Ejemplo n.º 1
0
    public static void RefreshUIConfig()
    {
        _objects.Clear();
        foreach (string fileURL in _path)
        {
            string[] array = fileURL.Split(':');
            DirectoryInfo directoryInfo = new DirectoryInfo(_folderPath + array[0]);

            GetPrefabRecursively(directoryInfo, _objects, array[1]);
        }

        string sourcePath = "Assets/ZGame/AssetPackage/Export/Config/uiConfig.asset";
        UIConfigDictionary assetData = AssetDatabase.LoadAssetAtPath(sourcePath, typeof(UIConfigDictionary)) as UIConfigDictionary;

        if (null == assetData)
        {
            assetData = ScriptableObject.CreateInstance(typeof(UIConfigDictionary)) as UIConfigDictionary;
            AssetDatabase.CreateAsset(assetData, sourcePath);
        }

        assetData.itemList.Clear();
        int index = 0;
        foreach (UnityEngine.Object obj in _objects)
        {
            UIConfig def = new UIConfig() { isCache = false, id = index, name = obj.name, scripts = GetScriptname(obj.name) };
            assetData.itemList.Add(def);
            index++;
        }

        EditorUtility.SetDirty(assetData);
        AssetDatabase.SaveAssets();
    }
Ejemplo n.º 2
0
 void Awake()
 {
     if (_instance != null)
     {
         Destroy(this);
     }
     else
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
 }