From 117938ecaece43c584ee74723a36d8dc2f2a4ae1 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 26 May 2021 19:27:38 +0800 Subject: +Tween Animation --- .../Tween/Editor/TweenAnimationInspector.cs | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs') diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs new file mode 100644 index 0000000..f98c47d --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace TweenAnimation +{ + [CustomEditor(typeof(TweenAnimation), false)] + public partial class TweenAnimationInspector : Editor + { + + + public override void OnInspectorGUI() + { + TweenAnimation tween = target as TweenAnimation; + + EditorGUILayout.LabelField("Tween Alpha", TweenModuleGUIStyles.Get().moduleHeaderStyle); + // GUILayout.Button("button", "ProfilerBadge"); + //DrawProObjectField(new GUIContent(""), tween, typeof(TweenAnimation), TweenModuleGUIStyles.Get().objectField, false); + + Rect rect = GUILayoutUtility.GetRect(100, 25f); + + bool result = GUI.Toggle(rect, true, "content", TweenModuleGUIStyles.Get().moduleHeaderStyle); + rect = GUILayoutUtility.GetRect(100, 25f); + + GUI.Button(rect, "", "OL Plus"); + rect.y += 20; + GUI.Button(rect, "", "OL Minus"); + } + public static void DrawProObjectField( + GUIContent label, + SerializedProperty value, + Type objType, + GUIStyle style, + bool allowSceneObjects, + Texture objIcon = null, + params GUILayoutOption[] options) where T : UnityEngine.Object + { + + T tObj = value.objectReferenceValue as T; + + if (objIcon == null) + { + objIcon = EditorGUIUtility.FindTexture("PrefabNormal Icon"); + } + style.imagePosition = ImagePosition.ImageLeft; + + int pickerID = 455454425; + + if (tObj != null) + { + EditorGUILayout.LabelField(label, + new GUIContent(tObj.name, objIcon), style, options); + } + + if (GUILayout.Button("Select")) + { + EditorGUIUtility.ShowObjectPicker( + tObj, allowSceneObjects, "", pickerID); + + } + if (Event.current.commandName == "ObjectSelectorUpdated") + { + if (EditorGUIUtility.GetObjectPickerControlID() == pickerID) + { + tObj = EditorGUIUtility.GetObjectPickerObject() as T; + value.objectReferenceValue = tObj; + } + } + + } + + } +} \ No newline at end of file -- cgit v1.1-26-g67d0