Slider() public static method

Make a slider the user can drag to change a value between a min and a max.

public static Slider ( GUIContent label, float value, float leftValue, float rightValue ) : float
label UnityEngine.GUIContent Optional label in front of the slider.
value float The value the slider shows. This determines the position of the draggable thumb.
leftValue float The value at the left end of the slider.
rightValue float The value at the right end of the slider.
return float
    void OnGUI()
    {
        EGL.LabelField("Generated texture", EditorStyles.boldLabel);

        EGL.LabelField("Show channels:");
        EGL.BeginHorizontal();
        _c[3] = GUILayout.Toggle(_c[3], "A");
        EG.BeginDisabledGroup(_c[3]);
        _c[0] = GUILayout.Toggle(_c[0], "R");
        _c[1] = GUILayout.Toggle(_c[1], "G");
        _c[2] = GUILayout.Toggle(_c[2], "B");
        EG.EndDisabledGroup();
        EGL.EndHorizontal();

        EGL.LabelField("Zoom");
        zoom = EGL.Slider(zoom, 0.2f, 3f);

        EGL.LabelField("Slice");
        slice = EGL.Slider(slice, 0f, 1f);

        Rect r_tex = EGL.BeginVertical(GUILayout.ExpandHeight(true));

        r_tex.height = r_tex.width = Mathf.Min(r_tex.height, r_tex.width);
        if (texture)
        {
            previewMaterial.SetFloat("_Zoom", zoom);
            previewMaterial.SetFloat("_Slice", slice);
            previewMaterial.SetVector("_Channels", ChannelVector());
            EG.DrawPreviewTexture(r_tex, texture, previewMaterial);
        }
        EGL.EndVertical();
    }
    private void ShowScaleInformation()
    {
        field.scaleUsesRange = EGL.Toggle(new GUIContent("Scale uses range?", "Whether the asteroids spawned should pick a scale from a specified range."), field.scaleUsesRange);

        if (field.scaleUsesRange)
        {
            field.asteroidLowerScale = EGL.Slider("Lower range", field.asteroidLowerScale, 0, 20);
            field.asteroidUpperScale = EGL.Slider("Upper range", field.asteroidUpperScale, field.asteroidLowerScale, field.asteroidLowerScale + 20);
        }

        else
        {
            field.asteroidScaleMultiplier = EGL.Slider("Scale Multiplier", field.asteroidScaleMultiplier, 0, 20);
        }
    }
    void ShowTerrainSettings()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;
        TerrainConfiguration    terrainStreamingConfiguration = importCfg.TerrainConfiguration;

        EGL.BeginVertical();
        {
            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                if (GUILayout.Button("Apply to selected TerrainData assets"))
                {
                    QueueCall(editorUtilities.ApplyDimensionsToSelection);
                }
            }
            EGL.EndVertical();

            EGL.Separator();

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("In-game terrain LOD settings.");
                terrainStreamingConfiguration.HeightmapPixelError = EGL.Slider("Pixel Error", terrainStreamingConfiguration.HeightmapPixelError, 1f, 200f);
                terrainStreamingConfiguration.BasemapDistance     = EGL.FloatField("Basemap Dist.", terrainStreamingConfiguration.BasemapDistance);
                terrainStreamingConfiguration.CastShadows         = EGL.Toggle("Cast Shadows", terrainStreamingConfiguration.CastShadows);
                EGL.Separator();
                terrainStreamingConfiguration.DetailObjectDistance    = EGL.Slider("Detail Distance", terrainStreamingConfiguration.DetailObjectDistance, 0f, 250f);
                terrainStreamingConfiguration.DetailObjectDensity     = EGL.Slider("Detail Density", terrainStreamingConfiguration.DetailObjectDensity, 0f, 1f);
                terrainStreamingConfiguration.TreeDistance            = EGL.Slider("Tree Distance", terrainStreamingConfiguration.TreeDistance, 0f, 2000f);
                terrainStreamingConfiguration.TreeBillboardDistance   = EGL.Slider("Billboard Start", terrainStreamingConfiguration.TreeBillboardDistance, 50f, 2000f);
                terrainStreamingConfiguration.TreeCrossFadeLength     = EGL.Slider("Fade Length", terrainStreamingConfiguration.TreeCrossFadeLength, 0f, 200f);
                terrainStreamingConfiguration.TreeMaximumFullLODCount = EGL.IntSlider("Max Mesh Trees", terrainStreamingConfiguration.TreeMaximumFullLODCount, 0, 500);
                EGL.Separator();

                if (GUILayout.Button("Apply to selected Scene assets"))
                {
                    QueueCall(editorUtilities.ApplyTerrainLODSettingsToSelection);
                }
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EGL.Space();

        AsteroidField field = (AsteroidField)target;

        field.AsteroidGameObject = (GameObject)EGL.ObjectField(new GUIContent("Asteroid Game Object", "The game object that represents the spawned asteroids"), field.AsteroidGameObject, typeof(GameObject), false);

        field.InnerRadius = EGL.FloatField(new GUIContent("Inner Radius", "The inner radius of the field"), field.InnerRadius);
        field.OuterRadius = EGL.Slider("Outer Radius", field.OuterRadius, field.InnerRadius, 10000 + field.InnerRadius);

        EGL.Space();

        scaleUsesRange = EGL.Toggle(new GUIContent("Scale uses range?", "Whether the asteroids spawned should pick a scale from a specified range."), scaleUsesRange);

        if (scaleUsesRange)
        {
            field.AsteroidLowerScale = EGL.Slider("Lower range", field.AsteroidLowerScale, 0, 20);
            field.AsteroidUpperScale = EGL.Slider("Upper range", field.AsteroidUpperScale, field.AsteroidLowerScale, field.AsteroidLowerScale + 20);
        }

        else
        {
            field.AsteroidScale = EGL.Slider("Scale", field.AsteroidScale, 0, 20);
        }

        using (new EditorGUI.DisabledScope(field.AsteroidGameObject == null))
        {
            if (GUILayout.Button("Generate Field"))
            {
                field.GenerateField(scaleUsesRange);
            }
        }

        if (GUILayout.Button("Clear Field"))
        {
            field.ClearField();
        }
    }
示例#5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        var engine = target as Engine;

        if (Application.isPlaying == false)
        {
            return;
        }

        EGL.LabelField("Speed: " + engine.Speed);

        EGL.Space();
        ShowButtons(engine);
        EGL.Space();

        EGL.LabelField("Pitch: " + engine.Pitch);
        EGL.LabelField("Yaw: " + engine.Yaw);
        EGL.LabelField("Roll: " + engine.Roll);

        engine.Strafe   = EGL.Slider("Strafe", engine.Strafe, -1, 1);
        engine.Throttle = EGL.Slider("Throttle", engine.Throttle, 0, 1);
    }
示例#6
0
    void showRoadMapGUI()
    {
        EG.BeginDisabledGroup(!(terrainGenerated && growthMapGenerated && populationGenerated));
        showRoadMapUI = EGL.Foldout(showRoadMapUI, roadmapLabel, true);
        if (showRoadMapUI)
        {
            GL.Label("Streets", EditorStyles.centeredGreyMiniLabel);
            GL.BeginHorizontal();
            GL.BeginVertical();
            GL.Label("Width");
            GL.Label("Min Length");
            GL.Label("LookAhead");
            GL.Label("Pop Threshold");
            GL.Label("Max Slope");
            GL.EndVertical();
            GL.BeginVertical();
            CG.streetWidth        = EGL.IntSlider(CG.streetWidth, 5, 20);
            CG.streetMinLength    = EGL.Slider(CG.streetMinLength, 5f, 100f);
            CG.streetLookAhead    = EGL.IntSlider(CG.streetLookAhead, 1, (int)(CG.terrainSize / CG.streetMinLength));
            CG.streetPopThreshold = EGL.Slider(CG.streetPopThreshold, 0f, 1f);
            CG.streetMaxSlope     = EGL.Slider(CG.streetMaxSlope, 0f, 1f);
            GL.EndVertical();
            GL.EndHorizontal();

            GL.Space(5);

            GL.Label("Highways", EditorStyles.centeredGreyMiniLabel);
            GL.BeginHorizontal();
            GL.BeginVertical();
            GL.Label("Width");
            GL.Label("Min Length");
            GL.Label("LookAhead");
            GL.Label("Pop Threshold");
            GL.Label("Max Slope");
            GL.EndVertical();
            GL.BeginVertical();
            CG.highwayWidth        = EGL.IntSlider(CG.highwayWidth, 10, 25);
            CG.highwayMinLength    = EGL.Slider(CG.highwayMinLength, 5f, 200f);
            CG.highwayLookAhead    = EGL.IntSlider(CG.highwayLookAhead, 1, (int)(CG.terrainSize / CG.highwayMinLength));
            CG.highwayPopThreshold = EGL.Slider(CG.highwayPopThreshold, 0f, 1f);
            CG.highwayMaxSlope     = EGL.Slider(CG.highwayMaxSlope, 0f, 1f);
            GL.EndVertical();
            GL.EndHorizontal();

            GL.Space(10);

            showRoadMapAdvanced = EGL.Foldout(showRoadMapAdvanced, "Advanced Settings", true);
            if (showRoadMapAdvanced)
            {
                EGL.HelpBox("Adjusting these settings might break the Editor or severely influence performance.", MessageType.Warning);
                GL.Label("General Advanced Settings", EditorStyles.centeredGreyMiniLabel);
                GL.BeginHorizontal();
                GL.BeginVertical();
                GL.Label("Legalization Attempts");
                GL.Label("Min Road Correction Angle");
                GL.Label("Node Check Radius");
                GL.Label("Road Connect Max Distance");
                GL.Label("Ray Count");
                GL.EndVertical();
                GL.BeginVertical();
                CG.legalizationAttempts = EGL.IntSlider(CG.legalizationAttempts, 1, 100);
                CG.minRoadAngle         = EGL.IntSlider(CG.minRoadAngle, 0, 90);
                CG.nodeCheckRadius      = EGL.Slider(CG.nodeCheckRadius, 0f, 100f);
                CG.roadConnectDistance  = EGL.Slider(CG.roadConnectDistance, 0f, 100f);
                CG.rayCount             = EGL.IntSlider(CG.rayCount, 1, 32);
                GL.EndVertical();
                GL.EndHorizontal();

                GL.Label("Advanced Settings for L-system Component", EditorStyles.centeredGreyMiniLabel);
                EGL.HelpBox("Low values correspond to higher priority.", MessageType.Info);
                GL.BeginHorizontal();
                GL.BeginVertical();
                GL.Label("Street - Priority");
                GL.Label("Highway - Priority");
                GL.EndVertical();
                GL.BeginVertical();
                CG.streetPriority  = EGL.IntSlider(CG.streetPriority, 1, 5);
                CG.highwayPriority = EGL.IntSlider(CG.highwayPriority, 1, 5);
                GL.EndVertical();
                GL.EndHorizontal();

                GL.Label("Advanced Settings for Growth Rules", EditorStyles.centeredGreyMiniLabel);
                GL.BeginHorizontal();
                GL.BeginVertical();
                GL.Label("Street - Straight Angle");
                GL.Label("Street - Branch  Angle");
                GL.Space(10);
                GL.Label("Highway - Branch Prob");
                GL.Label("Highway - Straight Angle");
                GL.Label("Highway - Branch Angle");
                GL.EndVertical();
                GL.BeginVertical();
                CG.streetStraightAngle = EGL.Slider(CG.streetStraightAngle, 0f, 90f);
                CG.streetBranchAngle   = EGL.Slider(CG.streetBranchAngle, 0f, 90f);
                GL.Space(10);
                CG.highwayBranchProb    = EGL.Slider(CG.highwayBranchProb, 0f, 1f);
                CG.highwayStraightAngle = EGL.Slider(CG.highwayStraightAngle, 0f, 90f);
                CG.highwayBranchAngle   = EGL.Slider(CG.highwayBranchAngle, 0f, 90f);
                GL.EndVertical();
                GL.EndHorizontal();
            }
            if (roadMapGenerated)
            {
                GL.BeginHorizontal("Box");
                GL.FlexibleSpace();
                CG.showPop = EGL.ToggleLeft("Preview Pop Map", CG.showPop);
                GL.FlexibleSpace();
                CG.showGrowth = EGL.ToggleLeft("Preview Growth Map", CG.showGrowth);
                GL.FlexibleSpace();
                GL.EndHorizontal();

                if (DebugMode)
                {
                    showPreviewGUI();
                }
            }
            EGL.HelpBox("The 'Generate Road Map' button may take several tries to generate road map due to the random nature of the algorithm.", MessageType.Info);
            GL.BeginHorizontal();
            if (GL.Button("Generate Road Map"))
            {
                GameObject roadMap = GameObject.Find("RoadMap");
                GameObject nodes   = GameObject.Find("Nodes");


                if (roadMap != null)
                {
                    roadMap.SetActive(true);
                }
                if (nodes != null)
                {
                    nodes.SetActive(true);
                }
                generator.generateRoadMap();
                roadMapGenerated  = true;
                roadMeshGenerated = false;
            }

            EG.BeginDisabledGroup(!roadMapGenerated);
            if (GL.Button("Generate Road Meshes & Blocks"))
            {
                generator.generateRoadMeshes();
                generator.generateBlocks();
                roadMeshGenerated = true;
            }
            EG.EndDisabledGroup();
            GL.EndHorizontal();

            EG.BeginDisabledGroup(!roadMeshGenerated);
            if (GL.Button("Save and Proceed"))
            {
                showRoadMapUI       = false;
                showRoadMapAdvanced = false;
                showBuildingUI      = true;
                GameObject roadMap = GameObject.Find("RoadMap");
                if (roadMap != null)
                {
                    roadMap.SetActive(false);
                }
                GameObject nodes = GameObject.Find("Nodes");
                if (nodes != null)
                {
                    nodes.SetActive(false);
                }
                roadmapLabel = "4. Road Map Generation - COMPLETED ✔";
            }
            EG.EndDisabledGroup();
        }
        EG.EndDisabledGroup();
    }
        private void NormalsAndTangentsGUI()
        {
            GUILayout.Label(ModelImporterModelEditor.styles.TangentSpace, EditorStyles.boldLabel, new GUILayoutOption[0]);
            bool flag = true;

            UnityEngine.Object[] targets = base.targets;
            for (int i = 0; i < targets.Length; i++)
            {
                ModelImporter modelImporter = (ModelImporter)targets[i];
                if (!modelImporter.isTangentImportSupported)
                {
                    flag = false;
                }
            }
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Popup(this.m_NormalImportMode, ModelImporterModelEditor.styles.NormalModeLabelsAll, ModelImporterModelEditor.styles.TangentSpaceNormalLabel, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                if (this.m_NormalImportMode.intValue == 2)
                {
                    this.m_TangentImportMode.intValue = 2;
                }
                else if (this.m_NormalImportMode.intValue == 0 && flag)
                {
                    this.m_TangentImportMode.intValue = 0;
                }
                else
                {
                    this.m_TangentImportMode.intValue = 3;
                }
            }
            using (new EditorGUI.DisabledScope(this.m_NormalImportMode.intValue != 1))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.Slider(this.m_NormalSmoothAngle, 0f, 180f, ModelImporterModelEditor.styles.SmoothingAngle, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    this.m_NormalSmoothAngle.floatValue = Mathf.Round(this.m_NormalSmoothAngle.floatValue);
                }
            }
            GUIContent[]            displayedOptions = ModelImporterModelEditor.styles.TangentSpaceModeOptLabelsAll;
            ModelImporterTangents[] array            = ModelImporterModelEditor.styles.TangentSpaceModeOptEnumsAll;
            if (this.m_NormalImportMode.intValue == 1 || !flag)
            {
                displayedOptions = ModelImporterModelEditor.styles.TangentSpaceModeOptLabelsCalculate;
                array            = ModelImporterModelEditor.styles.TangentSpaceModeOptEnumsCalculate;
            }
            else if (this.m_NormalImportMode.intValue == 2)
            {
                displayedOptions = ModelImporterModelEditor.styles.TangentSpaceModeOptLabelsNone;
                array            = ModelImporterModelEditor.styles.TangentSpaceModeOptEnumsNone;
            }
            using (new EditorGUI.DisabledScope(this.m_NormalImportMode.intValue == 2))
            {
                int num = Array.IndexOf <ModelImporterTangents>(array, (ModelImporterTangents)this.m_TangentImportMode.intValue);
                EditorGUI.BeginChangeCheck();
                num = EditorGUILayout.Popup(ModelImporterModelEditor.styles.TangentSpaceTangentLabel, num, displayedOptions, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    this.m_TangentImportMode.intValue = (int)array[num];
                }
            }
        }
