Browse Source

Improved summary for If command

master
chrisgregan 11 years ago
parent
commit
6d1f691557
  1. 54
      Assets/Fungus/VisualScripting/If.cs
  2. BIN
      Assets/Shuttle/ShuttleGame.unity

54
Assets/Fungus/VisualScripting/If.cs

@ -169,27 +169,67 @@ namespace Fungus.Script
return "No variable selected"; return "No variable selected";
} }
string description = "IF " + variable.key + " THEN "; string summary = variable.key;
switch (compareOperator)
{
case CompareOperator.Equals:
summary += " == ";
break;
case CompareOperator.NotEquals:
summary += " != ";
break;
case CompareOperator.LessThan:
summary += " < ";
break;
case CompareOperator.GreaterThan:
summary += " > ";
break;
case CompareOperator.LessThanOrEquals:
summary += " <= ";
break;
case CompareOperator.GreaterThanOrEquals:
summary += " >= ";
break;
}
if (variable.GetType() == typeof(BooleanVariable))
{
summary += booleanValue.GetDescription();
}
else if (variable.GetType() == typeof(IntegerVariable))
{
summary += integerValue.GetDescription();
}
else if (variable.GetType() == typeof(FloatVariable))
{
summary += floatValue.GetDescription();
}
else if (variable.GetType() == typeof(StringVariable))
{
summary += stringValue.GetDescription();
}
summary += " THEN ";
if (thenSequence == null) if (thenSequence == null)
{ {
description += "<Continue>"; summary += "<Continue>";
} }
else else
{ {
description += thenSequence.name; summary += thenSequence.name;
} }
description += " ELSE "; summary += " ELSE ";
if (elseSequence == null) if (elseSequence == null)
{ {
description += "<Continue>"; summary += "<Continue>";
} }
else else
{ {
description += elseSequence.name; summary += elseSequence.name;
} }
return description; return summary;
} }
public override bool HasReference(FungusVariable variable) public override bool HasReference(FungusVariable variable)

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save