private IEnumerator LoadLocalGameResAsync() { string xmlPath = string.Format("{0}{1}", ABConfiger.PACKAGE_STREAMING_DATA_PATH, TableGameRes.FILE_NAME); Debug.Log("streaming xml file path==" + xmlPath); WWW xmlWWW = new WWW(xmlPath); yield return(xmlWWW); byte[] datas = xmlWWW.bytes; if (datas == null || datas.Length <= 0) { Debug.LogError("Load resConfig xml in streaming path error!"); yield break; } // copy file to sandbox string sandBoxPath = ABConfiger.GetSandboxFilePath(TableGameRes.FILE_NAME); File.WriteAllBytes(sandBoxPath, datas); xmlWWW.Dispose(); xmlWWW = null; // read file in sandbox localTableResConfig = XMLSerializer.Read <TableGameRes>(datas) as TableGameRes; LoadResConfigComplete(); }
/// <summary> /// 同步大厅资源配置数据 /// </summary> /// <param name="lobbyResConfig"></param> public void SyncLobbyResConfig(LobbyResConfig lobbyResConfig) { LocalTableResConfig.lobbyResConfig = lobbyResConfig; ABAssetDataMgr.Instance.SyncLobbyAssetInfo(LocalTableResConfig); string xmlPath = ABConfiger.GetSandboxFilePath(TableGameRes.FILE_NAME); XMLSerializer.Save <TableGameRes>(xmlPath, LocalTableResConfig); }
/// <summary> /// 读取本地资源配置数据 /// </summary> public void LoadLocalGameRes() { // 首先读取沙盒目录下资源配置文件 string xmlPath = ABConfiger.GetSandboxFilePath(TableGameRes.FILE_NAME); Debug.Log("Sandbox xml file path====" + xmlPath); if (MLFileUtil.CheckFileExits(xmlPath)) { localTableResConfig = XMLSerializer.Read <TableGameRes>(xmlPath) as TableGameRes; LoadResConfigComplete(); return; } CoroutineManger.Instance.StartCoroutine(LoadLocalGameResAsync()); }
/// <summary> /// 同步具体产品游戏资源配置数据 /// </summary> public void SyncGameResConfig(GameResConfig gameResConfig, int productId) { BaseRes newGameRes = gameResConfig.FindProductRes(productId); if (newGameRes == null) { return; } LocalTableResConfig.gameResConfig.RebuildGameRes(newGameRes, productId); ABAssetDataMgr.Instance.SyncGameAssetInfo(LocalTableResConfig, productId); string xmlPath = ABConfiger.GetSandboxFilePath(TableGameRes.FILE_NAME); XMLSerializer.Save <TableGameRes>(xmlPath, LocalTableResConfig); }
private IEnumerator StartDownload(WWWRequest request) { //Debug.Log("url=====" + request.url); request.www = new WWW(request.url); yield return(request.www); while (!request.www.isDone) { yield return(null); } string filePath = ABConfiger.GetSandboxFilePath(path); Debugger.Log("filePath===" + filePath); byte[] datas = request.www.bytes; MLFileUtil.SaveFile(filePath, bundleFullPath, datas); }