fix: 装备属性面板避让逻辑 + 多项功能更新

- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
This commit is contained in:
shen
2026-09-21 16:38:59 -07:00
parent 1522a8a1a1
commit c93894313a
5498 changed files with 4558004 additions and 1442 deletions
+26
View File
@@ -32,6 +32,8 @@ class FakeAudio extends Node:
stopped += 1
func set_music_volume(v: float) -> void:
master_bgm = clampf(v, 0.0, 1.0)
func set_sound_volume(v: float) -> void:
master_sfx = clampf(v, 0.0, 1.0)
var _fail := 0
func _ck(c: bool, m: String) -> void:
@@ -46,6 +48,7 @@ func _init() -> void:
_test_world_reset_reruns()
_test_musicinfo_lastplay_roundtrip()
_test_background_save_restore()
_test_window_focus_save_restore()
if _fail == 0:
print("PASS: bgm_test (§9.1 map BGM select + §9.2 volume save/restore)")
quit(0)
@@ -139,6 +142,7 @@ func _test_background_save_restore() -> void:
life._enter_background()
_ck(is_equal_approx(audio.master_bgm, 0.0), "music muted in background, got %f" % audio.master_bgm)
_ck(is_equal_approx(audio.master_sfx, 0.0), "sound muted in background, got %f" % audio.master_sfx)
_ck(audio._volume_saved, "save_volume ran (backup taken)")
_ck(is_equal_approx(audio._backup_music_volume, 0.6), "backup music volume, got %f" % audio._backup_music_volume)
_ck(is_equal_approx(audio._backup_sound_volume, 0.9), "backup sound volume, got %f" % audio._backup_sound_volume)
@@ -151,3 +155,25 @@ func _test_background_save_restore() -> void:
_ck(not audio._volume_saved, "backup flag cleared after restore")
client.free(); life.free(); audio.free()
# §9.2 / Windows WM_ACTIVATEAPP:桌面失焦和重新获得焦点与后台一样保存、静音、恢复。
func _test_window_focus_save_restore() -> void:
var audio := Audio.new()
var life := AppLifecycle.new()
get_root().add_child(audio)
audio.setup("res://__no_assets__")
get_root().add_child(life)
life.pause_tree_on_background = false
life.background_max_fps = 0
life.bind(null, audio)
audio.master_bgm = 0.55
audio.master_sfx = 0.75
life._notification(Node.NOTIFICATION_WM_WINDOW_FOCUS_OUT)
_ck(is_equal_approx(audio.master_bgm, 0.0), "window focus-out mutes music, got %f" % audio.master_bgm)
_ck(is_equal_approx(audio.master_sfx, 0.0), "window focus-out mutes sound, got %f" % audio.master_sfx)
life._notification(Node.NOTIFICATION_WM_WINDOW_FOCUS_IN)
_ck(is_equal_approx(audio.master_bgm, 0.55), "window focus-in restores music, got %f" % audio.master_bgm)
_ck(is_equal_approx(audio.master_sfx, 0.75), "window focus-in restores sound, got %f" % audio.master_sfx)
life.free(); audio.free()