/// <summary> /// Called when the simulation is ticked by underlying operating system, game engine, or potato. Each of these system /// ticks is called at unpredictable rates, however if not a system tick that means the simulation has processed enough /// of them to fire off event for fixed interval that is set in the core simulation by constant in milliseconds. /// </summary> /// <remarks>Default is one second or 1000ms.</remarks> /// <param name="systemTick"> /// TRUE if ticked unpredictably by underlying operating system, game engine, or potato. FALSE if /// pulsed by game simulation at fixed interval. /// </param> /// <param name="skipDay"> /// Determines if the simulation has force ticked without advancing time or down the trail. Used by /// special events that want to simulate passage of time without actually any actual time moving by. /// </param> public override void OnTick(bool systemTick, bool skipDay = false) { // If the active Windows is not null and flag is set to remove then do that! var updatedModes = false; if (FocusedWindow != null && FocusedWindow.ShouldRemoveMode) { updatedModes = CleanWindows(); } // When list of modes is updated then we need to activate now active Windows since they shifted. if (updatedModes) { FocusedWindow.OnWindowActivate(); } // Otherwise just tick the game Windows logic. FocusedWindow?.OnTick(systemTick, skipDay); }
/// <summary> /// Tell all the other game modes that we added another Windows. /// </summary> private void OnWindowAdded() { lock (windowList) { var tempWindowList = new Dictionary <Type, IWindow>(windowList); foreach (var loadedMode in tempWindowList) { if (loadedMode.Key == FocusedWindow.GetType()) { // Only call post create on the newly added active game Windows. loadedMode.Value.OnWindowPostCreate(); } else { // All other game modes just get notification via method a Windows was added on top of them. loadedMode.Value.OnWindowAdded(); } } tempWindowList.Clear(); } }