示例#1
0
 public UserManager(IRoom room)
 {
     mRoom = (Room)room;
     mSocketHander = mRoom.SocketHander;
     mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnUserEnterEvent, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_USER_ENTER, typeof(tagUserInfo));
     mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnUserStatusEvent, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_USER_STATUS, typeof(CMD_GR_UserStatus));
     mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnUserScoreEvent, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_USER_SCORE, typeof(CMD_GR_UserScore));
 }
示例#2
0
        public TableManager(IRoom room)
        {
            mRoom = (Room)room;
            mSocketHander = mRoom.SocketHander;

            //桌子信息
            mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnTableStatusEvent, (ushort)MAIN_CMD.MDM_GR_STATUS, (ushort)STATUS_SUB_CMD.SUB_GR_TABLE_STATUS, typeof(CMD_GR_TableStatus));
            mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnTableInfoEvent, (ushort)MAIN_CMD.MDM_GR_STATUS, (ushort)STATUS_SUB_CMD.SUB_GR_TABLE_INFO, typeof(CMD_GR_TableInfo));
            mSocketHander.AddListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, OnSystemMessageEvent, (ushort)MAIN_CMD.MDM_CM_SYSTEM, (ushort)SYSTEM_SUB_CMD.SUB_CM_SYSTEM_MESSAGE, typeof(CMD_CM_SystemMessage));
        }
示例#3
0
        public void Dispose()
        {
            mSocketHander.RemoveListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, (ushort)MAIN_CMD.MDM_GR_STATUS, (ushort)STATUS_SUB_CMD.SUB_GR_TABLE_STATUS);
            mSocketHander.RemoveListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, (ushort)MAIN_CMD.MDM_GR_STATUS, (ushort)STATUS_SUB_CMD.SUB_GR_TABLE_INFO);
            mSocketHander.RemoveListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, (ushort)MAIN_CMD.MDM_CM_SYSTEM, (ushort)SYSTEM_SUB_CMD.SUB_CM_SYSTEM_MESSAGE);

            mSocketHander = null;
            mRoom = null;
            mTableList.Clear();
            mTableList = null;
        }
示例#4
0
 public void Dispose()
 {
     mSocketHander.RemoveListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_USER_ENTER);
     mSocketHander.RemoveListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_REQUEST_FAILURE);
     mSocketHander.RemoveListener(this, ENUM_SOCKET_EVENT.EVENT_MESSAGE, (ushort)MAIN_CMD.MDM_GR_USER, (ushort)USER_SUB_CMD.SUB_GR_USER_STATUS);
     foreach(var pair in mPlayerDictionary)
     {
         pair.Value.Dispose();
     }
     mPlayerDictionary.Clear();
     mPlayerDictionary = null;
     mSocketHander = null;
     mRoom = null;
 }
示例#5
0
 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;
 }
示例#6
0
 public GameLoginTask(Room room)
 {
     Name = typeof(GameLoginTask).ToString();
     mRoom = room;
     Description = "正在连接到游戏服务器.";
 }
示例#7
0
 public WaitRoomCloseTask(Room room)
 {
     mRoom = room;
     Description = "等待游戏房间关闭.";
 }