Browse Source

Green outline around selected sequence

master
chrisgregan 11 years ago
parent
commit
79011d666d
  1. 33
      Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs
  2. 5
      Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs
  3. 18
      Assets/Fungus/Editor/FungusScript/SequenceEditor.cs
  4. BIN
      Assets/Shuttle/ShuttleGame.unity

33
Assets/Fungus/Editor/FungusScript/FungusEditorWindow.cs

@ -98,7 +98,17 @@ namespace Fungus.Script
float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x; float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x;
float windowWidth = Mathf.Max (titleWidth + 10, 100); float windowWidth = Mathf.Max (titleWidth + 10, 100);
sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, sequence.name, GUILayout.Width(windowWidth), GUILayout.Height(40), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); if (Selection.activeGameObject == sequence.gameObject)
{
Rect outlineRect = sequence.nodeRect;
outlineRect.width += 10;
outlineRect.x -= 5;
outlineRect.height += 10;
outlineRect.y -= 5;
GLDraw.DrawBox(outlineRect, Color.green, 2);
}
sequence.nodeRect = GUILayout.Window(i, sequence.nodeRect, DrawWindow, sequence.name, GUILayout.Width(windowWidth), GUILayout.Height(20), GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
windowSequenceMap.Add(sequence); windowSequenceMap.Add(sequence);
} }
@ -172,6 +182,7 @@ namespace Fungus.Script
} }
} }
/*
if (FungusCommandEditor.selectedCommand != null) if (FungusCommandEditor.selectedCommand != null)
{ {
if (Selection.activeGameObject == null) if (Selection.activeGameObject == null)
@ -191,14 +202,24 @@ namespace Fungus.Script
} }
} }
} }
*/
Sequence sequence = windowSequenceMap[windowId]; Sequence sequence = windowSequenceMap[windowId];
string description = GUILayout.TextArea(sequence.description, GUILayout.ExpandWidth(true)); if (!Application.isPlaying && sequence.gameObject == Selection.activeGameObject)
if (description != sequence.description) {
string description = GUILayout.TextArea(sequence.description, GUILayout.ExpandWidth(true));
if (description != sequence.description)
{
Undo.RecordObject(sequence, "Set Description");
sequence.description = description;
}
}
else
{ {
Undo.RecordObject(sequence, "Set Description"); GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
sequence.description = description; labelStyle.wordWrap = true;
GUILayout.Label(sequence.description, labelStyle);
} }
/* /*
@ -244,7 +265,7 @@ namespace Fungus.Script
} }
*/ */
GUILayout.Space(10); GUILayout.Space(1);
GUI.DragWindow(); GUI.DragWindow();
} }

5
Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs

@ -15,7 +15,10 @@ namespace Fungus.Script
void OnEnable() void OnEnable()
{ {
variablesProperty = serializedObject.FindProperty("variables"); if (serializedObject != null)
{
variablesProperty = serializedObject.FindProperty("variables");
}
} }
public void OnInspectorUpdate() public void OnInspectorUpdate()

18
Assets/Fungus/Editor/FungusScript/SequenceEditor.cs

@ -55,17 +55,19 @@ namespace Fungus.Script
return true; return true;
} }
/*
public void OnInspectorUpdate()
{
Repaint();
}
*/
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
Sequence t = target as Sequence; Sequence t = target as Sequence;
EditorGUILayout.PrefixLabel(new GUIContent("Description", "Sequence description displayed in editor window"));
string description = GUILayout.TextArea(t.description, GUILayout.ExpandWidth(true));
if (description != t.description)
{
Undo.RecordObject(t, "Set Description");
t.description = description;
}
FungusCommand[] commands = t.GetComponents<FungusCommand>(); FungusCommand[] commands = t.GetComponents<FungusCommand>();
/* /*
@ -82,6 +84,8 @@ namespace Fungus.Script
} }
*/ */
EditorGUILayout.PrefixLabel("Commands");
foreach (FungusCommand command in commands) foreach (FungusCommand command in commands)
{ {
bool showCommandInspector = false; bool showCommandInspector = false;

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save