示例#1
0
        public override void DrawSectionMisc() // General Tab
        {
            var subCat = new GUIStyle(UnityEditor.EditorStyles.helpBox);

            subCat.padding = new RectOffset(0, 0, 10, 5);
            subCat.margin  = new RectOffset(0, 0, 0, 10);
            EditorGUI.indentLevel++;
            EditorGUILayout.BeginVertical(subCat);
            // Handle render texture precision mode
            EditorGUILayout.PropertyField(inspectorShowHelp);
            EditorGUILayout.Separator();
            EditorGUI.indentLevel--;

            if (GUILayout.Button("Open online documentation"))
            {
                Application.OpenURL("https://docs.google.com/document/d/1lhcYJwkueuVuHZnYdQVg2EqUb980VlH80_J9mvOwuPw/");
            }

            EditorGUILayout.EndVertical();

            // Draw Social Media
            EditorMacros.DrawSocial(styleHeader, styleContentBox);
        }
        public virtual void DrawSectionMisc() // General Tab
        {
            #region Extension IPointer Events
            bool extensionIPointerEventsSupport = targetAsSSAA.ExtensionIPointerEvents.IsSupported();
            if (extensionIPointerEventsSupport)
            {
                GUI.color = extensionIPointerEvents.FindPropertyRelative("enabled").boolValue ? new Color(.5f, 1f, .5f) : new Color(.8f, .8f, .8f);
            }
            else
            {
                GUI.color = new Color(1f, .3f, .3f);
            }
            EditorGUILayout.BeginHorizontal(styleHeader);
            {
                GUI.color = Color.white;
                EditorGUI.indentLevel++;
                extensionIPointerEvents.FindPropertyRelative("inspectorFoldout").boolValue = EditorGUILayout.Foldout(
                    extensionIPointerEvents.FindPropertyRelative("inspectorFoldout").boolValue,
                    "Unity IPointerEvents Integration",
                    true,
                    styleFoldout);
                EditorGUI.indentLevel--;
                GUI.color = colorAccentPro;
                if (GUILayout.Button(extensionIPointerEvents.FindPropertyRelative("enabled").boolValue ? "Disable" : "Enable", GUILayout.MaxWidth(100), GUILayout.MinWidth(100)))
                {
                    targetAsSSAA.enabled = false;
                    targetAsSSAA.ExtensionIPointerEvents.enabled = !targetAsSSAA.ExtensionIPointerEvents.enabled;
                    targetAsSSAA.enabled = true;
                }
                GUI.color = Color.white;
            }
            EditorGUILayout.EndHorizontal();
            if (extensionIPointerEvents.FindPropertyRelative("inspectorFoldout").boolValue)
            {
                EditorGUILayout.BeginVertical(styleContentBox);
                EditorGUILayout.HelpBox(SSAAExtensionPointerEventsSupport.description, MessageType.Info);
                EditorGUILayout.PropertyField(extensionIPointerEvents.FindPropertyRelative("eventsLayerMask"));
                EditorGUILayout.EndVertical();
            }
            #endregion

            #region Extension Post Processing Stack 2
            bool extensionPostProcessingStackSupport = targetAsSSAA.ExtensionPostProcessingStack.IsSupported();
            if (extensionPostProcessingStackSupport)
            {
                GUI.color = extensionPostProcessingStack.FindPropertyRelative("enabled").boolValue ? new Color(.5f, 1f, .5f) : new Color(.8f, .8f, .8f);
            }
            else
            {
                GUI.color = new Color(1f, .3f, .3f);
            }
            EditorGUILayout.BeginHorizontal(styleHeader);
            {
                GUI.color = Color.white;
                EditorGUI.indentLevel++;
                extensionPostProcessingStack.FindPropertyRelative("inspectorFoldout").boolValue = EditorGUILayout.Foldout(
                    extensionPostProcessingStack.FindPropertyRelative("inspectorFoldout").boolValue,
                    "Unity PostProcessing Stack V2 Integration",
                    true,
                    styleFoldout);

                EditorGUI.indentLevel--;
                GUI.color = colorAccentPro;
                if (extensionPostProcessingStackSupport)
                {
                    if (GUILayout.Button(extensionPostProcessingStack.FindPropertyRelative("enabled").boolValue ? "Disable" : "Enable", GUILayout.MaxWidth(100), GUILayout.MinWidth(100)))
                    {
                        targetAsSSAA.enabled = false;
                        targetAsSSAA.ExtensionPostProcessingStack.enabled = !targetAsSSAA.ExtensionPostProcessingStack.enabled;
                        targetAsSSAA.enabled = true;
                    }
                }
                GUI.color = Color.white;
            }
            EditorGUILayout.EndHorizontal();
            if (extensionPostProcessingStack.FindPropertyRelative("inspectorFoldout").boolValue)
            {
                EditorGUILayout.BeginVertical(styleContentBox);
                if (extensionPostProcessingStackSupport)
                {
                    EditorGUILayout.HelpBox(SSAAExtensionPostProcessingStack2.description, MessageType.Info);
                    EditorGUILayout.PropertyField(extensionPostProcessingStack.FindPropertyRelative("updateFromOriginal"));
                    EditorGUILayout.PropertyField(extensionPostProcessingStack.FindPropertyRelative("lwrpLegacySupport"));
                }
                else
                {
                    EditorGUILayout.HelpBox(SSAAExtensionPostProcessingStack2.requirement, MessageType.Error);
                }
                EditorGUILayout.EndVertical();
            }
            #endregion

            #region Extension Cinemachine
            bool extensionCinemachineSupport = targetAsSSAA.ExtensionCinemachine.IsSupported();
            if (extensionCinemachineSupport)
            {
                GUI.color = extensionCinemachine.FindPropertyRelative("enabled").boolValue ? new Color(.5f, 1f, .5f) : new Color(.8f, .8f, .8f);
            }
            else
            {
                GUI.color = new Color(1f, .3f, .3f);
            }
            EditorGUILayout.BeginHorizontal(styleHeader);
            {
                GUI.color = Color.white;
                EditorGUI.indentLevel++;
                extensionCinemachine.FindPropertyRelative("inspectorFoldout").boolValue = EditorGUILayout.Foldout(
                    extensionCinemachine.FindPropertyRelative("inspectorFoldout").boolValue,
                    "Unity Cinemachine Integration",
                    true,
                    styleFoldout);

                EditorGUI.indentLevel--;
                GUI.color = colorAccentPro;
                if (extensionCinemachineSupport)
                {
                    if (GUILayout.Button(extensionCinemachine.FindPropertyRelative("enabled").boolValue ? "Disable" : "Enable", GUILayout.MaxWidth(100), GUILayout.MinWidth(100)))
                    {
                        targetAsSSAA.enabled = false;
                        targetAsSSAA.ExtensionCinemachine.enabled = !targetAsSSAA.ExtensionCinemachine.enabled;
                        if (targetAsSSAA.ExtensionCinemachine.enabled)
                        {
                            SymbolDefineUtils.AddDefine("SSAA_CINEMACHINE");
                        }
                        else
                        {
                            SymbolDefineUtils.RemoveDefine("SSAA_CINEMACHINE");
                        }
                        targetAsSSAA.enabled = true;
                    }
                }
                GUI.color = Color.white;
            }
            EditorGUILayout.EndHorizontal();
            if (extensionCinemachine.FindPropertyRelative("inspectorFoldout").boolValue)
            {
                EditorGUILayout.BeginVertical(styleContentBox);
                if (extensionCinemachineSupport)
                {
                    EditorGUILayout.HelpBox(SSAAExtensionCinemachine.description, MessageType.Info);
                    EditorGUILayout.PropertyField(extensionCinemachine.FindPropertyRelative("updateFromOriginal"));
                }
                else
                {
                    EditorGUILayout.HelpBox(SSAAExtensionCinemachine.requirement, MessageType.Error);
                }
                EditorGUILayout.EndVertical();
            }
            #endregion

            // Draw Extensions
            EditorMacros.DrawHeader("Misc", styleHeader);
            EditorGUI.indentLevel++;
            EditorGUILayout.BeginVertical(styleContentBox);
            // Handle render texture precision mode
            if (!Application.isPlaying)
            {
                currentMode = internalTextureFormat.enumValueIndex == (int)RenderTextureFormat.ARGBFloat ? TextureMode.Float : TextureMode.Half;
                var oldMode = currentMode;
                currentMode = (TextureMode)EditorGUILayout.EnumPopup(new GUIContent("Render Texture Precision"), currentMode);
                internalTextureFormat.enumValueIndex = currentMode == TextureMode.Half ? (int)RenderTextureFormat.ARGBHalf : (int)RenderTextureFormat.ARGBFloat;
                if (oldMode != currentMode)
                {
                    targetAsSSAA.Refresh();
                }
            }
            EditorGUILayout.PropertyField(inspectorShowHelp);
            EditorGUILayout.Separator();
            EditorGUI.indentLevel--;
            if (GUILayout.Button("Open online documentation"))
            {
                Application.OpenURL("https://github.com/MadGoat-Studio/MadGoat-SSAA-Resolution-Scale/wiki");
            }

            EditorGUILayout.EndVertical();

            // Draw Social Media
            EditorMacros.DrawSocial(styleHeader, styleContentBox);
        }