refactor(config): 将CardKind枚举移动到GameSet并更新相关引用
重构代码结构,将CardKind枚举从CardSet.ts移动到GameSet.ts以集中管理游戏配置枚举 更新MissionCardComp.ts中的卡片类型显示逻辑,支持根据CardKind动态显示对应节点 调整card.prefab的UI元素位置和尺寸,优化卡片显示效果
This commit is contained in:
@@ -381,7 +381,7 @@
|
|||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@e556e",
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@75b82",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
@@ -396,7 +396,10 @@
|
|||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": true,
|
||||||
"_useGrayscale": false,
|
"_useGrayscale": false,
|
||||||
"_atlas": null,
|
"_atlas": {
|
||||||
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a",
|
||||||
|
"__expectedType__": "cc.SpriteAtlas"
|
||||||
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -461,7 +464,7 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 19
|
"__id__": 19
|
||||||
@@ -636,7 +639,7 @@
|
|||||||
"__id__": 1
|
"__id__": 1
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 27
|
"__id__": 27
|
||||||
@@ -731,7 +734,7 @@
|
|||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@5ab11",
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@21123",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
@@ -909,7 +912,7 @@
|
|||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@48c4e",
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@75b82",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
@@ -1087,7 +1090,7 @@
|
|||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@ec412",
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@21123",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
@@ -1102,7 +1105,10 @@
|
|||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": true,
|
||||||
"_useGrayscale": false,
|
"_useGrayscale": false,
|
||||||
"_atlas": null,
|
"_atlas": {
|
||||||
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a",
|
||||||
|
"__expectedType__": "cc.SpriteAtlas"
|
||||||
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1437,7 +1443,7 @@
|
|||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@abf8a",
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@21123",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
@@ -1925,7 +1931,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 1.625,
|
"x": 1.625,
|
||||||
"y": -52.417500000000004,
|
"y": -60,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -2019,7 +2025,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 141.75,
|
"width": 141.75,
|
||||||
"height": 95.16499999999999
|
"height": 80
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -2057,7 +2063,7 @@
|
|||||||
"_string": "这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍",
|
"_string": "这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍这里时介绍",
|
||||||
"_horizontalAlign": 1,
|
"_horizontalAlign": 1,
|
||||||
"_verticalAlign": 1,
|
"_verticalAlign": 1,
|
||||||
"_actualFontSize": 13,
|
"_actualFontSize": 11,
|
||||||
"_fontSize": 20,
|
"_fontSize": 20,
|
||||||
"_fontFamily": "Arial",
|
"_fontFamily": "Arial",
|
||||||
"_lineHeight": 28,
|
"_lineHeight": 28,
|
||||||
@@ -2164,7 +2170,7 @@
|
|||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 151.75,
|
"width": 151.75,
|
||||||
"height": 105.16499999999999
|
"height": 90
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
@@ -2238,7 +2244,7 @@
|
|||||||
"_target": null,
|
"_target": null,
|
||||||
"_left": 0.05,
|
"_left": 0.05,
|
||||||
"_right": 5,
|
"_right": 5,
|
||||||
"_top": 119.83500000000001,
|
"_top": 135,
|
||||||
"_bottom": 15,
|
"_bottom": 15,
|
||||||
"_horizontalCenter": 0,
|
"_horizontalCenter": 0,
|
||||||
"_verticalCenter": 0,
|
"_verticalCenter": 0,
|
||||||
@@ -2746,7 +2752,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 6,
|
"y": 1.502,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -2758,8 +2764,8 @@
|
|||||||
},
|
},
|
||||||
"_lscale": {
|
"_lscale": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0.5,
|
"x": 0.8,
|
||||||
"y": 0.5,
|
"y": 0.8,
|
||||||
"z": 1
|
"z": 1
|
||||||
},
|
},
|
||||||
"_mobility": 0,
|
"_mobility": 0,
|
||||||
@@ -2781,7 +2787,7 @@
|
|||||||
"__id__": 118
|
"__id__": 118
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 120
|
"__id__": 120
|
||||||
@@ -3923,7 +3929,7 @@
|
|||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@eb208",
|
"__uuid__": "deedea09-8f2b-400f-9803-4cfd38e45d1a@cabf0",
|
||||||
"__expectedType__": "cc.SpriteFrame"
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
},
|
},
|
||||||
"_type": 0,
|
"_type": 0,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { AttrCards, AttrInfo, CanSelectAttrs } from "./AttrSet";
|
|||||||
import { talConf, ItalConf, CanSelectTalents } from "./TalSet";
|
import { talConf, ItalConf, CanSelectTalents } from "./TalSet";
|
||||||
import { SkillSet, SkillConfig, CanSelectSkills } from "./SkillSet";
|
import { SkillSet, SkillConfig, CanSelectSkills } from "./SkillSet";
|
||||||
import { HeroInfo, heroInfo, CanSelectHeros } from "./heroSet";
|
import { HeroInfo, heroInfo, CanSelectHeros } from "./heroSet";
|
||||||
import { CardType } from "./GameSet";
|
import { CardType, CardKind } from "./GameSet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统一卡牌信息接口 (用于UI显示和逻辑处理)
|
* 统一卡牌信息接口 (用于UI显示和逻辑处理)
|
||||||
@@ -37,16 +37,6 @@ export interface IPoolConfig {
|
|||||||
tag?: string; // 辅助筛选(从全池中筛选带tag的,如 "special")
|
tag?: string; // 辅助筛选(从全池中筛选带tag的,如 "special")
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum CardKind {
|
|
||||||
Atk = 1,
|
|
||||||
Atted = 2,
|
|
||||||
Buff = 3,
|
|
||||||
Attr = 4,
|
|
||||||
Skill = 5,
|
|
||||||
Hp = 6,
|
|
||||||
Dead = 7,
|
|
||||||
Partner = 8,
|
|
||||||
}
|
|
||||||
// 默认单卡权重
|
// 默认单卡权重
|
||||||
const DEFAULT_CARD_WEIGHT = 100;
|
const DEFAULT_CARD_WEIGHT = 100;
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ export enum CardType {
|
|||||||
Attr = 5
|
Attr = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum CardKind {
|
||||||
|
Atk = 1,
|
||||||
|
Atted = 2,
|
||||||
|
Buff = 3,
|
||||||
|
Attr = 4,
|
||||||
|
Skill = 5,
|
||||||
|
Hp = 6,
|
||||||
|
Dead = 7,
|
||||||
|
Partner = 8,
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取等级对应的奖励类型
|
* 获取等级对应的奖励类型
|
||||||
* @param level 当前等级
|
* @param level 当前等级
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { count } from "console";
|
import { count } from "console";
|
||||||
import { Attrs, BType } from "./HeroAttrs";
|
import { Attrs, BType } from "./HeroAttrs";
|
||||||
import { CardKind } from "./CardSet";
|
import { CardKind } from "./GameSet";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 天赋类型枚举,也是触发条件
|
* 天赋类型枚举,也是触发条件
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/modu
|
|||||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||||
import { GameEvent } from "../common/config/GameEvent";
|
import { GameEvent } from "../common/config/GameEvent";
|
||||||
import { smc } from "../common/SingletonModuleComp";
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
import { CardType, FightSet } from "../common/config/GameSet";
|
import { CardType, FightSet, CardKind } from "../common/config/GameSet";
|
||||||
import { getCardOptions, ICardInfo } from "../common/config/CardSet";
|
import { getCardOptions, ICardInfo } from "../common/config/CardSet";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
@@ -301,6 +301,65 @@ export class MissionCardComp extends CCComp {
|
|||||||
// ICardInfo 已经标准化了 desc,直接使用
|
// ICardInfo 已经标准化了 desc,直接使用
|
||||||
info.getComponent(Label)!.string = data.desc || "";
|
info.getComponent(Label)!.string = data.desc || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 先隐藏所有类型标识
|
||||||
|
const typeNodes = ["Atk", "Atked", "Buff", "Attr", "Skill", "Hp", "Dead", "Partner"];
|
||||||
|
|
||||||
|
// 1. 处理 card 直接子节点
|
||||||
|
typeNodes.forEach(nodeName => {
|
||||||
|
const node = card.getChildByName(nodeName);
|
||||||
|
if (node) node.active = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 2. 处理 card/type 下的子节点
|
||||||
|
const typeContainer = card.getChildByName("type");
|
||||||
|
if (typeContainer) {
|
||||||
|
typeNodes.forEach(nodeName => {
|
||||||
|
const node = typeContainer.getChildByName(nodeName);
|
||||||
|
if (node) node.active = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据 kind 激活对应节点
|
||||||
|
let activeNodeName = "";
|
||||||
|
switch (data.kind) {
|
||||||
|
case CardKind.Atk:
|
||||||
|
activeNodeName = "Atk";
|
||||||
|
break;
|
||||||
|
case CardKind.Atted:
|
||||||
|
activeNodeName = "Atked";
|
||||||
|
break;
|
||||||
|
case CardKind.Buff:
|
||||||
|
activeNodeName = "Buff";
|
||||||
|
break;
|
||||||
|
case CardKind.Attr:
|
||||||
|
activeNodeName = "Attr";
|
||||||
|
break;
|
||||||
|
case CardKind.Skill:
|
||||||
|
activeNodeName = "Skill";
|
||||||
|
break;
|
||||||
|
case CardKind.Hp:
|
||||||
|
activeNodeName = "Hp";
|
||||||
|
break;
|
||||||
|
case CardKind.Dead:
|
||||||
|
activeNodeName = "Dead";
|
||||||
|
break;
|
||||||
|
case CardKind.Partner:
|
||||||
|
activeNodeName = "Partner";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeNodeName) {
|
||||||
|
// 激活 card 下的节点
|
||||||
|
const activeNode = card.getChildByName(activeNodeName);
|
||||||
|
if (activeNode) activeNode.active = true;
|
||||||
|
|
||||||
|
// 激活 card/type 下的节点
|
||||||
|
if (typeContainer) {
|
||||||
|
const activeTypeNode = typeContainer.getChildByName(activeNodeName);
|
||||||
|
if (activeTypeNode) activeTypeNode.active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCardData(index: number, data: ICardInfo) {
|
updateCardData(index: number, data: ICardInfo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user