improve: battle action clarity, visible feedback, explicit exit

Owner feedback: too few visible animations, button rows feel list-like, battle
actions unclear, and tapping a bottom tab silently left the fight.

- Battle manual actions now have icons and three distinct weights: sword =
  repeated hit (brass primary), bolt = storm (quiet), fireball = ultimate
  (purple special). A "tight" icon-button mode keeps all three plus dynamic
  cooldown/energy text inside the 358px row (verified by geometry probe).
- Added an always-visible flagged "退出战斗" button in the battle header; the
  stage hint now reads "tap enemy to retarget / buttons below to act".
- Leaving battle via any tab shows a shell-level toast "已离开战斗 · 前往 X"
  so the player knows the fight ended and where they landed.
- Game feel: idle sprites have a 6fps floor (authored 4-frame/3fps idle read as
  frozen), damage numbers get a short overshoot-and-settle pop, and manual-hit
  shake trauma doubled (still small tier). All respect reduced motion/low power.
- New regression assertions: labeled exit button + exit toast; 108 gates pass.

Normal-render capture inspected at 390x844 zh_CN. agent_visual_reviewed only;
owner must confirm on device whether the motion level now feels right.
This commit is contained in:
2026-11-20 14:33:44 +08:00
parent ed8b63e9d3
commit 28e824763b
11 changed files with 134 additions and 24 deletions
+5 -2
View File
@@ -933,10 +933,13 @@
"shell.endless.log": "Recent Zone Log",
"shell.settings.skin": "UI Skin",
"shell.settings.skin_name.default": "Default",
"shell.settings.skin_name.parchment": "Parchment"
"shell.settings.skin_name.parchment": "Parchment",
"hud.exit.button": "Exit battle",
"hud.exit.notice": "Left battle · Going to",
"hud.manual.hint": "Tap an enemy to retarget · use the buttons below"
},
"shell.interact.board_kill": "Purge: battle wins {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_clear": "Advance: nodes cleared {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_build": "Grow: talents {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_ascend": "Expedition: rebuilds/new skies {prog}/{step}, pays 5 crystal ({avail} ready)"
}
}
+5 -2
View File
@@ -933,10 +933,13 @@
"shell.endless.log": "最近区域记录",
"shell.settings.skin": "界面皮肤",
"shell.settings.skin_name.default": "默认",
"shell.settings.skin_name.parchment": "羊皮纸"
"shell.settings.skin_name.parchment": "羊皮纸",
"hud.exit.button": "退出战斗",
"hud.exit.notice": "已离开战斗 · 前往",
"hud.manual.hint": "点敌人切换目标 · 下方按钮出招"
},
"shell.interact.board_kill": "清剿委托:战斗胜利 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_clear": "推进委托:通关节点 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_build": "成长委托:天赋数 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_ascend": "远征委托:重建/新天空 {prog}/{step},奖励 5 风晶({avail} 待领)"
}
}
+5 -2
View File
@@ -933,10 +933,13 @@
"shell.endless.log": "Recent Zone Log",
"shell.settings.skin": "UI Skin",
"shell.settings.skin_name.default": "Default",
"shell.settings.skin_name.parchment": "Parchment"
"shell.settings.skin_name.parchment": "Parchment",
"hud.exit.button": "Exit battle",
"hud.exit.notice": "Left battle · Going to",
"hud.manual.hint": "Tap an enemy to retarget · use the buttons below"
},
"shell.interact.board_kill": "Purge: battle wins {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_clear": "Advance: nodes cleared {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_build": "Grow: talents {prog}/{step}, pays 5 crystal ({avail} ready)",
"shell.interact.board_ascend": "Expedition: rebuilds/new skies {prog}/{step}, pays 5 crystal ({avail} ready)"
}
}
+5 -2
View File
@@ -933,10 +933,13 @@
"shell.endless.log": "最近区域记录",
"shell.settings.skin": "界面皮肤",
"shell.settings.skin_name.default": "默认",
"shell.settings.skin_name.parchment": "羊皮纸"
"shell.settings.skin_name.parchment": "羊皮纸",
"hud.exit.button": "退出战斗",
"hud.exit.notice": "已离开战斗 · 前往",
"hud.manual.hint": "点敌人切换目标 · 下方按钮出招"
},
"shell.interact.board_kill": "清剿委托:战斗胜利 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_clear": "推进委托:通关节点 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_build": "成长委托:天赋数 {prog}/{step},奖励 5 风晶({avail} 待领)",
"shell.interact.board_ascend": "远征委托:重建/新天空 {prog}/{step},奖励 5 风晶({avail} 待领)"
}
}
+34 -6
View File
@@ -41,6 +41,7 @@ var _node_value: Label
var _speed_button: Button
var _pause_button: Button
var _settings_button: Button
var _exit_button: Button
var _stage_enemy_row: HBoxContainer
var _stage_timer_bar: ProgressBar
@@ -276,6 +277,15 @@ func _build_battle_header() -> void:
_pause_button.pressed.connect(func() -> void: pause_requested.emit())
row.add_child(_pause_button)
# An explicit, always-visible exit action. Before this, the only way out
# was a bottom tab whose behaviour was invisible to the player.
_exit_button = UiTheme.make_menu_button(
"res://assets/icons/icon_flag.png",
UiText.t("hud.exit.button", locale), "secondary", 12, true)
_exit_button.custom_minimum_size = Vector2(110, 36)
_exit_button.pressed.connect(func() -> void: nav_requested.emit("skyport"))
row.add_child(_exit_button)
func _build_battle_stage() -> void:
var region: Control = _regions["battle_stage"]
@@ -359,22 +369,29 @@ func _build_manual_zone() -> void:
row.add_theme_constant_override("separation", 8)
margin.add_child(row)
_tap_button = UiTheme.make_button("", 12)
# Three differently weighted actions with icons: the repeated manual hit
# is the loud primary, the storm is a quiet utility, the ultimate is a
# distinct special. Previously all three were identical text-only boxes.
_tap_button = UiTheme.make_menu_button(
"res://assets/icons/icon_sword.png", "", "primary", 13, false, true)
_tap_button.name = "TapButton"
_tap_button.custom_minimum_size = Vector2(150, 52)
_tap_button.custom_minimum_size = Vector2(132, 52)
_tap_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
_tap_button.pressed.connect(_on_tap_pressed)
row.add_child(_tap_button)
_storm_button = UiTheme.make_button("", 12)
_storm_button = UiTheme.make_menu_button(
"res://assets/icons/icon_tempo_bolt.png", "", "secondary", 12, false, true)
_storm_button.name = "StormButton"
_storm_button.custom_minimum_size = Vector2(96, 52)
_storm_button.custom_minimum_size = Vector2(88, 52)
_storm_button.alignment = HORIZONTAL_ALIGNMENT_CENTER
_storm_button.pressed.connect(func() -> void: storm_used.emit())
row.add_child(_storm_button)
_ultimate_button = UiTheme.make_button("", 12)
_ultimate_button = UiTheme.make_menu_button(
"res://assets/icons/icon_aoe_fireball.png", "", "special", 12, false, true)
_ultimate_button.name = "UltimateButton"
_ultimate_button.custom_minimum_size = Vector2(96, 52)
_ultimate_button.custom_minimum_size = Vector2(88, 52)
_ultimate_button.pressed.connect(_on_ultimate_pressed)
row.add_child(_ultimate_button)
@@ -817,6 +834,15 @@ func show_damage_number(unit_id: String, amount: float) -> void:
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
_overlay_layer.add_child(label)
_floating_numbers.append(label)
# A brief overshoot-and-settle makes the number read as an impact instead
# of a passive label drifting upward. Rest state is scale ONE.
if not reduced_motion:
label.scale = Vector2(0.72, 0.72)
var pop := create_tween()
pop.tween_property(label, "scale", Vector2(1.18, 1.18), 0.07) \
.set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
pop.tween_property(label, "scale", Vector2.ONE, 0.14) \
.set_ease(Tween.EASE_OUT)
var tween := create_tween()
if reduced_motion:
# No drift, no fade: show the number briefly and release it.
@@ -1277,6 +1303,8 @@ func refresh_static_text() -> void:
_pause_button.text = "暂停" if locale.begins_with("zh") else "Pause"
if _settings_button != null:
_settings_button.text = UiText.t("shell.settings.title", locale)
if _exit_button != null:
_exit_button.text = UiText.t("hud.exit.button", locale)
for key in _nav_buttons.keys():
var button: Button = _nav_buttons[key]
button.text = UiText.t("hud.nav.%s" % key, locale)
+1 -1
View File
@@ -458,7 +458,7 @@ func _refresh() -> void:
timeout,
str(scenario.get("id", "")).ends_with("N10")
)
hud.set_hint(UiText.t("hud.stage.tap_target", locale))
hud.set_hint(UiText.t("hud.manual.hint", locale))
hud.set_manual_state(
tap_active,
+2 -2
View File
@@ -18,7 +18,7 @@ enum Tier { SMALL, MEDIUM, LARGE }
## Event -> tier. Only events emitted by the authoritative sim appear here.
const EVENT_TIERS: Dictionary = {
"click_enemy": Tier.SMALL,
"click_enemy": Tier.SMALL, # frequent manual hit: slightly stronger small cue
"offboard_burst": Tier.MEDIUM,
"shield_break": Tier.MEDIUM,
"enemy_defeated": Tier.MEDIUM,
@@ -29,7 +29,7 @@ const EVENT_TIERS: Dictionary = {
## trauma added per tier; total is clamped to 1.0
const SHAKE_TRAUMA: Dictionary = {
Tier.SMALL: 0.06,
Tier.SMALL: 0.12,
Tier.MEDIUM: 0.30,
Tier.LARGE: 0.72,
}
+49 -5
View File
@@ -66,6 +66,8 @@ var _modal: Control
var _modal_title: Label
var _modal_body: Label
var _modal_actions: VBoxContainer
var _toast_label: Label
var _toast_tween: Tween
var _nav_buttons: Dictionary = {}
var skyport_report_text: Label
var _skyport_report_button: Button
@@ -150,6 +152,7 @@ func _ready() -> void:
_build_growth()
_build_bottom_nav()
_build_modal()
_build_toast()
show_page(PAGE_SKYPORT)
_apply_safe_area()
# React to orientation / display changes (safe inset changes on rotation).
@@ -1795,6 +1798,40 @@ func _build_modal() -> void:
stack.add_child(_modal_actions)
## Short non-blocking notice above every layer. Used to explain that leaving
## battle ended the fight and where the player landed.
func _build_toast() -> void:
var layer := CanvasLayer.new()
layer.name = "ToastLayer"
layer.layer = 11
add_child(layer)
_toast_label = UiTheme.make_label("", 14, UiTheme.COLOR_TEXT)
_toast_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
_toast_label.set_anchors_and_offsets_preset(Control.PRESET_CENTER_TOP)
_toast_label.offset_top = 96.0
_toast_label.offset_bottom = 132.0
_toast_label.offset_left = 16.0
_toast_label.offset_right = -16.0
_toast_label.theme = _shell_theme
_toast_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
_toast_label.visible = false
layer.add_child(_toast_label)
func show_toast(message: String) -> void:
if _toast_label == null:
return
if _toast_tween != null and _toast_tween.is_valid():
_toast_tween.kill()
_toast_label.text = message
_toast_label.modulate = Color(1, 1, 1, 1)
_toast_label.visible = true
_toast_tween = create_tween()
_toast_tween.tween_interval(2.2)
_toast_tween.tween_property(_toast_label, "modulate:a", 0.0, 0.4)
_toast_tween.tween_callback(func() -> void: _toast_label.visible = false)
func show_page(page: String) -> void:
if page == PAGE_BATTLE:
return
@@ -2867,15 +2904,22 @@ func _on_battle_exit_requested(page: String) -> void:
sfx.play("ui", "ui")
# Map HUD nav ids to shell pages. Each of the four battle tabs now really
# goes somewhere different instead of all exiting to the same page.
var dest := PAGE_SKYPORT
var nav_key := "skyport"
match page:
"expedition":
show_page(PAGE_MAP)
dest = PAGE_MAP
nav_key = "expedition"
"company":
show_page(PAGE_GROWTH)
dest = PAGE_GROWTH
nav_key = "company"
"archive":
show_page(PAGE_SIDE)
_:
show_page(PAGE_SKYPORT) # skyport + pause-exit
dest = PAGE_SIDE
nav_key = "archive"
show_page(dest)
# Leaving battle via a tab used to be silent -- the player could not tell
# whether the fight ended or the screen simply changed. Say it explicitly.
show_toast(UiText.t("hud.exit.notice", locale) + " " + UiText.t("hud.nav.%s" % nav_key, locale))
_diag_write("after_exit:page=%s battle_vis=%s" % [current_page,
str(_battle_host.visible if _battle_host != null else false)])
@@ -107,6 +107,16 @@ func _run() -> void:
_problems.append("battle resource bar global top must equal safe inset")
battle.set_safe_area(0.0, 0.0)
# Leaving battle must explain itself (owner: "did it exit or what?").
var exit_btn: Button = battle.hud.get("_exit_button") as Button
if exit_btn == null or exit_btn.text.is_empty():
_problems.append("battle must expose a labeled exit button")
shell._on_battle_exit_requested("expedition")
await process_frame
var toast: Label = shell.get("_toast_label") as Label
if toast == null or not toast.text.contains(UiText.t("hud.exit.notice", shell.locale)):
_problems.append("leaving battle must show an explanatory toast")
var payload := {"problems": _problems, "button_filter": btn.mouse_filter,
"battle_info_text": info_txt, "battle_timer_text": timer_txt,
"panel_filter": panel.mouse_filter, "grid_ok": grid_ok}
+12 -2
View File
@@ -214,7 +214,7 @@ static func make_button(text: String, font_size: int = 13) -> Button:
## secondary at a glance. `kind`: "primary" | "secondary" | "quiet".
## Uses flat, sharp-edged styles (no antialiasing) so it stays pixel-grid
## compatible, and keeps `text` set so accessibility and text-based lookups work.
static func make_menu_button(icon_path: String, text: String, kind: String = "secondary", font_size: int = 14, compact: bool = false) -> Button:
static func make_menu_button(icon_path: String, text: String, kind: String = "secondary", font_size: int = 14, compact: bool = false, tight: bool = false) -> Button:
var button := Button.new()
button.text = text
button.focus_mode = Control.FOCUS_NONE
@@ -228,7 +228,7 @@ static func make_menu_button(icon_path: String, text: String, kind: String = "se
button.icon = tex
button.icon_alignment = HORIZONTAL_ALIGNMENT_LEFT
button.expand_icon = false
button.add_theme_constant_override("h_separation", 12)
button.add_theme_constant_override("h_separation", 4 if tight else 12)
var normal: StyleBoxFlat
var pressed: StyleBoxFlat
@@ -245,6 +245,13 @@ static func make_menu_button(icon_path: String, text: String, kind: String = "se
pad = 14
height = 58
button.alignment = HORIZONTAL_ALIGNMENT_CENTER
"special":
normal = flat_style(Color("#4b3563"), COLOR_PURPLE, 2)
pressed = flat_style(Color("#35234a"), Color("#c9a6ff"), 2)
hover = flat_style(Color("#5b4278"), Color("#c9a6ff"), 2)
fg = Color("#fff3ff")
height = 58
button.alignment = HORIZONTAL_ALIGNMENT_CENTER
"quiet":
normal = flat_style(Color(0, 0, 0, 0))
pressed = flat_style(Color(0, 0, 0, 0))
@@ -258,6 +265,9 @@ static func make_menu_button(icon_path: String, text: String, kind: String = "se
if compact:
pad = 8
height = 36
if tight:
# Icon + dynamic state text must fit three buttons in one 358px row.
pad = 4
for s in [normal, pressed, hover]:
s.content_margin_left = pad
s.content_margin_right = pad
+6
View File
@@ -147,6 +147,12 @@ func _process(delta: float) -> void:
return
_elapsed += delta
var fps := float(state.get("fps", 8))
# Authored idle manifests use 3 fps (4 frames = a 1.3s loop), which reads
# as a frozen sprite at play size. A 6 fps floor keeps the breathing alive
# without touching generated asset data. One-shot attack/hit states keep
# their authored pacing.
if _current == "idle":
fps = maxf(fps, 6.0)
var frame_duration := 1.0 / maxf(0.1, fps)
while _elapsed >= frame_duration:
_elapsed -= frame_duration