|
|
@ -30,13 +30,15 @@ namespace Fungus.Script |
|
|
|
|
|
|
|
|
|
|
|
public CompareOperator compareOperator; |
|
|
|
public CompareOperator compareOperator; |
|
|
|
|
|
|
|
|
|
|
|
public BooleanData booleanData; |
|
|
|
public FungusVariable compareVariable; |
|
|
|
|
|
|
|
|
|
|
|
public IntegerData integerData; |
|
|
|
public bool booleanValue; |
|
|
|
|
|
|
|
|
|
|
|
public FloatData floatData; |
|
|
|
public int integerValue; |
|
|
|
|
|
|
|
|
|
|
|
public StringData stringData; |
|
|
|
public float floatValue; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string stringValue; |
|
|
|
|
|
|
|
|
|
|
|
public Sequence onTrueSequence; |
|
|
|
public Sequence onTrueSequence; |
|
|
|
|
|
|
|
|
|
|
@ -61,75 +63,87 @@ namespace Fungus.Script |
|
|
|
|
|
|
|
|
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
bool lhs = (variable as BooleanVariable).Value; |
|
|
|
|
|
|
|
bool rhs = (compareVariable as BooleanVariable) == null ? booleanValue : (compareVariable as BooleanVariable).Value; |
|
|
|
|
|
|
|
|
|
|
|
switch (compareOperator) |
|
|
|
switch (compareOperator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case CompareOperator.Equals: |
|
|
|
case CompareOperator.Equals: |
|
|
|
condition = (variable as BooleanVariable).Value == booleanData.value; |
|
|
|
condition = lhs == rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
default: |
|
|
|
default: |
|
|
|
condition = (variable as BooleanVariable).Value != booleanData.value; |
|
|
|
condition = lhs != rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
int lhs = (variable as IntegerVariable).Value; |
|
|
|
|
|
|
|
int rhs = (compareVariable as IntegerVariable) == null ? integerValue : (compareVariable as IntegerVariable).Value; |
|
|
|
|
|
|
|
|
|
|
|
switch (compareOperator) |
|
|
|
switch (compareOperator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case CompareOperator.Equals: |
|
|
|
case CompareOperator.Equals: |
|
|
|
condition = (variable as IntegerVariable).Value == integerData.value; |
|
|
|
condition = lhs == rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
condition = (variable as IntegerVariable).Value != integerData.value; |
|
|
|
condition = lhs != rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.LessThan: |
|
|
|
case CompareOperator.LessThan: |
|
|
|
condition = (variable as IntegerVariable).Value < integerData.value; |
|
|
|
condition = lhs < rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.GreaterThan: |
|
|
|
case CompareOperator.GreaterThan: |
|
|
|
condition = (variable as IntegerVariable).Value > integerData.value; |
|
|
|
condition = lhs > rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.LessThanOrEquals: |
|
|
|
case CompareOperator.LessThanOrEquals: |
|
|
|
condition = (variable as IntegerVariable).Value <= integerData.value; |
|
|
|
condition = lhs <= rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.GreaterThanOrEquals: |
|
|
|
case CompareOperator.GreaterThanOrEquals: |
|
|
|
condition = (variable as IntegerVariable).Value >= integerData.value; |
|
|
|
condition = lhs >= rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
float lhs = (variable as FloatVariable).Value; |
|
|
|
|
|
|
|
float rhs = (compareVariable as FloatVariable) == null ? floatValue : (compareVariable as FloatVariable).Value; |
|
|
|
|
|
|
|
|
|
|
|
switch (compareOperator) |
|
|
|
switch (compareOperator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case CompareOperator.Equals: |
|
|
|
case CompareOperator.Equals: |
|
|
|
condition = (variable as FloatVariable).Value == floatData.value; |
|
|
|
condition = lhs == rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
condition = (variable as FloatVariable).Value != floatData.value; |
|
|
|
condition = lhs != rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.LessThan: |
|
|
|
case CompareOperator.LessThan: |
|
|
|
condition = (variable as FloatVariable).Value < floatData.value; |
|
|
|
condition = lhs < rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.GreaterThan: |
|
|
|
case CompareOperator.GreaterThan: |
|
|
|
condition = (variable as FloatVariable).Value > floatData.value; |
|
|
|
condition = lhs > rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.LessThanOrEquals: |
|
|
|
case CompareOperator.LessThanOrEquals: |
|
|
|
condition = (variable as FloatVariable).Value <= floatData.value; |
|
|
|
condition = lhs <= rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.GreaterThanOrEquals: |
|
|
|
case CompareOperator.GreaterThanOrEquals: |
|
|
|
condition = (variable as FloatVariable).Value >= floatData.value; |
|
|
|
condition = lhs >= rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
string lhs = (variable as StringVariable).Value; |
|
|
|
|
|
|
|
string rhs = (compareVariable as StringVariable) == null ? stringValue : (compareVariable as StringVariable).Value; |
|
|
|
|
|
|
|
|
|
|
|
switch (compareOperator) |
|
|
|
switch (compareOperator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case CompareOperator.Equals: |
|
|
|
case CompareOperator.Equals: |
|
|
|
condition = (variable as StringVariable).Value == stringData.value; |
|
|
|
condition = lhs == rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
case CompareOperator.NotEquals: |
|
|
|
default: |
|
|
|
default: |
|
|
|
condition = (variable as StringVariable).Value != stringData.value; |
|
|
|
condition = lhs != rhs; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|