no message
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
import { VisualAssets } from './VisualAssets';
|
||||
import { GameManager } from '../manager/GameManager';
|
||||
import { Movement } from '../gameplay/Movement';
|
||||
import { resolveLevelDrawRoot, sortIsoTiles } from '../level/TileLayout';
|
||||
import { resolveThemeId } from '../theme/ThemeDatabase';
|
||||
import {
|
||||
PlayerAction, PlayerAnimPaths, actionFolder, resolvePlayerAnimPaths,
|
||||
@@ -205,6 +206,7 @@ export class PlayerActionAnimator extends Component {
|
||||
|
||||
setAction(action: PlayerAction, force = false) {
|
||||
if (!force && this.action === action && this.useSequence && this.frames.length > 0) return;
|
||||
const actionChanged = this.action !== action;
|
||||
this.action = action;
|
||||
this.frameIdx = 0;
|
||||
this.frameTimer = 0;
|
||||
@@ -212,9 +214,12 @@ export class PlayerActionAnimator extends Component {
|
||||
VisualAssets.applyPlayerSprite(
|
||||
this.spriteNode, this.direction, { theme: this.theme }, this.scaleMul,
|
||||
);
|
||||
if (actionChanged && (action === PlayerAction.Win || action === PlayerAction.Fail)) {
|
||||
this.refreshResultDrawOrder();
|
||||
}
|
||||
return;
|
||||
}
|
||||
void this.applyActionFrames(action);
|
||||
void this.applyActionFrames(action, actionChanged);
|
||||
}
|
||||
|
||||
getAction(): PlayerAction {
|
||||
@@ -279,7 +284,12 @@ export class PlayerActionAnimator extends Component {
|
||||
return this.displayLockPromise;
|
||||
}
|
||||
|
||||
private async applyActionFrames(action: PlayerAction) {
|
||||
private refreshResultDrawOrder() {
|
||||
const root = resolveLevelDrawRoot(this.node);
|
||||
if (root) sortIsoTiles(root);
|
||||
}
|
||||
|
||||
private async applyActionFrames(action: PlayerAction, sortOnLoad = false) {
|
||||
if (!this.animPaths) return;
|
||||
const gen = ++this.loadingGen;
|
||||
const isFront = this.direction === Direction.South || this.direction === Direction.East;
|
||||
@@ -305,6 +315,9 @@ export class PlayerActionAnimator extends Component {
|
||||
this.frameIdx = 0;
|
||||
this.frameTimer = 0;
|
||||
this.showFrame(frames[0]!);
|
||||
if (sortOnLoad && (action === PlayerAction.Win || action === PlayerAction.Fail)) {
|
||||
this.refreshResultDrawOrder();
|
||||
}
|
||||
}
|
||||
|
||||
private showFrame(sf: SpriteFrame) {
|
||||
|
||||
Reference in New Issue
Block a user