16 changed files with 395 additions and 261 deletions
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,38 @@ |
|||||
|
/** |
||||
|
* 再玩一次类 |
||||
|
* @property {object} lib 库对象 |
||||
|
* @property {object} btnAgain 面板元素对象 |
||||
|
*/ |
||||
|
function Again() { |
||||
|
this.lib = library; |
||||
|
|
||||
|
this.btnAgain = null; |
||||
|
} |
||||
|
|
||||
|
Again.of = function () { |
||||
|
const 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 () { |
||||
|
location.reload(); |
||||
|
}, |
||||
|
false, |
||||
|
); |
||||
|
stage.addChild(btnAgain); |
||||
|
}; |
@ -0,0 +1,41 @@ |
|||||
|
/** |
||||
|
* 演示模式类 |
||||
|
* @property {object} lib 库对象 |
||||
|
* @property {object} stopDemo 面板元素对象 |
||||
|
*/ |
||||
|
function Demo() { |
||||
|
this.lib = library; |
||||
|
|
||||
|
this.stopDemo = null; |
||||
|
} |
||||
|
|
||||
|
Demo.of = function () { |
||||
|
const instance = new Demo(); |
||||
|
instance.init(); |
||||
|
return instance; |
||||
|
}; |
||||
|
|
||||
|
// 初始化
|
||||
|
Demo.prototype.init = function () { |
||||
|
this.showStopDemo(); |
||||
|
}; |
||||
|
|
||||
|
// 显示演示模式按钮
|
||||
|
Demo.prototype.showStopDemo = function () { |
||||
|
const lib = this.lib; |
||||
|
const stopDemo = new lib.stopDemo(); |
||||
|
stopDemo.x = 50; |
||||
|
stopDemo.y = lib.properties.height - 100; |
||||
|
this.stopDemo = stopDemo; |
||||
|
// 关闭演示模式
|
||||
|
this.stopDemo.addEventListener( |
||||
|
'click', |
||||
|
function () { |
||||
|
stage.removeChild(stopDemo); |
||||
|
location.hash = ''; |
||||
|
location.reload(); |
||||
|
}, |
||||
|
false, |
||||
|
); |
||||
|
stage.addChild(stopDemo); |
||||
|
}; |
Loading…
Reference in new issue