public Dictionary <int, GameTypeStaticsData> GetGameTypeStatics() { Dictionary <int, GameTypeStaticsData> result = new Dictionary <int, GameTypeStaticsData>(); if (this.IsAlive) { lock (this.Mutex) { foreach (KeyValuePair <int, Dictionary <long, int> > kvp in this.AlivedGameDict) { GameTypeStaticsData data = null; if (!result.TryGetValue(kvp.Key, out data)) { data = new GameTypeStaticsData(); data.ServerAlived = 1; result[kvp.Key] = data; } data.FuBenAlived = kvp.Value.Count; data.SingUpRoleCount = 0; data.StartGameRoleCount = kvp.Value.ToList <KeyValuePair <long, int> >().Sum((KeyValuePair <long, int> c) => c.Value); } if (this.TotalMainlineRolePayLoad > 0L) { result.Add(7, new GameTypeStaticsData { ServerAlived = 1, StartGameRoleCount = (int)this.TotalMainlineRolePayLoad }); } } } return(result); }
public void SetGameTypeLoad(GameTypes gameType, int signUpCount, int startCount) { lock (this.Mutex) { GameTypeStaticsData data = null; if (!this.GameTypeLoadDict.TryGetValue((int)gameType, out data)) { data = new GameTypeStaticsData(); this.GameTypeLoadDict[(int)gameType] = data; } data.SingUpRoleCount = signUpCount; data.StartGameRoleCount = startCount; } }
public Dictionary <int, GameTypeStaticsData> GetGameTypeStatics() { var result = new Dictionary <int, GameTypeStaticsData>(); lock (Mutex) { foreach (var serverId in AllKfServerId) { ClientAgent agent = null; if (ServerId2ClientAgent.TryGetValue(serverId, out agent)) { foreach (var tmpKvp in agent.GetGameTypeStatics()) { GameTypeStaticsData existData = null; if (!result.TryGetValue(tmpKvp.Key, out existData)) { existData = new GameTypeStaticsData(); result[tmpKvp.Key] = existData; } existData.ServerAlived += tmpKvp.Value.ServerAlived; existData.FuBenAlived += tmpKvp.Value.FuBenAlived; existData.SingUpRoleCount += tmpKvp.Value.SingUpRoleCount; existData.StartGameRoleCount += tmpKvp.Value.StartGameRoleCount; } } } foreach (var kvp in GameTypeLoadDict) { if (result.ContainsKey(kvp.Key)) { result[kvp.Key].SingUpRoleCount = kvp.Value.SingUpRoleCount; result[kvp.Key].StartGameRoleCount = kvp.Value.StartGameRoleCount; } } } return(result); }
/// <summary> /// key: gameType /// value: statics data /// </summary> /// <returns></returns> public Dictionary <int, GameTypeStaticsData> GetGameTypeStatics() { var result = new Dictionary <int, GameTypeStaticsData>(); if (IsAlive) { lock (Mutex) { foreach (var kvp in AlivedGameDict) { GameTypeStaticsData data = null; if (!result.TryGetValue(kvp.Key, out data)) { data = new GameTypeStaticsData(); data.ServerAlived = 1; result[kvp.Key] = data; } data.FuBenAlived = kvp.Value.Count; data.SingUpRoleCount = 0; // not set data.StartGameRoleCount = kvp.Value.ToList().Sum(c => c.Value); } if (TotalMainlineRolePayLoad > 0) { result.Add((int)GameTypes.KuaFuMap, new GameTypeStaticsData() { ServerAlived = 1, StartGameRoleCount = (int)TotalMainlineRolePayLoad }); } } } return(result); }