You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.0 KiB
27 lines
1.0 KiB
import { LoadPriority } from './LoadPolicy';
|
|
|
|
/** 预加载规则:when 信号 → load 资源包/bundle */
|
|
export interface PreloadRule {
|
|
when: string;
|
|
load: string[];
|
|
priority: LoadPriority;
|
|
}
|
|
|
|
export const PRELOAD_RULES: PreloadRule[] = [
|
|
{ when: 'tabIntent:Home', load: ['bundle:home', 'ui:101'], priority: 'silent' },
|
|
{ when: 'tabIntent:Weapon', load: ['bundle:shenjiang', 'bundle:icons'], priority: 'silent' },
|
|
{ when: 'panelOpen:Weapon', load: ['bundle:battleHero'], priority: 'silent' },
|
|
{ when: 'idleOnHome:5s', load: ['bundle:rank', 'bundle:shenjiang', 'bundle:popBattle'], priority: 'silent' },
|
|
];
|
|
|
|
export function parseBattleScopedToken(token: string): { levelId?: number } {
|
|
if (token === 'currentChapter') {
|
|
return { levelId: gg.game?.CurentSelectLevelId ?? gg.data?.doc?.rankId ?? 1 };
|
|
}
|
|
if (token === 'selectedChapter') {
|
|
return { levelId: gg.game?.CurentSelectLevelId ?? 1 };
|
|
}
|
|
const m = /^chapter:(\d+)$/.exec(token);
|
|
if (m) return { levelId: Number(m[1]) };
|
|
return {};
|
|
}
|
|
|