Beispiel #1
0
        private static void LateUpdate(float dt)
        {
            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;
            bool flag  = false;

            for (int index = 0; index < count; ++index)
            {
                ScreenLayer layer = ScreenManager._sortedActiveLayersCopy[index];
                if (ScreenManager.FocusTest(layer))
                {
                    flag = true;
                }
                layer.LateProcessEvents();
                if (!flag)
                {
                    ScreenLayer focusedLayer = ScreenManager._focusedLayer;
                }
            }
            for (int index = 0; index < count; ++index)
            {
                ScreenLayer screenLayer = ScreenManager._sortedActiveLayersCopy[index];
                screenLayer.OnLateUpdate(dt);
                if (screenLayer != ScreenManager.FirstHitLayer)
                {
                    screenLayer.Input.ResetLastDownKeys();
                }
            }
            ScreenManager._sortedActiveLayersCopy.Initialize();
            ScreenManager.FirstHitLayer?.Input?.UpdateLastDownKeys();
            ScreenManager.FirstHitLayer = (ScreenLayer)null;
        }
Beispiel #2
0
        private static void Update()
        {
            ScreenManager.UpdateMouseVisibility();
            List <ScreenLayer> sortedActiveLayers = ScreenManager.SortedActiveLayers;

            if (ScreenManager._sortedActiveLayersCopyForUpdate.Length != sortedActiveLayers.Capacity)
            {
                ScreenManager._sortedActiveLayersCopyForUpdate = new ScreenLayer[sortedActiveLayers.Capacity];
            }
            sortedActiveLayers.CopyTo(ScreenManager._sortedActiveLayersCopyForUpdate);
            for (int index = sortedActiveLayers.Count - 1; index >= 0; --index)
            {
                ScreenLayer screenLayer = ScreenManager._sortedActiveLayersCopyForUpdate[index];
                if (!screenLayer.Finalized)
                {
                    screenLayer.ProcessEvents();
                }
            }
            for (int count = sortedActiveLayers.Count; count < ScreenManager._sortedActiveLayersCopyForUpdate.Length; ++count)
            {
                ScreenManager._sortedActiveLayersCopyForUpdate[count] = (ScreenLayer)null;
            }
        }
Beispiel #3
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();
        }