示例#8
0
 private static float MyStaticCustomDrawerStatic(float value, GUIContent label)
 {
     return(EditorGUILayout.Slider(label, value, 0f, 10f));
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // realtime settings
            if (SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime))
            {
                GUILayout.Label(Styles.precomputedRealtimeGIContent, EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(m_Resolution, Styles.resolutionContent);
                EditorGUILayout.Slider(m_ClusterResolution, 0.1F, 1.0F, Styles.clusterResolutionContent);
                EditorGUILayout.IntSlider(m_IrradianceBudget, 32, 2048, Styles.irradianceBudgetContent);
                EditorGUILayout.IntSlider(m_IrradianceQuality, 512, 131072, Styles.irradianceQualityContent);
                EditorGUILayout.Slider(m_ModellingTolerance, 0.0f, 1.0f, Styles.modellingToleranceContent);
                EditorGUILayout.PropertyField(m_EdgeStitching, Styles.edgeStitchingContent);
                EditorGUILayout.PropertyField(m_IsTransparent, Styles.isTransparent);
                EditorGUILayout.PropertyField(m_SystemTag, Styles.systemTagContent);
                EditorGUILayout.Space();
            }

            // baked settings
            #pragma warning disable 618
            bool usesPathTracerBakeBackend = Lightmapping.GetLightingSettingsOrDefaultsFallback().lightmapper != LightingSettings.Lightmapper.Enlighten;
            bool usesEnlightenBackend      = Lightmapping.GetLightingSettingsOrDefaultsFallback().lightmapper == LightingSettings.Lightmapper.Enlighten;
            bool bakedEnlightenSupported   = SupportedRenderingFeatures.IsLightmapperSupported((int)LightingSettings.Lightmapper.Enlighten);
            #pragma warning restore 618

            GUILayout.Label(Styles.bakedGIContent, EditorStyles.boldLabel);

            if (bakedEnlightenSupported)
            {
                using (new EditorGUI.DisabledScope(usesPathTracerBakeBackend))
                {
                    EditorGUILayout.PropertyField(m_BlurRadius, Styles.blurRadiusContent);
                    EditorGUILayout.PropertyField(m_DirectLightQuality, Styles.directLightQualityContent);
                }
            }

            EditorGUILayout.PropertyField(m_AntiAliasingSamples, Styles.antiAliasingSamplesContent);
            const float minPushOff = 0.0001f; // Keep in sync with PLM_MIN_PUSHOFF
            EditorGUILayout.Slider(m_Pushoff, minPushOff, 1.0f, Styles.pushoffContent);
            EditorGUILayout.PropertyField(m_BakedLightmapTag, Styles.bakedLightmapTagContent);
            using (new EditorGUI.DisabledScope(usesEnlightenBackend))
            {
                m_LimitLightmapCount.boolValue = EditorGUILayout.Toggle(Styles.limitLightmapCount, m_LimitLightmapCount.boolValue);
                if (m_LimitLightmapCount.boolValue)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(m_LightmapMaxCount, Styles.lightmapMaxCount);
                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.Space();

            if (bakedEnlightenSupported)
            {
                using (new EditorGUI.DisabledScope(usesPathTracerBakeBackend))
                {
                    GUILayout.Label(Styles.bakedAOContent, EditorStyles.boldLabel);
                    EditorGUILayout.PropertyField(m_AOQuality, Styles.aoQualityContent);
                    EditorGUILayout.PropertyField(m_AOAntiAliasingSamples, Styles.aoAntiAliasingSamplesContent);
                }
            }

            GUILayout.Label(Styles.generalGIContent, EditorStyles.boldLabel);
            EditorGUILayout.Slider(m_BackFaceTolerance, 0.0f, 1.0f, Styles.backFaceToleranceContent);

            serializedObject.ApplyModifiedProperties();
        }
        private void DrawGUI()
        {
            if (m_RenderSettings == null || m_RenderSettings.targetObject != RenderSettings.GetRenderSettings())
            {
                InitSettings();
            }

            Material skyboxMaterial = m_SkyboxMaterial.objectReferenceValue as Material;

            m_bShowEnvironment = EditorGUILayout.FoldoutTitlebar(m_bShowEnvironment, Styles.env_top, true);

            if (m_bShowEnvironment)
            {
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_SkyboxMaterial, Styles.env_skybox_mat);
                if (skyboxMaterial && !EditorMaterialUtility.IsBackgroundMaterial(skyboxMaterial))
                {
                    EditorGUILayout.HelpBox(Styles.skyboxWarning.text, MessageType.Warning);
                }

                EditorGUILayout.PropertyField(m_Sun, Styles.env_skybox_sun);
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_amb_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.IntPopup(m_AmbientSource, Styles.kFullAmbientSource, Styles.kFullAmbientSourceValues, Styles.env_amb_src);
                switch ((AmbientMode)m_AmbientSource.intValue)
                {
                case AmbientMode.Trilight:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValueUp   = EditorGUILayout.ColorField(Styles.ambientUp, m_AmbientSkyColor.colorValue, true, false, true);
                    Color newValueMid  = EditorGUILayout.ColorField(Styles.ambientMid, m_AmbientEquatorColor.colorValue, true, false, true);
                    Color newValueDown = EditorGUILayout.ColorField(Styles.ambientDown, m_AmbientGroundColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue     = newValueUp;
                        m_AmbientEquatorColor.colorValue = newValueMid;
                        m_AmbientGroundColor.colorValue  = newValueDown;
                    }
                }
                break;

                case AmbientMode.Flat:
                {
                    EditorGUI.BeginChangeCheck();
                    Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_AmbientSkyColor.colorValue = newValue;
                    }
                }
                break;

                case AmbientMode.Skybox:
                    if (skyboxMaterial == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        Color newValue = EditorGUILayout.ColorField(Styles.ambient, m_AmbientSkyColor.colorValue, true, false, true);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_AmbientSkyColor.colorValue = newValue;
                        }
                    }
                    else
                    {
                        // Ambient intensity - maximum is kEmissiveRGBMMax
                        EditorGUILayout.Slider(m_AmbientIntensity, 0.0F, 8.0F, Styles.env_amb_int);
                    }
                    break;
                }

                // ambient GI - realtime / baked
                bool realtimeGISupported = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Realtime);
                bool bakedGISupported    = SupportedRenderingFeatures.IsLightmapBakeTypeSupported(LightmapBakeType.Baked);

                if ((m_EnabledBakedGI.boolValue || m_EnabledRealtimeGI.boolValue) && (bakedGISupported || realtimeGISupported))
                {
                    int[] modeVals = { 0, 1 };

                    if (m_EnabledBakedGI.boolValue && m_EnabledRealtimeGI.boolValue)
                    {
                        // if the user has selected the only state that is supported, then gray it out
                        using (new EditorGUI.DisabledScope(((m_AmbientLightingMode.intValue == 0) && realtimeGISupported && !bakedGISupported) || ((m_AmbientLightingMode.intValue == 1) && bakedGISupported && !realtimeGISupported)))
                        {
                            EditorGUILayout.IntPopup(m_AmbientLightingMode, Styles.AmbientLightingModes, modeVals, Styles.AmbientLightingMode);
                        }

                        // if they have selected a state that isnt supported, show dialog, and still make the box editable
                        if (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ||
                            ((m_AmbientLightingMode.intValue == 1) && !bakedGISupported))
                        {
                            EditorGUILayout.HelpBox("The following mode is not supported and will fallback on " + (((m_AmbientLightingMode.intValue == 0) && !realtimeGISupported) ? "Baked" : "Realtime"), MessageType.Warning);
                        }
                    }
                    // Show "Baked" if precomputed GI is disabled and "Realtime" if baked GI is disabled (but we don't wanna show the box if the whole mode is not supported.)
                    else if ((m_EnabledBakedGI.boolValue && bakedGISupported) || (m_EnabledRealtimeGI.boolValue && realtimeGISupported))
                    {
                        using (new EditorGUI.DisabledScope(true))
                        {
                            EditorGUILayout.IntPopup(Styles.AmbientLightingMode, m_EnabledBakedGI.boolValue ? 1 : 0, Styles.AmbientLightingModes, modeVals);
                        }
                    }
                }

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();

                EditorGUILayout.LabelField(Styles.env_refl_top);
                EditorGUI.indentLevel++;

                EditorGUILayout.PropertyField(m_DefaultReflectionMode, Styles.env_refl_src);

                DefaultReflectionMode defReflectionMode = (DefaultReflectionMode)m_DefaultReflectionMode.intValue;
                switch (defReflectionMode)
                {
                case DefaultReflectionMode.FromSkybox:
                {
                    int[]        reflectionResolutionValuesArray = null;
                    GUIContent[] reflectionResolutionTextArray   = null;
                    ReflectionProbeEditor.GetResolutionArray(ref reflectionResolutionValuesArray, ref reflectionResolutionTextArray);
                    EditorGUILayout.IntPopup(m_DefaultReflectionResolution, reflectionResolutionTextArray, reflectionResolutionValuesArray, Styles.env_refl_res, GUILayout.MinWidth(40));
                }
                break;

                case DefaultReflectionMode.Custom:
                    EditorGUILayout.PropertyField(m_CustomReflection, Styles.customReflection);
                    break;
                }

                EditorGUILayout.PropertyField(m_ReflectionCompression, Styles.env_refl_cmp);
                EditorGUILayout.Slider(m_ReflectionIntensity, 0.0F, 1.0F, Styles.env_refl_int);
                EditorGUILayout.IntSlider(m_ReflectionBounces, 1, 5, Styles.env_refl_bnc);

                EditorGUI.indentLevel--;

                EditorGUI.indentLevel--;
                EditorGUILayout.Space();
            }
        }
        private void Audio3DGUI()
        {
            EditorGUILayout.Slider(m_DopplerLevel, 0.0f, 5.0f, Styles.dopplerLevelLabel);

            // Spread control
            AnimProp(Styles.spreadLabel, m_AudioCurves[kSpreadCurveID].curveProp, 0.0f, 360.0f, true);

            // Rolloff mode
            if (m_RolloffMode.hasMultipleDifferentValues ||
                (m_RolloffMode.enumValueIndex == (int)AudioRolloffMode.Custom && m_AudioCurves[kRolloffCurveID].curveProp.hasMultipleDifferentValues)
                )
            {
                EditorGUILayout.TargetChoiceField(m_AudioCurves[kRolloffCurveID].curveProp, Styles.rolloffLabel, SetRolloffToTarget);
            }
            else
            {
                EditorGUILayout.PropertyField(m_RolloffMode, Styles.rolloffLabel);

                if ((AudioRolloffMode)m_RolloffMode.enumValueIndex != AudioRolloffMode.Custom)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(m_MinDistance);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_MinDistance.floatValue = Mathf.Clamp(m_MinDistance.floatValue, 0, m_MaxDistance.floatValue / 1.01f);
                    }
                }
                else
                {
                    using (new EditorGUI.DisabledScope(true))
                    {
                        EditorGUILayout.LabelField(m_MinDistance.displayName, Styles.controlledByCurveLabel);
                    }
                }
            }

            // Max distance control
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(m_MaxDistance);
            if (EditorGUI.EndChangeCheck())
            {
                m_MaxDistance.floatValue = Mathf.Min(Mathf.Max(Mathf.Max(m_MaxDistance.floatValue, 0.01f), m_MinDistance.floatValue * 1.01f), 1000000.0f);
            }

            Rect r = GUILayoutUtility.GetAspectRect(1.333f, GUI.skin.textField);

            r.xMin += EditorGUI.indent;
            if (Event.current.type != EventType.Layout && Event.current.type != EventType.Used)
            {
                m_CurveEditor.rect = new Rect(r.x, r.y, r.width, r.height);
            }

            // Draw Curve Editor
            UpdateWrappersAndLegend();
            GUI.Label(m_CurveEditor.drawRect, GUIContent.none, "TextField");

            m_CurveEditor.hRangeLocked = Event.current.shift;
            m_CurveEditor.vRangeLocked = EditorGUI.actionKey;

            m_CurveEditor.OnGUI();

            // Draw current listener position
            if (targets.Length == 1)
            {
                AudioSource   t             = (AudioSource)target;
                AudioListener audioListener = (AudioListener)FindObjectOfType(typeof(AudioListener));
                if (audioListener != null)
                {
                    float distToListener = (AudioUtil.GetListenerPos() - t.transform.position).magnitude;
                    DrawLabel("Listener", distToListener, r);
                }
            }

            // Draw legend
            DrawLegend();

            if (!m_CurveEditor.InLiveEdit())
            {
                // Check if any of the curves changed
                foreach (AudioCurveWrapper audioCurve in m_AudioCurves)
                {
                    if ((m_CurveEditor.GetCurveWrapperFromID(audioCurve.id) != null) && (m_CurveEditor.GetCurveWrapperFromID(audioCurve.id).changed))
                    {
                        AnimationCurve changedCurve = m_CurveEditor.GetCurveWrapperFromID(audioCurve.id).curve;

                        // Never save a curve with no keys
                        if (changedCurve.length > 0)
                        {
                            audioCurve.curveProp.animationCurveValue = changedCurve;
                            m_CurveEditor.GetCurveWrapperFromID(audioCurve.id).changed = false;

                            // Volume curve special handling
                            if (audioCurve.type == AudioCurveType.Volume)
                            {
                                m_RolloffMode.enumValueIndex = (int)AudioRolloffMode.Custom;
                            }
                        }
                    }
                }
            }
        }
