MinMaxSlider() публичный статический Метод

public static MinMaxSlider ( GUIContent label, float &minValue, float &maxValue, float minLimit, float maxLimit ) : void
label UnityEngine.GUIContent
minValue float
maxValue float
minLimit float
maxLimit float
Результат void
Пример #1
0
    public static IntRange FrameRangeSlider(string text, IntRange range, int frames)
    {
        var prog0 = (float)range.from / frames;
        var prog1 = (float)range.to / frames;

        EGL.MinMaxSlider(text + string.Format(" ({0}-{1})", range.from, range.to),
                         ref prog0, ref prog1, 0, 1);

        return(new IntRange(Mathf.RoundToInt(frames * prog0), Mathf.RoundToInt(frames * prog1)));
    }
Пример #2
0
        void DoAlbedoArea(Material material)
        {
            float MaxRim = rimMax.floatValue;
            float MinRim = rimMin.floatValue;

            m_MaterialEditor.TexturePropertySingleLine(Styles.albedoText, albedoMap, albedoColor);
            m_MaterialEditor.ShaderProperty(useProbe, Styles.probeText);
            m_MaterialEditor.TexturePropertySingleLine(Styles.fallbackText, fallbackMap);

            if (((BlendMode)material.GetFloat("_Mode") == BlendMode.Cutout))
            {
                m_MaterialEditor.ShaderProperty(alphaCutoff, Styles.alphaCutoffText.text, MaterialEditor.kMiniTextureFieldLabelIndentLevel + 1);
            }

            if (stylizeSpec.floatValue == 1)
            {
                GUILayout.Space(17);
                GUILayout.Label("Custom Specular", EditorStyles.boldLabel);
                GUILayout.BeginHorizontal();
                m_MaterialEditor.ShaderProperty(specularBrightness, "Specular Brightness");
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            if (stylizeRim.floatValue == 1)
            {
                float rimVal = litRim.floatValue;
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.MinMaxSlider("Rim (Min / Max)", ref MinRim, ref MaxRim, 0f, 1f);
                rimVal = GUILayout.Toggle(litRim.floatValue == 1, "Directional Rim", "Button", GUILayout.MaxWidth(100)) ? 1 : 0;
                if (EditorGUI.EndChangeCheck())
                {
                    litRim.floatValue = rimVal;
                    rimMax.floatValue = MaxRim;
                    rimMin.floatValue = MinRim;
                }
            }

            if (stylizeRamp.floatValue == 1)
            {
                float shadowVal = shadowToggle.floatValue;
                EditorGUI.BeginChangeCheck();
                GUILayout.Space(17);
                GUILayout.Label("Custom Ramp", EditorStyles.boldLabel);
                EditorGUI.showMixedValue = shadowToggle.hasMixedValue;
                shadowVal = EditorGUILayout.Toggle("Tint Shadows?", shadowToggle.floatValue == 1, GUILayout.MaxWidth(EditorGUIUtility.labelWidth + 13.0f)) ? 1 : 0;
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    shadowToggle.floatValue = shadowVal;
                }
                GUILayout.Space(-17);

                GUILayout.BeginHorizontal();
                EditorGUI.BeginDisabledGroup(shadowToggle.floatValue == 0);
                GUILayout.Space(20);
                ProperColorBox(ref shadowColor, " ");
                EditorGUI.EndDisabledGroup();
                GUILayout.EndHorizontal();

                m_MaterialEditor.ShaderProperty(rampOff, Styles.rampOffText);
            }
            if (stylizeRamp.floatValue == 1 || stylizeSpec.floatValue == 1)
            {
                m_MaterialEditor.ShaderProperty(rampHard, Styles.rampHardText); GUILayout.Space(17);
            }

            if (outlineEnabled.floatValue > 0)
            {
                GUILayout.Label("Outlines", EditorStyles.boldLabel);
                ProperColorBox(ref outlineColor, "Outline Color");

                GUILayout.BeginHorizontal();
                m_MaterialEditor.ShaderProperty(stencilRef, "Stencil [0-255]");
                if (GUILayout.Button("Randomize"))
                {
                    stencilRef.floatValue = Mathf.RoundToInt(UnityEngine.Random.Range(0f, 255f));
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                m_MaterialEditor.RangeProperty(outlineColorMix, "Tint");
                m_MaterialEditor.ShaderProperty(outlineWidth, "Width");
                //m_MaterialEditor.ShaderProperty(angleAdjust, "Edge Fix Angle");
            }
            GUILayout.Space(17);
            GUILayout.FlexibleSpace();

            m_MaterialEditor.ShaderProperty(fakeLight, Styles.fakeLightText);
        }
Пример #3
0
        private void OnGUI()
        {
            bool  recording = NetworkProfiler.IsRunning;
            float deltaTime = (float)(EditorApplication.timeSinceStartup - m_LastSetup);

            m_LastSetup = EditorApplication.timeSinceStartup;

            //Draw top bar
            EditorGUILayout.BeginVertical();
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button(recording ? "Stop" : "Capture"))
            {
                ChangeRecordState();
            }
            if (GUILayout.Button("Clear"))
            {
                ClearDrawing();
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            if (GUILayout.Button("Import datafile"))
            {
                string path = EditorUtility.OpenFilePanel("Choose a NetworkProfiler file", "", "");
                if (!string.IsNullOrEmpty(path))
                {
                    var ticks = ProfilerContainer.FromBytes(File.ReadAllBytes(path)).Ticks;
                    if (ticks.Length >= 2)
                    {
                        m_Curve   = AnimationCurve.Constant(ticks[0].EventId, ticks[(ticks.Length - 1)].EventId, 0);
                        m_ShowMax = ticks.Length;
                        m_ShowMin = ticks.Length - Mathf.Clamp(100, 0, ticks.Length);
                    }
                    else
                    {
                        m_Curve = AnimationCurve.Constant(0, 1, 0);
                    }

                    m_CurrentTicks.Clear();
                    for (int i = 0; i < ticks.Length; i++)
                    {
                        m_CurrentTicks.Add(ticks[i]);

                        uint bytes = 0;
                        if (ticks[i].Events.Count > 0)
                        {
                            for (int j = 0; j < ticks[i].Events.Count; j++)
                            {
                                var tickEvent = ticks[i].Events[j];
                                bytes += tickEvent.Bytes;
                            }
                        }

                        m_Curve.AddKey(ticks[i].EventId, bytes);
                    }
                }
            }

            if (GUILayout.Button("Export datafile"))
            {
                int max          = (int)m_ShowMax;
                int min          = (int)m_ShowMin;
                int ticksInRange = max - min;
                var ticks        = new ProfilerTick[ticksInRange];
                for (int i = min; i < max; i++)
                {
                    ticks[i - min] = m_CurrentTicks[i];
                }
                string path = EditorUtility.SaveFilePanel("Save NetworkProfiler data", "", "networkProfilerData", "");
                if (!string.IsNullOrEmpty(path))
                {
                    File.WriteAllBytes(path, new ProfilerContainer {
                        Ticks = ticks
                    }.ToBytes());
                }
            }

            EditorGUILayout.EndHorizontal();
            float prevHis = m_CaptureCount;

            m_CaptureCount = EditorGUILayout.DelayedIntField("History count", m_CaptureCount);
            if (m_CaptureCount <= 0)
            {
                m_CaptureCount = 1;
            }
            m_UpdateDelay = EditorGUILayout.Slider("Refresh delay", m_UpdateDelay, 0.1f, 10f);
            EditorGUILayout.EndVertical();

            if (prevHis != m_CaptureCount)
            {
                StartRecording();
            }

            //Cache
            if (NetworkProfiler.IsRunning)
            {
                if (Time.unscaledTime - m_LastDrawn > m_UpdateDelay)
                {
                    m_LastDrawn = Time.unscaledTime;
                    m_CurrentTicks.Clear();
                    if (NetworkProfiler.Ticks.Count >= 2)
                    {
                        m_Curve = AnimationCurve.Constant(NetworkProfiler.Ticks.ElementAt(0).EventId, NetworkProfiler.Ticks.ElementAt(NetworkProfiler.Ticks.Count - 1).EventId, 0);
                    }

                    for (int i = 0; i < NetworkProfiler.Ticks.Count; i++)
                    {
                        var tick = NetworkProfiler.Ticks.ElementAt(i);
                        m_CurrentTicks.Add(tick);

                        uint bytes = 0;
                        if (tick.Events.Count > 0)
                        {
                            for (int j = 0; j < tick.Events.Count; j++)
                            {
                                var tickEvent = tick.Events[j];
                                bytes += tickEvent.Bytes;
                            }
                        }

                        m_Curve.AddKey(tick.EventId, bytes);
                    }
                }
            }


            //Draw Animation curve and slider
            m_Curve = EditorGUILayout.CurveField(m_Curve);
            EditorGUILayout.MinMaxSlider(ref m_ShowMin, ref m_ShowMax, 0, m_CurrentTicks.Count);
            //Verify slider values
            if (m_ShowMin < 0)
            {
                m_ShowMin = 0;
            }
            if (m_ShowMax > m_CurrentTicks.Count)
            {
                m_ShowMax = m_CurrentTicks.Count;
            }
            if (m_ShowMin <= 0 && m_ShowMax <= 0)
            {
                m_ShowMin = 0;
                m_ShowMax = m_CurrentTicks.Count;
            }

            //Draw main board
            bool hover            = false;
            int  nonEmptyTicks    = 0;
            int  largestTickCount = 0;
            int  totalTicks       = ((int)m_ShowMax - (int)m_ShowMin);

            for (int i = (int)m_ShowMin; i < (int)m_ShowMax; i++)
            {
                if (m_CurrentTicks[i].Events.Count > 0)
                {
                    nonEmptyTicks++;                                     //Count non empty ticks
                }
                if (m_CurrentTicks[i].Events.Count > largestTickCount)
                {
                    largestTickCount = m_CurrentTicks[i].Events.Count;                                                    //Get how many events the tick with most events has
                }
            }

            int emptyTicks = totalTicks - nonEmptyTicks;

            float equalWidth   = position.width / totalTicks;
            float propWidth    = equalWidth * 0.3f;
            float widthPerTick = ((position.width - emptyTicks * propWidth) / nonEmptyTicks);

            float currentX    = 0;
            int   emptyStreak = 0;

            for (int i = (int)m_ShowMin; i < (int)m_ShowMax; i++)
            {
                var tick = m_CurrentTicks[i];
                if (tick.Events.Count == 0 && i != totalTicks - 1)
                {
                    emptyStreak++;
                    continue;
                }

                if (emptyStreak > 0 || i == totalTicks - 1)
                {
                    var dataRect = new Rect(currentX, 140f, propWidth * emptyStreak, position.height - 140f);
                    currentX += propWidth * emptyStreak;
                    if (emptyStreak >= 2)
                    {
                        EditorGUI.LabelField(new Rect(dataRect.x, dataRect.y, dataRect.width, dataRect.height), emptyStreak.ToString(), s_WrapStyle);
                    }
                    emptyStreak = 0;
                }

                if (tick.Events.Count > 0)
                {
                    float heightPerEvent = ((position.height - 140f) - (5f * largestTickCount)) / largestTickCount;

                    float currentY = 140f;
                    for (int j = 0; j < tick.Events.Count; j++)
                    {
                        var tickEvent = tick.Events[j];
                        var dataRect  = new Rect(currentX, currentY, widthPerTick, heightPerEvent);

                        if (dataRect.Contains(Event.current.mousePosition))
                        {
                            hover        = true;
                            m_EventHover = tickEvent;
                        }

                        EditorGUI.DrawRect(dataRect, TickTypeToColor(tickEvent.EventType, true));
                        EditorGUI.LabelField(new Rect(dataRect.x, dataRect.y, dataRect.width, dataRect.height / 2), tickEvent.EventType.ToString(), s_WrapStyle);
                        EditorGUI.LabelField(new Rect(dataRect.x, dataRect.y + dataRect.height / 2, dataRect.width, dataRect.height / 2), tickEvent.Bytes + "B", s_WrapStyle);

                        currentY += heightPerEvent + 5f;
                    }
                }

                EditorGUI.DrawRect(new Rect(currentX, 100, widthPerTick, 40), TickTypeToColor(tick.Type, false));
                EditorGUI.LabelField(new Rect(currentX, 100, widthPerTick, 20), tick.Type.ToString(), s_WrapStyle);
                EditorGUI.LabelField(new Rect(currentX, 120, widthPerTick, 20), tick.Frame.ToString(), s_WrapStyle);
                currentX += widthPerTick;
            }

            //Calculate alpha
            if (hover)
            {
                m_HoverAlpha += deltaTime * 10f;

                if (m_HoverAlpha > 1f)
                {
                    m_HoverAlpha = 1f;
                }
                else if (m_HoverAlpha < 0f)
                {
                    m_HoverAlpha = 0f;
                }
            }
            else
            {
                m_HoverAlpha -= deltaTime * 10f;
                if (m_HoverAlpha > 1f)
                {
                    m_HoverAlpha = 1f;
                }
                else if (m_HoverAlpha < 0f)
                {
                    m_HoverAlpha = 0f;
                }
            }

            //Draw hover thingy
            if (m_EventHover != null)
            {
                var rect = new Rect(Event.current.mousePosition, new Vector2(500, 100));
                EditorGUI.DrawRect(rect, GetEditorColorWithAlpha(m_HoverAlpha));

                float heightPerField = (rect.height - 5) / 4;
                EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + 5, rect.width, rect.height), "EventType: " + m_EventHover.EventType, GetStyleWithTextAlpha(EditorStyles.label, m_HoverAlpha));
                EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + heightPerField * 1 + 5, rect.width, rect.height), "Size: " + m_EventHover.Bytes + "B", GetStyleWithTextAlpha(EditorStyles.label, m_HoverAlpha));
                EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + heightPerField * 2 + 5, rect.width, rect.height), "Channel: " + m_EventHover.ChannelName, GetStyleWithTextAlpha(EditorStyles.label, m_HoverAlpha));
                EditorGUI.LabelField(new Rect(rect.x + 5, rect.y + heightPerField * 3 + 5, rect.width, rect.height), "MessageType: " + m_EventHover.MessageType, GetStyleWithTextAlpha(EditorStyles.label, m_HoverAlpha));
            }

            Repaint();
        }
