Skip to main content

RedesignedAltaAccountLinker

A internal class in Root.Township, the global namespace. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.

Client login screen that signs in to an Alta account and links it to the player's platform account. Built on LoginAndRegisterHelper.

Constructors​

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

Fields​

10 private and internal fields
MemberWhat it is
private IHighLevelApiClient apiClientInjected high-level API client.
private GameObject errorTextObject shown when login fails.
private static readonly Logger loggerNLog logger.
private ILoginPreferences loginPreferencesInjected login preferences, where the username is saved.
private UnityEvent onFailedToLinkEvent fired when linking fails.
private UnityEvent onValidLinkEvent fired when linking succeeds or isn't supported.
private UnityEvent onValidLoginEvent fired when username and password login succeeds.
private ScalingFadeAnimator scalingFadeAnimatorAnimator used by LogoutAndFade.
private const string ScreenNameAnalytics screen name, Account Linking.
private IUserService userServiceInjected platform user service that does the linking.

Methods​

MemberWhat it is
async void AttemptLogin()Logs in with the username and password fields and fires onValidLogin on success.
void Logout()Logs out of the API unless the UI is locked.
void LogoutAndFade(GameObject fadeToOnLogout)Logs out and fades to the given screen, unless the UI is locked.
protected void Inject(IUserService userService, IHighLevelApiClient api, ILoginPreferences loginPrefs)VContainer injection of the user service, API client and login preferences.
protected override async Task InternalSubmit()Saves the username, then links the platform account, or skips linking if the platform doesn't support it.
5 private and internal methods
MemberWhat it is
private async Task LinkPlatformAccountAsync()Links the platform account. On error shows the message, logs out and fires onFailedToLink; on success finishes login and fires onValidLink.
private async Task<bool> LoginWithUsernameAndPassword(string username, string password)Hashes the password and logs in by email (if the name has an @) or username. Returns false and shows the error on failure.
private void OnEnable()Reports the linking screen start to signup analytics.
private void ProcessAccountLinkingNotSupported()Warns, finishes login without linking and fires onValidLink.
private void SaveUsername()Stores the logged-in username in login preferences.