GetInstance() static private method

static private GetInstance ( ) : ParticleSystemWindow
return ParticleSystemWindow
示例#1
0
        private bool ShouldShowInspector()
        {
            // Only show the inspector GUI if we are not showing the ParticleSystemWindow
            ParticleSystemWindow window = ParticleSystemWindow.GetInstance();

            return(!window || !window.IsVisible() || !selectedInParticleSystemWindow);
        }
        private void ShowEdiorButtonGUI()
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            ParticleSystemWindow instance = ParticleSystemWindow.GetInstance();

            if (GUILayout.Button(!(bool)((Object)instance) || !instance.IsVisible() ? this.showWindowText : (instance.GetNumTabs() <= 1 ? this.closeWindowText : this.hideWindowText), EditorStyles.miniButton, new GUILayoutOption[1] {
                GUILayout.Width(110f)
            }))
            {
                if ((bool)((Object)instance))
                {
                    if (instance.IsVisible())
                    {
                        if (!instance.ShowNextTabIfPossible())
                        {
                            instance.Close();
                        }
                    }
                    else
                    {
                        instance.Focus();
                    }
                }
                else
                {
                    this.Clear();
                    ParticleSystemWindow.CreateWindow();
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();
        }
        private void ShowEdiorButtonGUI()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            bool                 selectedInParticleSystemWindow = this.selectedInParticleSystemWindow;
            GameObject           gameObject     = (base.target as ParticleSystem).gameObject;
            GUIContent           hideWindowText = null;
            ParticleSystemWindow instance       = ParticleSystemWindow.GetInstance();

            if (((instance != null) && instance.IsVisible()) && selectedInParticleSystemWindow)
            {
                if (instance.GetNumTabs() > 1)
                {
                    hideWindowText = this.hideWindowText;
                }
                else
                {
                    hideWindowText = this.closeWindowText;
                }
            }
            else
            {
                hideWindowText = this.showWindowText;
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(110f) };
            if (GUILayout.Button(hideWindowText, EditorStyles.miniButton, options))
            {
                if (((instance != null) && instance.IsVisible()) && selectedInParticleSystemWindow)
                {
                    if (!instance.ShowNextTabIfPossible())
                    {
                        instance.Close();
                    }
                }
                else
                {
                    if (!selectedInParticleSystemWindow)
                    {
                        ParticleSystemEditorUtils.lockedParticleSystem = null;
                        Selection.activeGameObject = gameObject;
                    }
                    if (instance != null)
                    {
                        if (!selectedInParticleSystemWindow)
                        {
                            instance.Clear();
                        }
                        instance.Focus();
                    }
                    else
                    {
                        this.Clear();
                        ParticleSystemWindow.CreateWindow();
                        GUIUtility.ExitGUI();
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
        private bool ShouldShowInspector()
        {
            ParticleSystemWindow instance = ParticleSystemWindow.GetInstance();

            if ((bool)((Object)instance))
            {
                return(!instance.IsVisible());
            }
            return(true);
        }
示例#5
0
        private void ShowEdiorButtonGUI()
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            ParticleSystemWindow instance = ParticleSystemWindow.GetInstance();
            GUIContent           content;

            if (instance && instance.IsVisible())
            {
                if (instance.GetNumTabs() > 1)
                {
                    content = this.hideWindowText;
                }
                else
                {
                    content = this.closeWindowText;
                }
            }
            else
            {
                content = this.showWindowText;
            }
            if (GUILayout.Button(content, EditorStyles.miniButton, new GUILayoutOption[]
            {
                GUILayout.Width(110f)
            }))
            {
                if (instance)
                {
                    if (instance.IsVisible())
                    {
                        if (!instance.ShowNextTabIfPossible())
                        {
                            instance.Close();
                        }
                    }
                    else
                    {
                        instance.Focus();
                    }
                }
                else
                {
                    this.Clear();
                    ParticleSystemWindow.CreateWindow();
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();
        }
示例#6
0
        private bool ShouldShowInspector()
        {
            ParticleSystemWindow instance = ParticleSystemWindow.GetInstance();

            return(!instance || !instance.IsVisible());
        }
 private void ShowEdiorButtonGUI()
 {
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.FlexibleSpace();
     if (this.m_ParticleEffectUI == null || !this.m_ParticleEffectUI.multiEdit)
     {
         bool                 selectedInParticleSystemWindow = this.selectedInParticleSystemWindow;
         GameObject           gameObject = (base.target as ParticleSystem).gameObject;
         ParticleSystemWindow instance   = ParticleSystemWindow.GetInstance();
         if (instance)
         {
             instance.customEditor = this;
         }
         GUIContent content;
         if (instance && instance.IsVisible() && selectedInParticleSystemWindow)
         {
             if (instance.GetNumTabs() > 1)
             {
                 content = this.hideWindowText;
             }
             else
             {
                 content = this.closeWindowText;
             }
         }
         else
         {
             content = this.showWindowText;
         }
         if (GUILayout.Button(content, EditorStyles.miniButton, new GUILayoutOption[]
         {
             GUILayout.Width(110f)
         }))
         {
             if (instance && instance.IsVisible() && selectedInParticleSystemWindow)
             {
                 if (!instance.ShowNextTabIfPossible())
                 {
                     instance.Close();
                 }
             }
             else
             {
                 if (!selectedInParticleSystemWindow)
                 {
                     ParticleSystemEditorUtils.lockedParticleSystem = null;
                     Selection.activeGameObject = gameObject;
                 }
                 if (instance)
                 {
                     if (!selectedInParticleSystemWindow)
                     {
                         instance.Clear();
                     }
                     instance.Focus();
                 }
                 else
                 {
                     this.Clear();
                     ParticleSystemWindow.CreateWindow();
                     instance = ParticleSystemWindow.GetInstance();
                     instance.customEditor = this;
                     GUIUtility.ExitGUI();
                 }
             }
         }
     }
     GUILayout.EndHorizontal();
 }
        private bool ShouldShowInspector()
        {
            ParticleSystemWindow instance = ParticleSystemWindow.GetInstance();

            return(((instance == null) || !instance.IsVisible()) || !this.selectedInParticleSystemWindow);
        }
示例#9
0
        void ShowEdiorButtonGUI()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.FlexibleSpace();

                if (m_ParticleEffectUI == null || !m_ParticleEffectUI.multiEdit)
                {
                    bool       alreadySelected  = selectedInParticleSystemWindow;
                    GameObject targetGameObject = (target as ParticleSystem).gameObject;

                    GUIContent           text   = null;
                    ParticleSystemWindow window = ParticleSystemWindow.GetInstance();
                    if (window)
                    {
                        window.customEditor = this; // window can be created by LoadWindowLayout, when Editor starts up, so always make sure the custom editor member is set up (case 930005)
                    }
                    if (window && window.IsVisible() && alreadySelected)
                    {
                        if (window.GetNumTabs() > 1)
                        {
                            text = hideWindowText;
                        }
                        else
                        {
                            text = closeWindowText;
                        }
                    }
                    else
                    {
                        text = showWindowText;
                    }

                    if (GUILayout.Button(text, EditorStyles.miniButton, GUILayout.Width(110)))
                    {
                        if (window && window.IsVisible() && alreadySelected)
                        {
                            // Hide window (close instead if not possible)
                            if (!window.ShowNextTabIfPossible())
                            {
                                window.Close();
                            }
                        }
                        else
                        {
                            if (!alreadySelected)
                            {
                                ParticleSystemEditorUtils.lockedParticleSystem = null;
                                Selection.activeGameObject = targetGameObject;
                            }

                            if (window)
                            {
                                if (!alreadySelected)
                                {
                                    window.Clear();
                                }

                                // Show window
                                window.Focus();
                            }
                            else
                            {
                                // Kill inspector gui first to ensure playback time is cached properly
                                Clear();

                                // Create new window
                                ParticleSystemWindow.CreateWindow();
                                window = ParticleSystemWindow.GetInstance();
                                window.customEditor = this;
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                }
            }
            GUILayout.EndHorizontal();
        }
        void ShowEditorButtonGUI()
        {
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();

                if (m_ParticleEffectUI != null)
                {
                    m_ParticleEffectUI.m_SubEmitterSelected = false;
                }

                if (m_ParticleEffectUI == null || !m_ParticleEffectUI.multiEdit)
                {
                    bool       alreadySelected  = selectedInParticleSystemWindow;
                    GameObject targetGameObject = (target as ParticleSystem).gameObject;

                    // Show a button to select the sub-emitter owner, if this system is a sub-emitter
                    List <ParticleSystem> owners = new List <ParticleSystem>();
                    var parent = targetGameObject.transform.parent;
                    while (parent != null)
                    {
                        var ps = parent.GetComponent <ParticleSystem>();
                        if (ps != null)
                        {
                            var subEmitters = ps.subEmitters;
                            if (subEmitters.enabled)
                            {
                                for (int i = 0; i < subEmitters.subEmittersCount; i++)
                                {
                                    var subEmitter = subEmitters.GetSubEmitterSystem(i);
                                    if (subEmitter != null && subEmitter.gameObject == targetGameObject)
                                    {
                                        owners.Add(ps);
                                        break;
                                    }
                                }
                            }
                        }

                        parent = parent.parent;
                    }
                    if (owners.Count > 0)
                    {
                        if (m_ParticleEffectUI != null)
                        {
                            m_ParticleEffectUI.m_SubEmitterSelected = true;
                        }

                        if (owners.Count == 1)
                        {
                            if (GUILayout.Button(GUIContent.Temp(selectSubEmitterOwner.text, owners[0].name), EditorStyles.miniButton, GUILayout.Width(160)))
                            {
                                Selection.activeGameObject = owners[0].gameObject;
                            }
                        }
                        else
                        {
                            if (EditorGUILayout.DropdownButton(selectSubEmitterOwner, FocusType.Passive, EditorStyles.miniButton, GUILayout.Width(160)))
                            {
                                GenericMenu menu = new GenericMenu();

                                foreach (var owner in owners)
                                {
                                    menu.AddItem(new GUIContent(owner.name), false, OnOwnerSelected, owner);
                                }
                                menu.AddSeparator("");
                                menu.AddItem(new GUIContent("Select All"), false, OnOwnersSelected, owners);

                                Rect buttonRect = GUILayoutUtility.topLevel.GetLast();
                                menu.DropDown(buttonRect);
                            }
                        }
                    }

                    // When editing a preset the GameObject will have the NotEditable flag.
                    // We do not support the ParticleSystemWindow for Presets for two reasons:
                    // - When selected the Preset editor creates a temporary GameObject which it then uses to edit the properties.
                    // The ParticleSystemWindow also uses the Selection system which triggers a selection change, the Preset
                    // editor cleans up the temp object and the ParticleSystemWindow is now unable to edit the system.
                    // - A preset will only contain a single system, so there is no benefit to using the window. (case 1198545)
                    if ((targetGameObject.hideFlags & HideFlags.NotEditable) != 0)
                    {
                        return;
                    }

                    GUIContent           text   = null;
                    ParticleSystemWindow window = ParticleSystemWindow.GetInstance();
                    if (window)
                    {
                        window.customEditor = this; // window can be created by LoadWindowLayout, when Editor starts up, so always make sure the custom editor member is set up (case 930005)
                    }
                    if (window && window.IsVisible() && alreadySelected)
                    {
                        if (window.GetNumTabs() > 1)
                        {
                            text = hideWindowText;
                        }
                        else
                        {
                            text = closeWindowText;
                        }
                    }
                    else
                    {
                        text = showWindowText;
                    }

                    if (GUILayout.Button(text, EditorStyles.miniButton, GUILayout.Width(110)))
                    {
                        if (window && window.IsVisible() && alreadySelected)
                        {
                            // Hide window (close instead if not possible)
                            if (!window.ShowNextTabIfPossible())
                            {
                                window.Close();
                            }
                        }
                        else
                        {
                            if (!alreadySelected)
                            {
                                ParticleSystemEditorUtils.lockedParticleSystem = null;
                                Selection.activeGameObject = targetGameObject;
                            }

                            if (window)
                            {
                                if (!alreadySelected)
                                {
                                    window.Clear();
                                }

                                // Show window
                                window.Focus();
                            }
                            else
                            {
                                // Kill inspector gui first to ensure playback time is cached properly
                                Clear();

                                // Create new window
                                ParticleSystemWindow.CreateWindow();
                                window = ParticleSystemWindow.GetInstance();
                                window.customEditor = this;
                                GUIUtility.ExitGUI();
                            }
                        }
                    }
                }
            }
        }