// 同步大厅资源信息 public void SyncLobbyAssetInfo(TableGameRes resConfig) { luaAssetsInfo.Clear(); lobbyAssetsInfo.Clear(); LoadLobbyAssetInfo(resConfig); }
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(); }
private void LoadLuaAssetsInfo(TableGameRes resConfig) { List <ResData> datas = resConfig.lobbyResConfig.scripts.luaFiles; foreach (ResData data in datas) { luaAssetsInfo.Add(data.name, data); } }
/// <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> /// <param name="resConfig"></param> /// <param name="productId">产品ID</param> public void LoadGameAssetsInfo(TableGameRes resConfig, int productId) { GameResConfig gameResConfig = resConfig.gameResConfig; BaseRes gameRes = gameResConfig.FindProductRes(productId); if (gameRes == null) { return; } Dictionary <string, ResData> assetInfo = gameAssetsInfo.FindGameAsset(productId); if (assetInfo != null) { return; } assetInfo = gameAssetsInfo.CreateGameAsset(productId); LoadAssetsInfo(gameRes, assetInfo); }
private IEnumerator DownLoadResConfig() { string url = downLoadMgr.FormatUrl(TableGameRes.FILE_NAME); WWW www = new WWW(url); yield return(www); if (www.error != null) { Debug.LogError("Down load game res config file error!" + www.error); www.Dispose(); www = null; yield break; } serverTableResConfig = XMLSerializer.Read <TableGameRes>(www.bytes) as TableGameRes; www.Dispose(); www = null; }
private void LoadLobbyAssetsInfo(TableGameRes resConfig) { LobbyResConfig lobbyResConfig = resConfig.lobbyResConfig; ResData data = lobbyResConfig.shader; if (data != null) { lobbyAssetsInfo.Add(data.name, data); } data = lobbyResConfig.datas; if (data != null) { lobbyAssetsInfo.Add(data.name, data); } LoadAssetsInfo(lobbyResConfig.common, lobbyAssetsInfo); LoadAssetsInfo(lobbyResConfig.hotUpdate, lobbyAssetsInfo); LoadAssetsInfo(lobbyResConfig.login, lobbyAssetsInfo); LoadAssetsInfo(lobbyResConfig.lobby, lobbyAssetsInfo); LoadAssetsInfo(lobbyResConfig.game, lobbyAssetsInfo); }
public void LoadLobbyAssetInfo(TableGameRes resConfig) { LoadLuaAssetsInfo(resConfig); LoadLobbyAssetsInfo(resConfig); }
/// <summary> /// 同步游戏资源配置 /// </summary> /// <param name="resConfig"></param> /// <param name="productId"></param> public void SyncGameAssetInfo(TableGameRes resConfig, int productId) { gameAssetsInfo.Clean(productId); LoadGameAssetsInfo(resConfig, productId); }