99 * CodeStyle: https://github.com/scottcgi/Mojoc/blob/master/Docs/CodeStyle.md
1010 *
1111 * Since : 2016-6-8
12- * Update : 2019-1-8
12+ * Update : 2021-8-16
1313 * Author : scott.cgi
1414 */
1515
@@ -107,7 +107,7 @@ static TweenActionValue* AddTweenActionValue(TweenAction* action)
107107 actionValue -> OnGet = NULL ;
108108 actionValue -> OnSet = NULL ;
109109 actionValue -> isRelative = true;
110- actionValue -> easeType = TweenEaseType_Linear ;
110+ actionValue -> easeType = TweenEaseType_Smooth ;
111111
112112 return actionValue ;
113113}
@@ -187,6 +187,18 @@ static void* RunActions(Array(TweenAction*)* actions, void* tweenID)
187187}
188188
189189
190+ static void RemoveActionByIndex (Tween * tween , TweenAction * action , int index )
191+ {
192+ if (action == tween -> queueAction )
193+ {
194+ tween -> queueAction = NULL ;
195+ }
196+
197+ AArrayList -> RemoveByLast (tween -> current , index );
198+ AArrayList_Add (actionCacheList , action );
199+ }
200+
201+
190202static bool TryRemoveAction (void * tweenID , TweenAction * action )
191203{
192204 Tween * tween = AArrayIntMap_Get (tweenRunningMap , tweenID , Tween * );
@@ -199,14 +211,7 @@ static bool TryRemoveAction(void* tweenID, TweenAction* action)
199211
200212 if (action == tweenAction )
201213 {
202- if (action == tween -> queueAction )
203- {
204- tween -> queueAction = NULL ;
205- }
206-
207- AArrayList -> RemoveByLast (tween -> current , i );
208- AArrayList_Add (actionCacheList , action );
209-
214+ RemoveActionByIndex (tween , action , i );
210215 return true;
211216 }
212217 }
@@ -395,13 +400,7 @@ static void Update(float deltaSeconds)
395400 action -> OnComplete (action );
396401 }
397402
398- if (tween -> queueAction == action )
399- {
400- tween -> queueAction = NULL ;
401- }
402-
403- AArrayList -> RemoveByLast (tween -> current , j );
404- AArrayList_Add (actionCacheList , action );
403+ RemoveActionByIndex (tween , action , j );
405404 }
406405 }
407406 }
0 commit comments