void CreateRoom(string roomName) { room = new RoomMessage(roomName, NetworkTools.GetLocalIP()); NetworkManager._Instance.AddCallBack(2, SendRoomMsg); NetworkManager._Instance.AddCallBack(7, AddRoomMsgCallBack); NetworkManager._Instance.AddCallBack(9, QuitRoomMsgCallBack); NetworkManager._Instance.AddCallBack(10, UpdateRoomPlayerMsgCallBack); NetworkManager._Instance.AddCallBack(14, ReciveGetPlayerInfos); StartServer(); playerData = new RoomPlayerData(); playerData.AddPlayerInfo(NetworkTools.GetLocalIP(), new RoomPlayerInfoMessage("", true, NetworkTools.GetLocalIP())); playerInfo = new PlayerInfoMessage(1, 101, 102, "房主", NetworkTools.GetLocalIP()); //RoomSingle.AddPlayer(new PlayerInfoMessage(2,104,105,"房主",NetworkTools.GetLocalIP())); NetworkManager._Instance.AddMessage(102, playerData); EventCenterManager._Instance.AddListener(EventType.GetPlayerInfo, GetPlayerInfoCallBack); EventCenterManager._Instance.AddListener(EventType.SetPlayerInfo, SetPlayerInfoCallBack); }
private void Awake() { base.BaseAwake(); wait = GetComponent <WaitStartRoomUI>(); playerData = new RoomPlayerData(); }