Browse Source

Renamed FungusVariable to Variable

master
chrisgregan 11 years ago
parent
commit
64cf2c346e
  1. BIN
      Assets/Example/Scenes/Example.unity
  2. 4
      Assets/Fungus/FungusScript/Commands/If.cs
  3. 4
      Assets/Fungus/FungusScript/Commands/SetVariable.cs
  4. 4
      Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs
  5. 4
      Assets/Fungus/FungusScript/Editor/IfEditor.cs
  6. 4
      Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs
  7. 40
      Assets/Fungus/FungusScript/Editor/VariableEditor.cs
  8. 0
      Assets/Fungus/FungusScript/Editor/VariableEditor.cs.meta
  9. 12
      Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs
  10. 0
      Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs.meta
  11. 2
      Assets/Fungus/FungusScript/Scripts/BooleanVariable.cs
  12. 2
      Assets/Fungus/FungusScript/Scripts/Command.cs
  13. 2
      Assets/Fungus/FungusScript/Scripts/FloatVariable.cs
  14. 6
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs
  15. 2
      Assets/Fungus/FungusScript/Scripts/IntegerVariable.cs
  16. 2
      Assets/Fungus/FungusScript/Scripts/StringVariable.cs
  17. 2
      Assets/Fungus/FungusScript/Scripts/Variable.cs
  18. 0
      Assets/Fungus/FungusScript/Scripts/Variable.cs.meta

BIN
Assets/Example/Scenes/Example.unity

Binary file not shown.

4
Assets/Fungus/FungusScript/Commands/If.cs

@ -19,7 +19,7 @@ namespace Fungus.Script
"If the test expression is true, execute the following block of commands.")] "If the test expression is true, execute the following block of commands.")]
public class If : Command public class If : Command
{ {
public FungusVariable variable; public Variable variable;
public CompareOperator compareOperator; public CompareOperator compareOperator;
@ -212,7 +212,7 @@ namespace Fungus.Script
return summary; return summary;
} }
public override bool HasReference(FungusVariable variable) public override bool HasReference(Variable variable)
{ {
return (variable == this.variable); return (variable == this.variable);
} }

4
Assets/Fungus/FungusScript/Commands/SetVariable.cs

@ -18,7 +18,7 @@ namespace Fungus.Script
Divide // /= Divide // /=
} }
public FungusVariable variable; public Variable variable;
public SetOperator setOperator; public SetOperator setOperator;
@ -173,7 +173,7 @@ namespace Fungus.Script
return description; return description;
} }
public override bool HasReference(FungusVariable variable) public override bool HasReference(Variable variable)
{ {
return (variable == this.variable); return (variable == this.variable);
} }

4
Assets/Fungus/FungusScript/Editor/FungusScriptEditor.cs

@ -98,7 +98,7 @@ namespace Fungus.Script
ReorderableListGUI.Title("Variables"); ReorderableListGUI.Title("Variables");
FungusVariableListAdaptor adaptor = new FungusVariableListAdaptor(variablesProp, 0); VariableListAdaptor adaptor = new VariableListAdaptor(variablesProp, 0);
ReorderableListControl.DrawControlFromState(adaptor, null, ReorderableListFlags.DisableContextMenu | ReorderableListFlags.HideAddButton); ReorderableListControl.DrawControlFromState(adaptor, null, ReorderableListFlags.DisableContextMenu | ReorderableListFlags.HideAddButton);
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
@ -118,7 +118,7 @@ namespace Fungus.Script
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
void AddVariable<T>(object obj) where T : FungusVariable void AddVariable<T>(object obj) where T : Variable
{ {
FungusScript fungusScript = obj as FungusScript; FungusScript fungusScript = obj as FungusScript;
if (fungusScript == null) if (fungusScript == null)

4
Assets/Fungus/FungusScript/Editor/IfEditor.cs

@ -38,7 +38,7 @@ namespace Fungus.Script
return; return;
} }
FungusVariableEditor.VariableField(variableProp, VariableEditor.VariableField(variableProp,
new GUIContent("Variable", "Variable to use in operation"), new GUIContent("Variable", "Variable to use in operation"),
t.GetFungusScript(), t.GetFungusScript(),
null); null);
@ -49,7 +49,7 @@ namespace Fungus.Script
return; return;
} }
FungusVariable selectedVariable = variableProp.objectReferenceValue as FungusVariable; Variable selectedVariable = variableProp.objectReferenceValue as Variable;
System.Type variableType = selectedVariable.GetType(); System.Type variableType = selectedVariable.GetType();
List<GUIContent> operatorList = new List<GUIContent>(); List<GUIContent> operatorList = new List<GUIContent>();

