refactor: 收口 BangDream 星级列表规格

This commit is contained in:
sunlei 2026-06-07 05:55:37 +08:00
parent 1aca165bbc
commit bef1750022
4 changed files with 53 additions and 3 deletions

View File

@ -396,6 +396,7 @@ export interface TsuguHook {
- 已新增 `render-blocks/list-card-prefix-spec.ts`,收口卡牌详情顶部标题块的画布、背景、乐队 Logo 等比缩放、卡牌标题和角色名文字布局;`list-card-prefix.ts` 改为消费 spec乐队/角色/服务器优先级读取和绘制顺序保持不变;`list-card-prefix-spec.spec.ts` 覆盖标题块尺寸、背景、文字坐标和 Logo 缩放,本地 `/查卡 472` 图片 smoke 输出非空。
- 已新增 `render-blocks/list-stat-spec.ts`,收口卡牌/玩家综合力列表的间隔、数值行画布、文字规格、进度条布局和条宽算法;`list-stat.ts` 改为消费 spec综合力计算、突破加成和绘制顺序保持不变`list-stat-spec.spec.ts` 覆盖间隔/画布/文字/进度条规格、文本生成和条宽布局,本地 `/查卡 472` 图片 smoke 输出非空。
- 已新增 `render-blocks/title-spec.ts`,收口通用标题条的背景偏移、两行文字字号/行高/颜色/字体/坐标;`title.ts` 改为消费 spec标题底图加载、标题文案和绘制顺序保持不变`title-spec.spec.ts` 覆盖背景偏移、两行文字布局、绘制参数和坐标,本地 `/查卡 472` 图片 smoke 输出非空。
- 已新增 `render-blocks/list-rarity-spec.ts`,收口星级列表的文字大小、间距和特训星图使用阈值;`list-rarity.ts` 改为消费 spec星图资源加载、星级数量和列表绘制顺序保持不变`list-rarity-spec.spec.ts` 覆盖列表规格和 3/4/5 星及未特训边界,本地 `/查卡 472` 图片 smoke 输出非空。
- smoke/Jenkins/远程调试卡点继续按已固化规则处理同一卡点第二次尝试前必须改变可验证变量Jenkins 查询 URL 含方括号时用 `curl -g` 或改查 Jenkins home线上图片 smoke 必须查询 `commandId`、拉回图片、展示图片、查日志并清理本轮临时目录PowerShell 双引号 here-string 中不要写 JS `${...}` 模板字面量,避免被 PowerShell 提前插值smoke 没有真实图片落盘时必须失败。
### Phase 6策略 policy 和时间/档线规则

View File

@ -0,0 +1,24 @@
export const BANGDREAM_RARITY_LIST_SPEC = {
list: {
spacing: 0,
textSize: 50,
},
trainedStar: {
minRarity: 4,
},
} as const;
/**
* 使
*
* @param rarity -
* @param trainingStatus -
*/
export function shouldUseTrainedRarityStar(
rarity: number,
trainingStatus: boolean,
) {
return (
rarity >= BANGDREAM_RARITY_LIST_SPEC.trainedStar.minRarity && trainingStatus
);
}

View File

@ -2,6 +2,10 @@ import { Canvas, Image } from 'skia-canvas';
import { drawList } from './list-frame';
import { loadImageFromPath } from '@/qqbot/plugins/bangDream/tsugu/canvas/image-utils';
import { getBangDreamAssetPath } from '@/qqbot/plugins/bangDream/tsugu/runtime/asset-manifest';
import {
BANGDREAM_RARITY_LIST_SPEC,
shouldUseTrainedRarityStar,
} from '@/qqbot/plugins/bangDream/tsugu/render-blocks/list-rarity-spec';
interface RarityInListOptions {
key?: string;
@ -36,7 +40,7 @@ export async function drawRarityInList({
}: RarityInListOptions): Promise<Canvas> {
const content: Array<string | Image | Canvas> = [];
let star: Image;
if (rarity > 3 && trainingStatus) {
if (shouldUseTrainedRarityStar(rarity, trainingStatus)) {
star = starList.trained;
} else {
star = starList.normal;
@ -50,8 +54,8 @@ export async function drawRarityInList({
const canvas = drawList({
key,
content: content,
textSize: 50,
spacing: 0,
textSize: BANGDREAM_RARITY_LIST_SPEC.list.textSize,
spacing: BANGDREAM_RARITY_LIST_SPEC.list.spacing,
});
return canvas;
}

View File

@ -0,0 +1,21 @@
import {
BANGDREAM_RARITY_LIST_SPEC,
shouldUseTrainedRarityStar,
} from '@/qqbot/plugins/bangDream/tsugu/render-blocks/list-rarity-spec';
describe('BangDream rarity list spec', () => {
it('keeps the historical rarity list text size and spacing stable', () => {
expect(BANGDREAM_RARITY_LIST_SPEC.list).toEqual({
spacing: 0,
textSize: 50,
});
});
it('keeps the trained star threshold stable', () => {
expect(BANGDREAM_RARITY_LIST_SPEC.trainedStar.minRarity).toBe(4);
expect(shouldUseTrainedRarityStar(3, true)).toBe(false);
expect(shouldUseTrainedRarityStar(4, true)).toBe(true);
expect(shouldUseTrainedRarityStar(5, true)).toBe(true);
expect(shouldUseTrainedRarityStar(4, false)).toBe(false);
});
});