示例#1
0
 protected override void Init()
 {
     if (this.m_StrengthX == null)
     {
         if (NoiseModuleUI.s_Texts == null)
         {
             NoiseModuleUI.s_Texts = new NoiseModuleUI.Texts();
         }
         this.m_StrengthX                 = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.x, "strength", ModuleUI.kUseSignedRange);
         this.m_StrengthY                 = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.y, "strengthY", ModuleUI.kUseSignedRange);
         this.m_StrengthZ                 = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.z, "strengthZ", ModuleUI.kUseSignedRange);
         this.m_SeparateAxes              = base.GetProperty("separateAxes");
         this.m_Damping                   = base.GetProperty("damping");
         this.m_Frequency                 = base.GetProperty("frequency");
         this.m_Octaves                   = base.GetProperty("octaves");
         this.m_OctaveMultiplier          = base.GetProperty("octaveMultiplier");
         this.m_OctaveScale               = base.GetProperty("octaveScale");
         this.m_Quality                   = base.GetProperty("quality");
         this.m_ScrollSpeed               = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.scrollSpeed, "scrollSpeed", ModuleUI.kUseSignedRange);
         this.m_ScrollSpeed.m_AllowRandom = false;
         this.m_RemapX = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.x, "remap", ModuleUI.kUseSignedRange);
         this.m_RemapY = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.y, "remapY", ModuleUI.kUseSignedRange);
         this.m_RemapZ = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.z, "remapZ", ModuleUI.kUseSignedRange);
         this.m_RemapX.m_AllowRandom   = false;
         this.m_RemapY.m_AllowRandom   = false;
         this.m_RemapZ.m_AllowRandom   = false;
         this.m_RemapX.m_AllowConstant = false;
         this.m_RemapY.m_AllowConstant = false;
         this.m_RemapZ.m_AllowConstant = false;
         this.m_RemapEnabled           = base.GetProperty("remapEnabled");
         this.m_PositionAmount         = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.positionAmount, "positionAmount", ModuleUI.kUseSignedRange);
         this.m_RotationAmount         = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.rotationAmount, "rotationAmount", ModuleUI.kUseSignedRange);
         this.m_SizeAmount             = new SerializedMinMaxCurve(this, NoiseModuleUI.s_Texts.sizeAmount, "sizeAmount", ModuleUI.kUseSignedRange);
         if (NoiseModuleUI.s_PreviewTexture == null)
         {
             NoiseModuleUI.s_PreviewTexture                      = new Texture2D(96, 96, TextureFormat.RGBA32, false, true);
             NoiseModuleUI.s_PreviewTexture.name                 = "ParticleNoisePreview";
             NoiseModuleUI.s_PreviewTexture.filterMode           = FilterMode.Bilinear;
             NoiseModuleUI.s_PreviewTexture.hideFlags            = HideFlags.HideAndDontSave;
             NoiseModuleUI.s_Texts.previewTexture.image          = NoiseModuleUI.s_PreviewTexture;
             NoiseModuleUI.s_Texts.previewTextureMultiEdit.image = NoiseModuleUI.s_PreviewTexture;
         }
         NoiseModuleUI.s_PreviewTextureDirty    = true;
         this.previewTextureStyle               = new GUIStyle(ParticleSystemStyles.Get().label);
         this.previewTextureStyle.alignment     = TextAnchor.LowerCenter;
         this.previewTextureStyle.imagePosition = ImagePosition.ImageAbove;
     }
 }
