Fix values clearing when you go to the account panel when logged out
This commit is contained in:
@@ -7,6 +7,7 @@ using UnityEngine.UI;
|
||||
public class AccountLoggedIn : MonoBehaviour
|
||||
{
|
||||
public TMP_Text loggedInText;
|
||||
public AccountLoggedOut accountLoggedOut;
|
||||
public Button loggedInChangeUsernameButton;
|
||||
public Button loggedInChangePasswordButton;
|
||||
public Button loggedInSaveButton;
|
||||
@@ -22,7 +23,10 @@ public class AccountLoggedIn : MonoBehaviour
|
||||
loggedInSaveButton.onClick.AddListener(() => SaveAccount());
|
||||
loggedInLoadButton.onClick.AddListener(() => LoadAccount());
|
||||
loggedInRefreshLoginButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(6));
|
||||
loggedInLogoutButton.onClick.AddListener(() => AccountHandler.instance.SwitchPanel(1));
|
||||
loggedInLogoutButton.onClick.AddListener(() => {
|
||||
accountLoggedOut.clearValues = true;
|
||||
AccountHandler.instance.SwitchPanel(1);
|
||||
});
|
||||
loggedInBackButton.onClick.AddListener(async () => await SceneManager.LoadSceneAsync("MainMenu"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user