Commit 1c5772e1 authored by Master Q's avatar Master Q

方连点

parent 58a746b7
This diff is collapsed.
...@@ -97,4 +97,12 @@ export default class CountDownComp extends Module { ...@@ -97,4 +97,12 @@ export default class CountDownComp extends Module {
} }
destory() {
this.stop()
this.timeoutFn.length = 0
super.destroy()
}
} }
\ No newline at end of file
...@@ -36,17 +36,18 @@ export class GameOverPanel extends Panel { ...@@ -36,17 +36,18 @@ export class GameOverPanel extends Panel {
var icon = UI.Sp(panelCtn, 'prize-icon1.png', panelCtn.width / 2, 580) var icon = UI.Sp(panelCtn, 'prize-icon1.png', panelCtn.width / 2, 580)
icon.anchorTexture.set(0.5, 0.5) icon.anchorTexture.set(0.5, 0.5)
icon.addEventListener(FYGE.MouseEvent.CLICK, async function() { icon.addEventListener(FYGE.MouseEvent.CLICK, async function() {
const {data, success} = await sendTbNet(TbNetName.drawLotteryPrize) this.btnDelay(this)
if (success) { const {data, success} = await sendTbNet(TbNetName.drawLotteryPrize)
if (data.type != 5) { if (success) {
// 中奖了 if (data.type != 5) {
this.hidePanel() // 中奖了
showPanel(PrizeShowPanel, Object.assign({}, data, this.data)) this.hidePanel()
} else { showPanel(PrizeShowPanel, Object.assign({}, data, this.data))
this.hidePanel() } else {
changeScene(GameOverScene, this.data) this.hidePanel()
} changeScene(GameOverScene, this.data)
} }
}, this) }
}, this)
} }
} }
\ No newline at end of file
...@@ -27,6 +27,7 @@ export class PrizeShowPanel extends Panel { ...@@ -27,6 +27,7 @@ export class PrizeShowPanel extends Panel {
.endFill() .endFill()
UI.Btn(panelCtn, 'confirm-btn.png', function() { UI.Btn(panelCtn, 'confirm-btn.png', function() {
this.btnDelay(this)
if (this.data.type == 3) { if (this.data.type == 3) {
this.hidePanel() this.hidePanel()
changeScene(GameOverScene, this.data) changeScene(GameOverScene, this.data)
......
...@@ -36,17 +36,19 @@ export class GameOverScene extends Scene { ...@@ -36,17 +36,19 @@ export class GameOverScene extends Scene {
}, this, 45, 950) }, this, 45, 950)
UI.Btn(this, 'more-btn.png', function() { UI.Btn(this, 'more-btn.png', function() {
this.btnDelay(this)
// @ts-ignore // @ts-ignore
my.redirectTo({ my.reLaunch({
url: '/pages/mainscene/mainscene' url: '/pages/mainscene/mainscene'
}) })
}, this, 45, 1110) }, this, 45, 1110)
var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350) var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350)
_s.addEventListener(FYGE.MouseEvent.CLICK, function() { _s.addEventListener(FYGE.MouseEvent.CLICK, function() {
this.btnDelay(this)
// todo // todo
console.log('回到主场') console.log('回到主场')
}) }, this)
_s.anchorTexture.set(0.5, 0.5) _s.anchorTexture.set(0.5, 0.5)
var bottomCont = UI.Ctn(this) var bottomCont = UI.Ctn(this)
...@@ -57,10 +59,11 @@ export class GameOverScene extends Scene { ...@@ -57,10 +59,11 @@ export class GameOverScene extends Scene {
UI.Txt(bottomCont, '让你的体态更加健康', 26, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 75) UI.Txt(bottomCont, '让你的体态更加健康', 26, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 75)
UI.Sp(bottomCont, 'jump-icon.png', 600, 40) UI.Sp(bottomCont, 'jump-icon.png', 600, 40)
.addEventListener(FYGE.MouseEvent.CLICK, function() { .addEventListener(FYGE.MouseEvent.CLICK, function() {
this.btnDelay(this)
// @ts-ignore // @ts-ignore
// my. // my.
console.log(this.data.productLink) console.log(this.data.productLink)
}) }, this)
} }
} }
\ No newline at end of file
...@@ -100,8 +100,7 @@ export class GameScene extends MotionInitScene { ...@@ -100,8 +100,7 @@ export class GameScene extends MotionInitScene {
var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime)) var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime))
this.cdp.addTimeoutFunc(() => { this.cdp.addTimeoutFunc(() => {
this.cdp.visible = false this.cdp.destory()
// 销毁 instance // 销毁 instance
DeviceMotion.instance.destory() DeviceMotion.instance.destory()
//@ts-ignore //@ts-ignore
...@@ -128,7 +127,7 @@ export class GameScene extends MotionInitScene { ...@@ -128,7 +127,7 @@ export class GameScene extends MotionInitScene {
} }
async onSubmit(params) { async onSubmit(params) {
const {data, success} = await sendTbNet(TbNetName.submitGame, params) const {data, success, message} = await sendTbNet(TbNetName.submitGame, params)
if (success) { if (success) {
const {score, isNewRecord, productLink, isWinPrize} = data const {score, isNewRecord, productLink, isWinPrize} = data
if (isWinPrize) { if (isWinPrize) {
...@@ -146,6 +145,12 @@ export class GameScene extends MotionInitScene { ...@@ -146,6 +145,12 @@ export class GameScene extends MotionInitScene {
isWinPrize isWinPrize
}) })
} }
} else {
//@ts-ignore
my && my.showToast({
content: message
});
sendTbNet(TbNetName.navigateBack)
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment