cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
5.49k stars 1.58k forks source link

Add tween.running getter and use it in the new added unit tests for tween.stopAll #17193

Closed dumganhar closed 1 week ago

dumganhar commented 1 week ago

Also add Tween.getRunningCount static method. Feature was requested in https://forum.cocos.org/t/topic/128931

Re: #

Changelog

*


Continuous Integration

This pull request:


Compatibility Check

This pull request:

github-actions[bot] commented 1 week ago

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -55041,8 +55041,13 @@
          * @return @en The instance itself for easier chaining. @zh 返回该实例本身,以便于链式调用。
          */
         resume(): Tween<T>;
         /**
+         * @en Checking whether the current tween instance is running.
+         * @zh 检查当前缓动实例是否在运行。
+         */
+        get running(): boolean;
+        /**
          * @en
          * Clone a tween.
          * @zh
          * 克隆当前 tween。
@@ -55238,8 +55243,16 @@
          * @return @en The instance itself for easier chaining. @zh 返回该实例本身,以便于链式调用。
          */
         destroySelf(): __private._cocos_tween_tween__TweenWithNodeTargetOrUnknown<T>;
         /**
+         * @en Get the count of running tween instances those associate with the target.
+         * @zh 获取目标对象关联的正在运行的缓动实例的个数。
+         * @param target @en The target to check. @zh 要检查的目标对象。
+         * @return @en The count of running tween instances those associate with the target.
+         *         @zh 目标对象关联的正在运行的缓动实例的个数。
+         */
+        static getRunningCount<U extends object = any>(target: U): number;
+        /**
          * @en
          * Stop all tween instances.
          * @zh
          * 停止所有缓动实例
@@ -70475,8 +70488,9 @@
              * @method pauseTargets
              * @param {Array} targetsToPause
              */
             pauseTargets<T>(targetsToPause: Array<T>): void;
+            isActionRunning(action: _cocos_tween_actions_action__Action): boolean;
             /**
              * @en The ActionManager update。
              * @zh ActionManager 主循环。
              * @method update