|
|
|
@ -19,7 +19,7 @@ namespace Fungus.Script
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FungusVariable variable = SequenceEditor.VariableField(new GUIContent("Variable", "Variable to set"), |
|
|
|
|
FungusVariable variable = FungusVariableEditor.VariableField(new GUIContent("Variable", "Variable to set"), |
|
|
|
|
fungusScript, |
|
|
|
|
t.variable); |
|
|
|
|
|
|
|
|
@ -120,47 +120,52 @@ namespace Fungus.Script
|
|
|
|
|
t.setOperator = setOperator; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool booleanValue = t.booleanData.value; |
|
|
|
|
int integerValue = t.integerData.value; |
|
|
|
|
float floatValue = t.floatData.value; |
|
|
|
|
string stringValue = t.stringData.value; |
|
|
|
|
FungusVariable setVariable = FungusVariableEditor.VariableField(new GUIContent("Other Variable", "The variable to read the assigned value from."), |
|
|
|
|
t.GetFungusScript(), |
|
|
|
|
t.setVariable, |
|
|
|
|
v => v.GetType() == variable.GetType ()); |
|
|
|
|
|
|
|
|
|
if (setVariable != t.setVariable) |
|
|
|
|
{ |
|
|
|
|
Undo.RecordObject(t, "Select Set Variable"); |
|
|
|
|
t.setVariable = setVariable; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (setVariable == null) |
|
|
|
|
{ |
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
|
|
|
|
|
|
bool booleanValue = t.booleanValue; |
|
|
|
|
int integerValue = t.integerValue; |
|
|
|
|
float floatValue = t.floatValue; |
|
|
|
|
string stringValue = t.stringValue; |
|
|
|
|
|
|
|
|
|
if (variable.GetType() == typeof(BooleanVariable)) |
|
|
|
|
{ |
|
|
|
|
booleanValue = EditorGUILayout.Toggle(new GUIContent("Boolean Value", "The boolean value to set the variable with"), booleanValue); |
|
|
|
|
booleanValue = EditorGUILayout.Toggle (new GUIContent("Boolean Value", "A constant boolean value to set the variable with"), booleanValue); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(IntegerVariable)) |
|
|
|
|
{ |
|
|
|
|
integerValue = EditorGUILayout.IntField(new GUIContent("Integer Value", "The integer value to set the variable with"), integerValue); |
|
|
|
|
integerValue = EditorGUILayout.IntField(new GUIContent("Integer Value", "A constant integer value to set the variable with"), integerValue); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(FloatVariable)) |
|
|
|
|
{ |
|
|
|
|
floatValue = EditorGUILayout.FloatField(new GUIContent("Float Value", "The float value to set the variable with"), floatValue); |
|
|
|
|
floatValue = EditorGUILayout.FloatField(new GUIContent("Float Value", "A constant float value to set the variable with"), floatValue); |
|
|
|
|
} |
|
|
|
|
else if (variable.GetType() == typeof(StringVariable)) |
|
|
|
|
{ |
|
|
|
|
stringValue = EditorGUILayout.TextField(new GUIContent("String Value", "The string value to set the variable with"), stringValue); |
|
|
|
|
stringValue = EditorGUILayout.TextField(new GUIContent("String Value", "A constant string value to set the variable with"), stringValue); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (booleanValue != t.booleanData.value) |
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
|
{ |
|
|
|
|
Undo.RecordObject(t, "Set boolean value"); |
|
|
|
|
t.booleanData.value = booleanValue; |
|
|
|
|
} |
|
|
|
|
else if (integerValue != t.integerData.value) |
|
|
|
|
{ |
|
|
|
|
Undo.RecordObject(t, "Set integer value"); |
|
|
|
|
t.integerData.value = integerValue; |
|
|
|
|
} |
|
|
|
|
else if (floatValue != t.floatData.value) |
|
|
|
|
{ |
|
|
|
|
Undo.RecordObject(t, "Set float value"); |
|
|
|
|
t.floatData.value = floatValue; |
|
|
|
|
Undo.RecordObject(t, "Set Variable Data"); |
|
|
|
|
|
|
|
|
|
t.booleanValue = booleanValue; |
|
|
|
|
t.integerValue = integerValue; |
|
|
|
|
t.floatValue = floatValue; |
|
|
|
|
t.stringValue = stringValue; |
|
|
|
|
} |
|
|
|
|
else if (stringValue != t.stringData.value) |
|
|
|
|
{ |
|
|
|
|
Undo.RecordObject(t, "Set string value"); |
|
|
|
|
t.stringData.value = stringValue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|