|
|
@ -11,6 +11,8 @@ namespace Fungus.Script |
|
|
|
{ |
|
|
|
{ |
|
|
|
private List<Sequence> windowSequenceMap = new List<Sequence>(); |
|
|
|
private List<Sequence> windowSequenceMap = new List<Sequence>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static public FungusScript activeFungusScript; |
|
|
|
|
|
|
|
|
|
|
|
[MenuItem("Window/Fungus Editor")] |
|
|
|
[MenuItem("Window/Fungus Editor")] |
|
|
|
static void Init() |
|
|
|
static void Init() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -24,31 +26,17 @@ namespace Fungus.Script |
|
|
|
|
|
|
|
|
|
|
|
static public FungusScript GetFungusScript() |
|
|
|
static public FungusScript GetFungusScript() |
|
|
|
{ |
|
|
|
{ |
|
|
|
GameObject activeObject = Selection.activeGameObject; |
|
|
|
if (Selection.activeGameObject != null) |
|
|
|
|
|
|
|
|
|
|
|
while (activeObject != null) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
FungusScript fungusScript = activeObject.GetComponent<FungusScript>(); |
|
|
|
FungusScript fungusScript = Selection.activeGameObject.GetComponent<FungusScript>(); |
|
|
|
Sequence sequence = activeObject.GetComponent<Sequence>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fungusScript != null) |
|
|
|
if (fungusScript != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Found sequence controller |
|
|
|
activeFungusScript = fungusScript; |
|
|
|
return fungusScript; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (sequence != null && |
|
|
|
|
|
|
|
sequence.transform.parent != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// Check parent for sequence controller |
|
|
|
|
|
|
|
activeObject = sequence.transform.parent.gameObject; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
activeObject = null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return activeFungusScript; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void OnGUI() |
|
|
|
void OnGUI() |
|
|
@ -167,6 +155,8 @@ namespace Fungus.Script |
|
|
|
{ |
|
|
|
{ |
|
|
|
FungusScript fungusScript = s.GetFungusScript(); |
|
|
|
FungusScript fungusScript = s.GetFungusScript(); |
|
|
|
fungusScript.selectedSequence = s; |
|
|
|
fungusScript.selectedSequence = s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Selection.activeGameObject = fungusScript.gameObject; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|