hand show and hide
This commit is contained in:
@@ -82,6 +82,7 @@ func _setup_ui() -> void:
|
||||
hand_display.card_hovered.connect(_on_hand_card_hovered)
|
||||
hand_display.card_unhovered.connect(_on_hand_card_unhovered)
|
||||
hand_display.card_selected.connect(_on_hand_card_selected)
|
||||
hand_display.hand_minimized_changed.connect(_on_hand_minimized_changed)
|
||||
|
||||
# Create damage displays (positioned by 3D camera overlay later)
|
||||
for i in range(2):
|
||||
@@ -89,18 +90,25 @@ func _setup_ui() -> void:
|
||||
damage_displays.append(damage_display)
|
||||
|
||||
func _position_hand_display() -> void:
|
||||
# Get viewport size and position hand at bottom
|
||||
var viewport = get_viewport()
|
||||
if viewport:
|
||||
# get_visible_rect() gives the coordinate space for 2D content
|
||||
# With canvas_items + expand, this is the expanded design space
|
||||
var vp_size = viewport.get_visible_rect().size
|
||||
# Hand cards are 195x273px (triple original), positioned at y=0 in container
|
||||
var card_height = 273.0
|
||||
var hand_height = card_height + 25.0 # Extra space for hover lift
|
||||
var is_min = hand_display and hand_display.is_minimized
|
||||
|
||||
# Position so card bottom is 100px above viewport bottom
|
||||
var bottom_offset = 100.0
|
||||
hand_display.position = Vector2(10, vp_size.y - bottom_offset - card_height)
|
||||
hand_display.size = Vector2(vp_size.x - 20, hand_height)
|
||||
var card_height = 273.0
|
||||
if is_min:
|
||||
# Minimized: push cards down so only the top portion peeks up
|
||||
var peek_height = 65.0 # How much of the card top is visible
|
||||
hand_display.position = Vector2(10, vp_size.y - peek_height)
|
||||
hand_display.size = Vector2(vp_size.x - 20, card_height + 25.0)
|
||||
else:
|
||||
# Full hand: cards at the bottom of the screen
|
||||
var hand_height = card_height + 25.0 # Extra space for hover lift
|
||||
var bottom_offset = 10.0
|
||||
hand_display.position = Vector2(10, vp_size.y - bottom_offset - card_height)
|
||||
hand_display.size = Vector2(vp_size.x - 20, hand_height)
|
||||
|
||||
if not viewport.size_changed.is_connected(_on_viewport_resized):
|
||||
viewport.size_changed.connect(_on_viewport_resized)
|
||||
@@ -108,12 +116,10 @@ func _position_hand_display() -> void:
|
||||
func _on_viewport_resized() -> void:
|
||||
var viewport = get_viewport()
|
||||
if viewport and hand_display:
|
||||
var vp_size = viewport.get_visible_rect().size
|
||||
var card_height = 273.0 # Triple size hand cards
|
||||
var hand_height = card_height + 25.0
|
||||
var bottom_offset = 100.0
|
||||
hand_display.position = Vector2(10, vp_size.y - bottom_offset - card_height)
|
||||
hand_display.size = Vector2(vp_size.x - 20, hand_height)
|
||||
_position_hand_display()
|
||||
|
||||
func _on_hand_minimized_changed(_minimized: bool) -> void:
|
||||
_position_hand_display()
|
||||
|
||||
func _connect_signals() -> void:
|
||||
# GameManager signals
|
||||
|
||||
Reference in New Issue
Block a user