/// <summary> /// Load the specified localization dictionary. /// </summary> static bool LoadDictionary(string value) { if (value.Equals(SystemLanguage.ChineseSimplified.ToString())) { value = SystemLanguage.Chinese.ToString(); } string assetName = Common.LANGUAGE_PREFIX + value.ToLower(); string abName = CUtils.GetRightFileName(assetName + Common.CHECK_ASSETBUNDLE_SUFFIX); CRequest req = CRequest.Get(); req.relativeUrl = abName; req.assetName = assetName; req.assetType = typeof(BytesAsset); req.async = false; var uri = new UriGroup(); uri.Add(CUtils.GetRealPersistentDataPath(), true); uri.Add(CUtils.GetRealStreamingAssetsPath()); req.uris = uri; req.OnComplete += delegate(CRequest req1) { BytesAsset main = req1.data as BytesAsset; //www.assetBundle.mainAsset as TextAsset; byte[] txt = main.bytes; #if UNITY_EDITOR Debug.Log(mLanguage + " is loaded " + txt.Length + " " + Time.frameCount); #endif if (txt != null) { Load(txt); } SelectLanguage(mLanguage); CacheManager.Unload(req1.keyHashCode); localizationHasBeenSet = true; }; req.OnEnd += delegate(CRequest req1) { if (!value.ToLower().Equals(SystemLanguage.English.ToString().ToLower())) { language = SystemLanguage.English.ToString(); } }; ResourcesLoader.LoadAsset(req); return(false); }
/// <summary> /// 根据组策略校验request.url的crc值。 /// 文件不存在或者校验失败返回false /// </summary> /// <param name="req"></param> /// <returns></returns> public static bool CheckUriCrc(CRequest req) { bool check = ManifestManager.CheckReqCrc(req); //CheckLocalFileCrc(req.url, out crc); if (!check) { var re = UriGroup.CheckAndSetNextUriGroup(req); //CUtils.SetRequestUri(req, 1); #if HUGULA_LOADER_DEBUG HugulaDebug.FilterLogFormat(req.key, "<color=#ffff00>CrcCheck.CheckUriCrc Req(assetname={0},url={1}) CheckFileCrc=false,SetNextUri={2}</color>", req.assetName, req.url, re); #endif return(re); } return(true); }
/// <summary> /// 根据组策略校验request.url的crc值。 /// 文件不存在或者校验失败返回false /// </summary> /// <param name="req"></param> /// <returns></returns> public static bool CheckUriCrc(CRequest req) { uint crc = 0; bool check = CheckLocalFileCrc(req.url, out crc); if (!check) { var re = UriGroup.CheckAndSetNextUriGroup(req); //CUtils.SetRequestUri(req, 1); #if HUGULA_LOADER_DEBUG Debug.LogFormat("<color=#ff0000>CrcCheck.CheckUriCrc Req(assetname={0},url={1}) crc={2},CheckFileCrc=false,SetNextUri={3}</color>", req.assetName, req.url, crc, re); #endif return(re); } return(true); }