| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, Animation, _decorator, AnimatorBase, _dec, _dec2, _dec3, _class, _crd, ccclass, property, requireComponent, disallowMultiple, menu, help, AnimatorAnimation;
- function _reportPossibleCrUseOfAnimatorBase(extras) {
- _reporterNs.report("AnimatorBase", "./core/AnimatorBase", _context.meta, extras);
- }
- function _reportPossibleCrUseOfAnimationPlayer(extras) {
- _reporterNs.report("AnimationPlayer", "./core/AnimatorBase", _context.meta, extras);
- }
- function _reportPossibleCrUseOfAnimatorStateLogic(extras) {
- _reporterNs.report("AnimatorStateLogic", "./core/AnimatorStateLogic", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- Animation = _cc.Animation;
- _decorator = _cc._decorator;
- }, function (_unresolved_2) {
- AnimatorBase = _unresolved_2.default;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "64571Qy/TlCEZI/28RxIG+E", "AnimatorAnimation", undefined);
- __checkObsolete__(['Animation', 'AnimationState', '_decorator']);
- ({
- ccclass,
- property,
- requireComponent,
- disallowMultiple,
- menu,
- help
- } = _decorator);
- /**
- * Cocos Animation状态机组件
- */
- _export("default", AnimatorAnimation = (_dec = requireComponent(Animation), _dec2 = menu('OopsFramework/Animator/AnimatorAnimation (动画状态机)'), _dec3 = help('https://gitee.com/dgflash/oops-framework/wikis/pages?sort_id=12036279&doc_id=2873565'), ccclass(_class = disallowMultiple(_class = _dec(_class = _dec2(_class = _dec3(_class = class AnimatorAnimation extends (_crd && AnimatorBase === void 0 ? (_reportPossibleCrUseOfAnimatorBase({
- error: Error()
- }), AnimatorBase) : AnimatorBase) {
- constructor() {
- super(...arguments);
- /** Animation组件 */
- this._animation = null;
- /** 当前的动画实例 */
- this._animState = null;
- /** 记录初始的wrapmode */
- this._wrapModeMap = new Map();
- }
- start() {
- if (!this.PlayOnStart || this._hasInit) {
- return;
- }
- this._hasInit = true;
- this._animation = this.getComponent(Animation);
- this._animation.on(Animation.EventType.FINISHED, this.onAnimFinished, this);
- this._animation.on(Animation.EventType.LASTFRAME, this.onAnimFinished, this);
- if (this.AssetRawUrl !== null) {
- this.initJson(this.AssetRawUrl.json);
- }
- }
- /**
- * 手动初始化状态机,可传入0-3个参数,类型如下
- * - onStateChangeCall 状态切换时的回调
- * - stateLogicMap 各个状态逻辑控制
- * - animationPlayer 自定义动画控制
- * @override
- */
- onInit() {
- if (this.PlayOnStart || this._hasInit) {
- return;
- }
- this._hasInit = true;
- this.initArgs(...arguments);
- this._animation = this.getComponent(Animation);
- this._animation.on(Animation.EventType.FINISHED, this.onAnimFinished, this);
- this._animation.on(Animation.EventType.LASTFRAME, this.onAnimFinished, this);
- if (this.AssetRawUrl !== null) {
- this.initJson(this.AssetRawUrl.json);
- }
- }
- /**
- * 播放动画
- * @override
- * @param animName 动画名
- * @param loop 是否循环播放
- */
- playAnimation(animName, loop) {
- if (!animName) {
- return;
- }
- this._animation.play(animName);
- this._animState = this._animation.getState(animName);
- if (!this._animState) {
- return;
- }
- if (!this._wrapModeMap.has(this._animState)) {
- this._wrapModeMap.set(this._animState, this._animState.wrapMode);
- }
- this._animState.wrapMode = loop ? 2 : this._wrapModeMap.get(this._animState);
- }
- /**
- * 缩放动画播放速率
- * @override
- * @param scale 缩放倍率
- */
- scaleTime(scale) {
- if (this._animState) {
- this._animState.speed = scale;
- }
- }
- }) || _class) || _class) || _class) || _class) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=0ceb4243222791273c0ecc056e9e57c84185fc0d.js.map
|