RepaintAll() public static method

public static RepaintAll ( ) : void
return void
示例#1
0
        private void InitEffectUI()
        {
            if (!this.m_IsVisible)
            {
                return;
            }
            ParticleSystem particleSystem = ParticleSystemEditorUtils.lockedParticleSystem;

            if ((Object)particleSystem == (Object)null && (Object)Selection.activeGameObject != (Object)null)
            {
                particleSystem = Selection.activeGameObject.GetComponent <ParticleSystem>();
            }
            this.m_Target = particleSystem;
            if ((Object)this.m_Target != (Object)null)
            {
                if (this.m_ParticleEffectUI == null)
                {
                    this.m_ParticleEffectUI = new ParticleEffectUI((ParticleEffectUIOwner)this);
                }
                if (this.m_ParticleEffectUI.InitializeIfNeeded(this.m_Target))
                {
                    this.Repaint();
                }
            }
            if (!((Object)this.m_Target == (Object)null) || this.m_ParticleEffectUI == null)
            {
                return;
            }
            this.Clear();
            this.Repaint();
            SceneView.RepaintAll();
            GameView.RepaintAll();
        }
示例#2
0
 private void InitEffectUI()
 {
     if (this.m_IsVisible)
     {
         ParticleSystem lockedParticleSystem = ParticleSystemEditorUtils.lockedParticleSystem;
         if ((lockedParticleSystem == null) && (Selection.activeGameObject != null))
         {
             lockedParticleSystem = Selection.activeGameObject.GetComponent <ParticleSystem>();
         }
         this.m_Target = lockedParticleSystem;
         if (this.m_Target != null)
         {
             if (this.m_ParticleEffectUI == null)
             {
                 this.m_ParticleEffectUI = new ParticleEffectUI(this);
             }
             if (this.m_ParticleEffectUI.InitializeIfNeeded(this.m_Target))
             {
                 base.Repaint();
             }
         }
         if ((this.m_Target == null) && (this.m_ParticleEffectUI != null))
         {
             this.Clear();
             base.Repaint();
             SceneView.RepaintAll();
             GameView.RepaintAll();
         }
     }
 }
        public void Clear()
        {
            ParticleSystem root = this.GetRoot();

            if (this.ShouldManagePlaybackState(root) && (root != null))
            {
                PlayState playing;
                if (this.IsPlaying())
                {
                    playing = PlayState.Playing;
                }
                else if (this.IsPaused())
                {
                    playing = PlayState.Paused;
                }
                else
                {
                    playing = PlayState.Stopped;
                }
                int instanceID = root.GetInstanceID();
                SessionState.SetVector3("SimulationState" + instanceID, new Vector3((float)instanceID, (float)playing, ParticleSystemEditorUtils.editorPlaybackTime));
            }
            this.m_ParticleSystemCurveEditor.OnDisable();
            ParticleEffectUtils.ClearPlanes();
            Tools.s_Hidden = false;
            if (root != null)
            {
                SessionState.SetBool("ShowSelected" + root.GetInstanceID(), this.m_ShowOnlySelectedMode);
            }
            this.SetShowOnlySelectedMode(false);
            GameView.RepaintAll();
            SceneView.RepaintAll();
        }
示例#4
0
        private void CommandBufferGUI()
        {
            if (this.targets.Length != 1)
            {
                return;
            }
            Camera target = this.target as Camera;

            if ((UnityEngine.Object)target == (UnityEngine.Object)null)
            {
                return;
            }
            int commandBufferCount = target.commandBufferCount;

            if (commandBufferCount == 0)
            {
                return;
            }
            this.m_CommandBuffersShown = GUILayout.Toggle(this.m_CommandBuffersShown, GUIContent.Temp(commandBufferCount.ToString() + " command buffers"), EditorStyles.foldout, new GUILayoutOption[0]);
            if (!this.m_CommandBuffersShown)
            {
                return;
            }
            ++EditorGUI.indentLevel;
            foreach (CameraEvent evt in (CameraEvent[])Enum.GetValues(typeof(CameraEvent)))
            {
                foreach (CommandBuffer commandBuffer in target.GetCommandBuffers(evt))
                {
                    using (new GUILayout.HorizontalScope(new GUILayoutOption[0]))
                    {
                        Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel);
                        rect.xMin += EditorGUI.indent;
                        Rect removeButtonRect = CameraEditor.GetRemoveButtonRect(rect);
                        rect.xMax = removeButtonRect.x;
                        GUI.Label(rect, string.Format("{0}: {1} ({2})", (object)evt, (object)commandBuffer.name, (object)EditorUtility.FormatBytes(commandBuffer.sizeInBytes)), EditorStyles.miniLabel);
                        if (GUI.Button(removeButtonRect, CameraEditor.Styles.iconRemove, CameraEditor.Styles.invisibleButton))
                        {
                            target.RemoveCommandBuffer(evt, commandBuffer);
                            SceneView.RepaintAll();
                            GameView.RepaintAll();
                            GUIUtility.ExitGUI();
                        }
                    }
                }
            }
            using (new GUILayout.HorizontalScope(new GUILayoutOption[0]))
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Remove all", EditorStyles.miniButton, new GUILayoutOption[0]))
                {
                    target.RemoveAllCommandBuffers();
                    SceneView.RepaintAll();
                    GameView.RepaintAll();
                }
            }
            --EditorGUI.indentLevel;
        }
