Browse Source

Option description and <Continue> instead of <None>

master
chrisgregan 11 years ago
parent
commit
4421d477c4
  1. 9
      Assets/Fungus/Editor/FungusScript/CallEditor.cs
  2. 25
      Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs
  3. 5
      Assets/Fungus/Editor/FungusScript/OptionEditor.cs
  4. 6
      Assets/Fungus/Editor/FungusScript/SequenceEditor.cs
  5. 6
      Assets/Fungus/VisualScripting/Call.cs
  6. 8
      Assets/Fungus/VisualScripting/Option.cs
  7. BIN
      Assets/Shuttle/ShuttleGame.unity

9
Assets/Fungus/Editor/FungusScript/CallEditor.cs

@ -30,7 +30,10 @@ namespace Fungus.Script
if (t.callCondition == CallCondition.CallAlways)
{
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to call"), t.GetFungusScript(), t.targetSequence);
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to call"),
new GUIContent("<Continue>"),
t.GetFungusScript(),
t.targetSequence);
if (targetSequence != t.targetSequence)
{
Undo.RecordObject(t, "Set Target Sequence");
@ -39,7 +42,7 @@ namespace Fungus.Script
return;
}
FungusVariable fungusVariable = FungusVariableEditor.VariableField(new GUIContent("Compare Variable", "Variable to use in compare operation"),
FungusVariable fungusVariable = FungusVariableEditor.VariableField(new GUIContent("Variable", "Variable to use in operation"),
t.GetFungusScript(),
t.variable,
null);
@ -95,10 +98,12 @@ namespace Fungus.Script
}
Sequence onTrue = SequenceEditor.SequenceField(new GUIContent("On True Sequence", "Sequence to execute if comparision is true"),
new GUIContent("<Continue>"),
t.GetFungusScript(),
t.onTrueSequence);
Sequence onFalse = SequenceEditor.SequenceField(new GUIContent("On False Sequence", "Sequence to execute if comparision is false"),
new GUIContent("<Continue>"),
t.GetFungusScript(),
t.onFalseSequence);

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

@ -38,12 +38,14 @@ namespace Fungus.Script
FungusScript t = target as FungusScript;
GUIContent stepTimeLabel = new GUIContent("Step Time", "Minimum time to execute each step");
t.stepTime = EditorGUILayout.FloatField(stepTimeLabel, t.stepTime);
GUIContent startSequenceLabel = new GUIContent("Start Sequence", "Sequence to be executed when controller starts.");
t.startSequence = SequenceEditor.SequenceField(startSequenceLabel, t, t.startSequence);
float stepTime = EditorGUILayout.FloatField(new GUIContent("Step Time", "Minimum time to execute each step"), t.stepTime);
EditorGUI.BeginChangeCheck();
Sequence startSequence = SequenceEditor.SequenceField(new GUIContent("Start Sequence", "Sequence to be executed when controller starts."),
new GUIContent("<None>"),
t,
t.startSequence);
if (t.startSequence == null)
{
GUIStyle style = new GUIStyle(GUI.skin.label);
@ -51,8 +53,17 @@ namespace Fungus.Script
EditorGUILayout.LabelField(new GUIContent("Error: Please select a Start Sequence"), style);
}
GUIContent startAutomaticallyLabel = new GUIContent("Start Automatically", "Start this Fungus Script when the scene starts.");
t.startAutomatically = EditorGUILayout.Toggle(startAutomaticallyLabel, t.startAutomatically);
bool startAutomatically = EditorGUILayout.Toggle(new GUIContent("Start Automatically", "Start this Fungus Script when the scene starts."), t.startAutomatically);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(t, "Set Fungus Script");
t.stepTime = stepTime;
t.startSequence = startSequence;
t.startAutomatically = startAutomatically;
}
EditorGUILayout.Separator();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

5
Assets/Fungus/Editor/FungusScript/OptionEditor.cs

@ -17,7 +17,10 @@ namespace Fungus.Script
EditorGUI.BeginChangeCheck();
string optionText = EditorGUILayout.TextField(new GUIContent("Option Text", "Text for option button label"), t.optionText);
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when option is selected"), t.GetFungusScript(), t.targetSequence);
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when option is selected"),
new GUIContent("<Continue>"),
t.GetFungusScript(),
t.targetSequence);
Option.ShowCondition showCondition = (Option.ShowCondition)EditorGUILayout.EnumPopup(new GUIContent("Show Condition", "Condition when this option should be visible."), t.showCondition);
BooleanVariable booleanVariable = t.booleanVariable;

6
Assets/Fungus/Editor/FungusScript/SequenceEditor.cs

@ -10,9 +10,7 @@ namespace Fungus.Script
[CustomEditor (typeof(Sequence))]
public class SequenceEditor : Editor
{
// FungusCommand activeCommand;
static public Sequence SequenceField(GUIContent label, FungusScript fungusScript, Sequence sequence)
static public Sequence SequenceField(GUIContent label, GUIContent nullLabel, FungusScript fungusScript, Sequence sequence)
{
if (fungusScript == null)
{
@ -25,7 +23,7 @@ namespace Fungus.Script
List<GUIContent> sequenceNames = new List<GUIContent>();
int selectedIndex = 0;
sequenceNames.Add(new GUIContent("<None>"));
sequenceNames.Add(nullLabel);
Sequence[] sequences = fungusScript.GetComponentsInChildren<Sequence>();
for (int i = 0; i < sequences.Length; ++i)
{

6
Assets/Fungus/VisualScripting/Call.cs

@ -7,7 +7,7 @@ namespace Fungus.Script
public enum CallCondition
{
CallAlways,
CallOnCompare
CallIf
}
public enum CompareOperator
@ -202,7 +202,7 @@ namespace Fungus.Script
if (onTrueSequence == null)
{
description += "<continue>";
description += "<Continue>";
}
else
{
@ -211,7 +211,7 @@ namespace Fungus.Script
description += " else ";
if (onFalseSequence == null)
{
description += "<continue>";
description += "<Continue>";
}
else
{

8
Assets/Fungus/VisualScripting/Option.cs

@ -76,10 +76,14 @@ namespace Fungus.Script
}
}
public override string GetDescription()
{
return "\"" + optionText + "\"";
string description = "\"" + optionText + "\"";
if (targetSequence != null)
{
description += " (" + targetSequence.name + ")";
}
return description;
}
}

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save