Skip to content

Commit

Permalink
fix code format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Canvasfull committed Jul 13, 2023
1 parent 336abfd commit 1f719b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cocos/spine/skeleton-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class AnimationCache {
// If pre animation not finished, play it to the end.
preAnimationCache.updateToFrame(0);
}
}
}
const listener = skeletonInfo?.listener;
this._instance.setAnimation(0, this._animationName!, false);
this.bind(listener!);
Expand Down Expand Up @@ -386,7 +386,7 @@ class SkeletonCache {

public initAnimationCache (uuid: string, data: SkeletonData, animationName: string) {
const spData = data.getRuntimeData();
if(!spData) return null;
if (!spData) return null;
const skeletonInfo = this._skeletonCache[uuid];
const skeleton = skeletonInfo && skeletonInfo.skeleton;
if (!skeleton) return null;
Expand Down
19 changes: 10 additions & 9 deletions cocos/spine/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ export class Skeleton extends UIRenderer {
/**
* @internal
*/
public _startEntry:spine.TrackEntry;
public _startEntry: spine.TrackEntry;
/**
* @internal
*/
public _endEntry:spine.TrackEntry;
public _endEntry: spine.TrackEntry;
// Paused or playing state
protected _paused = false;

Expand Down Expand Up @@ -855,14 +855,15 @@ export class Skeleton extends UIRenderer {
*
* @param skinName @en The name of skin. @zh 皮肤名称。
*/
public setSkin (name: string) {
public setSkin (name: string) {
if (this.isAnimationCached()) {
if (this._animCache) {
this._animCache.setSkin(name);
this.invalidAnimationCache();
this.invalidAnimationCache();
}
}
this._instance.setSkin(name);
this._updateSkeletonData();
}

/**
Expand Down Expand Up @@ -1229,12 +1230,12 @@ export class Skeleton extends UIRenderer {
* 使动画缓存失效,之后会在每帧重新计算。
* @method invalidAnimationCache
*/
public invalidAnimationCache () {
if (!this.isAnimationCached()) return;
if (this._skeletonCache) {
this._skeletonCache.invalidAnimationCache(this._skeletonData!.uuid);
}
public invalidAnimationCache () {
if (!this.isAnimationCached()) return;
if (this._skeletonCache) {
this._skeletonCache.invalidAnimationCache(this._skeletonData!.uuid);
}
}

/**
* @en
Expand Down

0 comments on commit 1f719b7

Please sign in to comment.