4
Assets/Fungus/FungusScript/Editor/SetVariableEditor.cs

@ -38,7 +38,7 @@ namespace Fungus.Script
return; return;
} }
FungusVariableEditor.VariableField(variableProp, VariableEditor.VariableField(variableProp,
new GUIContent("Variable", "Variable to set"), new GUIContent("Variable", "Variable to set"),
fungusScript); fungusScript);
@ -49,7 +49,7 @@ namespace Fungus.Script
return; return;
} }
FungusVariable selectedVariable = variableProp.objectReferenceValue as FungusVariable; Variable selectedVariable = variableProp.objectReferenceValue as Variable;
System.Type variableType = selectedVariable.GetType(); System.Type variableType = selectedVariable.GetType();
List<GUIContent> operatorsList = new List<GUIContent>(); List<GUIContent> operatorsList = new List<GUIContent>();

40
Assets/Fungus/FungusScript/Editor/FungusVariableEditor.cs → Assets/Fungus/FungusScript/Editor/VariableEditor.cs

@ -8,30 +8,30 @@ using System.Linq;
namespace Fungus.Script namespace Fungus.Script
{ {
[CustomEditor (typeof(FungusVariable), true)] [CustomEditor (typeof(Variable), true)]
public class FungusVariableEditor : CommandEditor public class VariableEditor : CommandEditor
{ {
void OnEnable() void OnEnable()
{ {
FungusVariable t = target as FungusVariable; Variable t = target as Variable;
t.hideFlags = HideFlags.HideInInspector; t.hideFlags = HideFlags.HideInInspector;
} }
static public void VariableField(SerializedProperty property, GUIContent label, FungusScript fungusScript, Func<FungusVariable, bool> filter = null) static public void VariableField(SerializedProperty property, GUIContent label, FungusScript fungusScript, Func<Variable, bool> filter = null)
{ {
List<string> variableKeys = new List<string>(); List<string> variableKeys = new List<string>();
List<FungusVariable> variableObjects = new List<FungusVariable>(); List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<None>"); variableKeys.Add("<None>");
variableObjects.Add(null); variableObjects.Add(null);
List<FungusVariable> variables = fungusScript.variables; List<Variable> variables = fungusScript.variables;
int index = 0; int index = 0;
int selectedIndex = 0; int selectedIndex = 0;
FungusVariable selectedVariable = property.objectReferenceValue as FungusVariable; Variable selectedVariable = property.objectReferenceValue as Variable;
foreach (FungusVariable v in variables) foreach (Variable v in variables)
{ {
if (filter != null) if (filter != null)
{ {
@ -97,15 +97,15 @@ namespace Fungus.Script
BooleanVariable selectedBooleanVariable = referenceProp.objectReferenceValue as BooleanVariable; BooleanVariable selectedBooleanVariable = referenceProp.objectReferenceValue as BooleanVariable;
List<string> variableKeys = new List<string>(); List<string> variableKeys = new List<string>();
List<FungusVariable> variableObjects = new List<FungusVariable>(); List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<Value>"); variableKeys.Add("<Value>");
variableObjects.Add(null); variableObjects.Add(null);
FungusVariable[] variables = fungusScript.GetComponents<FungusVariable>(); Variable[] variables = fungusScript.GetComponents<Variable>();
int index = 0; int index = 0;
int selectedIndex = 0; int selectedIndex = 0;
foreach (FungusVariable v in variables) foreach (Variable v in variables)
{ {
if (v.GetType() != typeof(BooleanVariable)) if (v.GetType() != typeof(BooleanVariable))
{ {
@ -170,15 +170,15 @@ namespace Fungus.Script
IntegerVariable selectedVariable = referenceProp.objectReferenceValue as IntegerVariable; IntegerVariable selectedVariable = referenceProp.objectReferenceValue as IntegerVariable;
List<string> variableKeys = new List<string>(); List<string> variableKeys = new List<string>();
List<FungusVariable> variableObjects = new List<FungusVariable>(); List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<Value>"); variableKeys.Add("<Value>");
variableObjects.Add(null); variableObjects.Add(null);
FungusVariable[] variables = fungusScript.GetComponents<FungusVariable>(); Variable[] variables = fungusScript.GetComponents<Variable>();
int index = 0; int index = 0;
int selectedIndex = 0; int selectedIndex = 0;
foreach (FungusVariable v in variables) foreach (Variable v in variables)
{ {
if (v.GetType() != typeof(IntegerVariable)) if (v.GetType() != typeof(IntegerVariable))
{ {
@ -243,15 +243,15 @@ namespace Fungus.Script
FloatVariable selectedVariable = referenceProp.objectReferenceValue as FloatVariable; FloatVariable selectedVariable = referenceProp.objectReferenceValue as FloatVariable;
List<string> variableKeys = new List<string>(); List<string> variableKeys = new List<string>();
List<FungusVariable> variableObjects = new List<FungusVariable>(); List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<Value>"); variableKeys.Add("<Value>");
variableObjects.Add(null); variableObjects.Add(null);
FungusVariable[] variables = fungusScript.GetComponents<FungusVariable>(); Variable[] variables = fungusScript.GetComponents<Variable>();
int index = 0; int index = 0;
int selectedIndex = 0; int selectedIndex = 0;
foreach (FungusVariable v in variables) foreach (Variable v in variables)
{ {
if (v.GetType() != typeof(FloatVariable)) if (v.GetType() != typeof(FloatVariable))
{ {
@ -316,15 +316,15 @@ namespace Fungus.Script
StringVariable selectedVariable = referenceProp.objectReferenceValue as StringVariable; StringVariable selectedVariable = referenceProp.objectReferenceValue as StringVariable;
List<string> variableKeys = new List<string>(); List<string> variableKeys = new List<string>();
List<FungusVariable> variableObjects = new List<FungusVariable>(); List<Variable> variableObjects = new List<Variable>();
variableKeys.Add("<Value>"); variableKeys.Add("<Value>");
variableObjects.Add(null); variableObjects.Add(null);
FungusVariable[] variables = fungusScript.GetComponents<FungusVariable>(); Variable[] variables = fungusScript.GetComponents<Variable>();
int index = 0; int index = 0;
int selectedIndex = 0; int selectedIndex = 0;
foreach (FungusVariable v in variables) foreach (Variable v in variables)
{ {
if (v.GetType() != typeof(StringVariable)) if (v.GetType() != typeof(StringVariable))
{ {

0
Assets/Fungus/FungusScript/Editor/FungusVariableEditor.cs.meta → Assets/Fungus/FungusScript/Editor/VariableEditor.cs.meta

12
Assets/Fungus/FungusScript/Editor/FungusVariableListAdaptor.cs → Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs

@ -1,4 +1,4 @@
// Copyright (c) 2012-2013 Rotorz Limited. All rights reserved. // Copyright (c) 2012-2013 Rotorz Limited. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
@ -9,7 +9,7 @@ using Rotorz.ReorderableList;
namespace Fungus.Script namespace Fungus.Script
{ {
public class FungusVariableListAdaptor : IReorderableListAdaptor { public class VariableListAdaptor : IReorderableListAdaptor {
private SerializedProperty _arrayProperty; private SerializedProperty _arrayProperty;
@ -23,7 +23,7 @@ namespace Fungus.Script
get { return _arrayProperty; } get { return _arrayProperty; }
} }
public FungusVariableListAdaptor(SerializedProperty arrayProperty, float fixedItemHeight) { public VariableListAdaptor(SerializedProperty arrayProperty, float fixedItemHeight) {
if (arrayProperty == null) if (arrayProperty == null)
throw new ArgumentNullException("Array property was null."); throw new ArgumentNullException("Array property was null.");
if (!arrayProperty.isArray) if (!arrayProperty.isArray)
@ -33,7 +33,7 @@ namespace Fungus.Script
this.fixedItemHeight = fixedItemHeight; this.fixedItemHeight = fixedItemHeight;
} }
public FungusVariableListAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f) { public VariableListAdaptor(SerializedProperty arrayProperty) : this(arrayProperty, 0f) {
} }
public int Count { public int Count {
@ -65,7 +65,7 @@ namespace Fungus.Script
public void Remove(int index) { public void Remove(int index) {
// Remove the Fungus Variable component // Remove the Fungus Variable component
FungusVariable variable = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as FungusVariable; Variable variable = _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue as Variable;
Undo.DestroyObjectImmediate(variable); Undo.DestroyObjectImmediate(variable);
_arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null; _arrayProperty.GetArrayElementAtIndex(index).objectReferenceValue = null;
@ -84,7 +84,7 @@ namespace Fungus.Script
public void DrawItem(Rect position, int index) public void DrawItem(Rect position, int index)
{ {
FungusVariable variable = this[index].objectReferenceValue as FungusVariable; Variable variable = this[index].objectReferenceValue as Variable;
float width1 = 100; float width1 = 100;
float width3 = 50; float width3 = 50;

0
Assets/Fungus/FungusScript/Editor/FungusVariableListAdaptor.cs.meta → Assets/Fungus/FungusScript/Editor/VariableListAdaptor.cs.meta

2
Assets/Fungus/FungusScript/Scripts/BooleanVariable.cs

@ -5,7 +5,7 @@ using System.Collections;
namespace Fungus.Script namespace Fungus.Script
{ {
public class BooleanVariable : FungusVariable public class BooleanVariable : Variable
{ {
bool booleanValue; bool booleanValue;

2
Assets/Fungus/FungusScript/Scripts/Command.cs

@ -109,7 +109,7 @@ namespace Fungus.Script
public virtual void GetConnectedSequences(ref List<Sequence> connectedSequences) public virtual void GetConnectedSequences(ref List<Sequence> connectedSequences)
{} {}
public virtual bool HasReference(FungusVariable variable) public virtual bool HasReference(Variable variable)
{ {
return false; return false;
} }

2
Assets/Fungus/FungusScript/Scripts/FloatVariable.cs

@ -4,7 +4,7 @@ using System.Collections;
namespace Fungus.Script namespace Fungus.Script
{ {
public class FloatVariable : FungusVariable public class FloatVariable : Variable
{ {
float floatValue; float floatValue;

6
Assets/Fungus/FungusScript/Scripts/FungusScript.cs

@ -45,7 +45,7 @@ namespace Fungus.Script
public bool colorCommands = true; public bool colorCommands = true;
public List<FungusVariable> variables = new List<FungusVariable>(); public List<Variable> variables = new List<Variable>();
void Start() void Start()
{ {
@ -88,7 +88,7 @@ namespace Fungus.Script
sequence.ExecuteNextCommand(); sequence.ExecuteNextCommand();
} }
public string GetUniqueVariableKey(string originalKey, FungusVariable ignoreVariable = null) public string GetUniqueVariableKey(string originalKey, Variable ignoreVariable = null)
{ {
int suffix = 0; int suffix = 0;
string baseKey = originalKey; string baseKey = originalKey;
@ -110,7 +110,7 @@ namespace Fungus.Script
while (true) while (true)
{ {
bool collision = false; bool collision = false;
foreach(FungusVariable variable in GetComponents<FungusVariable>()) foreach(Variable variable in GetComponents<Variable>())
{ {
if (variable == ignoreVariable || if (variable == ignoreVariable ||
variable.key == null) variable.key == null)

2
Assets/Fungus/FungusScript/Scripts/IntegerVariable.cs

@ -4,7 +4,7 @@ using System.Collections;
namespace Fungus.Script namespace Fungus.Script
{ {
public class IntegerVariable : FungusVariable public class IntegerVariable : Variable
{ {
int integerValue; int integerValue;

2
Assets/Fungus/FungusScript/Scripts/StringVariable.cs

@ -4,7 +4,7 @@ using System.Collections;
namespace Fungus.Script namespace Fungus.Script
{ {
public class StringVariable : FungusVariable public class StringVariable : Variable
{ {
string stringValue; string stringValue;

2
Assets/Fungus/FungusScript/Scripts/FungusVariable.cs → Assets/Fungus/FungusScript/Scripts/Variable.cs

@ -18,7 +18,7 @@ namespace Fungus.Script
Global Global
} }
public class FungusVariable : MonoBehaviour public class Variable : MonoBehaviour
{ {
public VariableScope scope; public VariableScope scope;
public string key = ""; public string key = "";

0
Assets/Fungus/FungusScript/Scripts/FungusVariable.cs.meta → Assets/Fungus/FungusScript/Scripts/Variable.cs.meta

Loading…
Cancel
Save