popraven novi npc

This commit is contained in:
2025-12-08 17:09:52 +01:00
parent 81a7895c10
commit abc536fea1
17 changed files with 149 additions and 58 deletions

View File

@@ -474,15 +474,19 @@ class UIScene extends Phaser.Scene {
}
selectSlot(index) {
// Deselect current
if (this.inventorySlots[this.selectedSlot]) {
this.drawSlot(this.inventorySlots[this.selectedSlot], false);
// Deselect ALL slots first
for (let i = 0; i < this.inventorySlots.length; i++) {
if (this.inventorySlots[i]) {
this.drawSlot(this.inventorySlots[i], false);
}
}
this.selectedSlot = index;
// Select new
this.drawSlot(this.inventorySlots[this.selectedSlot], true);
if (this.inventorySlots[this.selectedSlot]) {
this.drawSlot(this.inventorySlots[this.selectedSlot], true);
}
}
updateInventory(slots) {
@@ -1514,4 +1518,27 @@ class UIScene extends Phaser.Scene {
hideOxygen() {
if (this.oxygenContainer) this.oxygenContainer.setVisible(false);
}
showFloatingText(data) {
const text = this.add.text(data.x, data.y, data.text, {
fontSize: '16px',
color: data.color || '#FFFFFF',
fontStyle: 'bold',
stroke: '#000000',
strokeThickness: 3
});
text.setOrigin(0.5);
text.setDepth(10000);
text.setScrollFactor(1);
// Animate upward and fade
this.tweens.add({
targets: text,
y: text.y - 50,
alpha: 0,
duration: 1500,
ease: 'Power2',
onComplete: () => text.destroy()
});
}
}