示例#5
0
 private void CommandBufferGUI()
 {
     if (base.targets.Length == 1)
     {
         Light light = base.target as Light;
         if (!(light == null))
         {
             int commandBufferCount = light.commandBufferCount;
             if (commandBufferCount != 0)
             {
                 this.m_CommandBuffersShown = GUILayout.Toggle(this.m_CommandBuffersShown, GUIContent.Temp(commandBufferCount + " command buffers"), EditorStyles.foldout, new GUILayoutOption[0]);
                 if (this.m_CommandBuffersShown)
                 {
                     EditorGUI.indentLevel++;
                     LightEvent[] array = (LightEvent[])Enum.GetValues(typeof(LightEvent));
                     for (int i = 0; i < array.Length; i++)
                     {
                         LightEvent      lightEvent     = array[i];
                         CommandBuffer[] commandBuffers = light.GetCommandBuffers(lightEvent);
                         CommandBuffer[] array2         = commandBuffers;
                         for (int j = 0; j < array2.Length; j++)
                         {
                             CommandBuffer commandBuffer = array2[j];
                             using (new GUILayout.HorizontalScope(new GUILayoutOption[0]))
                             {
                                 Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel);
                                 rect.xMin += EditorGUI.indent;
                                 Rect removeButtonRect = LightEditor.GetRemoveButtonRect(rect);
                                 rect.xMax = removeButtonRect.x;
                                 GUI.Label(rect, string.Format("{0}: {1} ({2})", lightEvent, commandBuffer.name, EditorUtility.FormatBytes(commandBuffer.sizeInBytes)), EditorStyles.miniLabel);
                                 if (GUI.Button(removeButtonRect, LightEditor.s_Styles.iconRemove, LightEditor.s_Styles.invisibleButton))
                                 {
                                     light.RemoveCommandBuffer(lightEvent, commandBuffer);
                                     SceneView.RepaintAll();
                                     GameView.RepaintAll();
                                     GUIUtility.ExitGUI();
                                 }
                             }
                         }
                     }
                     using (new GUILayout.HorizontalScope(new GUILayoutOption[0]))
                     {
                         GUILayout.FlexibleSpace();
                         if (GUILayout.Button("Remove all", EditorStyles.miniButton, new GUILayoutOption[0]))
                         {
                             light.RemoveAllCommandBuffers();
                             SceneView.RepaintAll();
                             GameView.RepaintAll();
                         }
                     }
                     EditorGUI.indentLevel--;
                 }
             }
         }
     }
 }
示例#6
0
 public void DrawMultiDisplay()
 {
     if (ModuleManager.ShouldShowMultiDisplayOption())
     {
         int prevDisplay = targetDisplay.intValue;
         EditorGUILayout.IntPopup(targetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"));
         if (prevDisplay != targetDisplay.intValue)
         {
             GameView.RepaintAll();
         }
     }
 }
示例#7
0
 private void CommandBufferGUI()
 {
     if (base.targets.Length == 1)
     {
         Camera target = base.target as Camera;
         if (target != null)
         {
             int commandBufferCount = target.commandBufferCount;
             if (commandBufferCount != 0)
             {
                 this.m_CommandBuffersShown = GUILayout.Toggle(this.m_CommandBuffersShown, GUIContent.Temp(commandBufferCount + " command buffers"), EditorStyles.foldout, new GUILayoutOption[0]);
                 if (this.m_CommandBuffersShown)
                 {
                     EditorGUI.indentLevel++;
                     foreach (CameraEvent event2 in (CameraEvent[])Enum.GetValues(typeof(CameraEvent)))
                     {
                         CommandBuffer[] commandBuffers = target.GetCommandBuffers(event2);
                         foreach (CommandBuffer buffer in commandBuffers)
                         {
                             using (new GUILayout.HorizontalScope(new GUILayoutOption[0]))
                             {
                                 Rect r = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel);
                                 r.xMin += EditorGUI.indent;
                                 Rect removeButtonRect = GetRemoveButtonRect(r);
                                 r.xMax = removeButtonRect.x;
                                 GUI.Label(r, $"{event2}: {buffer.name} ({EditorUtility.FormatBytes(buffer.sizeInBytes)})", EditorStyles.miniLabel);
                                 if (GUI.Button(removeButtonRect, Styles.iconRemove, Styles.invisibleButton))
                                 {
                                     target.RemoveCommandBuffer(event2, buffer);
                                     SceneView.RepaintAll();
                                     GameView.RepaintAll();
                                     GUIUtility.ExitGUI();
                                 }
                             }
                         }
                     }
                     using (new GUILayout.HorizontalScope(new GUILayoutOption[0]))
                     {
                         GUILayout.FlexibleSpace();
                         if (GUILayout.Button("Remove all", EditorStyles.miniButton, new GUILayoutOption[0]))
                         {
                             target.RemoveAllCommandBuffers();
                             SceneView.RepaintAll();
                             GameView.RepaintAll();
                         }
                     }
                     EditorGUI.indentLevel--;
                 }
             }
         }
     }
 }