示例#12
0
        public override void OnInspectorGUI()
        {
            AudioSourceInspector.InitStyles();
            base.serializedObject.Update();
            if (this.m_LowpassObject != null)
            {
                this.m_LowpassObject.Update();
            }
            this.HandleLowPassFilter();
            AudioSourceInspector.AudioCurveWrapper[] audioCurves = this.m_AudioCurves;
            for (int i = 0; i < audioCurves.Length; i++)
            {
                AudioSourceInspector.AudioCurveWrapper audioCurveWrapper = audioCurves[i];
                CurveWrapper curveWrapperById = this.m_CurveEditor.getCurveWrapperById(audioCurveWrapper.id);
                if (audioCurveWrapper.curveProp != null)
                {
                    AnimationCurve animationCurveValue = audioCurveWrapper.curveProp.animationCurveValue;
                    if (curveWrapperById == null != audioCurveWrapper.curveProp.hasMultipleDifferentValues)
                    {
                        this.m_RefreshCurveEditor = true;
                    }
                    else if (curveWrapperById != null)
                    {
                        if (curveWrapperById.curve.length == 0)
                        {
                            this.m_RefreshCurveEditor = true;
                        }
                        else if (animationCurveValue.length >= 1 && animationCurveValue.keys[0].value != curveWrapperById.curve.keys[0].value)
                        {
                            this.m_RefreshCurveEditor = true;
                        }
                    }
                }
                else if (curveWrapperById != null)
                {
                    this.m_RefreshCurveEditor = true;
                }
            }
            this.UpdateWrappersAndLegend();
            EditorGUILayout.PropertyField(this.m_AudioClip, AudioSourceInspector.ms_Styles.audioClipLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_OutputAudioMixerGroup, AudioSourceInspector.ms_Styles.outputMixerGroupLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Mute, new GUILayoutOption[0]);
            if (AudioUtil.canUseSpatializerEffect)
            {
                EditorGUILayout.PropertyField(this.m_Spatialize, new GUILayoutOption[0]);
            }
            EditorGUILayout.PropertyField(this.m_BypassEffects, new GUILayoutOption[0]);
            bool flag = base.targets.Any((UnityEngine.Object t) => (t as AudioSource).outputAudioMixerGroup != null);

            if (flag)
            {
                EditorGUI.BeginDisabledGroup(true);
            }
            EditorGUILayout.PropertyField(this.m_BypassListenerEffects, new GUILayoutOption[0]);
            if (flag)
            {
                EditorGUI.EndDisabledGroup();
            }
            EditorGUILayout.PropertyField(this.m_BypassReverbZones, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_PlayOnAwake, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Loop, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUIUtility.sliderLabels.SetLabels(AudioSourceInspector.ms_Styles.priorityLeftLabel, AudioSourceInspector.ms_Styles.priorityRightLabel);
            EditorGUILayout.IntSlider(this.m_Priority, 0, 256, AudioSourceInspector.ms_Styles.priorityLabel, new GUILayoutOption[0]);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(this.m_Volume, 0f, 1f, AudioSourceInspector.ms_Styles.volumeLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(this.m_Pitch, -3f, 3f, AudioSourceInspector.ms_Styles.pitchLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUIUtility.sliderLabels.SetLabels(AudioSourceInspector.ms_Styles.panLeftLabel, AudioSourceInspector.ms_Styles.panRightLabel);
            EditorGUILayout.Slider(this.m_Pan2D, -1f, 1f, AudioSourceInspector.ms_Styles.panStereoLabel, new GUILayoutOption[0]);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();
            EditorGUIUtility.sliderLabels.SetLabels(AudioSourceInspector.ms_Styles.spatialLeftLabel, AudioSourceInspector.ms_Styles.spatialRightLabel);
            AudioSourceInspector.AnimProp(AudioSourceInspector.ms_Styles.spatialBlendLabel, this.m_AudioCurves[1].curveProp, 0f, 1f, false);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();
            AudioSourceInspector.AnimProp(AudioSourceInspector.ms_Styles.reverbZoneMixLabel, this.m_AudioCurves[4].curveProp, 0f, 1.1f, false);
            EditorGUILayout.Space();
            this.m_Expanded3D = EditorGUILayout.Foldout(this.m_Expanded3D, "3D Sound Settings");
            if (this.m_Expanded3D)
            {
                EditorGUI.indentLevel++;
                this.Audio3DGUI();
                EditorGUI.indentLevel--;
            }
            base.serializedObject.ApplyModifiedProperties();
            if (this.m_LowpassObject != null)
            {
                this.m_LowpassObject.ApplyModifiedProperties();
            }
        }
示例#13
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Camera camera = (Camera)base.target;

            this.m_ShowBGColorOptions.target  = (!this.m_ClearFlags.hasMultipleDifferentValues && (camera.clearFlags == CameraClearFlags.Color || camera.clearFlags == CameraClearFlags.Skybox));
            this.m_ShowOrthoOptions.target    = (!this.m_Orthographic.hasMultipleDifferentValues && camera.orthographic);
            this.m_ShowTargetEyeOption.target = (this.m_TargetEye.intValue != 3 || PlayerSettings.virtualRealitySupported);
            EditorGUILayout.PropertyField(this.m_ClearFlags, new GUILayoutOption[0]);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType = (!this.m_Orthographic.boolValue) ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            projectionType           = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", projectionType, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = (projectionType == CameraEditor.ProjectionType.Orthographic);
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth, new GUILayoutOption[0]);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            if (this.m_ShowOrthoOptions.target && this.wantDeferredRendering)
            {
                EditorGUILayout.HelpBox("Deferred rendering does not work with Orthographic camera, will use Forward.", MessageType.Warning, true);
            }
            EditorGUILayout.PropertyField(this.m_TargetTexture, new GUILayoutOption[0]);
            if (!this.m_TargetTexture.hasMultipleDifferentValues)
            {
                RenderTexture renderTexture = this.m_TargetTexture.objectReferenceValue as RenderTexture;
                if (renderTexture && renderTexture.antiAliasing > 1 && this.wantDeferredRendering)
                {
                    EditorGUILayout.HelpBox("Manual MSAA target set with deferred rendering. This will lead to undefined behavior.", MessageType.Warning, true);
                }
            }
            EditorGUILayout.PropertyField(this.m_OcclusionCulling, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_HDR, EditorGUIUtility.TempContent("Allow HDR"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AllowMSAA, new GUILayoutOption[0]);
            this.DisplayCameraWarnings();
            if (PlayerSettings.virtualRealitySupported)
            {
                EditorGUILayout.PropertyField(this.m_StereoSeparation, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_StereoConvergence, new GUILayoutOption[0]);
            }
            if (this.ShouldShowTargetDisplayProperty())
            {
                int intValue = this.m_TargetDisplay.intValue;
                EditorGUILayout.Space();
                EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
                if (intValue != this.m_TargetDisplay.intValue)
                {
                    GameView.RepaintAll();
                }
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetEyeOption.faded))
            {
                EditorGUILayout.IntPopup(this.m_TargetEye, CameraEditor.kTargetEyes, CameraEditor.kTargetEyeValues, EditorGUIUtility.TempContent("Target Eye"), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            base.serializedObject.ApplyModifiedProperties();
        }
        private void BakeSettings()
        {
            EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            Rect controlRect = EditorGUILayout.GetControlRect(false, 120f, new GUILayoutOption[0]);

            this.DrawAgentDiagram(controlRect, this.m_AgentRadius.floatValue, this.m_AgentHeight.floatValue, this.m_AgentClimb.floatValue, this.m_AgentSlope.floatValue);
            float num = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentRadiusContent, this.m_AgentRadius.floatValue, new GUILayoutOption[0]);

            if (num >= 0.001f && !Mathf.Approximately(num - this.m_AgentRadius.floatValue, 0f))
            {
                this.m_AgentRadius.floatValue = num;
                if (!this.m_ManualCellSize.boolValue)
                {
                    this.m_CellSize.floatValue = 2f * this.m_AgentRadius.floatValue / 6f;
                }
            }
            if (this.m_AgentRadius.floatValue < 0.05f && !this.m_ManualCellSize.boolValue)
            {
                EditorGUILayout.HelpBox("The agent radius you've set is really small, this can slow down the build.\nIf you intended to allow the agent to move close to the borders and walls, please adjust voxel size in advaced settings to ensure correct bake.", MessageType.Warning);
            }
            float num2 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentHeightContent, this.m_AgentHeight.floatValue, new GUILayoutOption[0]);

            if (num2 >= 0.001f && !Mathf.Approximately(num2 - this.m_AgentHeight.floatValue, 0f))
            {
                this.m_AgentHeight.floatValue = num2;
            }
            EditorGUILayout.Slider(this.m_AgentSlope, 0f, 60f, NavMeshEditorWindow.s_Styles.m_AgentSlopeContent, new GUILayoutOption[0]);
            if (this.m_AgentSlope.floatValue > 60f)
            {
                EditorGUILayout.HelpBox("The maximum slope should be set to less than " + 60f + " degrees to prevent NavMesh build artifacts on slopes. ", MessageType.Warning);
            }
            float num3 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentClimbContent, this.m_AgentClimb.floatValue, new GUILayoutOption[0]);

            if (num3 >= 0f && !Mathf.Approximately(this.m_AgentClimb.floatValue - num3, 0f))
            {
                this.m_AgentClimb.floatValue = num3;
            }
            if (this.m_AgentClimb.floatValue >= this.m_AgentHeight.floatValue)
            {
                EditorGUILayout.HelpBox("Step height should be less than agent height.\nClamping step height to " + this.m_AgentHeight.floatValue + ".", MessageType.Warning);
            }
            float floatValue = this.m_CellSize.floatValue;
            float num4       = floatValue * 0.5f;
            int   num5       = (int)Mathf.Ceil(this.m_AgentClimb.floatValue / num4);
            float num6       = Mathf.Tan(this.m_AgentSlope.floatValue / 180f * 3.14159274f) * floatValue;
            int   num7       = (int)Mathf.Ceil(num6 * 2f / num4);

            if (num7 > num5)
            {
                float f    = (float)num5 * num4 / (floatValue * 2f);
                float num8 = Mathf.Atan(f) / 3.14159274f * 180f;
                float num9 = (float)(num7 - 1) * num4;
                EditorGUILayout.HelpBox(string.Concat(new string[]
                {
                    "Step Height conflicts with Max Slope. This makes some slopes unwalkable.\nConsider decreasing Max Slope to < ",
                    num8.ToString("0.0"),
                    " degrees.\nOr, increase Step Height to > ",
                    num9.ToString("0.00"),
                    "."
                }), MessageType.Warning);
            }
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_OffmeshHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            bool flag = !InternalEditorUtility.HasProFeaturesEnabled();

            if (flag)
            {
                EditorGUILayout.HelpBox("This is only available in the Pro version of Unity.", MessageType.Warning);
                if (this.m_LedgeDropHeight.floatValue != 0f)
                {
                    this.m_LedgeDropHeight.floatValue = 0f;
                }
                if (this.m_MaxJumpAcrossDistance.floatValue != 0f)
                {
                    this.m_MaxJumpAcrossDistance.floatValue = 0f;
                }
                GUI.enabled = false;
            }
            float num10 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentDropContent, this.m_LedgeDropHeight.floatValue, new GUILayoutOption[0]);

            if (num10 >= 0f && !Mathf.Approximately(num10 - this.m_LedgeDropHeight.floatValue, 0f))
            {
                this.m_LedgeDropHeight.floatValue = num10;
            }
            float num11 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentJumpContent, this.m_MaxJumpAcrossDistance.floatValue, new GUILayoutOption[0]);

            if (num11 >= 0f && !Mathf.Approximately(num11 - this.m_MaxJumpAcrossDistance.floatValue, 0f))
            {
                this.m_MaxJumpAcrossDistance.floatValue = num11;
            }
            if (flag)
            {
                GUI.enabled = true;
            }
            EditorGUILayout.Space();
            this.m_Advanced = GUILayout.Toggle(this.m_Advanced, NavMeshEditorWindow.s_Styles.m_AdvancedHeader, EditorStyles.foldout, new GUILayoutOption[0]);
            if (this.m_Advanced)
            {
                EditorGUI.indentLevel++;
                bool flag2 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_ManualCellSizeContent, this.m_ManualCellSize.boolValue, new GUILayoutOption[0]);
                if (flag2 != this.m_ManualCellSize.boolValue)
                {
                    this.m_ManualCellSize.boolValue = flag2;
                    if (!flag2)
                    {
                        this.m_CellSize.floatValue = 2f * this.m_AgentRadius.floatValue / 6f;
                    }
                }
                EditorGUI.BeginDisabledGroup(!this.m_ManualCellSize.boolValue);
                EditorGUI.indentLevel++;
                float num12 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_CellSizeContent, this.m_CellSize.floatValue, new GUILayoutOption[0]);
                if (num12 > 0f && !Mathf.Approximately(num12 - this.m_CellSize.floatValue, 0f))
                {
                    this.m_CellSize.floatValue = Math.Max(0.01f, num12);
                }
                if (num12 < 0.01f)
                {
                    EditorGUILayout.HelpBox("The voxel size should be larger than 0.01.", MessageType.Warning);
                }
                float num13 = (this.m_CellSize.floatValue <= 0f) ? 0f : (this.m_AgentRadius.floatValue / this.m_CellSize.floatValue);
                EditorGUILayout.LabelField(" ", num13.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel, new GUILayoutOption[0]);
                if (this.m_ManualCellSize.boolValue)
                {
                    float num14 = this.m_CellSize.floatValue * 0.5f;
                    if ((int)Mathf.Floor(this.m_AgentHeight.floatValue / num14) > 250)
                    {
                        EditorGUILayout.HelpBox("The number of voxels per agent height is too high. This will reduce the accuracy of the navmesh. Consider using voxel size of at least " + (this.m_AgentHeight.floatValue / 250f / 0.5f).ToString("0.000") + ".", MessageType.Warning);
                    }
                    if (num13 < 1f)
                    {
                        EditorGUILayout.HelpBox("The number of voxels per agent radius is too small. The agent may not avoid walls and ledges properly. Consider using voxel size of at least " + (this.m_AgentRadius.floatValue / 2f).ToString("0.000") + " (2 voxels per agent radius).", MessageType.Warning);
                    }
                    else
                    {
                        if (num13 > 8f)
                        {
                            EditorGUILayout.HelpBox("The number of voxels per agent radius is too high. It can cause excessive build times. Consider using voxel size closer to " + (this.m_AgentRadius.floatValue / 8f).ToString("0.000") + " (8 voxels per radius).", MessageType.Warning);
                        }
                    }
                }
                if (this.m_ManualCellSize.boolValue)
                {
                    EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None);
                }
                EditorGUI.indentLevel--;
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.Space();
                float num15 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_MinRegionAreaContent, this.m_MinRegionArea.floatValue, new GUILayoutOption[0]);
                if (num15 >= 0f && num15 != this.m_MinRegionArea.floatValue)
                {
                    this.m_MinRegionArea.floatValue = num15;
                }
                EditorGUILayout.Space();
                bool flag3 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_AgentPlacementContent, this.m_AccuratePlacement.boolValue, new GUILayoutOption[0]);
                if (flag3 != this.m_AccuratePlacement.boolValue)
                {
                    this.m_AccuratePlacement.boolValue = flag3;
                }
                EditorGUI.indentLevel--;
            }
        }
        void NormalsTangentsGUI()
        {
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.hasMultipleDifferentValues;
            var legacyComputeFromSmoothingGroups = EditorGUILayout.Toggle(Styles.LegacyComputeNormalsFromSmoothingGroupsWhenMeshHasBlendShapes, m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.boolValue);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.boolValue = legacyComputeFromSmoothingGroups;
            }

            using (var horizontal = new EditorGUILayout.HorizontalScope())
            {
                using (var property = new EditorGUI.PropertyScope(horizontal.rect, Styles.NormalsLabel, m_NormalImportMode))
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.showMixedValue = m_NormalImportMode.hasMultipleDifferentValues;
                    var newValue = (int)(ModelImporterNormals)EditorGUILayout.EnumPopup(property.content, (ModelImporterNormals)m_NormalImportMode.intValue);
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_NormalImportMode.intValue = newValue;
                        // This check is made in CheckConsistency, but because AssetImporterEditor does not serialize the object each update,
                        // We need to double check here for UI consistency.
                        if (m_NormalImportMode.intValue == (int)ModelImporterNormals.None)
                        {
                            m_TangentImportMode.intValue = (int)ModelImporterTangents.None;
                        }
                        else if (m_NormalImportMode.intValue == (int)ModelImporterNormals.Calculate && m_TangentImportMode.intValue == (int)ModelImporterTangents.Import)
                        {
                            m_TangentImportMode.intValue = (int)ModelImporterTangents.CalculateMikk;
                        }


                        // Also make the blendshape normal mode follow normal mode, with the exception that we never
                        // select Import automatically (since we can't trust imported normals to be correct, and we
                        // also can't detect when they're not).
                        if (m_NormalImportMode.intValue == (int)ModelImporterNormals.None)
                        {
                            m_BlendShapeNormalCalculationMode.intValue = (int)ModelImporterNormals.None;
                        }
                        else
                        {
                            m_BlendShapeNormalCalculationMode.intValue = (int)ModelImporterNormals.Calculate;
                        }
                    }
                }
            }

            if (!m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.boolValue && m_ImportBlendShapes.boolValue && !m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.hasMultipleDifferentValues)
            {
                using (new EditorGUI.DisabledScope(m_NormalImportMode.intValue == (int)ModelImporterNormals.None))
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUI.showMixedValue = m_BlendShapeNormalCalculationMode.hasMultipleDifferentValues;
                    var blendShapeNormalCalculationMode = (int)(ModelImporterNormals)EditorGUILayout.EnumPopup(Styles.BlendShapeNormalsLabel, (ModelImporterNormals)m_BlendShapeNormalCalculationMode.intValue);
                    EditorGUI.showMixedValue = false;
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_BlendShapeNormalCalculationMode.intValue = blendShapeNormalCalculationMode;
                    }
                }
            }

            if (m_NormalImportMode.intValue != (int)ModelImporterNormals.None || m_BlendShapeNormalCalculationMode.intValue != (int)ModelImporterNormals.None)
            {
                // Normal calculation mode
                using (var horizontal = new EditorGUILayout.HorizontalScope())
                {
                    using (var property = new EditorGUI.PropertyScope(horizontal.rect, Styles.RecalculateNormalsLabel, m_NormalCalculationMode))
                    {
                        EditorGUI.BeginChangeCheck();
                        EditorGUI.showMixedValue = m_NormalCalculationMode.hasMultipleDifferentValues;
                        var normalCalculationMode = (int)(ModelImporterNormalCalculationMode)EditorGUILayout.EnumPopup(property.content, (ModelImporterNormalCalculationMode)m_NormalCalculationMode.intValue);
                        EditorGUI.showMixedValue = false;
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_NormalCalculationMode.intValue = normalCalculationMode;
                        }
                    }
                }

                // Normal smoothness
                if (!m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.boolValue)
                {
                    using (var horizontal = new EditorGUILayout.HorizontalScope())
                        using (var property = new EditorGUI.PropertyScope(horizontal.rect, Styles.NormalSmoothingSourceLabel, m_NormalSmoothingSource))
                        {
                            EditorGUI.BeginChangeCheck();
                            EditorGUI.showMixedValue = m_NormalSmoothingSource.hasMultipleDifferentValues;
                            var normalSmoothingSource = (int)(ModelImporterNormalSmoothingSource)EditorGUILayout.EnumPopup(property.content, (ModelImporterNormalSmoothingSource)m_NormalSmoothingSource.intValue);
                            EditorGUI.showMixedValue = false;
                            if (EditorGUI.EndChangeCheck())
                            {
                                m_NormalSmoothingSource.intValue = normalSmoothingSource;
                            }
                        }
                }

                // Normal split angle
                if (m_LegacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes.boolValue || m_NormalSmoothingSource.intValue == (int)ModelImporterNormalSmoothingSource.PreferSmoothingGroups || m_NormalSmoothingSource.intValue == (int)ModelImporterNormalSmoothingSource.FromAngle)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.Slider(m_NormalSmoothAngle, 0, 180, Styles.SmoothingAngle);

                    // Property is serialized as float but we want to show it as an int so we round the value when changed
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_NormalSmoothAngle.floatValue = Mathf.Round(m_NormalSmoothAngle.floatValue);
                    }
                }
            }

            // Choose the option values and labels based on what the NormalImportMode is
            if (m_NormalImportMode.intValue != (int)ModelImporterNormals.None)
            {
                using (var horizontal = new EditorGUILayout.HorizontalScope())
                {
                    using (var property = new EditorGUI.PropertyScope(horizontal.rect, Styles.TangentsLabel, m_TangentImportMode))
                    {
                        EditorGUI.BeginChangeCheck();
                        var newValue = (int)(ModelImporterTangents)EditorGUILayout.EnumPopup(property.content, (ModelImporterTangents)m_TangentImportMode.intValue, TangentModeAvailabilityCheck, false);
                        if (EditorGUI.EndChangeCheck())
                        {
                            m_TangentImportMode.intValue = newValue;
                        }
                    }
                }
            }
        }
 private void ShowLODGUI()
 {
     this.m_ShowSmoothLODOptions.target      = (this.m_EnableSmoothLOD.hasMultipleDifferentValues || this.m_EnableSmoothLOD.boolValue);
     this.m_ShowCrossFadeWidthOptions.target = (this.m_AnimateCrossFading.hasMultipleDifferentValues || !this.m_AnimateCrossFading.boolValue);
     GUILayout.Label(SpeedTreeImporterInspector.Styles.LODHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_EnableSmoothLOD, SpeedTreeImporterInspector.Styles.SmoothLOD, new GUILayoutOption[0]);
     EditorGUI.indentLevel++;
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowSmoothLODOptions.faded))
     {
         EditorGUILayout.PropertyField(this.m_AnimateCrossFading, SpeedTreeImporterInspector.Styles.AnimateCrossFading, new GUILayoutOption[0]);
         if (EditorGUILayout.BeginFadeGroup(this.m_ShowCrossFadeWidthOptions.faded))
         {
             EditorGUILayout.Slider(this.m_BillboardTransitionCrossFadeWidth, 0f, 1f, SpeedTreeImporterInspector.Styles.CrossFadeWidth, new GUILayoutOption[0]);
             EditorGUILayout.Slider(this.m_FadeOutWidth, 0f, 1f, SpeedTreeImporterInspector.Styles.FadeOutWidth, new GUILayoutOption[0]);
         }
         EditorGUILayout.EndFadeGroup();
     }
     EditorGUILayout.EndFadeGroup();
     EditorGUI.indentLevel--;
     EditorGUILayout.Space();
     if (this.HasSameLODConfig())
     {
         EditorGUILayout.Space();
         Rect rect = GUILayoutUtility.GetRect(0f, 30f, new GUILayoutOption[]
         {
             GUILayout.ExpandWidth(true)
         });
         List <LODGroupGUI.LODInfo> lODInfoArray = this.GetLODInfoArray(rect);
         this.DrawLODLevelSlider(rect, lODInfoArray);
         EditorGUILayout.Space();
         EditorGUILayout.Space();
         if (this.m_SelectedLODRange != -1 && lODInfoArray.Count > 0)
         {
             EditorGUILayout.LabelField(lODInfoArray[this.m_SelectedLODRange].LODName + " Options", EditorStyles.boldLabel, new GUILayoutOption[0]);
             bool flag = this.m_SelectedLODRange == lODInfoArray.Count - 1 && this.importers[0].hasBillboard;
             EditorGUILayout.PropertyField(this.m_LODSettings.GetArrayElementAtIndex(this.m_SelectedLODRange).FindPropertyRelative("castShadows"), SpeedTreeImporterInspector.Styles.CastShadows, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_LODSettings.GetArrayElementAtIndex(this.m_SelectedLODRange).FindPropertyRelative("receiveShadows"), SpeedTreeImporterInspector.Styles.ReceiveShadows, new GUILayoutOption[0]);
             SerializedProperty serializedProperty = this.m_LODSettings.GetArrayElementAtIndex(this.m_SelectedLODRange).FindPropertyRelative("useLightProbes");
             EditorGUILayout.PropertyField(serializedProperty, SpeedTreeImporterInspector.Styles.UseLightProbes, new GUILayoutOption[0]);
             if (!serializedProperty.hasMultipleDifferentValues && serializedProperty.boolValue && flag)
             {
                 EditorGUILayout.HelpBox("Enabling Light Probe for billboards breaks batched rendering and may cause performance problem.", MessageType.Warning);
             }
             EditorGUILayout.PropertyField(this.m_LODSettings.GetArrayElementAtIndex(this.m_SelectedLODRange).FindPropertyRelative("enableBump"), SpeedTreeImporterInspector.Styles.EnableBump, new GUILayoutOption[0]);
             EditorGUILayout.PropertyField(this.m_LODSettings.GetArrayElementAtIndex(this.m_SelectedLODRange).FindPropertyRelative("enableHue"), SpeedTreeImporterInspector.Styles.EnableHue, new GUILayoutOption[0]);
             int num = this.importers.Min((SpeedTreeImporter im) => im.bestWindQuality);
             if (num > 0)
             {
                 if (flag)
                 {
                     num = ((num < 1) ? 0 : 1);
                 }
                 EditorGUILayout.Popup(this.m_LODSettings.GetArrayElementAtIndex(this.m_SelectedLODRange).FindPropertyRelative("windQuality"), (from s in SpeedTreeImporter.windQualityNames.Take(num + 1)
                                                                                                                                                select new GUIContent(s)).ToArray <GUIContent>(), SpeedTreeImporterInspector.Styles.WindQuality, new GUILayoutOption[0]);
             }
         }
     }
     else
     {
         if (this.CanUnifyLODConfig())
         {
             EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
             GUILayout.FlexibleSpace();
             Rect rect2 = GUILayoutUtility.GetRect(SpeedTreeImporterInspector.Styles.ResetLOD, EditorStyles.miniButton);
             if (GUI.Button(rect2, SpeedTreeImporterInspector.Styles.ResetLOD, EditorStyles.miniButton))
             {
                 GenericMenu genericMenu = new GenericMenu();
                 foreach (SpeedTreeImporter current in base.targets.Cast <SpeedTreeImporter>())
                 {
                     string text = string.Format("{0}: {1}", Path.GetFileNameWithoutExtension(current.assetPath), string.Join(" | ", (from height in current.LODHeights
                                                                                                                                      select string.Format("{0:0}%", height * 100f)).ToArray <string>()));
                     genericMenu.AddItem(new GUIContent(text), false, new GenericMenu.MenuFunction2(this.OnResetLODMenuClick), current);
                 }
                 genericMenu.DropDown(rect2);
             }
             EditorGUILayout.EndHorizontal();
         }
         Rect rect3 = GUILayoutUtility.GetRect(0f, 30f, new GUILayoutOption[]
         {
             GUILayout.ExpandWidth(true)
         });
         if (Event.current.type == EventType.Repaint)
         {
             LODGroupGUI.DrawMixedValueLODSlider(rect3);
         }
     }
     EditorGUILayout.Space();
 }
