void initAssetManager()
 {
     string[] strs = System.Enum.GetNames(typeof(NEngine.Game.GameEnum));
     for (int i = 0; i < strs.Length; i++)
     {
         AssetVersion      ver1 = AssetVersion.FromString(FileUtil.ReadFromFile(appConfigPath_old + "/Conn/" + strs[i] + "/assetVersion.config"));
         AssetbundleConfig ver2 = AssetbundleConfig.FromString(FileUtil.ReadFromFile(appConfigPath_old + "/Conn/" + strs[i] + "/abConfig.config"));
         PreloadConfig     ver3 = PreloadConfig.FromString(FileUtil.ReadFromFile(appConfigPath_old + "/Conn/" + strs[i] + "/preloadConfig.config"));
         App.GetMgr <AssetManager>().AddAssetConfig(strs[i], new AssetConfig(strs[i], ver1, ver2, ver3));
     }
 }
示例#2
0
        protected AssetConfig LoadLocalConfig(string game)
        {
            Debug.Log("资源配置文件loading");
            string path = Application.streamingAssetsPath + "/CONFIG/" + game;

            string[]          files        = System.IO.Directory.GetFiles(path);
            AssetbundleConfig bundle       = null;
            AssetVersion      assetversion = null;
            PreloadConfig     preload      = null;
            string            str          = "";
            string            name         = "";

            for (int i = 0; i < files.Length; i++)
            {
                str = "";
                using (System.IO.StreamReader sr = new System.IO.StreamReader(files[i]))
                {
                    name = Util.GetFileName(files[i]);
                    str  = sr.ReadToEnd();
                    //str = System.Text.Encoding.UTF8.GetString(System.Text.Encoding.UTF8.GetBytes(str));
                    if (name == "bundle.config")
                    {
                        bundle = AssetbundleConfig.FromString(str);
                    }
                    else if (name == "assetVersion.config")
                    {
                        assetversion = AssetVersion.FromString(str);
                    }
                    else if (name == "preload.config")
                    {
                        preload = PreloadConfig.FromString(str);
                    }
                    sr.Close();
                }
            }
            return(new AssetConfig(game, assetversion, bundle, preload));
        }