示例#1
0
 public void DeleteUserData(string name = "user")
 {
     if (UserDataExist(name))
     {
         FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/{name}.lcc");
         fileInfo.Delete();
         userData = null;
     }
 }
示例#2
0
 public void DeleteUserSetData()
 {
     if (UserSetDataExist())
     {
         FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc");
         fileInfo.Delete();
         userSetData = null;
     }
 }
示例#3
0
        public bool UserSetDataExist()
        {
            FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc");

            if (fileInfo.Exists)
            {
                return(true);
            }
            return(false);
        }
示例#4
0
        public bool UserDataExist(string name = "user")
        {
            FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/{name}.lcc");

            if (fileInfo.Exists)
            {
                return(true);
            }
            return(false);
        }
示例#5
0
        public void DeleteAll()
        {
            DirectoryInfo directoryInfo = new DirectoryInfo(PathUtil.GetPath(PathType.PersistentDataPath, "Res"));

            if (directoryInfo.Exists)
            {
                directoryInfo.Delete();
                userData    = null;
                userSetData = null;
            }
        }
示例#6
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);
            }
        }
示例#7
0
        public override void Update()
        {
#if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.C))
            {
                ScreenCapture.CaptureScreenshot($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/Screenshot.png");
            }
#endif
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (PanelManager.Instance.IsOpenPanel(PanelType.Set))
                {
                    return;
                }
                if (PanelManager.Instance.IsOpenPanel(PanelType.Quit))
                {
                    return;
                }
                if (!PanelManager.Instance.IsOpenPanel(PanelType.Load))
                {
                }
            }
        }
示例#8
0
        public void SaveUserSetData()
        {
            string value = RijndaelUtil.RijndaelEncrypt(key, JsonUtil.ToJson(userSetData));

            FileUtil.SaveAsset($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc", value);
        }
示例#9
0
 public UserSetData GetUserSetData()
 {
     if (UserSetDataExist())
     {
         string value = RijndaelUtil.RijndaelDecrypt(key, FileUtil.GetAsset($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc")).GetString();
         return(JsonUtil.ToObject <UserSetData>(value));
     }
     return(new UserSetData(20, 100, CVType.Chinese, LccModel.LanguageType.Chinese, DisplayModeType.FullScreen, ResolutionType.Resolution1920x1080));
 }
示例#10
0
 public UserData GetUserData(string name = "user")
 {
     if (UserDataExist(name))
     {
         string value = RijndaelUtil.RijndaelDecrypt(key, FileUtil.GetAsset($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/{name}.lcc")).GetString();
         return(JsonUtil.ToObject <UserData>(value));
     }
     return(new UserData());
 }