Files
pixelheros/assets/script/game/common/config/HighlightSet.ts
panw 1589851592 feat(i18n): 扩展翻译函数支持参数替换并更新中文文本
- 修改 I18nString 类以支持参数替换,将阈值等动态值插入翻译文本
- 更新多个配置文件中的翻译调用,传入相应的参数值
- 修正中文语言文件中的导航栏标签文本
2026-04-29 10:39:54 +08:00

152 lines
8.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @file HighlightSet.ts
* @description 亮点成就配置文件
*
* 定义所有亮点成就的等级、触发条件、加分以及称号描述。
* 每个亮点都包含5个递进等级奖励分随等级增加。
*/
import { oops } from "db://oops-framework/core/Oops"
class I18nString {
constructor(private key: string, private params?: any[]) {}
private getTranslated(): string {
let str = oops.language.getLangByID(this.key) || this.key;
if (this.params && this.params.length > 0) {
for (let i = 0; i < this.params.length; i++) {
str = str.replace(`{${i}}`, String(this.params[i]));
}
}
return str;
}
toString() { return this.getTranslated(); }
valueOf() { return this.getTranslated(); }
toJSON() { return this.getTranslated(); }
get length() { return this.toString().length; }
}
const t = (key: string, ...params: any[]) => new I18nString(key, params) as unknown as string;
export enum HighlightType {
CritMaster = "CritMaster", // 暴击大师
DeathExpert = "DeathExpert", // 送死达人
IronWall = "IronWall", // 铁壁铜墙
WindStorm = "WindStorm", // 风暴之王
OneHitKill = "OneHitKill", // 一击必杀
HealingLight = "HealingLight", // 治愈之光
PerfectClear = "PerfectClear", // 完美通关 (特殊,只有一档或布尔判定)
LuckyKing = "LuckyKing", // 欧皇附体
ThriftyPlayer = "ThriftyPlayer" // 节俭玩家
}
export interface HighlightLevel {
level: number; // 成就等级 (1-5)
threshold: number; // 达成阈值 (如暴击40次)
scoreBonus: number; // 额外加分
title: string; // 成就称号
desc: string; // 成就描述模板
}
export interface HighlightConfig {
type: HighlightType;
icon: string; // 显示前缀icon如 "🔥"
levels: HighlightLevel[];
}
export const HighlightSet: Record<HighlightType, HighlightConfig> = {
[HighlightType.CritMaster]: {
type: HighlightType.CritMaster,
icon: "🔥",
levels: [
{ level: 1, threshold: 20, scoreBonus: 50, title: t("hl_title_CritMaster_1"), desc: t("hl_desc_CritMaster", 20) },
{ level: 2, threshold: 40, scoreBonus: 100, title: t("hl_title_CritMaster_2"), desc: t("hl_desc_CritMaster", 40) },
{ level: 3, threshold: 60, scoreBonus: 150, title: t("hl_title_CritMaster_3"), desc: t("hl_desc_CritMaster", 60) },
{ level: 4, threshold: 80, scoreBonus: 200, title: t("hl_title_CritMaster_4"), desc: t("hl_desc_CritMaster", 80) },
{ level: 5, threshold: 100, scoreBonus: 300, title: t("hl_title_CritMaster_5"), desc: t("hl_desc_CritMaster", 100) },
]
},
[HighlightType.DeathExpert]: {
type: HighlightType.DeathExpert,
icon: "💀",
levels: [
{ level: 1, threshold: 15, scoreBonus: 50, title: t("hl_title_DeathExpert_1"), desc: t("hl_desc_DeathExpert", 15) },
{ level: 2, threshold: 25, scoreBonus: 100, title: t("hl_title_DeathExpert_2"), desc: t("hl_desc_DeathExpert", 25) },
{ level: 3, threshold: 40, scoreBonus: 150, title: t("hl_title_DeathExpert_3"), desc: t("hl_desc_DeathExpert", 40) },
{ level: 4, threshold: 60, scoreBonus: 200, title: t("hl_title_DeathExpert_4"), desc: t("hl_desc_DeathExpert", 60) },
{ level: 5, threshold: 80, scoreBonus: 300, title: t("hl_title_DeathExpert_5"), desc: t("hl_desc_DeathExpert", 80) },
]
},
[HighlightType.IronWall]: {
type: HighlightType.IronWall,
icon: "🛡️",
levels: [
{ level: 1, threshold: 15, scoreBonus: 50, title: t("hl_title_IronWall_1"), desc: t("hl_desc_IronWall", 15) },
{ level: 2, threshold: 30, scoreBonus: 100, title: t("hl_title_IronWall_2"), desc: t("hl_desc_IronWall", 30) },
{ level: 3, threshold: 50, scoreBonus: 150, title: t("hl_title_IronWall_3"), desc: t("hl_desc_IronWall", 50) },
{ level: 4, threshold: 70, scoreBonus: 200, title: t("hl_title_IronWall_4"), desc: t("hl_desc_IronWall", 70) },
{ level: 5, threshold: 100, scoreBonus: 300, title: t("hl_title_IronWall_5"), desc: t("hl_desc_IronWall", 100) },
]
},
[HighlightType.WindStorm]: {
type: HighlightType.WindStorm,
icon: "⚡",
levels: [
{ level: 1, threshold: 10, scoreBonus: 50, title: t("hl_title_WindStorm_1"), desc: t("hl_desc_WindStorm", 10) },
{ level: 2, threshold: 20, scoreBonus: 100, title: t("hl_title_WindStorm_2"), desc: t("hl_desc_WindStorm", 20) },
{ level: 3, threshold: 35, scoreBonus: 150, title: t("hl_title_WindStorm_3"), desc: t("hl_desc_WindStorm", 35) },
{ level: 4, threshold: 50, scoreBonus: 200, title: t("hl_title_WindStorm_4"), desc: t("hl_desc_WindStorm", 50) },
{ level: 5, threshold: 70, scoreBonus: 300, title: t("hl_title_WindStorm_5"), desc: t("hl_desc_WindStorm", 70) },
]
},
[HighlightType.OneHitKill]: {
type: HighlightType.OneHitKill,
icon: "🎯",
levels: [
{ level: 1, threshold: 100, scoreBonus: 50, title: t("hl_title_OneHitKill_1"), desc: t("hl_desc_OneHitKill", 100) },
{ level: 2, threshold: 200, scoreBonus: 100, title: t("hl_title_OneHitKill_2"), desc: t("hl_desc_OneHitKill", 200) },
{ level: 3, threshold: 400, scoreBonus: 150, title: t("hl_title_OneHitKill_3"), desc: t("hl_desc_OneHitKill", 400) },
{ level: 4, threshold: 800, scoreBonus: 200, title: t("hl_title_OneHitKill_4"), desc: t("hl_desc_OneHitKill", 800) },
{ level: 5, threshold: 1500, scoreBonus: 300, title: t("hl_title_OneHitKill_5"), desc: t("hl_desc_OneHitKill", 1500) },
]
},
[HighlightType.HealingLight]: {
type: HighlightType.HealingLight,
icon: "💊",
levels: [
{ level: 1, threshold: 200, scoreBonus: 50, title: t("hl_title_HealingLight_1"), desc: t("hl_desc_HealingLight", 200) },
{ level: 2, threshold: 500, scoreBonus: 100, title: t("hl_title_HealingLight_2"), desc: t("hl_desc_HealingLight", 500) },
{ level: 3, threshold: 1000, scoreBonus: 150, title: t("hl_title_HealingLight_3"), desc: t("hl_desc_HealingLight", 1000) },
{ level: 4, threshold: 2000, scoreBonus: 200, title: t("hl_title_HealingLight_4"), desc: t("hl_desc_HealingLight", 2000) },
{ level: 5, threshold: 4000, scoreBonus: 300, title: t("hl_title_HealingLight_5"), desc: t("hl_desc_HealingLight", 4000) },
]
},
[HighlightType.PerfectClear]: {
type: HighlightType.PerfectClear,
icon: "🏆",
levels: [
{ level: 1, threshold: 1, scoreBonus: 500, title: t("hl_title_PerfectClear_1"), desc: t("hl_desc_PerfectClear") },
]
},
[HighlightType.LuckyKing]: {
type: HighlightType.LuckyKing,
icon: "🎲",
levels: [
{ level: 1, threshold: 0.6, scoreBonus: 50, title: t("hl_title_LuckyKing_1"), desc: t("hl_desc_LuckyKing", 60) },
{ level: 2, threshold: 0.7, scoreBonus: 100, title: t("hl_title_LuckyKing_2"), desc: t("hl_desc_LuckyKing", 70) },
{ level: 3, threshold: 0.8, scoreBonus: 150, title: t("hl_title_LuckyKing_3"), desc: t("hl_desc_LuckyKing", 80) },
{ level: 4, threshold: 0.9, scoreBonus: 200, title: t("hl_title_LuckyKing_4"), desc: t("hl_desc_LuckyKing", 90) },
{ level: 5, threshold: 1.0, scoreBonus: 300, title: t("hl_title_LuckyKing_5"), desc: t("hl_desc_LuckyKing", 100) },
]
},
[HighlightType.ThriftyPlayer]: {
type: HighlightType.ThriftyPlayer,
icon: "💰",
levels: [
{ level: 1, threshold: 0.75, scoreBonus: 50, title: t("hl_title_ThriftyPlayer_1"), desc: t("hl_desc_ThriftyPlayer", 75) },
{ level: 2, threshold: 0.85, scoreBonus: 100, title: t("hl_title_ThriftyPlayer_2"), desc: t("hl_desc_ThriftyPlayer", 85) },
{ level: 3, threshold: 0.95, scoreBonus: 150, title: t("hl_title_ThriftyPlayer_3"), desc: t("hl_desc_ThriftyPlayer", 95) },
{ level: 4, threshold: 0.98, scoreBonus: 200, title: t("hl_title_ThriftyPlayer_4"), desc: t("hl_desc_ThriftyPlayer", 98) },
{ level: 5, threshold: 1.00, scoreBonus: 300, title: t("hl_title_ThriftyPlayer_5"), desc: t("hl_desc_ThriftyPlayer", 100) },
]
}
};