Skip to content

Commit

Permalink
Fixed speedrun mode pref not persisting after new game
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowberryHN committed Apr 25, 2024
1 parent 99080e4 commit 05d2f51
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions Assembly-CSharp/PhoneInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public static void ClearGameData(bool keepMonsters)
string_dic.Clear();
StoreInfo("version", version);
StoreInfoInt("tried_tutorial");
StoreInfoInt("speedrun_mode");
StoreInfo("volume_master", 0.75f);
StoreInfo("volume_menu", 1f);
StoreInfo("volume_ring", 1f);
Expand Down Expand Up @@ -343,6 +344,23 @@ public static void ClearGameData(bool keepMonsters)
}
}



private static void StoreInfo(string pref_name, int default_val)
{
int_dic.Add(pref_name, PlayerPrefs.GetInt(pref_name, default_val));
}

private static void StoreInfo(string pref_name, float default_val)
{
float_dic.Add(pref_name, PlayerPrefs.GetFloat(pref_name, default_val));
}

private static void StoreInfo(string pref_name, string default_val)
{
string_dic.Add(pref_name, PlayerPrefs.GetString(pref_name, default_val));
}

private static void StoreInfoInt(string pref_name)
{
if (PlayerPrefs.HasKey(pref_name))
Expand All @@ -351,11 +369,6 @@ private static void StoreInfoInt(string pref_name)
}
}

private static void StoreInfo(string pref_name, int default_val)
{
int_dic.Add(pref_name, PlayerPrefs.GetInt(pref_name, default_val));
}

private static void StoreInfoFloat(string pref_name)
{
if (PlayerPrefs.HasKey(pref_name))
Expand All @@ -364,11 +377,6 @@ private static void StoreInfoFloat(string pref_name)
}
}

private static void StoreInfo(string pref_name, float default_val)
{
float_dic.Add(pref_name, PlayerPrefs.GetFloat(pref_name, default_val));
}

private static void StoreInfoString(string pref_name)
{
if (PlayerPrefs.HasKey(pref_name))
Expand All @@ -377,11 +385,6 @@ private static void StoreInfoString(string pref_name)
}
}

private static void StoreInfo(string pref_name, string default_val)
{
string_dic.Add(pref_name, PlayerPrefs.GetString(pref_name, default_val));
}

private void Awake()
{
if (_instance == null)
Expand Down
Binary file modified dist/zinethCE_Data/Managed/Assembly-CSharp.dll
Binary file not shown.
Binary file modified dist/zinethCE_Data/Managed/Assembly-UnityScript-firstpass.dll
Binary file not shown.
Binary file modified dist/zinethCE_Data/Managed/Assembly-UnityScript.dll
Binary file not shown.

0 comments on commit 05d2f51

Please sign in to comment.