From 071c6ea8ddbacc360b121c2c08c541b70bac44c7 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Sat, 2 Aug 2014 00:09:52 +0100 Subject: [PATCH] Custom editor for Jump command --- .../Editor/FungusScript/AddOptionEditor.cs | 47 ------------------ .../Fungus/Editor/FungusScript/JumpEditor.cs | 30 +++++++++++ ...ptionEditor.cs.meta => JumpEditor.cs.meta} | 2 +- Assets/Shuttle/ShuttleGame.unity | Bin 78588 -> 78468 bytes 4 files changed, 31 insertions(+), 48 deletions(-) delete mode 100644 Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs create mode 100644 Assets/Fungus/Editor/FungusScript/JumpEditor.cs rename Assets/Fungus/Editor/FungusScript/{AddOptionEditor.cs.meta => JumpEditor.cs.meta} (78%) diff --git a/Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs b/Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs deleted file mode 100644 index c6ae465b..00000000 --- a/Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs +++ /dev/null @@ -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; - } - } - } - } - -} \ No newline at end of file diff --git a/Assets/Fungus/Editor/FungusScript/JumpEditor.cs b/Assets/Fungus/Editor/FungusScript/JumpEditor.cs new file mode 100644 index 00000000..36cd0a43 --- /dev/null +++ b/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; + } + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs.meta b/Assets/Fungus/Editor/FungusScript/JumpEditor.cs.meta similarity index 78% rename from Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs.meta rename to Assets/Fungus/Editor/FungusScript/JumpEditor.cs.meta index a50987ce..f7cba747 100644 --- a/Assets/Fungus/Editor/FungusScript/AddOptionEditor.cs.meta +++ b/Assets/Fungus/Editor/FungusScript/JumpEditor.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a20371077211a4cc394cb2192fdc4417 +guid: 970dc31f991bd4b0ba8e3475419f3272 MonoImporter: serializedVersion: 2 defaultReferences: [] diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 110c4833b6b33187d38085b970d0bfd255e84536..fb949d626532a2505318e31f9e8459e3c9ce0143 100644 GIT binary patch delta 570 zcmY+=O-lk%6b9gPb4H97xo{Ct`GsUgR6>h(q7l(5tW_u|CRl2yxQGZeuzlcST=o+Z ziSY-tkO(5E2>L)u%fN+Xlnc#Xb%begm^%;WoR@o>WiD0b)I>k$#H=YI8pOGnRXeN9 zo%2-%K5+udop_(Gt$Tl9gZ{*anP~s@$1{$!Fg>vr|NC z=xIr_5B7>H01LyAo9Ko=0`GzHkSCbV@;~Gmwg-!2xGpVZx8$wCLIXq}ieC9wkA0pQ zB9+XxE4FB0mguM#+|AvoBy78x%482*HiZ(Y^qyP+z31dDsR^Wqpsp}p`%bdP;<6v?+PBKZCo(*ecKqY|I~(} zb!=T#{$?f8^@&0Qi-@ac#)(Ef<5^tn(KAz}8eL=F84q465YBdsCwjJ3?GF=e_Yp;q zytW2Lf9mtj9SJ;R*qF<&ssf)mqZl