You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.1 KiB

using System.Collections.Generic;
using Sog.Log;
using ProtoCSStruct;
namespace Game
{
/// <summary>
/// game服务器统计相关信息的辅助类
/// </summary>
public static class GameServerStat
{
private static long m_lastLogTime;
private static Dictionary<int, long> m_lastTickTime = new Dictionary<int, long>();
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);
}
}
}