using System.Collections.Generic; using Sog.Log; using ProtoCSStruct; namespace Game { /// /// game服务器统计相关信息的辅助类 /// public static class GameServerStat { private static long m_lastLogTime; private static Dictionary m_lastTickTime = new Dictionary(); public static void Tick(long nowMs) { ServerStat.Instance.Tick(nowMs); //每秒记录一次一些信息 if (nowMs < m_lastLogTime + 1000) { return; } m_lastLogTime = nowMs; WriteServerStat(); } private static void WriteServerStat() { //在线玩家数量 ServerStat.Instance.SetValue("OnlinePlayer", GameServerUtils.GetPlayerTableOp().GetOnlinePlayer()); } public static void AddIDValue(string id, long value) { ServerStat.Instance.AddValue(id, value); } public static void SetIDValue(string id, long value) { ServerStat.Instance.SetValue(id, value); } } }