CmdInputResult C#
Contains list of CmdInputPart. List is created based on list of Parts from CmdFormula.
You can select necessary part and extract data from it:
Data type depends on PartType.
If this Part has Integer PartType, so you can extract int value from it:
Example:

So here is a method that is called when the command is executed:
private void OnSpawnBallsCommand(CmdInputResult result)
{
int ballsCount = result.Parts[1].Integer;
}Lets take a look at all Part Types:
Sentence
public int PartIndex;
void OnCommandExecuted(CmdInputResult result)
{
string sentence = result.Parts[PartIndex].String;
}Float, Int, Bool
public int PartIndex;
void OnCommandExecuted(CmdInputResult result)
{
float floatValue = result.Parts[PartIndex].Float; // if float
int intValue = result.Parts[PartIndex].Integer; // if int
bool boolValue = result.Parts[PartIndex].Bool; // if bool
}Enum
EnumVariant returns index of selected variant
EnumVariantString returns selected variant
public int PartIndex;
void OnCommandExecuted(CmdInputResult result)
{
int enumVariantIndex = result.Parts[PartIndex].EnumVariant;
string enumVariantString = result.Parts[PartIndex].EnumVariantString;
}Last updated