public void DisplayPanel(bool blnClearFields = false) { #if USES_STATUSMANAGER Status.UpdateStatus(); #endif if (blnClearFields) { if (UsernameInput.GetComponent <InputField>().interactable) { UsernameInput.GetComponent <InputField>().text = ""; } PasswordInput.GetComponent <InputField>().text = ""; EmailAddressInput.GetComponent <InputField>().text = ""; } if (Net == null || !Net.IsConnected || App.IsLoggedIn) { // TURN EVERYTHING OFF this.GetComponent <Image>().enabled = false; for (int i = 0; i < this.transform.childCount; i++) { this.transform.GetChild(0).GetChild(i).gameObject.SetActive(false); } } else { // TURN EVERYTHING ON this.GetComponent <Image>().enabled = true; for (int i = 0; i < this.transform.childCount - 1; i++) { this.transform.GetChild(0).GetChild(i).gameObject.SetActive(true); } // MODIFY WHICH BUTTONS/INPUTFIELDS ARE ACTIVE BASED ON THE STATE if (App.UserLoginType == 2) // WINDOWS USERNAME LOGIN TYPE { UsernameInput.GetComponent <InputField>().interactable = false; PasswordContainer.SetActive(false); EmailAddressContainer.SetActive(false); ResetPasswordLabel.SetActive(false); ForgotPasswordContainer.SetActive(false); SignUpButton.SetActive(false); LoginButton.SetActive(!App.IsWorkingOffline && !Net.ForceOffline); UsernameInput.GetComponent <InputField>().text = App.GetWindowsUsername(); UsernameInput.GetComponent <InputField>().MoveTextEnd(false); UsernameInput.GetComponent <InputField>().DeactivateInputField(); EventSystem.current.SetSelectedGameObject(UsernameInput.GetComponent <InputField>().gameObject, null); UsernameInput.GetComponent <InputField>().OnPointerClick(new PointerEventData(EventSystem.current)); } else { UsernameInput.GetComponent <InputField>().interactable = true; UsernameContainer.SetActive(!_blnIsForgetting); PasswordContainer.SetActive(!_blnIsForgetting); EmailAddressContainer.SetActive(_blnIsSigningUp || _blnIsForgetting); ForgotPasswordContainer.SetActive(!_blnIsForgetting && !_blnIsSigningUp); ResetPasswordLabel.SetActive(_blnIsForgetting); LoginButton.SetActive(!App.IsWorkingOffline && !Net.ForceOffline); SignUpButton.SetActive(App.AllowSignUp || _blnIsForgetting || _blnIsSigningUp); } bool blnCanOffline = (App != null && App.CanWorkOffline && App.IsWorkingOffline && !_blnIsForgetting && !_blnIsSigningUp); #if USES_DATABASEMANAGER blnCanOffline = blnCanOffline && Database != null && Database.ClientsCanUse; #else blnCanOffline = false; #endif OfflineButton.SetActive(blnCanOffline); // ACTIVATE/DEACTIVATE BUTTONS BASED ON ACTIVE LOGIN (IE, GAME VERSION IS UP TO DATE) LoginButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline; ForgotPasswordButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline; SignUpButton.GetComponent <Button>().interactable = LoginIsActive && !Net.IsWorkingOffline && (App.AllowSignUp || _blnIsForgetting || _blnIsSigningUp); OfflineButton.GetComponent <Button>().interactable = LoginIsActive; } }
public void OnLogout() { LoginButton.GetComponent <Canvas>().enabled = true; AccountButton.GetComponent <Canvas>().enabled = false; }