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