From 26e4dc3a35d9c778684388de1af8b3f288fe627d Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 28 May 2021 20:00:48 +0800 Subject: *Tween --- .../Animation/Tween/Editor/TweenModuleUI.cs | 69 +++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleUI.cs') diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleUI.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleUI.cs index aeb4e8b..22071ea 100644 --- a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleUI.cs +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/TweenModuleUI.cs @@ -104,7 +104,7 @@ namespace TweenAnimation PrefixLabel(controlRect, guiContent); Rect position = controlRect; position.xMin += EditorGUIUtility.labelWidth; - content = GUI.TextField(position, content); + content = GUI.TextField(position, content, styles.textField); return content; } @@ -132,6 +132,35 @@ namespace TweenAnimation return EditorGUI.EnumPopup(rect, enumValue, styles.popup); } + public bool GUIToggle(string label, bool toggled, params GUILayoutOption[] layoutOptions) + { + return GUIToggle(new GUIContent(label), toggled, layoutOptions); + } + + public bool GUIToggle(GUIContent label, bool toggled, params GUILayoutOption[] layoutOptions) + { + Rect rect = GetControlRect(13, layoutOptions); + rect = PrefixLabel(rect, label); + toggled = EditorGUI.Toggle(rect, toggled, styles.toggle); + return toggled; + } + + public UnityEngine.Object GUIObject(string label, UnityEngine.Object obj, Type type, params GUILayoutOption[] layoutOptions) + { + return GUIObject(new GUIContent(label), obj, type, layoutOptions); + } + + public UnityEngine.Object GUIObject(GUIContent label, UnityEngine.Object obj, Type type, params GUILayoutOption[] layoutOptions) + { + Rect rect = GetControlRect(13, layoutOptions); + rect = PrefixLabel(rect, label); + int fontsize = EditorStyles.objectField.fontSize; + EditorStyles.objectField.fontSize = 9; + obj = EditorGUI.ObjectField(rect, obj, type, true); + EditorStyles.objectField.fontSize = fontsize; + return obj; + } + private Rect PrefixLabel(Rect totalPosition, GUIContent label) { bool flag = !EditorGUI_LabelHasContent(label); @@ -181,6 +210,44 @@ namespace TweenAnimation return GUILayoutUtility.GetLastRect(); } + public void DrawVerticalLineFast(float x, float minY, float maxY, Color color) + { + bool bWin = Application.platform == RuntimePlatform.WindowsEditor; + if (bWin) + { + GL.Color(color); + GL.Vertex(new Vector3(x - 0.5f, minY, 0f)); + GL.Vertex(new Vector3(x + 0.5f, minY, 0f)); + GL.Vertex(new Vector3(x + 0.5f, maxY, 0f)); + GL.Vertex(new Vector3(x - 0.5f, maxY, 0f)); + } + else + { + GL.Color(color); + GL.Vertex(new Vector3(x, minY, 0f)); + GL.Vertex(new Vector3(x, maxY, 0f)); + } + } + + public void DrawHorizontalLineFast(float y, float minX, float maxX, Color color) + { + bool bWin = Application.platform == RuntimePlatform.WindowsEditor; + if (bWin) + { + GL.Color(color); + GL.Vertex(new Vector3(minX, y - 0.5f, 0f)); + GL.Vertex(new Vector3(minX, y + 0.5f, 0f)); + GL.Vertex(new Vector3(maxX, y + 0.5f, 0f)); + GL.Vertex(new Vector3(maxX, y - 0.5f, 0f)); + } + else + { + GL.Color(color); + GL.Vertex(new Vector3(minX, y, 0f)); + GL.Vertex(new Vector3(maxX, y, 0f)); + } + } + } } -- cgit v1.1-26-g67d0