Class CurrencyHudView
Component that manages displaying a Currency's icon and quantity. When attached to a game object, it will display the Currency's icon and quantity.
Inherited Members
Namespace: UnityEngine.GameFoundation.Components
Syntax
[AddComponentMenu("Game Foundation/Currency HUD View", 4)]
[ExecuteInEditMode]
public class CurrencyHudView : MonoBehaviour
Properties
currency
A reference to the Currency definition.
Declaration
public Currency currency { get; }
Property Value
Type | Description |
---|---|
Currency |
currencyKey
The identifier of the Currency to display.
Declaration
public string currencyKey { get; }
Property Value
Type | Description |
---|---|
String |
iconImageField
The Image component to assign the Currency icon image to.
Declaration
public Image iconImageField { get; }
Property Value
Type | Description |
---|---|
Image |
iconSpritePropertyKey
The Static Property key string that should be used for getting the sprite of the Currency for displaying in the hud view.
Declaration
public string iconSpritePropertyKey { get; }
Property Value
Type | Description |
---|---|
String |
quantityTextField
The TextMeshProUGUI component to assign the Currency quantity to.
Declaration
public TextMeshProUGUI quantityTextField { get; }
Property Value
Type | Description |
---|---|
TMPro.TextMeshProUGUI |
Methods
SetCurrency(Currency)
Sets the Currency that should be displayed by this view. Runtime only.
Declaration
public void SetCurrency(Currency currency)
Parameters
Type | Name | Description |
---|---|---|
Currency | currency | A reference to the Currency that should be displayed. |
SetIconImageField(Image)
Sets the Image component to display Currency icon sprite on this view.
Declaration
public void SetIconImageField(Image image)
Parameters
Type | Name | Description |
---|---|---|
Image | image | The Image component to display Currency icon sprite. |
SetIconSpritePropertyKey(String)
Sets sprite name for Currency icon that will be displayed on this view.
Declaration
public void SetIconSpritePropertyKey(string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | propertyKey | The Static Property key to look up sprite by. Currency doesn't have this key in its Static Properties will not display an icon. |
SetQuantityTextField(TextMeshProUGUI)
Sets the TextMeshProUGUI component to display the Currency quantity on this view.
Declaration
public void SetQuantityTextField(TextMeshProUGUI text)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TextMeshProUGUI | text | The TextMeshProUGUI component to display the Currency quantity |