public void DeleteUserData(string name = "user") { if (UserDataExist(name)) { FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/{name}.lcc"); fileInfo.Delete(); userData = null; } }
public void DeleteUserSetData() { if (UserSetDataExist()) { FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc"); fileInfo.Delete(); userSetData = null; } }
public bool UserSetDataExist() { FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc"); if (fileInfo.Exists) { return(true); } return(false); }
public bool UserDataExist(string name = "user") { FileInfo fileInfo = new FileInfo($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/{name}.lcc"); if (fileInfo.Exists) { return(true); } return(false); }
public void DeleteAll() { DirectoryInfo directoryInfo = new DirectoryInfo(PathUtil.GetPath(PathType.PersistentDataPath, "Res")); if (directoryInfo.Exists) { directoryInfo.Delete(); userData = null; userSetData = null; } }
/// <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); } }
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)) { } } }
public void SaveUserSetData() { string value = RijndaelUtil.RijndaelEncrypt(key, JsonUtil.ToJson(userSetData)); FileUtil.SaveAsset($"{PathUtil.GetPath(PathType.PersistentDataPath, "Res")}/UserSet.lcc", value); }
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)); }
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()); }