From b9e952737523d0457a129108feda9cdcd20e2bcb Mon Sep 17 00:00:00 2001 From: walkpan Date: Wed, 4 Feb 2026 20:25:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E5=8A=A8=20getLevelReward?= =?UTF-8?q?Type=20=E5=87=BD=E6=95=B0=E8=87=B3=20CardSet=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将获取等级奖励类型的函数从 GameSet 模块移至更相关的 CardSet 模块,以提高代码的组织性和模块内聚性。 --- assets/script/game/common/config/CardSet.ts | 17 +++++++++++++++++ assets/script/game/common/config/GameSet.ts | 16 ---------------- assets/script/game/map/MissionComp.ts | 3 ++- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/assets/script/game/common/config/CardSet.ts b/assets/script/game/common/config/CardSet.ts index b4d858d9..4b26d70c 100644 --- a/assets/script/game/common/config/CardSet.ts +++ b/assets/script/game/common/config/CardSet.ts @@ -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显示和逻辑处理) */ diff --git a/assets/script/game/common/config/GameSet.ts b/assets/script/game/common/config/GameSet.ts index e235c4cf..a14d6e72 100644 --- a/assets/script/game/common/config/GameSet.ts +++ b/assets/script/game/common/config/GameSet.ts @@ -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, diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 7e7ee0bd..56d6ab4d 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -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;