示例#17
0
 public override void OnPaintInspectorGUI()
 {
     brush.m_Color = EditorGUILayout.ColorField("Color", brush.m_Color);
     brush.m_Blend = EditorGUILayout.Slider("Blend", brush.m_Blend, 0f, 1f);
     GUILayout.Label("Note: Tilemap needs to use TintedTilemap.shader!");
 }
示例#18
0
        void OnGUI()
        {
            var dirtyCount = PhysicsVisualizationSettings.dirtyCount;

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Reset", EditorStyles.toolbarButton))
            {
                PhysicsVisualizationSettings.Reset();
            }

            EditorGUILayout.EndHorizontal();

            m_MainScrollPos = GUILayout.BeginScrollView(m_MainScrollPos);

            {
                EditorGUILayout.Space();
                m_ShowInfoFoldout.value = EditorGUILayout.Foldout(m_ShowInfoFoldout.value, Style.selectedObjectInfo);
                if (m_ShowInfoFoldout.value)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.Space();
                    EditorGUI.BeginDisabledGroup(true);
                    var transforms = Selection.transforms;
                    if (transforms.Length > 0)
                    {
                        foreach (var tr in transforms)
                        {
                            EditorGUILayout.TextField(Style.gameObject, tr.name);
                            EditorGUILayout.TextField(Style.scene, tr.gameObject.scene.name);
                        }
                    }
                    EditorGUI.EndDisabledGroup();
                    Repaint();
                    EditorGUI.indentLevel--;
                }
            }
            GUILayout.Space(4);

            int           sceneCount = SceneManager.sceneCount;
            List <string> options    = new List <string>();

            for (int i = 0; i < sceneCount; ++i)
            {
                var scene = SceneManager.GetSceneAt(i);
                options.Add(string.Format("{0} ", scene.name));
            }

            int newPhysicsSceneMask = EditorGUILayout.MaskField(Style.showPhysicsScenes, PhysicsVisualizationSettings.GetShowPhysicsSceneMask(), options.ToArray());

            PhysicsVisualizationSettings.SetShowPhysicsSceneMask(newPhysicsSceneMask);

            // Layers
            int oldConcatenatedMask = InternalEditorUtility.LayerMaskToConcatenatedLayersMask(
                PhysicsVisualizationSettings.GetShowCollisionLayerMask());

            int newConcatenatedMask = EditorGUILayout.MaskField(
                Style.showLayers, oldConcatenatedMask, InternalEditorUtility.layers);

            PhysicsVisualizationSettings.SetShowCollisionLayerMask(
                (int)InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(newConcatenatedMask));

            // Static Colliders
            PhysicsVisualizationSettings.SetShowStaticColliders(EditorGUILayout.Toggle(
                                                                    Style.showStaticCollider, PhysicsVisualizationSettings.GetShowStaticColliders()));

            // Triggers
            PhysicsVisualizationSettings.SetShowTriggers(EditorGUILayout.Toggle(
                                                             Style.showTriggers, PhysicsVisualizationSettings.GetShowTriggers()));

            // Rigidbodies
            PhysicsVisualizationSettings.SetShowRigidbodies(EditorGUILayout.Toggle(
                                                                Style.showRigibodies, PhysicsVisualizationSettings.GetShowRigidbodies()));

            // Kinematic Bodies
            PhysicsVisualizationSettings.SetShowKinematicBodies(EditorGUILayout.Toggle(
                                                                    Style.showKinematicBodies, PhysicsVisualizationSettings.GetShowKinematicBodies()));

            // Sleeping Bodies
            PhysicsVisualizationSettings.SetShowSleepingBodies(EditorGUILayout.Toggle(
                                                                   Style.showSleepingBodies, PhysicsVisualizationSettings.GetShowSleepingBodies()));

            m_ShowColliderTypeFoldout.value = EditorGUILayout.Foldout(m_ShowColliderTypeFoldout.value, Style.colliderTypes);
            if (m_ShowColliderTypeFoldout.value)
            {
                EditorGUI.indentLevel++;
                float oldWidth = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 200;

                // BoxCollider
                PhysicsVisualizationSettings.SetShowBoxColliders(EditorGUILayout.Toggle(
                                                                     Style.showBoxCollider, PhysicsVisualizationSettings.GetShowBoxColliders()));

                // SphereCollider
                PhysicsVisualizationSettings.SetShowSphereColliders(EditorGUILayout.Toggle(
                                                                        Style.showSphereCollider, PhysicsVisualizationSettings.GetShowSphereColliders()));

                // CapsuleCollider
                PhysicsVisualizationSettings.SetShowCapsuleColliders(EditorGUILayout.Toggle(
                                                                         Style.showCapsuleCollider, PhysicsVisualizationSettings.GetShowCapsuleColliders()));

                // MeshCollider convex
                PhysicsVisualizationSettings.SetShowMeshColliders(PhysicsVisualizationSettings.MeshColliderType.Convex, EditorGUILayout.Toggle(
                                                                      Style.showConvexMeshCollider, PhysicsVisualizationSettings.GetShowMeshColliders(PhysicsVisualizationSettings.MeshColliderType.Convex)));

                // MeshCollider non-convex
                PhysicsVisualizationSettings.SetShowMeshColliders(PhysicsVisualizationSettings.MeshColliderType.NonConvex, EditorGUILayout.Toggle(
                                                                      Style.showConcaveMeshCollider, PhysicsVisualizationSettings.GetShowMeshColliders(PhysicsVisualizationSettings.MeshColliderType.NonConvex)));

                // TerrainCollider
                PhysicsVisualizationSettings.SetShowTerrainColliders(EditorGUILayout.Toggle(
                                                                         Style.showTerrainCollider, PhysicsVisualizationSettings.GetShowTerrainColliders()));

                EditorGUIUtility.labelWidth = oldWidth;
                EditorGUI.indentLevel--;
            }

            GUILayout.Space(4);

            // Selection buttons
            GUILayout.BeginHorizontal();

            bool selectNone = GUILayout.Button(Style.showNone);
            bool selectAll  = GUILayout.Button(Style.showAll);

            if (selectNone || selectAll)
            {
                PhysicsVisualizationSettings.SetShowForAllFilters(selectAll);
            }

            GUILayout.EndHorizontal();

            m_ColorFoldout.value = EditorGUILayout.Foldout(m_ColorFoldout.value, Style.colors);
            if (m_ColorFoldout.value)
            {
                EditorGUI.indentLevel++;

                PhysicsVisualizationSettings.staticColor =
                    EditorGUILayout.ColorField(Style.staticColor, PhysicsVisualizationSettings.staticColor);

                PhysicsVisualizationSettings.triggerColor =
                    EditorGUILayout.ColorField(Style.triggerColor, PhysicsVisualizationSettings.triggerColor);

                PhysicsVisualizationSettings.rigidbodyColor =
                    EditorGUILayout.ColorField(Style.rigidbodyColor, PhysicsVisualizationSettings.rigidbodyColor);

                PhysicsVisualizationSettings.kinematicColor =
                    EditorGUILayout.ColorField(Style.kinematicColor, PhysicsVisualizationSettings.kinematicColor);

                PhysicsVisualizationSettings.sleepingBodyColor =
                    EditorGUILayout.ColorField(Style.sleepingBodyColor, PhysicsVisualizationSettings.sleepingBodyColor);

                PhysicsVisualizationSettings.colorVariance =
                    EditorGUILayout.Slider(Style.colorVariaition, PhysicsVisualizationSettings.colorVariance, 0f, 1f);

                EditorGUI.indentLevel--;
            }

            m_RenderingFoldout.value = EditorGUILayout.Foldout(m_RenderingFoldout.value, Style.rendering);
            if (m_RenderingFoldout.value)
            {
                EditorGUI.indentLevel++;

                PhysicsVisualizationSettings.baseAlpha = 1f - EditorGUILayout.Slider(Style.transparency
                                                                                     , 1f - PhysicsVisualizationSettings.baseAlpha, 0f, 1f);

                PhysicsVisualizationSettings.forceOverdraw = EditorGUILayout.Toggle(Style.forceOverdraw
                                                                                    , PhysicsVisualizationSettings.forceOverdraw);

                PhysicsVisualizationSettings.viewDistance = EditorGUILayout.FloatField(Style.viewDistance
                                                                                       , PhysicsVisualizationSettings.viewDistance);

                PhysicsVisualizationSettings.terrainTilesMax = EditorGUILayout.IntField(Style.terrainTilesMax
                                                                                        , PhysicsVisualizationSettings.terrainTilesMax);

                EditorGUI.indentLevel--;
            }

            if (Unsupported.IsDeveloperMode() || PhysicsVisualizationSettings.devOptions)
            {
                PhysicsVisualizationSettings.devOptions = EditorGUILayout.Toggle(Style.devOptions
                                                                                 , PhysicsVisualizationSettings.devOptions);
            }

            if (PhysicsVisualizationSettings.devOptions)
            {
                PhysicsVisualizationSettings.dotAlpha = EditorGUILayout.Slider(Style.dotAlpha
                                                                               , PhysicsVisualizationSettings.dotAlpha, -1f, 1f);

                PhysicsVisualizationSettings.forceDot = EditorGUILayout.Toggle(Style.forceDot
                                                                               , PhysicsVisualizationSettings.forceDot);

                Tools.hidden = EditorGUILayout.Toggle(Style.toolsHidden
                                                      , Tools.hidden);
            }

            GUILayout.EndScrollView();

            if (dirtyCount != PhysicsVisualizationSettings.dirtyCount)
            {
                RepaintSceneAndGameViews();
            }
        }
