fix: 修复训练模式手牌显示不完整的问题
- 添加 ScrollContainer 包裹 HandArea,支持横向滚动查看所有27张牌 - HandArea 设置最小宽度 2200px 确保所有卡牌有足够空间 - 调整布局适配 1280x720 视口 - 按钮居中排列 - 清除调试 print 语句 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user