From 618d34c91c094793af30f8f08be8e023e24ab9b2 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 11 Sep 2014 15:35:45 +0100 Subject: [PATCH] Reverted sequence to use game object name. Added Fungus Script menu item --- Assets/Example/Scenes/Example.unity | Bin 123692 -> 123484 bytes .../FungusScript/Editor/FungusScriptWindow.cs | 20 +++++++++++++++--- .../FungusScript/Editor/SequenceEditor.cs | 16 +++++++++----- .../Fungus/FungusScript/Scripts/Sequence.cs | 2 -- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Assets/Example/Scenes/Example.unity b/Assets/Example/Scenes/Example.unity index afa5300f5c6775fefe2b58fd8574639bed8de676..3060c85d19a25144c4e17eb7c85df4f7b85d7e3d 100644 GIT binary patch delta 5145 zcmY+{4{%h)9l-H@5FxaHCoyn9l(QhjPOB&A^!$H9luHe5r~#4^;F1tX_#0xBfPr^t z&{MF+9&*P&x!RdFRm2NHa?`PpDrzd0W(oynTHyq%(Q1v_*0c)ryLY=`-%NIL`P^^+ z|90QYo;L^o?eJiiu;%O%*4c6)#1KArwz(=_YAZfEFye3Ph&;K^6{))Q;Ye=#DC?TY zXAR>c2low)l(*+b&hY!W53(aquNoBD)IK6IV%hxmuiNK8Wf#%VR~Ii{tmk+3Cv7?Y zD}*TFbCxQ{j~vX2VR1`{j|OJS$n_U;d^tkQBL+^FQCJK!>$^M!-inV zYlJAr{-xr+g}J|z8KBOsZ(}jcT-Bi^g|?>`lu7udsyvK9|9Bw^urHJi$HG_$(}P*E z=2cJj1m}J(#pdJJSRA_*JEO{``wmV@VR90Ba+@*Vb_-fn@b}P8i2)qaMe%Cped$AUcW0E=TX3BOTsg;+0^hsj)%<;l5|C%e9%K24ePFGslvYy{2a+KhE$ z0lwGAvwHB<$?og9tOi^<+p{*zp6u}ov5q)B1n;L)MyenS8Qkcw-lqv_XpzU*B z79C&@W-iycU;A&#zQuXNy)okCElDU2`eYa;SXYqwBc~}hF!spLagTFkw@DA@C&gX%9*xPq?-|0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14NTYiHJD~zMgIx@{l0cn=4VeD{XXPzeC*~#Y16B7v z%=4i0`F=mvjG4)L4Ryo|XDVMDeb^h=n}|=h#`H|QJ=?mnU%rcPrmO#li-i|j?nF_I zb+%ye8xw?ZPblEqiJ@TiV)ugOweAHqD?`DRvEp@BX~MtG`eb;19^c;;Tv@#;IA6rZ z@3p*%$X+YIe||67YF(gK9^Y8gLCa%Vu@?_oFY{yVA!~|dC0;pXRrl#F^% zSYi!N_+GI_SlP;1l$GmVwbmpuuUes=)U7xw>&BkQ{z#lUYJGM=wu$MX<*Vvs6Qg4B zJ(ersdQ-QP{YJJk`YkJ*h`(i(_U(); + GameObject newSequenceGO = new GameObject(); + newSequenceGO.transform.parent = newFungusScriptGO.transform; + newSequenceGO.name = "Start"; + newSequenceGO.hideFlags = HideFlags.HideInHierarchy; + Sequence sequence = newSequenceGO.AddComponent(); + fungusScript.startSequence = sequence; + } + // Implementing this method causes the padlock image to display on the window // https://leahayes.wordpress.com/2013/04/30/adding-the-little-padlock-button-to-your-editorwindow/#more-455 void ShowButton(Rect position) { @@ -137,8 +151,8 @@ namespace Fungus for (int i = 0; i < sequences.Length; ++i) { Sequence sequence = sequences[i]; - - float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.sequenceName)).x; + + float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x; float windowWidth = Mathf.Max (titleWidth + 10, 100); if (fungusScript.selectedSequence == sequence || @@ -310,7 +324,7 @@ namespace Fungus GUILayout.BeginVertical(); GUILayout.FlexibleSpace(); - GUILayout.Label(sequence.sequenceName, labelStyle); + GUILayout.Label(sequence.name, labelStyle); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); diff --git a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs index 88061569..c3a0690b 100644 --- a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs @@ -17,7 +17,6 @@ namespace Fungus void OnEnable() { - sequenceNameProp = serializedObject.FindProperty("sequenceName"); descriptionProp = serializedObject.FindProperty("description"); } @@ -31,8 +30,15 @@ namespace Fungus serializedObject.Update(); Sequence sequence = fungusScript.selectedSequence; - - EditorGUILayout.PropertyField(sequenceNameProp); + + EditorGUI.BeginChangeCheck(); + string sequenceName = EditorGUILayout.TextField(new GUIContent("Name", "Name of sequence object"), sequence.gameObject.name); + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(sequence.gameObject, "Set Sequence Name"); + sequence.gameObject.name = sequenceName; + } + EditorGUILayout.PropertyField(descriptionProp); EditorGUILayout.Separator(); @@ -183,7 +189,7 @@ namespace Fungus Sequence[] sequences = fungusScript.GetComponentsInChildren(); for (int i = 0; i < sequences.Length; ++i) { - sequenceNames.Add(new GUIContent(sequences[i].sequenceName)); + sequenceNames.Add(new GUIContent(sequences[i].name)); if (sequence == sequences[i]) { @@ -221,7 +227,7 @@ namespace Fungus Sequence[] sequences = fungusScript.GetComponentsInChildren(); for (int i = 0; i < sequences.Length; ++i) { - sequenceNames.Add(new GUIContent(sequences[i].sequenceName)); + sequenceNames.Add(new GUIContent(sequences[i].name)); if (sequence == sequences[i]) { diff --git a/Assets/Fungus/FungusScript/Scripts/Sequence.cs b/Assets/Fungus/FungusScript/Scripts/Sequence.cs index e4c1b66e..44a4cfa6 100644 --- a/Assets/Fungus/FungusScript/Scripts/Sequence.cs +++ b/Assets/Fungus/FungusScript/Scripts/Sequence.cs @@ -14,8 +14,6 @@ namespace Fungus { public Rect nodeRect = new Rect(10, 10, 100, 40); - public string sequenceName = "Sequence"; - public string description = ""; [System.NonSerialized]