This commit is contained in:
team3
2026-09-16 13:21:45 +02:00
parent 8a188c5d5c
commit 49e8f2d95e
27 changed files with 1772 additions and 265 deletions

View File

@@ -6,6 +6,9 @@ extends Control
signal buy_requested(index: int, quick: bool)
signal reroll_pressed
signal lock_pressed
signal card_hovered(index: int, screen_pos: Vector2)
signal card_left
signal undo_pressed
const PANEL_BG := Color(0.14, 0.15, 0.19)
const SLOT_BG := Color(0.20, 0.21, 0.26)
@@ -15,6 +18,8 @@ var btn_reroll: Button
var btn_lock: Button
var lbl_fodder: Label
var lbl_hint: Label
var lbl_tip: Label ## Erstrunden-Hilfe
var btn_undo: Button ## Rückgängig nach einem Verkauf, verschwindet nach 5 s
func build(x: float, y: float, w: float, h: float) -> void:
@@ -44,6 +49,13 @@ func build(x: float, y: float, w: float, h: float) -> void:
head.add_child(lbl_fodder)
lbl_hint = UiKit.label("", 13, Color(0.95, 0.85, 0.45))
head.add_child(lbl_hint)
lbl_tip = UiKit.label("", 13, Color(0.6, 0.95, 0.75))
head.add_child(lbl_tip)
btn_undo = UiKit.button("Verkauf rückgängig [Z]", Color(0.55, 0.40, 0.25))
btn_undo.custom_minimum_size = Vector2(210, 26)
btn_undo.visible = false
btn_undo.pressed.connect(func(): undo_pressed.emit())
head.add_child(btn_undo)
var spacer := Control.new()
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
head.add_child(spacer)
@@ -76,9 +88,11 @@ func refresh(game: Game) -> void:
note += "\nRechtsklick: %s" % Data.ELEMENT_NAMES[p.last_element]
else:
note = "noch %d im Vorrat" % game.pool.element_left[e.element]
b = UiKit.button("%s\n%d Gold\n%s" % [e.label(), e.price(), note], col, UiKit.ink(col))
b = UiKit.button("[%d] %s\n%d Gold\n%s" % [i + 1, e.label(), e.price(), note], col, UiKit.ink(col))
b.disabled = p.gold < e.price() or game.phase != Game.Phase.PLANNING
b.gui_input.connect(_on_card_input.bind(i))
b.mouse_entered.connect(func(): card_hovered.emit(i, b.global_position + Vector2(b.size.x, -8.0)))
b.mouse_exited.connect(func(): card_left.emit())
b.custom_minimum_size = Vector2(196, 88)
row.add_child(b)
var mine := []
@@ -111,3 +125,15 @@ func hint(text: String) -> void:
get_tree().create_timer(2.5).timeout.connect(func():
if is_instance_valid(lbl_hint) and lbl_hint.text == text:
lbl_hint.text = "")
## Zeigt den Rückgängig-Knopf für fünf Sekunden.
func show_undo() -> void:
btn_undo.visible = true
get_tree().create_timer(5.0).timeout.connect(func():
if is_instance_valid(btn_undo):
btn_undo.visible = false)
func hide_undo() -> void:
btn_undo.visible = false