Make unit commands icon first
This commit is contained in:
@@ -3471,19 +3471,38 @@ func _check_hud_command_grid_layout(failures: Array[String]) -> void:
|
||||
failures.append("unit command grid should use %d columns, got %d" % [BattleSceneScript.HUD_COMMAND_GRID_COLUMNS, command_grid.columns])
|
||||
if command_grid.custom_minimum_size.x < BattleSceneScript.HUD_COMMAND_GRID_SIZE.x or command_grid.custom_minimum_size.y < BattleSceneScript.HUD_COMMAND_GRID_SIZE.y:
|
||||
failures.append("unit command grid should reserve stable space: %s" % str(command_grid.custom_minimum_size))
|
||||
for button in [
|
||||
scene.wait_button,
|
||||
scene.tactic_button,
|
||||
scene.item_button,
|
||||
scene.equip_button
|
||||
]:
|
||||
var command_icon_expectations := [
|
||||
{"button": scene.wait_button, "icon": "wait"},
|
||||
{"button": scene.tactic_button, "icon": "tactic"},
|
||||
{"button": scene.item_button, "icon": "item"},
|
||||
{"button": scene.equip_button, "icon": "equip"}
|
||||
]
|
||||
for expectation in command_icon_expectations:
|
||||
var button: Button = expectation["button"]
|
||||
if button == null:
|
||||
failures.append("unit command button missing")
|
||||
continue
|
||||
if button.get_parent() != command_grid:
|
||||
failures.append("unit command button should stay in the side command grid: %s" % str(button.name))
|
||||
if button.custom_minimum_size.x < BattleSceneScript.HUD_COMMAND_BUTTON_SIZE.x or button.custom_minimum_size.y < BattleSceneScript.HUD_COMMAND_BUTTON_SIZE.y:
|
||||
failures.append("unit command button should reserve fixed Korean label space: %s" % str(button.custom_minimum_size))
|
||||
failures.append("unit command button should reserve fixed icon space: %s" % str(button.custom_minimum_size))
|
||||
if button.icon == null or str(button.get_meta("command_icon", "")) != str(expectation["icon"]):
|
||||
failures.append("unit command button should carry an immediate visual icon: %s icon=%s meta=%s" % [button.text, str(button.icon), str(button.get_meta("command_icon", ""))])
|
||||
if not bool(button.get_meta("icon_only", false)) or button.text != "":
|
||||
failures.append("unit command button should be icon-first without visible text: %s text=%s" % [str(button.name), button.text])
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load opening battle for command icon tooltip check")
|
||||
else:
|
||||
scene.battle_started = true
|
||||
scene.briefing_panel.visible = false
|
||||
scene.result_panel.visible = false
|
||||
scene._update_hud()
|
||||
for expectation in command_icon_expectations:
|
||||
var button: Button = expectation["button"]
|
||||
if button == null:
|
||||
continue
|
||||
if button.tooltip_text.strip_edges().is_empty():
|
||||
failures.append("unit command icon should expose its command through tooltip: %s" % str(button.name))
|
||||
var top_toolbar := scene.end_turn_button.get_parent() as HBoxContainer
|
||||
if top_toolbar == null or top_toolbar.name != "TopToolBar":
|
||||
failures.append("global battle commands should move to the top icon toolbar")
|
||||
@@ -3515,6 +3534,15 @@ func _check_action_button_disabled_reasons(failures: Array[String]) -> void:
|
||||
scene.equip_button = Button.new()
|
||||
scene.end_turn_button = Button.new()
|
||||
scene.threat_button = Button.new()
|
||||
for button in [
|
||||
scene.wait_button,
|
||||
scene.tactic_button,
|
||||
scene.item_button,
|
||||
scene.equip_button,
|
||||
scene.end_turn_button,
|
||||
scene.threat_button
|
||||
]:
|
||||
button.set_meta("icon_only", true)
|
||||
if not scene.state.load_battle("res://data/scenarios/001_yellow_turbans.json"):
|
||||
failures.append("could not load battle scene state for action button reasons")
|
||||
_free_action_button_test_scene(scene)
|
||||
@@ -3529,7 +3557,7 @@ func _check_action_button_disabled_reasons(failures: Array[String]) -> void:
|
||||
"remaining_phases": 2
|
||||
}]
|
||||
scene._update_tactic_button(cao_cao)
|
||||
if scene.tactic_button.text != "책략" or not scene.tactic_button.tooltip_text.contains("봉인됨") or not scene.tactic_button.tooltip_text.contains("책략"):
|
||||
if scene.tactic_button.text != "" or not scene.tactic_button.tooltip_text.contains("봉인됨") or not scene.tactic_button.tooltip_text.contains("책략"):
|
||||
failures.append("sealed unit should explain disabled tactic button: %s | %s" % [scene.tactic_button.text, scene.tactic_button.tooltip_text])
|
||||
cao_cao["status_effects"] = []
|
||||
|
||||
@@ -3538,36 +3566,36 @@ func _check_action_button_disabled_reasons(failures: Array[String]) -> void:
|
||||
scene._update_tactic_button(cao_cao)
|
||||
scene._update_item_button(cao_cao)
|
||||
scene._update_equip_button(cao_cao)
|
||||
if scene.wait_button.text != "대기" or not scene.wait_button.tooltip_text.contains("이미 행동"):
|
||||
if scene.wait_button.text != "" or not scene.wait_button.tooltip_text.contains("대기") or not scene.wait_button.tooltip_text.contains("이미 행동"):
|
||||
failures.append("acted unit hold button should keep short text and explain in tooltip: %s | %s" % [scene.wait_button.text, scene.wait_button.tooltip_text])
|
||||
if scene.tactic_button.text != "책략" or not scene.tactic_button.tooltip_text.contains("이미 행동"):
|
||||
if scene.tactic_button.text != "" or not scene.tactic_button.tooltip_text.contains("책략") or not scene.tactic_button.tooltip_text.contains("이미 행동"):
|
||||
failures.append("acted unit stratagem button should keep short text and explain in tooltip: %s | %s" % [scene.tactic_button.text, scene.tactic_button.tooltip_text])
|
||||
if scene.item_button.text != "도구" or not scene.item_button.tooltip_text.contains("이미 행동"):
|
||||
if scene.item_button.text != "" or not scene.item_button.tooltip_text.contains("도구") or not scene.item_button.tooltip_text.contains("이미 행동"):
|
||||
failures.append("acted unit supply button should keep short text and explain in tooltip: %s | %s" % [scene.item_button.text, scene.item_button.tooltip_text])
|
||||
if scene.equip_button.text != "병장" or not scene.equip_button.tooltip_text.contains("이미 행동"):
|
||||
if scene.equip_button.text != "" or not scene.equip_button.tooltip_text.contains("병장") or not scene.equip_button.tooltip_text.contains("이미 행동"):
|
||||
failures.append("acted unit arms button should keep short text and explain in tooltip: %s | %s" % [scene.equip_button.text, scene.equip_button.tooltip_text])
|
||||
|
||||
cao_cao["acted"] = false
|
||||
cao_cao["moved"] = true
|
||||
scene._update_equip_button(cao_cao)
|
||||
if scene.equip_button.text != "병장" or not scene.equip_button.tooltip_text.contains("행군 후") or not scene.equip_button.tooltip_text.contains("행군 전"):
|
||||
if scene.equip_button.text != "" or not scene.equip_button.tooltip_text.contains("병장") or not scene.equip_button.tooltip_text.contains("행군 후") or not scene.equip_button.tooltip_text.contains("행군 전"):
|
||||
failures.append("moved unit should explain disabled equip button: %s | %s" % [scene.equip_button.text, scene.equip_button.tooltip_text])
|
||||
|
||||
cao_cao["moved"] = false
|
||||
scene.state.set_inventory_snapshot({})
|
||||
scene._update_item_button(cao_cao)
|
||||
if scene.item_button.text != "도구" or not scene.item_button.tooltip_text.contains("비어 있음") or not scene.item_button.tooltip_text.contains("도구"):
|
||||
if scene.item_button.text != "" or not scene.item_button.tooltip_text.contains("비어 있음") or not scene.item_button.tooltip_text.contains("도구"):
|
||||
failures.append("empty inventory should explain disabled item button: %s | %s" % [scene.item_button.text, scene.item_button.tooltip_text])
|
||||
|
||||
scene.state.current_team = BattleState.TEAM_ENEMY
|
||||
scene._update_end_turn_button()
|
||||
if scene.end_turn_button.text != "차례 종료" or not scene.end_turn_button.tooltip_text.contains("적군 차례") or not scene.end_turn_button.tooltip_text.contains("아군 군령"):
|
||||
if scene.end_turn_button.text != "" or not scene.end_turn_button.tooltip_text.contains("차례 종료") or not scene.end_turn_button.tooltip_text.contains("적군 차례") or not scene.end_turn_button.tooltip_text.contains("아군 군령"):
|
||||
failures.append("enemy phase should explain disabled end turn button: %s | %s" % [scene.end_turn_button.text, scene.end_turn_button.tooltip_text])
|
||||
|
||||
scene.state.current_team = BattleState.TEAM_PLAYER
|
||||
scene.battle_started = false
|
||||
scene._update_threat_button()
|
||||
if scene.threat_button.text != "적정" or not scene.threat_button.tooltip_text.contains("전장도 미개봉") or not scene.threat_button.tooltip_text.contains("전장도"):
|
||||
if scene.threat_button.text != "" or not scene.threat_button.tooltip_text.contains("적정") or not scene.threat_button.tooltip_text.contains("전장도 미개봉") or not scene.threat_button.tooltip_text.contains("전장도"):
|
||||
failures.append("inactive battle should explain disabled threat button: %s | %s" % [scene.threat_button.text, scene.threat_button.tooltip_text])
|
||||
_free_action_button_test_scene(scene)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user