Beispiel #1
0
        public static void ReadGameRes()
        {
            TextAsset resEditor = AssetDatabase.LoadAssetAtPath <TextAsset>(PathConfig.resEditor);
            TextAsset resBundle = AssetDatabase.LoadAssetAtPath <TextAsset>(PathConfig.resBundle);

            if (resEditor == null || resBundle == null)
            {
                return;
            }
            List <GameResInfo>    editorItems = TableUtil.ReadContent <GameResInfo>(resEditor.text);
            List <GameBundleInfo> bundleItems = TableUtil.ReadContent <GameBundleInfo>(resBundle.text);
            SortedDictionary <string, GameResourceData> dict = null;


            for (int i = 0; i < bundleItems.Count; ++i)
            {
                GameResourceData item = new GameResourceData(bundleItems[i], editorItems[i]);
                if (GameResourceDict.ContainsKey(item.type))
                {
                    dict = GameResourceDict[item.type];
                }
                else
                {
                    dict = new SortedDictionary <string, GameResourceData>();
                    GameResourceDict[item.type] = dict;
                }

                if (dict.ContainsKey(item.name))
                {
                    continue;
                }
                dict[item.name] = item;
            }
        }