using ET; using FairyGUI; namespace GFGGame { public class RoleDataHandler { //单位秒 private const int INTERVAL_HEARTBEAT = 20; private static int _heartbeatCDEnd = 0; public static void StartUpdate() { _heartbeatCDEnd = ServerDataManager.currentTimeSecs + INTERVAL_HEARTBEAT; StopUpdate(); Timers.inst.Add(1, 0, OnUpdate); } public static void StopUpdate() { Timers.inst.Remove(OnUpdate); } private static void OnUpdate(object param) { if(!RoleDataManager.powerTimeLock &&!RoleDataManager.CheckPowerFull()) { int powerTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerTime); int passTime = ServerDataManager.currentTimeSecs - powerTime; if(passTime >= GameConst.INTERVAL_TIME_SECONDS_POWER) { RoleDataManager.powerTimeLock = true; NumericHelper.RequestAddAttributePoint(GameGlobal.zoneScene, NumericType.Power).Coroutine(); } } int currentTimeSecs = ServerDataManager.currentTimeSecs; if(currentTimeSecs >= _heartbeatCDEnd) { //GameProxy.ReqUpdateTime(); _heartbeatCDEnd = currentTimeSecs + INTERVAL_HEARTBEAT; } int day = ServerDataManager.CurrentDay; int recommendDay = GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount); if(recommendDay >= 0 && recommendDay != day) { StoryDataManager.ResetDailyData(); } } } }