public Room(tagGameServer Server, tagGameKind Kind) { mGameServer = Server; mKind = Kind; mUserManager = new UserManager(this); mTableManager = new TableManager(this); // mFrameManger = new GameClientManager(this); mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnRequestFailureEvent, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_REQUEST_FAILURE, typeof(CMD_GR_RequestFailure)); //游戏配置 mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnCongigColumnEvent, (ushort)MAIN_CMD.MDM_GR_CONFIG, (ushort)CONFIG_SUB_CMD.SUB_GR_CONFIG_COLUMN, typeof(CMD_GR_ConfigColumn)); mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnCongigServerEvent, (ushort)MAIN_CMD.MDM_GR_CONFIG, (ushort)CONFIG_SUB_CMD.SUB_GR_CONFIG_SERVER, typeof(CMD_GR_ConfigServer)); mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnCongigPropertyEvent, (ushort)MAIN_CMD.MDM_GR_CONFIG, (ushort)CONFIG_SUB_CMD.SUB_GR_CONFIG_PROPERTY, typeof(CMD_GR_ConfigProperty)); mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnCongigFinishEvent, (ushort)MAIN_CMD.MDM_GR_CONFIG, (ushort)CONFIG_SUB_CMD.SUB_GR_CONFIG_FINISH); }
internal bool EnterRoom(tagGameServer Server, tagGameKind Kind) { if (FindByServerID(Server.wServerID) != null) return false; Room room = new Room(Server, Kind); mRoomList.Add(room); TaskExecute execute = new TaskExecute(); execute.Push(new GameLoginTask(room)); execute.Push(new WaitRoomCloseTask(room)); execute.Execute(delegate(TASK_EVENT ev, BaseTask task) { DebugKit.Log("KL", "RoomManager.EnterRoom: " + ev.ToString()); switch (ev) { case TASK_EVENT.TASK_COMPLETE: { if (OnRoomEvent != null) { OnRoomEvent(new RoomEvent(room,ENUM_ROOM_EVENT.SHOW_ERROR)); room.Dispose(); } } break; case TASK_EVENT.TASK_FINISH: { if(task.Name == typeof(GameLoginTask).ToString()) { if (OnRoomEvent != null) OnRoomEvent(new RoomEvent(room, ENUM_ROOM_EVENT.SHOW_ROOM)); } } break; case TASK_EVENT.TASK_EXECUTE: break; case TASK_EVENT.TASK_CANCEL: { OnRoomEvent(new RoomEvent(room, ENUM_ROOM_EVENT.SHOW_ERROR, task.Message)); room.Dispose(); } break; } }); return true; }