Fix Biome System integration, memory optimization, and Tiled live sync workflow
This commit is contained in:
@@ -25,6 +25,7 @@ class UIScene extends Phaser.Scene {
|
||||
this.createVirtualJoystick();
|
||||
this.createClock();
|
||||
this.createMinimap(); // NEW: Mini mapa
|
||||
this.createDevButtons(); // MacBook friendly restart
|
||||
// this.createDebugInfo(); // REMOVED - Using UnifiedStatsPanel
|
||||
|
||||
// Hide old debug panel if it exists
|
||||
@@ -647,6 +648,39 @@ class UIScene extends Phaser.Scene {
|
||||
this.clockText.setOrigin(0.5, 0.5);
|
||||
}
|
||||
|
||||
createDevButtons() {
|
||||
if (this.restartBtn) this.restartBtn.destroy();
|
||||
|
||||
// Position next to clock (top right, left of clock)
|
||||
const x = this.scale.width - 190;
|
||||
const y = 20;
|
||||
|
||||
// Small 🔄 button
|
||||
const btnBg = this.add.rectangle(x, y + 20, 30, 40, 0x000000, 0.5);
|
||||
btnBg.setStrokeStyle(2, 0xffffff, 0.8);
|
||||
btnBg.setInteractive({ useHandCursor: true });
|
||||
|
||||
const btnText = this.add.text(x, y + 20, '🔄', { fontSize: '18px' }).setOrigin(0.5);
|
||||
|
||||
btnBg.on('pointerdown', () => {
|
||||
console.log('🔄 Reloading game...');
|
||||
window.location.reload();
|
||||
});
|
||||
|
||||
// Tooltip
|
||||
const tooltip = this.add.text(x, y + 50, 'RESTART (F4)', {
|
||||
fontSize: '10px',
|
||||
backgroundColor: '#000000',
|
||||
padding: { x: 4, y: 2 }
|
||||
}).setOrigin(0.5).setVisible(false);
|
||||
|
||||
btnBg.on('pointerover', () => tooltip.setVisible(true));
|
||||
btnBg.on('pointerout', () => tooltip.setVisible(false));
|
||||
|
||||
this.restartBtn = this.add.container(0, 0, [btnBg, btnText, tooltip]);
|
||||
this.restartBtn.setDepth(2000);
|
||||
}
|
||||
|
||||
createResourcesDisplay() {
|
||||
const startX = this.scale.width - 160;
|
||||
const startY = 110; // Below gold display
|
||||
@@ -699,7 +733,8 @@ class UIScene extends Phaser.Scene {
|
||||
if (!this.resourceTexts) return;
|
||||
const text = this.resourceTexts[resource];
|
||||
if (text) {
|
||||
text.setText(`${resource.toUpperCase()}: ${amount}`);
|
||||
const displayAmount = amount !== undefined && amount !== null ? amount : 0;
|
||||
text.setText(`${resource.toUpperCase()}: ${displayAmount}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,7 +771,9 @@ class UIScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
updateAge(gen, age) {
|
||||
if (this.genText) this.genText.setText(`Gen: ${gen} | Age: ${age}`);
|
||||
const dGen = gen !== undefined ? gen : 1;
|
||||
const dAge = age !== undefined ? age : 18;
|
||||
if (this.genText) this.genText.setText(`Gen: ${dGen} | Age: ${dAge}`);
|
||||
}
|
||||
|
||||
updateGold(amount) {
|
||||
@@ -744,7 +781,8 @@ class UIScene extends Phaser.Scene {
|
||||
console.warn('goldText not ready yet, skipping update');
|
||||
return;
|
||||
}
|
||||
this.goldText.setText(`GOLD: ${amount}`);
|
||||
const displayAmount = amount !== undefined ? amount : 0;
|
||||
this.goldText.setText(`GOLD: ${displayAmount}`);
|
||||
}
|
||||
|
||||
// DEBUG INFO REMOVED - Now using UnifiedStatsPanel (TAB/F3)
|
||||
@@ -765,6 +803,16 @@ class UIScene extends Phaser.Scene {
|
||||
this.setBarValue(this.thirstBar, stats.thirst);
|
||||
}
|
||||
|
||||
// Sync XP and Level
|
||||
if (this.gameScene.player && this.XPBar && this.LevelDisplay) {
|
||||
const xp = this.gameScene.player.xp || 0;
|
||||
const maxXp = this.gameScene.player.maxXp || 100;
|
||||
const level = this.gameScene.player.level || 1;
|
||||
|
||||
this.setBarValue(this.XPBar, (xp / maxXp) * 100);
|
||||
this.LevelDisplay.setText(`${window.i18n.t('ui.lv', 'LV')}: ${level}`);
|
||||
}
|
||||
|
||||
// Update Zombie Stats Panel (starter zombie worker)
|
||||
if (this.gameScene.npcs && this.gameScene.npcs.length > 0) {
|
||||
const zombieWorker = this.gameScene.npcs.find(npc => npc.type === 'zombie' && npc.isTamed);
|
||||
@@ -1245,13 +1293,14 @@ class UIScene extends Phaser.Scene {
|
||||
|
||||
let objText = '';
|
||||
quest.objectives.forEach(obj => {
|
||||
const status = obj.done ? '✅' : '⬜';
|
||||
let desc = '';
|
||||
if (obj.type === 'collect') desc = `${obj.item}: ${obj.current}/${obj.amount}`;
|
||||
else if (obj.type === 'action') desc = `${obj.action}: ${obj.current}/${obj.amount}`;
|
||||
else if (obj.type === 'kill') desc = `Slay ${obj.target}: ${obj.current}/${obj.amount}`;
|
||||
const status = obj.done || obj.completed ? '✅' : '⬜';
|
||||
const current = obj.current !== undefined ? obj.current : 0;
|
||||
const required = obj.required || obj.amount || 1;
|
||||
|
||||
objText += `${status} ${desc}\n`;
|
||||
let desc = obj.description || obj.name || 'Objective';
|
||||
|
||||
// Format: [status] Description: 0/1
|
||||
objText += `${status} ${desc}: ${current}/${required}\n`;
|
||||
});
|
||||
|
||||
this.questObjectives.setText(objText);
|
||||
|
||||
Reference in New Issue
Block a user