Browse Source

Added New Sequence button to Sequence Controller

master
chrisgregan 11 years ago
parent
commit
712817dbdb
  1. 7
      Assets/Fungus/Editor/FungusEditorWindow.cs
  2. 13
      Assets/Fungus/Editor/SequenceControllerEditor.cs
  3. BIN
      Assets/Fungus/Tests/Sequence/SequenceTest.unity

7
Assets/Fungus/Editor/FungusEditorWindow.cs

@ -7,9 +7,11 @@ using Fungus;
public class FungusEditorWindow : EditorWindow
{
[System.NonSerialized]
public Vector2 scrollPos; // ScrollViews use a Vector2 to track the state of each scroll bar
private List<Sequence> windowSequenceMap = new List<Sequence>();
private Vector2 scrollPos; // ScrollViews use a Vector2 to track the state of each scroll bar
private GameObject cachedSelection;
[MenuItem("Window/Fungus Editor")]
@ -63,6 +65,7 @@ public class FungusEditorWindow : EditorWindow
Sequence[] sequences = sequenceController.GetComponentsInChildren<Sequence>();
Rect scrollViewRect = new Rect();
foreach (Sequence s in sequences)
{
scrollViewRect.xMin = Mathf.Min(scrollViewRect.xMin, s.nodeRect.xMin);

13
Assets/Fungus/Editor/SequenceControllerEditor.cs

@ -28,6 +28,19 @@ public class SequenceControllerEditor : Editor
{
EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor");
}
if (GUILayout.Button("New Sequence"))
{
GameObject go = new GameObject("Sequence");
go.transform.parent = t.transform;
Sequence s = go.AddComponent<Sequence>();
FungusEditorWindow fungusEditorWindow = EditorWindow.GetWindow(typeof(FungusEditorWindow), false, "Fungus Editor") as FungusEditorWindow;
s.nodeRect.x = fungusEditorWindow.scrollPos.x;
s.nodeRect.y = fungusEditorWindow.scrollPos.y;
Undo.RegisterCreatedObjectUndo(go, "Sequence");
Selection.activeGameObject = go;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}

BIN
Assets/Fungus/Tests/Sequence/SequenceTest.unity

Binary file not shown.
Loading…
Cancel
Save