|
|
@ -6,14 +6,14 @@ using System.Collections.Generic; |
|
|
|
namespace Fungus.Script |
|
|
|
namespace Fungus.Script |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
[CustomEditor (typeof(Set))] |
|
|
|
[CustomEditor (typeof(SetVariable))] |
|
|
|
public class SetEditor : FungusCommandEditor |
|
|
|
public class SetVariableEditor : FungusCommandEditor |
|
|
|
{ |
|
|
|
{ |
|
|
|
public override void DrawCommandGUI() |
|
|
|
public override void DrawCommandGUI() |
|
|
|
{ |
|
|
|
{ |
|
|
|
serializedObject.Update(); |
|
|
|
serializedObject.Update(); |
|
|
|
|
|
|
|
|
|
|
|
Set t = target as Set; |
|
|
|
SetVariable t = target as SetVariable; |
|
|
|
|
|
|
|
|
|
|
|
FungusScript fungusScript = t.GetFungusScript(); |
|
|
|
FungusScript fungusScript = t.GetFungusScript(); |
|
|
|
if (fungusScript == null) |
|
|
|
if (fungusScript == null) |
|
|
@ -55,29 +55,29 @@ namespace Fungus.Script |
|
|
|
switch (t.setOperator) |
|
|
|
switch (t.setOperator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
default: |
|
|
|
default: |
|
|
|
case Set.SetOperator.Assign: |
|
|
|
case SetVariable.SetOperator.Assign: |
|
|
|
selectedIndex = 0; |
|
|
|
selectedIndex = 0; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Set.SetOperator.Negate: |
|
|
|
case SetVariable.SetOperator.Negate: |
|
|
|
selectedIndex = 1; |
|
|
|
selectedIndex = 1; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Set.SetOperator.Add: |
|
|
|
case SetVariable.SetOperator.Add: |
|
|
|
selectedIndex = 1; |
|
|
|
selectedIndex = 1; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Set.SetOperator.Subtract: |
|
|
|
case SetVariable.SetOperator.Subtract: |
|
|
|
selectedIndex = 2; |
|
|
|
selectedIndex = 2; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Set.SetOperator.Multiply: |
|
|
|
case SetVariable.SetOperator.Multiply: |
|
|
|
selectedIndex = 3; |
|
|
|
selectedIndex = 3; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Set.SetOperator.Divide: |
|
|
|
case SetVariable.SetOperator.Divide: |
|
|
|
selectedIndex = 4; |
|
|
|
selectedIndex = 4; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
selectedIndex = EditorGUILayout.Popup(new GUIContent("Operator", "Arithmetic operator to use"), selectedIndex, operatorsList.ToArray()); |
|
|
|
selectedIndex = EditorGUILayout.Popup(new GUIContent("Operator", "Arithmetic operator to use"), selectedIndex, operatorsList.ToArray()); |
|
|
|
|
|
|
|
|
|
|
|
Set.SetOperator setOperator = Set.SetOperator.Assign; |
|
|
|
SetVariable.SetOperator setOperator = SetVariable.SetOperator.Assign; |
|
|
|
if (variable.GetType() == typeof(BooleanVariable) || |
|
|
|
if (variable.GetType() == typeof(BooleanVariable) || |
|
|
|
variable.GetType() == typeof(StringVariable)) |
|
|
|
variable.GetType() == typeof(StringVariable)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -85,10 +85,10 @@ namespace Fungus.Script |
|
|
|
{ |
|
|
|
{ |
|
|
|
default: |
|
|
|
default: |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
setOperator = Set.SetOperator.Assign; |
|
|
|
setOperator = SetVariable.SetOperator.Assign; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
setOperator = Set.SetOperator.Negate; |
|
|
|
setOperator = SetVariable.SetOperator.Negate; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -99,19 +99,19 @@ namespace Fungus.Script |
|
|
|
{ |
|
|
|
{ |
|
|
|
default: |
|
|
|
default: |
|
|
|
case 0: |
|
|
|
case 0: |
|
|
|
setOperator = Set.SetOperator.Assign; |
|
|
|
setOperator = SetVariable.SetOperator.Assign; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
case 1: |
|
|
|
setOperator = Set.SetOperator.Add; |
|
|
|
setOperator = SetVariable.SetOperator.Add; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
case 2: |
|
|
|
setOperator = Set.SetOperator.Subtract; |
|
|
|
setOperator = SetVariable.SetOperator.Subtract; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
case 3: |
|
|
|
setOperator = Set.SetOperator.Multiply; |
|
|
|
setOperator = SetVariable.SetOperator.Multiply; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
case 4: |
|
|
|
setOperator = Set.SetOperator.Divide; |
|
|
|
setOperator = SetVariable.SetOperator.Divide; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |