internal void Update() { while (keepGoing) { foreach (UpdateTask task in updateTasks.Values) { if (task.enabled && task.nextTime < DateTime.Now) { task.callback(task.param); task.nextTime += TimeSpan.FromMilliseconds(task.interval); } } if (requestLockDown) { lockDown = true; tasks.Restart(); requestLockDown = false; Thread.Sleep(100); // buffer time for all threads to catch up map.ClearUpdateQueue(); lockDownReady = true; } Thread.Sleep(1); } }
public bool Lock([NotNull] Player player) { if (player == null) { throw new ArgumentNullException("player"); } lock ( lockLock ) { if (IsLocked) { return(false); } else { LockedBy = player.Name; LockedDate = DateTime.UtcNow; IsLocked = true; Map mapCache = Map; if (mapCache != null) { mapCache.ClearUpdateQueue(); mapCache.StopAllDrawOps(); } Players.Message("&WWorld was locked by {0}", player.ClassyName); Logger.Log(LogType.UserActivity, "World {0} was locked by {1}", Name, player.Name); return(true); } } }
public bool Lock(Player player) { if (player == null) { throw new ArgumentNullException("player"); } lock ( lockLock ) { if (IsLocked) { return(false); } else { LockedBy = player.Name; LockedDate = DateTime.UtcNow; IsLocked = true; if (Map != null) { Map.ClearUpdateQueue(); } SendToAll("&WMap was locked by {0}", player.GetClassyName()); Logger.Log("World {0} was locked by {1}", LogType.UserActivity, Name, player.Name); return(true); } } }