12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using ET;
- using FairyGUI;
- namespace GFGGame
- {
- public class RoleDataHandler
- {
- private static int seconds = 0;
- public static void StartUpdate()
- {
- StopUpdate();
- //每秒检测
- Timers.inst.Add(1, 0, OnUpdate);
- }
- public static void StopUpdate()
- {
- Timers.inst.Remove(OnUpdate);
- }
- private static void OnUpdate(object param)
- {
- int currentTimeSecs = (int)(Game.TimeInfo.ServerNow() / 1000);
- if (!RoleDataManager.powerTimeServerLock && !RoleDataManager.CheckPowerFull())
- {
- int powerTime = GameGlobal.myNumericComponent.GetAsInt(NumericType.PowerTime);
- int passTime = currentTimeSecs - powerTime;
- if (passTime >= GameConst.INTERVAL_TIME_SECONDS_POWER)
- {
- RoleDataManager.powerTimeServerLock = true;
- NumericHelper.RequestAddAttributePoint(GameGlobal.zoneScene, NumericType.Power).Coroutine();
- }
- }
- int dailyResetSecs = GameGlobal.myNumericComponent.GetAsInt(NumericType.DailyResetSecs);
- if (TimeHelper.ServerNowSecs >= dailyResetSecs)
- {
- CommonSProxy.ResetDailyData().Coroutine();
- }
- if (seconds >= TimeUtil.SECOND_PER_MUNITE * 3)
- {
- ViewManager.CheckDispsoe();
- seconds = 0;
- }
- seconds++;
- }
- }
- }
|