/// <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> public static void SetLS(int serverId, GameSession ss) { //判断 if (!ss.IsAuthorized) { TraceLog.WriteError("非法开启大厅服,ServerId:{0}", serverId); return; } ServerSsMgr.SetLobbySession(ss); ServerSsMgr.AddSession(ss); // TraceLog.WriteLine("大厅服加入成功"); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////大厅服///////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <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); }