Collection Scene Refactor
This commit is contained in:
parent
0f1db0884c
commit
1dca6ff81a
|
|
@ -299,7 +299,8 @@ export class CollectionScene extends Phaser.Scene {
|
|||
this._populateGrid();
|
||||
|
||||
// Clear showcase
|
||||
if (this._showcaseCard) { this._showcaseCard.destroy(); this._showcaseCard = null; }
|
||||
if (this._showcaseArtImage) this._showcaseArtImage.setVisible(false);
|
||||
if (this._showcaseArtTitle) this._showcaseArtTitle.setVisible(false);
|
||||
if (this._showcasePlaceholder) this._showcasePlaceholder.setVisible(true);
|
||||
if (this._showcaseNotCollected) this._showcaseNotCollected.setVisible(false);
|
||||
this._clearTerminal();
|
||||
|
|
@ -398,55 +399,73 @@ export class CollectionScene extends Phaser.Scene {
|
|||
_buildShowcaseArea() {
|
||||
const cx = RIGHT_X + RIGHT_W / 2;
|
||||
const cy = SHOWCASE_Y + SHOWCASE_H / 2;
|
||||
const boxW = RIGHT_W - 40;
|
||||
const boxH = SHOWCASE_H - 20;
|
||||
|
||||
// Subtle background
|
||||
this.add.rectangle(cx, cy, RIGHT_W - 40, SHOWCASE_H - 20, 0x0a0a1a, 0.5)
|
||||
// Background
|
||||
this.add.rectangle(cx, cy, boxW, boxH, 0x0a0a1a, 0.5)
|
||||
.setStrokeStyle(1, 0x222244);
|
||||
|
||||
this._showcasePlaceholder = this.add.text(cx, cy, 'SELECT A CARD', {
|
||||
fontSize: '24px', color: '#333355', fontStyle: 'bold', fontFamily: 'Audiowide'
|
||||
}).setOrigin(0.5);
|
||||
|
||||
this._showcaseNotCollected = this.add.text(cx, cy + 190, 'NOT COLLECTED', {
|
||||
fontSize: '16px', color: '#aa3333', fontStyle: 'bold', fontFamily: 'Audiowide'
|
||||
}).setOrigin(0.5).setVisible(false);
|
||||
// Card art image (fills the box)
|
||||
this._showcaseArtImage = this.add.image(cx, cy, '__DEFAULT')
|
||||
.setDisplaySize(boxW, boxH)
|
||||
.setVisible(false);
|
||||
|
||||
// Title overlay at bottom of box
|
||||
this._showcaseArtTitle = this.add.text(cx, cy + boxH / 2 - 16, '', {
|
||||
fontSize: '22px', color: '#ffffff', fontStyle: 'bold',
|
||||
fontFamily: 'Audiowide',
|
||||
backgroundColor: '#000000bb',
|
||||
padding: { x: 14, y: 7 }
|
||||
}).setOrigin(0.5, 1).setVisible(false).setDepth(2);
|
||||
|
||||
this._showcaseNotCollected = this.add.text(cx, cy - 30, 'NOT COLLECTED', {
|
||||
fontSize: '18px', color: '#aa3333', fontStyle: 'bold', fontFamily: 'Audiowide',
|
||||
backgroundColor: '#000000aa', padding: { x: 10, y: 5 }
|
||||
}).setOrigin(0.5).setVisible(false).setDepth(2);
|
||||
}
|
||||
|
||||
_updateShowcase(cardData) {
|
||||
if (this._showcaseCard) { this._showcaseCard.destroy(); this._showcaseCard = null; }
|
||||
this._showcasePlaceholder.setVisible(false);
|
||||
|
||||
const cx = RIGHT_X + RIGHT_W / 2;
|
||||
const cy = SHOWCASE_Y + SHOWCASE_H / 2;
|
||||
const boxW = RIGHT_W - 40;
|
||||
const boxH = SHOWCASE_H - 20;
|
||||
|
||||
const instance = this.cardManager.createInstance(cardData.id, this.save.level || 1);
|
||||
this._showcaseCard = new CardObject(this, cx, cy, instance, {
|
||||
width: 260, height: 357, disableTooltip: true
|
||||
// Show art image
|
||||
if (this.textures.exists(cardData.id)) {
|
||||
this._showcaseArtImage.setTexture(cardData.id);
|
||||
}
|
||||
this._showcaseArtImage.setDisplaySize(boxW, boxH).setAlpha(0).setVisible(true);
|
||||
this.tweens.add({
|
||||
targets: this._showcaseArtImage,
|
||||
alpha: 1,
|
||||
duration: 300,
|
||||
ease: 'Power2'
|
||||
});
|
||||
|
||||
// Show title
|
||||
this._showcaseArtTitle.setText(cardData.name).setVisible(true);
|
||||
|
||||
// Unowned indicator
|
||||
const owned = this.save.collection[cardData.id] || 0;
|
||||
if (owned === 0) {
|
||||
this._showcaseCard.setAlpha(0.5);
|
||||
this._showcaseArtImage.setAlpha(0);
|
||||
this.tweens.add({
|
||||
targets: this._showcaseArtImage,
|
||||
alpha: 0.4,
|
||||
duration: 300,
|
||||
ease: 'Power2'
|
||||
});
|
||||
this._showcaseNotCollected.setVisible(true);
|
||||
} else {
|
||||
this._showcaseNotCollected.setVisible(false);
|
||||
// Rarity glow
|
||||
const glowColor = RARITY_COLORS[cardData.rarity]?.glow || 0x888888;
|
||||
try {
|
||||
this._showcaseCard.postFX?.addGlow(glowColor, 6, 0, false, 0.2, 12);
|
||||
} catch (e) { /* PostFX may not be available */ }
|
||||
}
|
||||
|
||||
// Entry animation
|
||||
this._showcaseCard.setScale(0.8);
|
||||
this._showcaseCard.setAlpha(owned > 0 ? 0.5 : 0.3);
|
||||
this.tweens.add({
|
||||
targets: this._showcaseCard,
|
||||
scaleX: 1, scaleY: 1,
|
||||
alpha: owned > 0 ? 1 : 0.5,
|
||||
duration: 300,
|
||||
ease: 'Back.Out'
|
||||
});
|
||||
}
|
||||
|
||||
// ── CRT Terminal ────────────────────────────────────────────────────────────
|
||||
|
|
@ -645,7 +664,7 @@ export class CollectionScene extends Phaser.Scene {
|
|||
if (line === '') {
|
||||
// Blank line — just advance
|
||||
this._currentTermLine = (this._currentTermLine || 0) + 1;
|
||||
const evt = this.time.delayedCall(100, () => this._typeLines(lines, lineIdx + 1));
|
||||
const evt = this.time.delayedCall(20, () => this._typeLines(lines, lineIdx + 1));
|
||||
this._typingEvents.push(evt);
|
||||
return;
|
||||
}
|
||||
|
|
@ -676,7 +695,7 @@ export class CollectionScene extends Phaser.Scene {
|
|||
// Line complete — move to next line after pause
|
||||
this._currentTermLine++;
|
||||
this._updateCursorPos(textObj);
|
||||
const evt = this.time.delayedCall(120, () => this._typeLines(lines, lineIdx + 1));
|
||||
const evt = this.time.delayedCall(24, () => this._typeLines(lines, lineIdx + 1));
|
||||
this._typingEvents.push(evt);
|
||||
return;
|
||||
}
|
||||
|
|
@ -690,7 +709,7 @@ export class CollectionScene extends Phaser.Scene {
|
|||
// Update cursor position
|
||||
this._updateCursorPos(textObj);
|
||||
|
||||
const evt = this.time.delayedCall(20, typeChar);
|
||||
const evt = this.time.delayedCall(4, typeChar);
|
||||
this._typingEvents.push(evt);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue