feat(卡牌): 添加卡牌大类标识并更新UI显示

- 在CardSet中新增CKind枚举,区分英雄、技能、卡牌、药水等大类
- 在卡牌配置中增加kind字段,并更新所有卡牌配置
- 在CardComp组件中添加Ckind_node属性,用于显示卡牌大类图标
- 重构card.prefab,将大类图标节点重命名为更具语义的名称(如lv1-lv5),并调整节点激活状态
- 在卡牌初始化和重置时,根据cardData.kind动态显示对应的大类图标
This commit is contained in:
panw
2026-04-02 15:39:08 +08:00
parent 0f602e7e45
commit 588c935c18
3 changed files with 98 additions and 86 deletions

View File

@@ -180,7 +180,7 @@
"__id__": 2
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 4
@@ -351,14 +351,14 @@
},
{
"__type__": "cc.Node",
"_name": "green",
"_name": "lv1",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 12
@@ -529,7 +529,7 @@
},
{
"__type__": "cc.Node",
"_name": "blue",
"_name": "lv2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -707,7 +707,7 @@
},
{
"__type__": "cc.Node",
"_name": "zhise",
"_name": "lv3",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -885,7 +885,7 @@
},
{
"__type__": "cc.Node",
"_name": "yellow",
"_name": "lv4",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -1063,7 +1063,7 @@
},
{
"__type__": "cc.Node",
"_name": "red",
"_name": "lv5",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -2742,7 +2742,7 @@
},
{
"__type__": "cc.Node",
"_name": "N",
"_name": "NF",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -2818,7 +2818,7 @@
"__id__": 118
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 120
@@ -2989,14 +2989,14 @@
},
{
"__type__": "cc.Node",
"_name": "green",
"_name": "lv1",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 118
},
"_children": [],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 128
@@ -3167,7 +3167,7 @@
},
{
"__type__": "cc.Node",
"_name": "blue",
"_name": "lv2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -3345,7 +3345,7 @@
},
{
"__type__": "cc.Node",
"_name": "zhise",
"_name": "lv3",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -3523,7 +3523,7 @@
},
{
"__type__": "cc.Node",
"_name": "yellow",
"_name": "lv4",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -3701,7 +3701,7 @@
},
{
"__type__": "cc.Node",
"_name": "red",
"_name": "lv5",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -3956,7 +3956,7 @@
},
{
"__type__": "cc.Node",
"_name": "H",
"_name": "HF",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -4032,7 +4032,7 @@
"__id__": 172
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 174
@@ -4203,7 +4203,7 @@
},
{
"__type__": "cc.Node",
"_name": "green",
"_name": "lv1",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -4381,7 +4381,7 @@
},
{
"__type__": "cc.Node",
"_name": "blue",
"_name": "lv2",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -4559,7 +4559,7 @@
},
{
"__type__": "cc.Node",
"_name": "zhise",
"_name": "lv3",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -4737,7 +4737,7 @@
},
{
"__type__": "cc.Node",
"_name": "yellow",
"_name": "lv4",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -4915,7 +4915,7 @@
},
{
"__type__": "cc.Node",
"_name": "red",
"_name": "lv5",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -5360,6 +5360,8 @@
"__id__": 0
},
"fileId": "d6lvh87QJBqrQKgDnhSWth",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
@@ -7932,7 +7934,7 @@
},
{
"__type__": "cc.Node",
"_name": "kind",
"_name": "CKind",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -7963,8 +7965,8 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 75.54,
"y": 106.256,
"x": 0,
"y": -102.964,
"z": 0
},
"_lrot": {
@@ -7976,8 +7978,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": 0.8,
"y": 0.8,
"z": 1
},
"_mobility": 0,
@@ -7992,7 +7994,7 @@
},
{
"__type__": "cc.Node",
"_name": "hero",
"_name": "Hero",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -8014,7 +8016,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 265.066,
"z": 0
},
"_lrot": {
@@ -8122,11 +8124,13 @@
"__id__": 0
},
"fileId": "f3MmyLb9lML5mXGMUZsqPK",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "card",
"_name": "Card",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -8148,7 +8152,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 265.066,
"z": 0
},
"_lrot": {
@@ -8259,11 +8263,13 @@
"__id__": 0
},
"fileId": "dfmEZyL9NF05PFQxDRYO6o",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "skill",
"_name": "Skill",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -8285,7 +8291,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 265.066,
"z": 0
},
"_lrot": {
@@ -8402,7 +8408,7 @@
},
{
"__type__": "cc.Node",
"_name": "buff",
"_name": "Potion",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
@@ -8424,7 +8430,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 265.066,
"z": 0
},
"_lrot": {
@@ -8641,6 +8647,9 @@
"cost_node": {
"__id__": 233
},
"Ckind_node": {
"__id__": 343
},
"_id": ""
},
{

View File

@@ -8,6 +8,13 @@ export enum CardType {
SpecialUpgrade = 3,
SpecialRefresh = 4,
}
/** 卡牌大类定义 */
export enum CKind {
Hero = 1, //英雄
Skill = 2, //技能
Card = 3, //卡牌
Potion = 4, //药水
}
/** 卡池等级定义 */
export enum CardKind {
@@ -25,6 +32,7 @@ export interface CardConfig {
type: CardType
cost: number
weight: number
kind: CKind
lv: CardKind
hero_lv?: number
}
@@ -47,55 +55,31 @@ export const CARD_POOL_MAX_LEVEL = CardKind.LV6
export const CARD_HERO_MAX_LEVEL = 3
/** 基础卡池(英雄、技能、功能) */
export const CardPoolList: CardConfig[] = [
{ uuid: 5001, type: CardType.Hero, cost: 3, weight: 25, lv: 1, hero_lv: 1 },
{ uuid: 5101, type: CardType.Hero, cost: 3, weight: 25, lv: 1, hero_lv: 1 },
{ uuid: 5201, type: CardType.Hero, cost: 3, weight: 25, lv: 1, hero_lv: 1 },
{ uuid: 5301, type: CardType.Hero, cost: 3, weight: 25, lv: 1, hero_lv: 1 },
{ uuid: 5001, type: CardType.Hero, cost: 3, weight: 25, lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5101, type: CardType.Hero, cost: 3, weight: 25, lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5201, type: CardType.Hero, cost: 3, weight: 25, lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5301, type: CardType.Hero, cost: 3, weight: 25, lv: 1, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5003, type: CardType.Hero, cost: 3, weight: 25, lv: 2, hero_lv: 1 },
{ uuid: 5102, type: CardType.Hero, cost: 3, weight: 25, lv: 2, hero_lv: 1 },
{ uuid: 5302, type: CardType.Hero, cost: 3, weight: 25, lv: 2, hero_lv: 1 },
{ uuid: 5003, type: CardType.Hero, cost: 3, weight: 25, lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5102, type: CardType.Hero, cost: 3, weight: 25, lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5302, type: CardType.Hero, cost: 3, weight: 25, lv: 2, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5001, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 2 },
{ uuid: 5101, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 2 },
{ uuid: 5201, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 2 },
{ uuid: 5301, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 2 },
{ uuid: 5002, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 1 },
{ uuid: 5103, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 1 },
{ uuid: 5202, type: CardType.Hero, cost: 3, weight: 25, lv: 3, hero_lv: 1 },
{ uuid: 5003, type: CardType.Hero, cost: 3, weight: 25, lv: 4, hero_lv: 2 },
{ uuid: 5102, type: CardType.Hero, cost: 3, weight: 25, lv: 4, hero_lv: 2 },
{ uuid: 5302, type: CardType.Hero, cost: 3, weight: 25, lv: 4, hero_lv: 2 },
{ uuid: 5002, type: CardType.Hero, cost: 3, weight: 25, lv: 3, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5103, type: CardType.Hero, cost: 3, weight: 25, lv: 3, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5202, type: CardType.Hero, cost: 3, weight: 25, lv: 3, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5004, type: CardType.Hero, cost: 3, weight: 25, lv: 4, hero_lv: 1 },
{ uuid: 5104, type: CardType.Hero, cost: 3, weight: 25, lv: 4, hero_lv: 1 },
{ uuid: 5303, type: CardType.Hero, cost: 3, weight: 25, lv: 4, hero_lv: 1 },
{ uuid: 5004, type: CardType.Hero, cost: 3, weight: 25, lv: 4, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5104, type: CardType.Hero, cost: 3, weight: 25, lv: 4, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5303, type: CardType.Hero, cost: 3, weight: 25, lv: 4, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5001, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 3 },
{ uuid: 5101, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 3 },
{ uuid: 5201, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 3 },
{ uuid: 5301, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 3 },
{ uuid: 5105, type: CardType.Hero, cost: 3, weight: 25, lv: 5, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5304, type: CardType.Hero, cost: 3, weight: 25, lv: 5, kind: CKind.Hero, hero_lv: 1 },
{ uuid: 5002, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 2 },
{ uuid: 5103, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 2 },
{ uuid: 5202, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 2 },
{ uuid: 5105, type: CardType.Hero, cost: 3, weight: 25, lv: 5, hero_lv: 1 },
{ uuid: 5003, type: CardType.Hero, cost: 3, weight: 25, lv: 6, hero_lv: 3 },
{ uuid: 5102, type: CardType.Hero, cost: 3, weight: 25, lv: 6, hero_lv: 3 },
{ uuid: 5302, type: CardType.Hero, cost: 3, weight: 25, lv: 6, hero_lv: 3 },
{ uuid: 5304, type: CardType.Hero, cost: 3, weight: 25, lv: 6, hero_lv: 1 },
{ uuid: 7001, type: CardType.SpecialUpgrade, cost: 6, weight: 16, lv: 1 },
{ uuid: 7002, type: CardType.SpecialUpgrade, cost: 6, weight: 14, lv: 2 },
{ uuid: 7101, type: CardType.SpecialRefresh, cost: 4, weight: 14, lv: 1 },
{ uuid: 7102, type: CardType.SpecialRefresh, cost: 4, weight: 14, lv: 1 },
{ uuid: 7103, type: CardType.SpecialRefresh, cost: 5, weight: 12, lv: 2 },
{ uuid: 7001, type: CardType.SpecialUpgrade, cost: 6, weight: 16, lv: 1 ,kind: CKind.Card },
{ uuid: 7002, type: CardType.SpecialUpgrade, cost: 6, weight: 14, lv: 2 ,kind: CKind.Card },
{ uuid: 7101, type: CardType.SpecialRefresh, cost: 4, weight: 14, lv: 1 ,kind: CKind.Card },
{ uuid: 7102, type: CardType.SpecialRefresh, cost: 4, weight: 14, lv: 1 ,kind: CKind.Card },
{ uuid: 7103, type: CardType.SpecialRefresh, cost: 5, weight: 12, lv: 2 ,kind: CKind.Card },
]
@@ -126,22 +110,22 @@ export interface SpecialRefreshCardConfig extends CardConfig {
export const SpecialUpgradeCardList: Record<number, SpecialUpgradeCardConfig> = {
7001: { uuid: 7001,type: CardType.SpecialUpgrade,cost: 6,weight: 16,lv: CardKind.LV1,name:"战术晋升",info: "升级场上随机1个1级英雄到2级",
7001: { uuid: 7001,type: CardType.SpecialUpgrade,cost: 6,weight: 16,lv: CardKind.LV1,kind:CKind.Card,name:"战术晋升",info: "升级场上随机1个1级英雄到2级",
currentLv: 1, targetLv: 2,
},
7002: { uuid: 7002,type: CardType.SpecialUpgrade,cost: 6,weight: 14,lv: CardKind.LV2,name:"进阶战术",info: "升级场上随机1个2级英雄到3级",
7002: { uuid: 7002,type: CardType.SpecialUpgrade,cost: 6,weight: 14,lv: CardKind.LV2,kind:CKind.Card,name:"进阶战术",info: "升级场上随机1个2级英雄到3级",
currentLv: 2, targetLv: 3,
},
}
export const SpecialRefreshCardList: Record<number, SpecialRefreshCardConfig> = {
7101: { uuid: 7101,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardKind.LV1,name:"近战征召",info: "刷新卡池,都是近战英雄",
7101: { uuid: 7101,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardKind.LV1,kind:CKind.Card,name:"近战征召",info: "刷新卡池,都是近战英雄",
refreshLv: 0, refreshHeroType: SpecialRefreshHeroType.Melee,
},
7102: { uuid: 7102,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardKind.LV1,name:"远程征召",info: "刷新卡池,都是远程英雄",
7102: { uuid: 7102,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardKind.LV1,kind:CKind.Card,name:"远程征召",info: "刷新卡池,都是远程英雄",
refreshLv: 0, refreshHeroType: SpecialRefreshHeroType.Ranged,
},
7103: { uuid: 7103,type: CardType.SpecialRefresh,cost: 5,weight: 12,lv: CardKind.LV2,name:"精英筛选",info: "刷新卡池都是3级卡池等级英雄",
7103: { uuid: 7103,type: CardType.SpecialRefresh,cost: 5,weight: 12,lv: CardKind.LV2,kind:CKind.Card,name:"精英筛选",info: "刷新卡池都是3级卡池等级英雄",
refreshLv: 3, refreshHeroType: SpecialRefreshHeroType.Any,
},
}

View File

@@ -2,7 +2,7 @@ import { mLogger } from "../common/Logger";
import { _decorator, Animation, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas, Tween, tween, UIOpacity, Vec3, resources } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList } from "../common/config/CardSet";
import { CardConfig, CardType, SpecialRefreshCardList, SpecialUpgradeCardList, CKind } from "../common/config/CardSet";
import { CardUseComp } from "./CardUseComp";
import { HeroInfo } from "../common/config/heroSet";
import { SkillSet } from "../common/config/SkillSet";
@@ -35,7 +35,15 @@ export class CardComp extends CCComp {
icon_node=null!
@property(Node)
cost_node=null!
@property(Node)
Ckind_node=null!
@property(Node)
BG_node=null!
@property(Node)
NF_node=null!
@property(Node)
HF_node=null!
card_cost:number=0
card_type:CardType=CardType.Hero
card_uuid:number=0
@@ -367,6 +375,12 @@ export class CardComp extends CCComp {
if (this.opacityComp) this.opacityComp.opacity = 255;
this.node.setPosition(this.restPosition);
if (this.Ckind_node) {
const kindName = CKind[this.cardData.kind];
this.Ckind_node.children.forEach(child => {
child.active = (child.name === kindName);
});
}
if(this.card_type===CardType.Hero){
const hero = HeroInfo[this.card_uuid];
@@ -449,6 +463,11 @@ export class CardComp extends CCComp {
this.setLabel(this.cost_node, "");
if (this.info_node) this.info_node.active = false;
if (this.oinfo_node) this.oinfo_node.active = false;
if (this.Ckind_node) {
this.Ckind_node.children.forEach(child => {
child.active = false;
});
}
this.clearIconAnimation(this.icon_node as Node);
const sprite = this.icon_node?.getComponent(Sprite) || this.icon_node?.getComponentInChildren(Sprite);
if (sprite) sprite.spriteFrame = null;