Ejemplo n.º 1
0
        public static void Init()
        {
            if (isInit)
            {
                return;
            }

            isInit = true;
            pathDataDic.Clear();
            if (ResourcesManager.assetsLoadType == AssetsLoadType.Resources)
            {
                AssetData[] res = ResourcesManager.LoadAssets(fileName);
                if (res.Length > 0 && res[0].asset)
                {
                    TextAsset tex  = (TextAsset)res[0].asset;
                    string    text = tex.text;
                    pathDataDic = LoadPathData(text);
                }
            }
            else
            {
                string filePathPer    = Application.persistentDataPath + "/" + fileName + ".txt";
                string filePathStream = Application.streamingAssetsPath + "/" + fileName + ".assetbundle";

                string textDataPer = FileUtils.LoadTextFileByPath(filePathPer);
                Dictionary <string, string> pathDataPer = LoadPathData(textDataPer);

                AssetData[] resArr = AssetBundleLoadManager.LoadAssets(filePathStream, false);
                TextAsset   tex    = (TextAsset)resArr[0].asset;
                string      text   = tex.text;
                //Debug.Log(text);
                pathDataDic = LoadPathData(text);
                List <string> list = new List <string>(pathDataDic.Keys);
                for (int i = 0; i < list.Count; i++)
                {
                    pathDataDic[list[i]] = Application.streamingAssetsPath + "/" + pathDataDic[list[i]];
                }
                foreach (string key in pathDataPer.Keys)
                {
                    if (pathDataDic.ContainsKey(key))
                    {
                        pathDataDic[key] = Application.persistentDataPath + "/" + pathDataPer[key];
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public static Dictionary <string, object> GetConfig(string configName)
 {
     if (confDatas.ContainsKey(configName))
     {
         return(confDatas[configName]);
     }
     else
     {
         string text = ResourcesManager.LoadTextFileByName(configName);
         Dictionary <string, object> data = LoadData(text);
         if (data == null)
         {
             return(null);
         }
         confDatas.Add(configName, data);
         return(data);
     }
 }
Ejemplo n.º 3
0
 public static void Clear()
 {
     ResourcesManager.ReleaseAll();
     pathDataDic.Clear();
     isInit = false;
 }