/// <summary> /// 创建房间 /// </summary> /// <param name="pID">P I.</param> /// <param name="msg">Message.</param> /// <param name="action">Action.</param> public void sendMsg(GameProtocol pID, msgReqCreateRoom msg, Action <Message> action) { JsonObject jsonMsg = new JsonObject(); jsonMsg.Add("game", (int)msg.game); jsonMsg.Add("roomType", (int)msg.roomType); jsonMsg.Add("baseScore", msg.baseScore); jsonMsg.Add("minScore", msg.minScore); jsonMsg.Add("maxScore", msg.maxScore); jsonMsg.Add("roomName", msg.roomName); jsonMsg.Add("roomPassword", msg.roomPassword); jsonMsg.Add("rule", msg.rule); sendMsg(pID, jsonMsg, action); }
//------------------------------------以下是界面消息-------------------------------------------- void onEventCreateRoom(object data) { RoomEvent.sV2C_CreateRoom roomData = (RoomEvent.sV2C_CreateRoom)data; msgReqCreateRoom cr = new msgReqCreateRoom(); cr.game = GameType.GAME_LIANQI; cr.roomType = roomData.roomType; cr.baseScore = roomData.baseScore; cr.minScore = roomData.minScore; cr.maxScore = roomData.maxScore; cr.roomName = Account.getSelfData().name; cr.roomPassword = roomData.roomPassword; cr.rule = roomData.rule; ProtocolManager.getInstance().sendMsg(GameProtocol.P_GAME_REQ_CREATEROOM, cr, OnRespCreateRoom); ViewManagerEvent.EM().InvokeEvent(ViewManagerEvent.EVENT.SHOW_LOADING_ANI, true); }