public RunRepeating ( System.TimeSpan delay, System.TimeSpan interval, int times ) : |
||
delay | System.TimeSpan | |
interval | System.TimeSpan | |
times | int | |
return |
ChatTimer( TimeSpan duration, [CanBeNull] string message, [NotNull] string startedBy ) { if( startedBy == null ) throw new ArgumentNullException( "startedBy" ); StartedBy = startedBy; Message = message; StartTime = DateTime.UtcNow; EndTime = StartTime.Add( duration ); Duration = duration; int oneSecondRepeats = (int)duration.TotalSeconds + 1; if( duration > Hour ) { announceIntervalIndex = AnnounceIntervals.Length - 1; lastHourAnnounced = (int)duration.TotalHours; } else { for( int i = 0; i < AnnounceIntervals.Length; i++ ) { if( duration <= AnnounceIntervals[i] ) { announceIntervalIndex = i - 1; break; } } } task = Scheduler.NewTask( TimerCallback, this ); Id = Interlocked.Increment( ref timerCounter ); AddTimerToList( this ); IsRunning = true; task.RunRepeating( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), oneSecondRepeats ); }
public static void Start() { world_.Hax = false; world_.gameMode = GameMode.TeamDeathMatch; //set the game mode delayTask = Scheduler.NewTask(t => world_.Players.Message("&WTEAM DEATHMATCH &fwill be starting in {0} seconds: &WGet ready!", timeDelay)); delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), 1); }
public static void Start() { world_.Hax = false; world_.gameMode = GameMode.FFA; //set the game mode delayTask = Scheduler.NewTask(t => world_.Players.Message("&WFFA &fwill be starting in {0} seconds: &WGet ready!", (timeDelay - (DateTime.UtcNow - startTime).ToSeconds()))); delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (timeDelay / 10)); }
private ChatTimer( TimeSpan duration, [CanBeNull] string message, [NotNull] string startedBy ) { if ( startedBy == null ) throw new ArgumentNullException( "startedBy" ); StartedBy = startedBy; Message = message; StartTime = DateTime.UtcNow; EndTime = StartTime.Add( duration ); Duration = duration; int oneSecondRepeats = ( int )duration.TotalSeconds + 1; if ( duration > Hour ) { announceIntervalIndex = AnnounceIntervals.Length - 1; lastHourAnnounced = ( int )duration.TotalHours; } else { for ( int i = 0; i < AnnounceIntervals.Length; i++ ) { if ( duration <= AnnounceIntervals[i] ) { announceIntervalIndex = i - 1; break; } } } task = Scheduler.NewTask( TimerCallback, this ); Id = Interlocked.Increment( ref timerCounter ); AddTimerToList( this ); IsRunning = true; task.RunRepeating( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), oneSecondRepeats ); }
public static void Start() { world_.Hax = false; //world_.Players.Send(PacketWriter.MakeHackControl(0,0,0,0,0,-1)); Commented out until classicube clients support hax packet stopwatch.Reset(); stopwatch.Start(); world_.gameMode = GameMode.CaptureTheFlag; delayTask = Scheduler.NewTask(t => world_.Players.Message("&WCTF &fwill be starting in {0} seconds: &WGet ready!", (timeDelay - stopwatch.Elapsed.Seconds))); delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (int)Math.Floor((double)(timeDelay / 10)));//Start task immediately, send message every 10s if (stopwatch.Elapsed.Seconds > 11) { stopwatch.Stop(); } }
ChatTimer(TimeSpan duration, [CanBeNull] string message, [NotNull] string startedBy) { if (startedBy == null) { throw new ArgumentNullException("startedBy"); } StartedBy = startedBy; Message = message; StartTime = DateTime.UtcNow; EndTime = StartTime.Add(duration); Duration = duration; int oneSecondRepeats = (int)duration.TotalSeconds + 1; if (duration > Hour) { announceIntervalIndex = AnnounceIntervals.Length - 1; lastHourAnnounced = (int)duration.TotalHours; } else { for (int i = 0; i < AnnounceIntervals.Length; i++) { if (duration <= AnnounceIntervals[i]) { announceIntervalIndex = i - 1; break; } } } task = Scheduler.NewTask(TimerCallback, this); ID = Interlocked.Increment(ref timerCounter); AddTimerToList(this); IsRunning = true; task.RunRepeating(TimeSpan.Zero, TimeSpan.FromSeconds(1), oneSecondRepeats); try { if (!Directory.Exists("./Timers")) { Directory.CreateDirectory("./Timers"); } string[] output = { "StartDate: " + StartTime, "EndDate: " + EndTime, "CreatedBy: " + StartedBy, "Message: " + Message }; File.WriteAllLines("./Timers/" + TimerFilename(this), output); } catch (Exception ex) { Player.Console.Message("Timer Writer Has Crashed: {0}", ex); } }
ChatTimer( TimeSpan duration, [CanBeNull] string message, [NotNull] string startedBy ) { if( startedBy == null ) throw new ArgumentNullException( "startedBy" ); StartedBy = startedBy; Message = message; StartTime = DateTime.UtcNow; EndTime = StartTime.Add( duration ); Duration = duration; int oneSecondRepeats = (int)duration.TotalSeconds + 1; if( duration > Hour ) { announceIntervalIndex = AnnounceIntervals.Length - 1; lastHourAnnounced = (int)duration.TotalHours; } else { for( int i = 0; i < AnnounceIntervals.Length; i++ ) { if( duration <= AnnounceIntervals[i] ) { announceIntervalIndex = i - 1; break; } } } task = Scheduler.NewTask( TimerCallback, this ); ID = Interlocked.Increment( ref timerCounter ); AddTimerToList( this ); IsRunning = true; task.RunRepeating( TimeSpan.Zero, TimeSpan.FromSeconds( 1 ), oneSecondRepeats ); try { if (!(Directory.Exists("./Timers"))) Directory.CreateDirectory("./Timers"); string[] output = { "StartDate: " + StartTime.ToString(), "EndDate: " + EndTime.ToString(), "CreatedBy: " + StartedBy, "Message: " + Message }; File.WriteAllLines("./Timers/" + EndTime.Year.ToString() + "_" + EndTime.Month.ToString() + "_" + EndTime.Day.ToString() + "_" + EndTime.Hour.ToString() + "_" + EndTime.Minute.ToString() + "_" + EndTime.Second.ToString() + ".txt", output); } catch (Exception ex) { Player.Console.Message("Timer Writer Has Crashed: {0}", ex); } }
public static void Start() { world_.Hax = false; world_.gameMode = GameMode.FFA; //set the game mode delayTask = Scheduler.NewTask(t => world_.Players.Message("&WFFA &fwill be starting in {0} seconds: &WGet ready!", (timeDelay - (DateTime.Now - startTime).ToSeconds()))); delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (timeDelay / 10)); }
public static void Start() { world_.Hax = false; world_.gameMode = GameMode.TeamDeathMatch; //set the game mode delayTask = Scheduler.NewTask(t => world_.Players.Message("&WTEAM DEATHMATCH &fwill be starting in {0} seconds: &WGet ready!", timeDelay)); delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), 1); }
public static void Start() { world_.Hax = false; //world_.Players.Send(PacketWriter.MakeHackControl(0,0,0,0,0,-1)); Commented out until classicube clients support hax packet stopwatch.Reset(); stopwatch.Start(); world_.gameMode = GameMode.CaptureTheFlag; delayTask = Scheduler.NewTask(t => world_.Players.Message("&WCTF &fwill be starting in {0} seconds: &WGet ready!", (timeDelay - stopwatch.Elapsed.Seconds))); delayTask.RunRepeating(TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(10), (int)Math.Floor((double)(timeDelay / 10)));//Start task immediately, send message every 10s if (stopwatch.Elapsed.Seconds > 11) { stopwatch.Stop(); } }