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 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)); }
public static void Buffer_ReplyID(ReplyID replyID) { p_AllMsg.ReplyID.your_connectID = replyID.your_connectID; p_AllMsg.ReplyID.type = replyID.type; }