From 654d95efad67a00cb4cffc300419092e9a5093e5 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 27 May 2021 18:11:57 +0800 Subject: *tween animation --- .../Animation/Tween/Editor/TweenModuleGUIStyles.cs | 95 +++++++++++++++++++++- 1 file changed, 92 insertions(+), 3 deletions(-) (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs') diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs index ad9d09a..2e90cb8 100644 --- a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleGUIStyles.cs @@ -12,11 +12,25 @@ namespace TweenAnimation private delegate bool GetBoldDefaultFontFunc(); private static GetBoldDefaultFontFunc GetBoldDefaultFont; + static Texture2D m_BgTexture; + static Texture2D m_BgTextureActive; + static Texture2D m_BgTextureWire; + static Texture2D m_BgTextureWireSmall; + + static Texture2D LoadTexture(string path) + { + return AssetDatabase.LoadAssetAtPath(path, typeof(Texture2D)) as Texture2D; + } + static TweenModuleGUIStyles() { Type editorGUIUtility = typeof(EditorGUIUtility); + GetBoldDefaultFont = (GetBoldDefaultFontFunc)GetMethod(typeof(GetBoldDefaultFontFunc), typeof(EditorGUIUtility), "GetBoldDefaultFont", BindingFlags.Static | BindingFlags.NonPublic); - GetBoldDefaultFont = (GetBoldDefaultFontFunc) GetMethod(typeof(GetBoldDefaultFontFunc), typeof(EditorGUIUtility), "GetBoldDefaultFont", BindingFlags.Static | BindingFlags.NonPublic); + m_BgTexture = LoadTexture(TweenAnimationSetup.root + "Icons/Background.png"); + m_BgTextureActive = LoadTexture(TweenAnimationSetup.root + "Icons/BackgroundActive.png"); + m_BgTextureWire = LoadTexture(TweenAnimationSetup.root + "Icons/BackgroundWire.png"); + m_BgTextureWireSmall = LoadTexture(TweenAnimationSetup.root + "Icons/BackgroundWireSmall.png"); } private static Delegate GetMethod(Type del, Type type, string name, BindingFlags flag) @@ -194,6 +208,22 @@ namespace TweenAnimation } } + public GUIStyle floatfiled + { + get + { + return m_FloatField; + } + } + + public GUIStyle headerBg + { + get + { + return m_HeaderBg; + } + } + private GUIStyle m_Label; private GUIStyle m_LabelBold; @@ -246,10 +276,29 @@ namespace TweenAnimation private GUIStyle m_CustomDataWindow; + private GUIStyle m_FloatField; + private Texture2D m_WarningIcon; private static TweenModuleGUIStyles s_TweenModuleGUIStyles; + private GUIStyle m_HeaderBg; + + private GUIStyle m_HeaderTitle; + public GUIStyle headerTitle { get { return m_HeaderTitle; } } + + private GUIStyle m_Bg; + public GUIStyle bg { get { return m_Bg; } } + + private GUIStyle m_BgSmall; + public GUIStyle bgSmall { get { return m_BgSmall; } } + + private GUIStyle m_AddNewModule; + public GUIStyle addNewModule { get { return m_AddNewModule; } } + + private GUIStyle m_Text; + public GUIStyle text { get { return m_Text; } } + public static TweenModuleGUIStyles Get() { bool flag = s_TweenModuleGUIStyles == null; @@ -285,18 +334,58 @@ namespace TweenAnimation 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); - } + InitStyle(out m_FloatField, EditorStyles.numberField, s => s.fontSize = 9); + InitStyle(out m_HeaderBg, s => { + s.border = new RectOffset(11, 15, 10, 15); + s.normal.background = m_BgTexture; + s.active.background = m_BgTextureActive; + s.hover.background = m_BgTexture; + }); + InitStyle(out m_HeaderTitle, s => { + s.fontStyle = FontStyle.Bold; + s.fontSize = 9; + }); + InitStyle(out m_Bg, s => { + s.border = new RectOffset(5, 5, 5, 5); + s.normal.background = m_BgTextureWire; + }); + InitStyle(out m_BgSmall, s => { + s.border = new RectOffset(3, 3, 3, 3); + s.normal.background = m_BgTextureWireSmall; + }); + InitStyle(out m_AddNewModule,EditorStyles.miniButtonMid , s => { + s.fontSize = 9; + }); + + InitStyle(out m_Text, EditorStyles.label, s => { + s.fontSize = 9; + }); + } + private static void InitStyle(out GUIStyle normal, string name) { normal = FindStyle(name); } + private delegate void Initter(GUIStyle style); + + private static void InitStyle(out GUIStyle normal, GUIStyle other, Initter initter) + { + normal = new GUIStyle(other); + initter(normal); + } + + private static void InitStyle(out GUIStyle normal, Initter initter) + { + normal = new GUIStyle(); + initter(normal); + } + private static void InitStyle(out GUIStyle normal, out GUIStyle bold, string name) { InitStyle(out normal, name); -- cgit v1.1-26-g67d0