Class CostDisplayer
A utility object which dictates how costs (and especially multicosts) are to be displayed in non-textual contexts such as shops. Accounts for multicosts and other correctly-implemented nested costs.
Inherited Members
Namespace: ItemChanger
Assembly: ItemChanger.dll
Syntax
public abstract class CostDisplayer
Properties
| Improve this Doc View SourceCumulative
Whether nested costs should be considered cumulative. A cost is cumulative if costs paid also count towards subsequent costs. For example, grub costs are cumulative, geo costs are not.
Declaration
public virtual bool Cumulative { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CustomCostSprite
A sprite to use to display the cost visually, if contextually applicable. If no sprite is provided, existing sprites won't be replaced. Default is null.
Declaration
public virtual ISprite CustomCostSprite { get; set; }
Property Value
Type | Description |
---|---|
ISprite |
Methods
| Improve this Doc View SourceGetAdditionalCostText(Cost)
Gets a text representation of costs which are not included in the display amount.
Declaration
public string GetAdditionalCostText(Cost cost)
Parameters
Type | Name | Description |
---|---|---|
Cost | cost | The cost to evaluate cost text for |
Returns
Type | Description |
---|---|
System.String |
GetDisplayAmount(Cost)
Gets the amount to display alongside the cost, e.g. in the shop item list. For multicosts, the maximum amount for single matching costs is displayed if the displayer is cumulative; the sum of amounts is used if the displayer is non-cumulative.
Declaration
public int GetDisplayAmount(Cost cost)
Parameters
Type | Name | Description |
---|---|---|
Cost | cost | The cost to evaluate the display amound for |
Returns
Type | Description |
---|---|
System.Int32 |
GetSingleCostDisplayAmount(Cost)
Gets the display amount for a single cost in the displayer.
Declaration
protected abstract int GetSingleCostDisplayAmount(Cost cost)
Parameters
Type | Name | Description |
---|---|---|
Cost | cost |
Returns
Type | Description |
---|---|
System.Int32 |
Remarks
Implementers may assume that the cost has already been checked and confirmed to be supported (i.e. direct type casting without checking first is acceptable).
SupportsCost(Cost)
Whether this displayer can support a given cost.
Declaration
protected abstract bool SupportsCost(Cost cost)
Parameters
Type | Name | Description |
---|---|---|
Cost | cost | The cost to evaluate support for |
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
Implementers may assume that any wrapper costs have been removed (i.e. directly type checking a given cost without calling GetBaseCost is acceptable).