Пример #4
0
 private void DrawRenderTargetControls(FrameDebuggerEventData cur)
 {
     if (cur.rtWidth > 0 && cur.rtHeight > 0)
     {
         bool  disabled = cur.rtFormat == 1 || cur.rtFormat == 3;
         bool  flag     = cur.rtHasDepthTexture != 0;
         short num      = cur.rtCount;
         if (flag)
         {
             num += 1;
         }
         EditorGUILayout.LabelField("RenderTarget", cur.rtName, new GUILayoutOption[0]);
         GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
         EditorGUI.BeginChangeCheck();
         bool flag2;
         using (new EditorGUI.DisabledScope(num <= 1))
         {
             GUIContent[] array = new GUIContent[(int)num];
             for (int i = 0; i < (int)cur.rtCount; i++)
             {
                 array[i] = FrameDebuggerWindow.Styles.mrtLabels[i];
             }
             if (flag)
             {
                 array[(int)cur.rtCount] = FrameDebuggerWindow.Styles.depthLabel;
             }
             int num2 = Mathf.Clamp(this.m_RTIndex, 0, (int)(num - 1));
             flag2          = (num2 != this.m_RTIndex);
             this.m_RTIndex = num2;
             this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, array, EditorStyles.toolbarPopup, new GUILayoutOption[]
             {
                 GUILayout.Width(70f)
             });
         }
         GUILayout.Space(10f);
         using (new EditorGUI.DisabledScope(disabled))
         {
             GUILayout.Label(FrameDebuggerWindow.Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
             this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, FrameDebuggerWindow.Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]);
         }
         GUILayout.Space(10f);
         GUILayout.Label(FrameDebuggerWindow.Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
         EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0f, 1f, new GUILayoutOption[]
         {
             GUILayout.MaxWidth(200f)
         });
         if (EditorGUI.EndChangeCheck() || flag2)
         {
             Vector4 channels = Vector4.zero;
             if (this.m_RTChannel == 1)
             {
                 channels.x = 1f;
             }
             else if (this.m_RTChannel == 2)
             {
                 channels.y = 1f;
             }
             else if (this.m_RTChannel == 3)
             {
                 channels.z = 1f;
             }
             else if (this.m_RTChannel == 4)
             {
                 channels.w = 1f;
             }
             else
             {
                 channels = Vector4.one;
             }
             int num3 = this.m_RTIndex;
             if (num3 >= (int)cur.rtCount)
             {
                 num3 = -1;
             }
             FrameDebuggerUtility.SetRenderTargetDisplayOptions(num3, channels, this.m_RTBlackLevel, this.m_RTWhiteLevel);
             this.RepaintAllNeededThings();
         }
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
         GUILayout.Label(string.Format("{0}x{1} {2}", cur.rtWidth, cur.rtHeight, (RenderTextureFormat)cur.rtFormat), new GUILayoutOption[0]);
         if (cur.rtDim == 4)
         {
             GUILayout.Label("Rendering into cubemap", new GUILayoutOption[0]);
         }
         if (cur.rtFormat == 3 && SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9"))
         {
             EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true);
         }
     }
 }
