public TimedEventCountdownHelper(UXLabel label, ITimedEventVO campaign) { this.label = label; this.Campaign = campaign; this.lang = Service.Get <Lang>(); Service.Get <ViewTimeEngine>().RegisterClockTimeObserver(this, 1f); if (this.Campaign != null) { this.UpdateTimeRemaining(); } }
public int GetOffsetSeconds(ITimedEventVO vo) { if (!vo.UseTimeZoneOffset) { return(0); } if (this.campaigns.ContainsKey(vo.Uid)) { return((int)(this.campaigns[vo.Uid].TimeZone * 3600f)); } return(this.env.GetTimezoneOffsetSeconds()); }
public static int GetSecondsRemaining(ITimedEventVO vo) { int nowTimeWithEventOffset = TimedEventUtils.GetNowTimeWithEventOffset(vo); switch (TimedEventUtils.GetState(vo)) { case TimedEventState.Upcoming: return(vo.StartTimestamp - nowTimeWithEventOffset); case TimedEventState.Live: return(vo.EndTimestamp - nowTimeWithEventOffset); case TimedEventState.Closing: return(vo.EndTimestamp - nowTimeWithEventOffset); default: return(0); } }
public static TimedEventState GetState(ITimedEventVO vo, uint nowSeconds) { int upcomingDurationSeconds = vo.GetUpcomingDurationSeconds(); int closingDurationSeconds = vo.GetClosingDurationSeconds(); if ((ulong)nowSeconds < (ulong)((long)(vo.StartTimestamp - upcomingDurationSeconds)) || (ulong)nowSeconds > (ulong)((long)(vo.EndTimestamp + closingDurationSeconds))) { return(TimedEventState.Hidden); } if ((ulong)nowSeconds < (ulong)((long)vo.StartTimestamp)) { return(TimedEventState.Upcoming); } if ((ulong)nowSeconds < (ulong)((long)vo.EndTimestamp)) { return(TimedEventState.Live); } if ((ulong)nowSeconds < (ulong)((long)(vo.EndTimestamp + closingDurationSeconds))) { return(TimedEventState.Closing); } return(TimedEventState.Hidden); }
public static TimedEventState GetState(ITimedEventVO vo) { int nowTimeWithEventOffset = TimedEventUtils.GetNowTimeWithEventOffset(vo); return(TimedEventUtils.GetState(vo, (uint)nowTimeWithEventOffset)); }
public static bool IsTimedEventClosing(ITimedEventVO eventVO, uint timeToCheck) { TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck); return(state == TimedEventState.Closing); }
public static bool IsTimedEventActive(ITimedEventVO eventVO) { TimedEventState state = TimedEventUtils.GetState(eventVO); return(state != TimedEventState.Invalid && state != TimedEventState.Hidden); }
public static bool IsTimedEventLiveOrClosing(ITimedEventVO eventVO) { TimedEventState state = TimedEventUtils.GetState(eventVO); return(state == TimedEventState.Live || state == TimedEventState.Closing); }
public static bool IsTimedEventLive(ITimedEventVO eventVO, uint timeToCheck) { TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck); return(state == TimedEventState.Live); }
public static bool IsTimedEventLive(ITimedEventVO eventVO) { TimedEventState state = TimedEventUtils.GetState(eventVO); return(state == TimedEventState.Live); }
private static int GetNowTimeWithEventOffset(ITimedEventVO vo) { return((int)(ServerTime.Time + (uint)Service.Get <CurrentPlayer>().CampaignProgress.GetOffsetSeconds(vo))); }
public static int GetStoreSecondsRemaining(ITimedEventVO vo) { return(TimedEventUtils.GetSecondsRemaining(vo) + vo.GetClosingDurationSeconds()); }
public static int GetSecondsRemainingUntilClosing(ITimedEventVO vo) { int nowTimeWithEventOffset = TimedEventUtils.GetNowTimeWithEventOffset(vo); return(vo.EndTimestamp - nowTimeWithEventOffset); }