inventori

This commit is contained in:
2025-12-13 03:07:45 +01:00
parent f0cd2ae056
commit 725cd98e7c
9 changed files with 1067 additions and 67 deletions

View File

@@ -342,12 +342,13 @@ class GameScene extends Phaser.Scene {
console.log('🌾 Solo farming mode - no NPCs');
// FPS Monitor (Performance)
console.log('📊 Initializing FPS Monitor...');
this.fpsMonitor = new FPSMonitor(this);
// FPS Monitor - DISABLED (Using UnifiedStatsPanel instead)
// console.log('📊 Initializing FPS Monitor...');
// this.fpsMonitor = new FPSMonitor(this);
// Performance Monitor (Advanced)
console.log(' Initializing Performance Monitor...');
this.performanceMonitor = new PerformanceMonitor(this);
// Unified Stats Panel (Performance + Debug in one)
console.log('📊 Initializing Unified Stats Panel...');
this.unifiedStatsPanel = new UnifiedStatsPanel(this);
// NPC Spawner
console.log('🧟 Initializing NPC Spawner...');
@@ -454,6 +455,10 @@ class GameScene extends Phaser.Scene {
// Tutorial System (shows keyboard shortcuts)
this.tutorialSystem = new TutorialSystem(this);
// Full Inventory UI (24 slots, I key to open)
this.fullInventoryUI = new FullInventoryUI(this);
this.legacySystem = new LegacySystem(this);
// Initialize Sound Manager
@@ -605,9 +610,9 @@ class GameScene extends Phaser.Scene {
// Auto-load if available (DISABLED in SaveSystem!)
this.saveSystem.loadGame(); // Vrne false - ne naloži save-a!
// Debug Text
this.add.text(10, 10, 'NovaFarma Alpha v0.6', { font: '16px monospace', fill: '#ffffff' })
.setScrollFactor(0).setDepth(10000);
// Debug Text - REMOVED (Version shown in UnifiedStatsPanel)
// this.add.text(10, 10, 'NovaFarma Alpha v0.6', { font: '16px monospace', fill: '#ffffff' })
// .setScrollFactor(0).setDepth(10000);
console.log('✅ GameScene ready - FAZA 20 (Full Features)!');
@@ -1007,24 +1012,14 @@ class GameScene extends Phaser.Scene {
if (npc.update) npc.update(delta);
}
// Debug Info
if (this.player) {
const playerPos = this.player.getPosition();
const uiScene = this.scene.get('UIScene');
if (uiScene && uiScene.debugText) {
const activeCrops = this.terrainSystem && this.terrainSystem.cropsMap ? this.terrainSystem.cropsMap.size : 0;
const dropsCount = this.lootSystem ? this.lootSystem.drops.length : 0;
const conn = this.multiplayerSystem && this.multiplayerSystem.isConnected ? '🟢 Online' : '🔴 Offline';
// Update Unified Stats Panel
if (this.unifiedStatsPanel) {
this.unifiedStatsPanel.update(delta);
}
uiScene.debugText.setText(
`NovaFarma v0.6 [${conn}]\n` +
`[F5] Save | [F9] Load | [K] Boss\n` +
`Time: ${this.timeSystem ? this.timeSystem.gameTime.toFixed(1) : '?'}h\n` +
`Active Crops: ${activeCrops}\n` +
`Loot Drops: ${dropsCount}\n` +
`Player: (${playerPos.x}, ${playerPos.y})`
);
}
// Update Full Inventory UI
if (this.fullInventoryUI) {
this.fullInventoryUI.update();
}
// Run Antigravity Engine Update

View File

@@ -9,6 +9,9 @@ class UIScene extends Phaser.Scene {
// Pridobi reference na GameScene podatke (ko bodo na voljo)
this.gameScene = this.scene.get('GameScene');
// Track selected inventory slot (for tools)
this.selectedSlot = 0;
// Setup UI Container
// Shared Overlay (DayNight + Weather)
// Rendered here to be screen-space (HUD) and ignore zoom
@@ -22,7 +25,12 @@ class UIScene extends Phaser.Scene {
this.createVirtualJoystick();
this.createClock();
this.createMinimap(); // NEW: Mini mapa
// this.createDebugInfo();
// this.createDebugInfo(); // REMOVED - Using UnifiedStatsPanel
// Hide old debug panel if it exists
if (this.debugText) this.debugText.setVisible(false);
if (this.debugBg) this.debugBg.setVisible(false);
this.createSettingsButton();
// ESC Pause Menu
@@ -343,7 +351,7 @@ class UIScene extends Phaser.Scene {
this.createTimeControlPanel();
this.createInventoryBar();
this.createInventoryBar();
this.createDebugInfo();
// this.createDebugInfo(); // REMOVED - Using UnifiedStatsPanel
this.createSettingsButton();
// Refresh data
@@ -739,28 +747,7 @@ class UIScene extends Phaser.Scene {
this.goldText.setText(`GOLD: ${amount}`);
}
createDebugInfo() {
if (this.debugText) this.debugText.destroy();
if (this.debugBg) this.debugBg.destroy();
const x = this.scale.width - 170;
const y = 120; // Below Gold and Clock area
// Background
this.debugBg = this.add.graphics();
this.debugBg.fillStyle(0x000000, 0.7);
this.debugBg.fillRect(x, y, 160, 70);
this.debugBg.setDepth(2999);
this.debugText = this.add.text(x + 10, y + 10, 'Waiting for stats...', {
fontSize: '12px',
fontFamily: 'monospace',
fill: '#ffffff',
stroke: '#000000',
strokeThickness: 2
});
this.debugText.setDepth(3000);
}
// DEBUG INFO REMOVED - Now using UnifiedStatsPanel (TAB/F3)
update() {
if (!this.gameScene) return;
@@ -814,6 +801,9 @@ class UIScene extends Phaser.Scene {
this.updateResourceDisplay('iron', inv.getItemCount('iron'));
}
// Update Equipment Preview
this.updateEquipmentPreview();
// Update Minimap
this.updateMinimap();
}
@@ -2489,8 +2479,9 @@ class UIScene extends Phaser.Scene {
// Equipment Preview
createEquipmentPreview() {
const previewX = 20;
const previewY = 400; // MOVED LOWER (was 150)
// Position next to inventory bar (bottom right)
const previewX = this.scale.width - 80; // Right side
const previewY = this.scale.height - 80; // Bottom
// Background - SMALLER
this.equipmentBg = this.add.graphics();
@@ -2500,6 +2491,7 @@ class UIScene extends Phaser.Scene {
this.equipmentBg.strokeRoundedRect(previewX, previewY, 60, 60, 8);
this.equipmentBg.setScrollFactor(0);
this.equipmentBg.setDepth(1000);
this.equipmentBg.setVisible(true); // VISIBLE
// Label - SMALLER
this.equipmentLabel = this.add.text(
@@ -2514,17 +2506,19 @@ class UIScene extends Phaser.Scene {
this.equipmentLabel.setOrigin(0.5, 1);
this.equipmentLabel.setScrollFactor(0);
this.equipmentLabel.setDepth(1001);
this.equipmentLabel.setVisible(true); // VISIBLE
// Icon sprite placeholder - SMALLER
this.equipmentIcon = this.add.rectangle(previewX + 30, previewY + 30, 24, 24, 0x888888);
this.equipmentIcon.setScrollFactor(0);
this.equipmentIcon.setDepth(1001);
this.equipmentIcon.setVisible(true); // VISIBLE
// Tool name - HIDDEN (too much text)
// Tool name
this.equipmentName = this.add.text(
previewX + 30,
previewY + 50,
'',
'None',
{
font: 'bold 8px Arial',
fill: '#ffffff'
@@ -2533,28 +2527,57 @@ class UIScene extends Phaser.Scene {
this.equipmentName.setOrigin(0.5, 0);
this.equipmentName.setScrollFactor(0);
this.equipmentName.setDepth(1001);
this.equipmentName.setVisible(false); // HIDDEN
this.equipmentName.setVisible(true); // VISIBLE
console.log('🎮 Equipment preview created!');
console.log('🎮 Equipment preview created and VISIBLE!');
}
updateEquipmentPreview() {
if (!this.gameScene || !this.gameScene.inventorySystem) return;
if (!this.equipmentName) return;
if (!this.equipmentIcon) return;
const inv = this.gameScene.inventorySystem;
const selectedItem = inv.items[inv.selectedSlot];
if (selectedItem) {
// Update name
this.equipmentName.setText(selectedItem.name || selectedItem.id);
this.equipmentIcon.setVisible(true);
this.equipmentName.setVisible(true);
} else {
// Hide if no item
this.equipmentName.setText('None');
this.equipmentIcon.setVisible(false);
// Since inv.selectedSlot is undefined, use slot 0 for now
const slotIndex = 0;
if (this.equipmentLabel) {
this.equipmentLabel.setText(`SLOT ${slotIndex + 1}`);
}
const selectedSlot = inv.slots ? inv.slots[slotIndex] : null;
if (selectedSlot && selectedSlot.item) {
// Has item - show color
if (selectedSlot.item.id === 'axe') {
this.equipmentIcon.setFillStyle(0x8B4513);
} else if (selectedSlot.item.id === 'hoe') {
this.equipmentIcon.setFillStyle(0x654321);
} else {
this.equipmentIcon.setFillStyle(0x00ff00);
}
if (this.equipmentName) {
this.equipmentName.setText(selectedSlot.item.id);
this.equipmentName.setVisible(true);
}
} else {
this.equipmentIcon.setFillStyle(0x444444);
if (this.equipmentName) {
this.equipmentName.setText('Empty');
this.equipmentName.setVisible(true);
}
}
this.equipmentIcon.setVisible(true);
}
// Select inventory slot (called from GameScene keyboard input)
selectSlot(slotIndex) {
this.selectedSlot = slotIndex;
// Update equipment preview immediately
this.updateEquipmentPreview();
}
/**