void OnRespCreateRoom(Message msg) { ViewManagerEvent.EM().InvokeEvent(ViewManagerEvent.EVENT.SHOW_LOADING_ANI, false); msgRespCreateRoom resp = msgRespCreateRoom.deserialize(msg); if (resp.flag == 0) { CommonUtil.RoomRule roomRule = CommonUtil.RoomRule.deserialize(resp.rule); RoomEvent.sV2C_JoinRoom data; data.playerNum = roomRule.playerNum; data.gridLevel = roomRule.gridLevel; data.plazaID = 0; data.pwd = resp.roomPassword; data.roomId = resp.roomId; data.plazaName = ""; data.tagId = -1; onEventJoinRoom((object)data); } else { CommonUtil.Util.showDialog("系统提示", "创建房间失败,参数有误或不满足开房条件"); } }
void onEventJoinRoom(object data) { RoomEvent.sV2C_JoinRoom roomData = (RoomEvent.sV2C_JoinRoom)data; msgReqJoinRoom jr = new msgReqJoinRoom(); jr.game = GameType.GAME_LIANQI; jr.playerNum = roomData.playerNum; jr.gridLevel = roomData.gridLevel; jr.pwd = roomData.pwd; //非用户创建无密码 jr.plazaID = roomData.plazaID; //根据plazalist得到,界面也是根据plazalisy生成 jr.roomId = roomData.roomId; //非用户创建房间填0,即通过各种模式直接进入游戏的 //如果plazaid和roomid同时为0 则认为是经典快速开始模式 if (roomData.plazaID == 0 && roomData.roomId == 0) { //需要从plazalist查找plazaid for (int i = 0; i < Lobby.Lobby.plazaList.Count; i++) { CommonUtil.RoomRule roomRule = CommonUtil.RoomRule.deserialize(Lobby.Lobby.plazaList[i].rule); if (Lobby.Lobby.plazaList[i].roomType == (int)CommonDefine.eCreateRoomType.ROOM_CLASSIC_PLAZA && roomRule.playerNum == roomData.playerNum && roomRule.gridLevel == roomData.gridLevel) { jr.plazaID = Lobby.Lobby.plazaList[i].plazaid; jr.roomId = 0; } } } //保存下如果是场模式的信息 Room.Room.setPlazaData(roomData.plazaName, roomData.tagId); ProtocolManager.getInstance().sendMsg(GameProtocol.P_GAME_REQ_JOINROOM, jr, OnRespJoinRoom); ViewManagerEvent.EM().InvokeEvent(ViewManagerEvent.EVENT.SHOW_LOADING_ANI, true); }
//----------------一些接口------------------------------------- public Plaza createPlaza(int index, LobbyEvent.Plaza data) { Plaza plaza = Instantiate(_plazaPrefab, new Vector3(0, 0, 0), Quaternion.identity); plaza.transform.SetParent(_plazaRoot.transform); plaza.transform.localPosition = new Vector3(index * _plazaInteral + _plazaInteral / 2, 0, 0); CommonUtil.RoomRule roomRule = CommonUtil.RoomRule.deserialize(data.rule); string rr; if (roomRule.lmtRound != 0) { rr = "回合限制" + roomRule.lmtRound; } else { rr = "回合无限制"; } if (roomRule.lmtTurnTime != 0) { rr = rr + " 思考时间" + roomRule.lmtTurnTime + "秒"; } else { rr = rr + " 思考时间无限制"; } plaza.updatePlaza(index, data.plazaid, data.name, data.star, data.des, rr, this); plaza.transform.localScale = plaza.transform.localScale * CommonUtil.Util.getScreenScale(); return(plaza); }