| | |
| | | } |
| | | } |
| | | |
| | | Dictionary<string, Window> windows = new Dictionary<string, Window>(); |
| | | |
| | | Windows windows = new Windows(); |
| | | List<OpenCommand> openCommands = new List<OpenCommand>(); |
| | | List<CloseCommand> closeCommands = new List<CloseCommand>(); |
| | | |
| | |
| | | |
| | | public void CloseAll(CloseAllIgnoreType ignoreType = CloseAllIgnoreType.System) |
| | | { |
| | | foreach (var window in windows.Values) |
| | | for (var i = windows.Keys.Count - 1; i >= 0; i--) |
| | | { |
| | | var name = windows.Keys[i]; |
| | | var window = windows[name]; |
| | | if (window == null) |
| | | { |
| | | continue; |
| | |
| | | isIgnore = window.windowInfo.windowType <= WindowType.Base; |
| | | break; |
| | | case CloseAllIgnoreType.BaseAndCustom: |
| | | isIgnore = window.windowInfo.windowType <= WindowType.Base || closeAllIgnoreWindows.Contains(window.name); |
| | | isIgnore = window.windowInfo.windowType <= WindowType.Base || closeAllIgnoreWindows.Contains(name); |
| | | break; |
| | | case CloseAllIgnoreType.System: |
| | | isIgnore = window.windowInfo.windowType >= WindowType.System; |
| | | break; |
| | | case CloseAllIgnoreType.Custom: |
| | | isIgnore = closeAllIgnoreWindows.Contains(window.name); |
| | | isIgnore = closeAllIgnoreWindows.Contains(name); |
| | | break; |
| | | case CloseAllIgnoreType.SystemAndCustom: |
| | | isIgnore = window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(window.name); |
| | | isIgnore = window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(name); |
| | | break; |
| | | } |
| | | |
| | |
| | | { |
| | | if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening) |
| | | { |
| | | window.CloseImmediately(); |
| | | Close(name); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public void CloseOthers<T>() where T : Window |
| | | { |
| | | foreach (var name in windows.Keys) |
| | | for (var i = windows.Keys.Count - 1; i >= 0; i--) |
| | | { |
| | | var name = windows.Keys[i]; |
| | | var window = windows[name]; |
| | | if (window is T) |
| | | if (window == null || window is T) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | |
| | | public void CloseOthers(List<string> windowNames, CloseAllIgnoreType ignoreType) |
| | | { |
| | | foreach (var name in windows.Keys) |
| | | for (var i = windows.Keys.Count - 1; i >= 0; i--) |
| | | { |
| | | var name = windows.Keys[i]; |
| | | var window = windows[name]; |
| | | if (window == null) |
| | | { |
| | |
| | | asyncLoad.StopAllTasks(); |
| | | } |
| | | |
| | | public void DestoryWinsByStage(WindowStage _windowStage) |
| | | public void DestoryWinsByStage(WindowStage windowStage) |
| | | { |
| | | switch (_windowStage) |
| | | switch (windowStage) |
| | | { |
| | | case WindowStage.Launch: |
| | | DestroyWin<DownLoadWin>(); |
| | |
| | | break; |
| | | } |
| | | |
| | | UnLoadAssetBundle(_windowStage); |
| | | UnLoadAssetBundle(windowStage); |
| | | } |
| | | |
| | | public void DestroyWin<T>() where T : Window |
| | |
| | | public bool ExistAnyFullScreenOrMaskWin() |
| | | { |
| | | var exist = false; |
| | | foreach (var window in windows.Values) |
| | | foreach (var name in windows.Keys) |
| | | { |
| | | var window = windows[name]; |
| | | if (window.windowInfo.needMask || window.windowInfo.fullScreen) |
| | | { |
| | | if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening) |
| | |
| | | public bool ExistAnyFullScreenOrMaskWinLEqual(WindowType windowType) |
| | | { |
| | | var exist = false; |
| | | foreach (var window in windows.Values) |
| | | foreach (var name in windows.Keys) |
| | | { |
| | | var window = windows[name]; |
| | | if ((window.windowInfo.needMask || window.windowInfo.fullScreen) && window.windowInfo.windowType >= windowType) |
| | | { |
| | | if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening) |
| | |
| | | { |
| | | var exceptOpen = StageLoad.Instance.stageType == Stage.E_StageType.Dungeon |
| | | && !ExistAnyFullScreenOrMaskWinLEqual(WindowType.Base) |
| | | && !IsOpen("DefaultDialogueBoxWin") |
| | | && !IsOpen("DefaultDialogueBoxWin") |
| | | && !IsOpen("DialogueDuidanceWin") |
| | | && !IsOpen("TaskBoxBGMWin"); |
| | | |
| | |
| | | SystemAndCustom = 5, |
| | | } |
| | | |
| | | class Windows |
| | | { |
| | | Dictionary<string, Window> windows = new Dictionary<string, Window>(); |
| | | List<string> windowKeys = new List<string>(); |
| | | |
| | | public Window this[string key] |
| | | { |
| | | get { return windows[key]; } |
| | | set |
| | | { |
| | | windows[key] = value; |
| | | if (!windowKeys.Contains(key)) |
| | | { |
| | | windowKeys.Add(key); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public List<string> Keys { get { return windowKeys; } } |
| | | |
| | | public bool ContainsKey(string key) |
| | | { |
| | | return windowKeys.Contains(key); |
| | | } |
| | | |
| | | public bool TryGetValue(string key, out Window window) |
| | | { |
| | | return windows.TryGetValue(key, out window); |
| | | } |
| | | |
| | | public void Remove(string key) |
| | | { |
| | | windows.Remove(key); |
| | | windowKeys.Remove(key); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |