fix: 修正任务奖励数据字段名并添加调试日志

将任务奖励数据结构中的 type 字段统一更名为 kind 以保持一致性
在 MissionCardComp 和 MissionGetsComp 中添加调试日志输出
This commit is contained in:
panw
2026-01-27 17:29:27 +08:00
parent b43a30a192
commit b79d8e1950
3 changed files with 2789 additions and 3025 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -274,7 +274,7 @@ export class MissionCardComp extends CCComp {
// 使用 CardSet 的 getCardOptions 获取卡牌
// 这里我们要获取 4 张卡牌
const options = getCardOptions(level, 4, [], forcedType);
console.log("[MissionCard]获取到的卡牌选项:", options);
// 更新卡片数据
if (options.length > 0) this.updateCardData(1, options[0]);
if (options.length > 1) this.updateCardData(2, options[1]);
@@ -475,7 +475,7 @@ export class MissionCardComp extends CCComp {
oops.message.dispatchEvent(GameEvent.UpdateMissionGet, {
uuid: selectedData.uuid,
icon: selectedData.icon,
type: selectedData.type
kind: selectedData.kind
});
this.close();

View File

@@ -12,7 +12,7 @@ const { ccclass, property } = _decorator;
@ccclass('MissionGetsCompComp')
@ecs.register('MissionGetsComp', false)
export class MissionGetsCompComp extends CCComp {
get_datas: { [key: number]: { num: number, node: Node, type?: number } } = {};
get_datas: { [key: number]: { num: number, node: Node, kind?: number } } = {};
get_nodes: Node[] = [];
// 图标图集缓存
private uiconsAtlas: SpriteAtlas | null = null;
@@ -44,20 +44,21 @@ export class MissionGetsCompComp extends CCComp {
private onUpdateMissionGet(event: string, args: any) {
if (!args || !args.uuid) return;
const { uuid, icon, type } = args;
this.addGet(uuid, icon, type);
const { uuid, icon, kind } = args;
this.addGet(uuid, icon, kind);
}
addGet(uuid: number, iconName?: string, type?: number) {
addGet(uuid: number, iconName?: string, kind?: number) {
console.log("[MissionGetsComp]添加获取到的物品:", uuid, iconName, kind);
if (this.get_datas[uuid]) {
this.get_datas[uuid].num++;
this.updateNodeNum(this.get_datas[uuid].node, this.get_datas[uuid].num);
} else {
this.load_hui(uuid, iconName || uuid.toString(), type);
this.load_hui(uuid, iconName || uuid.toString(), kind);
}
}
load_hui(uuid: number, iconName: string, type?: number){
load_hui(uuid: number, iconName: string, kind?: number){
var path = "game/gui/get";
var prefab: Prefab = oops.res.get(path, Prefab)!;
if (!prefab) {
@@ -69,7 +70,7 @@ export class MissionGetsCompComp extends CCComp {
this.node.addChild(node);
// 记录数据
this.get_datas[uuid] = { num: 1, node: node, type: type };
this.get_datas[uuid] = { num: 1, node: node, kind: kind };
this.get_nodes.push(node);
node.getChildByName("num").getComponent(Label).string = "1";
@@ -83,7 +84,7 @@ export class MissionGetsCompComp extends CCComp {
});
// 根据 kind 激活bg
let activeNodeName = "";
switch (type) {
switch (kind) {
case CardKind.Atk:
activeNodeName = "Atk";
break;