Пример #5
0
 private void DrawRenderTargetControls(FrameDebuggerEvent cur)
 {
     if ((cur.rtWidth > 0) && (cur.rtHeight > 0))
     {
         bool  disabled = (cur.rtFormat == 1) || (cur.rtFormat == 3);
         bool  flag2    = cur.rtHasDepthTexture != 0;
         short rtCount  = cur.rtCount;
         if (flag2)
         {
             rtCount = (short)(rtCount + 1);
         }
         GUILayout.Label("RenderTarget: " + cur.rtName, EditorStyles.boldLabel, new GUILayoutOption[0]);
         GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
         EditorGUI.BeginChangeCheck();
         EditorGUI.BeginDisabledGroup(rtCount <= 1);
         GUIContent[] displayedOptions = new GUIContent[rtCount];
         for (int i = 0; i < cur.rtCount; i++)
         {
             displayedOptions[i] = Styles.mrtLabels[i];
         }
         if (flag2)
         {
             displayedOptions[cur.rtCount] = Styles.depthLabel;
         }
         int  num3  = Mathf.Clamp(this.m_RTIndex, 0, rtCount - 1);
         bool flag3 = num3 != this.m_RTIndex;
         this.m_RTIndex = num3;
         GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(70f) };
         this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, displayedOptions, EditorStyles.toolbarPopup, options);
         EditorGUI.EndDisabledGroup();
         GUILayout.Space(10f);
         EditorGUI.BeginDisabledGroup(disabled);
         GUILayout.Label(Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
         this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]);
         EditorGUI.EndDisabledGroup();
         GUILayout.Space(10f);
         GUILayout.Label(Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
         GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MaxWidth(200f) };
         EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0f, 1f, optionArray2);
         if (EditorGUI.EndChangeCheck() || flag3)
         {
             Vector4 zero = Vector4.zero;
             if (this.m_RTChannel == 1)
             {
                 zero.x = 1f;
             }
             else if (this.m_RTChannel == 2)
             {
                 zero.y = 1f;
             }
             else if (this.m_RTChannel == 3)
             {
                 zero.z = 1f;
             }
             else if (this.m_RTChannel == 4)
             {
                 zero.w = 1f;
             }
             else
             {
                 zero = Vector4.one;
             }
             int rTIndex = this.m_RTIndex;
             if (rTIndex >= cur.rtCount)
             {
                 rTIndex = -1;
             }
             FrameDebuggerUtility.SetRenderTargetDisplayOptions(rTIndex, zero, this.m_RTBlackLevel, this.m_RTWhiteLevel);
             this.RepaintAllNeededThings();
         }
         GUILayout.FlexibleSpace();
         GUILayout.EndHorizontal();
         GUILayout.Label(string.Format("{0}x{1} {2}", cur.rtWidth, cur.rtHeight, (RenderTextureFormat)cur.rtFormat), new GUILayoutOption[0]);
         if (cur.rtDim == 4)
         {
             GUILayout.Label("Rendering into cubemap", new GUILayoutOption[0]);
         }
         if ((cur.rtFormat == 3) && SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9"))
         {
             EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true);
         }
     }
 }
