Skip to main content

StoreRotationPopup

A class in Root.Township, the global namespace.

Client tool that, after login, shows a popup with the current shop banner once per shop rotation. Remembers the last rotation it showed in player preferences.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private static readonly int _MainTexShader property id for _MainTex.
private const string LastStoreRotationPrefsKeyPlayer preference key holding the hash of the last rotation shown.
private static Logger loggerNLog logger for popup errors.
private PopupBoard popupBoardPopup board prefab to show.
private Texture storeBannerThe downloaded banner texture.
private Material targetMaterialMaterial the banner texture is put on.
private UnityWebRequest wwwThe running banner download request.

Methods​

MemberWhat it is
protected override async void LoggedIn()Fetches the shop configuration and, if the rotation is new, downloads the banner and shows the popup.
protected override void LoggedOut()Does nothing.
protected override void OnDestroy()Clears the banner and download.
4 private and internal methods
MemberWhat it is
private void Clear()Removes the banner texture from the material, destroys it and aborts any running download.
private void CloseBoard(IPopupBoard board)Clears the banner when the popup closes.
private int GetHashForConfiguration(ShopPageConfiguration configuration)Hashes the shop item identifiers so a new rotation can be told apart from the last one shown.
private async Task<Texture> GetStoreTexture(string path)Downloads the banner image from a URL; returns null on error.