/// <summary> /// Obtains required login credentials using a valid refreshtoken and then updates all of the users login details /// </summary> /// <param name="refreshToken">Valid refresh token retrieved from initial login</param> /// <returns></returns> private IEnumerator Get_IDtoken(string refreshToken) { YUR_Log.Log("Getting Login Token with Refresh Token"); string refreshResponse; refreshResponse = Systems.Interops.User_AccountAuthorization.Retrieve_IDToken(refreshToken); if (refreshResponse.StartsWith("--1")) { Bad_Login?.Invoke(refreshResponse); yield break; } if (!CurrentUser.Convert_Refresh_Login(refreshResponse)) { YUR_Log.Error("Get IDToken could not use Convert Refresh Login Method. Login was unnsuccessful."); Login.status = Login.StatusType.Logging_Out; Logout.ActiveUser(); yield break; } yield return(StartCoroutine(Get_UserData())); Successful_Login?.Invoke("Successfull Login!"); yield break; }
private void Screens_MainMenu_Finished() { //EditProfile = (GameObject)Instantiate(Resources.Load("YUR Selection Button"), gameObject.transform); //EditProfile.GetComponent<RectTransform>().localPosition = new Vector3(0, 53f, EditProfile.GetComponent<RectTransform>().localPosition.z); EditProfile.GetComponentInChildren <TextMeshProUGUI>().text = "Edit Profile"; EditProfile.GetComponent <Button>().onClick.AddListener(delegate { YURScreenCoordinator.ScreenCoordinator.PresentNewScreen(Screens_EditProfile.inst); }); //Stats_Screen = (GameObject)Instantiate(Resources.Load("YUR Selection Button"), gameObject.transform); //Stats_Screen.GetComponent<RectTransform>().localPosition = new Vector3(0f, 11f, Stats_Screen.GetComponent<RectTransform>().localPosition.z); Stats_Screen.GetComponentInChildren <TextMeshProUGUI>().text = "View Stats"; Stats_Screen.GetComponent <Button>().onClick.AddListener(delegate { YURScreenCoordinator.ScreenCoordinator.PresentNewScreen(Screens_Stats.inst); }); //SwitchUsers = (GameObject)Instantiate(Resources.Load("YUR Selection Button"), gameObject.transform); //SwitchUsers.GetComponent<RectTransform>().localPosition = new Vector3(0f, -69, SwitchUsers.GetComponent<RectTransform>().localPosition.z); SwitchUsers.GetComponentInChildren <TextMeshProUGUI>().text = "Switch Users"; SwitchUsers.GetComponent <Button>().onClick.AddListener(delegate { YURScreenCoordinator.ScreenCoordinator.PresentNewScreen(Screens_UserSelection.instance); }); //SignOut = (GameObject)Instantiate(Resources.Load("YUR Selection Button"), gameObject.transform); //SignOut.GetComponent<RectTransform>().localPosition = new Vector3(0f, -111, SignOut.GetComponent<RectTransform>().localPosition.z); SignOut.GetComponentInChildren <TextMeshProUGUI>().text = "Sign Out"; SignOut.GetComponent <Button>().onClick.AddListener(delegate { Logout.ActiveUser("Logging out from Main Menu"); YURScreenCoordinator.ScreenCoordinator.PresentNewScreen(Screens_InitialLogin.inst, true); }); }
public void OnEnable() { UserCount = YUR_Main.main.UserList.Count; UsersNames = new string[UserCount]; for (int i = 0; i < UserCount; i++) { if (YUR_Main.main.UserList[i] == YUR_Main.main.User_Manager.CurrentUser.loginCredentials.LocalId) { UserIndex = i; } } if (Login.Status == Login.StatusType.Logged_In) { ProfileName.text = YUR_Main.main.User_Manager.CurrentUser.Data_Biometrics.Name; /// Get User picture here /// UsersNames[UserIndex] = YUR_Main.main.User_Manager.CurrentUser.Data_Biometrics.Name; } else { UserIndex = 0; YUR_CurrentUser.Local_User_Info_Reference Reference = YUR_CurrentUser.Preview_User(YUR_Main.main.UserList[UserIndex]); ProfileName.text = Reference.name; UsersNames[UserIndex] = Reference.name; } NewSignIn.onClick.AddListener(delegate { Logout.ActiveUser("Logging out from switch user screen"); YURScreenCoordinator.ScreenCoordinator.PresentNewScreen(Screens_InitialLogin.inst, true); }); SignInUser.onClick.AddListener(delegate { if (YUR_Main.main.UserList[UserIndex] == YUR_Main.main.User_Manager.CurrentUser.loginCredentials.LocalId) { YURScreenCoordinator.ScreenCoordinator.PresentNewScreen(Screens_MainMenu.inst, true); } else { UserManagement.YUR_UserManager.Successful_Login += YUR_UserManager_Successful_Login; UserManagement.YUR_UserManager.Bad_Login += YUR_UserManager_Bad_Login; Login.User_ID(YUR_Main.main.UserList[UserIndex]); } }); Next.onClick.AddListener(delegate { if (UserIndex + 1 > UserCount - 1) { UserIndex = 0; } else { UserIndex++; } if (!string.IsNullOrEmpty(UsersNames[UserIndex])) { ProfileName.text = UsersNames[UserIndex]; } else { YUR_CurrentUser.Local_User_Info_Reference Reference = YUR_CurrentUser.Preview_User(YUR_Main.main.UserList[UserIndex]); ProfileName.text = Reference.name; UsersNames[UserIndex] = Reference.name; } /// Get User Profile Picture }); Prev.onClick.AddListener(delegate { if (UserIndex - 1 < 0) { UserIndex = UserCount - 1; } else { UserIndex--; } if (!string.IsNullOrEmpty(UsersNames[UserIndex])) { ProfileName.text = UsersNames[UserIndex]; } else { YUR_CurrentUser.Local_User_Info_Reference Reference = YUR_CurrentUser.Preview_User(YUR_Main.main.UserList[UserIndex]); ProfileName.text = Reference.name; UsersNames[UserIndex] = Reference.name; } }); }