少年修仙传客户端代码仓库
client_Wu Xijin
2018-08-20 ddcba938b4b7cb150170a07d59b480d0748a476c
UI/Common/WindowConfig.cs
@@ -4,77 +4,77 @@
using System;
[CreateAssetMenu(menuName = "Config/WindowConfig")]
public class WindowConfig : ScriptableObject
public class WindowConfig : ScriptableObject
{
    public WindowTable[] windows;
    static WindowConfig config;
    public static WindowConfig Get()
    {
        if (config == null)
        {
            config = Resources.Load<WindowConfig>("ScriptableObject/Config/WindowConfig");
        }
        return config;
    public static WindowConfig Get()
    {
        if (config == null)
        {
            config = Resources.Load<WindowConfig>("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 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;
    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;
    public struct WindowTable
    {
        public string parent;
        public OrderTable[] orderTables;
    }
    [Serializable]
    public struct OrderTable
    {
        public int order;
        public string window;
    public struct OrderTable
    {
        public int order;
        public string window;
    }
}