/// <summary> /// 履歴に積まれている Window を全部閉じ、履歴を削除します /// </summary> static public void allCloseWindow() { settingCurrentWindow(true); while (history[currentUIType].Count != 0) { var window = history[currentUIType].Pop(); window.gameObject.SetActive(false); } currentWindow = null; }
/// <summary> /// フレームの設定をします /// </summary> /// <param name="window">操作するWindow</param> /// <param name="activate">ボタンをアクティブ化するか</param> static void settingFrame(MyMenuFrame window, bool activate) { window.gameObject.SetActive(true); var buttons = window.GetComponentsInChildren <Button>(); foreach (var button in buttons) { button.interactable = activate; } window.OpenWindow(); }
/// <summary> /// 現在の Window を閉じ、履歴の一番新しいものを表示します /// </summary> static public void cancel() { settingCurrentWindow(true); if (history[currentUIType].Count == 0) { return; } var window = history[currentUIType].Pop(); Debug.Log(history[currentUIType].Count); settingFrame(window, true); currentWindow = window; }
/// <summary> /// Window を開く /// history に追加 /// </summary> /// <param name="window">切り替える Window</param> /// <param name="closeOldWindow">現在開いている Window を閉じるか</param> static public void openWindow(MyMenuFrame window, bool closeOldWindow = false) { if (window == currentWindow) { return; } settingCurrentWindow(closeOldWindow); settingFrame(window, true); if (currentWindow != null) { history[currentUIType].Push(currentWindow); } currentWindow = window; }