示例#8
0
 public void DrawMultiDisplay()
 {
     if (ModuleManager.ShouldShowMultiDisplayOption())
     {
         int intValue = this.targetDisplay.intValue;
         EditorGUILayout.Space();
         EditorGUILayout.IntPopup(this.targetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
         if (intValue != this.targetDisplay.intValue)
         {
             GameView.RepaintAll();
         }
     }
 }
示例#9
0
        public void Clear()
        {
            ParticleSystem root = ParticleSystemEditorUtils.GetRoot(m_SelectedParticleSystems[0]); // root can have been deleted

            if (ShouldManagePlaybackState(root))
            {
                // Store simulation state of current effect as Vector3 (rootInstanceID, isPlaying, playBackTime)
                if (root != null)
                {
                    PlayState playState;
                    if (IsPlaying())
                    {
                        playState = PlayState.Playing;
                    }
                    else if (IsPaused())
                    {
                        playState = PlayState.Paused;
                    }
                    else
                    {
                        playState = PlayState.Stopped;
                    }
                    int rootInstanceId = root.GetInstanceID();
                    SessionState.SetVector3(k_SimulationStateId + rootInstanceId, new Vector3(rootInstanceId, (int)playState, ParticleSystemEditorUtils.playbackTime));
                }

                // Stop the ParticleSystem here (prevents it being frozen on screen)
                //Stop();
            }

            m_ParticleSystemCurveEditor.OnDisable();
            Tools.s_Hidden = false; // The collisionmodule might have hidden the tools

            if (root != null)
            {
                SessionState.SetBool(k_ShowSelectedId + root.GetInstanceID(), m_ShowOnlySelectedMode);
            }
            SetShowOnlySelectedMode(false);

            GameView.RepaintAll();
            SceneView.RepaintAll();
        }
        public void Clear()
        {
            ParticleSystem root = this.GetRoot();

            if (this.ShouldManagePlaybackState(root) && (UnityEngine.Object)root != (UnityEngine.Object)null)
            {
                ParticleEffectUI.PlayState playState = !this.IsPlaying() ? (!this.IsPaused() ? ParticleEffectUI.PlayState.Stopped : ParticleEffectUI.PlayState.Paused) : ParticleEffectUI.PlayState.Playing;
                int instanceId = root.GetInstanceID();
                SessionState.SetVector3("SimulationState" + (object)instanceId, new Vector3((float)instanceId, (float)playState, ParticleSystemEditorUtils.editorPlaybackTime));
            }
            this.m_ParticleSystemCurveEditor.OnDisable();
            ParticleEffectUtils.ClearPlanes();
            Tools.s_Hidden = false;
            if ((UnityEngine.Object)root != (UnityEngine.Object)null)
            {
                SessionState.SetBool("ShowSelected" + (object)root.GetInstanceID(), this.m_ShowOnlySelectedMode);
            }
            this.SetShowOnlySelectedMode(false);
            GameView.RepaintAll();
            SceneView.RepaintAll();
        }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (GUI.changed)
     {
         this.m_MightHaveModified = true;
     }
     foreach (ProceduralTexture texture in base.targets)
     {
         if (texture != null)
         {
             ProceduralMaterial proceduralMaterial = texture.GetProceduralMaterial();
             if ((proceduralMaterial != null) && proceduralMaterial.isProcessing)
             {
                 base.Repaint();
                 SceneView.RepaintAll();
                 GameView.RepaintAll();
                 break;
             }
         }
     }
 }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (GUI.changed)
     {
         this.m_MightHaveModified = true;
     }
     foreach (ProceduralTexture target in this.targets)
     {
         if ((bool)((Object)target))
         {
             ProceduralMaterial proceduralMaterial = target.GetProceduralMaterial();
             if ((bool)((Object)proceduralMaterial) && proceduralMaterial.isProcessing)
             {
                 this.Repaint();
                 SceneView.RepaintAll();
                 GameView.RepaintAll();
                 break;
             }
         }
     }
 }
