Dock weather clock to screen corner
This commit is contained in:
parent
cae120c532
commit
7661b057bc
3 changed files with 17 additions and 5 deletions
|
|
@ -150,13 +150,25 @@ func _run() -> void:
|
|||
assert(presenter.get_ui_viewport_size() == expected_viewport_size)
|
||||
assert(presenter.size.is_equal_approx(Vector2(expected_viewport_size)))
|
||||
var chat_panel := chat_ui.get_node("ChatPanel") as Control
|
||||
var clock_panel := chat_ui.get_node("WorldClockPanel") as Control
|
||||
var weather_icon := chat_ui.get_node("WorldWeatherIcon") as Control
|
||||
assert(chat_panel != null)
|
||||
assert(clock_panel != null)
|
||||
assert(weather_icon != null)
|
||||
assert(chat_panel.visible)
|
||||
assert(is_equal_approx(chat_panel.position.x, 0.0))
|
||||
assert(is_equal_approx(
|
||||
(chat_panel.position.y + chat_panel.size.y) * effective_scale,
|
||||
display_size.y - ChatUI.BOTTOM_MARGIN * effective_scale,
|
||||
))
|
||||
assert(clock_panel.position.is_equal_approx(Vector2(
|
||||
ChatUI.CLOCK_EDGE_MARGIN,
|
||||
ChatUI.CLOCK_EDGE_MARGIN,
|
||||
)))
|
||||
assert(is_equal_approx(
|
||||
weather_icon.position.y, ChatUI.CLOCK_EDGE_MARGIN
|
||||
))
|
||||
assert(weather_icon.position.x > clock_panel.position.x)
|
||||
print(
|
||||
(
|
||||
"UI resize: requested=%s actual=%s viewport=%s container_scale=%.6f "
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ func _run_client() -> void:
|
|||
assert(clock_label.text.ends_with(" pm"))
|
||||
assert(weather_icon.visible)
|
||||
assert(weather_icon.get_weather() == WorldWeatherService.Weather.RAINY)
|
||||
assert(is_equal_approx(clock_panel.position.y, 10.0))
|
||||
assert(is_equal_approx(weather_icon.position.y, 10.0))
|
||||
assert(clock_panel.position.y + clock_panel.size.y < chat_panel.position.y)
|
||||
|
||||
var update_deadline: int = Time.get_ticks_msec() + 10000
|
||||
|
|
@ -156,10 +158,12 @@ func _run_client() -> void:
|
|||
await process_frame
|
||||
assert(clock_panel.position.x > 1000.0)
|
||||
assert(weather_icon.position.x < clock_panel.position.x)
|
||||
assert(is_equal_approx(clock_panel.position.y, 10.0))
|
||||
chat_ui.call("set_dock_right", false)
|
||||
await process_frame
|
||||
assert(clock_panel.position.x < 20.0)
|
||||
assert(weather_icon.position.x > clock_panel.position.x)
|
||||
assert(is_equal_approx(clock_panel.position.y, 10.0))
|
||||
print("World time multiplayer client validation: PASS")
|
||||
session.disconnect_session("")
|
||||
main.queue_free()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ const COLLAPSED_REVEAL_WIDTH: float = 8.0
|
|||
const HINT_EDGE_MARGIN: float = 4.0
|
||||
const CLOCK_SIZE := Vector2(116.0, 34.0)
|
||||
const CLOCK_EDGE_MARGIN: float = 10.0
|
||||
const CLOCK_PANEL_GAP: float = 8.0
|
||||
const WEATHER_ICON_SIZE := Vector2(34.0, 34.0)
|
||||
const WEATHER_ICON_GAP: float = 6.0
|
||||
const WorldTimeServiceType = preload("res://world/world_time_service.gd")
|
||||
|
|
@ -824,10 +823,7 @@ func _layout_presentation(animate: bool) -> void:
|
|||
)
|
||||
var clock_position := Vector2(
|
||||
clock_x,
|
||||
maxf(
|
||||
CLOCK_EDGE_MARGIN,
|
||||
target_position.y - CLOCK_SIZE.y - CLOCK_PANEL_GAP,
|
||||
),
|
||||
CLOCK_EDGE_MARGIN,
|
||||
)
|
||||
var weather_icon_x: float = (
|
||||
clock_position.x - WEATHER_ICON_GAP - WEATHER_ICON_SIZE.x
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue