Наследование: global::ProtoBuf.IExtensible
Пример #1
0
 internal void HandleUserQuit(Msg_LR_UserQuit msg, PBChannel channel)
 {
     Room room = GetRoomByID(msg.RoomID);
     if (null != room) {
         User user = room.GetUserByGuid(msg.UserGuid);
         if (null != user) {
             room.DeleteUser(user);
         }
     }
     Msg_RL_UserQuit replyBuilder = new Msg_RL_UserQuit();
     replyBuilder.UserGuid = msg.UserGuid;
     replyBuilder.RoomID = msg.RoomID;
     channel.Send(replyBuilder);
 }
Пример #2
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);
     }
 }
 internal void QuitRoom(ulong guid, bool is_quit_room, int srcHandle)
 {
     UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(guid);
     if (user != null) {
         if (user.CurrentState == UserState.Room) {
             RoomInfo room = user.Room;
             if (null != room) {
                 Msg_LR_UserQuit msg = new Msg_LR_UserQuit();
                 msg.UserGuid = guid;
                 msg.RoomID = room.RoomId;
                 LobbyServer.Instance.RoomSvrChannel.Send(room.RoomServerName, msg);
             }
         } else if (null != user.Room) {
             user.Room.DelUsers(guid);
             user.ResetRoomInfo();
             user.CurrentState = UserState.Online;
             user.LeftLife = UserInfo.c_LifeTimeWaitOffline;
         }
         LogSys.Log(LOG_TYPE.INFO, "QuitRoom Guid {0} state {1}", guid, user.CurrentState);
     } else {
         Msg_BL_QueryUserStateResult builder = new Msg_BL_QueryUserStateResult();
         builder.Guid = guid;
         builder.State = (int)UserState.DropOrOffline;
         LobbyServer.Instance.UserChannel.Send(srcHandle, builder);
     }
 }
        internal void UserOffline(ulong guid, int srcHandle)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(guid);
            if (user != null) {
                if (null != user.Room) {
                    Msg_LR_UserQuit msg = new Msg_LR_UserQuit();
                    msg.UserGuid = guid;
                    msg.RoomID = user.Room.RoomId;
                    LobbyServer.Instance.RoomSvrChannel.Send(user.Room.RoomServerName, msg);

                    Msg_BL_UserOffline builder = new Msg_BL_UserOffline();
                    builder.Guid = guid;
                    LobbyServer.Instance.UserChannel.Send(srcHandle, builder);

                    LogSys.Log(LOG_TYPE.INFO, "UserOffline, guid:{0}", guid);
                }
            }
        }
        //响应RoomServer发来的房间内玩家掉线消息
        internal void OnRoomUserDrop(int roomid, ulong guid, bool isBattleEnd, Msg_RL_UserDrop originalMsg)
        {
            UserInfo user = LobbyServer.Instance.UserProcessScheduler.GetUserInfo(guid);
            if (user != null) {
                if (isBattleEnd) {
                    user.CurrentRoomID = 0;
                    user.CurrentState = UserState.Room == user.CurrentState ? UserState.Online : user.CurrentState;
                } else {
                    user.CurrentRoomID = roomid;
                }
                RoomInfo curRoom = user.Room;
                RoomInfo oldRoom = m_LobbyInfo.GetRoomByID(roomid);
                if (null != oldRoom && oldRoom != curRoom) {
                    Msg_LR_UserQuit msg = new Msg_LR_UserQuit();
                    msg.UserGuid = guid;
                    msg.RoomID = roomid;
                    LobbyServer.Instance.RoomSvrChannel.Send(oldRoom.RoomServerName, msg);
                }
                LobbyServer.Instance.ForwardToWorld(user.UserSvrName, originalMsg);

                LogSys.Log(LOG_TYPE.INFO, "RoomServer User Drop! Guid {0} State {1} IsEnd {2}", guid, user.CurrentState, isBattleEnd);
            } else {
                RoomInfo oldRoom = m_LobbyInfo.GetRoomByID(roomid);
                if (null != oldRoom) {
                    Msg_LR_UserQuit msg = new Msg_LR_UserQuit();
                    msg.UserGuid = guid;
                    msg.RoomID = roomid;
                    LobbyServer.Instance.RoomSvrChannel.Send(oldRoom.RoomServerName, msg);
                }

                LogSys.Log(LOG_TYPE.INFO, "RoomServer User Drop! Guid {0} State Offline IsEnd {1}", guid, isBattleEnd);
            }
        }