|
@@ -12,13 +12,6 @@ public enum Curve
|
|
|
EaseOutQuad,
|
|
|
}
|
|
|
|
|
|
-public enum TweenType
|
|
|
-{
|
|
|
- CG,
|
|
|
- Vector,
|
|
|
- Graphic,
|
|
|
-}
|
|
|
-
|
|
|
public delegate float CurveFunctionF(float timer, float duration, float start, float delta);
|
|
|
|
|
|
public delegate Color CurveFunctionC(float timer, float duration, Color start, Color delta);
|
|
@@ -30,17 +23,20 @@ public class ManaAnim : MonoBehaviour
|
|
|
#region 变量
|
|
|
|
|
|
public static List<Move> MoveList;
|
|
|
- public static List<Tween> ForwardList;
|
|
|
- public static List<Tween> BackwardList;
|
|
|
+ public static List<Tween> TweenForList;
|
|
|
+ public static List<Tween> TweenBacList;
|
|
|
|
|
|
public static Dictionary<Curve, CurveFunctionF> FunctionDicF;
|
|
|
public static Dictionary<Curve, CurveFunctionC> FunctionDicC;
|
|
|
public static Dictionary<Curve, CurveFunctionV> FunctionDicV;
|
|
|
|
|
|
- private static Dictionary<Transform, Move> MoveDic;
|
|
|
- private static Dictionary<Transform, Tween> TweenCgDic;
|
|
|
- private static Dictionary<Transform, Tween> TweenVectorDic;
|
|
|
- private static Dictionary<Transform, Tween> TweenGraphicDic;
|
|
|
+ private static Dictionary<Transform, MoveVec> MoveVecDic;
|
|
|
+ private static Dictionary<Transform, MoveScrr> MoveScrrDic;
|
|
|
+
|
|
|
+ private static Dictionary<Transform, TweenCG> TweenCgDic;
|
|
|
+ private static Dictionary<Transform, TweenVec> TweenVecDic;
|
|
|
+ private static Dictionary<Transform, TweenGra> TweenGraDic;
|
|
|
+ private static Dictionary<Transform, TweenScale> TweenScaleDic;
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -59,17 +55,17 @@ public class ManaAnim : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < ForwardList.Count; i++)
|
|
|
+ for (int i = 0; i < TweenForList.Count; i++)
|
|
|
{
|
|
|
- if (ForwardList[i].DoForward())
|
|
|
+ if (TweenForList[i].DoForward())
|
|
|
{
|
|
|
i--;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < BackwardList.Count; i++)
|
|
|
+ for (int i = 0; i < TweenBacList.Count; i++)
|
|
|
{
|
|
|
- if (BackwardList[i].DoBackward())
|
|
|
+ if (TweenBacList[i].DoBackward())
|
|
|
{
|
|
|
i--;
|
|
|
}
|
|
@@ -80,17 +76,20 @@ public class ManaAnim : MonoBehaviour
|
|
|
private void RegistValue()
|
|
|
{
|
|
|
MoveList = new List<Move>();
|
|
|
- ForwardList = new List<Tween>();
|
|
|
- BackwardList = new List<Tween>();
|
|
|
+ TweenForList = new List<Tween>();
|
|
|
+ TweenBacList = new List<Tween>();
|
|
|
|
|
|
FunctionDicF = new Dictionary<Curve, CurveFunctionF>();
|
|
|
FunctionDicC = new Dictionary<Curve, CurveFunctionC>();
|
|
|
FunctionDicV = new Dictionary<Curve, CurveFunctionV>();
|
|
|
|
|
|
- MoveDic = new Dictionary<Transform, Move>();
|
|
|
- TweenCgDic = new Dictionary<Transform, Tween>();
|
|
|
- TweenVectorDic = new Dictionary<Transform, Tween>();
|
|
|
- TweenGraphicDic = new Dictionary<Transform, Tween>();
|
|
|
+ MoveVecDic = new Dictionary<Transform, MoveVec>();
|
|
|
+ MoveScrrDic = new Dictionary<Transform, MoveScrr>();
|
|
|
+
|
|
|
+ TweenCgDic = new Dictionary<Transform, TweenCG>();
|
|
|
+ TweenVecDic = new Dictionary<Transform, TweenVec>();
|
|
|
+ TweenGraDic = new Dictionary<Transform, TweenGra>();
|
|
|
+ TweenScaleDic = new Dictionary<Transform, TweenScale>();
|
|
|
|
|
|
FunctionDicF.Add(Curve.Linear, Linear);
|
|
|
FunctionDicF.Add(Curve.EaseOutQuad, EaseOutQuad);
|
|
@@ -103,11 +102,24 @@ public class ManaAnim : MonoBehaviour
|
|
|
}
|
|
|
|
|
|
|
|
|
+ #region 动画函数
|
|
|
+
|
|
|
public static float Linear(float timer, float duration, float start, float delta)
|
|
|
{
|
|
|
return delta*timer/duration + start;
|
|
|
}
|
|
|
|
|
|
+ public static Color Linear(float timer, float duration, Color start, Color delta)
|
|
|
+ {
|
|
|
+ return new Color(Linear(timer, duration, start.r, delta.r), Linear(timer, duration, start.g, delta.g), Linear(timer, duration, start.b, delta.b), Linear(timer, duration, start.a, delta.a));
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Vector3 Linear(float timer, float duration, Vector3 start, Vector3 delta)
|
|
|
+ {
|
|
|
+ return new Vector3(Linear(timer, duration, start.x, delta.x), Linear(timer, duration, start.y, delta.y), Linear(timer, duration, start.z, delta.z));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public static float EaseOutQuad(float timer, float duration, float start, float delta)
|
|
|
{
|
|
|
timer /= duration;
|
|
@@ -115,110 +127,208 @@ public class ManaAnim : MonoBehaviour
|
|
|
return -delta*timer*(timer - 2) + start;
|
|
|
}
|
|
|
|
|
|
- public static Color Linear(float timer, float duration, Color start, Color delta)
|
|
|
+ public static Color EaseOutQuad(float timer, float duration, Color start, Color delta)
|
|
|
{
|
|
|
- return new Color(Linear(timer, duration, start.r, delta.r), Linear(timer, duration, start.g, delta.g), Linear(timer, duration, start.b, delta.b), Linear(timer, duration, start.a, delta.a));
|
|
|
+ return new Color(EaseOutQuad(timer, duration, start.r, delta.r), EaseOutQuad(timer, duration, start.g, delta.g), EaseOutQuad(timer, duration, start.b, delta.b), EaseOutQuad(timer, duration, start.a, delta.a));
|
|
|
}
|
|
|
|
|
|
- public static Color EaseOutQuad(float timer, float duration, Color start, Color delta)
|
|
|
+ public static Vector3 EaseOutQuad(float timer, float duration, Vector3 start, Vector3 delta)
|
|
|
{
|
|
|
- return new Color(EaseOutQuad(timer, duration, start.r, delta.r), EaseOutQuad(timer, duration, start.g, delta.g), EaseOutQuad(timer, duration, start.b, delta.b), EaseOutQuad(timer, duration, start.a, delta.a));
|
|
|
+ return new Vector3(EaseOutQuad(timer, duration, start.x, delta.x), EaseOutQuad(timer, duration, start.y, delta.y), EaseOutQuad(timer, duration, start.z, delta.z));
|
|
|
}
|
|
|
|
|
|
- public static Vector3 Linear(float timer, float duration, Vector3 start, Vector3 delta)
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 播放动画
|
|
|
+
|
|
|
+ public static void MoveVec(Transform target, Vector3 destination, float duration, Curve curve)
|
|
|
{
|
|
|
- return new Vector3(Linear(timer, duration, start.x, delta.x), Linear(timer, duration, start.y, delta.y), Linear(timer, duration, start.z, delta.z));
|
|
|
+ MoveVec moveVec;
|
|
|
+
|
|
|
+ if (MoveVecDic.TryGetValue(target, out moveVec))
|
|
|
+ {
|
|
|
+ moveVec.StartMove(destination, duration, curve);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ moveVec = CreateMoveVec(target);
|
|
|
+
|
|
|
+ moveVec.StartMove(destination, duration, curve);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Vector3 EaseOutQuad(float timer, float duration, Vector3 start, Vector3 delta)
|
|
|
+ public static void MoveScrr(Transform target, float destination, float duration, Curve curve)
|
|
|
{
|
|
|
- return new Vector3(EaseOutQuad(timer, duration, start.x, delta.x), EaseOutQuad(timer, duration, start.y, delta.y), EaseOutQuad(timer, duration, start.z, delta.z));
|
|
|
+ MoveScrr moveScrr;
|
|
|
+
|
|
|
+ if (MoveScrrDic.TryGetValue(target, out moveScrr))
|
|
|
+ {
|
|
|
+ moveScrr.StartMove(destination, duration, curve);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ moveScrr = CreateMoveScrr(target);
|
|
|
+
|
|
|
+ moveScrr.StartMove(destination, duration, curve);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static void Move(Transform target, Vector3 destination, float duration, Curve curve)
|
|
|
+ public static void TweenForCG(Transform target)
|
|
|
{
|
|
|
- Move move;
|
|
|
+ TweenCG tweenCG;
|
|
|
|
|
|
- if (MoveDic.TryGetValue(target, out move))
|
|
|
+ if (TweenCgDic.TryGetValue(target, out tweenCG))
|
|
|
{
|
|
|
- move.StartMove(destination, duration, curve);
|
|
|
+ tweenCG.StartForward();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- move = CreateMove(target);
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void TweenForVec(Transform target)
|
|
|
+ {
|
|
|
+ TweenVec tweenVec;
|
|
|
|
|
|
- move.StartMove(destination, duration, curve);
|
|
|
+ if (TweenVecDic.TryGetValue(target, out tweenVec))
|
|
|
+ {
|
|
|
+ tweenVec.StartForward();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void Forward(Transform target, TweenType tweenType)
|
|
|
+ public static void TweenForGra(Transform target)
|
|
|
{
|
|
|
- Tween tween;
|
|
|
+ TweenGra tweenGra;
|
|
|
|
|
|
- if (tweenType == TweenType.CG)
|
|
|
+ if (TweenGraDic.TryGetValue(target, out tweenGra))
|
|
|
{
|
|
|
- tween = TweenCgDic[target];
|
|
|
+ tweenGra.StartForward();
|
|
|
}
|
|
|
- else if (tweenType == TweenType.Vector)
|
|
|
+ else
|
|
|
{
|
|
|
- tween = TweenVectorDic[target];
|
|
|
+ throw new Exception();
|
|
|
}
|
|
|
- else if (tweenType == TweenType.Graphic)
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void TweenForScale(Transform target)
|
|
|
+ {
|
|
|
+ TweenScale tweenScale;
|
|
|
+
|
|
|
+ if (TweenScaleDic.TryGetValue(target, out tweenScale))
|
|
|
{
|
|
|
- tween = TweenGraphicDic[target];
|
|
|
+ tweenScale.StartForward();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
throw new Exception();
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void TweenBacCG(Transform target)
|
|
|
+ {
|
|
|
+ TweenCG tweenCG;
|
|
|
|
|
|
- tween.StartForward();
|
|
|
+ if (TweenCgDic.TryGetValue(target, out tweenCG))
|
|
|
+ {
|
|
|
+ tweenCG.StartBackward();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static void Backward(Transform target, TweenType tweenType)
|
|
|
+ public static void TweenBacVec(Transform target)
|
|
|
{
|
|
|
- Tween tween;
|
|
|
+ TweenVec tweenVec;
|
|
|
|
|
|
- if (tweenType == TweenType.CG)
|
|
|
+ if (TweenVecDic.TryGetValue(target, out tweenVec))
|
|
|
{
|
|
|
- tween = TweenCgDic[target];
|
|
|
+ tweenVec.StartBackward();
|
|
|
}
|
|
|
- else if (tweenType == TweenType.Vector)
|
|
|
+ else
|
|
|
{
|
|
|
- tween = TweenVectorDic[target];
|
|
|
+ throw new Exception();
|
|
|
}
|
|
|
- else if (tweenType == TweenType.Graphic)
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void TweenBacGra(Transform target)
|
|
|
+ {
|
|
|
+ TweenGra tweenGra;
|
|
|
+
|
|
|
+ if (TweenGraDic.TryGetValue(target, out tweenGra))
|
|
|
{
|
|
|
- tween = TweenGraphicDic[target];
|
|
|
+ tweenGra.StartBackward();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
throw new Exception();
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void TweenBacScale(Transform target)
|
|
|
+ {
|
|
|
+ TweenScale tweenScale;
|
|
|
|
|
|
- tween.StartBackward();
|
|
|
+ if (TweenScaleDic.TryGetValue(target, out tweenScale))
|
|
|
+ {
|
|
|
+ tweenScale.StartBackward();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
|
|
|
- public static Move GetMove(Transform target)
|
|
|
+ #region 得到动画
|
|
|
+
|
|
|
+ public static MoveVec GetMoveVec(Transform target)
|
|
|
{
|
|
|
- return MoveDic[target];
|
|
|
+ MoveVec moveVec;
|
|
|
+
|
|
|
+ if (MoveVecDic.TryGetValue(target, out moveVec))
|
|
|
+ {
|
|
|
+ return moveVec;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween GetTween(Transform target, TweenType tweenType)
|
|
|
+ public static MoveScrr GetMoveScrr(Transform target)
|
|
|
{
|
|
|
- if (tweenType == TweenType.Vector)
|
|
|
+ MoveScrr moveScrr;
|
|
|
+
|
|
|
+ if (MoveScrrDic.TryGetValue(target, out moveScrr))
|
|
|
{
|
|
|
- return TweenVectorDic[target];
|
|
|
+ return moveScrr;
|
|
|
}
|
|
|
- else if (tweenType == TweenType.CG)
|
|
|
+ else
|
|
|
{
|
|
|
- return TweenCgDic[target];
|
|
|
+ throw new Exception();
|
|
|
}
|
|
|
- else if (tweenType == TweenType.Graphic)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static TweenCG GetTweenCG(Transform target)
|
|
|
+ {
|
|
|
+ TweenCG tweenCG;
|
|
|
+
|
|
|
+ if (TweenCgDic.TryGetValue(target, out tweenCG))
|
|
|
{
|
|
|
- return TweenGraphicDic[target];
|
|
|
+ return tweenCG;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -226,80 +336,273 @@ public class ManaAnim : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static TweenVec GetTweenVec(Transform target)
|
|
|
+ {
|
|
|
+ TweenVec tweenVec;
|
|
|
+
|
|
|
+ if (TweenVecDic.TryGetValue(target, out tweenVec))
|
|
|
+ {
|
|
|
+ return tweenVec;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- public static Move CreateMove(Transform target)
|
|
|
+ public static TweenGra GetTweenGra(Transform target)
|
|
|
{
|
|
|
- Move move = new Move(target);
|
|
|
-
|
|
|
- MoveDic.Add(target, move);
|
|
|
+ TweenGra tweenGra;
|
|
|
|
|
|
- return move;
|
|
|
+ if (TweenGraDic.TryGetValue(target, out tweenGra))
|
|
|
+ {
|
|
|
+ return tweenGra;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween CreateTween(Transform target, float origin, float destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ public static TweenScale GetTweenScale(Transform target)
|
|
|
{
|
|
|
- CanvasGroup cg = target.GetComponent<CanvasGroup>();
|
|
|
+ TweenScale tweenScale;
|
|
|
|
|
|
- TweenCG tween = new TweenCG(cg, origin, destination, duration, originActive, destActive, curve);
|
|
|
+ if (TweenScaleDic.TryGetValue(target, out tweenScale))
|
|
|
+ {
|
|
|
+ return tweenScale;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- TweenCgDic.Add(target, tween);
|
|
|
+ #endregion
|
|
|
|
|
|
- return tween;
|
|
|
+
|
|
|
+ #region 创建动画
|
|
|
+
|
|
|
+ public static MoveVec CreateMoveVec(Transform target)
|
|
|
+ {
|
|
|
+ if (MoveVecDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ MoveVec moveVec = MoveVecDic[target];
|
|
|
+
|
|
|
+ moveVec = new MoveVec(target);
|
|
|
+
|
|
|
+ return moveVec;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MoveVec moveVec = new MoveVec(target);
|
|
|
+
|
|
|
+ MoveVecDic.Add(target, moveVec);
|
|
|
+
|
|
|
+ return moveVec;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween CreateTween(Transform target, float destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ public static MoveScrr CreateMoveScrr(Transform target)
|
|
|
{
|
|
|
- CanvasGroup cg = target.GetComponent<CanvasGroup>();
|
|
|
+ if (MoveScrrDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ MoveScrr moveScrr = MoveScrrDic[target];
|
|
|
+
|
|
|
+ moveScrr = new MoveScrr(target.GetComponent<ScrollRect>());
|
|
|
|
|
|
- TweenCG tween = new TweenCG(cg, cg.alpha, destination, duration, originActive, destActive, curve);
|
|
|
+ return moveScrr;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MoveScrr moveScrr = new MoveScrr(target.GetComponent<ScrollRect>());
|
|
|
|
|
|
- TweenCgDic.Add(target, tween);
|
|
|
+ MoveScrrDic.Add(target, moveScrr);
|
|
|
|
|
|
- return tween;
|
|
|
+ return moveScrr;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween CreateTween(Transform target, Color origin, Color destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ public static TweenCG CreateTweenCG(Transform target, float origin, float destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
{
|
|
|
- Graphic graphic = target.GetComponent<Graphic>();
|
|
|
+ if (TweenCgDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ CanvasGroup cg = target.GetComponent<CanvasGroup>();
|
|
|
+
|
|
|
+ TweenCG tween = TweenCgDic[target];
|
|
|
+
|
|
|
+ tween = new TweenCG(cg, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CanvasGroup cg = target.GetComponent<CanvasGroup>();
|
|
|
|
|
|
- TweenGraphic tween = new TweenGraphic(graphic, origin, destination, duration, originActive, destActive, curve);
|
|
|
+ TweenCG tween = new TweenCG(cg, origin, destination, duration, originActive, destActive, curve);
|
|
|
|
|
|
- TweenGraphicDic.Add(target, tween);
|
|
|
+ TweenCgDic.Add(target, tween);
|
|
|
|
|
|
- return tween;
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween CreateTween(Transform target, Color destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ public static TweenCG CreateTweenCG(Transform target, float destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
{
|
|
|
- Graphic graphic = target.GetComponent<Graphic>();
|
|
|
+ if (TweenCgDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ CanvasGroup cg = target.GetComponent<CanvasGroup>();
|
|
|
+
|
|
|
+ TweenCG tween = TweenCgDic[target];
|
|
|
+
|
|
|
+ tween = new TweenCG(cg, cg.alpha, destination, duration, originActive, destActive, curve);
|
|
|
|
|
|
- TweenGraphic tween = new TweenGraphic(graphic, graphic.color, destination, duration, originActive, destActive, curve);
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CanvasGroup cg = target.GetComponent<CanvasGroup>();
|
|
|
|
|
|
- TweenGraphicDic.Add(target, tween);
|
|
|
+ TweenCG tween = new TweenCG(cg, cg.alpha, destination, duration, originActive, destActive, curve);
|
|
|
|
|
|
- return tween;
|
|
|
+ TweenCgDic.Add(target, tween);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween CreateTween(Transform target, Vector3 origin, Vector3 destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ public static TweenVec CreateTweenVec(Transform target, Vector3 origin, Vector3 destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
{
|
|
|
origin.z = target.position.z;
|
|
|
destination.z = target.position.z;
|
|
|
-
|
|
|
- TweenVector tween = new TweenVector(target, origin, destination, duration, originActive, destActive, curve);
|
|
|
|
|
|
- TweenVectorDic.Add(target, tween);
|
|
|
+ if (TweenVecDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ TweenVec tween = TweenVecDic[target];
|
|
|
+
|
|
|
+ tween = new TweenVec(target, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TweenVec tween = new TweenVec(target, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ TweenVecDic.Add(target, tween);
|
|
|
|
|
|
- return tween;
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public static Tween CreateTween(Transform target, Vector3 destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ public static TweenVec CreateTweenVec(Transform target, Vector3 destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
{
|
|
|
destination.z = target.position.z;
|
|
|
|
|
|
- TweenVector tween = new TweenVector(target, target.position, destination, duration, originActive, destActive, curve);
|
|
|
-
|
|
|
- TweenVectorDic.Add(target, tween);
|
|
|
+ if (TweenVecDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ TweenVec tween = TweenVecDic[target];
|
|
|
+
|
|
|
+ tween = new TweenVec(target, target.position, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TweenVec tween = new TweenVec(target, target.position, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ TweenVecDic.Add(target, tween);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static TweenGra CreateTweenGra(Transform target, Color origin, Color destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ {
|
|
|
+ if (TweenGraDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ Graphic graphic = target.GetComponent<Graphic>();
|
|
|
+
|
|
|
+ TweenGra tween = TweenGraDic[target];
|
|
|
+
|
|
|
+ tween = new TweenGra(graphic, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Graphic graphic = target.GetComponent<Graphic>();
|
|
|
+
|
|
|
+ TweenGra tween = new TweenGra(graphic, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ TweenGraDic.Add(target, tween);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static TweenGra CreateTweenGra(Transform target, Color destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ {
|
|
|
+ if (TweenGraDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ Graphic graphic = target.GetComponent<Graphic>();
|
|
|
+
|
|
|
+ TweenGra tween = TweenGraDic[target];
|
|
|
+
|
|
|
+ tween = new TweenGra(graphic, graphic.color, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Graphic graphic = target.GetComponent<Graphic>();
|
|
|
+
|
|
|
+ TweenGra tween = new TweenGra(graphic, graphic.color, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ TweenGraDic.Add(target, tween);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static TweenScale CreateTweenScale(Transform target, Vector3 origin, Vector3 destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ {
|
|
|
+ if (TweenScaleDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ TweenScale tween = TweenScaleDic[target];
|
|
|
|
|
|
- return tween;
|
|
|
+ tween = new TweenScale(target, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TweenScale tween = new TweenScale(target, origin, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ TweenScaleDic.Add(target, tween);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ public static TweenScale CreateTweenScale(Transform target, Vector3 destination, float duration, bool originActive, bool destActive, Curve curve)
|
|
|
+ {
|
|
|
+ if (TweenScaleDic.ContainsKey(target))
|
|
|
+ {
|
|
|
+ TweenScale tween = TweenScaleDic[target];
|
|
|
+
|
|
|
+ tween = new TweenScale(target, target.localScale, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ TweenScale tween = new TweenScale(target, target.localScale, destination, duration, originActive, destActive, curve);
|
|
|
+
|
|
|
+ TweenScaleDic.Add(target, tween);
|
|
|
+
|
|
|
+ return tween;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|