Class CampaignMapScreen
- Namespace
- TDMaker.Unity.Campaign
- Assembly
- TDMaker.Unity.dll
World map screen built from code (uGUI + TextMesh Pro, styled by a HudTheme): the campaign's map picture with a point per level (locked with a lock, open with its number, completed with its best stars), dashed roads from each level's prerequisites, the star total, and a level info panel (title, summary, best stars, unlock requirements, Play). Call Show(CampaignProgress, CampaignMapUpdate) with the slot's progress and the update returned by ApplyPending() to highlight new stars and newly opened levels. PlayRequested and BackRequested leave the screen to the caller. Keys: 1-9 select a level, Enter plays it, Esc closes the panel and then goes back. Texts use HudTexts keys and relabel when the language changes. When the campaign has an upgradeShop, a Shop button (with the unspent stars as a badge) opens the UpgradeShopScreen over the map.
[AddComponentMenu("2D Tower Defense Maker/Campaign/World Map Screen")]
public sealed class CampaignMapScreen : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourCampaignMapScreen
- 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
CampaignMapScreen()
public CampaignMapScreen()
Properties
InfoOpen
Whether the level info panel is open.
public bool InfoOpen { get; }
Property Value
PointSprite
Sprite of the level points (null: the theme's circle).
public Sprite PointSprite { get; set; }
Property Value
- Sprite
Progress
The progress shown, or null.
public CampaignProgress Progress { get; }
Property Value
SaveShop
Saves the slot after shop purchases (default: through CampaignSession, which Open(int) sets). Set it when the progress comes from somewhere else.
public Func<bool> SaveShop { get; set; }
Property Value
SelectedLevel
Index of the level whose info panel is open, or -1.
public int SelectedLevel { get; }
Property Value
ShopOpen
Whether the upgrade shop is showing over the map.
public bool ShopOpen { get; }
Property Value
ShopScreen
The upgrade shop screen (created the first time the shop opens), or null.
public UpgradeShopScreen ShopScreen { get; }
Property Value
Theme
The theme (the default theme when none is set).
public HudTheme Theme { get; set; }
Property Value
UpgradeShop
The upgrade shop of the shown campaign, or null.
public UpgradeShopAsset UpgradeShop { get; }
Property Value
Methods
Back()
Raises BackRequested.
public void Back()
CloseInfo()
Closes the info panel.
public void CloseInfo()
CloseShop()
Closes the upgrade shop.
public void CloseShop()
Create(Transform, HudTheme, Sprite)
Creates the screen under parent (a canvas or a rect inside one), stretched to fill it.
public static CampaignMapScreen Create(Transform parent, HudTheme theme, Sprite pointSprite = null)
Parameters
parentTransformthemeHudThemepointSpriteSprite
Returns
OpenShop()
Opens the upgrade shop of the campaign over the map (does nothing without a shop).
public void OpenShop()
PlaySelected()
Plays the selected level when it is open (raises PlayRequested).
public void PlaySelected()
Refresh()
Redraws the points, roads and star total from the progress (after changes made while the screen is open).
public void Refresh()
SelectLevel(int)
Opens the info panel of level index (locked levels show what opens them).
public void SelectLevel(int index)
Parameters
indexint
Show(CampaignProgress, CampaignMapUpdate)
Shows campaignProgress; update (optional) highlights what the last merge changed.
public void Show(CampaignProgress campaignProgress, CampaignMapUpdate update = null)
Parameters
campaignProgressCampaignProgressupdateCampaignMapUpdate
Events
BackRequested
Raised by the Back button (or Esc without an open panel).
public event Action BackRequested
Event Type
PlayRequested
Raised by the Play button (or Enter) with the level index.
public event Action<int> PlayRequested