示例#19
0
 private float MyStaticCustomDrawerArray(float value, GUIContent label)
 {
     return(EditorGUILayout.Slider(value, this.Min, this.Max));
 }
示例#20
0
        private void Audio3DGUI()
        {
            EditorGUILayout.Slider(this.m_DopplerLevel, 0f, 5f, AudioSourceInspector.ms_Styles.dopplerLevelLabel, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            AudioSourceInspector.AnimProp(AudioSourceInspector.ms_Styles.spreadLabel, this.m_AudioCurves[2].curveProp, 0f, 360f, true);
            if (this.m_RolloffMode.hasMultipleDifferentValues || (this.m_RolloffMode.enumValueIndex == 2 && this.m_AudioCurves[0].curveProp.hasMultipleDifferentValues))
            {
                EditorGUILayout.TargetChoiceField(this.m_AudioCurves[0].curveProp, AudioSourceInspector.ms_Styles.rolloffLabel, new TargetChoiceHandler.TargetChoiceMenuFunction(AudioSourceInspector.SetRolloffToTarget), new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.PropertyField(this.m_RolloffMode, AudioSourceInspector.ms_Styles.rolloffLabel, new GUILayoutOption[0]);
                if (this.m_RolloffMode.enumValueIndex != 2)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(this.m_MinDistance, new GUILayoutOption[0]);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_MinDistance.floatValue = Mathf.Clamp(this.m_MinDistance.floatValue, 0f, this.m_MaxDistance.floatValue / 1.01f);
                    }
                }
                else
                {
                    EditorGUI.BeginDisabledGroup(true);
                    EditorGUILayout.LabelField(this.m_MinDistance.displayName, AudioSourceInspector.ms_Styles.controlledByCurveLabel, new GUILayoutOption[0]);
                    EditorGUI.EndDisabledGroup();
                }
            }
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(this.m_MaxDistance, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_MaxDistance.floatValue = Mathf.Min(Mathf.Max(Mathf.Max(this.m_MaxDistance.floatValue, 0.01f), this.m_MinDistance.floatValue * 1.01f), 1000000f);
            }
            if (EditorGUI.EndChangeCheck())
            {
                this.m_RefreshCurveEditor = true;
            }
            Rect aspectRect = GUILayoutUtility.GetAspectRect(1.333f, GUI.skin.textField);

            aspectRect.xMin += EditorGUI.indent;
            if (Event.current.type != EventType.Layout && Event.current.type != EventType.Used)
            {
                this.m_CurveEditor.rect = new Rect(aspectRect.x, aspectRect.y, aspectRect.width, aspectRect.height);
            }
            this.UpdateWrappersAndLegend();
            GUI.Label(this.m_CurveEditor.drawRect, GUIContent.none, "TextField");
            this.m_CurveEditor.hRangeLocked = Event.current.shift;
            this.m_CurveEditor.vRangeLocked = EditorGUI.actionKey;
            this.m_CurveEditor.OnGUI();
            if (base.targets.Length == 1)
            {
                AudioSource   audioSource = (AudioSource)this.target;
                AudioListener x           = (AudioListener)UnityEngine.Object.FindObjectOfType(typeof(AudioListener));
                if (x != null)
                {
                    float magnitude = (AudioUtil.GetListenerPos() - audioSource.transform.position).magnitude;
                    this.DrawLabel("Listener", magnitude, aspectRect);
                }
            }
            this.DrawLegend();
            AudioSourceInspector.AudioCurveWrapper[] audioCurves = this.m_AudioCurves;
            for (int i = 0; i < audioCurves.Length; i++)
            {
                AudioSourceInspector.AudioCurveWrapper audioCurveWrapper = audioCurves[i];
                if (this.m_CurveEditor.getCurveWrapperById(audioCurveWrapper.id) != null && this.m_CurveEditor.getCurveWrapperById(audioCurveWrapper.id).changed)
                {
                    AnimationCurve curve = this.m_CurveEditor.getCurveWrapperById(audioCurveWrapper.id).curve;
                    if (curve.length > 0)
                    {
                        audioCurveWrapper.curveProp.animationCurveValue = curve;
                        this.m_CurveEditor.getCurveWrapperById(audioCurveWrapper.id).changed = false;
                        if (audioCurveWrapper.type == AudioSourceInspector.AudioCurveType.Volume)
                        {
                            this.m_RolloffMode.enumValueIndex = 2;
                        }
                    }
                }
            }
        }
 private void ShowRadiusInfromation()
 {
     field.innerRadius = EGL.FloatField(new GUIContent("Inner Radius", "The inner radius of the field"), field.innerRadius);
     field.outerRadius = EGL.Slider("Outer Radius", field.outerRadius, field.innerRadius, 10000 + field.innerRadius);
 }
        void Draw()
        {
            var settings = m_SceneView.cameraSettings;

            m_Scroll = GUILayout.BeginScrollView(m_Scroll);

            GUILayout.BeginVertical(Styles.settingsArea);
            EditorGUI.BeginChangeCheck();

            GUILayout.Space(k_HeaderSpacing);

            GUILayout.BeginHorizontal();
            GUILayout.Label(m_SceneCameraLabel, EditorStyles.boldLabel);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(EditorGUI.GUIContents.titleSettingsIcon, EditorStyles.iconButton))
            {
                ShowContextMenu(m_SceneView);
            }
            GUILayout.EndHorizontal();

            EditorGUIUtility.labelWidth = kPrefixLabelWidth;

            // fov isn't applicable in orthographic mode, and orthographic size is controlled by the user zoom
            using (new EditorGUI.DisabledScope(m_SceneView.orthographic))
            {
                settings.fieldOfView = EditorGUILayout.Slider(m_FieldOfView, settings.fieldOfView, k_MinFieldOfView, k_MaxFieldOfView);
            }

            settings.dynamicClip = EditorGUILayout.Toggle(m_DynamicClip, settings.dynamicClip);

            using (new EditorGUI.DisabledScope(settings.dynamicClip))
            {
                float near = settings.nearClip, far = settings.farClip;
                DrawClipPlanesField(EditorGUI.s_ClipingPlanesLabel, ref near, ref far, EditorGUI.kNearFarLabelsWidth);
                settings.SetClipPlanes(near, far);
            }

            settings.occlusionCulling = EditorGUILayout.Toggle(m_OcclusionCulling, settings.occlusionCulling);

            if (EditorGUI.EndChangeCheck())
            {
                m_SceneView.Repaint();
            }

            EditorGUILayout.Space(k_HeaderSpacing);

            GUILayout.Label(m_NavigationLabel, EditorStyles.boldLabel);

            settings.easingEnabled       = EditorGUILayout.Toggle(m_EasingEnabled, settings.easingEnabled);
            settings.accelerationEnabled = EditorGUILayout.Toggle(m_AccelerationEnabled, settings.accelerationEnabled);

            EditorGUI.BeginChangeCheck();
            float min = settings.speedMin, max = settings.speedMax, speed = settings.RoundSpeedToNearestSignificantDecimal(settings.speed);

            speed = EditorGUILayout.Slider(m_CameraSpeedSliderContent, speed, min, max);
            if (EditorGUI.EndChangeCheck())
            {
                settings.speed = settings.RoundSpeedToNearestSignificantDecimal(speed);
            }

            EditorGUI.BeginChangeCheck();

            m_Vector2Floats[0] = settings.speedMin;
            m_Vector2Floats[1] = settings.speedMax;

            DrawSpeedMinMaxFields();

            if (EditorGUI.EndChangeCheck())
            {
                settings.SetSpeedMinMax(m_Vector2Floats);
            }

            EditorGUIUtility.labelWidth = 0f;

            if (additionalSettingsGui != null)
            {
                EditorGUILayout.Space(k_HeaderSpacing);
                additionalSettingsGui(m_SceneView);
            }

            if (Event.current.type == EventType.Repaint)
            {
                m_WindowSize.y = Math.Min(GUILayoutUtility.GetLastRect().yMax + kContentPadding, kWindowHeight * 3);
            }

            GUILayout.EndVertical();
            GUILayout.EndScrollView();
        }
        private void BuiltinCustomSplashScreenGUI()
        {
            EditorGUILayout.LabelField(k_Texts.splashTitle, EditorStyles.boldLabel);

            using (new EditorGUI.DisabledScope(!licenseAllowsDisabling))
            {
                EditorGUILayout.PropertyField(m_ShowUnitySplashScreen, k_Texts.showSplash);
                if (!m_ShowUnitySplashScreen.boolValue)
                {
                    return;
                }
            }

            GUIContent buttonLabel       = SplashScreen.isFinished ? k_Texts.previewSplash : k_Texts.cancelPreviewSplash;
            Rect       previewButtonRect = GUILayoutUtility.GetRect(buttonLabel, "button");

            previewButtonRect = EditorGUI.PrefixLabel(previewButtonRect, new GUIContent(" "));
            if (GUI.Button(previewButtonRect, buttonLabel))
            {
                if (SplashScreen.isFinished)
                {
                    SplashScreen.Begin();
                    PlayModeView.RepaintAll();
                    var playModeView = PlayModeView.GetMainPlayModeView();
                    if (playModeView)
                    {
                        playModeView.Focus();
                    }
                    EditorApplication.update += PollSplashState;
                }
                else
                {
                    SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
                    EditorApplication.update -= PollSplashState;
                }

                GameView.RepaintAll();
            }

            EditorGUILayout.PropertyField(m_SplashScreenLogoStyle, k_Texts.splashStyle);

            // Animation
            EditorGUILayout.PropertyField(m_SplashScreenAnimation, k_Texts.animate);
            m_ShowAnimationControlsAnimator.target = m_SplashScreenAnimation.intValue == (int)PlayerSettings.SplashScreen.AnimationMode.Custom;

            if (EditorGUILayout.BeginFadeGroup(m_ShowAnimationControlsAnimator.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.Slider(m_SplashScreenLogoAnimationZoom, 0.0f, 1.0f, k_Texts.logoZoom);
                EditorGUILayout.Slider(m_SplashScreenBackgroundAnimationZoom, 0.0f, 1.0f, k_Texts.backgroundZoom);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();

            EditorGUILayout.Space();

            // Logos
            EditorGUILayout.LabelField(k_Texts.logosTitle, EditorStyles.boldLabel);
            using (new EditorGUI.DisabledScope(!Application.HasProLicense()))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(m_ShowUnitySplashLogo, k_Texts.showLogo);
                if (EditorGUI.EndChangeCheck())
                {
                    if (!m_ShowUnitySplashLogo.boolValue)
                    {
                        RemoveUnityLogoFromLogosList();
                    }
                    else if (m_SplashScreenDrawMode.intValue == (int)PlayerSettings.SplashScreen.DrawMode.AllSequential)
                    {
                        AddUnityLogoToLogosList();
                    }
                }

                m_ShowLogoControlsAnimator.target = m_ShowUnitySplashLogo.boolValue;
            }

            if (EditorGUILayout.BeginFadeGroup(m_ShowLogoControlsAnimator.faded))
            {
                EditorGUI.BeginChangeCheck();
                var oldDrawmode = m_SplashScreenDrawMode.intValue;
                EditorGUILayout.PropertyField(m_SplashScreenDrawMode, k_Texts.drawMode);
                if (oldDrawmode != m_SplashScreenDrawMode.intValue)
                {
                    if (m_SplashScreenDrawMode.intValue == (int)PlayerSettings.SplashScreen.DrawMode.UnityLogoBelow)
                    {
                        RemoveUnityLogoFromLogosList();
                    }
                    else
                    {
                        AddUnityLogoToLogosList();
                    }
                }
            }
            EditorGUILayout.EndFadeGroup();

            m_LogoList.DoLayoutList();
            EditorGUILayout.Space();

            // Background
            EditorGUILayout.LabelField(k_Texts.backgroundTitle, EditorStyles.boldLabel);
            EditorGUILayout.Slider(m_SplashScreenOverlayOpacity, Application.HasProLicense() ? k_MinProEditionOverlayOpacity : k_MinPersonalEditionOverlayOpacity, 1.0f, k_Texts.overlayOpacity);
            m_ShowBackgroundColorAnimator.target = m_SplashScreenBackgroundLandscape.objectReferenceValue == null;
            if (EditorGUILayout.BeginFadeGroup(m_ShowBackgroundColorAnimator.faded))
            {
                EditorGUILayout.PropertyField(m_SplashScreenBackgroundColor, k_Texts.backgroundColor);
            }
            EditorGUILayout.EndFadeGroup();

            EditorGUILayout.PropertyField(m_SplashScreenBlurBackground, k_Texts.blurBackground);
            EditorGUI.BeginChangeCheck();
            ObjectReferencePropertyField <Sprite>(m_SplashScreenBackgroundLandscape, k_Texts.backgroundImage);
            if (EditorGUI.EndChangeCheck() && m_SplashScreenBackgroundLandscape.objectReferenceValue == null)
            {
                m_SplashScreenBackgroundPortrait.objectReferenceValue = null;
            }

            using (new EditorGUI.DisabledScope(m_SplashScreenBackgroundLandscape.objectReferenceValue == null))
            {
                ObjectReferencePropertyField <Sprite>(m_SplashScreenBackgroundPortrait, k_Texts.backgroundPortraitImage);
            }
        }
示例#24
0
            public void DrawProjection()
            {
                ProjectionType projectionType = orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective;

                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = orthographic.hasMultipleDifferentValues;
                projectionType           = (ProjectionType)EditorGUILayout.EnumPopup(Styles.projection, projectionType);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    orthographic.boolValue = (projectionType == ProjectionType.Orthographic);
                }

                if (!orthographic.hasMultipleDifferentValues)
                {
                    if (projectionType == ProjectionType.Orthographic)
                    {
                        EditorGUILayout.PropertyField(orthographicSize, Styles.size);
                    }
                    else
                    {
                        float fovCurrentValue;
                        bool  multipleDifferentFovValues = false;
                        bool  isPhysicalCamera           = projectionMatrixMode.intValue == (int)Camera.ProjectionMatrixMode.PhysicalPropertiesBased;

                        var rect       = EditorGUILayout.GetControlRect();
                        var guiContent = EditorGUI.BeginProperty(rect, Styles.FOVAxisMode, fovAxisMode);
                        EditorGUI.showMixedValue = fovAxisMode.hasMultipleDifferentValues;

                        EditorGUI.BeginChangeCheck();
                        var fovAxisNewVal = (int)(Camera.FieldOfViewAxis)EditorGUI.EnumPopup(rect, guiContent, (Camera.FieldOfViewAxis)fovAxisMode.intValue);
                        if (EditorGUI.EndChangeCheck())
                        {
                            fovAxisMode.intValue = fovAxisNewVal;
                        }
                        EditorGUI.EndProperty();

                        bool fovAxisVertical = fovAxisMode.intValue == 0;

                        if (!fovAxisVertical && !fovAxisMode.hasMultipleDifferentValues)
                        {
                            var   targets     = m_SerializedObject.targetObjects;
                            var   camera0     = targets[0] as Camera;
                            float aspectRatio = isPhysicalCamera ? sensorSize.vector2Value.x / sensorSize.vector2Value.y : camera0.aspect;
                            // camera.aspect is not serialized so we have to check all targets.
                            fovCurrentValue = Camera.VerticalToHorizontalFieldOfView(camera0.fieldOfView, aspectRatio);
                            if (m_SerializedObject.targetObjectsCount > 1)
                            {
                                foreach (Camera camera in targets)
                                {
                                    if (camera.fieldOfView != fovCurrentValue)
                                    {
                                        multipleDifferentFovValues = true;
                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            fovCurrentValue            = verticalFOV.floatValue;
                            multipleDifferentFovValues = fovAxisMode.hasMultipleDifferentValues;
                        }

                        EditorGUI.showMixedValue = multipleDifferentFovValues;
                        var content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.fieldOfView, verticalFOV);
                        EditorGUI.BeginDisabled(projectionMatrixMode.hasMultipleDifferentValues || isPhysicalCamera && (sensorSize.hasMultipleDifferentValues || fovAxisMode.hasMultipleDifferentValues));
                        EditorGUI.BeginChangeCheck();
                        var fovNewValue = EditorGUILayout.Slider(content, fovCurrentValue, 0.00001f, 179f);
                        var fovChanged  = EditorGUI.EndChangeCheck();
                        EditorGUI.EndDisabled();
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndProperty();
                        EditorGUI.showMixedValue = false;

                        content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.physicalCamera, projectionMatrixMode);
                        EditorGUI.showMixedValue = projectionMatrixMode.hasMultipleDifferentValues;

                        EditorGUI.BeginChangeCheck();
                        isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera);
                        if (EditorGUI.EndChangeCheck())
                        {
                            projectionMatrixMode.intValue = isPhysicalCamera ? (int)Camera.ProjectionMatrixMode.PhysicalPropertiesBased : (int)Camera.ProjectionMatrixMode.Implicit;
                        }
                        EditorGUILayout.EndHorizontal();
                        EditorGUI.EndProperty();

                        EditorGUI.showMixedValue = false;
                        if (isPhysicalCamera && !projectionMatrixMode.hasMultipleDifferentValues)
                        {
                            using (new EditorGUI.IndentLevelScope())
                            {
                                using (var horizontal = new EditorGUILayout.HorizontalScope())
                                    using (new EditorGUI.PropertyScope(horizontal.rect, Styles.focalLength, focalLength))
                                        using (var checkScope = new EditorGUI.ChangeCheckScope())
                                        {
                                            EditorGUI.showMixedValue = focalLength.hasMultipleDifferentValues;
                                            float sensorLength   = fovAxisVertical ? sensorSize.vector2Value.y : sensorSize.vector2Value.x;
                                            float focalLengthVal = fovChanged ? Camera.FieldOfViewToFocalLength(fovNewValue, sensorLength) : focalLength.floatValue;
                                            focalLengthVal = EditorGUILayout.FloatField(Styles.focalLength, focalLengthVal);
                                            if (checkScope.changed || fovChanged)
                                            {
                                                focalLength.floatValue = focalLengthVal;
                                            }
                                        }

                                EditorGUI.showMixedValue = sensorSize.hasMultipleDifferentValues;
                                EditorGUI.BeginChangeCheck();
                                int filmGateIndex = Array.IndexOf(k_ApertureFormatValues, new Vector2((float)Math.Round(sensorSize.vector2Value.x, 3), (float)Math.Round(sensorSize.vector2Value.y, 3)));
                                if (filmGateIndex == -1)
                                {
                                    filmGateIndex = EditorGUILayout.Popup(Styles.cameraType, k_ApertureFormatNames.Length - 1, k_ApertureFormatNames);
                                }
                                else
                                {
                                    filmGateIndex = EditorGUILayout.Popup(Styles.cameraType, filmGateIndex, k_ApertureFormatNames);
                                }
                                EditorGUI.showMixedValue = false;
                                if (EditorGUI.EndChangeCheck() && filmGateIndex < k_ApertureFormatValues.Length)
                                {
                                    sensorSize.vector2Value = k_ApertureFormatValues[filmGateIndex];
                                }

                                EditorGUILayout.PropertyField(sensorSize, Styles.sensorSize);

                                EditorGUILayout.PropertyField(lensShift, Styles.lensShift);

                                using (var horizontal = new EditorGUILayout.HorizontalScope())
                                    using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.gateFit, gateFit))
                                        using (var checkScope = new EditorGUI.ChangeCheckScope())
                                        {
                                            int gateValue = (int)(Camera.GateFitMode)EditorGUILayout.EnumPopup(propertyScope.content, (Camera.GateFitMode)gateFit.intValue);
                                            if (checkScope.changed)
                                            {
                                                gateFit.intValue = gateValue;
                                            }
                                        }
                            }
                        }
                        else if (fovChanged)
                        {
                            verticalFOV.floatValue = fovAxisVertical ? fovNewValue : Camera.HorizontalToVerticalFieldOfView(fovNewValue, (m_SerializedObject.targetObjects[0] as Camera).aspect);
                        }
                        EditorGUILayout.Space();
                    }
                }
            }
        public override void OnInspectorGUI()
        {
            //Bug fix: 1018456 Moved the HandleLowPassFilter method before updating the serializedObjects
            HandleLowPassFilter();

            serializedObject.Update();

            if (m_LowpassObject != null)
            {
                m_LowpassObject.Update();
            }


            UpdateWrappersAndLegend();

            EditorGUILayout.PropertyField(m_AudioClip, Styles.audioClipLabel);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_OutputAudioMixerGroup, Styles.outputMixerGroupLabel);
            EditorGUILayout.PropertyField(m_Mute);
            if (AudioUtil.canUseSpatializerEffect)
            {
                EditorGUILayout.PropertyField(m_Spatialize, Styles.spatializeLabel);
                using (new EditorGUI.DisabledScope(!m_Spatialize.boolValue))
                {
                    EditorGUILayout.PropertyField(m_SpatializePostEffects, Styles.spatializePostEffectsLabel);
                }
            }
            EditorGUILayout.PropertyField(m_BypassEffects);
            if (targets.Any(t => (t as AudioSource).outputAudioMixerGroup != null))
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.PropertyField(m_BypassListenerEffects);
                }
            }
            else
            {
                EditorGUILayout.PropertyField(m_BypassListenerEffects);
            }
            EditorGUILayout.PropertyField(m_BypassReverbZones);

            EditorGUILayout.PropertyField(m_PlayOnAwake);
            EditorGUILayout.PropertyField(m_Loop);

            EditorGUILayout.Space();
            EditorGUIUtility.sliderLabels.SetLabels(Styles.priorityLeftLabel, Styles.priorityRightLabel);
            EditorGUILayout.IntSlider(m_Priority, 0, 256, Styles.priorityLabel);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(m_Volume, 0f, 1.0f, Styles.volumeLabel);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(m_Pitch, -3.0f, 3.0f, Styles.pitchLabel);

            EditorGUILayout.Space();

            EditorGUIUtility.sliderLabels.SetLabels(Styles.panLeftLabel, Styles.panRightLabel);
            EditorGUILayout.Slider(m_Pan2D, -1f, 1f, Styles.panStereoLabel);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();

            // 3D Level control
            EditorGUIUtility.sliderLabels.SetLabels(Styles.spatialLeftLabel, Styles.spatialRightLabel);
            AnimProp(Styles.spatialBlendLabel, m_AudioCurves[kSpatialBlendCurveID].curveProp, 0.0f, 1.0f, false);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();

            // 3D Level control
            AnimProp(Styles.reverbZoneMixLabel, m_AudioCurves[kReverbZoneMixCurveID].curveProp, 0.0f, 1.1f, false);
            EditorGUILayout.Space();

            m_Expanded3D = EditorGUILayout.Foldout(m_Expanded3D, "3D Sound Settings", true);
            if (m_Expanded3D)
            {
                EditorGUI.indentLevel++;
                Audio3DGUI();
                EditorGUI.indentLevel--;
            }

            serializedObject.ApplyModifiedProperties();
            if (m_LowpassObject != null)
            {
                m_LowpassObject.ApplyModifiedProperties();
            }
        }
