static void CreatePreloadInfo(string game) { PreloadConfig preload = new PreloadConfig(); string path = pathConfig_Editor + "/" + game + "/preload.config"; FileUtil.SaveFile(path, preload.ToString()); CopyToStreamingAssets(game, path); }
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)); } }
void initAppConfig() { string[] gs = System.Enum.GetNames(typeof(GameEnum)); APPVersion app = new APPVersion(); //AssetConfig for (int i = 0; i < gs.Length; i++) { GameVersion ver = new GameVersion(gs[i], "name:" + gs[i]); app.Add(ver); AssetVersion aver = new AssetVersion(); aver.assetVersion = 0; AssetbundleConfig abcon = new AssetbundleConfig(); abcon.AddAssetBundle("test", "has001"); PreloadConfig pre = new PreloadConfig(); FileUtil.SaveFile(path + "/" + gs[i] + "/assetVersion.config", aver.ToStr()); FileUtil.SaveFile(path + "/" + gs[i] + "/abConfig.config", abcon.ToString()); FileUtil.SaveFile(path + "/" + gs[i] + "/preloadConfig.config", pre.ToString()); } FileUtil.SaveFile(path + "/appVersion.config", app.ToString()); //appversion }
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)); }