示例#2
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            if (NoiseModuleUI.s_Texts == null)
            {
                NoiseModuleUI.s_Texts = new NoiseModuleUI.Texts();
            }
            if (NoiseModuleUI.s_PreviewTextureDirty)
            {
                if (this.m_ParticleSystemUI.multiEdit)
                {
                    Color32[] array = new Color32[NoiseModuleUI.s_PreviewTexture.width * NoiseModuleUI.s_PreviewTexture.height];
                    for (int i = 0; i < array.Length; i++)
                    {
                        array[i] = new Color32(120, 120, 120, 255);
                    }
                    NoiseModuleUI.s_PreviewTexture.SetPixels32(array);
                    NoiseModuleUI.s_PreviewTexture.Apply(false);
                }
                else
                {
                    this.m_ParticleSystemUI.m_ParticleSystems[0].GenerateNoisePreviewTexture(NoiseModuleUI.s_PreviewTexture);
                }
                NoiseModuleUI.s_PreviewTextureDirty = false;
            }
            if (!base.isWindowView)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
            }
            EditorGUI.BeginChangeCheck();
            bool flag  = ModuleUI.GUIToggle(NoiseModuleUI.s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);
            bool flag2 = EditorGUI.EndChangeCheck();

            EditorGUI.BeginChangeCheck();
            if (flag2)
            {
                if (flag)
                {
                    this.m_StrengthX.RemoveCurveFromEditor();
                    this.m_RemapX.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_StrengthX.RemoveCurveFromEditor();
                    this.m_StrengthY.RemoveCurveFromEditor();
                    this.m_StrengthZ.RemoveCurveFromEditor();
                    this.m_RemapX.RemoveCurveFromEditor();
                    this.m_RemapY.RemoveCurveFromEditor();
                    this.m_RemapZ.RemoveCurveFromEditor();
                }
            }
            if (!this.m_StrengthX.stateHasMultipleDifferentValues)
            {
                this.m_StrengthZ.SetMinMaxState(this.m_StrengthX.state, flag);
                this.m_StrengthY.SetMinMaxState(this.m_StrengthX.state, flag);
            }
            if (!this.m_RemapX.stateHasMultipleDifferentValues)
            {
                this.m_RemapZ.SetMinMaxState(this.m_RemapX.state, flag);
                this.m_RemapY.SetMinMaxState(this.m_RemapX.state, flag);
            }
            if (flag)
            {
                this.m_StrengthX.m_DisplayName = NoiseModuleUI.s_Texts.x;
                base.GUITripleMinMaxCurve(GUIContent.none, NoiseModuleUI.s_Texts.x, this.m_StrengthX, NoiseModuleUI.s_Texts.y, this.m_StrengthY, NoiseModuleUI.s_Texts.z, this.m_StrengthZ, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_StrengthX.m_DisplayName = NoiseModuleUI.s_Texts.strength;
                ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.strength, this.m_StrengthX, new GUILayoutOption[0]);
            }
            ModuleUI.GUIFloat(NoiseModuleUI.s_Texts.frequency, this.m_Frequency, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.scrollSpeed, this.m_ScrollSpeed, new GUILayoutOption[0]);
            ModuleUI.GUIToggle(NoiseModuleUI.s_Texts.damping, this.m_Damping, new GUILayoutOption[0]);
            int num = ModuleUI.GUIInt(NoiseModuleUI.s_Texts.octaves, this.m_Octaves, new GUILayoutOption[0]);

            using (new EditorGUI.DisabledScope(num == 1))
            {
                ModuleUI.GUIFloat(NoiseModuleUI.s_Texts.octaveMultiplier, this.m_OctaveMultiplier, new GUILayoutOption[0]);
                ModuleUI.GUIFloat(NoiseModuleUI.s_Texts.octaveScale, this.m_OctaveScale, new GUILayoutOption[0]);
            }
            ModuleUI.GUIPopup(NoiseModuleUI.s_Texts.quality, this.m_Quality, NoiseModuleUI.s_Texts.qualityDropdown, new GUILayoutOption[0]);
            bool flag3 = ModuleUI.GUIToggle(NoiseModuleUI.s_Texts.remap, this.m_RemapEnabled, new GUILayoutOption[0]);

            using (new EditorGUI.DisabledScope(!flag3))
            {
                if (flag)
                {
                    this.m_RemapX.m_DisplayName = NoiseModuleUI.s_Texts.x;
                    base.GUITripleMinMaxCurve(GUIContent.none, NoiseModuleUI.s_Texts.x, this.m_RemapX, NoiseModuleUI.s_Texts.y, this.m_RemapY, NoiseModuleUI.s_Texts.z, this.m_RemapZ, null, new GUILayoutOption[0]);
                }
                else
                {
                    this.m_RemapX.m_DisplayName = NoiseModuleUI.s_Texts.remap;
                    ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.remapCurve, this.m_RemapX, new GUILayoutOption[0]);
                }
            }
            ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.positionAmount, this.m_PositionAmount, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.rotationAmount, this.m_RotationAmount, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.sizeAmount, this.m_SizeAmount, new GUILayoutOption[0]);
            if (!base.isWindowView)
            {
                GUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck() || this.m_ScrollSpeed.scalar.floatValue != 0f || flag3 || flag2)
            {
                NoiseModuleUI.s_PreviewTextureDirty = true;
                this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner.Repaint();
            }
            if (this.m_ParticleSystemUI.multiEdit)
            {
                GUILayout.Label(NoiseModuleUI.s_Texts.previewTextureMultiEdit, this.previewTextureStyle, new GUILayoutOption[]
                {
                    GUILayout.ExpandWidth(true),
                    GUILayout.ExpandHeight(false)
                });
            }
            else
            {
                GUILayout.Label(NoiseModuleUI.s_Texts.previewTexture, this.previewTextureStyle, new GUILayoutOption[]
                {
                    GUILayout.ExpandWidth(true),
                    GUILayout.ExpandHeight(false)
                });
            }
            if (!base.isWindowView)
            {
                GUILayout.EndHorizontal();
            }
        }
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (NoiseModuleUI.s_Texts == null)
            {
                NoiseModuleUI.s_Texts = new NoiseModuleUI.Texts();
            }
            if (NoiseModuleUI.s_PreviewTextureDirty)
            {
                this.m_ParticleSystemUI.m_ParticleSystem.GenerateNoisePreviewTexture(NoiseModuleUI.s_PreviewTexture);
                NoiseModuleUI.s_PreviewTextureDirty = false;
            }
            bool flag = this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner is ParticleSystemInspector;

            if (flag)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
            }
            EditorGUI.BeginChangeCheck();
            bool flag2 = ModuleUI.GUIToggle(NoiseModuleUI.s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);
            bool flag3 = EditorGUI.EndChangeCheck();

            EditorGUI.BeginChangeCheck();
            if (flag3)
            {
                if (flag2)
                {
                    this.m_StrengthX.RemoveCurveFromEditor();
                    this.m_RemapX.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_StrengthX.RemoveCurveFromEditor();
                    this.m_StrengthY.RemoveCurveFromEditor();
                    this.m_StrengthZ.RemoveCurveFromEditor();
                    this.m_RemapX.RemoveCurveFromEditor();
                    this.m_RemapY.RemoveCurveFromEditor();
                    this.m_RemapZ.RemoveCurveFromEditor();
                }
            }
            SerializedMinMaxCurve arg_12D_0 = this.m_StrengthZ;
            MinMaxCurveState      state     = this.m_StrengthX.state;

            this.m_StrengthY.state = state;
            arg_12D_0.state        = state;
            SerializedMinMaxCurve arg_151_0 = this.m_RemapZ;

            state = this.m_RemapX.state;
            this.m_RemapY.state = state;
            arg_151_0.state     = state;
            if (flag2)
            {
                this.m_StrengthX.m_DisplayName = NoiseModuleUI.s_Texts.x;
                base.GUITripleMinMaxCurve(GUIContent.none, NoiseModuleUI.s_Texts.x, this.m_StrengthX, NoiseModuleUI.s_Texts.y, this.m_StrengthY, NoiseModuleUI.s_Texts.z, this.m_StrengthZ, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_StrengthX.m_DisplayName = NoiseModuleUI.s_Texts.strength;
                ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.strength, this.m_StrengthX, new GUILayoutOption[0]);
            }
            ModuleUI.GUIFloat(NoiseModuleUI.s_Texts.frequency, this.m_Frequency, new GUILayoutOption[0]);
            ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.scrollSpeed, this.m_ScrollSpeed, new GUILayoutOption[0]);
            ModuleUI.GUIToggle(NoiseModuleUI.s_Texts.damping, this.m_Damping, new GUILayoutOption[0]);
            int num = ModuleUI.GUIInt(NoiseModuleUI.s_Texts.octaves, this.m_Octaves, new GUILayoutOption[0]);

            using (new EditorGUI.DisabledScope(num == 1))
            {
                ModuleUI.GUIFloat(NoiseModuleUI.s_Texts.octaveMultiplier, this.m_OctaveMultiplier, new GUILayoutOption[0]);
                ModuleUI.GUIFloat(NoiseModuleUI.s_Texts.octaveScale, this.m_OctaveScale, new GUILayoutOption[0]);
            }
            ModuleUI.GUIPopup(NoiseModuleUI.s_Texts.quality, this.m_Quality, NoiseModuleUI.s_Texts.qualityDropdown, new GUILayoutOption[0]);
            bool flag4 = ModuleUI.GUIToggle(NoiseModuleUI.s_Texts.remap, this.m_RemapEnabled, new GUILayoutOption[0]);

            using (new EditorGUI.DisabledScope(!flag4))
            {
                if (flag2)
                {
                    this.m_RemapX.m_DisplayName = NoiseModuleUI.s_Texts.x;
                    base.GUITripleMinMaxCurve(GUIContent.none, NoiseModuleUI.s_Texts.x, this.m_RemapX, NoiseModuleUI.s_Texts.y, this.m_RemapY, NoiseModuleUI.s_Texts.z, this.m_RemapZ, null, new GUILayoutOption[0]);
                }
                else
                {
                    this.m_RemapX.m_DisplayName = NoiseModuleUI.s_Texts.remap;
                    ModuleUI.GUIMinMaxCurve(NoiseModuleUI.s_Texts.remapCurve, this.m_RemapX, new GUILayoutOption[0]);
                }
            }
            if (flag)
            {
                GUILayout.EndVertical();
            }
            if (EditorGUI.EndChangeCheck() || this.m_ScrollSpeed.scalar.floatValue > 0f || flag4 || flag3)
            {
                NoiseModuleUI.s_PreviewTextureDirty = true;
                this.m_ParticleSystemUI.m_ParticleEffectUI.m_Owner.Repaint();
            }
            GUILayout.Label(NoiseModuleUI.s_Texts.previewTexture, this.previewTextureStyle, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(false)
            });
            if (flag)
            {
                GUILayout.EndHorizontal();
            }
        }