refactor(卡牌系统): 清理废弃的卡池等级相关代码并优化抽卡接口
1. 移除了CardSkillType枚举、废弃的CardLV枚举和相关常量定义 2. 删除了已废弃的getCardPoolByLv、getCardsByLv等兼容旧接口 3. 简化drawCardsByRule接口,移除不再生效的历史参数 4. 调整MissionCardComp中调用drawCardsByRule的传参方式 5. 格式化VictoryComp中的代码格式,统一代码风格
This commit is contained in:
@@ -37,16 +37,6 @@ export enum CKind {
|
|||||||
Potion = 4, //药水
|
Potion = 4, //药水
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 技能卡触发类型 */
|
|
||||||
export enum CardSkillType {
|
|
||||||
Interval = 1, // 间隔定时触发 (战斗中每隔N秒执行)
|
|
||||||
Field = 2, // 驻场技能 (被动光环)
|
|
||||||
BattleStart = 3, // 战斗开始时触发一次
|
|
||||||
BattleEnd = 4, // 战斗结束时触发一次
|
|
||||||
HeroDead = 5, // 场上己方英雄死亡时触发
|
|
||||||
HeroCall = 6, // 场上己方英雄召唤上场时触发
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 卡牌技能触发类型
|
* 卡牌技能触发类型
|
||||||
* - 命名对齐英雄侧 SkillTriggerType,便于跨模块认知统一
|
* - 命名对齐英雄侧 SkillTriggerType,便于跨模块认知统一
|
||||||
@@ -62,19 +52,6 @@ export enum CardTriggerType {
|
|||||||
HeroCall = 7, // 英雄上场时触发(主角召唤 + 技能召唤 + 复活)
|
HeroCall = 7, // 英雄上场时触发(主角召唤 + 技能召唤 + 复活)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 卡池等级占位枚举(已废弃分层语义)。
|
|
||||||
* 新机制下所有英雄卡均属 LV1,不再使用卡池升级。
|
|
||||||
* 保留枚举仅为兼容历史代码引用。
|
|
||||||
*/
|
|
||||||
export enum CardLV {
|
|
||||||
LV1 = 1,
|
|
||||||
LV2 = 2,
|
|
||||||
LV3 = 3,
|
|
||||||
LV4 = 4,
|
|
||||||
LV5 = 5,
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 通用卡牌配置 */
|
/** 通用卡牌配置 */
|
||||||
export interface CardConfig {
|
export interface CardConfig {
|
||||||
uuid: number
|
uuid: number
|
||||||
@@ -116,24 +93,6 @@ export interface CardConfig {
|
|||||||
target_hero_eid?: number;
|
target_hero_eid?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 升级卡折扣表(已废弃,保留以兼容历史引用) */
|
|
||||||
export const CardsUpSet: Record<number, number> = {
|
|
||||||
1: 50,
|
|
||||||
2: 100,
|
|
||||||
3: 150,
|
|
||||||
4: 200,
|
|
||||||
5: 250,
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 卡池升级每波减免金额(已废弃,保留以兼容历史引用) */
|
|
||||||
export const CARD_POOL_UPGRADE_DISCOUNT_PER_WAVE = 10
|
|
||||||
/** 卡池默认初始等级(已废弃,所有卡牌统一 LV1) */
|
|
||||||
export const CARD_POOL_INIT_LEVEL = CardLV.LV1
|
|
||||||
/** 卡池等级上限(已废弃,所有卡牌统一 LV1) */
|
|
||||||
export const CARD_POOL_MAX_LEVEL = CardLV.LV1
|
|
||||||
/** 英雄最高等级限制(已废弃,统一由 FightSet.HERO_MAX_LV 控制) */
|
|
||||||
export const CARD_HERO_MAX_LEVEL = 1
|
|
||||||
|
|
||||||
/** 基础卡池(英雄、技能、功能) */
|
/** 基础卡池(英雄、技能、功能) */
|
||||||
export const CardPoolList: CardConfig[] = [];
|
export const CardPoolList: CardConfig[] = [];
|
||||||
|
|
||||||
@@ -211,11 +170,6 @@ export const SpecialRefreshCardList: Record<number, SpecialRefreshCardConfig> =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** 规范等级到合法区间(保留以兼容历史调用,新机制下统一返回 LV1) */
|
|
||||||
const clampCardLv = (lv: number): CardLV => {
|
|
||||||
return CardLV.LV1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============ 装备相关语义已迁移至 EquipSet.ts ============
|
// ============ 装备相关语义已迁移至 EquipSet.ts ============
|
||||||
// 装备卡池(EquipPoolList)独立管理,不再混入 CardPoolList
|
// 装备卡池(EquipPoolList)独立管理,不再混入 CardPoolList
|
||||||
|
|
||||||
@@ -248,62 +202,27 @@ const pickCards = (cards: CardConfig[], count: number, unique: boolean = false):
|
|||||||
return selected
|
return selected
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取基础卡池(已废弃 lv 参数,新机制下返回完整卡池)。
|
|
||||||
* @param lv 历史遗留参数,不再生效
|
|
||||||
* @param onlyCurrentLv 历史遗留参数,不再生效
|
|
||||||
*/
|
|
||||||
export const getCardPoolByLv = (lv: number, onlyCurrentLv: boolean = false): CardConfig[] => {
|
|
||||||
return CardPoolList;
|
|
||||||
}
|
|
||||||
|
|
||||||
const normalizeTypeFilter = (type: CardType | CardType[]): Set<CardType> => {
|
const normalizeTypeFilter = (type: CardType | CardType[]): Set<CardType> => {
|
||||||
const list = Array.isArray(type) ? type : [type]
|
const list = Array.isArray(type) ? type : [type]
|
||||||
return new Set<CardType>(list)
|
return new Set<CardType>(list)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 常规发牌:前 3 英雄 + 后 1 其他;支持按类型过滤。
|
* 通用按规则抽卡。
|
||||||
* @param lv 历史遗留参数,不再生效
|
* @param options 抽卡选项
|
||||||
* @param type 限定卡牌类型
|
|
||||||
* @param onlyCurrentLv 历史遗留参数,不再生效
|
|
||||||
*/
|
|
||||||
export const getCardsByLv = (
|
|
||||||
lv: number,
|
|
||||||
type?: CardType | CardType[],
|
|
||||||
onlyCurrentLv: boolean = false
|
|
||||||
): CardConfig[] => {
|
|
||||||
const pool = getCardPoolByLv(lv, onlyCurrentLv)
|
|
||||||
if (type !== undefined) {
|
|
||||||
const typeSet = normalizeTypeFilter(type)
|
|
||||||
const filteredPool = pool.filter(card => typeSet.has(card.type))
|
|
||||||
return pickCards(filteredPool, 4)
|
|
||||||
}
|
|
||||||
const heroPool = pool.filter(card => card.type === CardType.Hero)
|
|
||||||
const otherPool = pool.filter(card => card.type !== CardType.Hero)
|
|
||||||
const heroes = pickCards(heroPool, 3)
|
|
||||||
const others = pickCards(otherPool, 1)
|
|
||||||
return [...heroes, ...others]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用按规则抽卡(已废弃 lv/targetPoolLv/onlyCurrentLv 参数,仅为兼容保留)。
|
|
||||||
*/
|
*/
|
||||||
export const drawCardsByRule = (
|
export const drawCardsByRule = (
|
||||||
lv: number,
|
|
||||||
options: {
|
options: {
|
||||||
count?: number
|
count?: number
|
||||||
onlyCurrentLv?: boolean
|
|
||||||
type?: CardType | CardType[]
|
type?: CardType | CardType[]
|
||||||
heroType?: HType
|
heroType?: HType
|
||||||
heroLv?: number
|
heroLv?: number
|
||||||
targetPoolLv?: number
|
|
||||||
wave?: number
|
wave?: number
|
||||||
unique?: boolean
|
unique?: boolean
|
||||||
} = {}
|
} = {}
|
||||||
): CardConfig[] => {
|
): CardConfig[] => {
|
||||||
const count = Math.max(0, Math.floor(options.count ?? 4))
|
const count = Math.max(0, Math.floor(options.count ?? 4))
|
||||||
let pool = getCardPoolByLv(lv, options.onlyCurrentLv ?? false)
|
let pool = CardPoolList
|
||||||
if (options.type !== undefined) {
|
if (options.type !== undefined) {
|
||||||
const typeSet = normalizeTypeFilter(options.type)
|
const typeSet = normalizeTypeFilter(options.type)
|
||||||
pool = pool.filter(card => typeSet.has(card.type))
|
pool = pool.filter(card => typeSet.has(card.type))
|
||||||
|
|||||||
@@ -1473,7 +1473,7 @@ export class MissionCardComp extends CCComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private tryRefreshHeroCards(heroType?: HType): boolean {
|
private tryRefreshHeroCards(heroType?: HType): boolean {
|
||||||
const cards = drawCardsByRule(1, {
|
const cards = drawCardsByRule({
|
||||||
count: 3,
|
count: 3,
|
||||||
type: CardType.Hero,
|
type: CardType.Hero,
|
||||||
heroType,
|
heroType,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
|
|
||||||
*/
|
*/
|
||||||
import { _decorator, instantiate, Label ,Prefab,Node, Sprite, Animation, AnimationClip, resources, UITransform, Widget, ProgressBar, Tween, NodeEventType } from "cc";
|
import { _decorator, instantiate, Label, Prefab, Node, Sprite, Animation, AnimationClip, resources, UITransform, Widget, ProgressBar, Tween, NodeEventType } from "cc";
|
||||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
@@ -13,7 +13,7 @@ import { GameEvent } from "../common/config/GameEvent";
|
|||||||
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
|
||||||
import { FacSet } from "../common/config/GameSet";
|
import { FacSet } from "../common/config/GameSet";
|
||||||
import { HeroInfo } from "../common/config/heroSet";
|
import { HeroInfo } from "../common/config/heroSet";
|
||||||
import { CKind, CardType, CardLV, CardConfig } from "../common/config/CardSet";
|
import { CKind, CardType, CardConfig } from "../common/config/CardSet";
|
||||||
import { CardComp } from "./CardComp";
|
import { CardComp } from "./CardComp";
|
||||||
import { HighlightSet, HighlightType, HighlightLevel } from "../common/config/HighlightSet";
|
import { HighlightSet, HighlightType, HighlightLevel } from "../common/config/HighlightSet";
|
||||||
import { LangPrefix, lang, langf } from "../common/LangUtil";
|
import { LangPrefix, lang, langf } from "../common/LangUtil";
|
||||||
@@ -33,7 +33,7 @@ const { ccclass, property } = _decorator;
|
|||||||
export class VictoryComp extends CCComp {
|
export class VictoryComp extends CCComp {
|
||||||
|
|
||||||
@property(Node)
|
@property(Node)
|
||||||
mvp_node=null!
|
mvp_node = null!
|
||||||
|
|
||||||
// ======================== 结算 UI 绑定 ========================
|
// ======================== 结算 UI 绑定 ========================
|
||||||
@property({ type: Label, tooltip: "总分文本" })
|
@property({ type: Label, tooltip: "总分文本" })
|
||||||
@@ -63,18 +63,18 @@ export class VictoryComp extends CCComp {
|
|||||||
/** 调试日志开关 */
|
/** 调试日志开关 */
|
||||||
debugMode: boolean = false;
|
debugMode: boolean = false;
|
||||||
/** 奖励等级(预留) */
|
/** 奖励等级(预留) */
|
||||||
reward_lv:number=1
|
reward_lv: number = 1
|
||||||
/** 奖励数量(预留) */
|
/** 奖励数量(预留) */
|
||||||
reward_num:number=2
|
reward_num: number = 2
|
||||||
/** 掉落奖励列表 */
|
/** 掉落奖励列表 */
|
||||||
rewards:any[]=[]
|
rewards: any[] = []
|
||||||
/** 累计游戏数据(经验 / 金币 / 钻石) */
|
/** 累计游戏数据(经验 / 金币 / 钻石) */
|
||||||
game_data:any={
|
game_data: any = {
|
||||||
exp:0,
|
exp: 0,
|
||||||
gold:0,
|
gold: 0,
|
||||||
diamond:0
|
diamond: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ======================== 复活相关 ========================
|
// ======================== 复活相关 ========================
|
||||||
|
|
||||||
/** 是否可以复活(由 MissionComp 传入,取决于剩余复活次数) */
|
/** 是否可以复活(由 MissionComp 传入,取决于剩余复活次数) */
|
||||||
@@ -82,7 +82,7 @@ export class VictoryComp extends CCComp {
|
|||||||
|
|
||||||
/** 加载时隐藏 loading 遮罩 */
|
/** 加载时隐藏 loading 遮罩 */
|
||||||
protected onLoad(): void {
|
protected onLoad(): void {
|
||||||
this.node.getChildByName("loading").active=false
|
this.node.getChildByName("loading").active = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,18 +94,18 @@ export class VictoryComp extends CCComp {
|
|||||||
* @param args.can_revive 是否可复活
|
* @param args.can_revive 是否可复活
|
||||||
*/
|
*/
|
||||||
onAdded(args: any) {
|
onAdded(args: any) {
|
||||||
this.node.getChildByName("loading").active=false
|
this.node.getChildByName("loading").active = false
|
||||||
mLogger.log(this.debugMode, 'VictoryComp', "[VictoryComp] onAdded",args)
|
mLogger.log(this.debugMode, 'VictoryComp', "[VictoryComp] onAdded", args)
|
||||||
if(args.game_data){
|
if (args.game_data) {
|
||||||
this.game_data=args.game_data
|
this.game_data = args.game_data
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据是否可复活决定按钮显示
|
// 根据是否可复活决定按钮显示
|
||||||
this.node.getChildByName("btns").getChildByName("next").active=!args.can_revive
|
this.node.getChildByName("btns").getChildByName("next").active = !args.can_revive
|
||||||
|
|
||||||
// 计算总分
|
// 计算总分
|
||||||
this.calculateTotalScore();
|
this.calculateTotalScore();
|
||||||
|
|
||||||
// 渲染分数UI和亮点标签
|
// 渲染分数UI和亮点标签
|
||||||
this.renderScores();
|
this.renderScores();
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ export class VictoryComp extends CCComp {
|
|||||||
private getHighestHighlightLevel(type: HighlightType, value: number): HighlightLevel | null {
|
private getHighestHighlightLevel(type: HighlightType, value: number): HighlightLevel | null {
|
||||||
const config = HighlightSet[type];
|
const config = HighlightSet[type];
|
||||||
if (!config || !config.levels) return null;
|
if (!config || !config.levels) return null;
|
||||||
|
|
||||||
let highest: HighlightLevel | null = null;
|
let highest: HighlightLevel | null = null;
|
||||||
for (const levelConfig of config.levels) {
|
for (const levelConfig of config.levels) {
|
||||||
if (value >= levelConfig.threshold) {
|
if (value >= levelConfig.threshold) {
|
||||||
@@ -227,7 +227,7 @@ export class VictoryComp extends CCComp {
|
|||||||
*/
|
*/
|
||||||
private getAchievedHighlights(s: any): { type: HighlightType, config: HighlightLevel, value: number }[] {
|
private getAchievedHighlights(s: any): { type: HighlightType, config: HighlightLevel, value: number }[] {
|
||||||
const achieved: { type: HighlightType, config: HighlightLevel, value: number }[] = [];
|
const achieved: { type: HighlightType, config: HighlightLevel, value: number }[] = [];
|
||||||
|
|
||||||
// 计算辅助比例
|
// 计算辅助比例
|
||||||
const refreshRatio = s.refresh_count > 0 ? (s.refresh_hit_count / s.refresh_count) : 0;
|
const refreshRatio = s.refresh_count > 0 ? (s.refresh_hit_count / s.refresh_count) : 0;
|
||||||
const goldRatio = s.gold_earned > 0 ? (s.gold_spent / s.gold_earned) : 0;
|
const goldRatio = s.gold_earned > 0 ? (s.gold_spent / s.gold_earned) : 0;
|
||||||
@@ -251,7 +251,7 @@ export class VictoryComp extends CCComp {
|
|||||||
achieved.push({ type: item.type, config: levelConfig, value: item.value });
|
achieved.push({ type: item.type, config: levelConfig, value: item.value });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return achieved;
|
return achieved;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ export class VictoryComp extends CCComp {
|
|||||||
*/
|
*/
|
||||||
private calculateTotalScore() {
|
private calculateTotalScore() {
|
||||||
const s = smc.vmdata.scores;
|
const s = smc.vmdata.scores;
|
||||||
|
|
||||||
// 1. 战绩分:衡量生存能力——活几回合、赢几场。
|
// 1. 战绩分:衡量生存能力——活几回合、赢几场。
|
||||||
s.score_combat = (s.wave_win_count * 100)
|
s.score_combat = (s.wave_win_count * 100)
|
||||||
- (s.wave_remain_monsters * 15)
|
- (s.wave_remain_monsters * 15)
|
||||||
@@ -289,7 +289,7 @@ export class VictoryComp extends CCComp {
|
|||||||
// 6. 亮点成就额外加分 (按等级叠加)
|
// 6. 亮点成就额外加分 (按等级叠加)
|
||||||
const achieved = this.getAchievedHighlights(s);
|
const achieved = this.getAchievedHighlights(s);
|
||||||
s.achieved_highlights = achieved; // 记录已达成的亮点信息
|
s.achieved_highlights = achieved; // 记录已达成的亮点信息
|
||||||
|
|
||||||
let highlightBonus = 0;
|
let highlightBonus = 0;
|
||||||
for (const item of achieved) {
|
for (const item of achieved) {
|
||||||
highlightBonus += item.config.scoreBonus;
|
highlightBonus += item.config.scoreBonus;
|
||||||
@@ -297,7 +297,7 @@ export class VictoryComp extends CCComp {
|
|||||||
|
|
||||||
// 取整并存储当前局分数
|
// 取整并存储当前局分数
|
||||||
s.score = Math.floor(s.score_combat + s.score_output + s.score_defense + s.score_build + s.score_efficiency + highlightBonus);
|
s.score = Math.floor(s.score_combat + s.score_output + s.score_defense + s.score_build + s.score_efficiency + highlightBonus);
|
||||||
|
|
||||||
// 判定是否打破历史最高分记录
|
// 判定是否打破历史最高分记录
|
||||||
let isNewRecord = false;
|
let isNewRecord = false;
|
||||||
if (s.score > smc.data.score) {
|
if (s.score > smc.data.score) {
|
||||||
@@ -308,7 +308,7 @@ export class VictoryComp extends CCComp {
|
|||||||
smc.updateCloudData();
|
smc.updateCloudData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 借用 scores 对象传递新记录标记,供 UI 渲染使用
|
// 借用 scores 对象传递新记录标记,供 UI 渲染使用
|
||||||
(s as any).isNewRecord = isNewRecord;
|
(s as any).isNewRecord = isNewRecord;
|
||||||
|
|
||||||
@@ -330,11 +330,11 @@ export class VictoryComp extends CCComp {
|
|||||||
*/
|
*/
|
||||||
private renderScores() {
|
private renderScores() {
|
||||||
const s = smc.vmdata.scores;
|
const s = smc.vmdata.scores;
|
||||||
|
|
||||||
// 渲染总分
|
// 渲染总分
|
||||||
if (this.total_score_label) {
|
if (this.total_score_label) {
|
||||||
this.total_score_label.string = `${s.score}`;
|
this.total_score_label.string = `${s.score}`;
|
||||||
|
|
||||||
// 判定是否是新记录,如果是则激活 new 节点
|
// 判定是否是新记录,如果是则激活 new 节点
|
||||||
const isNewRecord = (s as any).isNewRecord === true;
|
const isNewRecord = (s as any).isNewRecord === true;
|
||||||
const newNode = this.total_score_label.node.getChildByName("new");
|
const newNode = this.total_score_label.node.getChildByName("new");
|
||||||
@@ -348,13 +348,13 @@ export class VictoryComp extends CCComp {
|
|||||||
if (!node) return;
|
if (!node) return;
|
||||||
const lab = node.getChildByName("score_label")?.getComponent(Label);
|
const lab = node.getChildByName("score_label")?.getComponent(Label);
|
||||||
if (lab) lab.string = `${score}`;
|
if (lab) lab.string = `${score}`;
|
||||||
|
|
||||||
const bar = node.getChildByName("progress_bar")?.getComponent(ProgressBar);
|
const bar = node.getChildByName("progress_bar")?.getComponent(ProgressBar);
|
||||||
if (bar) {
|
if (bar) {
|
||||||
// 根据该维度得分占“预期满分”的比例设置进度条(fillRange)
|
// 根据该维度得分占“预期满分”的比例设置进度条(fillRange)
|
||||||
bar.progress = Math.min(1, Math.max(0, score / maxScore));
|
bar.progress = Math.min(1, Math.max(0, score / maxScore));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: 进度条的最大值可按设计期望自行调整,目前为占位预估值
|
// TODO: 进度条的最大值可按设计期望自行调整,目前为占位预估值
|
||||||
// renderDim(this.combat_node, s.score_combat, 3000);
|
// renderDim(this.combat_node, s.score_combat, 3000);
|
||||||
@@ -372,21 +372,21 @@ export class VictoryComp extends CCComp {
|
|||||||
*/
|
*/
|
||||||
private renderHighlights() {
|
private renderHighlights() {
|
||||||
if (!this.highlights_container || !this.highlight_prefab) return;
|
if (!this.highlights_container || !this.highlight_prefab) return;
|
||||||
|
|
||||||
// 先清空原有的标签
|
// 先清空原有的标签
|
||||||
this.highlights_container.removeAllChildren();
|
this.highlights_container.removeAllChildren();
|
||||||
|
|
||||||
const s = smc.vmdata.scores;
|
const s = smc.vmdata.scores;
|
||||||
// 获取所有已达成的亮点(包含对应等级的信息)
|
// 获取所有已达成的亮点(包含对应等级的信息)
|
||||||
const achievedList = s.achieved_highlights || [];
|
const achievedList = s.achieved_highlights || [];
|
||||||
|
|
||||||
// 最多显示前3个亮点(如有优先级需求,可在截取前对 achievedList 进行排序)
|
// 最多显示前3个亮点(如有优先级需求,可在截取前对 achievedList 进行排序)
|
||||||
const displayTags = achievedList.slice(0, 3);
|
const displayTags = achievedList.slice(0, 3);
|
||||||
|
|
||||||
displayTags.forEach(item => {
|
displayTags.forEach(item => {
|
||||||
const tagNode = instantiate(this.highlight_prefab);
|
const tagNode = instantiate(this.highlight_prefab);
|
||||||
const lab = tagNode.getComponent(Label) || tagNode.getChildByName("label")?.getComponent(Label);
|
const lab = tagNode.getComponent(Label) || tagNode.getChildByName("label")?.getComponent(Label);
|
||||||
|
|
||||||
if (lab) {
|
if (lab) {
|
||||||
const typeConfig = HighlightSet[item.type];
|
const typeConfig = HighlightSet[item.type];
|
||||||
const levelConfig = item.config;
|
const levelConfig = item.config;
|
||||||
@@ -404,25 +404,25 @@ export class VictoryComp extends CCComp {
|
|||||||
// ======================== 操作入口 ========================
|
// ======================== 操作入口 ========================
|
||||||
|
|
||||||
/** 退出战斗:清理数据 → 触发任务结束 → 关闭弹窗 */
|
/** 退出战斗:清理数据 → 触发任务结束 → 关闭弹窗 */
|
||||||
victory_end(){
|
victory_end() {
|
||||||
this.clear_data()
|
this.clear_data()
|
||||||
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
||||||
oops.gui.removeByNode(this.node)
|
oops.gui.removeByNode(this.node)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 清理运行时数据:解除暂停标志 */
|
/** 清理运行时数据:解除暂停标志 */
|
||||||
clear_data(){
|
clear_data() {
|
||||||
smc.mission.pause=false
|
smc.mission.pause = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 看广告双倍奖励(预留) */
|
/** 看广告双倍奖励(预留) */
|
||||||
watch_ad(){
|
watch_ad() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 双倍奖励发放(预留) */
|
/** 双倍奖励发放(预留) */
|
||||||
double_reward(){
|
double_reward() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -432,20 +432,20 @@ export class VictoryComp extends CCComp {
|
|||||||
* 3. 显示 loading 遮罩,延迟 0.5 秒后触发 MissionStart。
|
* 3. 显示 loading 遮罩,延迟 0.5 秒后触发 MissionStart。
|
||||||
* 4. 关闭弹窗。
|
* 4. 关闭弹窗。
|
||||||
*/
|
*/
|
||||||
restart(){
|
restart() {
|
||||||
this.clear_data()
|
this.clear_data()
|
||||||
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
||||||
this.node.getChildByName("loading").active=true
|
this.node.getChildByName("loading").active = true
|
||||||
this.scheduleOnce(()=>{
|
this.scheduleOnce(() => {
|
||||||
oops.gui.open(UIID.Mission)
|
oops.gui.open(UIID.Mission)
|
||||||
this.node.getChildByName("loading").active=false
|
this.node.getChildByName("loading").active = false
|
||||||
oops.gui.removeByNode(this.node)
|
oops.gui.removeByNode(this.node)
|
||||||
},0.5)
|
}, 0.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 物品展示回调(预留) */
|
/** 物品展示回调(预留) */
|
||||||
item_show(e:any,val:any){
|
item_show(e: any, val: any) {
|
||||||
mLogger.log(this.debugMode, 'VictoryComp', "item_show",val)
|
mLogger.log(this.debugMode, 'VictoryComp', "item_show", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onDestroy(): void {
|
protected onDestroy(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user