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(); }