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();
     }
 }
Esempio n. 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());
 }
Esempio n. 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);
            }
        }
Esempio n. 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);
        }
Esempio n. 5
0
        public static TimedEventState GetState(ITimedEventVO vo)
        {
            int nowTimeWithEventOffset = TimedEventUtils.GetNowTimeWithEventOffset(vo);

            return(TimedEventUtils.GetState(vo, (uint)nowTimeWithEventOffset));
        }
Esempio n. 6
0
        public static bool IsTimedEventClosing(ITimedEventVO eventVO, uint timeToCheck)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck);

            return(state == TimedEventState.Closing);
        }
Esempio n. 7
0
        public static bool IsTimedEventActive(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state != TimedEventState.Invalid && state != TimedEventState.Hidden);
        }
Esempio n. 8
0
        public static bool IsTimedEventLiveOrClosing(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

            return(state == TimedEventState.Live || state == TimedEventState.Closing);
        }
Esempio n. 9
0
        public static bool IsTimedEventLive(ITimedEventVO eventVO, uint timeToCheck)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO, timeToCheck);

            return(state == TimedEventState.Live);
        }
Esempio n. 10
0
        public static bool IsTimedEventLive(ITimedEventVO eventVO)
        {
            TimedEventState state = TimedEventUtils.GetState(eventVO);

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

            return(vo.EndTimestamp - nowTimeWithEventOffset);
        }