Пример #6
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();
        }
    }
Пример #7
0
        private void DrawRenderTargetControls(FrameDebuggerEventData cur)
        {
            if (cur.rtWidth <= 0 || cur.rtHeight <= 0)
            {
                return;
            }
            bool  disabled = cur.rtFormat == 1 || cur.rtFormat == 3;
            bool  flag1    = (int)cur.rtHasDepthTexture != 0;
            short rtCount  = cur.rtCount;

            if (flag1)
            {
                ++rtCount;
            }
            GUILayout.Label("RenderTarget: " + cur.rtName, EditorStyles.boldLabel, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginDisabledGroup((int)rtCount <= 1);
            GUIContent[] displayedOptions = new GUIContent[(int)rtCount];
            for (int index = 0; index < (int)cur.rtCount; ++index)
            {
                displayedOptions[index] = FrameDebuggerWindow.Styles.mrtLabels[index];
            }
            if (flag1)
            {
                displayedOptions[(int)cur.rtCount] = FrameDebuggerWindow.Styles.depthLabel;
            }
            int  num   = Mathf.Clamp(this.m_RTIndex, 0, (int)rtCount - 1);
            bool flag2 = num != this.m_RTIndex;

            this.m_RTIndex = num;
            this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, displayedOptions, EditorStyles.toolbarPopup, new GUILayoutOption[1]
            {
                GUILayout.Width(70f)
            });
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(10f);
            EditorGUI.BeginDisabledGroup(disabled);
            GUILayout.Label(FrameDebuggerWindow.Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
            this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, FrameDebuggerWindow.Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]);
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(10f);
            GUILayout.Label(FrameDebuggerWindow.Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
            EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0.0f, 1f, GUILayout.MaxWidth(200f));
            if (EditorGUI.EndChangeCheck() || flag2)
            {
                Vector4 channels = Vector4.zero;
                if (this.m_RTChannel == 1)
                {
                    channels.x = 1f;
                }
                else if (this.m_RTChannel == 2)
                {
                    channels.y = 1f;
                }
                else if (this.m_RTChannel == 3)
                {
                    channels.z = 1f;
                }
                else if (this.m_RTChannel == 4)
                {
                    channels.w = 1f;
                }
                else
                {
                    channels = Vector4.one;
                }
                int rtIndex = this.m_RTIndex;
                if (rtIndex >= (int)cur.rtCount)
                {
                    rtIndex = -1;
                }
                FrameDebuggerUtility.SetRenderTargetDisplayOptions(rtIndex, channels, this.m_RTBlackLevel, this.m_RTWhiteLevel);
                this.RepaintAllNeededThings();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Label(string.Format("{0}x{1} {2}", (object)cur.rtWidth, (object)cur.rtHeight, (object)(RenderTextureFormat)cur.rtFormat));
            if (cur.rtDim == 4)
            {
                GUILayout.Label("Rendering into cubemap");
            }
            if (cur.rtFormat != 3 || !SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9"))
            {
                return;
            }
            EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true);
        }