From 5835be48726bf558e03ad4fff0d28e2eceedd92c Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 12 二月 2019 11:42:36 +0800
Subject: [PATCH] 3335 重构窗口管理
---
System/WindowBase/WindowCenter.cs | 52 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/System/WindowBase/WindowCenter.cs b/System/WindowBase/WindowCenter.cs
index 6c9ed44..06d42d1 100644
--- a/System/WindowBase/WindowCenter.cs
+++ b/System/WindowBase/WindowCenter.cs
@@ -22,10 +22,8 @@
};
UIRoot m_UIRoot;
- public UIRoot uiRoot
- {
- get
- {
+ public UIRoot uiRoot {
+ get {
if (m_UIRoot == null)
{
var prefab = BuiltInLoader.LoadPrefab("UIRoot");
@@ -42,10 +40,8 @@
}
WindowAsyncLoad m_AnyncLoad;
- public WindowAsyncLoad asyncLoad
- {
- get
- {
+ public WindowAsyncLoad asyncLoad {
+ get {
if (m_AnyncLoad == null)
{
var gameObject = new GameObject("WindowAnyncLoad");
@@ -170,10 +166,29 @@
public void Close(string name)
{
- PushCloseCommand(new CloseCommand()
+ if (WindowConfig.Get().IsChildWindow(name))
{
- name = name,
- });
+ CloseImmediately(name);
+ }
+ else
+ {
+ PushCloseCommand(new CloseCommand()
+ {
+ name = name,
+ });
+ }
+ }
+
+ public void CloseImmediately(string name)
+ {
+ Window window;
+ if (windows.TryGetValue(name, out window))
+ {
+ if (window.windowState != Window.WindowState.Closed)
+ {
+ window.CloseImmediately();
+ }
+ }
}
private void PushCloseCommand(CloseCommand command)
@@ -228,6 +243,7 @@
break;
}
+ isIgnore = isIgnore || WindowConfig.Get().IsChildWindow(name);
if (!isIgnore)
{
if (window.windowState == Window.WindowState.Opened || window.windowState == Window.WindowState.Opening)
@@ -247,6 +263,12 @@
var name = windows.Keys[i];
var window = windows[name];
if (window == null || window is T)
+ {
+ continue;
+ }
+
+ var isIgnore = WindowConfig.Get().IsChildWindow(name);
+ if (isIgnore)
{
continue;
}
@@ -293,6 +315,8 @@
isIgnore = windowNames.Contains(name) || window.windowInfo.windowType >= WindowType.System || closeAllIgnoreWindows.Contains(name);
break;
}
+
+ isIgnore = isIgnore || WindowConfig.Get().IsChildWindow(name);
if (!isIgnore)
{
@@ -721,11 +745,9 @@
Dictionary<string, Window> windows = new Dictionary<string, Window>();
List<string> windowKeys = new List<string>();
- public Window this[string key]
- {
+ public Window this[string key] {
get { return windows[key]; }
- set
- {
+ set {
windows[key] = value;
if (!windowKeys.Contains(key))
{
--
Gitblit v1.8.0