示例#13
0
        void InitEffectUI()
        {
            if (!m_IsVisible)
            {
                return;
            }

            // Use locked particle system if set otherwise check selected gameobject
            ParticleSystem target = ParticleSystemEditorUtils.lockedParticleSystem;

            if (target == null && Selection.activeGameObject != null)
            {
                target = Selection.activeGameObject.GetComponent <ParticleSystem>();
            }

            m_Target = target;
            if (m_Target != null)
            {
                if (m_ParticleEffectUI == null)
                {
                    m_ParticleEffectUI = new ParticleEffectUI(this);
                }

                if (m_ParticleEffectUI.InitializeIfNeeded(new ParticleSystem[] { m_Target }))
                {
                    Repaint();
                }
            }

            // Cleanup if needed
            if (m_Target == null && m_ParticleEffectUI != null)
            {
                Clear();
                Repaint();
                SceneView.RepaintAll();
                GameView.RepaintAll();
            }
        }
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (GUI.changed)
     {
         this.m_MightHaveModified = true;
     }
     UnityEngine.Object[] targets = base.targets;
     for (int i = 0; i < targets.Length; i++)
     {
         ProceduralTexture proceduralTexture = (ProceduralTexture)targets[i];
         if (proceduralTexture)
         {
             ProceduralMaterial proceduralMaterial = proceduralTexture.GetProceduralMaterial();
             if (proceduralMaterial && proceduralMaterial.isProcessing)
             {
                 base.Repaint();
                 SceneView.RepaintAll();
                 GameView.RepaintAll();
                 break;
             }
         }
     }
 }
示例#15
0
 internal static void RepaintSceneAndGameViews()
 {
     SceneView.RepaintAll();
     GameView.RepaintAll();
 }
示例#16
0
        private void BuiltinCustomSplashScreenGUI()
        {
            EditorGUILayout.LabelField(k_Texts.splashTitle, EditorStyles.boldLabel);

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

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

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

                GameView.RepaintAll();
            }

            EditorGUILayout.PropertyField(m_SplashScreenLogoStyle, k_Texts.splashStyle);

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

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

            EditorGUILayout.Space();

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

                m_ShowLogoControlsAnimator.target = m_ShowUnitySplashLogo.boolValue;
            }

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

            using (var vertical = new EditorGUILayout.VerticalScope())
                using (new EditorGUI.PropertyScope(vertical.rect, GUIContent.none, m_SplashScreenLogos))
                {
                    m_LogoList.DoLayoutList();
                }


            EditorGUILayout.Space();

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

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

            using (new EditorGUI.DisabledScope(m_SplashScreenBackgroundLandscape.objectReferenceValue == null))
            {
                ObjectReferencePropertyField <Sprite>(m_SplashScreenBackgroundPortrait, k_Texts.backgroundPortraitImage);
            }
        }
