From 2683c04adcaff44f9504248d2c983cd86bd4b3ad Mon Sep 17 00:00:00 2001
From: chai <chaifix@163.com>
Date: Mon, 31 May 2021 09:43:09 +0800
Subject: *tween

---
 .../Scripts/Animation/Tween/Editor/PlaybackTimer.cs     | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

(limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs')

diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs
index 69b91f7..533fbc8 100644
--- a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs
+++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs
@@ -2,18 +2,24 @@
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEditor;
+
 namespace TweenAnimation
 {
     public class PlaybackTimer
     {
-        // 考虑了Pause的playback时间,没考虑playback limit
+        // 动画
+        private TweenAnimation m_Animation;
+
+        // 考虑了Pause的playback逻辑时间,考虑了playbackLimit
         public float time
         {
             get
             {
+                float t = realTime;
                 if (m_PauseRealTime != -1)
-                    return m_PauseRealTime - m_StartRealTime;
-                return realTime;
+                    t = m_PauseRealTime - m_StartRealTime;
+                t = m_Animation.ApplyLimit(t);
+                return t;
             }
         }
 
@@ -30,8 +36,9 @@ namespace TweenAnimation
 
         private float m_PauseRealTime;
 
-        public PlaybackTimer()
+        public PlaybackTimer(TweenAnimation animation)
         {
+            m_Animation = animation;
             Reset();
         }
 
@@ -48,6 +55,8 @@ namespace TweenAnimation
         public void Pause()
         {
             m_PauseRealTime = (float)EditorApplication.timeSinceStartup;
+            float t = m_Animation.ApplyLimit(m_PauseRealTime - m_StartRealTime);
+            m_PauseRealTime = m_StartRealTime + t;
         }
 
         public void Stop()
-- 
cgit v1.1-26-g67d0