示例#26
0
    void showPopulationMapGUI()
    {
        EG.BeginDisabledGroup(!(terrainGenerated));
        showPopUI = EGL.Foldout(showPopUI, populationLabel, true);
        if (showPopUI)
        {
            GL.BeginVertical();
            GL.BeginHorizontal("box");
            GL.BeginVertical();
            GL.Label("Octaves");
            GL.Label("Persistance");
            GL.Label("Zoom");
            GL.Label("Seed");
            GL.EndVertical();

            GL.BeginVertical();
            CG.popOctaves     = EGL.IntSlider(CG.popOctaves, 1, 6);
            CG.popPersistance = EGL.Slider(CG.popPersistance, 0, 0.5f);
            CG.popZoom        = EGL.Slider(CG.popZoom, 0, 0.05f);
            GL.BeginHorizontal();
            EG.BeginDisabledGroup(rPopSeed.target == false);
            CG.popSeed = EGL.IntSlider(CG.popSeed, 0, int.MaxValue);
            EG.EndDisabledGroup();
            rPopSeed.target = EGL.Toggle(rPopSeed.target);
            GL.EndHorizontal();

            GL.Space(20);

            GL.BeginHorizontal();
            GL.Label("Or import your custom pop map: ");
            CG.popMapInput = (Texture2D)EGL.ObjectField(CG.popMapInput, typeof(Texture2D), false);
            GL.EndHorizontal();
            GL.EndVertical();

            GL.EndHorizontal();
            GL.EndVertical();

            GL.BeginHorizontal();
            if (GL.Button("Generate Population Map"))
            {
                if (rPopSeed.target == false && CG.popMapInput == null)
                {
                    CG.popSeed = Random.Range(0, int.MaxValue);
                }
                generator.generatePopulationMap();
                isPopMap   = true;
                CG.showPop = true;
            }

            EG.BeginDisabledGroup(!isPopMap);
            GL.BeginHorizontal();
            GL.FlexibleSpace();
            CG.showPop = EGL.ToggleLeft("Preview Pop Map", CG.showPop);
            GL.EndHorizontal();

            GL.EndHorizontal();
            if (GL.Button("Save and Proceed"))
            {
                populationGenerated = true;
                populationLabel     = "2. Population Map Generation - COMPLETED ✔";
                showPopUI           = false;
                CG.showPop          = false;
                showGrowthUI        = true;
            }
            EG.EndDisabledGroup();
        }
        EG.EndDisabledGroup();
    }
        void OnGUI()
        {
            var dirtyCount = PhysicsVisualizationSettings.dirtyCount;

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            // Workflow
            PhysicsVisualizationSettings.filterWorkflow = (PhysicsVisualizationSettings.FilterWorkflow)EditorGUILayout.EnumPopup(
                PhysicsVisualizationSettings.filterWorkflow, EditorStyles.toolbarPopup, GUILayout.Width(130));

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Reset", EditorStyles.toolbarButton))
                PhysicsVisualizationSettings.Reset();

            EditorGUILayout.EndHorizontal();

            m_MainScrollPos = GUILayout.BeginScrollView(m_MainScrollPos);

            PhysicsVisualizationSettings.FilterWorkflow filterMode = PhysicsVisualizationSettings.filterWorkflow;
            string action = (filterMode == PhysicsVisualizationSettings.FilterWorkflow.ShowSelectedItems) ? "Show " : "Hide ";

            // Layers
            int oldConcatenatedMask = InternalEditorUtility.LayerMaskToConcatenatedLayersMask(
                PhysicsVisualizationSettings.GetShowCollisionLayerMask(filterMode));

            int newConcatenatedMask = EditorGUILayout.MaskField(
                GUIContent.Temp(action + "Layers", action + "selected layers"), oldConcatenatedMask, InternalEditorUtility.layers);

            PhysicsVisualizationSettings.SetShowCollisionLayerMask(
                filterMode, (int)InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(newConcatenatedMask));

            // Static Colliders
            PhysicsVisualizationSettings.SetShowStaticColliders(filterMode, EditorGUILayout.Toggle(
                GUIContent.Temp(action + "Static Colliders", action + "collision geometry from Colliders that do not have a Rigidbody")
                , PhysicsVisualizationSettings.GetShowStaticColliders(filterMode)));

            // Triggers
            PhysicsVisualizationSettings.SetShowTriggers(filterMode, EditorGUILayout.Toggle(
                GUIContent.Temp(action + "Triggers", action + "collision geometry from Colliders that have 'isTrigger' enabled")
                , PhysicsVisualizationSettings.GetShowTriggers(filterMode)));

            // Rigidbodies
            PhysicsVisualizationSettings.SetShowRigidbodies(filterMode, EditorGUILayout.Toggle(
                GUIContent.Temp(action + "Rigidbodies", action + "collision geometry from Rigidbodies")
                , PhysicsVisualizationSettings.GetShowRigidbodies(filterMode)));

            // Kinematic Bodies
            PhysicsVisualizationSettings.SetShowKinematicBodies(filterMode, EditorGUILayout.Toggle(
                GUIContent.Temp(action + "Kinematic Bodies", action + "collision geometry from Kinematic Rigidbodies")
                , PhysicsVisualizationSettings.GetShowKinematicBodies(filterMode)));

            // Sleeping Bodies
            PhysicsVisualizationSettings.SetShowSleepingBodies(filterMode, EditorGUILayout.Toggle(
                GUIContent.Temp(action + "Sleeping Bodies", action + "collision geometry from Sleeping Rigidbodies")
                , PhysicsVisualizationSettings.GetShowSleepingBodies(filterMode)));

            m_FilterColliderTypesFoldout = EditorGUILayout.Foldout(m_FilterColliderTypesFoldout, "Collider Types");
            if (m_FilterColliderTypesFoldout)
            {
                EditorGUI.indentLevel++;
                float oldWidth = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 200;

                // BoxCollider
                PhysicsVisualizationSettings.SetShowBoxColliders(filterMode, EditorGUILayout.Toggle(
                    GUIContent.Temp(action + "BoxColliders", action + "collision geometry from BoxColliders")
                    , PhysicsVisualizationSettings.GetShowBoxColliders(filterMode)));

                // SphereCollider
                PhysicsVisualizationSettings.SetShowSphereColliders(filterMode, EditorGUILayout.Toggle(
                    GUIContent.Temp(action + "SphereColliders", action + "collision geometry from SphereColliders")
                    , PhysicsVisualizationSettings.GetShowSphereColliders(filterMode)));

                // CapsuleCollider
                PhysicsVisualizationSettings.SetShowCapsuleColliders(filterMode, EditorGUILayout.Toggle(
                    GUIContent.Temp(action + "CapsuleColliders", action + "collision geometry from CapsuleColliders")
                    , PhysicsVisualizationSettings.GetShowCapsuleColliders(filterMode)));

                // MeshCollider convex
                PhysicsVisualizationSettings.SetShowMeshColliders(filterMode, PhysicsVisualizationSettings.MeshColliderType.Convex, EditorGUILayout.Toggle(
                    GUIContent.Temp(action + "MeshColliders (convex)", action + "collision geometry from convex MeshColliders")
                    , PhysicsVisualizationSettings.GetShowMeshColliders(filterMode, PhysicsVisualizationSettings.MeshColliderType.Convex)));

                // MeshCollider non-convex
                PhysicsVisualizationSettings.SetShowMeshColliders(filterMode, PhysicsVisualizationSettings.MeshColliderType.NonConvex, EditorGUILayout.Toggle(
                    GUIContent.Temp(action + "MeshColliders (concave)", action + "collision geometry from non-convex MeshColliders")
                    , PhysicsVisualizationSettings.GetShowMeshColliders(filterMode, PhysicsVisualizationSettings.MeshColliderType.NonConvex)));

                // TerrainCollider
                PhysicsVisualizationSettings.SetShowTerrainColliders(filterMode, EditorGUILayout.Toggle(
                    GUIContent.Temp(action + "TerrainColliders", action + "collision geometry from TerrainColliders")
                    , PhysicsVisualizationSettings.GetShowTerrainColliders(filterMode)));

                EditorGUIUtility.labelWidth = oldWidth;
                EditorGUI.indentLevel--;
            }

            GUILayout.Space(4);

            // Selection buttons
            GUILayout.BeginHorizontal();

            bool selectNone = GUILayout.Button(action + "None", "MiniButton");
            bool selectAll = GUILayout.Button(action + "All", "MiniButton");
            if (selectNone || selectAll)
                PhysicsVisualizationSettings.SetShowForAllFilters(filterMode, selectAll);

            GUILayout.EndHorizontal();

            m_ColorFoldout = EditorGUILayout.Foldout(m_ColorFoldout, "Colors");
            if (m_ColorFoldout)
            {
                EditorGUI.indentLevel++;

                PhysicsVisualizationSettings.staticColor =
                    EditorGUILayout.ColorField(Contents.staticColor, PhysicsVisualizationSettings.staticColor);

                PhysicsVisualizationSettings.triggerColor =
                    EditorGUILayout.ColorField(Contents.triggerColor, PhysicsVisualizationSettings.triggerColor);

                PhysicsVisualizationSettings.rigidbodyColor =
                    EditorGUILayout.ColorField(Contents.rigidbodyColor, PhysicsVisualizationSettings.rigidbodyColor);

                PhysicsVisualizationSettings.kinematicColor =
                    EditorGUILayout.ColorField(Contents.kinematicColor, PhysicsVisualizationSettings.kinematicColor);

                PhysicsVisualizationSettings.sleepingBodyColor =
                    EditorGUILayout.ColorField(Contents.sleepingBodyColor, PhysicsVisualizationSettings.sleepingBodyColor);

                PhysicsVisualizationSettings.colorVariance =
                    EditorGUILayout.Slider("Variation", PhysicsVisualizationSettings.colorVariance, 0f, 1f);

                EditorGUI.indentLevel--;
            }

            m_RenderingFoldout = EditorGUILayout.Foldout(m_RenderingFoldout, "Rendering");
            if (m_RenderingFoldout)
            {
                EditorGUI.indentLevel++;

                PhysicsVisualizationSettings.baseAlpha = 1f - EditorGUILayout.Slider("Transparency"
                    , 1f - PhysicsVisualizationSettings.baseAlpha, 0f, 1f);

                PhysicsVisualizationSettings.forceOverdraw = EditorGUILayout.Toggle(Contents.forceOverdraw
                    , PhysicsVisualizationSettings.forceOverdraw);

                PhysicsVisualizationSettings.viewDistance = EditorGUILayout.FloatField(Contents.viewDistance
                    , PhysicsVisualizationSettings.viewDistance);

                PhysicsVisualizationSettings.terrainTilesMax = EditorGUILayout.IntField(Contents.terrainTilesMax
                    , PhysicsVisualizationSettings.terrainTilesMax);

                EditorGUI.indentLevel--;
            }

            if (Unsupported.IsDeveloperMode() || PhysicsVisualizationSettings.devOptions)
            {
                PhysicsVisualizationSettings.devOptions = EditorGUILayout.Toggle(Contents.devOptions
                    , PhysicsVisualizationSettings.devOptions);
            }

            if (PhysicsVisualizationSettings.devOptions)
            {
                PhysicsVisualizationSettings.dotAlpha = EditorGUILayout.Slider("dotAlpha"
                    , PhysicsVisualizationSettings.dotAlpha, -1f, 1f);

                PhysicsVisualizationSettings.forceDot = EditorGUILayout.Toggle(Contents.forceDot
                    , PhysicsVisualizationSettings.forceDot);

                Tools.hidden = EditorGUILayout.Toggle(Contents.toolsHidden
                    , Tools.hidden);
            }

            GUILayout.EndScrollView();

            if (dirtyCount != PhysicsVisualizationSettings.dirtyCount)
                RepaintSceneAndGameViews();
        }
