IsDeveloperBuild() public static method

public static IsDeveloperBuild ( ) : bool
return bool
コード例 #1
0
 public virtual void AddItemsToMenu(GenericMenu menu)
 {
     menu.AddItem(new GUIContent("Sort groups alphabetically"), this.m_SortGroupsAlphabetically, (GenericMenu.MenuFunction)(() => this.m_SortGroupsAlphabetically = !this.m_SortGroupsAlphabetically));
     menu.AddItem(new GUIContent("Show referenced groups"), this.m_ShowReferencedBuses, (GenericMenu.MenuFunction)(() => this.m_ShowReferencedBuses = !this.m_ShowReferencedBuses));
     menu.AddItem(new GUIContent("Show group connections"), this.m_ShowBusConnections, (GenericMenu.MenuFunction)(() => this.m_ShowBusConnections   = !this.m_ShowBusConnections));
     if (this.m_ShowBusConnections)
     {
         menu.AddItem(new GUIContent("Only highlight selected group connections"), this.m_ShowBusConnectionsOfSelection, (GenericMenu.MenuFunction)(() => this.m_ShowBusConnectionsOfSelection = !this.m_ShowBusConnectionsOfSelection));
     }
     menu.AddSeparator(string.Empty);
     menu.AddItem(new GUIContent("Vertical layout"), this.layoutMode == AudioMixerWindow.LayoutMode.Vertical, (GenericMenu.MenuFunction)(() => this.layoutMode     = AudioMixerWindow.LayoutMode.Vertical));
     menu.AddItem(new GUIContent("Horizontal layout"), this.layoutMode == AudioMixerWindow.LayoutMode.Horizontal, (GenericMenu.MenuFunction)(() => this.layoutMode = AudioMixerWindow.LayoutMode.Horizontal));
     menu.AddSeparator(string.Empty);
     menu.AddItem(new GUIContent("Use RMS metering for display"), EditorPrefs.GetBool(AudioMixerWindow.kAudioMixerUseRMSMetering, true), (GenericMenu.MenuFunction)(() => EditorPrefs.SetBool(AudioMixerWindow.kAudioMixerUseRMSMetering, true)));
     menu.AddItem(new GUIContent("Use peak metering for display"), !EditorPrefs.GetBool(AudioMixerWindow.kAudioMixerUseRMSMetering, true), (GenericMenu.MenuFunction)(() => EditorPrefs.SetBool(AudioMixerWindow.kAudioMixerUseRMSMetering, false)));
     if (!Unsupported.IsDeveloperBuild())
     {
         return;
     }
     menu.AddSeparator(string.Empty);
     menu.AddItem(new GUIContent("DEVELOPER/Groups Rendered Above"), this.m_GroupsRenderedAboveSections, (GenericMenu.MenuFunction)(() => this.m_GroupsRenderedAboveSections = !this.m_GroupsRenderedAboveSections));
     menu.AddItem(new GUIContent("DEVELOPER/Build 10 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(0, 7, 10)));
     menu.AddItem(new GUIContent("DEVELOPER/Build 20 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(0, 7, 20)));
     menu.AddItem(new GUIContent("DEVELOPER/Build 40 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(0, 7, 40)));
     menu.AddItem(new GUIContent("DEVELOPER/Build 80 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(0, 7, 80)));
     menu.AddItem(new GUIContent("DEVELOPER/Build 160 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(0, 7, 160)));
     menu.AddItem(new GUIContent("DEVELOPER/Build chain of 10 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(1, 1, 10)));
     menu.AddItem(new GUIContent("DEVELOPER/Build chain of 20 groups "), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(1, 1, 20)));
     menu.AddItem(new GUIContent("DEVELOPER/Build chain of 40 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(1, 1, 40)));
     menu.AddItem(new GUIContent("DEVELOPER/Build chain of 80 groups"), false, (GenericMenu.MenuFunction)(() => this.m_Controller.BuildTestSetup(1, 1, 80)));
     menu.AddItem(new GUIContent("DEVELOPER/Show overlays"), this.m_ShowDeveloperOverlays, (GenericMenu.MenuFunction)(() => this.m_ShowDeveloperOverlays = !this.m_ShowDeveloperOverlays));
 }
コード例 #2
0
 public virtual void AddItemsToMenu(GenericMenu menu)
 {
     if (Unsupported.IsDeveloperBuild())
     {
         menu.AddItem(new GUIContent("DEVELOPER/Toggle DebugMode"), false, new GenericMenu.MenuFunction(SceneHierarchyWindow.ToggleDebugMode));
     }
 }
コード例 #3
0
        public override Texture2D RenderStaticPreview(string assetPath, UnityEngine.Object[] subAssets, int width, int height)
        {
            Texture2D textured;

            if (!ShaderUtil.hardwareSupportsRectRenderTexture)
            {
                return(null);
            }
            Texture target = this.target as Texture;

            if (this.IsCubemap())
            {
                return(this.m_CubemapPreview.RenderStaticPreview(target, width, height));
            }
            PreviewHelpers.AdjustWidthAndHeightForStaticPreview(target.width, target.height, ref width, ref height);
            EditorUtility.SetTemporarilyAllowIndieRenderTexture(true);
            RenderTexture active                    = RenderTexture.active;
            Rect          rawViewportRect           = ShaderUtil.rawViewportRect;
            bool          flag                      = !TextureUtil.GetLinearSampled(target);
            RenderTexture dest                      = RenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.Default, !flag ? RenderTextureReadWrite.Linear : RenderTextureReadWrite.sRGB);
            Material      materialForSpecialTexture = EditorGUI.GetMaterialForSpecialTexture(target);

            GL.sRGBWrite = QualitySettings.activeColorSpace == ColorSpace.Linear;
            if (materialForSpecialTexture != null)
            {
                if (Unsupported.IsDeveloperBuild())
                {
                    materialForSpecialTexture = new Material(materialForSpecialTexture);
                }
                Graphics.Blit(target, dest, materialForSpecialTexture);
            }
            else
            {
                Graphics.Blit(target, dest);
            }
            GL.sRGBWrite         = false;
            RenderTexture.active = dest;
            Texture2D textured2 = this.target as Texture2D;

            if ((textured2 != null) && textured2.alphaIsTransparency)
            {
                textured = new Texture2D(width, height, TextureFormat.ARGB32, false);
            }
            else
            {
                textured = new Texture2D(width, height, TextureFormat.RGB24, false);
            }
            textured.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0);
            textured.Apply();
            RenderTexture.ReleaseTemporary(dest);
            EditorGUIUtility.SetRenderTextureNoViewport(active);
            ShaderUtil.rawViewportRect = rawViewportRect;
            EditorUtility.SetTemporarilyAllowIndieRenderTexture(false);
            if ((materialForSpecialTexture != null) && Unsupported.IsDeveloperBuild())
            {
                UnityEngine.Object.DestroyImmediate(materialForSpecialTexture);
            }
            return(textured);
        }
コード例 #4
0
        public override Texture2D RenderStaticPreview(string assetPath, UnityEngine.Object[] subAssets, int width, int height)
        {
            if (!ShaderUtil.hardwareSupportsRectRenderTexture)
            {
                return((Texture2D)null);
            }
            Texture target1 = this.target as Texture;

            if (this.IsCubemap())
            {
                return(this.m_CubemapPreview.RenderStaticPreview(target1, width, height));
            }
            TextureImporter atPath = AssetImporter.GetAtPath(assetPath) as TextureImporter;

            if ((UnityEngine.Object)atPath != (UnityEngine.Object)null && atPath.spriteImportMode == SpriteImportMode.Polygon)
            {
                Sprite subAsset = subAssets[0] as Sprite;
                if ((bool)((UnityEngine.Object)subAsset))
                {
                    return(SpriteInspector.BuildPreviewTexture(width, height, subAsset, (Material)null, true));
                }
            }
            PreviewHelpers.AdjustWidthAndHeightForStaticPreview(target1.width, target1.height, ref width, ref height);
            RenderTexture active          = RenderTexture.active;
            Rect          rawViewportRect = ShaderUtil.rawViewportRect;
            bool          flag            = !TextureUtil.GetLinearSampled(target1);
            RenderTexture temporary       = RenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.Default, !flag ? RenderTextureReadWrite.Linear : RenderTextureReadWrite.sRGB);
            Material      material        = EditorGUI.GetMaterialForSpecialTexture(target1);

            GL.sRGBWrite = QualitySettings.activeColorSpace == ColorSpace.Linear;
            if ((bool)((UnityEngine.Object)material))
            {
                if (Unsupported.IsDeveloperBuild())
                {
                    material = new Material(material);
                }
                Graphics.Blit(target1, temporary, material);
            }
            else
            {
                Graphics.Blit(target1, temporary);
            }
            GL.sRGBWrite         = false;
            RenderTexture.active = temporary;
            Texture2D target2   = this.target as Texture2D;
            Texture2D texture2D = !((UnityEngine.Object)target2 != (UnityEngine.Object)null) || !target2.alphaIsTransparency ? new Texture2D(width, height, TextureFormat.RGB24, false) : new Texture2D(width, height, TextureFormat.ARGB32, false);

            texture2D.ReadPixels(new Rect(0.0f, 0.0f, (float)width, (float)height), 0, 0);
            texture2D.Apply();
            RenderTexture.ReleaseTemporary(temporary);
            EditorGUIUtility.SetRenderTextureNoViewport(active);
            ShaderUtil.rawViewportRect = rawViewportRect;
            if ((bool)((UnityEngine.Object)material) && Unsupported.IsDeveloperBuild())
            {
                UnityEngine.Object.DestroyImmediate((UnityEngine.Object)material);
            }
            return(texture2D);
        }
コード例 #5
0
        private void OnInspectorUpdate()
        {
            string miniMemoryOverview = ProfilerDriver.miniMemoryOverview;

            if (Unsupported.IsDeveloperBuild() && (this.m_LastMiniMemoryOverview != miniMemoryOverview))
            {
                this.m_LastMiniMemoryOverview = miniMemoryOverview;
                base.Repaint();
            }
        }
コード例 #6
0
        private static void DisplayControls(UnityEngine.Object target, SceneView sceneView)
        {
            EditorGUIUtility.labelWidth = 150f;
            bool flag        = false;
            bool showNavMesh = NavMeshVisualizationSettings.showNavMesh;

            if (showNavMesh != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show NavMesh"), showNavMesh, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showNavMesh = !showNavMesh;
                flag = true;
            }
            EditorGUI.BeginDisabledGroup(!NavMeshVisualizationSettings.hasHeightMesh);
            bool showHeightMesh = NavMeshVisualizationSettings.showHeightMesh;

            if (showHeightMesh != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show HeightMesh"), showHeightMesh, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showHeightMesh = !showHeightMesh;
                flag = true;
            }
            EditorGUI.EndDisabledGroup();
            if (Unsupported.IsDeveloperBuild())
            {
                GUILayout.Label("Internal");
                bool showNavMeshPortals = NavMeshVisualizationSettings.showNavMeshPortals;
                if (showNavMeshPortals != EditorGUILayout.Toggle(new GUIContent("Show NavMesh Portals"), showNavMeshPortals, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showNavMeshPortals = !showNavMeshPortals;
                    flag = true;
                }
                bool showNavMeshLinks = NavMeshVisualizationSettings.showNavMeshLinks;
                if (showNavMeshLinks != EditorGUILayout.Toggle(new GUIContent("Show NavMesh Links"), showNavMeshLinks, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showNavMeshLinks = !showNavMeshLinks;
                    flag = true;
                }
                bool showProximityGrid = NavMeshVisualizationSettings.showProximityGrid;
                if (showProximityGrid != EditorGUILayout.Toggle(new GUIContent("Show Proximity Grid"), showProximityGrid, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showProximityGrid = !showProximityGrid;
                    flag = true;
                }
                bool heightMeshBvTree = NavMeshVisualizationSettings.showHeightMeshBVTree;
                if (heightMeshBvTree != EditorGUILayout.Toggle(new GUIContent("Show HeightMesh BV-Tree"), heightMeshBvTree, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showHeightMeshBVTree = !heightMeshBvTree;
                    flag = true;
                }
            }
            if (!flag)
            {
                return;
            }
            NavMeshEditorWindow.RepaintSceneAndGameViews();
        }
コード例 #7
0
        private void OnInspectorUpdate()
        {
            string miniMemoryOverview = ProfilerDriver.miniMemoryOverview;

            if (!Unsupported.IsDeveloperBuild() || !(this.m_LastMiniMemoryOverview != miniMemoryOverview))
            {
                return;
            }
            this.m_LastMiniMemoryOverview = miniMemoryOverview;
            this.Repaint();
        }
コード例 #8
0
        public override Texture2D RenderStaticPreview(string assetPath, UnityEngine.Object[] subAssets, int width, int height)
        {
            if (!ShaderUtil.hardwareSupportsRectRenderTexture)
            {
                return(null);
            }
            Texture texture = this.target as Texture;

            PreviewHelpers.AdjustWidthAndHeightForStaticPreview(texture.width, texture.height, ref width, ref height);
            EditorUtility.SetTemporarilyAllowIndieRenderTexture(true);
            RenderTexture active          = RenderTexture.active;
            Rect          rawViewportRect = ShaderUtil.rawViewportRect;
            RenderTexture temporary       = RenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Linear);
            Material      material        = EditorGUI.GetMaterialForSpecialTexture(texture);

            if (material)
            {
                if (Unsupported.IsDeveloperBuild())
                {
                    material = new Material(material);
                }
                Graphics.Blit(texture, temporary, material);
            }
            else
            {
                Graphics.Blit(texture, temporary);
            }
            RenderTexture.active = temporary;
            Texture2D texture2D = this.target as Texture2D;
            Texture2D texture2D2;

            if (texture2D != null && texture2D.alphaIsTransparency)
            {
                texture2D2 = new Texture2D(width, height, TextureFormat.ARGB32, false);
            }
            else
            {
                texture2D2 = new Texture2D(width, height, TextureFormat.RGB24, false);
            }
            texture2D2.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0);
            texture2D2.Apply();
            RenderTexture.ReleaseTemporary(temporary);
            EditorGUIUtility.SetRenderTextureNoViewport(active);
            ShaderUtil.rawViewportRect = rawViewportRect;
            EditorUtility.SetTemporarilyAllowIndieRenderTexture(false);
            if (material && Unsupported.IsDeveloperBuild())
            {
                UnityEngine.Object.DestroyImmediate(material);
            }
            return(texture2D2);
        }
コード例 #9
0
 private void DeveloperBuildEnlightenSettings(SerializedObject so)
 {
     if (!Unsupported.IsDeveloperBuild())
     {
         return;
     }
     this.m_ShowDevOptions = EditorGUILayout.Foldout(this.m_ShowDevOptions, "Debug [internal]");
     if (this.m_ShowDevOptions)
     {
         SerializedProperty property  = so.FindProperty("m_GISettings.m_BounceScale");
         SerializedProperty property2 = so.FindProperty("m_GISettings.m_TemporalCoherenceThreshold");
         EditorGUI.indentLevel++;
         Lightmapping.concurrentJobsType        = (Lightmapping.ConcurrentJobsType)EditorGUILayout.IntPopup(LightingWindow.styles.ConcurrentJobs, (int)Lightmapping.concurrentJobsType, this.kConcurrentJobsTypeStrings, this.kConcurrentJobsTypeValues, new GUILayoutOption[0]);
         Lightmapping.enlightenForceUpdates     = EditorGUILayout.Toggle(LightingWindow.styles.ForceUpdates, Lightmapping.enlightenForceUpdates, new GUILayoutOption[0]);
         Lightmapping.enlightenForceWhiteAlbedo = EditorGUILayout.Toggle(LightingWindow.styles.ForceWhiteAlbedo, Lightmapping.enlightenForceWhiteAlbedo, new GUILayoutOption[0]);
         Lightmapping.filterMode = (FilterMode)EditorGUILayout.EnumPopup(EditorGUIUtility.TempContent("Filter Mode"), Lightmapping.filterMode, new GUILayoutOption[0]);
         EditorGUILayout.Slider(property, 0f, 10f, LightingWindow.styles.BounceScale, new GUILayoutOption[0]);
         EditorGUILayout.Slider(property2, 0f, 1f, LightingWindow.styles.UpdateThreshold, new GUILayoutOption[0]);
         if (GUILayout.Button("Clear disk cache", new GUILayoutOption[]
         {
             GUILayout.Width(this.kButtonWidth)
         }))
         {
             Lightmapping.Clear();
             Lightmapping.ClearDiskCache();
         }
         if (GUILayout.Button("Print state to console", new GUILayoutOption[]
         {
             GUILayout.Width(this.kButtonWidth)
         }))
         {
             Lightmapping.PrintStateToConsole();
         }
         if (GUILayout.Button("Reset albedo/emissive", new GUILayoutOption[]
         {
             GUILayout.Width(this.kButtonWidth)
         }))
         {
             GIDebugVisualisation.ResetRuntimeInputTextures();
         }
         if (GUILayout.Button("Reset environment", new GUILayoutOption[]
         {
             GUILayout.Width(this.kButtonWidth)
         }))
         {
             DynamicGI.UpdateEnvironment();
         }
         EditorGUI.indentLevel--;
     }
 }
コード例 #10
0
 private void GammaBlit()
 {
     if (QualitySettings.activeColorSpace == ColorSpace.Linear)
     {
         Material material = EditorGUI.gammaCorrectMaterialNoClip;
         if (Unsupported.IsDeveloperBuild())
         {
             material = new Material(material);
         }
         Graphics.Blit(this.m_RenderTexture, this.m_RenderTextureGammaCorrect, material);
         if (material != null && Unsupported.IsDeveloperBuild())
         {
             UnityEngine.Object.DestroyImmediate(material);
         }
     }
 }
コード例 #11
0
 public void DeveloperBuildSettingsGUI()
 {
     if (Unsupported.IsDeveloperBuild())
     {
         Lightmapping.concurrentJobsType        = (Lightmapping.ConcurrentJobsType)EditorGUILayout.IntPopup(LightingWindowBakeSettings.Styles.ConcurrentJobs, (int)Lightmapping.concurrentJobsType, LightingWindowBakeSettings.Styles.ConcurrentJobsTypeStrings, LightingWindowBakeSettings.Styles.ConcurrentJobsTypeValues, new GUILayoutOption[0]);
         Lightmapping.enlightenForceUpdates     = EditorGUILayout.Toggle(LightingWindowBakeSettings.Styles.ForceUpdates, Lightmapping.enlightenForceUpdates, new GUILayoutOption[0]);
         Lightmapping.enlightenForceWhiteAlbedo = EditorGUILayout.Toggle(LightingWindowBakeSettings.Styles.ForceWhiteAlbedo, Lightmapping.enlightenForceWhiteAlbedo, new GUILayoutOption[0]);
         Lightmapping.filterMode = (FilterMode)EditorGUILayout.EnumPopup(EditorGUIUtility.TempContent("Filter Mode"), Lightmapping.filterMode, new GUILayoutOption[0]);
         EditorGUILayout.Slider(this.m_BounceScale, 0f, 10f, LightingWindowBakeSettings.Styles.BounceScale, new GUILayoutOption[0]);
         EditorGUILayout.Slider(this.m_UpdateThreshold, 0f, 1f, LightingWindowBakeSettings.Styles.UpdateThreshold, new GUILayoutOption[0]);
         if (GUILayout.Button("Clear disk cache", new GUILayoutOption[]
         {
             GUILayout.Width(150f)
         }))
         {
             Lightmapping.Clear();
             Lightmapping.ClearDiskCache();
         }
         if (GUILayout.Button("Print state to console", new GUILayoutOption[]
         {
             GUILayout.Width(150f)
         }))
         {
             Lightmapping.PrintStateToConsole();
         }
         if (GUILayout.Button("Reset albedo/emissive", new GUILayoutOption[]
         {
             GUILayout.Width(150f)
         }))
         {
             GIDebugVisualisation.ResetRuntimeInputTextures();
         }
         if (GUILayout.Button("Reset environment", new GUILayoutOption[]
         {
             GUILayout.Width(150f)
         }))
         {
             DynamicGI.UpdateEnvironment();
         }
     }
 }
コード例 #12
0
 private void OnEnable()
 {
     ConsoleWindow.ms_ConsoleWindow = this;
     this.m_DevBuild = Unsupported.IsDeveloperBuild();
 }
コード例 #13
0
        private void OnGUI()
        {
            ConsoleWindow.LoadIcons();
            if (background == null)
            {
                background = "AppToolbar";
            }
            if (EditorApplication.isPlayingOrWillChangePlaymode)
            {
                GUI.color = (Color)HostView.kPlayModeDarken;
            }
            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(new Rect(0f, 0f, base.position.width, base.position.height), false, false, false, false);
            }
            bool isCompiling = EditorApplication.isCompiling;

            GUILayout.Space(2f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(2f);
            string statusText = LogEntries.GetStatusText();

            if (statusText != null)
            {
                int      statusMask = LogEntries.GetStatusMask();
                GUIStyle statusStyleForErrorMode = ConsoleWindow.GetStatusStyleForErrorMode(statusMask);
                GUILayout.Label(ConsoleWindow.GetIconForErrorMode(statusMask, false), statusStyleForErrorMode, new GUILayoutOption[0]);
                GUILayout.Space(2f);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Space(2f);
                if (isCompiling)
                {
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth(GUIView.current.position.width - 52f) };
                    GUILayout.Label(statusText, statusStyleForErrorMode, options);
                }
                else
                {
                    GUILayout.Label(statusText, statusStyleForErrorMode, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndVertical();
                if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                    LogEntries.ClickStatusBar(Event.current.clickCount);
                    GUIUtility.ExitGUI();
                }
            }
            GUILayout.EndHorizontal();
            if (Event.current.type == EventType.Repaint)
            {
                float x = base.position.width - 24f;
                if (AsyncProgressBar.isShowing)
                {
                    x -= 188f;
                    EditorGUI.ProgressBar(new Rect(x, 0f, 185f, 19f), AsyncProgressBar.progress, AsyncProgressBar.progressInfo);
                }
                if (isCompiling)
                {
                    int index = (int)Mathf.Repeat(Time.realtimeSinceStartup * 10f, 11.99f);
                    GUI.Label(new Rect(base.position.width - 24f, 0f, (float)s_StatusWheel[index].image.width, (float)s_StatusWheel[index].image.height), s_StatusWheel[index], GUIStyle.none);
                }
                if (Unsupported.IsBleedingEdgeBuild())
                {
                    Color color = GUI.color;
                    GUI.color = Color.yellow;
                    GUI.Label(new Rect(x - 310f, 0f, 310f, 19f), "THIS IS AN UNTESTED BLEEDINGEDGE UNITY BUILD");
                    GUI.color = color;
                }
                else if (Unsupported.IsDeveloperBuild())
                {
                    GUI.Label(new Rect(x - 200f, 0f, 200f, 19f), this.m_LastMiniMemoryOverview, EditorStyles.progressBarText);
                    EditorGUIUtility.CleanCache(this.m_LastMiniMemoryOverview);
                }
            }
            base.DoWindowDecorationEnd();
            EditorGUI.ShowRepaints();
        }
コード例 #14
0
        private void DrawAudioPane()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            ProfilerAudioView profilerAudioView = this.m_ShowDetailedAudioPane;

            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Stats;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Channels, "Channels", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Channels;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Groups, "Groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Groups;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.ChannelsAndGroups, "Channels and groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.ChannelsAndGroups;
            }
            if (profilerAudioView != this.m_ShowDetailedAudioPane)
            {
                this.m_ShowDetailedAudioPane  = profilerAudioView;
                this.m_LastAudioProfilerFrame = -1;
            }
            if (this.m_ShowDetailedAudioPane == ProfilerAudioView.Stats)
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                this.DrawOverviewText(this.m_CurrentArea);
            }
            else
            {
                GUILayout.Space(5f);
                bool flag = GUILayout.Toggle(AudioUtil.resetAllAudioClipPlayCountsOnPlay, "Reset play count on play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                if (flag != AudioUtil.resetAllAudioClipPlayCountsOnPlay)
                {
                    AudioUtil.resetAllAudioClipPlayCountsOnPlay = flag;
                }
                if (Unsupported.IsDeveloperBuild())
                {
                    GUILayout.Space(5f);
                    bool @bool = EditorPrefs.GetBool("AudioProfilerShowAllGroups");
                    bool flag2 = GUILayout.Toggle(@bool, "Show all groups (dev-builds only)", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                    if (@bool != flag2)
                    {
                        EditorPrefs.SetBool("AudioProfilerShowAllGroups", flag2);
                    }
                }
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                Rect    rect         = GUILayoutUtility.GetRect(20f, 20000f, 10f, 10000f);
                Rect    position     = new Rect(rect.x, rect.y, 230f, rect.height);
                Rect    rect2        = new Rect(position.xMax, rect.y, rect.width - position.width, rect.height);
                string  overviewText = ProfilerDriver.GetOverviewText(this.m_CurrentArea, this.GetActiveVisibleFrameIndex());
                Vector2 vector       = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(overviewText));
                this.m_PaneScroll[(int)this.m_CurrentArea] = GUI.BeginScrollView(position, this.m_PaneScroll[(int)this.m_CurrentArea], new Rect(0f, 0f, vector.x, vector.y));
                GUI.Box(position, string.Empty, ProfilerWindow.ms_Styles.background);
                GUI.Label(new Rect(3f, 3f, vector.x, vector.y), overviewText, EditorStyles.wordWrappedLabel);
                GUI.EndScrollView();
                EditorGUI.DrawRect(new Rect(position.xMax - 1f, position.y, 1f, position.height), Color.black);
                if (this.m_AudioProfilerTreeViewState == null)
                {
                    this.m_AudioProfilerTreeViewState = new AudioProfilerTreeViewState();
                }
                if (this.m_AudioProfilerBackend == null)
                {
                    this.m_AudioProfilerBackend = new AudioProfilerBackend(this.m_AudioProfilerTreeViewState);
                }
                ProfilerProperty profilerProperty = this.CreateProperty(false);
                if (ProfilerWindow.CheckFrameData(profilerProperty))
                {
                    if (this.m_CurrentFrame == -1 || this.m_LastAudioProfilerFrame != this.m_CurrentFrame)
                    {
                        this.m_LastAudioProfilerFrame = this.m_CurrentFrame;
                        AudioProfilerInfo[] audioProfilerInfo = profilerProperty.GetAudioProfilerInfo();
                        if (audioProfilerInfo != null && audioProfilerInfo.Length > 0)
                        {
                            List <AudioProfilerInfoWrapper> list  = new List <AudioProfilerInfoWrapper>();
                            AudioProfilerInfo[]             array = audioProfilerInfo;
                            for (int i = 0; i < array.Length; i++)
                            {
                                AudioProfilerInfo info = array[i];
                                bool flag3             = (info.flags & 64) != 0;
                                if (this.m_ShowDetailedAudioPane != ProfilerAudioView.Channels || !flag3)
                                {
                                    if (this.m_ShowDetailedAudioPane != ProfilerAudioView.Groups || flag3)
                                    {
                                        list.Add(new AudioProfilerInfoWrapper(info, profilerProperty.GetAudioProfilerNameByOffset(info.assetNameOffset), profilerProperty.GetAudioProfilerNameByOffset(info.objectNameOffset), this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels));
                                    }
                                }
                            }
                            this.m_AudioProfilerBackend.SetData(list);
                            if (this.m_AudioProfilerView == null)
                            {
                                this.m_AudioProfilerView = new AudioProfilerView(this, this.m_AudioProfilerTreeViewState);
                                this.m_AudioProfilerView.Init(rect2, this.m_AudioProfilerBackend);
                            }
                        }
                    }
                    if (this.m_AudioProfilerView != null)
                    {
                        this.m_AudioProfilerView.OnGUI(rect2, this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels);
                    }
                }
                profilerProperty.Cleanup();
            }
        }
コード例 #15
0
 private void OnEnable()
 {
     this.titleContent = this.GetLocalizedTitleContent();
     ConsoleWindow.ms_ConsoleWindow = this;
     this.m_DevBuild = Unsupported.IsDeveloperBuild();
 }
コード例 #16
0
        public override void OnGUI()
        {
            const float space = 8;
            const float standardButtonWidth           = 32;
            const float dropdownWidth                 = 80;
            const float playPauseStopWidth            = 140;
            const float previewPackagesinUseWidth     = 173;
            const float previewPackagesinUseIconWidth = 45;

            InitializeToolIcons();

            bool isOrWillEnterPlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            GUI.color = isOrWillEnterPlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                Styles.appToolbar.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            // Position left aligned controls controls - start from left to right.
            Rect pos = new Rect(0, 0, 0, 0);

            ReserveWidthRight(space, ref pos);

            ReserveWidthRight(standardButtonWidth * s_ShownToolIcons.Length, ref pos);
            DoToolButtons(EditorToolGUI.GetThickArea(pos));

            ReserveWidthRight(space, ref pos);

            int playModeControlsStart = Mathf.RoundToInt((position.width - playPauseStopWidth) / 2);

            pos.x += pos.width;
            const float pivotButtonsWidth = 128;

            pos.width = pivotButtonsWidth;
            DoToolSettings(EditorToolGUI.GetThickArea(pos));

            pos.width = pivotButtonsWidth;
            ReserveWidthRight(standardButtonWidth, ref pos);
            DoSnapButtons(EditorToolGUI.GetThickArea(pos));

            // Position centered controls.
            pos = new Rect(playModeControlsStart, 0, 240, 0);

            if (ModeService.HasCapability(ModeCapability.Playbar, true))
            {
                GUILayout.BeginArea(EditorToolGUI.GetThickArea(pos));
                GUILayout.BeginHorizontal();
                {
                    if (!ModeService.Execute("gui_playbar", isOrWillEnterPlaymode))
                    {
                        DoPlayButtons(isOrWillEnterPlaymode);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            // Position right aligned controls controls - start from right to left.
            pos = new Rect(position.width, 0, 0, 0);

            // Right spacing side
            ReserveWidthLeft(space, ref pos);
            ReserveWidthLeft(dropdownWidth, ref pos);

            if (ModeService.HasCapability(ModeCapability.LayoutWindowMenu, true))
            {
                DoLayoutDropDown(EditorToolGUI.GetThinArea(pos));
            }

            if (ModeService.HasCapability(ModeCapability.Layers, true))
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                DoLayersDropDown(EditorToolGUI.GetThinArea(pos));
            }

            if (UnityEditor.MPE.ProcessService.level == UnityEditor.MPE.ProcessLevel.Master)
            {
                ReserveWidthLeft(space, ref pos);

                ReserveWidthLeft(dropdownWidth, ref pos);
                if (EditorGUI.DropdownButton(EditorToolGUI.GetThinArea(pos), s_AccountContent, FocusType.Passive, Styles.dropdown))
                {
                    ShowUserMenu(EditorToolGUI.GetThinArea(pos));
                }

                ReserveWidthLeft(space, ref pos);

                ReserveWidthLeft(standardButtonWidth, ref pos);
                if (GUI.Button(EditorToolGUI.GetThinArea(pos), s_CloudIcon, Styles.command))
                {
                    ServicesEditorWindow.ShowServicesWindow();
                }
            }

            foreach (SubToolbar subToolbar in s_SubToolbars)
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(subToolbar.Width, ref pos);
                subToolbar.OnGUI(EditorToolGUI.GetThinArea(pos));
            }

            if (Unsupported.IsDeveloperBuild() && ModeService.hasSwitchableModes)
            {
                EditorGUI.BeginChangeCheck();
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                var selectedModeIndex = EditorGUI.Popup(EditorToolGUI.GetThinArea(pos), ModeService.currentIndex, ModeService.modeNames, Styles.dropdown);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorApplication.delayCall += () => ModeService.ChangeModeByIndex(selectedModeIndex);
                    GUIUtility.ExitGUI();
                }
            }

            if (m_IsPreviewPackagesInUse && !m_PackageManagerPrefs.dismissPreviewPackagesInUse)
            {
                ReserveWidthLeft(space, ref pos);

                var useIcon = Toolbar.get.mainToolbar.position.width < k_MinWidthChangePreviewPackageInUseToIcon;
                ReserveWidthLeft(useIcon ? previewPackagesinUseIconWidth : previewPackagesinUseWidth, ref pos);

                var dropDownCustomColor = new GUIStyle(Styles.previewPackageInUseDropdown);

                if (EditorGUI.DropdownButton(EditorToolGUI.GetThinArea(pos), useIcon ? s_PreviewPackageIcon : s_PreviewPackageContent, FocusType.Passive, dropDownCustomColor))
                {
                    ShowPreviewPackageInUseMenu(EditorToolGUI.GetThinArea(pos));
                }
            }

            EditorGUI.ShowRepaints();
        }
コード例 #17
0
        private void BakeSettings()
        {
            EditorGUILayout.LabelField(s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            Rect rect = EditorGUILayout.GetControlRect(false, 120f, new GUILayoutOption[0]);

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

            if ((num2 >= 0.001f) && !Mathf.Approximately(num2 - this.m_AgentRadius.floatValue, 0f))
            {
                this.m_AgentRadius.floatValue = num2;
                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 num3 = EditorGUILayout.FloatField(s_Styles.m_AgentHeightContent, this.m_AgentHeight.floatValue, new GUILayoutOption[0]);

            if ((num3 >= 0.001f) && !Mathf.Approximately(num3 - this.m_AgentHeight.floatValue, 0f))
            {
                this.m_AgentHeight.floatValue = num3;
            }
            EditorGUILayout.Slider(this.m_AgentSlope, 0f, 60f, 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 num5 = EditorGUILayout.FloatField(s_Styles.m_AgentClimbContent, this.m_AgentClimb.floatValue, new GUILayoutOption[0]);

            if ((num5 >= 0f) && !Mathf.Approximately(this.m_AgentClimb.floatValue - num5, 0f))
            {
                this.m_AgentClimb.floatValue = num5;
            }
            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 + " internally when baking.", MessageType.Warning);
            }
            float floatValue = this.m_CellSize.floatValue;
            float num7       = floatValue * 0.5f;
            int   num8       = (int)Mathf.Ceil(this.m_AgentClimb.floatValue / num7);
            float num9       = Mathf.Tan((this.m_AgentSlope.floatValue / 180f) * 3.141593f) * floatValue;
            int   num10      = (int)Mathf.Ceil((num9 * 2f) / num7);

            if (num10 > num8)
            {
                float f     = (num8 * num7) / (floatValue * 2f);
                float num12 = (Mathf.Atan(f) / 3.141593f) * 180f;
                float num13 = (num10 - 1) * num7;
                EditorGUILayout.HelpBox("Step Height conflicts with Max Slope. This makes some slopes unwalkable.\nConsider decreasing Max Slope to < " + num12.ToString("0.0") + " degrees.\nOr, increase Step Height to > " + num13.ToString("0.00") + ".", MessageType.Warning);
            }
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(s_Styles.m_OffmeshHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            float num14 = EditorGUILayout.FloatField(s_Styles.m_AgentDropContent, this.m_LedgeDropHeight.floatValue, new GUILayoutOption[0]);

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

            if ((num15 >= 0f) && !Mathf.Approximately(num15 - this.m_MaxJumpAcrossDistance.floatValue, 0f))
            {
                this.m_MaxJumpAcrossDistance.floatValue = num15;
            }
            EditorGUILayout.Space();
            this.m_Advanced = GUILayout.Toggle(this.m_Advanced, s_Styles.m_AdvancedHeader, EditorStyles.foldout, new GUILayoutOption[0]);
            if (this.m_Advanced)
            {
                EditorGUI.indentLevel++;
                bool flag = EditorGUILayout.Toggle(s_Styles.m_ManualCellSizeContent, this.m_ManualCellSize.boolValue, new GUILayoutOption[0]);
                if (flag != this.m_ManualCellSize.boolValue)
                {
                    this.m_ManualCellSize.boolValue = flag;
                    if (!flag)
                    {
                        this.m_CellSize.floatValue = (2f * this.m_AgentRadius.floatValue) / 6f;
                    }
                }
                EditorGUI.BeginDisabledGroup(!this.m_ManualCellSize.boolValue);
                EditorGUI.indentLevel++;
                float num16 = EditorGUILayout.FloatField(s_Styles.m_CellSizeContent, this.m_CellSize.floatValue, new GUILayoutOption[0]);
                if ((num16 > 0f) && !Mathf.Approximately(num16 - this.m_CellSize.floatValue, 0f))
                {
                    this.m_CellSize.floatValue = Math.Max(0.01f, num16);
                }
                if (num16 < 0.01f)
                {
                    EditorGUILayout.HelpBox("The voxel size should be larger than 0.01.", MessageType.Warning);
                }
                float num17 = (this.m_CellSize.floatValue <= 0f) ? 0f : (this.m_AgentRadius.floatValue / this.m_CellSize.floatValue);
                EditorGUILayout.LabelField(" ", num17.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel, new GUILayoutOption[0]);
                if (this.m_ManualCellSize.boolValue)
                {
                    float num19 = this.m_CellSize.floatValue * 0.5f;
                    if (((int)Mathf.Floor(this.m_AgentHeight.floatValue / num19)) > 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 (num17 < 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 (num17 > 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 num23 = EditorGUILayout.FloatField(s_Styles.m_MinRegionAreaContent, this.m_MinRegionArea.floatValue, new GUILayoutOption[0]);
                if ((num23 >= 0f) && (num23 != this.m_MinRegionArea.floatValue))
                {
                    this.m_MinRegionArea.floatValue = num23;
                }
                EditorGUILayout.Space();
                bool flag2 = EditorGUILayout.Toggle(s_Styles.m_AgentPlacementContent, this.m_AccuratePlacement.boolValue, new GUILayoutOption[0]);
                if (flag2 != this.m_AccuratePlacement.boolValue)
                {
                    this.m_AccuratePlacement.boolValue = flag2;
                }
                EditorGUI.indentLevel--;
            }
            if (Unsupported.IsDeveloperBuild())
            {
                EditorGUILayout.Space();
                GUILayout.Label("Internal Bake Debug Options", EditorStyles.boldLabel, new GUILayoutOption[0]);
                EditorGUILayout.HelpBox("Note: The debug visualization is build during bake, so you'll need to bake for these settings to take effect.", MessageType.None);
                bool showAutoOffMeshLinkSampling = NavMeshVisualizationSettings.showAutoOffMeshLinkSampling;
                if (showAutoOffMeshLinkSampling != EditorGUILayout.Toggle(new GUIContent("Show Auto-Off-MeshLink Sampling"), showAutoOffMeshLinkSampling, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showAutoOffMeshLinkSampling = !showAutoOffMeshLinkSampling;
                }
                bool showVoxels = NavMeshVisualizationSettings.showVoxels;
                if (showVoxels != EditorGUILayout.Toggle(new GUIContent("Show Voxels"), showVoxels, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showVoxels = !showVoxels;
                }
                bool showWalkable = NavMeshVisualizationSettings.showWalkable;
                if (showWalkable != EditorGUILayout.Toggle(new GUIContent("Show Walkable"), showWalkable, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showWalkable = !showWalkable;
                }
                bool showRawContours = NavMeshVisualizationSettings.showRawContours;
                if (showRawContours != EditorGUILayout.Toggle(new GUIContent("Show Raw Contours"), showRawContours, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showRawContours = !showRawContours;
                }
                bool showContours = NavMeshVisualizationSettings.showContours;
                if (showContours != EditorGUILayout.Toggle(new GUIContent("Show Contours"), showContours, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showContours = !showContours;
                }
                bool showInputs = NavMeshVisualizationSettings.showInputs;
                if (showInputs != EditorGUILayout.Toggle(new GUIContent("Show Inputs"), showInputs, new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.showInputs = !showInputs;
                }
                if (GUILayout.Button("Clear Visualiation Data", new GUILayoutOption[0]))
                {
                    NavMeshVisualizationSettings.ClearVisualizationData();
                    RepaintSceneAndGameViews();
                }
                EditorGUILayout.Space();
            }
        }
コード例 #18
0
ファイル: SplitView.cs プロジェクト: zlhtech/unity-decompiled
        public void SplitGUI(Event evt)
        {
            if (this.splitState == null)
            {
                this.SetupSplitter();
            }
            SplitView parent = this.parent as SplitView;

            if ((bool)((Object)parent))
            {
                Event evt1 = new Event(evt);
                evt1.mousePosition += new Vector2(this.position.x, this.position.y);
                parent.SplitGUI(evt1);
                if (evt1.type == EventType.Used)
                {
                    evt.Use();
                }
            }
            float num1      = !this.vertical ? evt.mousePosition.x : evt.mousePosition.y;
            int   controlId = GUIUtility.GetControlID(546739, FocusType.Passive);

            this.controlID = controlId;
            switch (evt.GetTypeForControl(controlId))
            {
            case EventType.MouseDown:
                if (this.children.Length == 1)
                {
                    break;
                }
                int num2 = !this.vertical ? (int)this.children[0].position.x : (int)this.children[0].position.y;
                for (int index = 0; index < this.children.Length - 1; ++index)
                {
                    if (index >= this.splitState.realSizes.Length)
                    {
                        DockArea current = GUIView.current as DockArea;
                        string   str     = "Non-dock area " + (object)GUIView.current.GetType();
                        if ((bool)((Object)current) && current.m_Selected < current.m_Panes.Count && (bool)((Object)current.m_Panes[current.m_Selected]))
                        {
                            str = current.m_Panes[current.m_Selected].GetType().ToString();
                        }
                        if (Unsupported.IsDeveloperBuild())
                        {
                            Debug.LogError((object)("Real sizes out of bounds for: " + str + " index: " + (object)index + " RealSizes: " + (object)this.splitState.realSizes.Length));
                        }
                        this.SetupSplitter();
                    }
                    if ((!this.vertical ? new Rect((float)(num2 + this.splitState.realSizes[index] - this.splitState.splitSize / 2), this.children[0].position.y, (float)this.splitState.splitSize, this.children[0].position.height) : new Rect(this.children[0].position.x, (float)(num2 + this.splitState.realSizes[index] - this.splitState.splitSize / 2), this.children[0].position.width, (float)this.splitState.splitSize)).Contains(evt.mousePosition))
                    {
                        this.splitState.splitterInitialOffset = (int)num1;
                        this.splitState.currentActiveSplitter = index;
                        GUIUtility.hotControl = controlId;
                        evt.Use();
                        break;
                    }
                    num2 += this.splitState.realSizes[index];
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl != controlId)
                {
                    break;
                }
                GUIUtility.hotControl = 0;
                break;

            case EventType.MouseDrag:
                if (this.children.Length <= 1 || GUIUtility.hotControl != controlId || this.splitState.currentActiveSplitter < 0)
                {
                    break;
                }
                int diff = (int)num1 - this.splitState.splitterInitialOffset;
                if (diff != 0)
                {
                    this.splitState.splitterInitialOffset = (int)num1;
                    this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, diff);
                }
                this.SetupRectsFromSplitter();
                evt.Use();
                break;
            }
        }
コード例 #19
0
        protected override void OldOnGUI()
        {
            const float space               = 10;
            const float largeSpace          = 20;
            const float standardButtonWidth = 32;
            const float dropdownWidth       = 80;
            const float playPauseStopWidth  = 140;

            InitializeToolIcons();

            bool isOrWillEnterPlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            GUI.color = isOrWillEnterPlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                Styles.appToolbar.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            // Position left aligned controls controls - start from left to right.
            Rect pos = new Rect(0, 0, 0, 0);

            ReserveWidthRight(space, ref pos);

            ReserveWidthRight(standardButtonWidth * s_ShownToolIcons.Length, ref pos);
            DoToolButtons(EditorToolGUI.GetThickArea(pos));

            ReserveWidthRight(largeSpace, ref pos);

            int playModeControlsStart = Mathf.RoundToInt((position.width - playPauseStopWidth) / 2);

            pos.x    += pos.width;
            pos.width = (playModeControlsStart - pos.x) - largeSpace;
            DoToolSettings(EditorToolGUI.GetThickArea(pos));

            // Position centered controls.
            pos = new Rect(playModeControlsStart, 0, 240, 0);

            if (ModeService.HasCapability(ModeCapability.Playbar, true))
            {
                GUILayout.BeginArea(EditorToolGUI.GetThickArea(pos));
                GUILayout.BeginHorizontal();
                {
                    if (!ModeService.Execute("gui_playbar", isOrWillEnterPlaymode))
                    {
                        DoPlayButtons(isOrWillEnterPlaymode);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            // Position right aligned controls controls - start from right to left.
            pos = new Rect(position.width, 0, 0, 0);

            // Right spacing side
            ReserveWidthLeft(space, ref pos);
            ReserveWidthLeft(dropdownWidth, ref pos);
            DoLayoutDropDown(EditorToolGUI.GetThinArea(pos));

            if (ModeService.HasCapability(ModeCapability.Layers, true))
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                DoLayersDropDown(EditorToolGUI.GetThinArea(pos));
            }

            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(dropdownWidth, ref pos);
            if (EditorGUI.DropdownButton(EditorToolGUI.GetThinArea(pos), s_AccountContent, FocusType.Passive, Styles.dropdown))
            {
                ShowUserMenu(EditorToolGUI.GetThinArea(pos));
            }

            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(standardButtonWidth, ref pos);
            if (GUI.Button(EditorToolGUI.GetThinArea(pos), s_CloudIcon, Styles.command))
            {
                UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true, "cloud_icon"); // Should show hub when it's done
            }
            foreach (SubToolbar subToolbar in s_SubToolbars)
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(subToolbar.Width, ref pos);
                subToolbar.OnGUI(EditorToolGUI.GetThinArea(pos));
            }


            if (ModeService.modeCount > 1 && Unsupported.IsDeveloperBuild())
            {
                EditorGUI.BeginChangeCheck();
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                var selectedModeIndex = EditorGUI.Popup(EditorToolGUI.GetThinArea(pos), ModeService.currentIndex, ModeService.modeNames, Styles.dropdown);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorApplication.delayCall += () => ModeService.ChangeModeByIndex(selectedModeIndex);
                    GUIUtility.ExitGUI();
                }
            }

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
コード例 #20
0
        public void SplitGUI(Event evt)
        {
            if (this.splitState == null)
            {
                this.SetupSplitter();
            }
            SplitView parent = base.parent as SplitView;

            if (parent != null)
            {
                Event event2 = new Event(evt);
                event2.mousePosition += new Vector2(base.position.x, base.position.y);
                parent.SplitGUI(event2);
                if (event2.type == EventType.Used)
                {
                    evt.Use();
                }
            }
            float num       = !this.vertical ? evt.mousePosition.x : evt.mousePosition.y;
            int   controlID = GUIUtility.GetControlID(0x857b3, FocusType.Passive);

            this.controlID = controlID;
            EventType typeForControl = evt.GetTypeForControl(controlID);

            if (typeForControl == EventType.MouseDown)
            {
                if (base.children.Length != 1)
                {
                    int num3 = !this.vertical ? ((int)base.children[0].position.x) : ((int)base.children[0].position.y);
                    for (int i = 0; i < (base.children.Length - 1); i++)
                    {
                        if (i >= this.splitState.realSizes.Length)
                        {
                            DockArea current = GUIView.current as DockArea;
                            string   str     = "Non-dock area " + GUIView.current.GetType();
                            if (((current != null) && (current.m_Selected < current.m_Panes.Count)) && (current.m_Panes[current.m_Selected] != null))
                            {
                                str = current.m_Panes[current.m_Selected].GetType().ToString();
                            }
                            if (Unsupported.IsDeveloperBuild())
                            {
                                Debug.LogError(string.Concat(new object[] { "Real sizes out of bounds for: ", str, " index: ", i, " RealSizes: ", this.splitState.realSizes.Length }));
                            }
                            this.SetupSplitter();
                        }
                        Rect rect5 = !this.vertical ? new Rect((float)((num3 + this.splitState.realSizes[i]) - (this.splitState.splitSize / 2)), base.children[0].position.y, (float)this.splitState.splitSize, base.children[0].position.height) : new Rect(base.children[0].position.x, (float)((num3 + this.splitState.realSizes[i]) - (this.splitState.splitSize / 2)), base.children[0].position.width, (float)this.splitState.splitSize);
                        if (rect5.Contains(evt.mousePosition))
                        {
                            this.splitState.splitterInitialOffset = (int)num;
                            this.splitState.currentActiveSplitter = i;
                            GUIUtility.hotControl = controlID;
                            evt.Use();
                            break;
                        }
                        num3 += this.splitState.realSizes[i];
                    }
                }
            }
            else if (typeForControl == EventType.MouseDrag)
            {
                if (((base.children.Length > 1) && (GUIUtility.hotControl == controlID)) && (this.splitState.currentActiveSplitter >= 0))
                {
                    int diff = ((int)num) - this.splitState.splitterInitialOffset;
                    if (diff != 0)
                    {
                        this.splitState.splitterInitialOffset = (int)num;
                        this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, diff);
                    }
                    this.SetupRectsFromSplitter();
                    evt.Use();
                }
            }
            else if ((typeForControl == EventType.MouseUp) && (GUIUtility.hotControl == controlID))
            {
                GUIUtility.hotControl = 0;
            }
        }
コード例 #21
0
        private void Summary()
        {
            GUILayout.BeginVertical(EditorStyles.helpBox, new GUILayoutOption[0]);
            long num  = 0L;
            int  num2 = 0;
            Dictionary <Vector2, int> dictionary = new Dictionary <Vector2, int>();
            bool flag  = false;
            bool flag2 = false;

            LightmapData[] lightmaps = LightmapSettings.lightmaps;
            for (int i = 0; i < lightmaps.Length; i++)
            {
                LightmapData lightmapData = lightmaps[i];
                if (!(lightmapData.lightmapColor == null))
                {
                    num2++;
                    Vector2 vector = new Vector2((float)lightmapData.lightmapColor.width, (float)lightmapData.lightmapColor.height);
                    if (dictionary.ContainsKey(vector))
                    {
                        Dictionary <Vector2, int> dictionary2;
                        Vector2 key;
                        (dictionary2 = dictionary)[key = vector] = dictionary2[key] + 1;
                    }
                    else
                    {
                        dictionary.Add(vector, 1);
                    }
                    num += TextureUtil.GetStorageMemorySizeLong(lightmapData.lightmapColor);
                    if (lightmapData.lightmapDir)
                    {
                        num += TextureUtil.GetStorageMemorySizeLong(lightmapData.lightmapDir);
                        flag = true;
                    }
                    if (lightmapData.shadowMask)
                    {
                        num  += TextureUtil.GetStorageMemorySizeLong(lightmapData.shadowMask);
                        flag2 = true;
                    }
                }
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(num2);
            stringBuilder.Append((!flag) ? " non-directional" : " directional");
            stringBuilder.Append(" lightmap");
            if (num2 != 1)
            {
                stringBuilder.Append("s");
            }
            if (flag2)
            {
                stringBuilder.Append(" with shadowmask");
                if (num2 != 1)
                {
                    stringBuilder.Append("s");
                }
            }
            bool flag3 = true;

            foreach (KeyValuePair <Vector2, int> current in dictionary)
            {
                stringBuilder.Append((!flag3) ? ", " : ": ");
                flag3 = false;
                if (current.Value > 1)
                {
                    stringBuilder.Append(current.Value);
                    stringBuilder.Append("x");
                }
                stringBuilder.Append(current.Key.x);
                stringBuilder.Append("x");
                stringBuilder.Append(current.Key.y);
                stringBuilder.Append("px");
            }
            stringBuilder.Append(" ");
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label(stringBuilder.ToString(), LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label(EditorUtility.FormatBytes(num), LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
            GUILayout.Label((num2 != 0) ? "" : "No Lightmaps", LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            if (LightmapEditorSettings.giBakeBackend == LightmapEditorSettings.GIBakeBackend.PathTracer)
            {
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.Label("Occupied texels: " + InternalEditorUtility.CountToString(Lightmapping.occupiedTexelCount), LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                if (Lightmapping.isRunning)
                {
                    int num3  = 0;
                    int num4  = 0;
                    int num5  = 0;
                    int num6  = 0;
                    int num7  = 0;
                    int num8  = 0;
                    int num9  = 0;
                    int num10 = LightmapSettings.lightmaps.Length;
                    for (int j = 0; j < num10; j++)
                    {
                        LightmapConvergence lightmapConvergence = Lightmapping.GetLightmapConvergence(j);
                        if (!lightmapConvergence.IsValid())
                        {
                            num9++;
                        }
                        else if (Lightmapping.GetVisibleTexelCount(j) > 0uL)
                        {
                            num3++;
                            if (lightmapConvergence.IsConverged())
                            {
                                num4++;
                            }
                            else
                            {
                                num5++;
                            }
                        }
                        else
                        {
                            num6++;
                            if (lightmapConvergence.IsConverged())
                            {
                                num7++;
                            }
                            else
                            {
                                num8++;
                            }
                        }
                    }
                    EditorGUILayout.LabelField("Lightmaps in view: " + num3, LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField("converged: " + num4, LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                    EditorGUILayout.LabelField("not converged: " + num5, LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                    EditorGUI.indentLevel--;
                    EditorGUILayout.LabelField("Lightmaps out of view: " + num6, LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.LabelField("converged: " + num7, LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                    EditorGUILayout.LabelField("not converged: " + num8, LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                    EditorGUI.indentLevel--;
                }
                float lightmapBakeTimeTotal        = Lightmapping.GetLightmapBakeTimeTotal();
                float lightmapBakePerformanceTotal = Lightmapping.GetLightmapBakePerformanceTotal();
                if ((double)lightmapBakePerformanceTotal >= 0.0)
                {
                    GUILayout.Label("Bake performance: " + lightmapBakePerformanceTotal.ToString("0.00") + " mrays/sec", LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                }
                if (!Lightmapping.isRunning)
                {
                    float lightmapBakeTimeRaw = Lightmapping.GetLightmapBakeTimeRaw();
                    if ((double)lightmapBakeTimeTotal >= 0.0)
                    {
                        int num11 = (int)lightmapBakeTimeTotal;
                        int num12 = num11 / 3600;
                        num11 -= 3600 * num12;
                        int num13 = num11 / 60;
                        num11 -= 60 * num13;
                        int num14 = num11;
                        int num15 = (int)lightmapBakeTimeRaw;
                        int num16 = num15 / 3600;
                        num15 -= 3600 * num16;
                        int num17 = num15 / 60;
                        num15 -= 60 * num17;
                        int num18 = num15;
                        int num19 = Math.Max(0, (int)(lightmapBakeTimeTotal - lightmapBakeTimeRaw));
                        int num20 = num19 / 3600;
                        num19 -= 3600 * num20;
                        int num21 = num19 / 60;
                        num19 -= 60 * num21;
                        int num22 = num19;
                        GUILayout.Label(string.Concat(new string[]
                        {
                            "Total bake time: ",
                            num12.ToString("0"),
                            ":",
                            num13.ToString("00"),
                            ":",
                            num14.ToString("00")
                        }), LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                        if (Unsupported.IsDeveloperBuild())
                        {
                            GUILayout.Label(string.Concat(new string[]
                            {
                                "(Raw bake time: ",
                                num16.ToString("0"),
                                ":",
                                num17.ToString("00"),
                                ":",
                                num18.ToString("00"),
                                ", overhead:",
                                num20.ToString("0"),
                                ":",
                                num21.ToString("00"),
                                ":",
                                num22.ToString("00"),
                                ")"
                            }), LightingWindow.Styles.labelStyle, new GUILayoutOption[0]);
                        }
                    }
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
        }
コード例 #22
0
        private void BakeSettings()
        {
            EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            this.DrawAgentDiagram(EditorGUILayout.GetControlRect(false, 120f, new GUILayoutOption[0]), this.m_AgentRadius.floatValue, this.m_AgentHeight.floatValue, this.m_AgentClimb.floatValue, this.m_AgentSlope.floatValue);
            float num1 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentRadiusContent, this.m_AgentRadius.floatValue, new GUILayoutOption[0]);

            if ((double)num1 >= 1.0 / 1000.0 && !Mathf.Approximately(num1 - this.m_AgentRadius.floatValue, 0.0f))
            {
                this.m_AgentRadius.floatValue = num1;
                if (!this.m_ManualCellSize.boolValue)
                {
                    this.m_CellSize.floatValue = (float)(2.0 * (double)this.m_AgentRadius.floatValue / 6.0);
                }
            }
            if ((double)this.m_AgentRadius.floatValue < 0.0500000007450581 && !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 ((double)num2 >= 1.0 / 1000.0 && !Mathf.Approximately(num2 - this.m_AgentHeight.floatValue, 0.0f))
            {
                this.m_AgentHeight.floatValue = num2;
            }
            EditorGUILayout.Slider(this.m_AgentSlope, 0.0f, 60f, NavMeshEditorWindow.s_Styles.m_AgentSlopeContent, new GUILayoutOption[0]);
            if ((double)this.m_AgentSlope.floatValue > 60.0)
            {
                EditorGUILayout.HelpBox("The maximum slope should be set to less than " + (object)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 ((double)num3 >= 0.0 && !Mathf.Approximately(this.m_AgentClimb.floatValue - num3, 0.0f))
            {
                this.m_AgentClimb.floatValue = num3;
            }
            if ((double)this.m_AgentClimb.floatValue > (double)this.m_AgentHeight.floatValue)
            {
                EditorGUILayout.HelpBox("Step height should be less than agent height.\nClamping step height to " + (object)this.m_AgentHeight.floatValue + " internally when baking.", MessageType.Warning);
            }
            float floatValue = this.m_CellSize.floatValue;
            float num4       = floatValue * 0.5f;
            int   num5       = (int)Mathf.Ceil(this.m_AgentClimb.floatValue / num4);
            int   num6       = (int)Mathf.Ceil(Mathf.Tan((float)((double)this.m_AgentSlope.floatValue / 180.0 * 3.14159274101257)) * floatValue * 2f / num4);

            if (num6 > num5)
            {
                EditorGUILayout.HelpBox("Step Height conflicts with Max Slope. This makes some slopes unwalkable.\nConsider decreasing Max Slope to < " + ((float)((double)Mathf.Atan((float)((double)num5 * (double)num4 / ((double)floatValue * 2.0))) / 3.14159274101257 * 180.0)).ToString("0.0") + " degrees.\nOr, increase Step Height to > " + ((float)(num6 - 1) * num4).ToString("0.00") + ".", MessageType.Warning);
            }
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_OffmeshHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            float num7 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentDropContent, this.m_LedgeDropHeight.floatValue, new GUILayoutOption[0]);

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

            if ((double)num8 >= 0.0 && !Mathf.Approximately(num8 - this.m_MaxJumpAcrossDistance.floatValue, 0.0f))
            {
                this.m_MaxJumpAcrossDistance.floatValue = num8;
            }
            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 flag1 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_ManualCellSizeContent, this.m_ManualCellSize.boolValue, new GUILayoutOption[0]);
                if (flag1 != this.m_ManualCellSize.boolValue)
                {
                    this.m_ManualCellSize.boolValue = flag1;
                    if (!flag1)
                    {
                        this.m_CellSize.floatValue = (float)(2.0 * (double)this.m_AgentRadius.floatValue / 6.0);
                    }
                }
                EditorGUI.BeginDisabledGroup(!this.m_ManualCellSize.boolValue);
                ++EditorGUI.indentLevel;
                float val2 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_CellSizeContent, this.m_CellSize.floatValue, new GUILayoutOption[0]);
                if ((double)val2 > 0.0 && !Mathf.Approximately(val2 - this.m_CellSize.floatValue, 0.0f))
                {
                    this.m_CellSize.floatValue = Math.Max(0.01f, val2);
                }
                if ((double)val2 < 0.00999999977648258)
                {
                    EditorGUILayout.HelpBox("The voxel size should be larger than 0.01.", MessageType.Warning);
                }
                float num9 = (double)this.m_CellSize.floatValue <= 0.0 ? 0.0f : this.m_AgentRadius.floatValue / this.m_CellSize.floatValue;
                EditorGUILayout.LabelField(" ", num9.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel, new GUILayoutOption[0]);
                if (this.m_ManualCellSize.boolValue)
                {
                    if ((int)Mathf.Floor(this.m_AgentHeight.floatValue / (this.m_CellSize.floatValue * 0.5f)) > 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 " + ((float)((double)this.m_AgentHeight.floatValue / 250.0 / 0.5)).ToString("0.000") + ".", MessageType.Warning);
                    }
                    if ((double)num9 < 1.0)
                    {
                        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 ((double)num9 > 8.0)
                    {
                        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 num10 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_MinRegionAreaContent, this.m_MinRegionArea.floatValue, new GUILayoutOption[0]);
                if ((double)num10 >= 0.0 && (double)num10 != (double)this.m_MinRegionArea.floatValue)
                {
                    this.m_MinRegionArea.floatValue = num10;
                }
                EditorGUILayout.Space();
                bool flag2 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_AgentPlacementContent, this.m_AccuratePlacement.boolValue, new GUILayoutOption[0]);
                if (flag2 != this.m_AccuratePlacement.boolValue)
                {
                    this.m_AccuratePlacement.boolValue = flag2;
                }
                --EditorGUI.indentLevel;
            }
            if (!Unsupported.IsDeveloperBuild())
            {
                return;
            }
            EditorGUILayout.Space();
            GUILayout.Label("Internal Bake Debug Options", EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.HelpBox("Note: The debug visualization is build during bake, so you'll need to bake for these settings to take effect.", MessageType.None);
            bool meshLinkSampling = NavMeshVisualizationSettings.showAutoOffMeshLinkSampling;

            if (meshLinkSampling != EditorGUILayout.Toggle(new GUIContent("Show Auto-Off-MeshLink Sampling"), meshLinkSampling, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showAutoOffMeshLinkSampling = !meshLinkSampling;
            }
            bool showVoxels = NavMeshVisualizationSettings.showVoxels;

            if (showVoxels != EditorGUILayout.Toggle(new GUIContent("Show Voxels"), showVoxels, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showVoxels = !showVoxels;
            }
            bool showWalkable = NavMeshVisualizationSettings.showWalkable;

            if (showWalkable != EditorGUILayout.Toggle(new GUIContent("Show Walkable"), showWalkable, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showWalkable = !showWalkable;
            }
            bool showRawContours = NavMeshVisualizationSettings.showRawContours;

            if (showRawContours != EditorGUILayout.Toggle(new GUIContent("Show Raw Contours"), showRawContours, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showRawContours = !showRawContours;
            }
            bool showContours = NavMeshVisualizationSettings.showContours;

            if (showContours != EditorGUILayout.Toggle(new GUIContent("Show Contours"), showContours, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showContours = !showContours;
            }
            bool showInputs = NavMeshVisualizationSettings.showInputs;

            if (showInputs != EditorGUILayout.Toggle(new GUIContent("Show Inputs"), showInputs, new GUILayoutOption[0]))
            {
                NavMeshVisualizationSettings.showInputs = !showInputs;
            }
            if (GUILayout.Button("Clear Visualiation Data"))
            {
                NavMeshVisualizationSettings.ClearVisualizationData();
                NavMeshEditorWindow.RepaintSceneAndGameViews();
            }
            EditorGUILayout.Space();
        }
コード例 #23
0
        void Summary()
        {
            GUILayout.BeginVertical(EditorStyles.helpBox);

            long totalMemorySize            = 0;
            int  lightmapCount              = 0;
            Dictionary <Vector2, int> sizes = new Dictionary <Vector2, int>();
            bool directionalLightmapsMode   = false;
            bool shadowmaskMode             = false;

            foreach (LightmapData ld in LightmapSettings.lightmaps)
            {
                if (ld.lightmapColor == null)
                {
                    continue;
                }
                lightmapCount++;

                Vector2 texSize = new Vector2(ld.lightmapColor.width, ld.lightmapColor.height);
                if (sizes.ContainsKey(texSize))
                {
                    sizes[texSize]++;
                }
                else
                {
                    sizes.Add(texSize, 1);
                }

                totalMemorySize += TextureUtil.GetStorageMemorySizeLong(ld.lightmapColor);
                if (ld.lightmapDir)
                {
                    totalMemorySize         += TextureUtil.GetStorageMemorySizeLong(ld.lightmapDir);
                    directionalLightmapsMode = true;
                }
                if (ld.shadowMask)
                {
                    totalMemorySize += TextureUtil.GetStorageMemorySizeLong(ld.shadowMask);
                    shadowmaskMode   = true;
                }
            }
            StringBuilder sizesString = new StringBuilder();

            sizesString.Append(lightmapCount);
            sizesString.Append((directionalLightmapsMode ? " Directional" : " Non-Directional"));
            sizesString.Append(" Lightmap");
            if (lightmapCount != 1)
            {
                sizesString.Append("s");
            }
            if (shadowmaskMode)
            {
                sizesString.Append(" with Shadowmask");
                if (lightmapCount != 1)
                {
                    sizesString.Append("s");
                }
            }

            bool first = true;

            foreach (var s in sizes)
            {
                sizesString.Append(first ? ": " : ", ");
                first = false;
                if (s.Value > 1)
                {
                    sizesString.Append(s.Value);
                    sizesString.Append("x");
                }
                sizesString.Append(s.Key.x.ToString(CultureInfo.InvariantCulture.NumberFormat));
                sizesString.Append("x");
                sizesString.Append(s.Key.y.ToString(CultureInfo.InvariantCulture.NumberFormat));
                sizesString.Append("px");
            }
            sizesString.Append(" ");

            GUILayout.BeginHorizontal();

            GUILayout.BeginVertical();
            GUILayout.Label(sizesString.ToString(), Styles.LabelStyle);
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            GUILayout.Label(EditorUtility.FormatBytes(totalMemorySize), Styles.LabelStyle);
            GUILayout.Label((lightmapCount == 0 ? "No Lightmaps" : ""), Styles.LabelStyle);
            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            if (LightmapEditorSettings.lightmapper != LightmapEditorSettings.Lightmapper.Enlighten)
            {
                GUILayout.BeginVertical();
                GUILayout.Label("Occupied Texels: " + InternalEditorUtility.CountToString(Lightmapping.occupiedTexelCount), Styles.LabelStyle);
                if (Lightmapping.isRunning)
                {
                    int numLightmapsInView             = 0;
                    int numConvergedLightmapsInView    = 0;
                    int numNotConvergedLightmapsInView = 0;

                    int numLightmapsNotInView             = 0;
                    int numConvergedLightmapsNotInView    = 0;
                    int numNotConvergedLightmapsNotInView = 0;

                    int numLightmaps = LightmapSettings.lightmaps.Length;
                    for (int i = 0; i < numLightmaps; ++i)
                    {
                        LightmapConvergence lc = Lightmapping.GetLightmapConvergence(i);
                        if (!lc.IsValid())
                        {
                            continue;
                        }

                        if (Lightmapping.GetVisibleTexelCount(i) > 0)
                        {
                            numLightmapsInView++;
                            if (lc.IsConverged())
                            {
                                numConvergedLightmapsInView++;
                            }
                            else
                            {
                                numNotConvergedLightmapsInView++;
                            }
                        }
                        else
                        {
                            numLightmapsNotInView++;
                            if (lc.IsConverged())
                            {
                                numConvergedLightmapsNotInView++;
                            }
                            else
                            {
                                numNotConvergedLightmapsNotInView++;
                            }
                        }
                    }
                    if (Lightmapping.atlasCount > 0)
                    {
                        int convergedMaps = numConvergedLightmapsInView + numConvergedLightmapsNotInView;
                        GUILayout.Label("Lightmap convergence: (" + convergedMaps + "/" + Lightmapping.atlasCount + ")", Styles.LabelStyle);
                    }
                    EditorGUILayout.LabelField("Lightmaps in view: " + numLightmapsInView, Styles.LabelStyle);
                    EditorGUI.indentLevel += 1;
                    EditorGUILayout.LabelField("Converged: " + numConvergedLightmapsInView, Styles.LabelStyle);
                    EditorGUILayout.LabelField("Not Converged: " + numNotConvergedLightmapsInView, Styles.LabelStyle);
                    EditorGUI.indentLevel -= 1;
                    EditorGUILayout.LabelField("Lightmaps not in view: " + numLightmapsNotInView, Styles.LabelStyle);
                    EditorGUI.indentLevel += 1;
                    EditorGUILayout.LabelField("Converged: " + numConvergedLightmapsNotInView, Styles.LabelStyle);
                    EditorGUILayout.LabelField("Not Converged: " + numNotConvergedLightmapsNotInView, Styles.LabelStyle);
                    EditorGUI.indentLevel -= 1;

                    LightProbesConvergence lpc = Lightmapping.GetLightProbesConvergence();
                    if (lpc.IsValid() && lpc.probeSetCount > 0)
                    {
                        GUILayout.Label("Light Probes convergence: (" + lpc.convergedProbeSetCount + "/" + lpc.probeSetCount + ")", Styles.LabelStyle);
                    }
                }
                float bakeTime    = Lightmapping.GetLightmapBakeTimeTotal();
                float mraysPerSec = Lightmapping.GetLightmapBakePerformanceTotal();
                if (mraysPerSec >= 0.0)
                {
                    GUILayout.Label("Bake Performance: " + mraysPerSec.ToString("0.00", CultureInfo.InvariantCulture.NumberFormat) + " mrays/sec", Styles.LabelStyle);
                }
                if (!Lightmapping.isRunning)
                {
                    float bakeTimeRaw = Lightmapping.GetLightmapBakeTimeRaw();
                    if (bakeTime >= 0.0)
                    {
                        int time  = (int)bakeTime;
                        int timeH = time / 3600;
                        time -= 3600 * timeH;
                        int timeM = time / 60;
                        time -= 60 * timeM;
                        int timeS = time;

                        int timeRaw  = (int)bakeTimeRaw;
                        int timeRawH = timeRaw / 3600;
                        timeRaw -= 3600 * timeRawH;
                        int timeRawM = timeRaw / 60;
                        timeRaw -= 60 * timeRawM;
                        int timeRawS = timeRaw;

                        int oHeadTime  = Math.Max(0, (int)(bakeTime - bakeTimeRaw));
                        int oHeadTimeH = oHeadTime / 3600;
                        oHeadTime -= 3600 * oHeadTimeH;
                        int oHeadTimeM = oHeadTime / 60;
                        oHeadTime -= 60 * oHeadTimeM;
                        int oHeadTimeS = oHeadTime;


                        GUILayout.Label("Total Bake Time: " + timeH.ToString("0") + ":" + timeM.ToString("00") + ":" + timeS.ToString("00"), Styles.LabelStyle);
                        if (Unsupported.IsDeveloperBuild())
                        {
                            GUILayout.Label("(Raw Bake Time: " + timeRawH.ToString("0") + ":" + timeRawM.ToString("00") + ":" + timeRawS.ToString("00") + ", Overhead: " + oHeadTimeH.ToString("0") + ":" + oHeadTimeM.ToString("00") + ":" + oHeadTimeS.ToString("00") + ")", Styles.LabelStyle);
                        }
                    }
                }
                string deviceName = Lightmapping.GetLightmapBakeGPUDeviceName();
                if (deviceName.Length > 0)
                {
                    GUILayout.Label("Baking device: " + deviceName, Styles.LabelStyle);
                }
                GUILayout.EndVertical();
            }

            GUILayout.EndVertical();
        }
コード例 #24
0
        public override Texture2D RenderStaticPreview(string assetPath, UnityEngine.Object[] subAssets, int width, int height)
        {
            Texture2D result;

            if (!ShaderUtil.hardwareSupportsRectRenderTexture)
            {
                result = null;
            }
            else
            {
                Texture texture = base.target as Texture;
                if (this.IsCubemap())
                {
                    result = this.m_CubemapPreview.RenderStaticPreview(texture, width, height);
                }
                else
                {
                    TextureImporter textureImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;
                    if (textureImporter != null && textureImporter.textureType == TextureImporterType.Sprite && textureImporter.spriteImportMode == SpriteImportMode.Polygon)
                    {
                        Sprite sprite = subAssets[0] as Sprite;
                        if (sprite)
                        {
                            result = SpriteInspector.BuildPreviewTexture(width, height, sprite, null, true);
                            return(result);
                        }
                    }
                    PreviewHelpers.AdjustWidthAndHeightForStaticPreview(texture.width, texture.height, ref width, ref height);
                    RenderTexture active          = RenderTexture.active;
                    Rect          rawViewportRect = ShaderUtil.rawViewportRect;
                    bool          flag            = !TextureUtil.GetLinearSampled(texture);
                    RenderTexture temporary       = RenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.Default, (!flag) ? RenderTextureReadWrite.Linear : RenderTextureReadWrite.sRGB);
                    Material      material        = EditorGUI.GetMaterialForSpecialTexture(texture);
                    GL.sRGBWrite = (QualitySettings.activeColorSpace == ColorSpace.Linear);
                    if (material)
                    {
                        if (Unsupported.IsDeveloperBuild())
                        {
                            material = new Material(material);
                        }
                        Graphics.Blit(texture, temporary, material);
                    }
                    else
                    {
                        Graphics.Blit(texture, temporary);
                    }
                    GL.sRGBWrite         = false;
                    RenderTexture.active = temporary;
                    Texture2D texture2D = base.target as Texture2D;
                    Texture2D texture2D2;
                    if (texture2D != null && texture2D.alphaIsTransparency)
                    {
                        texture2D2 = new Texture2D(width, height, TextureFormat.RGBA32, false);
                    }
                    else
                    {
                        texture2D2 = new Texture2D(width, height, TextureFormat.RGB24, false);
                    }
                    texture2D2.ReadPixels(new Rect(0f, 0f, (float)width, (float)height), 0, 0);
                    texture2D2.Apply();
                    RenderTexture.ReleaseTemporary(temporary);
                    EditorGUIUtility.SetRenderTextureNoViewport(active);
                    ShaderUtil.rawViewportRect = rawViewportRect;
                    if (material && Unsupported.IsDeveloperBuild())
                    {
                        UnityEngine.Object.DestroyImmediate(material);
                    }
                    result = texture2D2;
                }
            }
            return(result);
        }
コード例 #25
0
        private void OnGUI()
        {
            int dirtyCount = PhysicsVisualizationSettings.dirtyCount;

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            PhysicsVisualizationSettings.filterWorkflow = (PhysicsVisualizationSettings.FilterWorkflow)EditorGUILayout.EnumPopup(PhysicsVisualizationSettings.filterWorkflow, EditorStyles.toolbarPopup, new GUILayoutOption[]
            {
                GUILayout.Width(130f)
            });
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Reset", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                PhysicsVisualizationSettings.Reset();
            }
            EditorGUILayout.EndHorizontal();
            this.m_MainScrollPos = GUILayout.BeginScrollView(this.m_MainScrollPos, new GUILayoutOption[0]);
            PhysicsVisualizationSettings.FilterWorkflow filterWorkflow = PhysicsVisualizationSettings.filterWorkflow;
            string str  = (filterWorkflow != PhysicsVisualizationSettings.FilterWorkflow.ShowSelectedItems) ? "Hide " : "Show ";
            int    mask = InternalEditorUtility.LayerMaskToConcatenatedLayersMask(PhysicsVisualizationSettings.GetShowCollisionLayerMask(filterWorkflow));
            int    concatenatedLayersMask = EditorGUILayout.MaskField(GUIContent.Temp(str + "Layers", str + "selected layers"), mask, InternalEditorUtility.layers, new GUILayoutOption[0]);

            PhysicsVisualizationSettings.SetShowCollisionLayerMask(filterWorkflow, InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(concatenatedLayersMask));
            PhysicsVisualizationSettings.SetShowStaticColliders(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "Static Colliders", str + "collision geometry from Colliders that do not have a Rigidbody"), PhysicsVisualizationSettings.GetShowStaticColliders(filterWorkflow), new GUILayoutOption[0]));
            PhysicsVisualizationSettings.SetShowTriggers(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "Triggers", str + "collision geometry from Colliders that have 'isTrigger' enabled"), PhysicsVisualizationSettings.GetShowTriggers(filterWorkflow), new GUILayoutOption[0]));
            PhysicsVisualizationSettings.SetShowRigidbodies(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "Rigidbodies", str + "collision geometry from Rigidbodies"), PhysicsVisualizationSettings.GetShowRigidbodies(filterWorkflow), new GUILayoutOption[0]));
            PhysicsVisualizationSettings.SetShowKinematicBodies(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "Kinematic Bodies", str + "collision geometry from Kinematic Rigidbodies"), PhysicsVisualizationSettings.GetShowKinematicBodies(filterWorkflow), new GUILayoutOption[0]));
            PhysicsVisualizationSettings.SetShowSleepingBodies(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "Sleeping Bodies", str + "collision geometry from Sleeping Rigidbodies"), PhysicsVisualizationSettings.GetShowSleepingBodies(filterWorkflow), new GUILayoutOption[0]));
            this.m_FilterColliderTypesFoldout = EditorGUILayout.Foldout(this.m_FilterColliderTypesFoldout, "Collider Types");
            if (this.m_FilterColliderTypesFoldout)
            {
                EditorGUI.indentLevel++;
                float labelWidth = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 200f;
                PhysicsVisualizationSettings.SetShowBoxColliders(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "BoxColliders", str + "collision geometry from BoxColliders"), PhysicsVisualizationSettings.GetShowBoxColliders(filterWorkflow), new GUILayoutOption[0]));
                PhysicsVisualizationSettings.SetShowSphereColliders(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "SphereColliders", str + "collision geometry from SphereColliders"), PhysicsVisualizationSettings.GetShowSphereColliders(filterWorkflow), new GUILayoutOption[0]));
                PhysicsVisualizationSettings.SetShowCapsuleColliders(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "CapsuleColliders", str + "collision geometry from CapsuleColliders"), PhysicsVisualizationSettings.GetShowCapsuleColliders(filterWorkflow), new GUILayoutOption[0]));
                PhysicsVisualizationSettings.SetShowMeshColliders(filterWorkflow, PhysicsVisualizationSettings.MeshColliderType.Convex, EditorGUILayout.Toggle(GUIContent.Temp(str + "MeshColliders (convex)", str + "collision geometry from convex MeshColliders"), PhysicsVisualizationSettings.GetShowMeshColliders(filterWorkflow, PhysicsVisualizationSettings.MeshColliderType.Convex), new GUILayoutOption[0]));
                PhysicsVisualizationSettings.SetShowMeshColliders(filterWorkflow, PhysicsVisualizationSettings.MeshColliderType.NonConvex, EditorGUILayout.Toggle(GUIContent.Temp(str + "MeshColliders (concave)", str + "collision geometry from non-convex MeshColliders"), PhysicsVisualizationSettings.GetShowMeshColliders(filterWorkflow, PhysicsVisualizationSettings.MeshColliderType.NonConvex), new GUILayoutOption[0]));
                PhysicsVisualizationSettings.SetShowTerrainColliders(filterWorkflow, EditorGUILayout.Toggle(GUIContent.Temp(str + "TerrainColliders", str + "collision geometry from TerrainColliders"), PhysicsVisualizationSettings.GetShowTerrainColliders(filterWorkflow), new GUILayoutOption[0]));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUI.indentLevel--;
            }
            GUILayout.Space(4f);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            bool flag  = GUILayout.Button(str + "None", "MiniButton", new GUILayoutOption[0]);
            bool flag2 = GUILayout.Button(str + "All", "MiniButton", new GUILayoutOption[0]);

            if (flag || flag2)
            {
                PhysicsVisualizationSettings.SetShowForAllFilters(filterWorkflow, flag2);
            }
            GUILayout.EndHorizontal();
            this.m_ColorFoldout = EditorGUILayout.Foldout(this.m_ColorFoldout, "Colors");
            if (this.m_ColorFoldout)
            {
                EditorGUI.indentLevel++;
                PhysicsVisualizationSettings.staticColor       = EditorGUILayout.ColorField(PhysicsDebugWindow.Contents.staticColor, PhysicsVisualizationSettings.staticColor, false, true, false, PhysicsDebugWindow.Contents.pickerConfig, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.triggerColor      = EditorGUILayout.ColorField(PhysicsDebugWindow.Contents.triggerColor, PhysicsVisualizationSettings.triggerColor, false, true, false, PhysicsDebugWindow.Contents.pickerConfig, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.rigidbodyColor    = EditorGUILayout.ColorField(PhysicsDebugWindow.Contents.rigidbodyColor, PhysicsVisualizationSettings.rigidbodyColor, false, true, false, PhysicsDebugWindow.Contents.pickerConfig, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.kinematicColor    = EditorGUILayout.ColorField(PhysicsDebugWindow.Contents.kinematicColor, PhysicsVisualizationSettings.kinematicColor, false, true, false, PhysicsDebugWindow.Contents.pickerConfig, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.sleepingBodyColor = EditorGUILayout.ColorField(PhysicsDebugWindow.Contents.sleepingBodyColor, PhysicsVisualizationSettings.sleepingBodyColor, false, true, false, PhysicsDebugWindow.Contents.pickerConfig, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.colorVariance     = EditorGUILayout.Slider("Variation", PhysicsVisualizationSettings.colorVariance, 0f, 1f, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
            }
            this.m_RenderingFoldout = EditorGUILayout.Foldout(this.m_RenderingFoldout, "Rendering");
            if (this.m_RenderingFoldout)
            {
                EditorGUI.indentLevel++;
                PhysicsVisualizationSettings.baseAlpha       = 1f - EditorGUILayout.Slider("Transparency", 1f - PhysicsVisualizationSettings.baseAlpha, 0f, 1f, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.forceOverdraw   = EditorGUILayout.Toggle(PhysicsDebugWindow.Contents.forceOverdraw, PhysicsVisualizationSettings.forceOverdraw, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.viewDistance    = EditorGUILayout.FloatField(PhysicsDebugWindow.Contents.viewDistance, PhysicsVisualizationSettings.viewDistance, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.terrainTilesMax = EditorGUILayout.IntField(PhysicsDebugWindow.Contents.terrainTilesMax, PhysicsVisualizationSettings.terrainTilesMax, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
            }
            if (Unsupported.IsDeveloperBuild() || PhysicsVisualizationSettings.devOptions)
            {
                PhysicsVisualizationSettings.devOptions = EditorGUILayout.Toggle(PhysicsDebugWindow.Contents.devOptions, PhysicsVisualizationSettings.devOptions, new GUILayoutOption[0]);
            }
            if (PhysicsVisualizationSettings.devOptions)
            {
                PhysicsVisualizationSettings.dotAlpha = EditorGUILayout.Slider("dotAlpha", PhysicsVisualizationSettings.dotAlpha, -1f, 1f, new GUILayoutOption[0]);
                PhysicsVisualizationSettings.forceDot = EditorGUILayout.Toggle(PhysicsDebugWindow.Contents.forceDot, PhysicsVisualizationSettings.forceDot, new GUILayoutOption[0]);
                Tools.hidden = EditorGUILayout.Toggle(PhysicsDebugWindow.Contents.toolsHidden, Tools.hidden, new GUILayoutOption[0]);
            }
            GUILayout.EndScrollView();
            if (dirtyCount != PhysicsVisualizationSettings.dirtyCount)
            {
                PhysicsDebugWindow.RepaintSceneAndGameViews();
            }
        }
コード例 #26
0
        public void SplitGUI(Event evt)
        {
            if (this.splitState == null)
            {
                this.SetupSplitter();
            }
            SplitView splitView = base.parent as SplitView;

            if (splitView)
            {
                Event @event = new Event(evt);
                @event.mousePosition += new Vector2(base.position.x, base.position.y);
                splitView.SplitGUI(@event);
                if (@event.type == EventType.Used)
                {
                    evt.Use();
                }
            }
            float num  = (!this.vertical) ? evt.mousePosition.x : evt.mousePosition.y;
            int   num2 = GUIUtility.GetControlID(546739, FocusType.Passive);

            this.controlID = num2;
            EventType typeForControl = evt.GetTypeForControl(num2);

            if (typeForControl != EventType.MouseDown)
            {
                if (typeForControl != EventType.MouseDrag)
                {
                    if (typeForControl == EventType.MouseUp)
                    {
                        if (GUIUtility.hotControl == num2)
                        {
                            GUIUtility.hotControl = 0;
                        }
                    }
                }
                else if (base.children.Length > 1 && GUIUtility.hotControl == num2 && this.splitState.currentActiveSplitter >= 0)
                {
                    int num3 = (int)num - this.splitState.splitterInitialOffset;
                    if (num3 != 0)
                    {
                        this.splitState.splitterInitialOffset = (int)num;
                        this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, num3);
                    }
                    this.SetupRectsFromSplitter();
                    evt.Use();
                }
            }
            else if (base.children.Length != 1)
            {
                int num4 = (!this.vertical) ? ((int)base.children[0].position.x) : ((int)base.children[0].position.y);
                for (int i = 0; i < base.children.Length - 1; i++)
                {
                    if (i >= this.splitState.realSizes.Length)
                    {
                        DockArea dockArea = GUIView.current as DockArea;
                        string   text     = "Non-dock area " + GUIView.current.GetType();
                        if (dockArea && dockArea.m_Selected < dockArea.m_Panes.Count && dockArea.m_Panes[dockArea.m_Selected])
                        {
                            text = dockArea.m_Panes[dockArea.m_Selected].GetType().ToString();
                        }
                        if (Unsupported.IsDeveloperBuild())
                        {
                            Debug.LogError(string.Concat(new object[]
                            {
                                "Real sizes out of bounds for: ",
                                text,
                                " index: ",
                                i,
                                " RealSizes: ",
                                this.splitState.realSizes.Length
                            }));
                        }
                        this.SetupSplitter();
                    }
                    if (((!this.vertical) ? new Rect((float)(num4 + this.splitState.realSizes[i] - this.splitState.splitSize / 2), base.children[0].position.y, (float)this.splitState.splitSize, base.children[0].position.height) : new Rect(base.children[0].position.x, (float)(num4 + this.splitState.realSizes[i] - this.splitState.splitSize / 2), base.children[0].position.width, (float)this.splitState.splitSize)).Contains(evt.mousePosition))
                    {
                        this.splitState.splitterInitialOffset = (int)num;
                        this.splitState.currentActiveSplitter = i;
                        GUIUtility.hotControl = num2;
                        evt.Use();
                        break;
                    }
                    num4 += this.splitState.realSizes[i];
                }
            }
        }