mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import { _decorator, Component, Label, Node } from 'cc';
|
|
import { app, JNGLayerBase } from '../../App';
|
|
import { Toggle } from 'cc';
|
|
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
|
|
import { director } from 'cc';
|
|
import { WorldCanvas } from '../../WorldCanvas';
|
|
import { StorageData, StorageEnum } from '../../consts/GData';
|
|
import { GUI } from '../UIConfig';
|
|
import { API } from '../../consts/API';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('HomeView')
|
|
export class HomeView extends JNGLayerBase {
|
|
|
|
@property(Label)
|
|
frameText:Label;
|
|
|
|
async onLoad(){
|
|
app.layer.Open(GUI.Tips,{text:(await API.GetPlayerInfo()).msg});
|
|
}
|
|
|
|
update(){
|
|
this.frameText.string = `当前帧数: ${app.sync.frame}`;
|
|
}
|
|
|
|
//设置移动
|
|
setRoleMove(data:Toggle){
|
|
console.log("移动",data.isChecked);
|
|
}
|
|
|
|
//设置攻击
|
|
setRoleAttack(data){
|
|
console.log("攻击",data.isChecked);
|
|
}
|
|
|
|
//重置
|
|
onClickReset(){
|
|
app.sync.onReset();
|
|
}
|
|
|
|
//重置服务器帧
|
|
onClickResetServer(){
|
|
app.socket.Send(JNSyncAction.NSyncFrameReset);
|
|
}
|
|
|
|
//前往PVP
|
|
onClickGoPVP(){
|
|
director.getScene().getComponentInChildren(WorldCanvas).index = 0;
|
|
app.layer.Open(GUI.Tips,{text:"切换成功 请点击重置"});
|
|
}
|
|
//前往无尽
|
|
onClickGoOnHook(){
|
|
director.getScene().getComponentInChildren(WorldCanvas).index = 1;
|
|
app.layer.Open(GUI.Tips,{text:"切换成功 请点击重置"});
|
|
}
|
|
//清除Token
|
|
onClickToken(){
|
|
StorageData.delect(StorageEnum.Token);
|
|
app.layer.Open(GUI.Tips,{text:"清除成功"});
|
|
}
|
|
|
|
}
|
|
|
|
|