60 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-10-23 18:56:01 +08:00
import { _decorator, Component, Label, Node } from 'cc';
import { app, JNGLayerBase } from '../../App';
2023-10-24 19:12:25 +08:00
import { Toggle } from 'cc';
2023-10-30 18:53:21 +08:00
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
2023-11-03 02:57:38 +08:00
import { director } from 'cc';
import { WorldCanvas } from '../../WorldCanvas';
2023-11-08 02:32:54 +08:00
import { StorageData, StorageEnum } from '../../consts/GData';
import { GUI } from '../UIConfig';
2023-10-23 18:56:01 +08:00
const { ccclass, property } = _decorator;
@ccclass('HomeView')
export class HomeView extends JNGLayerBase {
@property(Label)
frameText:Label;
update(){
this.frameText.string = `当前帧数: ${app.sync.frame}`;
}
2023-10-24 19:12:25 +08:00
//设置移动
setRoleMove(data:Toggle){
console.log("移动",data.isChecked);
}
2023-10-26 18:53:08 +08:00
2023-10-24 19:12:25 +08:00
//设置攻击
setRoleAttack(data){
console.log("攻击",data.isChecked);
}
2023-10-26 18:53:08 +08:00
//重置
onClickReset(){
app.sync.onReset();
2023-10-30 18:53:21 +08:00
}
//重置服务器帧
onClickResetServer(){
app.socket.Send(JNSyncAction.NSyncFrameReset);
2023-10-26 18:53:08 +08:00
}
2023-11-03 02:57:38 +08:00
//前往PVP
onClickGoPVP(){
director.getScene().getComponentInChildren(WorldCanvas).index = 0;
2023-11-08 02:32:54 +08:00
app.layer.Open(GUI.Tips,{text:"切换成功 请点击重置"});
2023-11-03 02:57:38 +08:00
}
//前往无尽
onClickGoOnHook(){
director.getScene().getComponentInChildren(WorldCanvas).index = 1;
2023-11-08 02:32:54 +08:00
app.layer.Open(GUI.Tips,{text:"切换成功 请点击重置"});
}
//清除Token
onClickToken(){
StorageData.delect(StorageEnum.Token);
app.layer.Open(GUI.Tips,{text:"清除成功"});
2023-11-03 02:57:38 +08:00
}
2023-10-23 18:56:01 +08:00
}