From bc1cb6da854cb2e9144f10ed55330a537ecdca16 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 04 三月 2026 14:35:57 +0800
Subject: [PATCH] 466 h5版本 资源规则修改 打包修改(未完成 勿拉取)
---
Main/Component/UI/Common/WindowConfig.cs | 62 +++++++++++++++---------------
1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/Main/Component/UI/Common/WindowConfig.cs b/Main/Component/UI/Common/WindowConfig.cs
index 6ec3bc1..d9e1fb5 100644
--- a/Main/Component/UI/Common/WindowConfig.cs
+++ b/Main/Component/UI/Common/WindowConfig.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using System;
+using Cysharp.Threading.Tasks;
[CreateAssetMenu(menuName = "Config/WindowConfig")]
public class WindowConfig : ScriptableObject
@@ -12,11 +13,11 @@
[NonSerialized] public List<string> childWindows = new List<string>();
static WindowConfig config;
- static WindowConfig Get()
+ public static async UniTask<WindowConfig> Get()
{
if (config == null)
{
- config = BuiltInLoader.LoadScriptableObject<WindowConfig>("WindowConfig");
+ config = await BuiltInLoader.LoadScriptableObjectAsync<WindowConfig>("WindowConfig");
foreach (var table in config.windows)
{
var children = config.parentChildrenTable[table.parent] = new List<string>();
@@ -24,12 +25,11 @@
{
children.Add(info.window);
}
-
config.childWindows.AddRange(children);
}
}
-
return config;
+
}
public static void Release()
@@ -37,29 +37,28 @@
config = null;
}
- public static bool FindParentWindow(string child, out string parent)
+ public static async UniTask<(bool found, string parent)> FindParentWindow(string child)
{
- foreach (var table in Get().windows)
+ var cfg = await Get();
+ foreach (var table in cfg.windows)
{
foreach (var orderTable in table.orderTables)
{
if (orderTable.window == child)
{
- parent = table.parent;
- return true;
+ return (true, table.parent);
}
}
}
-
- parent = string.Empty;
- return false;
+ return (false, string.Empty);
}
- public static List<string> GetChildWindows(string parent)
+ public static async UniTask<List<string>> GetChildWindows(string parent)
{
- if (Get().parentChildrenTable.ContainsKey(parent))
+ var cfg = await Get();
+ if (cfg.parentChildrenTable.ContainsKey(parent))
{
- return Get().parentChildrenTable[parent];
+ return cfg.parentChildrenTable[parent];
}
else
{
@@ -67,73 +66,74 @@
}
}
- public static bool IsParentWindow(string name)
+ public static async UniTask<bool> IsParentWindow(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return true;
}
}
-
return false;
}
- public static bool IsChildWindow(string name)
+ public static async UniTask<bool> IsChildWindow(string name)
{
- return Get().childWindows.Contains(name);
+ var cfg = await Get();
+ return cfg.childWindows.Contains(name);
}
- public static WindowLevel GetWindowLevel(string name)
+ public static async UniTask<WindowLevel> GetWindowLevel(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return window.level;
}
}
-
return WindowLevel.None;
}
- public static string GetWindowPattern(string name)
+ public static async UniTask<string> GetWindowPattern(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return window.pattern;
}
}
-
return string.Empty;
}
- public static List<OrderTable> GetWindowFunctionInfos(string parent)
+ public static async UniTask<List<OrderTable>> GetWindowFunctionInfos(string parent)
{
- foreach (var table in Get().windows)
+ var cfg = await Get();
+ foreach (var table in cfg.windows)
{
if (table.parent == parent)
{
return new List<OrderTable>(table.orderTables);
}
}
-
return null;
}
- public static string GetTitleIconKey(string name)
+ public static async UniTask<string> GetTitleIconKey(string name)
{
- foreach (var window in Get().windows)
+ var cfg = await Get();
+ foreach (var window in cfg.windows)
{
if (window.parent == name)
{
return window.titleIconKey;
}
}
-
return string.Empty;
}
--
Gitblit v1.8.0