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();
     }
 }
Пример #2
0
 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());
 }
Пример #3
0
        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);
            }
        }
Пример #4
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);
        }
Пример #5
0
        public static TimedEventState GetState(ITimedEventVO vo)
        {
            int nowTimeWithEventOffset = TimedEventUtils.GetNowTimeWithEventOffset(vo);

            return(TimedEventUtils.GetState(vo, (uint)nowTimeWithEventOffset));
        }
Пример #6
0
        public static bool IsTimedEventClosing(ITimedEventVO eventVO, uint timeToCheck)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck);

            return(state == TimedEventState.Closing);
        }
Пример #7
0
        public static bool IsTimedEventActive(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state != TimedEventState.Invalid && state != TimedEventState.Hidden);
        }
Пример #8
0
        public static bool IsTimedEventLiveOrClosing(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state == TimedEventState.Live || state == TimedEventState.Closing);
        }
Пример #9
0
        public static bool IsTimedEventLive(ITimedEventVO eventVO, uint timeToCheck)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck);

            return(state == TimedEventState.Live);
        }
Пример #10
0
        public static bool IsTimedEventLive(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state == TimedEventState.Live);
        }
Пример #11
0
 private static int GetNowTimeWithEventOffset(ITimedEventVO vo)
 {
     return((int)(ServerTime.Time + (uint)Service.Get <CurrentPlayer>().CampaignProgress.GetOffsetSeconds(vo)));
 }
Пример #12
0
 public static int GetStoreSecondsRemaining(ITimedEventVO vo)
 {
     return(TimedEventUtils.GetSecondsRemaining(vo) + vo.GetClosingDurationSeconds());
 }
Пример #13
0
        public static int GetSecondsRemainingUntilClosing(ITimedEventVO vo)
        {
            int nowTimeWithEventOffset = TimedEventUtils.GetNowTimeWithEventOffset(vo);

            return(vo.EndTimestamp - nowTimeWithEventOffset);
        }