From 69cdd5703be282795ca4382153f8689406ddf098 Mon Sep 17 00:00:00 2001 From: xiaji Date: Mon, 1 Jun 2026 23:04:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AE=AD=E7=BB=83?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E6=89=8B=E7=89=8C=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 ScrollContainer 包裹 HandArea,支持横向滚动查看所有27张牌 - HandArea 设置最小宽度 2200px 确保所有卡牌有足够空间 - 调整布局适配 1280x720 视口 - 按钮居中排列 - 清除调试 print 语句 🤖 Generated with [Qoder][https://qoder.com] --- src/ui/components/hand_area.gd | 3 --- src/ui/scenes/training_room.tscn | 31 +++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/ui/components/hand_area.gd b/src/ui/components/hand_area.gd index 4688b54..183ec03 100644 --- a/src/ui/components/hand_area.gd +++ b/src/ui/components/hand_area.gd @@ -13,7 +13,6 @@ const CARD_SCENE := preload("res://src/ui/components/card_node.tscn") var training_controller: TrainingController = null func update_hand(hand: Array) -> void: - print("[DEBUG] HandArea.update_hand called, cards count: ", hand.size()) for cn in card_nodes: cn.queue_free() card_nodes.clear() @@ -21,14 +20,12 @@ func update_hand(hand: Array) -> void: for c in hand: var node := CARD_SCENE.instantiate() as CardNode if node == null: - print("[DEBUG] CardNode instantiate returned null!") continue add_child(node) node.setup(c) node.card_clicked.connect(_on_card_clicked) node.card_double_clicked.connect(_on_card_double_clicked) card_nodes.append(node) - print("[DEBUG] CardNodes created: ", card_nodes.size()) func _on_card_clicked(card_node: CardNode) -> void: card_node.set_selected(not card_node.is_selected) diff --git a/src/ui/scenes/training_room.tscn b/src/ui/scenes/training_room.tscn index 23e645b..3c5717a 100644 --- a/src/ui/scenes/training_room.tscn +++ b/src/ui/scenes/training_room.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=3 format=3 uid="uid://training_room"] +[gd_scene load_steps=4 format=3 uid="uid://training_room"] [ext_resource type="Script" path="res://src/ui/scenes/training_room.gd" id="1_script"] @@ -11,7 +11,7 @@ script = ExtResource("1_script") [node name="StatusLabel" type="Label" parent="."] layout_mode = 0 -offset_right = 400.0 +offset_right = 1280.0 offset_bottom = 40.0 text = "掼蛋训练模式" horizontal_alignment = 1 @@ -19,30 +19,41 @@ horizontal_alignment = 1 [node name="GuideLabel" type="Label" parent="."] layout_mode = 0 offset_top = 45.0 -offset_right = 800.0 +offset_right = 1280.0 offset_bottom = 75.0 text = "提示:点击手牌选中,然后点击「出牌」或「过牌」。首次出牌建议点击「提示」按钮。" horizontal_alignment = 1 autowrap_mode = 2 -[node name="HandArea" type="HBoxContainer" parent="."] +[node name="ScrollContainer" type="ScrollContainer" parent="."] layout_mode = 0 -offset_top = 500.0 -offset_right = 800.0 -offset_bottom = 650.0 +offset_top = 380.0 +offset_right = 1280.0 +offset_bottom = 520.0 +horizontal_scroll_mode = 2 +vertical_scroll_mode = 0 + +[node name="HandArea" type="HBoxContainer" parent="ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 0 script = ExtResource("2_script") +custom_minimum_size = Vector2(2200, 140) [node name="Buttons" type="HBoxContainer" parent="."] layout_mode = 0 -offset_top = 660.0 -offset_right = 800.0 -offset_bottom = 720.0 +offset_top = 540.0 +offset_right = 1280.0 +offset_bottom = 600.0 +alignment = 1 [node name="PlayButton" type="Button" parent="Buttons"] text = "出牌" +custom_minimum_size = Vector2(100, 40) [node name="PassButton" type="Button" parent="Buttons"] text = "过牌" +custom_minimum_size = Vector2(100, 40) [node name="HintButton" type="Button" parent="Buttons"] text = "提示" +custom_minimum_size = Vector2(100, 40)