From 3b50d06d004ecc31df7ecaa57927fa35c1ea608e Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期日, 28 四月 2019 16:59:23 +0800
Subject: [PATCH] 3335 修改界面功能框架。
---
UI/Common/WindowConfig.cs | 141 +++++++++++++++++++++++++++++++++-------------
1 files changed, 100 insertions(+), 41 deletions(-)
diff --git a/UI/Common/WindowConfig.cs b/UI/Common/WindowConfig.cs
index f1cbefe..0c6a29e 100644
--- a/UI/Common/WindowConfig.cs
+++ b/UI/Common/WindowConfig.cs
@@ -6,25 +6,23 @@
[CreateAssetMenu(menuName = "Config/WindowConfig")]
public class WindowConfig : ScriptableObject
{
-
public WindowTable[] windows;
[NonSerialized] public Dictionary<string, List<string>> parentChildrenTable = new Dictionary<string, List<string>>();
[NonSerialized] public List<string> childWindows = new List<string>();
static WindowConfig config;
- public static WindowConfig Get()
+ static WindowConfig Get()
{
if (config == null)
{
config = BuiltInLoader.LoadScriptableObject<WindowConfig>("WindowConfig");
- for (int i = 0; i < config.windows.Length; i++)
+ foreach (var table in config.windows)
{
- var table = config.windows[i];
var children = config.parentChildrenTable[table.parent] = new List<string>();
- for (int j = 0; j < table.orderTables.Length; j++)
+ foreach (var info in table.orderTables)
{
- children.Add(table.orderTables[j].window);
+ children.Add(info.window);
}
config.childWindows.AddRange(children);
@@ -39,53 +37,29 @@
config = null;
}
- public bool FindChildWindow(string _parent, int _order, out string _child)
+ public static bool FindParentWindow(string child, out string parent)
{
- for (int i = 0; i < windows.Length; i++)
+ foreach (var table in Get().windows)
{
- var table = windows[i];
- if (table.parent == _parent)
+ foreach (var orderTable in table.orderTables)
{
- for (int j = 0; j < table.orderTables.Length; j++)
+ if (orderTable.window == child)
{
- if (table.orderTables[j].order == _order)
- {
- _child = table.orderTables[j].window;
- return true;
- }
- }
- }
- }
-
- _child = string.Empty;
- return false;
- }
-
- public bool FindParentWindow(string _child, out string _parent)
- {
- for (int i = 0; i < windows.Length; i++)
- {
- var table = windows[i];
- for (int j = 0; j < table.orderTables.Length; j++)
- {
- var orderTable = table.orderTables[j];
- if (orderTable.window == _child)
- {
- _parent = table.parent;
+ parent = table.parent;
return true;
}
}
}
- _parent = string.Empty;
+ parent = string.Empty;
return false;
}
- public List<string> FindChildWindows(string _parent)
+ public static List<string> GetChildWindows(string parent)
{
- if (parentChildrenTable.ContainsKey(_parent))
+ if (Get().parentChildrenTable.ContainsKey(parent))
{
- return parentChildrenTable[_parent];
+ return Get().parentChildrenTable[parent];
}
else
{
@@ -93,15 +67,89 @@
}
}
- public bool IsChildWindow(string _name)
+ public static bool IsParentWindow(string name)
{
- return childWindows.Contains(_name);
+ foreach (var window in Get().windows)
+ {
+ if (window.parent == name)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public static bool IsChildWindow(string name)
+ {
+ return Get().childWindows.Contains(name);
+ }
+
+ public static WindowLevel GetWindowLevel(string name)
+ {
+ foreach (var window in Get().windows)
+ {
+ if (window.parent == name)
+ {
+ return window.level;
+ }
+ }
+
+ return WindowLevel.None;
+ }
+
+ public static string GetWindowPattern(string name)
+ {
+ foreach (var window in Get().windows)
+ {
+ if (window.parent == name)
+ {
+ return window.pattern;
+ }
+ }
+
+ return string.Empty;
+ }
+
+ public static OrderTable GetWindowFunctionInfo(string parent, string child)
+ {
+ foreach (var table in Get().windows)
+ {
+ if (table.parent == parent)
+ {
+ foreach (var info in table.orderTables)
+ {
+ if (info.window == child)
+ {
+ return info;
+ }
+ }
+ }
+ }
+
+ return default(OrderTable);
+ }
+
+ public static string GetTitleIconKey(string name)
+ {
+ foreach (var window in Get().windows)
+ {
+ if (window.parent == name)
+ {
+ return window.titleIconKey;
+ }
+ }
+
+ return string.Empty;
}
[Serializable]
public struct WindowTable
{
public string parent;
+ public string titleIconKey;
+ public WindowLevel level;
+ public string pattern;
public OrderTable[] orderTables;
}
@@ -109,7 +157,18 @@
public struct OrderTable
{
public int order;
+ public int functionId;
+ public int redPointId;
+ public string titleKey;
public string window;
}
+ public enum WindowLevel
+ {
+ None,
+ OneLevel,
+ SecondLevel,
+ ThirdLevel,
+ }
+
}
--
Gitblit v1.8.0