window mode and botany wip

This commit is contained in:
ntr committed 2022-05-31 15:39:24 +10:00
1 parent f0aa6495c7
commit 0f9576a67b
68 files changed
+8224 -1311

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
using System.IO;
using UnityEngine;
[System.Serializable]
public class PreferenceData {
// Preference Fields
public int themeIndex;
// Others
string _path;
public PreferenceData(string path) {
_path = path;
themeIndex = 0;
}
public PreferenceData Load() {
try {
string json = File.ReadAllText(_path);
JsonUtility.FromJsonOverwrite(json, this);
return this;
} catch {
// file doesn't exist yet
return Save();
}
}
public PreferenceData Save() {
File.WriteAllText(_path, JsonUtility.ToJson(this));
return this;
}
}
public interface IPreferenceData {
PreferenceData LoadPreferences();
PreferenceData SavePreferences();
}