refactor: 移动 getLevelRewardType 函数至 CardSet 模块

将获取等级奖励类型的函数从 GameSet 模块移至更相关的 CardSet 模块,以提高代码的组织性和模块内聚性。
This commit is contained in:
walkpan
2026-02-04 20:25:24 +08:00
parent 82f7c3085b
commit b9e9527375
3 changed files with 19 additions and 17 deletions

View File

@@ -4,6 +4,23 @@ import { SkillSet, SkillConfig, CanSelectSkills } from "./SkillSet";
import { HeroInfo, heroInfo, CanSelectHeros } from "./heroSet";
import { CardType, CardKind } from "./GameSet";
/**
* 获取等级对应的奖励类型
* @param level 当前等级
* @returns 奖励类型 CardType
*/
export function getLevelRewardType(level: number): CardType {
if (level === 1) {
return CardType.Skill;
} else if (level >= 2 && level <= 5) {
return CardType.Talent;
} else if (level === 6) {
return CardType.Partner;
} else {
return CardType.Potion; // 以后暂时都是物品
}
}
/**
* 统一卡牌信息接口 (用于UI显示和逻辑处理)
*/

View File

@@ -41,22 +41,6 @@ export enum CardKind {
Partner = 8,
}
/**
* 获取等级对应的奖励类型
* @param level 当前等级
* @returns 奖励类型 CardType
*/
export function getLevelRewardType(level: number): CardType {
if (level === 1) {
return CardType.Skill;
} else if (level >= 2 && level <= 5) {
return CardType.Talent;
} else if (level === 6) {
return CardType.Partner;
} else {
return CardType.Potion; // 以后暂时都是物品
}
}
export enum FacSet {
HERO=0,

View File

@@ -9,8 +9,9 @@ import { GameEvent } from "../common/config/GameEvent";
import { HeroViewComp } from "../hero/HeroViewComp";
import { UIID } from "../common/config/GameUIConfig";
import { SkillView } from "../skill/SkillView";
import { FightSet, getLevelRewardType, CardType, FacSet } from "../common/config/GameSet";
import { FightSet, CardType, FacSet } from "../common/config/GameSet";
import { mLogger } from "../common/Logger";
import { getLevelRewardType } from "../common/config/CardSet";
const { ccclass, property } = _decorator;