愤怒的小红帽

欢迎来到程序小院

愤怒的小红帽

玩法:帮助小红帽安全送达老奶奶家,当狼进入靶子以后鼠标对准靶子,
点击鼠标左键🏹,对应的狼就会被射死,然后继续往前冲,快去🏹吧^^。

开始游戏icon-default.png?t=N7T8https://www.ormcc.com/play/gameStart/244

html

<div style="position: relative;" id="gameDiv"></div>

css

body {
    text-align: center;
    background: #fff;
    padding: 0;
    border: 0;
    margin: 0;
    height: 100%;
}
#gameDiv, canvas {
    display: block;
    position: absolute;
    margin: 0 auto;
    padding: 0;
    border: 0;
}

js

egret_h5 = {};
egret_h5.prefix = "";
egret_h5.loadScript = function (list, callback) {
    var loaded = 0;
    var loadNext = function () {
        egret_h5.loadSingleScript(egret_h5.prefix + list[loaded], function () {
            loaded++;
            if (loaded >= list.length) {
                callback();
            }
            else {
                loadNext();
            }
        })
    };
    loadNext();
};
egret_h5.loadSingleScript = function (src, callback) {
    var s = document.createElement('script');
    if (s.hasOwnProperty("async")) {
        s.async = false;
    }
    s.src = src;
    s.addEventListener('load', function () {
        this.removeEventListener('load', arguments.callee, false);
        callback();
    }, false);
    document.body.appendChild(s);
};
egret_h5.preloadScript = function (list, prefix) {
    if (!egret_h5.preloadList) {
        egret_h5.preloadList = [];
    }
    egret_h5.preloadList = egret_h5.preloadList.concat(list.map(function (item) {
        return prefix + item;
    }))
};
egret_h5.startLoading = function () {
    var list = egret_h5.preloadList;
    egret_h5.loadScript(list, egret_h5.startGame);
};
var NullLocalStorage = (function () {
    function NullLocalStorage() {
        this.data = {};
    }
    NullLocalStorage.prototype.getItem = function (key) {
        return this.data[key];
    };
    NullLocalStorage.prototype.setItem = function (key, value) {
        this.data[key] = value;
    };
    NullLocalStorage.prototype.removeItem = function (key) {
        delete this.data[key];
    };
    NullLocalStorage.prototype.clear = function () {
        for (var key in this.data) {
            this.removeItem(key);
        }
    };
    return NullLocalStorage;
})();
var EgretLocalStorage = (function () {
    function EgretLocalStorage() {
        if (egret_webview.io.isFileExists(EgretLocalStorage.filePath)) {
            var str = egret_webview.io.readFile(EgretLocalStorage.filePath, null);
            this.data = JSON.parse(str);
        }
        else {
            this.data = {};
        }
    }

    EgretLocalStorage.prototype.getItem = function (key) {
        return this.data[key];
    };

    EgretLocalStorage.prototype.setItem = function (key, value) {
        this.data[key] = value;
        this.save();
    };

    EgretLocalStorage.prototype.removeItem = function (key) {
        delete this.data[key];
        this.save();
    };


    EgretLocalStorage.prototype.clear = function () {
        for (var key in this.data) {
            delete this.data[key];
        }
        this.save();
    };
    EgretLocalStorage.prototype.save = function () {
        egret_webview.io.writeFile(EgretLocalStorage.filePath, JSON.stringify(this.data), null);
    };
    EgretLocalStorage.filePath = "LocalStorage.local";
    return EgretLocalStorage;
})();
function EgretRuntimeBridgeInit() {
    if (typeof(egret_webview) == "undefined") {
        if (typeof(window.____egret_webview) == "undefined") {
            //Runtime出错了!!
            //alert("_js : window.____egret_webview undefined");
        }
        else {
            egret_webview = {};
            egret_webview.obj = window.____egret_webview;
            console.log("_js : egret_webview =  " + egret_webview.obj);
            egret_webview.io = window.____egtIO;
            console.log("_js : egret_webview.io =  " + egret_webview.io);
            egret_webview.audio = window.____egtAudio;
            console.log("_js : egret_webview.audio =  " + egret_webview.audio);
        }
    }
    if (window.hasOwnProperty("egret_webview") && typeof(egret_webview) != "undefined") {
        egret_webview.onDestory = function () {
        };
        egret_webview.onPause = function () {
        };
        egret_webview.onResume = function () {
        };
        egret.localStorage = new EgretLocalStorage();
    }
    else if (window && window.localStorage && window.localStorage.getItem) {
        egret.localStorage = window.localStorage;
    }
    else {
        egret.localStorage = new NullLocalStorage();
    }
}
window.EgretRuntimeBridgeInit = EgretRuntimeBridgeInit;

源码

需要源码请关注添加好友哦^ ^

转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-01-11 12:18:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-11 12:18:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-11 12:18:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-11 12:18:02       20 阅读

热门阅读

  1. 【Machine Learning】Other Stuff

    2024-01-11 12:18:02       29 阅读
  2. 数据结构之红黑树

    2024-01-11 12:18:02       44 阅读
  3. 深入解析 Golang 中的自旋锁

    2024-01-11 12:18:02       40 阅读
  4. Go语言中的Select:深度解析与实战案例

    2024-01-11 12:18:02       36 阅读
  5. jQuery —— ajaxForm和ajaxSubmit的用法与区别

    2024-01-11 12:18:02       39 阅读
  6. c JPEG 中MCU 的理解

    2024-01-11 12:18:02       39 阅读
  7. 探索YOLOv5微服务:gRPC Proto设计与优化策略

    2024-01-11 12:18:02       36 阅读
  8. 排序算法之快速排序

    2024-01-11 12:18:02       46 阅读
  9. Facebook新注册账号频被封?如何预防封号?

    2024-01-11 12:18:02       35 阅读
  10. Golang 中哪些类型可以作为 map 类型的 key?

    2024-01-11 12:18:02       32 阅读
  11. 地震数据的可视化

    2024-01-11 12:18:02       34 阅读