using System.Collections; using System.Collections.Generic; using UnityEngine; using System; [CreateAssetMenu(menuName = "Config/WindowConfig")] public class WindowConfig : ScriptableObject { public WindowTable[] windows; static WindowConfig config; public static WindowConfig Get() { if (config == null) { config = Resources.Load("ScriptableObject/Config/WindowConfig"); } return config; } public bool FindChildWindow(string _parent, int _order, out string _child) { for (int i = 0; i < windows.Length; i++) { var table = windows[i]; if (table.parent == _parent) { for (int j = 0; j < table.orderTables.Length; j++) { 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; return true; } } } _parent = string.Empty; return false; } [Serializable] public struct WindowTable { public string parent; public OrderTable[] orderTables; } [Serializable] public struct OrderTable { public int order; public string window; } }