示例#28
0
    void showGrowthMapGUI()
    {
        EG.BeginDisabledGroup(!(terrainGenerated));
        showGrowthUI = EGL.Foldout(showGrowthUI, growthLabel, true);
        if (showGrowthUI)
        {
            GL.BeginVertical();

            GL.BeginHorizontal();
            GL.BeginVertical();
            if (GL.Button("Basic Rule"))
            {
                CG.growthBasic   = 1;
                CG.growthNewYork = 0;
                CG.growthParis   = 0;
            }
            if (GL.Button("New York Rule"))
            {
                CG.growthNewYork = 1;
                CG.growthBasic   = 0;
                CG.growthParis   = 0;
            }
            if (GL.Button("Paris Rule"))
            {
                CG.growthParis   = 1;
                CG.growthBasic   = 0;
                CG.growthNewYork = 0;
            }
            GL.EndVertical();
            GL.BeginVertical();
            GL.Space(1);
            CG.growthBasic = EGL.Slider(1 - CG.growthNewYork - CG.growthParis, 0, 1);
            GL.Space(1);
            CG.growthNewYork = EGL.Slider(1 - CG.growthBasic - CG.growthParis, 0, 1);
            GL.Space(1);
            CG.growthParis = EGL.Slider(1 - CG.growthBasic - CG.growthNewYork, 0, 1);
            GL.EndVertical();
            GL.EndHorizontal();
            GL.Space(1);

            if (GL.Button("Default"))
            {
                CG.growthParis   = 1f / 3f;
                CG.growthBasic   = 1f / 3f;
                CG.growthNewYork = 1f / 3f;
            }

            GL.BeginHorizontal("box");
            GL.BeginVertical();
            GL.Label("Octaves");
            GL.Label("Persistance");
            GL.Label("Zoom");
            GL.Label("Seed");
            GL.EndVertical();

            GL.BeginVertical();
            CG.growthOctaves     = EGL.IntSlider(CG.growthOctaves, 1, 6);
            CG.growthPersistance = EGL.Slider(CG.growthPersistance, 0, 0.7f);
            CG.growthZoom        = EGL.Slider(CG.growthZoom, 0, 0.05f);
            GL.BeginHorizontal();
            EG.BeginDisabledGroup(rGrowthSeed.target == false);
            CG.growthSeed = EGL.IntSlider(CG.growthSeed, 0, int.MaxValue);
            EG.EndDisabledGroup();
            rGrowthSeed.target = EGL.Toggle(rGrowthSeed.target);
            GL.EndHorizontal();

            GL.Space(20);

            GL.BeginHorizontal();
            GL.Label("Or import your growth-rule map: ");
            CG.growthMapInput = (Texture2D)EGL.ObjectField(CG.growthMapInput, typeof(Texture2D), false);
            GL.EndHorizontal();
            GL.EndVertical();

            GL.EndHorizontal();
            GL.EndVertical();

            GL.BeginHorizontal();
            if (GL.Button("Generate Growth Map"))
            {
                if (rGrowthSeed.target == false && CG.growthMapInput == null)
                {
                    CG.growthSeed = Random.Range(0, int.MaxValue);
                }
                generator.generateGrowthRule();
                isGrowthMap   = true;
                CG.showGrowth = true;
            }

            EG.BeginDisabledGroup(!isGrowthMap);
            GL.BeginHorizontal();
            GL.FlexibleSpace();
            CG.showGrowth = EGL.ToggleLeft("Preview Growth Map", CG.showGrowth);
            GL.FlexibleSpace();
            GL.EndHorizontal();
            GL.EndHorizontal();

            if (GL.Button("Save and Proceed"))
            {
                growthMapGenerated = true;
                growthLabel        = "3. Growth Map Generation - COMPLETED ✔";
                showGrowthUI       = false;
                CG.showGrowth      = false;
                showRoadMapUI      = true;
            }
            EG.EndDisabledGroup();
        }
        EG.EndDisabledGroup();
    }
