import { _decorator, Component, Node, Label } from 'cc'; import { ClientEvent } from './clientEvent'; import { Constant } from './constant'; import ChessMng, { ChessType } from './Game/DiffSel/ChessMng'; import { GameMng } from './GameMng'; import ScenceMng from './gcommon/ScenceMng'; import { UIButton } from './gcommon/UIButton'; import { UIManager } from './gcommon/UIManager'; import { msgManager } from './socket/msgManager'; import { roomData } from './UserData/roomData'; const { ccclass, property } = _decorator; @ccclass('joinRoom') export class joinRoom extends Component { @property(Node) btnClose: Node = null; @property(Node) btnReStart: Node = null; @property(Node) btnDelete: Node = null; @property(Node) btnSure: Node = null; @property(Node) labNumber: Node = null; @property(Node) numberNodeParent: Node = null; num:string = ""; start() { for (let index = 0; index < 10; index++) { var btn = this.numberNodeParent.getChildByName("number_"+index) UIButton.BindClick(btn,()=>{ this.updateLab(index+"") },this) } UIButton.BindClick(this.btnClose,()=>{ this.node.destroy() },this) UIButton.BindClick(this.btnReStart,()=>{ this.num = "" this.labNumber.getComponent(Label).string=this.num },this) UIButton.BindClick(this.btnDelete,()=>{ this.num = this.num.substring(0,this.num.length-1); this.labNumber.getComponent(Label).string = this.num },this) UIButton.BindClick(this.btnSure,()=>{ UIManager.AddPrefab(GameMng.Instance.uiloading) msgManager.joinRoom(this.num) },this) } onDestroy(){ } updateLab(number){ this.num=this.num+number this.labNumber.getComponent(Label).string = this.num } update(deltaTime: number) { } }