Class UpgradeShopScreen
- Namespace
- TDMaker.Unity.Campaign
- Assembly
- TDMaker.Unity.dll
The permanent star-upgrade shop, built from code (uGUI + TextMesh Pro, styled by a HudTheme) over the world map: one column per track with its rank nodes, the stars to spend, a tooltip on hover (price, state and an effect summary generated from the data), one click on the next affordable rank buys it at once (no confirmation), Undo Changes returns to the purchases the shop opened with, Reset All clears every purchase (no confirmation) and Done or Esc closes it. Every change is saved immediately (UpgradeShopSession). CampaignMapScreen opens it from its Shop button.
[AddComponentMenu("2D Tower Defense Maker/Campaign/Upgrade Shop Screen")]
public sealed class UpgradeShopScreen : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUpgradeShopScreen
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Constructors
UpgradeShopScreen()
public UpgradeShopScreen()
Properties
ClosedFrame
Frame on which the shop last closed (lets the map ignore the same Esc press).
public int ClosedFrame { get; }
Property Value
IsOpen
Whether the shop is showing.
public bool IsOpen { get; }
Property Value
Session
The open shop visit, or null.
public UpgradeShopSession Session { get; }
Property Value
Theme
The theme (the default theme when none is set).
public HudTheme Theme { get; set; }
Property Value
TooltipText
The tooltip's text (title and body), for tests.
public string TooltipText { get; }
Property Value
TooltipVisible
Whether the tooltip is showing (for tests).
public bool TooltipVisible { get; }
Property Value
Methods
Click(int, int)
Clicks rank rank (1-based) of track track: buys it when the rules allow.
public bool Click(int track, int rank)
Parameters
Returns
Close()
Closes the shop (purchases are already saved).
public void Close()
Create(Transform, HudTheme)
Creates the (hidden) shop under parent, stretched to fill it.
public static UpgradeShopScreen Create(Transform parent, HudTheme theme)
Parameters
parentTransformthemeHudTheme
Returns
Open(CampaignProgress, UpgradeShopAsset, Func<bool>)
Opens the shop of shop over progress (the purchases now become the revert baseline).
save writes the slot after each change (default: through CampaignSession).
public void Open(CampaignProgress progress, UpgradeShopAsset shop, Func<bool> save = null)
Parameters
progressCampaignProgressshopUpgradeShopAssetsaveFunc<bool>
Refresh()
Redraws the nodes, stars and buttons from the session.
public void Refresh()
ResetAll()
Clears every purchase.
public bool ResetAll()
Returns
Revert()
Returns to the purchases the shop opened with.
public bool Revert()
Returns
Events
Changed
Raised after every purchase, revert or reset.
public event Action Changed
Event Type
Closed
Raised when the shop closes (Done, Esc or Close()).
public event Action Closed