Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Hidden Save File Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
spxctreofficial committed Jul 1, 2021
1 parent 77a1eac commit 4e5e8b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ v0.1.3 is a beta release that adds new features and improvements to the game, pr
- The skip button allows the current sentence to be automatically finished.
- The continue button will advance to the next sentence.
- This dialogue system is currently used to introduce new users to the UI of the game. In the future, this dialogue system will be used throughout the game to advance the plot of the story.
- Serialized files storing data are now hidden by default.
- Serialized files will always hide themselves after saving.
- This change was made to conceal the save files just a bit. This certainly will not stop people from changing the files however.
- Changes & Fixes:
- The window slide animation's easing effect has been changed from EaseInOutQuad to EaseOutQuad (the difference is that easing is no longer applied at the beginning of the game.)
- The ChampionShopButton and the GoldDisplay prefabs have been renovated to include Layout Groups and Layout Elements in order to keep the aesthetic clean and self-manageable (where previously would break after a certain amount of characters were placed in the textboxes.)
Expand Down
15 changes: 15 additions & 0 deletions Assets/Project/Scripts/Serialization/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,23 @@ public void Save() {
string defaultSaveJson = JsonUtility.ToJson(defaultSaveObject, true);
string firstRunSaveJson = JsonUtility.ToJson(firstRunSaveObject, true);
if (!Directory.Exists(saveFolder)) Directory.CreateDirectory(saveFolder);

if (File.Exists(saveFolder + "/save.lohsave")) {
var defaultSaveAttributes = File.GetAttributes(saveFolder + "/save.lohsave");
var firstRunSaveAttributes = File.GetAttributes(saveFolder + "/firstrun.lohsave");

if ((defaultSaveAttributes & FileAttributes.Hidden) == FileAttributes.Hidden) defaultSaveAttributes &= ~FileAttributes.Hidden;
if ((firstRunSaveAttributes & FileAttributes.Hidden) == FileAttributes.Hidden) firstRunSaveAttributes &= ~FileAttributes.Hidden;

File.SetAttributes(saveFolder + "/save.lohsave", defaultSaveAttributes);
File.SetAttributes(saveFolder + "/firstrun.lohsave", firstRunSaveAttributes);
}

File.WriteAllText(saveFolder + "/save.lohsave", defaultSaveJson);
File.WriteAllText(saveFolder + "/firstrun.lohsave", firstRunSaveJson);

File.SetAttributes(saveFolder + "/save.lohsave", File.GetAttributes(saveFolder + "/save.lohsave") | FileAttributes.Hidden);
File.SetAttributes(saveFolder + "/firstrun.lohsave", File.GetAttributes(saveFolder + "/firstrun.lohsave") | FileAttributes.Hidden);
}
public void LoadDefaultSave() {
// Loads SaveObject
Expand Down

0 comments on commit 4e5e8b7

Please sign in to comment.