Fix Escape
This commit is contained in:
@@ -12,6 +12,7 @@ extends CanvasLayer
|
||||
|
||||
@onready var minimap_container = $TopRight/Minimap
|
||||
@onready var minimap_texture = $TopRight/Minimap/MinimapTexture
|
||||
@onready var event_log = $TopRight/EventLog
|
||||
|
||||
@onready var hotbar_container = $BottomCenter/Hotbar
|
||||
|
||||
@@ -35,6 +36,7 @@ func _connect_gamestate():
|
||||
GameState.dungeon_state_updated.connect(_update_resources)
|
||||
GameState.inventory_updated.connect(_update_hotbar)
|
||||
GameState.dungeon_entered.connect(_on_dungeon_entered)
|
||||
GameState.loot_received.connect(_on_loot_received)
|
||||
|
||||
func _on_dungeon_entered():
|
||||
_generate_minimap()
|
||||
@@ -212,3 +214,31 @@ func _update_escape_indicator():
|
||||
var remaining = max(0, 5 - elapsed)
|
||||
if escape_countdown:
|
||||
escape_countdown.text = "%.1f" % remaining
|
||||
|
||||
func _on_loot_received(items: Array):
|
||||
print("[HUD] Loot received! %d items" % items.size())
|
||||
for item in items:
|
||||
var item_name = item.get("name", item.get("Name", "Unknown"))
|
||||
var rarity = item.get("rarity", item.get("Rarity", "Common"))
|
||||
var quantity = item.get("quantity", item.get("Quantity", 1))
|
||||
|
||||
var color = _get_rarity_color(rarity)
|
||||
var text = "+%d %s" % [quantity, item_name] if quantity > 1 else "+ %s" % item_name
|
||||
add_log_entry(text, color)
|
||||
|
||||
func _get_rarity_color(rarity: String) -> Color:
|
||||
match rarity.to_lower():
|
||||
"common": return Color(0.7, 0.7, 0.7)
|
||||
"uncommon": return Color(0.18, 0.8, 0.44)
|
||||
"rare": return Color(0.2, 0.6, 0.86)
|
||||
"epic": return Color(0.61, 0.35, 0.71)
|
||||
"legendary": return Color(0.95, 0.61, 0.07)
|
||||
_: return Color.WHITE
|
||||
|
||||
func add_log_entry(test: String, color: Color):
|
||||
var label = RichTextLabel.new()
|
||||
label.bbcode_enabled = true
|
||||
label.fit_content = true
|
||||
label.scroll_active = false
|
||||
event_log.add_child(label)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user