Beispiel #1
0
        /// <summary>
        /// 下载资源
        /// </summary>
        /// <param name="url"></param>
        /// <param name="name"></param>
        /// <param name="folder"></param>
        /// <returns></returns>
        public static IEnumerator Download(string url, string name, params string[] folders)
        {
            url = Uri.EscapeUriString(url);
            UnityWebRequest webRequest = UnityWebRequest.Get(url);

            yield return(webRequest.SendWebRequest());

            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                LogUtil.Log(webRequest.error);
            }
            else
            {
                byte[] bytes = webRequest.downloadHandler.data;
                FileUtil.SaveAsset($"{PathUtil.GetPath(PathType.PersistentDataPath, folders)}/{name}", bytes);
            }
        }
Beispiel #2
0
        public void SaveUserSetData()
        {
            string value = RijndaelUtil.RijndaelEncrypt(key, JsonUtil.ToJson(userSetData));

            FileUtil.SaveAsset($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc", value);
        }