qa report v2
This commit is contained in:
@@ -110,16 +110,20 @@ public class LoginManager : MonoBehaviour
|
||||
void Awake()
|
||||
{
|
||||
HideServerMessagePanels();
|
||||
AuthToken = PlayerPrefs.GetString(PlayerPrefsAuthKey, "");
|
||||
|
||||
if(instance !=null){
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
instance.StopKeepalive();
|
||||
SceneManager.sceneLoaded -= instance.OnSceneLoaded;
|
||||
Destroy(instance.gameObject);
|
||||
}
|
||||
|
||||
instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
|
||||
AuthToken = PlayerPrefs.GetString(PlayerPrefsAuthKey, "");
|
||||
|
||||
if (string.IsNullOrEmpty(AuthToken))
|
||||
ClearLocalUserProfile();
|
||||
#if !UNITY_EDITOR
|
||||
@@ -248,10 +252,23 @@ public class LoginManager : MonoBehaviour
|
||||
AuthToken = "";
|
||||
ClearLocalUserProfile();
|
||||
ClearMatchYourTeam();
|
||||
OnUserDataUpdated = null;
|
||||
Cupid.ClearSession();
|
||||
CupidLobby.ClearUsername();
|
||||
GameManager.ClearMatchSession();
|
||||
NetPlayer.RedPlayer = null;
|
||||
NetPlayer.BluePlayer = null;
|
||||
PlayerPrefs.DeleteAll();
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
/// <summary>Full logout, then reload the login scene so a fresh <see cref="LoginManager"/> can bind UI.</summary>
|
||||
public static void LogoutAndReturnToLogin()
|
||||
{
|
||||
Logout();
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
static void ProceedToMainMenu()
|
||||
{
|
||||
if (LevelLoadManager.instance != null)
|
||||
@@ -419,7 +436,7 @@ public class LoginManager : MonoBehaviour
|
||||
if (request.result != UnityWebRequest.Result.Success &&
|
||||
request.result != UnityWebRequest.Result.ProtocolError)
|
||||
{
|
||||
ShowAuthMessage(string.IsNullOrEmpty(request.error) ? "Network error" : request.error);
|
||||
ShowAuthMessage("Network Error, Please try again.");
|
||||
SetBusy(false);
|
||||
yield break;
|
||||
}
|
||||
@@ -457,7 +474,7 @@ public class LoginManager : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowAuthMessage(string.IsNullOrEmpty(resp.error) ? "Request failed" : resp.error);
|
||||
ShowAuthMessage("Login failed. Please try again.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,11 +895,10 @@ public class LoginManager : MonoBehaviour
|
||||
|
||||
void OnDestroy()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
StopKeepalive();
|
||||
if (instance == this)
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
StopKeepalive();
|
||||
}
|
||||
instance = null;
|
||||
}
|
||||
|
||||
void StartKeepalive()
|
||||
@@ -979,14 +995,9 @@ public class LoginManager : MonoBehaviour
|
||||
if (_handlingKeepaliveUnauthorized) return;
|
||||
_handlingKeepaliveUnauthorized = true;
|
||||
|
||||
InvalidateStoredSession();
|
||||
SetBusy(false);
|
||||
|
||||
ShowAuthMessage(string.IsNullOrEmpty(message) ? "Session expired. Please sign in again." : message);
|
||||
|
||||
Scene active = SceneManager.GetActiveScene();
|
||||
if (active.buildIndex != 0 && active.name != "Intro")
|
||||
SceneManager.LoadScene(0);
|
||||
LogoutAndReturnToLogin();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user