Fix: restore board interaction after CardWidget + camera changes
Two root causes broke unit movement and card play: 1. Camera yaw=180° for P1 pushed P1's own row to the bottom of the 3D projection, directly behind the 260px HandArea panel → tiles unreachable 2. HandArea grew from 180→260px, blocking even more of the lower board Fixes: - Compact CardWidget in hand: hide MetaRow + StatsGrid, shrink ArtArea min height to 80px → card ~150px, fits in 190px HandArea - HandArea / RightPanel height: 260→190px - Camera orientation: when setting yaw for P1/P2, also shift _cam_pivot 30% of board half-length toward the player's own side so their row sits mid-screen (above the HandArea), not hidden behind it Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -96,7 +96,7 @@ anchor_left = 0.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.75
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -260.0
|
||||
offset_top = -190.0
|
||||
offset_right = 0.0
|
||||
|
||||
[node name="HandScroll" type="ScrollContainer" parent="HUD/HandArea"]
|
||||
@@ -119,7 +119,7 @@ anchor_left = 0.75
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -260.0
|
||||
offset_top = -190.0
|
||||
|
||||
[node name="RightMargin" type="MarginContainer" parent="HUD/RightPanel"]
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1064,6 +1064,17 @@ func _make_hand_card(card: Dictionary) -> Control:
|
||||
widget.set_meta("card_instance_id", iid)
|
||||
widget.setup(card, card)
|
||||
|
||||
# Compact the card for the hand area: hide genus/type row and stats grid
|
||||
# (full info is available via long-press context popup during gameplay).
|
||||
# Also shrink the art area so the card fits in the ~190px hand panel.
|
||||
var art_area := widget.get_node_or_null("Margin/VBox/ArtArea")
|
||||
if art_area is Control:
|
||||
(art_area as Control).custom_minimum_size = Vector2(0, 80)
|
||||
for hidden_node in ["Margin/VBox/MetaRow", "Margin/VBox/StatsGrid"]:
|
||||
var n := widget.get_node_or_null(hidden_node)
|
||||
if n is CanvasItem:
|
||||
(n as CanvasItem).visible = false
|
||||
|
||||
# Hover: scale up and rise.
|
||||
widget.mouse_entered.connect(func() -> void:
|
||||
widget.pivot_offset = widget.size * 0.5
|
||||
@@ -1237,10 +1248,19 @@ func _on_state_updated(state: Dictionary) -> void:
|
||||
var p1_id : String = str(state.get("playerOneAccountId", ""))
|
||||
if not p1_id.is_empty():
|
||||
_camera_oriented = true
|
||||
# P1 places at row y=0 (world -Z). Camera must look FROM -Z toward +Z → yaw=180°.
|
||||
# P2 places at row y=bh-1 (world +Z). Camera looks FROM +Z → yaw=0° (default).
|
||||
var bh := float(Game.board_height())
|
||||
# Shift cam_pivot toward the opponent's side (30 % of board half-length)
|
||||
# so the player's own row appears in the lower-middle of the screen,
|
||||
# above the hand panel — not hidden behind it.
|
||||
var pivot_offset := (bh - 1.0) * 0.3
|
||||
if Auth.user_id.to_lower() == p1_id.to_lower():
|
||||
_cam_yaw = 180.0
|
||||
# P1 row is at world -Z. Camera looks from -Z toward +Z → yaw=180°.
|
||||
# Shift pivot toward world -Z so P1's row is NOT at the very bottom.
|
||||
_cam_yaw = 180.0
|
||||
_cam_pivot = Vector3(0.0, 0.0, -pivot_offset)
|
||||
else:
|
||||
# P2 row is at world +Z (default yaw=0°).
|
||||
_cam_pivot = Vector3(0.0, 0.0, pivot_offset)
|
||||
_apply_camera()
|
||||
|
||||
var board : Dictionary = state.get("board", {})
|
||||
|
||||
Reference in New Issue
Block a user