public override void OnInspectorGUI() { GUILayout.Space(6f); CustomUITweenEditorTools.SetLabelWidth(120f); CustomTweenHeight tw = target as CustomTweenHeight; GUI.changed = false; int from = EditorGUILayout.IntField("From", tw.from); int to = EditorGUILayout.IntField("To", tw.to); bool table = EditorGUILayout.Toggle("Update Table", tw.updateTable); if (from < 0) { from = 0; } if (to < 0) { to = 0; } if (GUI.changed) { CustomUITweenEditorTools.RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; tw.updateTable = table; CustomUITweenTools.SetDirty(tw); } DrawCommonProperties(); }
/// <summary> /// 开始补间操作 /// </summary> static public CustomTweenHeight Begin(RectTransform rectTransform, float duration, int height) { CustomTweenHeight comp = CustomUITweener.Begin <CustomTweenHeight>(rectTransform.gameObject, duration); comp.from = (int)rectTransform.sizeDelta.y; comp.to = height; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } return(comp); }