Browse Source

Hide Components option now unhides all components when not selected

Added Fungus Script to component menu
master
chrisgregan 10 years ago
parent
commit
d1d2041800
  1. 47
      Assets/Fungus/FungusScript/Scripts/FungusScript.cs

47
Assets/Fungus/FungusScript/Scripts/FungusScript.cs

@ -11,6 +11,7 @@ namespace Fungus
* Visual scripting controller for the Fungus Script programming language. * Visual scripting controller for the Fungus Script programming language.
* FungusScript objects may be edited visually using the Fungus Script editor window. * FungusScript objects may be edited visually using the Fungus Script editor window.
*/ */
[AddComponentMenu("Fungus/Fungus Script")]
public class FungusScript : MonoBehaviour public class FungusScript : MonoBehaviour
{ {
/** /**
@ -368,27 +369,45 @@ namespace Fungus
*/ */
public virtual void UpdateHideFlags() public virtual void UpdateHideFlags()
{ {
Sequence[] sequences = GetComponentsInChildren<Sequence>(); if (hideComponents)
foreach (Sequence sequence in sequences)
{ {
sequence.hideFlags = hideComponents ? HideFlags.HideInInspector : HideFlags.None; Sequence[] sequences = GetComponentsInChildren<Sequence>();
if (sequence.gameObject != gameObject) foreach (Sequence sequence in sequences)
{ {
sequence.gameObject.hideFlags = hideComponents ? HideFlags.HideInHierarchy : HideFlags.None; sequence.hideFlags = HideFlags.HideInInspector;
if (sequence.gameObject != gameObject)
{
sequence.gameObject.hideFlags = HideFlags.HideInHierarchy;
}
} }
}
Command[] commands = GetComponentsInChildren<Command>(); Command[] commands = GetComponentsInChildren<Command>();
foreach (Command command in commands) foreach (Command command in commands)
{ {
command.hideFlags = hideComponents ? HideFlags.HideInInspector : HideFlags.None; command.hideFlags = HideFlags.HideInInspector;
} }
EventHandler[] eventHandlers = GetComponentsInChildren<EventHandler>(); EventHandler[] eventHandlers = GetComponentsInChildren<EventHandler>();
foreach (EventHandler eventHandler in eventHandlers) foreach (EventHandler eventHandler in eventHandlers)
{
eventHandler.hideFlags = HideFlags.HideInInspector;
}
}
else
{ {
eventHandler.hideFlags = hideComponents ? HideFlags.HideInInspector : HideFlags.None; MonoBehaviour[] monoBehaviours = GetComponentsInChildren<MonoBehaviour>();
foreach (MonoBehaviour monoBehaviour in monoBehaviours)
{
if (monoBehaviour == null)
{
continue;
}
monoBehaviour.hideFlags = HideFlags.None;
monoBehaviour.gameObject.hideFlags = HideFlags.None;
}
} }
} }
public virtual void ClearSelectedCommands() public virtual void ClearSelectedCommands()

Loading…
Cancel
Save