ui-system-fix #4

Merged
BitterSmile merged 12 commits from ui-system-fix into main 2024-02-12 19:06:53 +01:00
Showing only changes of commit 0148de0db7 - Show all commits

View File

@ -55,25 +55,29 @@ namespace NEG.UI.UnityUi
private void SetDirectionInput()
{
if (EventSystem.current == null)
if (EventSystem.current == null || MonoUiManager.Instance == null || CurrentSelectionSource == SelectionSource.Direction)
{
return;
}
CurrentSelectionSource = SelectionSource.Direction;
Cursor.visible = false;
if (EventSystem.current.currentSelectedGameObject == null)
if (EventSystem.current.currentSelectedGameObject == null && MonoUiManager.Instance.CurrentMainWindow != null)
{
EventSystem.current.SetSelectedGameObject(((MonoWindow)MonoUiManager.Instance.CurrentMainWindow).DefaultSelectedItem);
return;
}
var data = new PointerEventData(EventSystem.current);
var currentSelected = EventSystem.current.currentSelectedGameObject;
for (var current = EventSystem.current.currentSelectedGameObject.transform;
current != null;
current = current.parent)
if (currentSelected != null)
{
ExecuteEvents.Execute(current.gameObject, data, ExecuteEvents.pointerExitHandler);
for (var current = EventSystem.current.currentSelectedGameObject.transform;
current != null;
current = current.parent)
{
ExecuteEvents.Execute(current.gameObject, data, ExecuteEvents.pointerExitHandler);
}
}
EventSystem.current.SetSelectedGameObject(currentSelected);
}