123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { _decorator, Component, Node } from 'cc';
- import { ClientEvent } from '../clientEvent';
- import { Constant, matching_5_10_20_type, room_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 { native_manager } from '../native_manager';
- import { msgManager } from '../socket/msgManager';
- import { roomData } from '../UserData/roomData';
- const { ccclass, property } = _decorator;
- @ccclass('tongqianCreate')
- export class tongqianCreate extends Component {
- @property(Node)
- btn_chuji: Node = null; //
- @property(Node)
- btn_zhongji: Node = null; //
- @property(Node)
- btn_gaoji: Node = null; //
- @property(Node)
- btn_ads_tongqian: Node = null; //
- start() {
- let self = this;
- UIButton.BindClick(this.btn_chuji,()=>{
- this.sendMsg(room_type._chuji_tongqian)
- },this)
- UIButton.BindClick(this.btn_zhongji,()=>{
- this.sendMsg(room_type._zhongji_tongqian)
- },this)
- UIButton.BindClick(this.btn_ads_tongqian,()=>{
- native_manager.showRewardVideo()
- },this)
- ClientEvent.on(Constant.EVENT_TYPE.MSG_CREATE_ROOM,this.onRecvCreateRoom,this)
- }
- sendMsg(type:room_type){
- switch (type) {
- case room_type._chuji_tongqian:
- msgManager.createRoomByRoomType(room_type._chuji_tongqian)
- break;
- case room_type._zhongji_tongqian:
- msgManager.createRoomByRoomType(room_type._zhongji_tongqian)
- break;
- }
- UIManager.AddPrefab(GameMng.Instance.uiloading)
- }
- onDestroy(){
- ClientEvent.off(Constant.EVENT_TYPE.MSG_CREATE_ROOM,this.onRecvCreateRoom,this)
- }
- onRecvCreateRoom(room:roomData){
- console.log("room",room)
- UIManager.removeLoadingLayer()
- GameMng.updateRoomData(room);
- ScenceMng.Instance.load('Chess')
- }
- }
|