/// <summary>
 /// 社交服准备关闭
 /// </summary>
 static public void OnCloseSocialSBefore(GameSession session)
 {
     if (SocialSession != null && SocialSession.SessionId == session.SessionId)
     {
         Console.WriteLine("社交服准备关闭");
         ServerSsMgr.DelSession(session);
         SocialSession = null;
     }
 }
 /// <summary>
 /// 挖豹子服准备关闭
 /// </summary>
 static public void OnCloseWabaoziSBefore(GameSession session)
 {
     if (WabaoziSession != null && WabaoziSession.SessionId == session.SessionId)
     {
         Console.WriteLine("挖豹子服准备关闭");
         ServerSsMgr.DelSession(session);
         WabaoziSession = null;
     }
 }
예제 #3
0
 /// <summary>
 /// 拉霸机服准备关闭
 /// </summary>
 static public void OnCloseSuperMonreySBefore(GameSession session)
 {
     if (SuperMonreySession != null && SuperMonreySession.SessionId == session.SessionId)
     {
         Console.WriteLine("拉霸机服准备关闭");
         ServerSsMgr.DelSession(session);
         SuperMonreySession = null;
     }
 }
        /// <summary>
        /// 大厅服准备关闭
        /// </summary>
        static public void OnCloseLSBefore(GameSession session)
        {
            var lobbySs = ServerSsMgr.GetLobbySession();

            if (lobbySs != null && lobbySs.SessionId == session.SessionId)
            {
                Console.WriteLine("大厅服断开连接");
                ServerSsMgr.SetLobbySession(null);
                ServerSsMgr.DelSession(session);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////大厅服/////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// 是否存在大厅服
        /// </summary>
        static public bool IsExistLS()
        {
            var lobbySs = ServerSsMgr.GetLobbySession();

            if (lobbySs != null)
            {
                if (lobbySs.IsHeartbeatTimeout)
                {
                    ServerSsMgr.SetLobbySession(null);
                    ServerSsMgr.DelSession(lobbySs);
                }
            }
            return(ServerSsMgr.GetLobbySession() != null);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /////////////////////////////////////////////////////其它///////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// 其它服断开处理
        /// </summary>
        /// <param name="session"></param>
        public static void OnOtherServerDisconnected(GameSession session)
        {
            string serverSid = session.SessionId;

            do
            {
                var serverInfo = sConnectServerSet.Find(m => m.CSSid == serverSid);
                if (serverInfo != null)
                {
                    Console.WriteLine("连接服断开连接,ServerId:{0},剩余:{1}", serverInfo.ServerId, sConnectServerSet.FindAll(false).Count - 1);
                    sConnectServerSet.Delete(serverInfo);
                    break;
                }
                if (ServerSsMgr.GetLobbySession() != null &&
                    ServerSsMgr.GetLobbySession().SessionId == session.SessionId)
                {
                    Console.WriteLine("大厅服断开连接");
                    ServerSsMgr.SetLobbySession(null);
                    break;
                }
                if (session.UserId == GlobalDefine.ServerIdType.SocialId.ToInt())
                {
                    Console.WriteLine("社交服断开连接");
                    SocialHelper.SocialSession = null;
                    break;
                }
                if (session.UserId == GlobalDefine.ServerIdType.SuperMonreyId.ToInt())
                {
                    Console.WriteLine("拉霸机服断开连接");
                    SuperMonreyHelper.SuperMonreySession = null;
                    break;
                }
                if (session.UserId == GlobalDefine.ServerIdType.WabaoziId.ToInt())
                {
                    Console.WriteLine("挖豹子服断开连接");
                    WbzServerHelper.WabaoziSession = null;
                    break;
                }
                var rsInfo = sRoomServerSet.Find(m => m.RSSid == serverSid);
                if (rsInfo != null)
                {
                    Console.WriteLine("房间服断开连接,ServerId:{0},剩余:{1}", rsInfo.ServerId, sRoomServerSet.FindAll(false).Count - 1);
                    sRoomServerSet.Delete(rsInfo);
                    break;
                }
            } while (false);
            //
            ServerSsMgr.DelSession(session);
        }
        /// <summary>
        /// 是否存在社交服
        /// </summary>
        static public bool IsExistSocialS()
        {
            var socialSs = ServerSsMgr.Get((int)GlobalDefine.ServerIdType.SocialId);

            if (socialSs != null)
            {
                if (socialSs.IsHeartbeatTimeout)
                {
                    ServerSsMgr.DelSession(socialSs);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            return(false);
        }
        /// <summary>
        /// 是否存在挖豹子服
        /// </summary>
        static public bool IsExistWabaoziS()
        {
            var wabaoziSs = WabaoziSession;

            if (wabaoziSs != null)
            {
                if (wabaoziSs.IsHeartbeatTimeout)
                {
                    ServerSsMgr.DelSession(wabaoziSs);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            return(false);
        }
        /// <summary>
        /// 是否存在连接服
        /// </summary>
        static public bool IsExistCS(int _serverId)
        {
            var connectServer = sConnectServerSet.FindKey(_serverId);

            if (connectServer != null)
            {
                var connectSs = ServerSsMgr.Get(connectServer.CSSid);
                if (connectSs != null)
                {
                    if (connectSs.IsHeartbeatTimeout)
                    {
                        ServerSsMgr.DelSession(connectSs);
                        sConnectServerSet.Delete(connectServer);
                        connectServer = null;
                    }
                }
            }

            return(connectServer != null);
        }
예제 #10
0
        /// <summary>
        /// 是否存在房间服
        /// </summary>
        static public bool IsExistRS(int _serverId)
        {
            var roomServer = sRoomServerSet.FindKey(_serverId);

            if (roomServer != null)
            {
                var roomSs = ServerSsMgr.Get(roomServer.RSSid);
                if (roomSs != null)
                {
                    if (roomSs.IsHeartbeatTimeout)
                    {
                        ServerSsMgr.DelSession(roomSs);
                        sRoomServerSet.Delete(roomServer);
                        roomServer = null;
                    }
                }
            }

            return(roomServer != null);
        }