|
|
|
@ -98,7 +98,6 @@ namespace Fungus.Script
|
|
|
|
|
|
|
|
|
|
GUIStyle windowStyle = new GUIStyle(GUI.skin.window); |
|
|
|
|
|
|
|
|
|
bool drawOutline = false; |
|
|
|
|
Rect outlineRect = new Rect(); |
|
|
|
|
|
|
|
|
|
windowSequenceMap.Clear(); |
|
|
|
@ -109,16 +108,6 @@ namespace Fungus.Script
|
|
|
|
|
float titleWidth = windowStyle.CalcSize(new GUIContent(sequence.name)).x; |
|
|
|
|
float windowWidth = Mathf.Max (titleWidth + 10, 100); |
|
|
|
|
|
|
|
|
|
if (fungusScript.selectedSequence == sequence) |
|
|
|
|
{ |
|
|
|
|
drawOutline = true; |
|
|
|
|
outlineRect = sequence.nodeRect; |
|
|
|
|
outlineRect.width += 10; |
|
|
|
|
outlineRect.x -= 5; |
|
|
|
|
outlineRect.height += 10; |
|
|
|
|
outlineRect.y -= 5; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
@ -127,20 +116,25 @@ namespace Fungus.Script
|
|
|
|
|
// Draw connections |
|
|
|
|
foreach (Sequence s in windowSequenceMap) |
|
|
|
|
{ |
|
|
|
|
DrawConnections(s, false); |
|
|
|
|
DrawConnections(fungusScript, s, false); |
|
|
|
|
} |
|
|
|
|
foreach (Sequence s in windowSequenceMap) |
|
|
|
|
{ |
|
|
|
|
DrawConnections(s, true); |
|
|
|
|
DrawConnections(fungusScript, s, true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
EndWindows(); |
|
|
|
|
|
|
|
|
|
if (drawOutline) |
|
|
|
|
if (fungusScript.selectedSequence != null) |
|
|
|
|
{ |
|
|
|
|
outlineRect = fungusScript.selectedSequence.nodeRect; |
|
|
|
|
outlineRect.width += 10; |
|
|
|
|
outlineRect.x -= 5; |
|
|
|
|
outlineRect.height += 10; |
|
|
|
|
outlineRect.y -= 5; |
|
|
|
|
GLDraw.DrawBox(outlineRect, Color.green, 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
EndWindows(); |
|
|
|
|
|
|
|
|
|
GUI.EndScrollView(); |
|
|
|
|
|
|
|
|
|
string labelText = fungusScript.name; |
|
|
|
@ -271,14 +265,16 @@ namespace Fungus.Script
|
|
|
|
|
GUI.DragWindow(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DrawConnections(Sequence sequence, bool highlightedOnly) |
|
|
|
|
void DrawConnections(FungusScript fungusScript, Sequence sequence, bool highlightedOnly) |
|
|
|
|
{ |
|
|
|
|
List<Sequence> connectedSequences = new List<Sequence>(); |
|
|
|
|
|
|
|
|
|
bool sequenceIsSelected = (fungusScript.selectedSequence == sequence); |
|
|
|
|
|
|
|
|
|
FungusCommand[] commands = sequence.GetComponentsInChildren<FungusCommand>(); |
|
|
|
|
foreach (FungusCommand command in commands) |
|
|
|
|
{ |
|
|
|
|
bool highlight = ShouldHighlight(command); |
|
|
|
|
bool highlight = command.IsExecuting() || (sequenceIsSelected && command.expanded); |
|
|
|
|
|
|
|
|
|
if (highlightedOnly && !highlight || |
|
|
|
|
!highlightedOnly && highlight) |
|
|
|
@ -291,9 +287,13 @@ namespace Fungus.Script
|
|
|
|
|
|
|
|
|
|
foreach (Sequence sequenceB in connectedSequences) |
|
|
|
|
{ |
|
|
|
|
Rect rectA = sequence.nodeRect; |
|
|
|
|
Rect rectB = sequenceB.nodeRect; |
|
|
|
|
DrawRectConnection(sequence.nodeRect, sequenceB.nodeRect, highlight); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void DrawRectConnection(Rect rectA, Rect rectB, bool highlight) |
|
|
|
|
{ |
|
|
|
|
Vector2 pointA; |
|
|
|
|
Vector2 pointB; |
|
|
|
|
|
|
|
|
@ -309,26 +309,12 @@ namespace Fungus.Script
|
|
|
|
|
|
|
|
|
|
Color color = Color.grey; |
|
|
|
|
if (highlight) |
|
|
|
|
{ |
|
|
|
|
if (command.IsExecuting()) |
|
|
|
|
{ |
|
|
|
|
color = Color.green; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
color = Color.yellow; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GLDraw.DrawConnectingCurve(pointA, pointB, color, 2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool ShouldHighlight(FungusCommand command) |
|
|
|
|
{ |
|
|
|
|
return (command.IsExecuting() || (FungusCommandEditor.selectedCommand == command)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |