网页切换到后台暂停游戏
This commit is contained in:
@@ -143,6 +143,16 @@ export class Stage extends Laya.Script {
|
|||||||
this.btn_hint_ad = this.btn_hint.getChildByName("Image").getChildByName("ad") as Laya.Box
|
this.btn_hint_ad = this.btn_hint.getChildByName("Image").getChildByName("ad") as Laya.Box
|
||||||
this.btn_hint_label = this.btn_hint.getChildByName("Image").getChildByName("normal").getChildByName("label") as Laya.Label
|
this.btn_hint_label = this.btn_hint.getChildByName("Image").getChildByName("normal").getChildByName("label") as Laya.Label
|
||||||
|
|
||||||
|
|
||||||
|
//失去舞台焦点(切出游戏)的处理
|
||||||
|
Laya.stage.on(Laya.Event.BLUR, this, () => {
|
||||||
|
Stage.EventUpdatePause(true)
|
||||||
|
})
|
||||||
|
//获得舞台焦点(切回游戏)的处理
|
||||||
|
Laya.stage.on(Laya.Event.FOCUS, this, () => {
|
||||||
|
Stage.EventUpdatePause(false)
|
||||||
|
})
|
||||||
|
|
||||||
EventManager.getInstance().RegisterEvent(EVENT_TYPES.NOT_UPDATE_MISTAKE, Stage.EventUpdateMistake)
|
EventManager.getInstance().RegisterEvent(EVENT_TYPES.NOT_UPDATE_MISTAKE, Stage.EventUpdateMistake)
|
||||||
EventManager.getInstance().RegisterEvent(EVENT_TYPES.NOT_UPDATE_PAUSE, Stage.EventUpdatePause)
|
EventManager.getInstance().RegisterEvent(EVENT_TYPES.NOT_UPDATE_PAUSE, Stage.EventUpdatePause)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ const { regClass, property } = Laya
|
|||||||
export class DailyChallenge extends Laya.Script {
|
export class DailyChallenge extends Laya.Script {
|
||||||
declare owner: Laya.Box
|
declare owner: Laya.Box
|
||||||
|
|
||||||
|
|
||||||
@property(Laya.Sprite)
|
@property(Laya.Sprite)
|
||||||
public sprite_bottom: Laya.Sprite
|
public sprite_bottom: Laya.Sprite
|
||||||
|
|
||||||
@@ -306,7 +305,5 @@ export class DailyChallenge extends Laya.Script {
|
|||||||
UIManager.getInstance().loadTrophyClaimUI(find)
|
UIManager.getInstance().loadTrophyClaimUI(find)
|
||||||
user.set_trophyNew(find, false)
|
user.set_trophyNew(find, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user