12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using Fort23.Core;
- using UnityEngine;
- namespace Utility.CTween
- {
- public static class CustomTweenEX
- {
- public enum CustomAnimationCurve
- {
- Line,
- InExpo
- }
- public static T SetEase<T>(this T t, CustomAnimationCurve ease) where T : CustomTweener
- {
- switch (ease)
- {
- case CustomAnimationCurve.Line:
- t.AnimationCurve = CustomTweenManager.AnimationCurveLibrary.Line;
- break;
- case CustomAnimationCurve.InExpo:
- t.AnimationCurve = CustomTweenManager.AnimationCurveLibrary.InExpo;
- break;
- }
- return t;
- }
- public static T OnComplete<T>(this T t, Action action) where T : CustomTweener
- {
- t.OnCompleteAction = action;
- return t;
- }
-
- public static T SetLoop<T>(this T t, bool isLoop) where T : CustomTweener
- {
- t.IsLoop = isLoop;
- return t;
- }
- /// <summary>
- /// 注册变量改变事件
- /// </summary>
- /// <param name="t"></param>
- /// <param name="action"></param>
- /// <typeparam name="T"></typeparam>
- /// <returns></returns>
- public static T RegValueChangeAction<T>(this T t, Action action) where T : CustomTweener
- {
- action.Invoke();
- return t;
- }
- public static T OnUpdate<T>(this T t, Action action) where T : CustomTweener
- {
- t.OnUpdateAction += action;
- return t;
- }
- public static T OnUpdate<T>(this T t, Action<object> action) where T : CustomTweener
- {
- t.OnUpdateAndValueAction += action;
- return t;
- }
- }
- }
|