Class ConditionalFormatter
Provides conditional formatting on any placeholder that contains a "|" (pipe character) after the ":".
For example: {0:cond:>10?Greater Than 10|=10?Equals to 10|Less than 10}
Inherited Members
Namespace: UnityEngine.Localization.SmartFormat.Extensions
Syntax
[Serializable]
public class ConditionalFormatter : FormatterBase, IFormatter, ISerializationCallbackReceiver, IFormatterLiteralExtractor
Constructors
ConditionalFormatter()
Creates a new instance of the formatter.
Declaration
public ConditionalFormatter()
Properties
DefaultNames
Default names to use when Names is null
.
Declaration
public override string[] DefaultNames { get; }
Property Value
Type | Description |
---|---|
String[] |
Overrides
Methods
TryEvaluateFormat(IFormattingInfo)
Writes the current value to the output, using the specified format. IF this extension cannot write the value, returns false, otherwise true.
Declaration
public override bool TryEvaluateFormat(IFormattingInfo formattingInfo)
Parameters
Type | Name | Description |
---|---|---|
IFormattingInfo | formattingInfo |
Returns
Type | Description |
---|---|
Boolean |
Overrides
WriteAllLiterals(IFormattingInfo)
Ignores the format arguments and writes every possible literal value. This is used to extract all possible values so that we can determine the distinct characters for font generation etc.
Declaration
public void WriteAllLiterals(IFormattingInfo formattingInfo)
Parameters
Type | Name | Description |
---|---|---|
IFormattingInfo | formattingInfo |