mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
保存
This commit is contained in:
@@ -8,6 +8,9 @@ import { app } from '../../App';
|
||||
import { GAction } from '../../consts/GAction';
|
||||
import { GAPI } from '../../consts/GAPI';
|
||||
import GOnHookManager, { GOnHookManagerEvent } from '../../manager/battle/mode/GOnHookManager';
|
||||
import { Button } from 'cc';
|
||||
import GOnHookData, { GOnHookDataEnum } from '../../data/GOnHookData';
|
||||
import { Sprite } from 'cc';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainView')
|
||||
@@ -18,6 +21,9 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
@property(Label)
|
||||
onHookLabel:Label; //挂机文本
|
||||
|
||||
@property(Button)
|
||||
nextLevelBtn:Button; //下一关按钮
|
||||
|
||||
onJNLoad(data?: any): void {
|
||||
|
||||
@@ -32,6 +38,7 @@ export class MainView extends JNGLayerBase {
|
||||
|
||||
//监听
|
||||
app.event.on(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
|
||||
app.event.on(GOnHookDataEnum.UPDATE,this.onUpdateOnHookInfo,this);
|
||||
|
||||
}
|
||||
|
||||
@@ -39,16 +46,23 @@ export class MainView extends JNGLayerBase {
|
||||
onJNClose(): void {
|
||||
super.onJNClose();
|
||||
//取消监听
|
||||
app.event.on(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
|
||||
app.event.off(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
|
||||
app.event.off(GOnHookDataEnum.UPDATE,this.onUpdateOnHookInfo,this);
|
||||
}
|
||||
|
||||
onUpdateOnHook(){
|
||||
this.onHookLabel.string = (GOnHookManager.getIns().isOnHook) ? "挂机中" : "挂机";
|
||||
}
|
||||
|
||||
onUpdateOnHookInfo(){
|
||||
this.nextLevelBtn.node.active = GOnHookData.getIns().isNextLevel;
|
||||
}
|
||||
|
||||
//更新UI界面
|
||||
onUpdateView(){
|
||||
this.playerNameLabel.string = `${PlayerData.getIns().getInfo().playerId}`;
|
||||
this.onUpdateOnHookInfo();
|
||||
this.onUpdateOnHook();
|
||||
}
|
||||
|
||||
//打开Demo页面
|
||||
|
Reference in New Issue
Block a user