feat: add second-victory relief exploration

This commit is contained in:
2026-07-27 10:53:20 +09:00
parent e9fcd27611
commit f07a45c62b
24 changed files with 4583 additions and 282 deletions

View File

@@ -27,6 +27,7 @@ import {
releaseUnitBaseSheetTextures,
type UnitDirection
} from '../data/unitAssets';
import { ExplorationInputController } from '../input/ExplorationInputController';
import {
chooseCityStayResonance,
collectCityStayInformation,
@@ -137,19 +138,11 @@ export class CityStayScene extends Phaser.Scene {
private loadingOverlay?: Phaser.GameObjects.Container;
private transitionOverlay?: Phaser.GameObjects.Container;
private completionToast?: Phaser.GameObjects.Container;
private cursorKeys?: Phaser.Types.Input.Keyboard.CursorKeys;
private moveKeys?: {
up: Phaser.Input.Keyboard.Key;
down: Phaser.Input.Keyboard.Key;
left: Phaser.Input.Keyboard.Key;
right: Phaser.Input.Keyboard.Key;
};
private interactKeys: Phaser.Input.Keyboard.Key[] = [];
private explorationInput?: ExplorationInputController;
private moveTarget?: Phaser.Math.Vector2;
private ready = false;
private navigationPending = false;
private inputReadyAt = Number.POSITIVE_INFINITY;
private interactionQueued = false;
private stepIndex = 0;
private lastStepAt = 0;
private lastNotice = '';
@@ -191,6 +184,8 @@ export class CityStayScene extends Phaser.Scene {
this.ready = false;
this.navigationPending = false;
this.moveTarget = undefined;
this.explorationInput?.destroy();
this.explorationInput = undefined;
this.dialogueState = undefined;
releaseUnitBaseSheetTextures(this);
});
@@ -215,13 +210,13 @@ export class CityStayScene extends Phaser.Scene {
update(time: number, delta: number) {
if (!this.ready || this.navigationPending || time < this.inputReadyAt) {
this.interactionQueued = false;
this.explorationInput?.discardInteractionRequest();
return;
}
if (this.shopPanel || this.choicePanel) {
this.stopPlayerMovement();
this.interactionQueued = false;
this.explorationInput?.discardInteractionRequest();
return;
}
@@ -438,7 +433,7 @@ export class CityStayScene extends Phaser.Scene {
this.ready = false;
this.navigationPending = false;
this.inputReadyAt = Number.POSITIVE_INFINITY;
this.interactionQueued = false;
this.explorationInput = undefined;
this.stepIndex = 0;
this.lastStepAt = 0;
this.lastNotice = '';
@@ -934,36 +929,19 @@ export class CityStayScene extends Phaser.Scene {
}
private setupInput() {
const keyboard = this.input.keyboard;
if (keyboard) {
this.cursorKeys = keyboard.createCursorKeys();
this.moveKeys = {
up: keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.W),
down: keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.S),
left: keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.A),
right: keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.D)
};
this.interactKeys = [
keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.E),
keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE),
keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ENTER)
];
this.interactKeys.forEach((key) => {
key.on('down', () => {
this.interactionQueued = true;
});
});
keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ESC).on('down', () => this.handleEscape());
keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.ONE).on('down', () => this.chooseDialogueByIndex(0));
keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.TWO).on('down', () => this.chooseDialogueByIndex(1));
keyboard.addCapture([
Phaser.Input.Keyboard.KeyCodes.UP,
Phaser.Input.Keyboard.KeyCodes.DOWN,
Phaser.Input.Keyboard.KeyCodes.LEFT,
Phaser.Input.Keyboard.KeyCodes.RIGHT,
Phaser.Input.Keyboard.KeyCodes.SPACE
]);
}
this.explorationInput = new ExplorationInputController(this)
.bindKey(
Phaser.Input.Keyboard.KeyCodes.ESC,
() => this.handleEscape()
)
.bindKey(
Phaser.Input.Keyboard.KeyCodes.ONE,
() => this.chooseDialogueByIndex(0)
)
.bindKey(
Phaser.Input.Keyboard.KeyCodes.TWO,
() => this.chooseDialogueByIndex(1)
);
this.input.on(Phaser.Input.Events.POINTER_DOWN, (pointer: Phaser.Input.Pointer) => {
if (!this.ready || this.navigationPending || this.time.now < this.inputReadyAt) {
@@ -1065,27 +1043,14 @@ export class CityStayScene extends Phaser.Scene {
}
private consumeInteractionRequest() {
const keyPressedThisFrame = this.interactKeys.some((key) => Phaser.Input.Keyboard.JustDown(key));
const requested = this.interactionQueued || keyPressedThisFrame;
this.interactionQueued = false;
return requested;
return this.explorationInput?.consumeInteractionRequest() ?? false;
}
private keyboardMovementDirection() {
const vector = new Phaser.Math.Vector2();
if (this.cursorKeys?.left.isDown || this.moveKeys?.left.isDown) {
vector.x -= 1;
}
if (this.cursorKeys?.right.isDown || this.moveKeys?.right.isDown) {
vector.x += 1;
}
if (this.cursorKeys?.up.isDown || this.moveKeys?.up.isDown) {
vector.y -= 1;
}
if (this.cursorKeys?.down.isDown || this.moveKeys?.down.isDown) {
vector.y += 1;
}
return vector;
return (
this.explorationInput?.movementDirection() ??
new Phaser.Math.Vector2()
);
}
private directionForVector(vector: Phaser.Math.Vector2): UnitDirection {