diff --git a/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs b/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs index 09d52aa2..7ad1eb71 100644 --- a/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs +++ b/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs @@ -83,12 +83,19 @@ namespace Fungus.EditorUtils list.drawHeaderCallback = DrawHeader; list.drawElementCallback = DrawItem; //list.elementHeightCallback = GetElementHeight; + list.onSelectCallback = SelectChanged; } - //private float GetElementHeight(int index) - //{ - // return EditorGUI.GetPropertyHeight(this[index], null, true);// + EditorGUIUtility.singleLineHeight; - //} + private void SelectChanged(ReorderableList list) + { + Command command = this[list.index].objectReferenceValue as Command; + var flowchart = (Flowchart)command.GetFlowchart(); + BlockEditor.actionList.Add(delegate + { + flowchart.ClearSelectedCommands(); + flowchart.AddSelectedCommand(command); + }); + } private void DrawHeader(Rect rect) { @@ -227,6 +234,7 @@ namespace Fungus.EditorUtils flowchart.ClearSelectedCommands(); }); Event.current.Use(); + list.index = index; } BlockEditor.actionList.Add(delegate