Add escape menu and weapon slot tooltips to character sheet
- Escape Menu: - Opens with Escape key from base game screen - Resume button to return to game - Exit Game button to quit application - Character sheet closes with Escape if open (takes priority) - Mouse capture/release handled by UI components - Weapon Slot System: - Visual weapon boxes (80x80) in character sheet - Display weapon icons from WeaponData - Empty slots appear dimmed - Hover tooltips show weapon stats (not clipped by containers) - Tooltips display: slot name, weapon name, damage, range, cooldown, knockback, block percentage - Tooltips positioned globally to avoid ScrollContainer clipping - Bug Fixes: - Fixed typo in lilguy_body.gd (dwextends -> extends) - Removed manual mouse toggle from player (now handled by UI) - Updated character_sheet.gd to use weapon slot components instead of text labels - Added weapon_tooltip.tscn as separate scene for unclipped tooltips
This commit is contained in:
@@ -20,6 +20,12 @@ func _ready():
|
||||
is_visible = false
|
||||
|
||||
func _input(event):
|
||||
# Close on Escape press if open
|
||||
if event.is_action_pressed("quit") and is_visible:
|
||||
toggle_sheet()
|
||||
get_viewport().set_input_as_handled()
|
||||
return
|
||||
|
||||
# Toggle on Tab press
|
||||
if event.is_action_pressed("toggle_character_sheet"):
|
||||
toggle_sheet()
|
||||
@@ -126,38 +132,34 @@ func _refresh_weapons():
|
||||
spacer.custom_minimum_size = Vector2(0, 10)
|
||||
weapons_container.add_child(spacer)
|
||||
|
||||
# Main hand weapon
|
||||
_add_stat_label("--- MAIN HAND ---", Color(0.8, 0.8, 0.8))
|
||||
# Create horizontal container for weapon slots
|
||||
var slots_container = HBoxContainer.new()
|
||||
slots_container.add_theme_constant_override("separation", 15)
|
||||
weapons_container.add_child(slots_container)
|
||||
|
||||
# Load weapon slot scene
|
||||
var weapon_slot_scene = load("res://level/ui/scenes/weapon_slot.tscn")
|
||||
if not weapon_slot_scene:
|
||||
push_error("[CharacterSheet] Failed to load weapon_slot.tscn")
|
||||
return
|
||||
|
||||
# Create main hand slot
|
||||
var main_hand_slot = weapon_slot_scene.instantiate()
|
||||
slots_container.add_child(main_hand_slot)
|
||||
|
||||
if player.equipped_weapon and player.equipped_weapon.weapon_data:
|
||||
var wd = player.equipped_weapon.weapon_data
|
||||
_add_stat_label("Name: " + wd.weapon_name, Color(0.0, 1.0, 0.5))
|
||||
_add_stat_label("Damage: " + str(wd.damage))
|
||||
_add_stat_label("Range: " + str(wd.attack_range))
|
||||
_add_stat_label("Cooldown: " + str(wd.attack_cooldown) + "s")
|
||||
_add_stat_label("Knockback: " + str(wd.knockback_force))
|
||||
if wd.can_block:
|
||||
_add_stat_label("Block: " + str(int(wd.block_reduction * 100)) + "%")
|
||||
main_hand_slot.set_weapon(player.equipped_weapon.weapon_data, "Main Hand")
|
||||
else:
|
||||
_add_stat_label("No weapon equipped", Color(0.7, 0.7, 0.7))
|
||||
main_hand_slot.clear_weapon()
|
||||
|
||||
# Spacer
|
||||
var spacer2 = Control.new()
|
||||
spacer2.custom_minimum_size = Vector2(0, 10)
|
||||
weapons_container.add_child(spacer2)
|
||||
# Create off-hand slot
|
||||
var off_hand_slot = weapon_slot_scene.instantiate()
|
||||
slots_container.add_child(off_hand_slot)
|
||||
|
||||
# Off-hand weapon
|
||||
_add_stat_label("--- OFF-HAND ---", Color(0.8, 0.8, 0.8))
|
||||
if player.equipped_offhand and player.equipped_offhand.weapon_data:
|
||||
var wd = player.equipped_offhand.weapon_data
|
||||
_add_stat_label("Name: " + wd.weapon_name, Color(0.0, 1.0, 0.5))
|
||||
_add_stat_label("Damage: " + str(wd.damage))
|
||||
_add_stat_label("Range: " + str(wd.attack_range))
|
||||
_add_stat_label("Cooldown: " + str(wd.attack_cooldown) + "s")
|
||||
_add_stat_label("Knockback: " + str(wd.knockback_force))
|
||||
if wd.can_block:
|
||||
_add_stat_label("Block: " + str(int(wd.block_reduction * 100)) + "%")
|
||||
off_hand_slot.set_weapon(player.equipped_offhand.weapon_data, "Off-Hand")
|
||||
else:
|
||||
_add_stat_label("No weapon equipped", Color(0.7, 0.7, 0.7))
|
||||
off_hand_slot.clear_weapon()
|
||||
|
||||
## Refresh abilities list
|
||||
func _refresh_abilities():
|
||||
|
||||
Reference in New Issue
Block a user