Show / Hide Table of Contents

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.

Inheritance
System.Object
CostDisplayer
EggCostDisplayer
GeoCostDisplayer
PDIntCostDisplayer
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ItemChanger
Assembly: ItemChanger.dll
Syntax
public abstract class CostDisplayer

Properties

| Improve this Doc View Source

Cumulative

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
| Improve this Doc View Source

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 Source

GetAdditionalCostText(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
| Improve this Doc View Source

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
| Improve this Doc View Source

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).

| Improve this Doc View Source

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).

Extension Methods

Extensions.Yield<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX