예제 #1
0
        private void HandleUserQuit(Msg_LR_UserQuit msg, PBChannel channel, int handle, uint seq)
        {
            bool isFieldThread;
            int  ix = GetActiveRoomThreadIndex(msg.RoomID, out isFieldThread);

            if (ix >= 0)
            {
                if (isFieldThread)
                {
                    RoomThread roomThread = field_roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleUserQuit, msg, channel);
                }
                else
                {
                    RoomThread roomThread = roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleUserQuit, msg, channel);
                }
            }
            else
            {
                Msg_RL_UserQuit replyBuilder = new Msg_RL_UserQuit();
                replyBuilder.UserGuid = msg.UserGuid;
                replyBuilder.RoomID   = msg.RoomID;
                channel.Send(replyBuilder);
            }
        }
예제 #2
0
        private void HandleReconnectUser(Msg_LR_ReconnectUser urMsg, PBChannel channel, int handle, uint seq)
        {
            bool isFieldThread;
            int  ix = GetActiveRoomThreadIndex(urMsg.RoomID, out isFieldThread);

            if (ix < 0)
            {
                Msg_RL_ReplyReconnectUser replyBuilder = new Msg_RL_ReplyReconnectUser();
                replyBuilder.UserGuid = urMsg.UserGuid;
                replyBuilder.RoomID   = urMsg.RoomID;
                replyBuilder.Result   = (int)Msg_RL_ReplyReconnectUser.ReconnectResultEnum.NotExist;
                channel.Send(replyBuilder);
            }
            else
            {
                if (isFieldThread)
                {
                    RoomThread roomThread = field_roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleReconnectUser, urMsg, channel, handle, seq);
                }
                else
                {
                    RoomThread roomThread = roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleReconnectUser, urMsg, channel, handle, seq);
                }
            }
        }
예제 #3
0
        private void HandleActiveScene(Msg_LR_ActiveScene msg, PBChannel channel, int handle, uint seq)
        {
            int          roomid    = msg.RoomID;
            int          sceneId   = msg.SceneID;
            List <ulong> users     = msg.UserGuids;
            int          thread_id = GetIdleThread();

            if (thread_id < 0)
            {
                LogSys.Log(LOG_TYPE.ERROR, "all room are using, active room failed!");
                Msg_RL_ActiveSceneResult retMsg = new Msg_RL_ActiveSceneResult();
                retMsg.UserGuids.AddRange(users);
                retMsg.RoomID = roomid;
                retMsg.Result = (int)SceneOperationResultEnum.Cant_Find_Room;
                return;
            }
            RoomThread roomThread = roomthread_list_[thread_id];

            AddActiveRoom(roomid, thread_id, false);
            roomThread.PreActiveRoom();
            LogSys.Log(LOG_TYPE.INFO, "queue active room {0} scene {1} thread {2}", roomid, sceneId, thread_id);
            roomThread.QueueAction(roomThread.ActiveRoom, roomid, sceneId, (MyAction <bool>)((bool val) => {
                Msg_RL_ActiveSceneResult retMsg = new Msg_RL_ActiveSceneResult();
                retMsg.UserGuids.AddRange(users);
                retMsg.RoomID = roomid;
                retMsg.Result = val ? (int)SceneOperationResultEnum.Success : (int)SceneOperationResultEnum.Cant_Find_Room;
            }));
        }
예제 #4
0
        internal void ChangeRoomScene(int roomid, int sceneId)
        {
            bool isFieldThread;
            int  ix = GetActiveRoomThreadIndex(roomid, out isFieldThread);

            if (ix >= 0 && !isFieldThread)
            {
                RoomThread thread = roomthread_list_[ix];
                thread.QueueAction(thread.ChangeRoomScene, roomid, sceneId, (MyAction <bool>)((bool success) => {
                }));
            }
        }
예제 #5
0
        private void HandleRoomStoryMessage(Msg_LRL_StoryMessage msg, PBChannel channel, int handle, uint seq)
        {
            bool isFieldRoom;
            int  ix = GetActiveRoomThreadIndex(msg.RoomId, out isFieldRoom);

            if (ix >= 0)
            {
                if (isFieldRoom)
                {
                    RoomThread roomThread = field_roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleRoomStoryMessage, msg, channel);
                }
                else
                {
                    RoomThread roomThread = roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleRoomStoryMessage, msg, channel);
                }
            }
        }
예제 #6
0
        private void HandleReclaimItem(Msg_LR_ReclaimItem msg, PBChannel channel, int handle, uint seq)
        {
            bool isFieldThread;
            int  ix = GetActiveRoomThreadIndex(msg.RoomID, out isFieldThread);

            if (ix >= 0)
            {
                if (isFieldThread)
                {
                    RoomThread roomThread = field_roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleReclaimItem, msg, channel);
                }
                else
                {
                    RoomThread roomThread = roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleReclaimItem, msg, channel);
                }
            }
        }
예제 #7
0
        private void HandleUserRelive(Msg_LR_UserReLive msg, PBChannel channel, int handle, uint seq)
        {
            bool isFieldThread;
            int  ix = GetActiveRoomThreadIndex(msg.RoomID, out isFieldThread);

            if (ix >= 0)
            {
                if (isFieldThread)
                {
                    RoomThread roomThread = field_roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleUserRelive, msg);
                }
                else
                {
                    RoomThread roomThread = roomthread_list_[ix];
                    roomThread.QueueAction(roomThread.HandleUserRelive, msg);
                }
            }
        }