Announce() private method

private Announce ( System.TimeSpan timeLeft ) : void
timeLeft System.TimeSpan
return void
Beispiel #1
0
        static void TimerCallback([NotNull] SchedulerTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }
            ChatTimer timer = (ChatTimer)task.UserState;

            if (task.MaxRepeats == 1)
            {
                if (String.IsNullOrEmpty(timer.Message))
                {
                    Chat.SendSay(Player.Console, "(Timer Up)");
                }
                else
                {
                    Chat.SendSay(Player.Console, "(Timer Up) " + timer.Message);
                }
                timer.Stop(false);
            }
            else if (timer.announceIntervalIndex >= 0)
            {
                if (timer.lastHourAnnounced != (int)timer.TimeLeft.TotalHours)
                {
                    timer.lastHourAnnounced = (int)timer.TimeLeft.TotalHours;
                    timer.Announce(TimeSpan.FromHours(Math.Ceiling(timer.TimeLeft.TotalHours)));
                }
                if (timer.TimeLeft <= AnnounceIntervals[timer.announceIntervalIndex])
                {
                    timer.Announce(AnnounceIntervals[timer.announceIntervalIndex]);
                    timer.announceIntervalIndex--;
                }
            }
        }
Beispiel #2
0
        static void TimerCallback([NotNull] SchedulerTask task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }
            ChatTimer timer = (ChatTimer)task.UserState;

            if (task.MaxRepeats == 1)
            {
                if (String.IsNullOrEmpty(timer.Message))
                {
                    Server.Players.Message("&2[&7CountDown Finished&2]");
                    IRC.SendChannelMessage("\u212C&S[&7CountDown Finished&S]");
                }
                else
                {
                    Server.Players.Message("&2[&7Timer Finished&2] &7" + timer.Message);
                    IRC.SendChannelMessage("\u212C&S[&7Timer Finished&S]\u211C " + timer.Message);
                }
                //Timer Ends Here.
                timer.Stop(false);
            }
            else if (timer.announceIntervalIndex >= 0)
            {
                if (timer.lastHourAnnounced != (int)timer.TimeLeft.TotalHours)
                {
                    timer.lastHourAnnounced = (int)timer.TimeLeft.TotalHours;
                    timer.Announce(TimeSpan.FromHours(Math.Ceiling(timer.TimeLeft.TotalHours)));
                }
                if (timer.TimeLeft <= AnnounceIntervals[timer.announceIntervalIndex])
                {
                    timer.Announce(AnnounceIntervals[timer.announceIntervalIndex]);
                    timer.announceIntervalIndex--;
                }
            }
        }