예제 #1
0
 public static void PopScreen()
 {
     Debug.Print(nameof(PopScreen));
     if (ScreenManager._screenList.Count > 0)
     {
         ScreenManager.TopScreen.HandlePause();
         ScreenManager.TopScreen.HandleDeactivate();
         ScreenManager.TopScreen.HandleFinalize();
         ScreenManager.OnPopScreenEvent onPopScreen = ScreenManager.OnPopScreen;
         if (onPopScreen != null)
         {
             onPopScreen(ScreenManager.TopScreen);
         }
         ScreenManager._screenList.Remove(ScreenManager.TopScreen);
     }
     if (ScreenManager._screenList.Count > 0)
     {
         ScreenBase topScreen1 = ScreenManager.TopScreen;
         ScreenManager.TopScreen.HandleActivate();
         ScreenBase topScreen2 = ScreenManager.TopScreen;
         if (topScreen1 == topScreen2)
         {
             ScreenManager.TopScreen.HandleResume();
         }
     }
     ScreenManager.RefreshGlobalOrder();
 }
예제 #2
0
 public static void ReplaceTopScreen(ScreenBase screen)
 {
     Debug.Print("ReplaceToTopScreen");
     if (ScreenManager._screenList.Count > 0)
     {
         ScreenManager.TopScreen.HandlePause();
         ScreenManager.TopScreen.HandleDeactivate();
         ScreenManager.TopScreen.HandleFinalize();
         ScreenManager.OnPopScreenEvent onPopScreen = ScreenManager.OnPopScreen;
         if (onPopScreen != null)
         {
             onPopScreen(ScreenManager.TopScreen);
         }
         ScreenManager._screenList.Remove(ScreenManager.TopScreen);
     }
     ScreenManager._screenList.Add(screen);
     screen.HandleInitialize();
     screen.HandleActivate();
     screen.HandleResume();
     ScreenManager.RefreshGlobalOrder();
     ScreenManager.OnPushScreenEvent onPushScreen = ScreenManager.OnPushScreen;
     if (onPushScreen == null)
     {
         return;
     }
     onPushScreen(screen);
 }
예제 #3
0
 public static void AddGlobalLayer(GlobalLayer layer, bool isFocusable)
 {
     ScreenManager._globalLayers.Add(layer);
     layer.Layer.HandleActivate();
     ScreenManager._globalLayers.Sort();
     ScreenManager.RefreshGlobalOrder();
 }
 public void RemoveLayer(ScreenLayer layer)
 {
     if (this.IsActive)
     {
         layer.LastActiveState = false;
         layer.HandleDeactivate();
     }
     layer.HandleFinalize();
     this._layers.Remove(layer);
     ScreenManager.RefreshGlobalOrder();
 }
예제 #5
0
 public static void CleanAndPushScreen(ScreenBase screen)
 {
     Debug.Print(nameof(CleanAndPushScreen));
     ScreenManager.DeactivateAndFinalizeAllScreens();
     ScreenManager._screenList.Add(screen);
     screen.HandleInitialize();
     screen.HandleActivate();
     screen.HandleResume();
     ScreenManager.RefreshGlobalOrder();
     ScreenManager.OnPushScreenEvent onPushScreen = ScreenManager.OnPushScreen;
     if (onPushScreen == null)
     {
         return;
     }
     onPushScreen(screen);
 }
예제 #6
0
 public static void CleanScreens()
 {
     Debug.Print(nameof(CleanScreens));
     while (ScreenManager._screenList.Count > 0)
     {
         ScreenManager.TopScreen.HandlePause();
         ScreenManager.TopScreen.HandleDeactivate();
         ScreenManager.TopScreen.HandleFinalize();
         ScreenManager.OnPopScreenEvent onPopScreen = ScreenManager.OnPopScreen;
         if (onPopScreen != null)
         {
             onPopScreen(ScreenManager.TopScreen);
         }
         ScreenManager._screenList.Remove(ScreenManager.TopScreen);
     }
     ScreenManager.RefreshGlobalOrder();
 }
예제 #7
0
 public static void SetAndActivateRootScreen(ScreenBase screen)
 {
     Debug.Print(nameof(SetAndActivateRootScreen));
     if (ScreenManager.TopScreen != null)
     {
         throw new Exception("TopScreen is not null.");
     }
     ScreenManager._screenList.Add(screen);
     screen.HandleInitialize();
     screen.HandleActivate();
     screen.HandleResume();
     ScreenManager.RefreshGlobalOrder();
     ScreenManager.OnPushScreenEvent onPushScreen = ScreenManager.OnPushScreen;
     if (onPushScreen == null)
     {
         return;
     }
     onPushScreen(screen);
 }
