const {ccclass, property} = cc._decorator;
@ccclass
export default class SpinePreviewMode extends cc.Component {
static spinePreviewMode(){
if (CC_EDITOR) {
sp.Skeleton.prototype['update'] = function (dt) {
if (CC_EDITOR) {
cc['engine']._animatingInEditMode = 1;
cc['engine'].animatingInEditMode = 1;
}
if (this.paused) return;
dt *= this.timeScale * sp['timeScale'];
if (this.isAnimationCached()) {
if (this._isAniComplete) {
if (this._animationQueue.length === 0 && !this._headAniInfo) {
let frameCache = this._frameCache;
if (frameCache && frameCache.isInvalid()) {
frameCache.updateToFrame();
let frames = frameCache.frames;
this._curFrame = frames[frames.length - 1];
}
return;
}
if (!this._headAniInfo) {
this._headAniInfo = this._animationQueue.shift();
}
this._accTime += dt;
if (this._accTime > this._headAniInfo.delay) {
let aniInfo = this._headAniInfo;
this._headAniInfo = null;
this.setAnimation(0, aniInfo.animationName, aniInfo.loop);
}
return;
}
this._updateCache(dt);
} else {
this._updateRealtime(dt);
}
}
}
}
}
SpinePreviewMode.spinePreviewMode();
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46