From d69611d66431e28ea35477c6781a00d57ae04fa3 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 7 Apr 2021 21:13:03 +0800 Subject: =?UTF-8?q?*=E5=9B=A0=E4=B8=BA=E6=B2=A1=E6=9C=89meta=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E8=87=B4missing=EF=BC=8C=E5=88=A0=E9=99=A4UIEffect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Test/UIEffect/Program/Editor/UIEffectEditor.cs | 114 --------------------- 1 file changed, 114 deletions(-) delete mode 100644 Assets/Test/UIEffect/Program/Editor/UIEffectEditor.cs (limited to 'Assets/Test/UIEffect/Program/Editor/UIEffectEditor.cs') diff --git a/Assets/Test/UIEffect/Program/Editor/UIEffectEditor.cs b/Assets/Test/UIEffect/Program/Editor/UIEffectEditor.cs deleted file mode 100644 index 028ee73..0000000 --- a/Assets/Test/UIEffect/Program/Editor/UIEffectEditor.cs +++ /dev/null @@ -1,114 +0,0 @@ -using UnityEditor; -using UnityEditorInternal; -using UnityEngine; -using System.Linq; -using System; - -namespace Coffee.UIEffects.Editors -{ - /// - /// UIEffect editor. - /// - [CustomEditor(typeof(UIEffect))] - [CanEditMultipleObjects] - public class UIEffectEditor : Editor - { - SerializedProperty _spEffectMode; - SerializedProperty _spEffectFactor; - SerializedProperty _spColorMode; - SerializedProperty _spColorFactor; - SerializedProperty _spBlurMode; - SerializedProperty _spBlurFactor; - SerializedProperty _spAdvancedBlur; - - protected void OnEnable() - { - _spEffectMode = serializedObject.FindProperty("m_EffectMode"); - _spEffectFactor = serializedObject.FindProperty("m_EffectFactor"); - _spColorMode = serializedObject.FindProperty("m_ColorMode"); - _spColorFactor = serializedObject.FindProperty("m_ColorFactor"); - _spBlurMode = serializedObject.FindProperty("m_BlurMode"); - _spBlurFactor = serializedObject.FindProperty("m_BlurFactor"); - _spAdvancedBlur = serializedObject.FindProperty("m_AdvancedBlur"); - } - - public override void OnInspectorGUI() - { - //================ - // Effect setting. - //================ - using (new MaterialDirtyScope(targets)) - EditorGUILayout.PropertyField(_spEffectMode); - - // When effect is enable, show parameters. - if (_spEffectMode.intValue != (int) EffectMode.None) - { - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(_spEffectFactor); - EditorGUI.indentLevel--; - } - - - //================ - // Color setting. - //================ - using (new MaterialDirtyScope(targets)) - EditorGUILayout.PropertyField(_spColorMode); - - // When color is enable, show parameters. - { - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(_spColorFactor); - EditorGUI.indentLevel--; - } - - - //================ - // Blur setting. - //================ - using (new MaterialDirtyScope(targets)) - EditorGUILayout.PropertyField(_spBlurMode); - - // When blur is enable, show parameters. - if (_spBlurMode.intValue != (int) BlurMode.None) - { - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(_spBlurFactor); - - // When you change a property, it marks the material as dirty. - using (new MaterialDirtyScope(targets)) - EditorGUILayout.PropertyField(_spAdvancedBlur); - EditorGUI.indentLevel--; - - // Advanced blur requires uv2 channel. - if (_spAdvancedBlur.boolValue) - { - ShowCanvasChannelsWarning(); - } - } - - serializedObject.ApplyModifiedProperties(); - } - - void ShowCanvasChannelsWarning() - { - var effect = target as UIEffect; - if (effect == null || !effect.graphic) return; - - var channel = effect.uvMaskChannel; - var canvas = effect.graphic.canvas; - if (canvas == null || (canvas.additionalShaderChannels & channel) == channel) return; - - EditorGUILayout.BeginHorizontal(); - { - var msg = string.Format("Enable '{0}' of Canvas.additionalShaderChannels to use 'UIEffect'.", channel); - EditorGUILayout.HelpBox(msg, MessageType.Warning); - if (GUILayout.Button("Fix")) - { - canvas.additionalShaderChannels |= channel; - } - } - EditorGUILayout.EndHorizontal(); - } - } -} -- cgit v1.1-26-g67d0