/////////////////////////////LOBBY END//////////////////////////////////// //////////////////////////////ROOM//////////////////////////////////////// public void sendMsg(GameProtocol pID, msgReqJoinRoom msg, Action <Message> action) { JsonObject jsonMsg = new JsonObject(); jsonMsg.Add("game", (int)msg.game); jsonMsg.Add("roomId", msg.roomId); jsonMsg.Add("plazaID", msg.plazaID); jsonMsg.Add("playerNum", msg.playerNum); jsonMsg.Add("gridLevel", msg.gridLevel); jsonMsg.Add("pwd", msg.pwd); sendMsg(pID, jsonMsg, action); }
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); }