12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import { _decorator, Component, Node } from 'cc';
- import { ClientEvent } from '../clientEvent';
- import { Constant, matching_5_10_20_type } 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('jifenchangCreate')
- export class jifenchangCreate extends Component {
- @property(Node)
- btn_5: Node = null; //
- @property(Node)
- btn_10: Node = null; //
- @property(Node)
- btn_20: Node = null; //
- start() {
- let self = this;
- UIButton.BindClick(this.btn_5,()=>{
- this.sendMsg(matching_5_10_20_type._5)
- },this)
- UIButton.BindClick(this.btn_10,()=>{
- this.sendMsg(matching_5_10_20_type._10)
- },this)
- UIButton.BindClick(this.btn_20,()=>{
- this.sendMsg(matching_5_10_20_type._20)
- },this)
- ClientEvent.on(Constant.EVENT_TYPE.MSG_MATCHING_5_10_20,this.onCreate,this)
- }
- sendMsg(type:matching_5_10_20_type){
- switch (type) {
- case matching_5_10_20_type._5:
- msgManager.matching_5_10_20(matching_5_10_20_type._5)
- break;
-
- case matching_5_10_20_type._10:
- msgManager.matching_5_10_20(matching_5_10_20_type._10)
- break;
- case matching_5_10_20_type._20:
- msgManager.matching_5_10_20(matching_5_10_20_type._20)
- break;
- }
- UIManager.AddPrefab(GameMng.Instance.uiloading)
- }
- onDestroy(){
- ClientEvent.off(Constant.EVENT_TYPE.MSG_MATCHING_5_10_20,this.onCreate,this)
- }
- onCreate(room:roomData){
- console.log("room",room)
- UIManager.removeLoadingLayer()
- GameMng.updateRoomData(room)
- ScenceMng.Instance.load('Chess')
- }
- update(deltaTime: number) {
-
- }
- }
|