moa fixes
This commit is contained in:
parent
164fd2f794
commit
566430650f
@ -27,6 +27,7 @@ namespace NEG.Utils
|
||||
action?.Invoke();
|
||||
}
|
||||
|
||||
public static void ActionAfterEndOfFrame(this MonoBehaviour mono, Action action) => mono.StartCoroutine(ActionAtNextFrame(action));
|
||||
public static IEnumerator ActionAfterEndOfFrame(Action action)
|
||||
{
|
||||
yield return WaitForEndOfFrame;
|
||||
|
||||
@ -150,19 +150,13 @@ namespace NEG.UI
|
||||
|
||||
public virtual void Dispose() => Instance = null;
|
||||
|
||||
public void SetMainWindow(IWindow window) => mainWindows.Add(window);
|
||||
public void SetMainWindow(IWindow window) => mainWindows.Add(window);
|
||||
|
||||
public void MainWindowClosed(IWindow window) => mainWindows.Remove(window);
|
||||
|
||||
public void OnWindowClosed(IWindow window)
|
||||
{
|
||||
if(CurrentMainWindow != window)
|
||||
return;
|
||||
|
||||
MainWindowClosed(window);
|
||||
//TODO: select new main window
|
||||
}
|
||||
public void OnWindowClosed(IWindow window) => MainWindowClosed(window);
|
||||
|
||||
//TODO: select new main window
|
||||
protected void PopupClosed(PopupData data)
|
||||
{
|
||||
if (currentShownPopup.data != data)
|
||||
|
||||
@ -12,7 +12,7 @@ namespace NEG.UI.Area
|
||||
protected override void OnBackUsed(IControllable.BackUsed backUsed)
|
||||
{
|
||||
base.OnBackUsed(backUsed);
|
||||
UiManager.Instance.CurrentMainWindow.Close();
|
||||
UiManager.Instance.CurrentMainWindow?.Close();
|
||||
backUsed.Used = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
fileFormatVersion: 2
|
||||
guid: 39eb59ca1ef60934abb3f0c64169be65
|
||||
timeCreated: 1670707479
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 10
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -22,6 +22,8 @@ namespace NEG.UI.UnityUi
|
||||
{
|
||||
var defaultActions = new DefaultInputActions();
|
||||
InputActionReference.Create(defaultActions.UI.Navigate).action.performed += (ctx) => OnSelectionChangeStarted();
|
||||
InputActionReference.Create(defaultActions.UI.Cancel).action.performed +=
|
||||
(_) => UiManager.Instance.UseBack();
|
||||
defaultActions.Enable();
|
||||
|
||||
if (Gamepad.current != null)
|
||||
|
||||
@ -24,6 +24,8 @@ namespace NEG.UI.UnityUi.Window
|
||||
|
||||
public bool IsMainWindow { get; private set; }
|
||||
|
||||
public bool IsOpened { get; protected set; }
|
||||
|
||||
private IWindowSlot DefaultWindowSlot => windowSlots[0];
|
||||
public GameObject DefaultSelectedItem => defaultSelectedItem;
|
||||
|
||||
@ -34,6 +36,7 @@ namespace NEG.UI.UnityUi.Window
|
||||
public void SetOpenedState(IWindowSlot parentSlot, object data)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
IsOpened = true;
|
||||
Parent = parentSlot;
|
||||
EventSystem.current.SetSelectedGameObject(defaultSelectedItem);
|
||||
if (parentSlot.OpenWindowAsMain)
|
||||
@ -44,6 +47,7 @@ namespace NEG.UI.UnityUi.Window
|
||||
public void SetClosedState()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
IsOpened = false;
|
||||
Parent = null;
|
||||
((ISlotsHolder)this).CloseAllWindows();
|
||||
UiManager.Instance.OnWindowClosed(this);
|
||||
@ -58,8 +62,10 @@ namespace NEG.UI.UnityUi.Window
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if(gameObject.activeSelf)
|
||||
if (IsOpened)
|
||||
{
|
||||
UiManager.Instance.OnWindowClosed(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnValidate()
|
||||
|
||||
@ -4,7 +4,7 @@ MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 10
|
||||
executionOrder: 11
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user