Improve unit tokens and local tooltips

This commit is contained in:
2026-06-19 21:58:54 +09:00
parent de83b5cdd7
commit d02627e5d4
3 changed files with 74 additions and 18 deletions

View File

@@ -107,7 +107,7 @@ func _check_scene_post_move_menu_flow(failures: Array[String]) -> void:
failures.append("post-move action menu should be visible after moving")
else:
_check_local_panel_position(failures, scene, scene.post_move_menu, Vector2i(2, 3), "post-move action menu")
_check_local_command_button_tooltips_suppressed(failures, [
_check_local_command_button_tooltips_present(failures, [
scene.post_move_attack_button,
scene.post_move_tactic_button,
scene.post_move_item_button,
@@ -294,7 +294,7 @@ func _check_scene_post_move_text_fit(failures: Array[String]) -> void:
failures.append("post-move picker should expose a fitted detail label")
else:
_check_fitted_label_font(failures, scene.post_move_picker_detail_label, BattleSceneScript.LOCAL_COMMAND_DETAIL_FONT_SIZE, BattleSceneScript.LOCAL_COMMAND_DETAIL_MIN_FONT_SIZE, "post-move picker detail")
_check_local_command_button_tooltips_suppressed(failures, [
_check_local_command_button_tooltips_present(failures, [
scene.post_move_picker_back_button,
scene.post_move_picker_cancel_move_button,
scene.targeting_hint_back_button,
@@ -358,7 +358,7 @@ func _check_scene_post_move_blocked_command_labels(failures: Array[String]) -> v
failures.append("blocked tactic command should explain itself through local hover metadata")
if scene.post_move_item_button == null or not scene.post_move_item_button.disabled or scene.post_move_item_button.text != "" or str(scene.post_move_item_button.get_meta("disabled_hint", "")) != "보급 없음":
failures.append("blocked item command should explain itself through local hover metadata")
_check_local_command_button_tooltips_suppressed(failures, [
_check_local_command_button_tooltips_present(failures, [
scene.post_move_attack_button,
scene.post_move_tactic_button,
scene.post_move_item_button
@@ -768,7 +768,7 @@ func _check_scene_post_move_tactic_picker_flow(failures: Array[String]) -> void:
failures.append("post-move action menu should hide while the tactic picker is open")
if scene.tactic_menu != null and scene.tactic_menu.visible:
failures.append("post-move tactic shortcut should not use the side tactic menu")
_check_post_move_picker_option_tooltips_suppressed(failures, scene, "post-move tactic picker")
_check_post_move_picker_option_tooltips_present(failures, scene, "post-move tactic picker")
var escape := InputEventKey.new()
escape.keycode = KEY_ESCAPE
@@ -877,7 +877,7 @@ func _check_scene_post_move_item_picker_flow(failures: Array[String]) -> void:
failures.append("post-move action menu should hide while the item picker is open")
if scene.item_menu != null and scene.item_menu.visible:
failures.append("post-move item shortcut should not use the side item menu")
_check_post_move_picker_option_tooltips_suppressed(failures, scene, "post-move item picker")
_check_post_move_picker_option_tooltips_present(failures, scene, "post-move item picker")
scene._on_post_move_item_option_pressed("bean")
if scene.selected_item_id != "bean":
@@ -946,22 +946,22 @@ func _check_local_panel_position(failures: Array[String], scene, panel: Control,
failures.append("%s should not cover the moved unit cell: %s over %s" % [label, str(panel_rect), str(cell_rect)])
func _check_local_command_button_tooltips_suppressed(failures: Array[String], buttons: Array, label: String) -> void:
func _check_local_command_button_tooltips_present(failures: Array[String], buttons: Array, label: String) -> void:
for button in buttons:
if button == null:
failures.append("%s should expose local command buttons for tooltip checks" % label)
continue
if not str(button.tooltip_text).is_empty():
failures.append("%s should keep guidance on the map instead of native tooltips: %s" % [label, str(button.tooltip_text)])
if str(button.tooltip_text).strip_edges().is_empty():
failures.append("%s should explain icon function through hover tooltip" % label)
func _check_post_move_picker_option_tooltips_suppressed(failures: Array[String], scene, label: String) -> void:
func _check_post_move_picker_option_tooltips_present(failures: Array[String], scene, label: String) -> void:
if scene.post_move_picker_list == null:
failures.append("%s should expose a picker option list" % label)
return
for child in scene.post_move_picker_list.get_children():
if child is Button and not str(child.tooltip_text).is_empty():
failures.append("%s option should not rely on native tooltip popups: %s" % [label, str(child.tooltip_text)])
if child is Button and str(child.tooltip_text).strip_edges().is_empty():
failures.append("%s option should explain its function through hover tooltip" % label)
func _check_fitted_label_font(failures: Array[String], label: Label, base_size: int, min_size: int, label_name: String) -> void:

View File

@@ -3465,8 +3465,8 @@ func _check_local_command_icon_button(failures: Array[String], button: Button, e
failures.append("local command should carry an immediate visual icon: %s icon=%s meta=%s" % [expected_label, str(button.icon), str(button.get_meta("command_icon", ""))])
if str(button.get_meta("command_label", "")) != expected_label:
failures.append("local command should keep old wording in hover metadata: %s meta=%s" % [expected_label, str(button.get_meta("command_label", ""))])
if not str(button.tooltip_text).is_empty():
failures.append("local command should keep guidance in the local panel instead of native tooltip: %s" % expected_label)
if str(button.tooltip_text).strip_edges().is_empty() or not str(button.tooltip_text).contains(expected_label):
failures.append("local command should expose its function through hover tooltip: %s tooltip=%s" % [expected_label, str(button.tooltip_text)])
if button.custom_minimum_size.x <= 0.0 or button.custom_minimum_size.y <= 0.0:
failures.append("local command should reserve stable icon space: %s" % expected_label)
@@ -3886,6 +3886,17 @@ func _check_terrain_and_unit_presentation(failures: Array[String]) -> void:
var acted_modulate: Color = scene._unit_sprite_modulate(generic_enemy, true)
if acted_modulate.a >= enemy_modulate.a:
failures.append("acted generic enemy sprite should still dim below active tint")
var sprite_texture := scene._load_art_texture(str(named_officer.get("sprite", "")))
if sprite_texture == null:
failures.append("named officer high-res map sprite should load")
else:
var sprite_rect: Rect2 = scene._unit_map_sprite_rect(sprite_texture, scene._rect_for_cell(Vector2i(1, 6)), named_officer)
if sprite_rect.size.x < 24.0 or sprite_rect.size.y < 36.0:
failures.append("high-res map sprite should occupy a readable token area: %s" % str(sprite_rect))
if sprite_rect.position.x < scene._rect_for_cell(Vector2i(1, 6)).position.x or sprite_rect.end.x > scene._rect_for_cell(Vector2i(1, 6)).end.x:
failures.append("high-res map sprite should stay inside its tile horizontally: %s" % str(sprite_rect))
if scene.texture_filter != CanvasItem.TEXTURE_FILTER_LINEAR:
failures.append("battle scene should use linear texture filtering for smoother high-res map sprites")
scene.free()