LayerMaskField() static private method

static private LayerMaskField ( UnityEditor.SerializedProperty property, GUIContent label ) : void
property UnityEditor.SerializedProperty
label UnityEngine.GUIContent
return void
Esempio n. 1
0
        private static void CreatePointTools()
        {
            LineRendererEditor.inputMode = (LineRendererEditor.InputMode)EditorGUILayout.EnumPopup(s_Styles.inputMode, LineRendererEditor.inputMode);
            if (LineRendererEditor.inputMode == LineRendererEditor.InputMode.PhysicsRaycast)
            {
                LineRendererEditor.raycastMask = EditorGUILayout.LayerMaskField(LineRendererEditor.raycastMask, s_Styles.layerMask);
            }

            LineRendererEditor.createPointSeparation = EditorGUILayout.FloatField(s_Styles.pointSeparation, LineRendererEditor.createPointSeparation);
            LineRendererEditor.creationOffset        = EditorGUILayout.FloatField(s_Styles.normalOffset, LineRendererEditor.creationOffset);
        }
Esempio n. 2
0
        internal void PlayBackInfoGUI(bool isPlayMode)
        {
            EventType type       = Event.current.type;
            int       hotControl = GUIUtility.hotControl;
            string    kFloatFieldFormatString = EditorGUI.kFloatFieldFormatString;

            EditorGUIUtility.labelWidth = 110f;
            if (!isPlayMode)
            {
                EditorGUI.kFloatFieldFormatString = ParticleEffectUI.s_Texts.secondsFloatFieldFormatString;
                if (Time.timeScale == 0f)
                {
                    using (new EditorGUI.DisabledScope(true))
                    {
                        EditorGUILayout.FloatField(ParticleEffectUI.s_Texts.previewSpeedDisabled, 0f, new GUILayoutOption[0]);
                    }
                }
                else
                {
                    ParticleSystemEditorUtils.simulationSpeed = Mathf.Clamp(EditorGUILayout.FloatField(ParticleEffectUI.s_Texts.previewSpeed, ParticleSystemEditorUtils.simulationSpeed, new GUILayoutOption[0]), 0f, 10f);
                }
                EditorGUI.kFloatFieldFormatString = kFloatFieldFormatString;
                EditorGUI.BeginChangeCheck();
                EditorGUI.kFloatFieldFormatString = ParticleEffectUI.s_Texts.secondsFloatFieldFormatString;
                float num = EditorGUILayout.FloatField(ParticleEffectUI.s_Texts.previewTime, ParticleSystemEditorUtils.playbackTime, new GUILayoutOption[0]);
                EditorGUI.kFloatFieldFormatString = kFloatFieldFormatString;
                if (EditorGUI.EndChangeCheck())
                {
                    if (type == EventType.MouseDrag)
                    {
                        ParticleSystemEditorUtils.playbackIsScrubbing = true;
                        float simulationSpeed = ParticleSystemEditorUtils.simulationSpeed;
                        float playbackTime    = ParticleSystemEditorUtils.playbackTime;
                        float num2            = num - playbackTime;
                        num = playbackTime + num2 * (0.05f * simulationSpeed);
                    }
                    num = Mathf.Max(num, 0f);
                    ParticleSystemEditorUtils.playbackTime = num;
                    foreach (ParticleSystem current in this.m_SelectedParticleSystems)
                    {
                        ParticleSystem root = ParticleSystemEditorUtils.GetRoot(current);
                        if (root.isStopped)
                        {
                            root.Play();
                            root.Pause();
                        }
                    }
                    ParticleSystemEditorUtils.PerformCompleteResimulation();
                }
                if (type == EventType.MouseDown && GUIUtility.hotControl != hotControl)
                {
                    this.m_IsDraggingTimeHotControlID             = GUIUtility.hotControl;
                    ParticleSystemEditorUtils.playbackIsScrubbing = true;
                }
                if (this.m_IsDraggingTimeHotControlID != -1 && GUIUtility.hotControl != this.m_IsDraggingTimeHotControlID)
                {
                    this.m_IsDraggingTimeHotControlID             = -1;
                    ParticleSystemEditorUtils.playbackIsScrubbing = false;
                }
            }
            int   num3 = 0;
            float num4 = 0f;
            float num5 = float.PositiveInfinity;

            foreach (ParticleSystem current2 in this.m_SelectedParticleSystems)
            {
                current2.CalculateEffectUIData(ref num3, ref num4, ref num5);
            }
            EditorGUILayout.LabelField(ParticleEffectUI.s_Texts.particleCount, GUIContent.Temp(num3.ToString()), new GUILayoutOption[0]);
            bool flag = false;
            int  num6 = 0;

            foreach (ParticleSystem current3 in this.m_SelectedParticleSystems)
            {
                int num7 = 0;
                if (current3.CalculateEffectUISubEmitterData(ref num7, ref num4, ref num5))
                {
                    flag  = true;
                    num6 += num7;
                }
            }
            if (flag)
            {
                EditorGUILayout.LabelField(ParticleEffectUI.s_Texts.subEmitterParticleCount, GUIContent.Temp(num6.ToString()), new GUILayoutOption[0]);
            }
            if (num4 >= num5)
            {
                EditorGUILayout.LabelField(ParticleEffectUI.s_Texts.particleSpeeds, GUIContent.Temp(num5.ToString(ParticleEffectUI.s_Texts.speedFloatFieldFormatString) + " - " + num4.ToString(ParticleEffectUI.s_Texts.speedFloatFieldFormatString)), new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.LabelField(ParticleEffectUI.s_Texts.particleSpeeds, GUIContent.Temp("0.0 - 0.0"), new GUILayoutOption[0]);
            }
            if (!EditorApplication.isPlaying)
            {
                uint       arg_3C2_0 = ParticleSystemEditorUtils.previewLayers;
                GUIContent arg_3C2_1 = ParticleEffectUI.s_Texts.previewLayers;
                if (ParticleEffectUI.< > f__mg$cache0 == null)
                {
                    ParticleEffectUI.< > f__mg$cache0 = new EditorUtility.SelectMenuItemFunction(ParticleEffectUI.SetPreviewLayersDelegate);
                }
                EditorGUILayout.LayerMaskField(arg_3C2_0, arg_3C2_1, ParticleEffectUI.< > f__mg$cache0, new GUILayoutOption[0]);
Esempio n. 3
0
        internal void PlayBackInfoGUI(bool isPlayMode)
        {
            EventType oldEventType  = Event.current.type;
            int       oldHotControl = GUIUtility.hotControl;
            string    oldFormat     = EditorGUI.kFloatFieldFormatString;

            EditorGUIUtility.labelWidth = 110.0f;

            if (!isPlayMode)
            {
                EditorGUI.kFloatFieldFormatString = s_Texts.secondsFloatFieldFormatString;
                if (Time.timeScale == 0.0f)
                {
                    using (new EditorGUI.DisabledScope(true))
                    {
                        EditorGUILayout.FloatField(s_Texts.previewSpeedDisabled, 0.0f);
                    }
                }
                else
                {
                    ParticleSystemEditorUtils.simulationSpeed = Mathf.Clamp(EditorGUILayout.FloatField(s_Texts.previewSpeed, ParticleSystemEditorUtils.simulationSpeed), 0f, 10f);
                }
                EditorGUI.kFloatFieldFormatString = oldFormat;

                EditorGUI.BeginChangeCheck();
                EditorGUI.kFloatFieldFormatString = s_Texts.secondsFloatFieldFormatString;
                float playbackTime = EditorGUILayout.FloatField(s_Texts.previewTime, ParticleSystemEditorUtils.playbackTime);
                EditorGUI.kFloatFieldFormatString = oldFormat;
                if (EditorGUI.EndChangeCheck())
                {
                    if (oldEventType == EventType.MouseDrag)
                    {
                        ParticleSystemEditorUtils.playbackIsScrubbing = true;
                        float previewSpeed    = ParticleSystemEditorUtils.simulationSpeed;
                        float oldplaybackTime = ParticleSystemEditorUtils.playbackTime;
                        float timeDiff        = playbackTime - oldplaybackTime;
                        playbackTime = oldplaybackTime + timeDiff * (0.05F * previewSpeed);
                    }

                    playbackTime = Mathf.Max(playbackTime, 0.0F);
                    ParticleSystemEditorUtils.playbackTime = playbackTime;

                    foreach (ParticleSystem ps in m_SelectedParticleSystems)
                    {
                        ParticleSystem root = ParticleSystemEditorUtils.GetRoot(ps);
                        if (root.isStopped)
                        {
                            root.Play();
                            root.Pause();
                        }
                    }

                    ParticleSystemEditorUtils.PerformCompleteResimulation();
                }

                // Detect start dragging
                if (oldEventType == EventType.MouseDown && GUIUtility.hotControl != oldHotControl)
                {
                    m_IsDraggingTimeHotControlID = GUIUtility.hotControl;
                    ParticleSystemEditorUtils.playbackIsScrubbing = true;
                }

                // Detect stop dragging
                if (m_IsDraggingTimeHotControlID != -1 && GUIUtility.hotControl != m_IsDraggingTimeHotControlID)
                {
                    m_IsDraggingTimeHotControlID = -1;
                    ParticleSystemEditorUtils.playbackIsScrubbing = false;
                }
            }

            int   particleCount   = 0;
            float fastestParticle = 0.0f;
            float slowestParticle = Mathf.Infinity;

            foreach (ParticleSystem ps in m_SelectedParticleSystems)
            {
                ps.CalculateEffectUIData(ref particleCount, ref fastestParticle, ref slowestParticle);
            }
            EditorGUILayout.LabelField(s_Texts.particleCount, GUIContent.Temp(particleCount.ToString()));

            bool hasSubEmitters      = false;
            int  subEmitterParticles = 0;

            foreach (ParticleSystem ps in m_SelectedParticleSystems)
            {
                int subEmitterParticlesCurrent = 0;
                if (ps.CalculateEffectUISubEmitterData(ref subEmitterParticlesCurrent, ref fastestParticle, ref slowestParticle))
                {
                    hasSubEmitters       = true;
                    subEmitterParticles += subEmitterParticlesCurrent;
                }
            }
            if (hasSubEmitters)
            {
                EditorGUILayout.LabelField(s_Texts.subEmitterParticleCount, GUIContent.Temp(subEmitterParticles.ToString()));
            }

            if (fastestParticle >= slowestParticle)
            {
                EditorGUILayout.LabelField(s_Texts.particleSpeeds, GUIContent.Temp(slowestParticle.ToString(s_Texts.speedFloatFieldFormatString) + " - " + fastestParticle.ToString(s_Texts.speedFloatFieldFormatString)));
            }
            else
            {
                EditorGUILayout.LabelField(s_Texts.particleSpeeds, GUIContent.Temp("0.0 - 0.0"));
            }

            if (!EditorApplication.isPlaying)
            {
                EditorGUILayout.LayerMaskField(ParticleSystemEditorUtils.previewLayers, s_Texts.previewLayers, SetPreviewLayersDelegate);
                ParticleSystemEditorUtils.resimulation = GUILayout.Toggle(ParticleSystemEditorUtils.resimulation, s_Texts.resimulation, EditorStyles.toggle);
            }

            ParticleEffectUI.m_ShowBounds = GUILayout.Toggle(ParticleEffectUI.m_ShowBounds, ParticleEffectUI.texts.showBounds, EditorStyles.toggle);

            EditorGUIUtility.labelWidth = 0.0f;
        }