void SendRoomInfo(int clientID, int flag, Room room) { List <string> ids = room.GetIDList(); NetworkMsg msg = new ReplyJoin(flag, ids); networkManager.SendDataTo(clientID, msg); msg = new ReplyJoin(-1, ids); room.roomBroadCast(msg); }
public void OnPlayerJoin(int clientID) { room.JoinRoom(clientID); List <string> player_name = room.GetPlayerID(); NetworkMsg msg = new ReplyJoin(clientID, player_name); NetworkMsg msg2 = new ReplyID(clientID); networkManager.SendDataTo(clientID, msg2); //Debug.Log("sending replyID = " + clientID.ToString()); room.roomBroadCast(msg); }
public static void Buffer_ReplyJoin(ReplyJoin replyJoin) { p_AllMsg.ReplyJoin.real_player_id = replyJoin.real_player_id; p_AllMsg.ReplyJoin.player_names = replyJoin.player_names; p_AllMsg.ReplyJoin.type = replyJoin.type; }
public static byte[] SerializeData(BaseProtocol baseProtocol, NetworkMsg networkMsg, ReplyGetRooms replyGetRooms = null, ReplyJoin replyJoin = null, ReplyAskFrame replyAskFrame = null, ReplyID replyID = null, ReplyStart replyStart = null) { p_AllMsg = new p_AllMsg(); if (baseProtocol != null) { Buffer_BaseProtocol(baseProtocol); } if (networkMsg != null) { Buffer_NetworkMsg(networkMsg); } if (networkMsg.type == (int)CmdType.REPLYGETROOMS) { replyGetRooms = networkMsg as ReplyGetRooms; Buffer_ReplyGetRooms(replyGetRooms); } else if (networkMsg.type == (int)CmdType.REPLYJOIN) { replyJoin = networkMsg as ReplyJoin; Buffer_ReplyJoin(replyJoin); } else if (networkMsg.type == (int)CmdType.REPLYASKFRAME) { replyAskFrame = networkMsg as ReplyAskFrame; Buffer_ReplyAskFrame(replyAskFrame); } else if (networkMsg.type == (int)CmdType.REPLYSTART) { replyStart = networkMsg as ReplyStart; BufferReplyStart(replyStart); } else if (networkMsg.type == (int)CmdType.REPLYID) { replyID = networkMsg as ReplyID; Buffer_ReplyID(replyID); } return(Serialize <p_AllMsg>(p_AllMsg)); }