Browse Source

Renamed Set to SetVariable, improved color

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

BIN
Assets/Example/Scenes/Example.unity

Binary file not shown.

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

@ -4,9 +4,9 @@ using System.Collections;
namespace Fungus.Script
{
[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.")]
public class Set : FungusCommand
public class SetVariable : FungusCommand
{
public enum SetOperator
{
@ -180,7 +180,7 @@ namespace Fungus.Script
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
{
[CustomEditor (typeof(Set))]
public class SetEditor : FungusCommandEditor
[CustomEditor (typeof(SetVariable))]
public class SetVariableEditor : FungusCommandEditor
{
public override void DrawCommandGUI()
{
serializedObject.Update();
Set t = target as Set;
SetVariable t = target as SetVariable;
FungusScript fungusScript = t.GetFungusScript();
if (fungusScript == null)
@ -55,29 +55,29 @@ namespace Fungus.Script
switch (t.setOperator)
{
default:
case Set.SetOperator.Assign:
case SetVariable.SetOperator.Assign:
selectedIndex = 0;
break;
case Set.SetOperator.Negate:
case SetVariable.SetOperator.Negate:
selectedIndex = 1;
break;
case Set.SetOperator.Add:
case SetVariable.SetOperator.Add:
selectedIndex = 1;
break;
case Set.SetOperator.Subtract:
case SetVariable.SetOperator.Subtract:
selectedIndex = 2;
break;
case Set.SetOperator.Multiply:
case SetVariable.SetOperator.Multiply:
selectedIndex = 3;
break;
case Set.SetOperator.Divide:
case SetVariable.SetOperator.Divide:
selectedIndex = 4;
break;
}
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) ||
variable.GetType() == typeof(StringVariable))
{
@ -85,10 +85,10 @@ namespace Fungus.Script
{
default:
case 0:
setOperator = Set.SetOperator.Assign;
setOperator = SetVariable.SetOperator.Assign;
break;
case 1:
setOperator = Set.SetOperator.Negate;
setOperator = SetVariable.SetOperator.Negate;
break;
}
}
@ -99,19 +99,19 @@ namespace Fungus.Script
{
default:
case 0:
setOperator = Set.SetOperator.Assign;
setOperator = SetVariable.SetOperator.Assign;
break;
case 1:
setOperator = Set.SetOperator.Add;
setOperator = SetVariable.SetOperator.Add;
break;
case 2:
setOperator = Set.SetOperator.Subtract;
setOperator = SetVariable.SetOperator.Subtract;
break;
case 3:
setOperator = Set.SetOperator.Multiply;
setOperator = SetVariable.SetOperator.Multiply;
break;
case 4:
setOperator = Set.SetOperator.Divide;
setOperator = SetVariable.SetOperator.Divide;
break;
}
}

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

Loading…
Cancel
Save