示例#29
0
    void showTerrainGUI()
    {
        // General Terrain Settings
        showTerrainUI = EGL.Foldout(showTerrainUI, terrainLabel, true);

        if (showTerrainUI)
        {
            GL.BeginHorizontal();
            GL.BeginVertical();
            GL.Label(new GUIContent("Terrain Size", "The width in units of the generated Terrain Object."));
            GL.Label(new GUIContent("Terrain Height Range", "The min and max height in units of the generated Terrain Object."));
            GL.Label("Water?");
            GL.EndVertical();

            GL.BeginVertical();
            CG.terrainSize = EGL.IntSlider(CG.terrainSize, 512, 2048);
            GL.BeginHorizontal();
            GL.TextField(CG.minHeight.ToString("F1"));
            EGL.MinMaxSlider(ref CG.minHeight, ref CG.maxHeight, CG.terrainSize * -CG.highwayMaxSlope, CG.terrainSize * CG.highwayMaxSlope);
            GL.TextField(CG.maxHeight.ToString("F1"));
            GL.EndHorizontal();
            EG.BeginDisabledGroup(CG.minHeight > 0);
            rWaterToggle.target = EGL.Toggle(rWaterToggle.target);
            EG.EndDisabledGroup();
            GL.EndVertical();
            GL.EndHorizontal();

            GL.BeginVertical();
            GL.Label("Height Map Generation", EditorStyles.centeredGreyMiniLabel);
            GL.BeginHorizontal("box");
            GL.BeginVertical();
            GL.Label("Octaves");
            GL.Label("Persistance");
            GL.Label("Zoom");
            GL.Label("Seed");
            GL.EndVertical();

            GL.BeginVertical();
            CG.terrainOctaves     = EGL.IntSlider(CG.terrainOctaves, 1, 6);
            CG.terrainPersistance = EGL.Slider(CG.terrainPersistance, 0, 0.7f);
            CG.terrainZoom        = EGL.Slider(CG.terrainZoom, 0.01f, 0.04f);
            GL.BeginHorizontal();
            EG.BeginDisabledGroup(rTerrainSeed.target == false);
            CG.terrainSeed = EGL.IntSlider(CG.terrainSeed, 0, int.MaxValue);
            EG.EndDisabledGroup();
            rTerrainSeed.target = EGL.Toggle(rTerrainSeed.target);
            GL.EndHorizontal();
            GL.Space(20);
            GL.BeginHorizontal();
            GL.Label("Or import your custom height map: ");
            CG.terrainMap = (Texture2D)EGL.ObjectField(CG.terrainMap, typeof(Texture2D), false);
            GL.EndHorizontal();
            GL.EndVertical();


            GL.EndHorizontal();
            GL.EndVertical();

            GL.BeginHorizontal();
            if (GL.Button("Generate New Terrain"))
            {
                if (rTerrainSeed.target == false && CG.terrainMap == null)
                {
                    CG.terrainSeed = Random.Range(0, int.MaxValue);
                }
                CG.rWater = rWaterToggle.target;
                generator.generateTerrain();
                isTerrain = true;
            }
            EG.BeginDisabledGroup(!isTerrain);
            if (GL.Button("Save and Proceed"))
            {
                terrainGenerated = true;
                terrainLabel     = "1. Terrain Generation - COMPLETED ✔";
                if (CityGeneratorUI.DebugMode)
                {
                    Debug.Log("Terrain Generated");
                }
                showTerrainUI = false;
                showPopUI     = true;
            }
            EG.EndDisabledGroup();

            GL.EndHorizontal();
        }
    }
        private void OnGUI()
        {
            EditorGUIUtility.labelWidth = base.position.width - 64f - 20f;
            bool flag = true;

            this.m_ScrollPosition = EditorGUILayout.BeginVerticalScrollView(this.m_ScrollPosition, false, GUI.skin.verticalScrollbar, GUI.skin.scrollView, new GUILayoutOption[0]);
            flag &= this.ValidateTerrain();
            EditorGUI.BeginChangeCheck();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            string label           = "";
            float  alignmentOffset = 0f;

            switch (this.m_Terrain.materialType)
            {
            case Terrain.MaterialType.BuiltInStandard:
                label           = " Albedo (RGB)\nSmoothness (A)";
                alignmentOffset = 15f;
                break;

            case Terrain.MaterialType.BuiltInLegacyDiffuse:
                label           = "\n Diffuse (RGB)";
                alignmentOffset = 15f;
                break;

            case Terrain.MaterialType.BuiltInLegacySpecular:
                label           = "Diffuse (RGB)\n   Gloss (A)";
                alignmentOffset = 12f;
                break;

            case Terrain.MaterialType.Custom:
                label           = " \n  Splat";
                alignmentOffset = 0f;
                break;
            }
            TerrainSplatEditor.TextureFieldGUI(label, ref this.m_Texture, alignmentOffset);
            Texture2D normalMap = this.m_NormalMap;

            TerrainSplatEditor.TextureFieldGUI("\nNormal", ref this.m_NormalMap, -4f);
            if (this.m_NormalMap != normalMap)
            {
                this.CheckIfNormalMapHasCorrectTextureType();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            flag &= this.ValidateTextures();
            if (flag)
            {
                if (TerrainSplatEditor.IsUsingMetallic(this.m_Terrain.materialType, this.m_Terrain.materialTemplate))
                {
                    EditorGUILayout.Space();
                    float labelWidth = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 75f;
                    this.m_Metallic             = EditorGUILayout.Slider("Metallic", this.m_Metallic, 0f, 1f, new GUILayoutOption[0]);
                    EditorGUIUtility.labelWidth = labelWidth;
                }
                else if (TerrainSplatEditor.IsUsingSpecular(this.m_Terrain.materialType, this.m_Terrain.materialTemplate))
                {
                    this.m_Specular = EditorGUILayout.ColorField("Specular", this.m_Specular, new GUILayoutOption[0]);
                }
                if (TerrainSplatEditor.IsUsingSmoothness(this.m_Terrain.materialType, this.m_Terrain.materialTemplate) && !TextureUtil.HasAlphaTextureFormat(this.m_Texture.format))
                {
                    EditorGUILayout.Space();
                    float labelWidth2 = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 75f;
                    this.m_Smoothness           = EditorGUILayout.Slider("Smoothness", this.m_Smoothness, 0f, 1f, new GUILayoutOption[0]);
                    EditorGUIUtility.labelWidth = labelWidth2;
                }
            }
            TerrainSplatEditor.SplatSizeGUI(ref this.m_TileSize, ref this.m_TileOffset);
            bool flag2 = EditorGUI.EndChangeCheck();

            EditorGUILayout.EndScrollView();
            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUI.enabled = flag;
            if (GUILayout.Button(this.m_ButtonTitle, new GUILayoutOption[]
            {
                GUILayout.MinWidth(100f)
            }))
            {
                this.ApplyTerrainSplat();
                base.Close();
                GUIUtility.ExitGUI();
            }
            GUI.enabled = true;
            GUILayout.EndHorizontal();
            if (flag2 && flag && this.m_Index != -1)
            {
                this.ApplyTerrainSplat();
            }
        }