You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
913 B
47 lines
913 B
/**
|
|
* 再玩一次类
|
|
* @property {object} lib 库对象
|
|
* @property {object} btnAgain 面板元素对象
|
|
*/
|
|
function Again() {
|
|
this.lib = library;
|
|
|
|
this.btnAgain = null;
|
|
}
|
|
|
|
Again.of = (function () {
|
|
let instance = null;
|
|
return function () {
|
|
if (!instance) {
|
|
instance = new Again();
|
|
}
|
|
instance.init();
|
|
return instance;
|
|
};
|
|
})();
|
|
|
|
// 初始化
|
|
Again.prototype.init = function () {
|
|
this.showAgainBtn();
|
|
};
|
|
|
|
// 渲染背景面板
|
|
Again.prototype.showAgainBtn = function () {
|
|
const lib = this.lib;
|
|
const btnAgain = new lib.btnAgain();
|
|
btnAgain.x = lib.properties.width / 2;
|
|
btnAgain.y = lib.properties.height / 2 + 150;
|
|
this.btnAgain = btnAgain;
|
|
this.btnAgain.addEventListener(
|
|
'click',
|
|
function () {
|
|
if (config.mode === 0) {
|
|
againMessage();
|
|
} else {
|
|
location.reload();
|
|
}
|
|
},
|
|
false,
|
|
);
|
|
stage.addChild(btnAgain);
|
|
};
|
|
|