public int InitializeClient(KuaFuClientContext clientInfo) { int result; try { if (clientInfo.ServerId != 0) { bool bFirstInit = false; int ret = ClientAgentManager.Instance().InitializeClient(clientInfo, out bFirstInit); if (ret > 0) { if (clientInfo.MapClientCountDict != null && clientInfo.MapClientCountDict.Count > 0) { KuaFuServerManager.UpdateKuaFuLineData(clientInfo.ServerId, clientInfo.MapClientCountDict); ClientAgentManager.Instance().SetMainlinePayload(clientInfo.ServerId, clientInfo.MapClientCountDict.Values.ToList <int>().Sum()); } } result = ret; } else { LogManager.WriteLog(LogTypes.Error, string.Format("InitializeClient时GameType错误,禁止连接.ServerId:{0},GameType:{1}", clientInfo.ServerId, clientInfo.GameType), null, true); result = -4003; } } catch (Exception ex) { LogManager.WriteExceptionUseCache(string.Format("InitializeClient服务器ID重复,禁止连接.ServerId:{0},ClientId:{1},info:{2}", clientInfo.ServerId, clientInfo.ClientId, clientInfo.Token)); result = -11003; } return(result); }
public void UpdateKuaFuMapClientCount(int serverId, Dictionary <int, int> mapClientCountDict) { if (mapClientCountDict != null && mapClientCountDict.Count > 0) { ClientAgent agent = ClientAgentManager.Instance().GetCurrentClientAgent(serverId); if (null != agent) { KuaFuServerManager.UpdateKuaFuLineData(agent.ClientInfo.ServerId, mapClientCountDict); ClientAgentManager.Instance().SetMainlinePayload(agent.ClientInfo.ServerId, mapClientCountDict.Values.ToList <int>().Sum()); } } }