PC-20230316NUNE\Administrator 64ab2b0fe5 update
2023-10-30 18:53:21 +08:00

48 lines
1.2 KiB
TypeScript

import { _decorator, Component, Label, Node } from 'cc';
import { app, JNGLayerBase } from '../../App';
import { director } from 'cc';
import GRolePVPEntity from '../../battle/base/role/PVP/GRolePVPEntity';
import { Toggle } from 'cc';
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
const { ccclass, property } = _decorator;
@ccclass('HomeView')
export class HomeView extends JNGLayerBase {
@property(Label)
frameText:Label;
update(){
this.frameText.string = `当前帧数: ${app.sync.frame}`;
}
//设置移动
setRoleMove(data:Toggle){
console.log("移动",data.isChecked);
director.getScene().getComponentsInChildren(GRolePVPEntity).forEach((role) => {
role.input.isRun = data.isChecked;
})
}
//设置攻击
setRoleAttack(data){
console.log("攻击",data.isChecked);
director.getScene().getComponentsInChildren(GRolePVPEntity).forEach((role) => {
role.input.isAttack = data.isChecked;
})
}
//重置
onClickReset(){
app.sync.onReset();
}
//重置服务器帧
onClickResetServer(){
app.socket.Send(JNSyncAction.NSyncFrameReset);
}
}