Keep command panels attached while scrolling
This commit is contained in:
@@ -10,6 +10,7 @@ func _init() -> void:
|
||||
_check_scene_post_move_menu_flow(failures)
|
||||
_check_scene_post_move_edge_positioning(failures)
|
||||
_check_scene_post_move_scrolled_view_positioning(failures)
|
||||
_check_scene_post_move_menu_tracks_map_scroll(failures)
|
||||
_check_scene_post_move_text_fit(failures)
|
||||
_check_scene_post_move_tactic_picker_flow(failures)
|
||||
_check_scene_post_move_item_picker_flow(failures)
|
||||
@@ -204,6 +205,45 @@ func _check_scene_post_move_scrolled_view_positioning(failures: Array[String]) -
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_scene_post_move_menu_tracks_map_scroll(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene._create_hud()
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load opening battle for scroll-tracking menu")
|
||||
scene.free()
|
||||
return
|
||||
scene.battle_started = true
|
||||
scene.campaign_complete_screen = false
|
||||
scene.briefing_panel.visible = false
|
||||
scene.result_panel.visible = false
|
||||
scene._clear_pending_move_state()
|
||||
|
||||
var pending_cell := Vector2i(10, 6)
|
||||
var cao_cao: Dictionary = scene.state.get_unit("cao_cao")
|
||||
cao_cao["pos"] = pending_cell
|
||||
cao_cao["moved"] = true
|
||||
cao_cao["acted"] = false
|
||||
scene.state.select_unit("cao_cao")
|
||||
scene.pending_move_unit_id = "cao_cao"
|
||||
scene.pending_move_from_cell = Vector2i(9, 6)
|
||||
scene.pending_move_to_cell = pending_cell
|
||||
scene._show_post_move_menu()
|
||||
if scene.post_move_menu == null or not scene.post_move_menu.visible:
|
||||
failures.append("scroll-tracking post-move menu should be visible")
|
||||
scene.free()
|
||||
return
|
||||
|
||||
scene.post_move_menu.position = Vector2(1.0, 1.0)
|
||||
var map_rect: Rect2 = scene._minimap_map_rect()
|
||||
if not scene._scroll_board_to_minimap_position(map_rect.end):
|
||||
failures.append("minimap scroll should move the opening large map")
|
||||
var expected_position: Vector2 = scene._local_command_panel_position_for_cell(pending_cell, scene.POST_MOVE_MENU_SIZE)
|
||||
if scene.post_move_menu.position.distance_squared_to(expected_position) > 0.01:
|
||||
failures.append("post-move menu should track board scroll: %s vs %s" % [str(scene.post_move_menu.position), str(expected_position)])
|
||||
_check_local_panel_position(failures, scene, scene.post_move_menu, pending_cell, "scroll-tracking post-move action menu")
|
||||
scene.free()
|
||||
|
||||
|
||||
func _check_scene_post_move_text_fit(failures: Array[String]) -> void:
|
||||
var scene = BattleSceneScript.new()
|
||||
scene._create_hud()
|
||||
|
||||
Reference in New Issue
Block a user