示例#17
0
        private void CommandBufferGUI()
        {
            // Command buffers are not serialized data, so can't get to them through
            // serialized property (hence no multi-edit).
            if (targets.Length != 1)
            {
                return;
            }
            var light = target as Light;

            if (light == null)
            {
                return;
            }
            int count = light.commandBufferCount;

            if (count == 0)
            {
                return;
            }

            m_CommandBuffersShown = GUILayout.Toggle(m_CommandBuffersShown, GUIContent.Temp(count + " command buffers"), EditorStyles.foldout);
            if (!m_CommandBuffersShown)
            {
                return;
            }
            EditorGUI.indentLevel++;
            foreach (LightEvent le in (LightEvent[])System.Enum.GetValues(typeof(LightEvent)))
            {
                CommandBuffer[] cbs = light.GetCommandBuffers(le);
                foreach (CommandBuffer cb in cbs)
                {
                    using (new GUILayout.HorizontalScope())
                    {
                        // row with event & command buffer information label
                        Rect rowRect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel);
                        rowRect.xMin += EditorGUI.indent;
                        Rect minusRect = GetRemoveButtonRect(rowRect);
                        rowRect.xMax = minusRect.x;
                        GUI.Label(rowRect, string.Format("{0}: {1} ({2})", le, cb.name, EditorUtility.FormatBytes(cb.sizeInBytes)), EditorStyles.miniLabel);
                        // and a button to remove it
                        if (GUI.Button(minusRect, s_Styles.iconRemove, s_Styles.invisibleButton))
                        {
                            light.RemoveCommandBuffer(le, cb);
                            SceneView.RepaintAll();
                            GameView.RepaintAll();
                            GUIUtility.ExitGUI();
                        }
                    }
                }
            }
            // "remove all" button
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Remove all", EditorStyles.miniButton))
                {
                    light.RemoveAllCommandBuffers();
                    SceneView.RepaintAll();
                    GameView.RepaintAll();
                }
            }
            EditorGUI.indentLevel--;
        }
        private void MaterialListing()
        {
            ProceduralMaterial[] sortedMaterials = this.GetSortedMaterials();
            foreach (ProceduralMaterial proceduralMaterial in sortedMaterials)
            {
                if (proceduralMaterial.isProcessing)
                {
                    this.Repaint();
                    SceneView.RepaintAll();
                    GameView.RepaintAll();
                    break;
                }
            }
            int   length = sortedMaterials.Length;
            float num1   = (float)((double)GUIView.current.position.width - 16.0 - 18.0 - 2.0);

            if ((double)num1 * 2.0 < (double)length * 60.0)
            {
                num1 -= 16f;
            }
            int  num2      = Mathf.Max(1, Mathf.FloorToInt(num1 / 60f));
            int  num3      = Mathf.CeilToInt((float)length / (float)num2);
            Rect viewRect  = new Rect(0.0f, 0.0f, (float)num2 * 60f, (float)num3 * 76f);
            Rect rect      = GUILayoutUtility.GetRect(viewRect.width, Mathf.Clamp(viewRect.height, 76f, 152f) + 1f);
            Rect position1 = new Rect(rect.x + 1f, rect.y + 1f, rect.width - 2f, rect.height - 1f);

            GUI.Box(rect, GUIContent.none, this.m_SubstanceStyles.gridBackground);
            GUI.Box(position1, GUIContent.none, this.m_SubstanceStyles.background);
            this.m_ListScroll = GUI.BeginScrollView(position1, this.m_ListScroll, viewRect, false, false);
            if (this.m_EditorCache == null)
            {
                this.m_EditorCache = new EditorCache(EditorFeatures.PreviewGUI);
            }
            for (int index = 0; index < sortedMaterials.Length; ++index)
            {
                ProceduralMaterial proceduralMaterial = sortedMaterials[index];
                if (!((UnityEngine.Object)proceduralMaterial == (UnityEngine.Object)null))
                {
                    Rect  position2 = new Rect((float)(index % num2) * 60f, (float)(index / num2) * 76f, 60f, 76f);
                    bool  flag      = proceduralMaterial.name == this.m_SelectedMaterialInstanceName;
                    Event current   = Event.current;
                    int   controlId = GUIUtility.GetControlID(SubstanceImporterInspector.previewNoDragDropHash, FocusType.Native, position2);
                    switch (current.GetTypeForControl(controlId))
                    {
                    case EventType.MouseDown:
                        if (current.button == 0 && position2.Contains(current.mousePosition))
                        {
                            if (current.clickCount == 1)
                            {
                                this.m_SelectedMaterialInstanceName = proceduralMaterial.name;
                                current.Use();
                                break;
                            }
                            if (current.clickCount == 2)
                            {
                                AssetDatabase.OpenAsset((UnityEngine.Object)proceduralMaterial);
                                GUIUtility.ExitGUI();
                                current.Use();
                                break;
                            }
                            break;
                        }
                        break;

                    case EventType.Repaint:
                        Rect position3 = position2;
                        position3.y      = position2.yMax - 16f;
                        position3.height = 16f;
                        this.m_SubstanceStyles.resultsGridLabel.Draw(position3, EditorGUIUtility.TempContent(proceduralMaterial.name), false, false, flag, flag);
                        break;
                    }
                    position2.height -= 16f;
                    this.m_EditorCache[(UnityEngine.Object)proceduralMaterial].OnPreviewGUI(position2, this.m_SubstanceStyles.background);
                }
            }
            GUI.EndScrollView();
        }
示例#19
0
        private void MaterialListing()
        {
            ProceduralMaterial[] sortedMaterials = this.GetSortedMaterials();
            ProceduralMaterial[] array           = sortedMaterials;
            for (int i = 0; i < array.Length; i++)
            {
                ProceduralMaterial proceduralMaterial = array[i];
                if (proceduralMaterial.isProcessing)
                {
                    base.Repaint();
                    SceneView.RepaintAll();
                    GameView.RepaintAll();
                    break;
                }
            }
            int   num  = sortedMaterials.Length;
            float num2 = GUIView.current.position.width - 16f - 18f - 2f;

            if (num2 * 2f < (float)num * 60f)
            {
                num2 -= 16f;
            }
            int  num3     = Mathf.Max(1, Mathf.FloorToInt(num2 / 60f));
            int  num4     = Mathf.CeilToInt((float)num / (float)num3);
            Rect viewRect = new Rect(0f, 0f, (float)num3 * 60f, (float)num4 * 76f);
            Rect rect     = GUILayoutUtility.GetRect(viewRect.width, Mathf.Clamp(viewRect.height, 76f, 152f) + 1f);
            Rect position = new Rect(rect.x + 1f, rect.y + 1f, rect.width - 2f, rect.height - 1f);

            GUI.Box(rect, GUIContent.none, this.m_SubstanceStyles.gridBackground);
            GUI.Box(position, GUIContent.none, this.m_SubstanceStyles.background);
            this.m_ListScroll = GUI.BeginScrollView(position, this.m_ListScroll, viewRect, false, false);
            if (this.m_EditorCache == null)
            {
                this.m_EditorCache = new EditorCache(EditorFeatures.PreviewGUI);
            }
            for (int j = 0; j < sortedMaterials.Length; j++)
            {
                ProceduralMaterial proceduralMaterial2 = sortedMaterials[j];
                if (!(proceduralMaterial2 == null))
                {
                    float     x              = (float)(j % num3) * 60f;
                    float     y              = (float)(j / num3) * 76f;
                    Rect      rect2          = new Rect(x, y, 60f, 76f);
                    bool      flag           = proceduralMaterial2.name == this.m_SelectedMaterialInstanceName;
                    Event     current        = Event.current;
                    int       controlID      = GUIUtility.GetControlID(SubstanceImporterInspector.previewNoDragDropHash, FocusType.Passive, rect2);
                    EventType typeForControl = current.GetTypeForControl(controlID);
                    if (typeForControl != EventType.Repaint)
                    {
                        if (typeForControl == EventType.MouseDown)
                        {
                            if (current.button == 0)
                            {
                                if (rect2.Contains(current.mousePosition))
                                {
                                    if (current.clickCount == 1)
                                    {
                                        this.m_SelectedMaterialInstanceName = proceduralMaterial2.name;
                                        current.Use();
                                    }
                                    else if (current.clickCount == 2)
                                    {
                                        AssetDatabase.OpenAsset(proceduralMaterial2);
                                        GUIUtility.ExitGUI();
                                        current.Use();
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Rect position2 = rect2;
                        position2.y      = rect2.yMax - 16f;
                        position2.height = 16f;
                        this.m_SubstanceStyles.resultsGridLabel.Draw(position2, EditorGUIUtility.TempContent(proceduralMaterial2.name), false, false, flag, flag);
                    }
                    rect2.height -= 16f;
                    EditorWrapper editorWrapper = this.m_EditorCache[proceduralMaterial2];
                    editorWrapper.OnPreviewGUI(rect2, this.m_SubstanceStyles.background);
                }
            }
            GUI.EndScrollView();
        }
        private void BuiltinCustomSplashScreenGUI()
        {
            EditorGUILayout.LabelField(PlayerSettingsSplashScreenEditor.k_Texts.splashTitle, EditorStyles.boldLabel, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope(!PlayerSettingsSplashScreenEditor.licenseAllowsDisabling))
            {
                EditorGUILayout.PropertyField(this.m_ShowUnitySplashScreen, PlayerSettingsSplashScreenEditor.k_Texts.showSplash, new GUILayoutOption[0]);
                if (!this.m_ShowUnitySplashScreen.boolValue)
                {
                    return;
                }
            }
            Rect rect = GUILayoutUtility.GetRect(PlayerSettingsSplashScreenEditor.k_Texts.previewSplash, "button");

            rect = EditorGUI.PrefixLabel(rect, new GUIContent(" "));
            if (GUI.Button(rect, PlayerSettingsSplashScreenEditor.k_Texts.previewSplash))
            {
                SplashScreen.Begin();
                GameView mainGameView = GameView.GetMainGameView();
                if (mainGameView)
                {
                    mainGameView.Focus();
                }
                GameView.RepaintAll();
            }
            EditorGUILayout.PropertyField(this.m_SplashScreenLogoStyle, PlayerSettingsSplashScreenEditor.k_Texts.splashStyle, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_SplashScreenAnimation, PlayerSettingsSplashScreenEditor.k_Texts.animate, new GUILayoutOption[0]);
            this.m_ShowAnimationControlsAnimator.target = (this.m_SplashScreenAnimation.intValue == 2);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowAnimationControlsAnimator.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.Slider(this.m_SplashScreenLogoAnimationZoom, 0f, 1f, PlayerSettingsSplashScreenEditor.k_Texts.logoZoom, new GUILayoutOption[0]);
                EditorGUILayout.Slider(this.m_SplashScreenBackgroundAnimationZoom, 0f, 1f, PlayerSettingsSplashScreenEditor.k_Texts.backgroundZoom, new GUILayoutOption[0]);
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(PlayerSettingsSplashScreenEditor.k_Texts.logosTitle, EditorStyles.boldLabel, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope(!Application.HasProLicense()))
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_ShowUnitySplashLogo, PlayerSettingsSplashScreenEditor.k_Texts.showLogo, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    if (!this.m_ShowUnitySplashLogo.boolValue)
                    {
                        this.RemoveUnityLogoFromLogosList();
                    }
                    else if (this.m_SplashScreenDrawMode.intValue == 1)
                    {
                        this.AddUnityLogoToLogosList();
                    }
                }
                this.m_ShowLogoControlsAnimator.target = this.m_ShowUnitySplashLogo.boolValue;
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowLogoControlsAnimator.faded))
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                int intValue = this.m_SplashScreenDrawMode.intValue;
                EditorGUILayout.PropertyField(this.m_SplashScreenDrawMode, PlayerSettingsSplashScreenEditor.k_Texts.drawMode, new GUILayoutOption[0]);
                if (intValue != this.m_SplashScreenDrawMode.intValue)
                {
                    if (this.m_SplashScreenDrawMode.intValue == 0)
                    {
                        this.RemoveUnityLogoFromLogosList();
                    }
                    else
                    {
                        this.AddUnityLogoToLogosList();
                    }
                }
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            this.m_LogoList.DoLayoutList();
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(PlayerSettingsSplashScreenEditor.k_Texts.backgroundTitle, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.Slider(this.m_SplashScreenOverlayOpacity, (!Application.HasProLicense()) ? PlayerSettingsSplashScreenEditor.k_MinPersonalEditionOverlayOpacity : PlayerSettingsSplashScreenEditor.k_MinProEditionOverlayOpacity, 1f, PlayerSettingsSplashScreenEditor.k_Texts.overlayOpacity, new GUILayoutOption[0]);
            this.m_ShowBackgroundColorAnimator.target = (this.m_SplashScreenBackgroundLandscape.objectReferenceValue == null);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBackgroundColorAnimator.faded))
            {
                EditorGUILayout.PropertyField(this.m_SplashScreenBackgroundColor, PlayerSettingsSplashScreenEditor.k_Texts.backgroundColor, new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            PlayerSettingsSplashScreenEditor.ObjectReferencePropertyField <Sprite>(this.m_SplashScreenBackgroundLandscape, PlayerSettingsSplashScreenEditor.k_Texts.backgroundImage);
            if (GUI.changed && this.m_SplashScreenBackgroundLandscape.objectReferenceValue == null)
            {
                this.m_SplashScreenBackgroundPortrait.objectReferenceValue = null;
            }
            using (new EditorGUI.DisabledScope(this.m_SplashScreenBackgroundLandscape.objectReferenceValue == null))
            {
                PlayerSettingsSplashScreenEditor.ObjectReferencePropertyField <Sprite>(this.m_SplashScreenBackgroundPortrait, PlayerSettingsSplashScreenEditor.k_Texts.backgroundPortraitImage);
            }
        }
示例#21
0
        public override void OnInspectorGUI()
        {
            this.serializedObject.Update();
            Camera target = (Camera)this.target;

            this.m_ShowBGColorOptions.target  = !this.m_ClearFlags.hasMultipleDifferentValues && (target.clearFlags == CameraClearFlags.Color || target.clearFlags == CameraClearFlags.Skybox);
            this.m_ShowOrthoOptions.target    = !this.m_Orthographic.hasMultipleDifferentValues && target.orthographic;
            this.m_ShowTargetEyeOption.target = this.m_TargetEye.intValue != 3 || PlayerSettings.virtualRealitySupported || PlayerSettings.stereoscopic3D;
            EditorGUILayout.PropertyField(this.m_ClearFlags);
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowBGColorOptions.faded))
            {
                EditorGUILayout.PropertyField(this.m_BackgroundColor, new GUIContent("Background", "Camera clears the screen to this color before rendering."), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            EditorGUILayout.PropertyField(this.m_CullingMask);
            EditorGUILayout.Space();
            CameraEditor.ProjectionType projectionType1 = !this.m_Orthographic.boolValue ? CameraEditor.ProjectionType.Perspective : CameraEditor.ProjectionType.Orthographic;
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_Orthographic.hasMultipleDifferentValues;
            CameraEditor.ProjectionType projectionType2 = (CameraEditor.ProjectionType)EditorGUILayout.EnumPopup("Projection", (Enum)projectionType1, new GUILayoutOption[0]);
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                this.m_Orthographic.boolValue = projectionType2 == CameraEditor.ProjectionType.Orthographic;
            }
            if (!this.m_Orthographic.hasMultipleDifferentValues)
            {
                if (EditorGUILayout.BeginFadeGroup(this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.PropertyField(this.m_OrthographicSize, new GUIContent("Size"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
                if (EditorGUILayout.BeginFadeGroup(1f - this.m_ShowOrthoOptions.faded))
                {
                    EditorGUILayout.Slider(this.m_FieldOfView, 1f, 179f, new GUIContent("Field of View"), new GUILayoutOption[0]);
                }
                EditorGUILayout.EndFadeGroup();
            }
            EditorGUILayout.PropertiesField(EditorGUI.s_ClipingPlanesLabel, this.m_NearAndFarClippingPlanes, EditorGUI.s_NearAndFarLabels, 35f);
            EditorGUILayout.PropertyField(this.m_NormalizedViewPortRect, this.m_ViewportLabel, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(this.m_Depth);
            EditorGUILayout.IntPopup(this.m_RenderingPath, CameraEditor.kCameraRenderPaths, CameraEditor.kCameraRenderPathValues, EditorGUIUtility.TempContent("Rendering Path"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_TargetTexture);
            EditorGUILayout.PropertyField(this.m_OcclusionCulling);
            EditorGUILayout.PropertyField(this.m_HDR);
            if (this.m_HDR.boolValue)
            {
                this.DisplayHDRWarnings();
            }
            if (PlayerSettings.stereoscopic3D)
            {
                EditorGUILayout.PropertyField(this.m_StereoSeparation);
                EditorGUILayout.PropertyField(this.m_StereoConvergence);
            }
            if (this.ShouldShowTargetDisplayProperty())
            {
                int intValue = this.m_TargetDisplay.intValue;
                EditorGUILayout.Space();
                EditorGUILayout.IntPopup(this.m_TargetDisplay, DisplayUtility.GetDisplayNames(), DisplayUtility.GetDisplayIndices(), EditorGUIUtility.TempContent("Target Display"), new GUILayoutOption[0]);
                if (intValue != this.m_TargetDisplay.intValue)
                {
                    GameView.RepaintAll();
                }
            }
            if (EditorGUILayout.BeginFadeGroup(this.m_ShowTargetEyeOption.faded))
            {
                EditorGUILayout.IntPopup(this.m_TargetEye, CameraEditor.kTargetEyes, CameraEditor.kTargetEyeValues, EditorGUIUtility.TempContent("Target Eye"), new GUILayoutOption[0]);
            }
            EditorGUILayout.EndFadeGroup();
            this.DepthTextureModeGUI();
            this.CommandBufferGUI();
            this.serializedObject.ApplyModifiedProperties();
        }
示例#22
0
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            Camera camera = (Camera)base.target;

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

            if ((num3 * 2f) < (length * 60f))
            {
                num3 -= 16f;
            }
            int  num4     = Mathf.Max(1, Mathf.FloorToInt(num3 / 60f));
            int  num5     = Mathf.CeilToInt(((float)length) / ((float)num4));
            Rect viewRect = new Rect(0f, 0f, num4 * 60f, num5 * 76f);
            Rect rect     = GUILayoutUtility.GetRect(viewRect.width, Mathf.Clamp(viewRect.height, 76f, 152f) + 1f);
            Rect position = new Rect(rect.x + 1f, rect.y + 1f, rect.width - 2f, rect.height - 1f);

            GUI.Box(rect, GUIContent.none, this.m_SubstanceStyles.gridBackground);
            GUI.Box(position, GUIContent.none, this.m_SubstanceStyles.background);
            this.m_ListScroll = GUI.BeginScrollView(position, this.m_ListScroll, viewRect, false, false);
            if (this.m_EditorCache == null)
            {
                this.m_EditorCache = new EditorCache(EditorFeatures.PreviewGUI);
            }
            for (int i = 0; i < sortedMaterials.Length; i++)
            {
                ProceduralMaterial target = sortedMaterials[i];
                if (target != null)
                {
                    float x         = (i % num4) * 60f;
                    float y         = (i / num4) * 76f;
                    Rect  rect5     = new Rect(x, y, 60f, 76f);
                    bool  on        = target.name == this.m_SelectedMaterialInstanceName;
                    Event current   = Event.current;
                    int   controlID = GUIUtility.GetControlID(previewNoDragDropHash, FocusType.Passive, rect5);
                    switch (current.GetTypeForControl(controlID))
                    {
                    case EventType.Repaint:
                    {
                        Rect rect6 = rect5;
                        rect6.y      = rect5.yMax - 16f;
                        rect6.height = 16f;
                        this.m_SubstanceStyles.resultsGridLabel.Draw(rect6, EditorGUIUtility.TempContent(target.name), false, false, on, on);
                        break;
                    }

                    case EventType.MouseDown:
                        if ((current.button == 0) && rect5.Contains(current.mousePosition))
                        {
                            if (current.clickCount == 1)
                            {
                                this.m_SelectedMaterialInstanceName = target.name;
                                current.Use();
                            }
                            else if (current.clickCount == 2)
                            {
                                AssetDatabase.OpenAsset(target);
                                GUIUtility.ExitGUI();
                                current.Use();
                            }
                        }
                        break;
                    }
                    rect5.height -= 16f;
                    this.m_EditorCache[target].OnPreviewGUI(rect5, this.m_SubstanceStyles.background);
                }
            }
            GUI.EndScrollView();
        }