Skip to main content

SwipePromptController

A class in Root.Township, the global namespace.

Shows a swipe hint on an item scroller after a delay, until the player has swiped once. Used on customization menus.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private float delayToPromptSeconds to wait before showing the prompt.
private bool hasSwipedTrue once the player has swiped.
private GameObject promptThe hint object to show and hide.
private Coroutine promptDelayThe running delay coroutine.
private ItemScroller scrollerItem scroller checked for whether it can scroll.
private ScrollManager[] scrollManagersScroll managers whose item changes recheck the prompt.

Methods​

MemberWhat it is
void HasSwiped()Marks that the player swiped, so the prompt doesn't show again.
5 private and internal methods
MemberWhat it is
private void Awake()Subscribes to each scroll manager's items changed event, unless the player already swiped.
private void CheckPrompt()Restarts the prompt delay if the scroller can scroll and the player hasn't swiped yet.
private void ClearDelay()Stops the delay and hides the prompt.
private IEnumerator DelayPrompt() (iterator)Coroutine that shows the prompt after delayToPrompt seconds.
private void IBuildRendererPostBake.PostBake()Build step: drops null entries from scrollManagers.