|
|
|
@ -31,10 +31,78 @@ namespace Fungus
|
|
|
|
|
public StringData stringData; |
|
|
|
|
|
|
|
|
|
public override void OnEnter() |
|
|
|
|
{ |
|
|
|
|
DoSetOperation(); |
|
|
|
|
|
|
|
|
|
Continue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string GetSummary() |
|
|
|
|
{ |
|
|
|
|
if (variable == null) |
|
|
|
|
{ |
|
|
|
|
return "Error: Variable not selected"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string description = variable.key; |
|
|
|
|
|
|
|
|
|
switch (setOperator) |
|
|
|
|
{ |
|
|
|
|
default: |
|
|
|
|
case SetOperator.Assign: |
|
|
|
|
description += " = "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Negate: |
|
|
|
|
description += " != "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Add: |
|
|
|
|
description += " += "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Subtract: |
|
|
|
|
description += " -= "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Multiply: |
|
|
|
|
description += " *= "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Divide: |
|
|
|
|
description += " /= "; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
|
{ |
|
|
|
|
description += booleanData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
|
{ |
|
|
|
|
description += integerData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
|
{ |
|
|
|
|
description += floatData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
|
{ |
|
|
|
|
description += stringData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return description; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override bool HasReference(Variable variable) |
|
|
|
|
{ |
|
|
|
|
return (variable == this.variable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override Color GetButtonColor() |
|
|
|
|
{ |
|
|
|
|
return new Color32(253, 253, 150, 255); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void DoSetOperation() |
|
|
|
|
{ |
|
|
|
|
if (variable == null) |
|
|
|
|
{ |
|
|
|
|
Continue(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -42,7 +110,7 @@ namespace Fungus
|
|
|
|
|
{ |
|
|
|
|
BooleanVariable lhs = (variable as BooleanVariable); |
|
|
|
|
bool rhs = booleanData.Value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (setOperator) |
|
|
|
|
{ |
|
|
|
|
default: |
|
|
|
@ -58,7 +126,7 @@ namespace Fungus
|
|
|
|
|
{ |
|
|
|
|
IntegerVariable lhs = (variable as IntegerVariable); |
|
|
|
|
int rhs = integerData.Value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (setOperator) |
|
|
|
|
{ |
|
|
|
|
default: |
|
|
|
@ -108,7 +176,7 @@ namespace Fungus
|
|
|
|
|
{ |
|
|
|
|
StringVariable lhs = (variable as StringVariable); |
|
|
|
|
string rhs = stringData.Value; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (setOperator) |
|
|
|
|
{ |
|
|
|
|
default: |
|
|
|
@ -117,70 +185,6 @@ namespace Fungus
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Continue(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override string GetSummary() |
|
|
|
|
{ |
|
|
|
|
if (variable == null) |
|
|
|
|
{ |
|
|
|
|
return "Error: Variable not selected"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string description = variable.key; |
|
|
|
|
|
|
|
|
|
switch (setOperator) |
|
|
|
|
{ |
|
|
|
|
default: |
|
|
|
|
case SetOperator.Assign: |
|
|
|
|
description += " = "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Negate: |
|
|
|
|
description += " != "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Add: |
|
|
|
|
description += " += "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Subtract: |
|
|
|
|
description += " -= "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Multiply: |
|
|
|
|
description += " *= "; |
|
|
|
|
break; |
|
|
|
|
case SetOperator.Divide: |
|
|
|
|
description += " /= "; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
|
{ |
|
|
|
|
description += booleanData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
|
{ |
|
|
|
|
description += integerData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
|
{ |
|
|
|
|
description += floatData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
|
{ |
|
|
|
|
description += stringData.GetDescription(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return description; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override bool HasReference(Variable variable) |
|
|
|
|
{ |
|
|
|
|
return (variable == this.variable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override Color GetButtonColor() |
|
|
|
|
{ |
|
|
|
|
return new Color32(253, 253, 150, 255); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|