123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- System.register(["cc"], function (_export, _context) {
- "use strict";
- var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, CCString, Color, Component, sp, _decorator, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _crd, ccclass, property, UISpineMovie;
- function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
- function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
- return {
- setters: [function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- CCString = _cc.CCString;
- Color = _cc.Color;
- Component = _cc.Component;
- sp = _cc.sp;
- _decorator = _cc._decorator;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "4ce979zctxD67dYVnpW4Mn+", "UISpineMovie", undefined);
- __checkObsolete__(['CCString', 'Color', 'Component', 'sp', '_decorator']);
- ({
- ccclass,
- property
- } = _decorator);
- /**
- * spine动画表现管理
- * @author
- */
- _export("default", UISpineMovie = (_dec = ccclass('UISpineMovie'), _dec2 = property({
- type: [CCString],
- displayName: '动画列表'
- }), _dec3 = property({
- type: sp.Skeleton,
- tooltip: '角色动画'
- }), _dec(_class = (_class2 = class UISpineMovie extends Component {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "animat_names", _descriptor, this);
- _initializerDefineProperty(this, "spine", _descriptor2, this);
- this.cur = null;
- this.index = 0;
- }
- onLoad() {}
- start() {
- //this.spine.clearTracks()
- /*this.spine.setStartListener(function(){
- console.log("动画开始")
- }.bind(this));*/
- /* this.spine.setEventListener(((trackEntry:any, event:any) => {
- //var animationName = trackEntry.animation ? trackEntry.animation.name : "";
- //console.log("[track %s][animation %s] event: %s, %s, %s, %s", trackEntry.trackIndex, animationName, event.data.name, event.intValue, event.floatValue, event.stringValue);
- this.unit.DoEvent(event.data.name);
- }) as any);*/
- //
- //let duration = this.spine.getCurrent(0).animation.duration;
- //let frames = Math.ceil(frameRate * duration);
- //let secondsPerFrame = 1 / frameRate;
- //`总帧数 ${this.frames}`;
- //this.spine.setCompleteListener(trackEntry => {
- //});
- if (this.animat_names.length > 0) {
- this.index = 0;
- if (this.index == this.animat_names.length - 1) {
- this.DoAnimation(this.animat_names[this.index], true);
- } else {
- this.DoAnimation(this.animat_names[this.index], false);
- }
- this.spine.setCompleteListener(function () {
- this.index++;
- if (this.index < this.animat_names.length) {
- if (this.index == this.animat_names.length - 1) {
- this.DoAnimation(this.animat_names[this.index], true);
- } else {
- this.DoAnimation(this.animat_names[this.index], false);
- }
- } else {
- this.spine.setCompleteListener(null);
- }
- }.bind(this));
- }
- }
- SetSkin(skin) {
- this.spine.setSkin(skin);
- }
- DoAnimation(animation, loop, track, force) {
- if (loop === void 0) {
- loop = true;
- }
- if (track === void 0) {
- track = 0;
- }
- if (force === void 0) {
- force = false;
- }
- if (force) {
- this.spine.setAnimation(track, animation, loop);
- return;
- }
- if (this.cur == animation) return;
- this.spine.setAnimation(track, animation, loop);
- }
- /**设置是否暂停 */
- SetPaused(paused) {
- this.spine.paused = paused;
- }
- /**获取是否暂停 */
- GetPaused() {
- return this.spine.paused;
- }
- CheckPaused(paused) {
- if (this.spine.paused != paused) this.spine.paused = paused;
- }
- /** 闪色表现 Color.RED 0.1*/
- Flash(color, time, reColor) {
- if (reColor === void 0) {
- reColor = Color.WHITE;
- }
- if (this.spine.color != color) {
- this.spine.color = color;
- this.unscheduleAllCallbacks();
- this.scheduleOnce(() => {
- this.spine.color = reColor;
- }, time);
- }
- }
- /**
- * 缩放动画播放速率
- * @override
- * @param scale 缩放倍率
- */
- scaleTime(scale) {
- if (scale > 0) this.spine.timeScale = scale;
- }
- getBone(name) {
- var bone = this.spine.findBone(name);
- return bone;
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "animat_names", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return [];
- }
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "spine", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return null;
- }
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=b338d43f47dfc4fb7dece127fe5d88d8c0b856eb.js.map
|