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 +++++ .../Tween/Editor/TweenAnimationInspector.cs.meta | 11 + .../Tween/Editor/TweenAnimationInspector_Alpha.cs | 16 ++ .../Editor/TweenAnimationInspector_Alpha.cs.meta | 11 + .../Tween/Editor/TweenAnimationInspector_Color.cs | 13 + .../Editor/TweenAnimationInspector_Color.cs.meta | 11 + .../Editor/TweenAnimationInspector_Position.cs | 14 + .../TweenAnimationInspector_Position.cs.meta | 11 + .../Animation/Tween/Editor/TweenModuleGUIStyles.cs | 312 +++++++++++++++++++++ .../Tween/Editor/TweenModuleGUIStyles.cs.meta | 11 + 10 files changed, 485 insertions(+) create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs.meta create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs.meta create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs.meta create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs.meta create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs create mode 100644 Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs.meta (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor') 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 diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs.meta b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs.meta new file mode 100644 index 0000000..e0cb671 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15b32017a0ad3694b83807872adca840 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs new file mode 100644 index 0000000..0ccbe70 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +namespace TweenAnimation +{ + + public partial class TweenAnimationInspector : Editor + { + public void foo(TweenModule module) + { + + + } + } +} \ No newline at end of file diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs.meta b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs.meta new file mode 100644 index 0000000..41a8c43 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Alpha.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 191f5daa382e8b943bd7a3fd5945ccc3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs new file mode 100644 index 0000000..f051b61 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +namespace TweenAnimation +{ + + public partial class TweenAnimationInspector : Editor + { + + + } +} \ No newline at end of file diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs.meta b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs.meta new file mode 100644 index 0000000..487b332 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Color.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 65c4a84e518a9d947928857beead26a1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs new file mode 100644 index 0000000..7e32b37 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +namespace TweenAnimation +{ + + public partial class TweenAnimationInspector : Editor + { + + + } + +} \ No newline at end of file diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs.meta b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs.meta new file mode 100644 index 0000000..6a8a262 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenAnimationInspector_Position.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 167a55c71d77cda4387bd10d28eabf73 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs new file mode 100644 index 0000000..ad9d09a --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs @@ -0,0 +1,312 @@ +using System; +using System.Reflection; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace TweenAnimation +{ + internal class TweenModuleGUIStyles + { + private delegate bool GetBoldDefaultFontFunc(); + private static GetBoldDefaultFontFunc GetBoldDefaultFont; + + static TweenModuleGUIStyles() + { + Type editorGUIUtility = typeof(EditorGUIUtility); + + GetBoldDefaultFont = (GetBoldDefaultFontFunc) GetMethod(typeof(GetBoldDefaultFontFunc), typeof(EditorGUIUtility), "GetBoldDefaultFont", BindingFlags.Static | BindingFlags.NonPublic); + } + + private static Delegate GetMethod(Type del, Type type, string name, BindingFlags flag) + { + var method = type.GetMethod(name, flag); + Delegate deleg = Delegate.CreateDelegate(del, method); + return deleg; + } + + public GUIStyle label + { + get + { + return GetBoldDefaultFont() ? this.m_LabelBold : this.m_Label; + } + } + + public GUIStyle editableLabel + { + get + { + return GetBoldDefaultFont() ? this.m_EditableLabelBold : this.m_EditableLabel; + } + } + + public GUIStyle objectField + { + get + { + return GetBoldDefaultFont() ? this.m_ObjectFieldBold : this.m_ObjectField; + } + } + + public GUIStyle numberField + { + get + { + return GetBoldDefaultFont() ? this.m_NumberFieldBold : this.m_NumberField; + } + } + + public GUIStyle moduleHeaderStyle + { + get + { + return GetBoldDefaultFont() ? this.m_ModuleHeaderStyleBold : this.m_ModuleHeaderStyle; + } + } + + public GUIStyle popup + { + get + { + return GetBoldDefaultFont() ? this.m_PopupStyleBold : this.m_PopupStyle; + } + } + + public GUIStyle emitterHeaderStyle + { + get + { + return this.m_EmitterHeaderStyle; + } + } + + public GUIStyle effectBgStyle + { + get + { + return this.m_EffectBgStyle; + } + } + + public GUIStyle moduleBgStyle + { + get + { + return this.m_ModuleBgStyle; + } + } + + public GUIStyle plus + { + get + { + return this.m_Plus; + } + } + + public GUIStyle minus + { + get + { + return this.m_Minus; + } + } + + public GUIStyle checkmark + { + get + { + return this.m_Checkmark; + } + } + + public GUIStyle checkmarkMixed + { + get + { + return this.m_CheckmarkMixed; + } + } + + public GUIStyle minMaxCurveStateDropDown + { + get + { + return this.m_MinMaxCurveStateDropDown; + } + } + + public GUIStyle toggle + { + get + { + return this.m_Toggle; + } + } + + public GUIStyle toggleMixed + { + get + { + return this.m_ToggleMixed; + } + } + + public GUIStyle selectionMarker + { + get + { + return this.m_SelectionMarker; + } + } + + public GUIStyle toolbarButtonLeftAlignText + { + get + { + return this.m_ToolbarButtonLeftAlignText; + } + } + + public GUIStyle modulePadding + { + get + { + return this.m_ModulePadding; + } + } + + public GUIStyle customDataWindow + { + get + { + return this.m_CustomDataWindow; + } + } + + public Texture2D warningIcon + { + get + { + return this.m_WarningIcon; + } + } + + private GUIStyle m_Label; + + private GUIStyle m_LabelBold; + + private GUIStyle m_EditableLabel; + + private GUIStyle m_EditableLabelBold; + + private GUIStyle m_ObjectField; + + private GUIStyle m_ObjectFieldBold; + + private GUIStyle m_NumberField; + + private GUIStyle m_NumberFieldBold; + + private GUIStyle m_ModuleHeaderStyle; + + private GUIStyle m_ModuleHeaderStyleBold; + + private GUIStyle m_PopupStyle; + + private GUIStyle m_PopupStyleBold; + + private GUIStyle m_EmitterHeaderStyle; + + private GUIStyle m_EffectBgStyle; + + private GUIStyle m_ModuleBgStyle; + + private GUIStyle m_Plus; + + private GUIStyle m_Minus; + + private GUIStyle m_Checkmark; + + private GUIStyle m_CheckmarkMixed; + + private GUIStyle m_MinMaxCurveStateDropDown; + + private GUIStyle m_Toggle; + + private GUIStyle m_ToggleMixed; + + private GUIStyle m_SelectionMarker; + + private GUIStyle m_ToolbarButtonLeftAlignText; + + private GUIStyle m_ModulePadding; + + private GUIStyle m_CustomDataWindow; + + private Texture2D m_WarningIcon; + + private static TweenModuleGUIStyles s_TweenModuleGUIStyles; + + public static TweenModuleGUIStyles Get() + { + bool flag = s_TweenModuleGUIStyles == null; + if (flag) + { + s_TweenModuleGUIStyles = new TweenModuleGUIStyles(); + } + return s_TweenModuleGUIStyles; + } + + private TweenModuleGUIStyles() + { + InitStyle(out this.m_Label, out this.m_LabelBold, "ShurikenLabel"); + InitStyle(out this.m_EditableLabel, out this.m_EditableLabelBold, "ShurikenEditableLabel"); + InitStyle(out this.m_ObjectField, out this.m_ObjectFieldBold, "ShurikenObjectField"); + InitStyle(out this.m_NumberField, out this.m_NumberFieldBold, "ShurikenValue"); + InitStyle(out this.m_ModuleHeaderStyle, out this.m_ModuleHeaderStyleBold, "ShurikenModuleTitle"); + InitStyle(out this.m_PopupStyle, out this.m_PopupStyleBold, "ShurikenPopUp"); + InitStyle(out this.m_EmitterHeaderStyle, "ShurikenEmitterTitle"); + InitStyle(out this.m_EmitterHeaderStyle, "ShurikenEmitterTitle"); + InitStyle(out this.m_EffectBgStyle, "ShurikenEffectBg"); + InitStyle(out this.m_ModuleBgStyle, "ShurikenModuleBg"); + InitStyle(out this.m_Plus, "OL Plus"); + InitStyle(out this.m_Minus, "OL Minus"); + InitStyle(out this.m_Checkmark, "ShurikenCheckMark"); + InitStyle(out this.m_CheckmarkMixed, "ShurikenCheckMarkMixed"); + InitStyle(out this.m_MinMaxCurveStateDropDown, "ShurikenDropdown"); + InitStyle(out this.m_Toggle, "ShurikenToggle"); + InitStyle(out this.m_ToggleMixed, "ShurikenToggleMixed"); + InitStyle(out this.m_SelectionMarker, "IN ThumbnailShadow"); + InitStyle(out this.m_ToolbarButtonLeftAlignText, "ToolbarButton"); + this.m_CustomDataWindow = new GUIStyle(GUI.skin.window); + this.m_CustomDataWindow.font = EditorStyles.miniFont; + this.m_EmitterHeaderStyle.clipping = TextClipping.Clip; + this.m_EmitterHeaderStyle.padding.right = 45; + //this.m_WarningIcon = EditorGUIUtility.LoadIcon("console.infoicon.sml"); + this.m_ToolbarButtonLeftAlignText = new GUIStyle(this.m_ToolbarButtonLeftAlignText); + this.m_ToolbarButtonLeftAlignText.alignment = TextAnchor.MiddleLeft; + this.m_ModulePadding = new GUIStyle(); + this.m_ModulePadding.padding = new RectOffset(3, 3, 4, 2); + } + + private static void InitStyle(out GUIStyle normal, string name) + { + normal = FindStyle(name); + } + + private static void InitStyle(out GUIStyle normal, out GUIStyle bold, string name) + { + InitStyle(out normal, name); + bold = new GUIStyle(normal); + bold.font = EditorStyles.miniBoldFont; + } + + private static GUIStyle FindStyle(string styleName) + { + return styleName; + } + } +} \ No newline at end of file diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs.meta b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs.meta new file mode 100644 index 0000000..6ec3473 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 905cfc26c14b1d3428354540d06779b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0