예제 #8
0
 public static void PushScreen(ScreenBase screen)
 {
     Debug.Print(nameof(PushScreen));
     if (ScreenManager._screenList.Count > 0)
     {
         ScreenManager.TopScreen.HandlePause();
         if (ScreenManager.TopScreen.IsActive)
         {
             ScreenManager.TopScreen.HandleDeactivate();
         }
     }
     ScreenManager._screenList.Add(screen);
     screen.HandleInitialize();
     screen.HandleActivate();
     screen.HandleResume();
     ScreenManager.RefreshGlobalOrder();
     ScreenManager.OnPushScreenEvent onPushScreen = ScreenManager.OnPushScreen;
     if (onPushScreen == null)
     {
         return;
     }
     onPushScreen(screen);
 }
예제 #9
0
        private static void EarlyUpdate()
        {
            ScreenManager.UsableArea = EngineApplicationInterface.IScreen.GetUsableAreaPercentages();
            ScreenManager.RefreshGlobalOrder();
            ScreenManager.UpdateMouseVisibility();
            List <ScreenLayer> sortedActiveLayers = ScreenManager.SortedActiveLayers;

            if (ScreenManager._sortedActiveLayersCopy.Length != sortedActiveLayers.Capacity)
            {
                ScreenManager._sortedActiveLayersCopy = new ScreenLayer[sortedActiveLayers.Capacity];
            }
            sortedActiveLayers.CopyTo(ScreenManager._sortedActiveLayersCopy);
            int count = sortedActiveLayers.Count;

            TaleWorlds.Library.InputType p1 = TaleWorlds.Library.InputType.None;
            for (int index = 0; index < count; ++index)
            {
                ScreenManager._sortedActiveLayersCopy[index].MouseEnabled = true;
            }
            bool?mouseInput = ScreenManager.GetMouseInput();

            for (int index = count - 1; index >= 0; --index)
            {
                ScreenLayer layer = ScreenManager._sortedActiveLayersCopy[index];
                if (!layer.Finalized)
                {
                    bool?isMousePressed = new bool?();
                    bool?nullable       = mouseInput;
                    bool flag           = false;
                    if (nullable.GetValueOrDefault() == flag & nullable.HasValue)
                    {
                        isMousePressed = new bool?(false);
                    }
                    TaleWorlds.Library.InputType handledInputs = TaleWorlds.Library.InputType.None;
                    InputUsageMask inputUsageMask = layer.InputUsageMask;
                    if (layer.HitTest())
                    {
                        if (ScreenManager.FirstHitLayer == null)
                        {
                            ScreenManager.FirstHitLayer = layer;
                            MouseManager.ActivateMouseCursor(layer.ActiveCursor);
                        }
                        if (!p1.HasAnyFlag <TaleWorlds.Library.InputType>(TaleWorlds.Library.InputType.MouseButton) && inputUsageMask.HasAnyFlag <InputUsageMask>(InputUsageMask.MouseButtons))
                        {
                            isMousePressed = mouseInput;
                            handledInputs |= TaleWorlds.Library.InputType.MouseButton;
                            p1            |= TaleWorlds.Library.InputType.MouseButton;
                        }
                        if (!p1.HasAnyFlag <TaleWorlds.Library.InputType>(TaleWorlds.Library.InputType.MouseWheel) && inputUsageMask.HasAnyFlag <InputUsageMask>(InputUsageMask.MouseWheels))
                        {
                            handledInputs |= TaleWorlds.Library.InputType.MouseWheel;
                            p1            |= TaleWorlds.Library.InputType.MouseWheel;
                        }
                    }
                    if (ScreenManager.FocusTest(layer))
                    {
                        handledInputs |= TaleWorlds.Library.InputType.Key;
                        p1            |= TaleWorlds.Library.InputType.Key;
                    }
                    layer.EarlyProcessEvents(handledInputs, isMousePressed);
                }
            }
            ScreenManager._sortedActiveLayersCopy.Initialize();
        }
예제 #10
0
 public static void RemoveGlobalLayer(GlobalLayer layer)
 {
     ScreenManager._globalLayers.Remove(layer);
     layer.Layer.HandleDeactivate();
     ScreenManager.RefreshGlobalOrder();
 }