Skip to main content

LoginScreen

A class in Root.Township, the global namespace.

Client desktop login screen: username and password fields, remember me toggle and error text, shown when the app starts without a login.

Constructors​

MemberWhat it is
LoginScreen()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

10 private and internal fields
MemberWhat it is
private GameObject allLoginUIParent of the login fields, hidden while logging in.
private GameObject attemptLoginTextObject shown while a login is in progress.
private Text errorTextText showing the last login error.
private Text loadingGameTextText shown until the app has started.
private static Logger loggerNLog logger for this class.
private GameObject loginCanvasThe whole login canvas.
private ILoginPreferences loginPreferencesInjected login settings.
private InputField passwordInputPassword field.
private Toggle rememberMeToggleRemember me toggle.
private InputField usernameInputUsername or email field.

Methods​

MemberWhat it is
async void LoginAsync()Logs in with the entered name or email and hashed password, shows API errors, then passes success to LoginManager.
void OpenForgotPasswordLink()Opens the Township Tale reset password page.
protected void Inject(ILoginPreferences loginPreferences)Receives the login preferences.
8 private and internal methods
MemberWhat it is
private void ApplicationStarted()Hides the loading text and shows the login canvas if not logged in.
private void DisableCanvas()Hides the login canvas.
private void EnableCanvas()Shows the login canvas.
private void LoggedIn()Hides the canvas and clears the error text.
private void LoggedOut()Shows the login canvas again.
private void ShowAttemptingLoginText(bool isShowing)Swaps the login fields for the attempting login text, or back.
private void Start()Hides the canvas and hooks the toggle and LoginManager events.
private void UpdateRememberMe(bool value)Saves the remember me choice.