コード例 #1
0
        //初始化
        void Load()
        {
            m_tab       = EditorPrefs.GetInt("PrefabWin Prefab Tab", 0);
            SizePercent = EditorPrefs.GetFloat("PrefabWin_SizePercent", 0.5f);

            foreach (PreviewItem item in mItems)
            {
                DestroyTexture(item);
            }
            mItems.Clear();

            //读取本地存储的数据
            string data = EditorPrefs.GetString(saveKey, "");

            if (string.IsNullOrEmpty(data))
            {
                Resets();
            }
            else
            {
                if (string.IsNullOrEmpty(data))
                {
                    return;
                }
                string[] guids = data.Split('|');
                foreach (string s in guids)
                {
                    AddGUID(s, -1);
                }
                RectivateLights();
            }

            //加载默认文件夹里面的资源
            if (m_tab == 0 && Configure.PrefabWinBasicComPath != "")
            {
                List <string> filtered = UIEditorHelper.GetAllPrefabs(Configure.PrefabWinBasicComPath);
                for (int i = 0; i < filtered.Count; i++)
                {
                    AddGUID(AssetDatabase.AssetPathToGUID(filtered[i]), -1);
                }
                RectivateLights();
            }

            if (m_tab == 1 && Configure.PrefabWinCommonPanelPath != "")
            {
                List <string> filtered = UIEditorHelper.GetAllPrefabs(Configure.PrefabWinCommonPanelPath);
                for (int i = 0; i < filtered.Count; i++)
                {
                    AddGUID(AssetDatabase.AssetPathToGUID(filtered[i]), -1);
                }
                RectivateLights();
            }

            loadTextData(Configure.ColorDataPath, ref colocDic);
            loadTextData(Configure.UIWidgetPath, ref uiWidgetDic);
            loadTextData(Configure.UIInfoPath, ref uiInfoDic);
            loadTextData(Configure.UIStatePath, ref uiStateDic);
        }