Browse Source

Renamed Set to SetVariable, improved color

master
chrisgregan 10 years ago
parent
commit
29898ed586
  1. BIN
      Assets/Example/Scenes/Example.unity
  2. 2
      Assets/Fungus/FungusScript/Commands/EndIf.cs
  3. 6
      Assets/Fungus/FungusScript/Commands/SetVariable.cs
  4. 0
      Assets/Fungus/FungusScript/Commands/SetVariable.cs.meta
  5. 34
      Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs
  6. 0
      Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs.meta

BIN
Assets/Example/Scenes/Example.unity

Binary file not shown.

2
Assets/Fungus/FungusScript/Commands/EndIf.cs

@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Fungus.Script namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"EndIf", "End If",
"Marks the end of an If statement block.")] "Marks the end of an If statement block.")]
public class EndIf : FungusCommand public class EndIf : FungusCommand
{ {

6
Assets/Fungus/FungusScript/Commands/Set.cs → Assets/Fungus/FungusScript/Commands/SetVariable.cs

@ -4,9 +4,9 @@ using System.Collections;
namespace Fungus.Script namespace Fungus.Script
{ {
[CommandInfo("Scripting", [CommandInfo("Scripting",
"Set", "Set Variable",
"Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.")] "Sets a variable to a new value using simple arithmetic operations. The value can be a constant or another variable.")]
public class Set : FungusCommand public class SetVariable : FungusCommand
{ {
public enum SetOperator public enum SetOperator
{ {
@ -180,7 +180,7 @@ namespace Fungus.Script
public override Color GetButtonColor() public override Color GetButtonColor()
{ {
return new Color32(235, 191, 217, 255); return new Color32(253, 253, 150, 255);
} }
} }

0
Assets/Fungus/FungusScript/Commands/Set.cs.meta → Assets/Fungus/FungusScript/Commands/SetVariable.cs.meta

34
Assets/Fungus/FungusScript/Editor/SetEditor.cs → Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs

@ -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;
} }
} }

0
Assets/Fungus/FungusScript/Editor/SetEditor.cs.meta → Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs.meta

Loading…
Cancel
Save