Browse Source

Custom editor for Jump command

master
chrisgregan 11 years ago
parent
commit
071c6ea8dd
  1. 47
      Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs
  2. 30
      Assets/Fungus/Editor/FungusScript/JumpEditor.cs
  3. 2
      Assets/Fungus/Editor/FungusScript/JumpEditor.cs.meta
  4. BIN
      Assets/Shuttle/ShuttleGame.unity

47
Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs

@ -1,47 +0,0 @@
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus.Script
{
[CustomEditor (typeof(AddOption))]
public class AddOptionEditor : FungusCommandEditor
{
public override void DrawCommandInspectorGUI()
{
AddOption t = target as AddOption;
EditorGUI.BeginChangeCheck();
string newText = EditorGUILayout.TextField(new GUIContent("Text", "Text to display on option button"), t.text);
Sequence newSequence = SequenceEditor.SequenceField(new GUIContent("Sequence", "Sequence to execute when this option is selected"),
t.GetFungusScript(),
t.sequence);
AddOption.Condition newCondition = (AddOption.Condition)EditorGUILayout.EnumPopup(new GUIContent("Condition", "Conditions for when this option is displayed"), t.condition);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(t, "Set AddOption command");
t.text = newText;
t.sequence = newSequence;
t.condition = newCondition;
}
if (t.condition == AddOption.Condition.ShowOnBoolean ||
t.condition == AddOption.Condition.HideOnBoolean)
{
string newBooleanVariableKey = EditorGUILayout.TextField(new GUIContent("Boolean Variable Key", "Boolean variable to check for condition"), t.booleanVariableKey);
if (newBooleanVariableKey != t.booleanVariableKey)
{
Undo.RecordObject(t, "Set Boolean Variable");
t.booleanVariableKey = newBooleanVariableKey;
}
}
}
}
}

30
Assets/Fungus/Editor/FungusScript/JumpEditor.cs

@ -0,0 +1,30 @@
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Fungus.Script
{
[CustomEditor (typeof(Jump))]
public class JumpEditor : FungusCommandEditor
{
public override void DrawCommandInspectorGUI()
{
Jump t = target as Jump;
EditorGUI.BeginChangeCheck();
Sequence newSequence = SequenceEditor.SequenceField(new GUIContent("Sequence", "Sequence to jump to"),
t.GetFungusScript(),
t.targetSequence);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(t, "Set Jump command");
t.targetSequence = newSequence;
}
}
}
}

2
Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs.meta → Assets/Fungus/Editor/FungusScript/JumpEditor.cs.meta

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a20371077211a4cc394cb2192fdc4417 guid: 970dc31f991bd4b0ba8e3475419f3272
MonoImporter: MonoImporter:
serializedVersion: 2 serializedVersion: 2
defaultReferences: [] defaultReferences: []

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save