提供对SpriteAnimator中的一些字段的访问

This commit is contained in:
yhh
2020-07-20 13:46:58 +08:00
parent e76d5815f2
commit 2a38858838
7 changed files with 22 additions and 2 deletions

View File

@@ -434,6 +434,7 @@ declare class SpriteAnimator extends SpriteRenderer {
currentAnimationName: string;
currentFrame: number;
readonly isRunning: boolean;
readonly animations: Map<string, SpriteAnimation>;
private _animations;
private _elapsedTime;
private _loopMode;

View File

@@ -2007,6 +2007,13 @@ var SpriteAnimator = (function (_super) {
enumerable: true,
configurable: true
});
Object.defineProperty(SpriteAnimator.prototype, "animations", {
get: function () {
return this._animations;
},
enumerable: true,
configurable: true
});
SpriteAnimator.prototype.addAnimation = function (name, animation) {
if (!this.sprite && animation.sprites.length > 0)
this.setSprite(animation.sprites[0]);

File diff suppressed because one or more lines are too long

View File

@@ -17,6 +17,10 @@ class SpriteAnimator extends SpriteRenderer {
return this.animationState == State.running;
}
/** 提供对可用动画列表的访问 */
public get animations(){
return this._animations;
}
private _animations: Map<string, SpriteAnimation> = new Map<string, SpriteAnimation>();
private _elapsedTime: number = 0;
private _loopMode: LoopMode;