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.
 
 
 
 
 
 

106 lines
3.9 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Sog;
namespace Game
{
public static class PlayerAutoReOnlineForBillSvc
{
public static void OnTick(long nowSecond)
{
TickDailyLog(nowSecond);
if (AppTime.IsSameDay(nowSecond, GameServerUtils.GetGameServerData().ReOnlineAtZero, 0))
{
return;
}
GameServerUtils.GetGameServerData().ReOnlineAtZero = nowSecond;
long triggerTime = ConfigStringTimeParse.ParseDailyConfigTime(nowSecond, "00:00:01");
//只在一小段时间内有效, 其他时间无效果, 防止服务器启动就执行
if(nowSecond - triggerTime > 30)
{
return;
}
ReOnlineAllPlayer(triggerTime);
}
private static void TickDailyLog(long nowSecond)
{
var list = GameServerUtils.GetPlayerTable().m_dailyLogReportPlayers;
if(list == null || list.Count == 0)
{
return;
}
long triggerTime = ConfigStringTimeParse.ParseDailyConfigTime(nowSecond, "00:00:01");
int preCount = list.Count;
int max = 50; //每次最大tick数
if(GameServerUtils.GetApp().IsStopping)
{
max = list.Count;
}
for(int i = list.Count - 1; i >= 0 && max > 0; i--, max--)
{
long uid = list[i];
list.RemoveAt(i);
PlayerOnGame player = GameServerUtils.GetPlayerTableOp().GetPlayerByUid(uid);
if(player == null) //下线不管了,下线会自动触发
{
continue;
}
GameBillLogUtils.LogLogin(player, 1);
if (player.status != PlayerStatus.logout)
{
//BDC日志需要在每天23:59:59上报所有在线玩家的UserInfo
//TriggerTime是第二天的00:00:01
GameBDCLogUtils.UserInfo(player, triggerTime - 2);
GameBDCLogUtils.HerosSnapshot(player, triggerTime - 2);
GameTALogUtils.LogPlayerSnap(player);
GameTALogUtils.LogPropsRedundancy(player);
//GameTALogUtils.LogCrystalSnap(player);
}
}
TraceLog.Debug("PlayerAutoReOnlineForBillSvc.TickDailyLog triggerTime {0} preCount {1} curCount {2}"
, triggerTime, preCount, list.Count);
}
private static void ReOnlineAllPlayer(long triggerTime)
{
TraceLog.Debug("PlayerAutoReOnlineForBillSvc.ReOnlineAllPlayer triggerTime {0}", triggerTime);
GameServerUtils.GetPlayerTable().m_dailyLogReportPlayers = GameServerUtils.GetPlayerTable().m_uidTable.Keys.ToList();
//foreach (PlayerOnGame player in GameServerUtils.GetPlayerTable().m_uidTable.Values)
//{
// GameBillLogUtils.LogLogin(player, 1);
// if (player.status != PlayerStatus.logout)
// {
// //BDC日志需要在每天23:59:59上报所有在线玩家的UserInfo
// //TriggerTime是第二天的00:00:01
// GameBDCLogUtils.UserInfo(player, triggerTime - 2);
// GameBDCLogUtils.HerosSnapshot(player, triggerTime - 2);
// GameTALogUtils.LogPlayerSnap(player);
// GameTALogUtils.LogPropsRedundancy(player);
// GameTALogUtils.LogHerosSnapshot(player);
// GameTALogUtils.LogCommanderSnap(player);
// GameTALogUtils.LogTreasureSnap(player);
// GameTALogUtils.LogCrystalSnap(player);
// GameTALogUtils.LogArenaDefenceSnap(player);
// }
//}
}
}
}