Пример #1
0
        bool LoadCacheAndTimeConfig(string configText)
        {
            try
            {
                var allConfigList = MiniJSON.Json.Deserialize(configText) as List <object>;
                if (null == allConfigList)
                {
                    BLogger.Error("parse depends json error");
                    return(false);
                }

                for (int i = 0; i < allConfigList.Count; i++)
                {
                    Dictionary <string, object> dictItem = allConfigList[i] as Dictionary <string, object>;
                    string assetPath = AssetBundleUtil.ReadJsonKey <string>(dictItem, "asset");
                    int    cacheTime = (int)AssetBundleUtil.ReadJsonKey <Int64>(dictItem, "time");
                    int    poolCnt   = (int)AssetBundleUtil.ReadJsonKey <Int64>(dictItem, "poolcnt");
                    XResource.RegCacheResPath(assetPath, cacheTime, poolCnt);

                    BLogger.Info("[{0}]cache resource[{1}] cache time: {2} pool max count:{3}", i, assetPath, cacheTime, poolCnt);
                }

                return(true);
            }
            catch (Exception e)
            {
                BLogger.Error("LoadCacheAndTimeConfig failed: " + e.ToString());
                return(false);
            }
        }