test(presenter)+fix(i18n): 淘汰策略与共享缓存解耦;注释里的 ASCII 引号

- prune() 抽成独立函数:全局缓存被所有用例共享,谁往里面灌 240+ 条都会顺手清掉
  别的用例刚缓存的键(实测:并行跑时 the_second_identical_refresh_... 假红)。淘汰
  策略改在本地 Cache 上测,两条判据各自确定;
- clippy -D warnings:from_ref 代替 &[x.clone()];
- model.rs 注释里的 "原因 + OS 原文" 用 ASCII 引号 → 页面字面量白名单守门报红,改
  中文引号;core/events 的三处文档失真登记为 TowerFinding(scope 外);
- 出处文案口径:TooLarge 的 detail 只留数字(presenter 不产人读文案)。
This commit is contained in:
AskaEth committed 2026-11-11 16:52:47 +08:00
1 parent 0b6b8f0a62
commit dd9962e610
11 files changed
+127 -64

No files matched your search

+17 -4
View File
@@ -106,7 +106,7 @@ pub fn view(instance: &str) -> unlucky_presenter::dto::SavesListView {
Some(OLDEST),
ScreenshotPreview::Failed(ScreenshotThumbFailure {
kind: ScreenshotThumbKind::TooLarge,
detail: "9437184 > 8388608 字节".to_string(),
detail: "9437184 > 8388608".to_string(),
}),
),
],
@@ -214,7 +214,12 @@ fn scene(tone: u8) -> unlucky_presenter::dto::ThumbnailView {
// 地平线在 2/3 高度(截图里天空总比地面多)。
const HORIZON: u32 = H * 2 / 3;
let (sky_top, sky_bottom, ground, sun): ([u8; 3], [u8; 3], [u8; 3], [u8; 3]) = if tone == 1 {
([128, 176, 240], [200, 224, 248], [86, 138, 66], [255, 246, 186])
(
[128, 176, 240],
[200, 224, 248],
[86, 138, 66],
[255, 246, 186],
)
} else {
([96, 66, 96], [232, 148, 96], [58, 74, 48], [255, 214, 150])
};
@@ -228,12 +233,20 @@ fn scene(tone: u8) -> unlucky_presenter::dto::ThumbnailView {
let span = i32::from(to) - i32::from(from);
(i32::from(from) + span * t as i32 / 255) as u8
};
(mix(sky_top[0], sky_bottom[0]), mix(sky_top[1], sky_bottom[1]), mix(sky_top[2], sky_bottom[2]))
(
mix(sky_top[0], sky_bottom[0]),
mix(sky_top[1], sky_bottom[1]),
mix(sky_top[2], sky_bottom[2]),
)
} else {
// 地面:按 3px 一条的条纹给出「方块地形」的观感。
let stripe = (y / 3) % 2 == 0;
let shade: u8 = if stripe { 0 } else { 14 };
(ground[0].saturating_sub(shade), ground[1].saturating_sub(shade), ground[2].saturating_sub(shade))
(
ground[0].saturating_sub(shade),
ground[1].saturating_sub(shade),
ground[2].saturating_sub(shade),
)
};
// 太阳/月亮:右上角一个 18px 的圆(够小,不会盖住画面主体)。
let (dx, dy) = (x as i32 - 126, y as i32 - 26);