refactor: 移动 getLevelRewardType 函数至 CardSet 模块
将获取等级奖励类型的函数从 GameSet 模块移至更相关的 CardSet 模块,以提高代码的组织性和模块内聚性。
This commit is contained in:
@@ -4,6 +4,23 @@ import { SkillSet, SkillConfig, CanSelectSkills } from "./SkillSet";
|
|||||||
import { HeroInfo, heroInfo, CanSelectHeros } from "./heroSet";
|
import { HeroInfo, heroInfo, CanSelectHeros } from "./heroSet";
|
||||||
import { CardType, CardKind } from "./GameSet";
|
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显示和逻辑处理)
|
* 统一卡牌信息接口 (用于UI显示和逻辑处理)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -41,22 +41,6 @@ export enum CardKind {
|
|||||||
Partner = 8,
|
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 {
|
export enum FacSet {
|
||||||
HERO=0,
|
HERO=0,
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ import { GameEvent } from "../common/config/GameEvent";
|
|||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
import { UIID } from "../common/config/GameUIConfig";
|
import { UIID } from "../common/config/GameUIConfig";
|
||||||
import { SkillView } from "../skill/SkillView";
|
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 { mLogger } from "../common/Logger";
|
||||||
|
import { getLevelRewardType } from "../common/config/CardSet";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user