Skill-Eintraege im Skillbuch mit halbtransparentem Hintergrund
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6d3ef11321
commit
c170d98f3c
1 changed files with 16 additions and 7 deletions
|
|
@ -33,21 +33,32 @@ func _refresh_skills():
|
||||||
child.queue_free()
|
child.queue_free()
|
||||||
|
|
||||||
for skill in player.available_skills:
|
for skill in player.available_skills:
|
||||||
|
# Hintergrund-Panel für Lesbarkeit
|
||||||
|
var panel = PanelContainer.new()
|
||||||
|
var style = StyleBoxFlat.new()
|
||||||
|
style.bg_color = Color(0.9, 0.85, 0.75, 0.18)
|
||||||
|
style.set_corner_radius_all(4)
|
||||||
|
panel.add_theme_stylebox_override("panel", style)
|
||||||
|
panel.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||||
|
|
||||||
var hbox = HBoxContainer.new()
|
var hbox = HBoxContainer.new()
|
||||||
hbox.add_theme_constant_override("separation", 8)
|
hbox.add_theme_constant_override("separation", 8)
|
||||||
|
hbox.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
panel.add_child(hbox)
|
||||||
|
|
||||||
# Icon
|
# Icon
|
||||||
var icon_rect = TextureRect.new()
|
var icon_rect = TextureRect.new()
|
||||||
var tex = load(skill["icon"])
|
var tex = load(skill["icon"])
|
||||||
if tex:
|
if tex:
|
||||||
icon_rect.texture = tex
|
icon_rect.texture = tex
|
||||||
icon_rect.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
|
icon_rect.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
||||||
icon_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
icon_rect.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||||
icon_rect.custom_minimum_size = Vector2(36, 36)
|
icon_rect.custom_minimum_size = Vector2(36, 36)
|
||||||
|
icon_rect.size = Vector2(36, 36)
|
||||||
icon_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
icon_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
hbox.add_child(icon_rect)
|
hbox.add_child(icon_rect)
|
||||||
|
|
||||||
# Name + Beschreibung
|
# Name
|
||||||
var label = Label.new()
|
var label = Label.new()
|
||||||
label.text = skill["name"]
|
label.text = skill["name"]
|
||||||
label.add_theme_font_size_override("font_size", 14)
|
label.add_theme_font_size_override("font_size", 14)
|
||||||
|
|
@ -57,16 +68,14 @@ func _refresh_skills():
|
||||||
hbox.add_child(label)
|
hbox.add_child(label)
|
||||||
|
|
||||||
# Tooltip
|
# Tooltip
|
||||||
hbox.tooltip_text = skill["name"] + "\n" + skill["description"]
|
panel.tooltip_text = skill["name"] + "\n" + skill["description"]
|
||||||
hbox.custom_minimum_size = Vector2(0, 40)
|
|
||||||
hbox.mouse_filter = Control.MOUSE_FILTER_STOP
|
|
||||||
|
|
||||||
# Drag starten bei Linksklick
|
# Drag starten bei Linksklick
|
||||||
var skill_id = skill["id"]
|
var skill_id = skill["id"]
|
||||||
var skill_icon_path = skill["icon"]
|
var skill_icon_path = skill["icon"]
|
||||||
hbox.gui_input.connect(_on_skill_input.bind(skill_id, skill_icon_path))
|
panel.gui_input.connect(_on_skill_input.bind(skill_id, skill_icon_path))
|
||||||
|
|
||||||
skill_list.add_child(hbox)
|
skill_list.add_child(panel)
|
||||||
|
|
||||||
func _on_skill_input(event: InputEvent, skill_id: String, icon_path: String):
|
func _on_skill_input(event: InputEvent, skill_id: String, icon_path: String):
|
||||||
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue