Fix values clearing when you go to the account panel when logged out

This commit is contained in:
2025-06-24 14:35:17 -07:00
parent d3ae8e56a5
commit 24f983ecb1
3 changed files with 26 additions and 15 deletions

View File

@@ -7,6 +7,7 @@ public class AccountLoggedOut : MonoBehaviour
public Button loggedOutLoginButton;
public Button loggedOutRegisterButton;
public Button loggedOutBackButton;
public bool clearValues = false;
void Awake()
{
@@ -17,19 +18,23 @@ public class AccountLoggedOut : MonoBehaviour
void OnEnable()
{
PlayerPrefs.DeleteKey("gameSession");
PlayerPrefs.DeleteKey("userName");
PlayerPrefs.DeleteKey("userId");
PlayerPrefs.SetString("HighScoreV2", "0");
PlayerPrefs.SetInt("icon", 1);
PlayerPrefs.SetInt("overlay", 0);
PlayerPrefs.DeleteKey("TotalNormalBerries");
PlayerPrefs.DeleteKey("TotalPoisonBerries");
PlayerPrefs.DeleteKey("TotalSlowBerries");
PlayerPrefs.DeleteKey("TotalUltraBerries");
PlayerPrefs.DeleteKey("TotalSpeedyBerries");
PlayerPrefs.DeleteKey("TotalAttempts");
PlayerPrefs.DeleteKey("BirdColor");
PlayerPrefs.DeleteKey("OverlayColor");
if (clearValues)
{
PlayerPrefs.DeleteKey("gameSession");
PlayerPrefs.DeleteKey("userName");
PlayerPrefs.DeleteKey("userId");
PlayerPrefs.SetString("HighScoreV2", "0");
PlayerPrefs.SetInt("icon", 1);
PlayerPrefs.SetInt("overlay", 0);
PlayerPrefs.DeleteKey("TotalNormalBerries");
PlayerPrefs.DeleteKey("TotalPoisonBerries");
PlayerPrefs.DeleteKey("TotalSlowBerries");
PlayerPrefs.DeleteKey("TotalUltraBerries");
PlayerPrefs.DeleteKey("TotalSpeedyBerries");
PlayerPrefs.DeleteKey("TotalAttempts");
PlayerPrefs.DeleteKey("BirdColor");
PlayerPrefs.DeleteKey("OverlayColor");
clearValues = false;
}
}
}