blob: 64f01d6f3d56992d65a8330f4c370f1e9b8974e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// UIShadow editor.
/// </summary>
[CustomEditor(typeof(UIShadow))]
[CanEditMultipleObjects]
public class UIShadowEditor : Editor
{
UIEffect uiEffect;
SerializedProperty _spStyle;
SerializedProperty _spEffectDistance;
SerializedProperty _spEffectColor;
SerializedProperty _spUseGraphicAlpha;
SerializedProperty _spBlurFactor;
void OnEnable()
{
uiEffect = (target as UIShadow).GetComponent<UIEffect>();
_spStyle = serializedObject.FindProperty("m_Style");
_spEffectDistance = serializedObject.FindProperty("m_EffectDistance");
_spEffectColor = serializedObject.FindProperty("m_EffectColor");
_spUseGraphicAlpha = serializedObject.FindProperty("m_UseGraphicAlpha");
_spBlurFactor = serializedObject.FindProperty("m_BlurFactor");
}
/// <summary>
/// Implement this function to make a custom inspector.
/// </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();
//================
// Shadow setting.
//================
EditorGUILayout.PropertyField(_spStyle);
// When shadow is enable, show parameters.
if (_spStyle.intValue != (int) ShadowStyle.None)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(_spEffectDistance);
EditorGUILayout.PropertyField(_spEffectColor);
EditorGUILayout.PropertyField(_spUseGraphicAlpha);
if (uiEffect && uiEffect.blurMode != BlurMode.None)
{
EditorGUILayout.PropertyField(_spBlurFactor);
}
EditorGUI.indentLevel--;
}
serializedObject.ApplyModifiedProperties();
}
}
}
|