feat(card): 添加卡牌等级视觉区分与配置调整

- 在卡牌预制件中新增背景(BG_node)、普通边框(NF_node)和高阶边框(HF_node)节点
- 根据卡牌等级和英雄等级动态显示对应的背景和边框样式
- 调整卡牌等级枚举定义,移除LV6并重命名为CardLV
- 为CardConfig接口添加card_lv字段以支持独立卡牌等级
- 优化buff提示框的布局和字体大小
This commit is contained in:
panw
2026-04-02 16:31:06 +08:00
parent 588c935c18
commit a14513dcdf
7 changed files with 3963 additions and 1687 deletions

View File

@@ -1782,7 +1782,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -71.73,
"x": -61.45,
"y": 0.963,
"z": 0
},
@@ -1823,8 +1823,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 25.98046875,
"height": 81.6
"width": 17.6552734375,
"height": 56.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -1862,7 +1862,7 @@
"_string": "-",
"_horizontalAlign": 0,
"_verticalAlign": 1,
"_actualFontSize": 60,
"_actualFontSize": 35,
"_fontSize": 35,
"_fontFamily": "Arial",
"_lineHeight": 40,
@@ -1919,7 +1919,7 @@
},
"_alignFlags": 8,
"_target": null,
"_left": -34.720234375000004,
"_left": -30.557636718750004,
"_right": 0,
"_top": 0,
"_bottom": 0,
@@ -2014,7 +2014,7 @@
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "983a109b-a5e3-4ba7-84c5-1c53817ba177",
"__uuid__": "eca7fc51-87d0-4bb0-89e1-aa9c39411bc6",
"__expectedType__": "cc.BitmapFont"
},
"_isSystemFontUsed": false,
@@ -3822,7 +3822,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -36.930390625,
"x": -41.0830078125,
"y": 0,
"z": 0
},
@@ -4011,8 +4011,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 49.31,
"height": 50
"width": 57.615234375,
"height": 65
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -4056,11 +4056,8 @@
"_lineHeight": 50,
"_overflow": 0,
"_enableWrapText": true,
"_font": {
"__uuid__": "983a109b-a5e3-4ba7-84c5-1c53817ba177",
"__expectedType__": "cc.BitmapFont"
},
"_isSystemFontUsed": false,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,

View File

@@ -8650,6 +8650,15 @@
"Ckind_node": {
"__id__": 343
},
"BG_node": {
"__id__": 2
},
"NF_node": {
"__id__": 118
},
"HF_node": {
"__id__": 172
},
"_id": ""
},
{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -17,13 +17,12 @@ export enum CKind {
}
/** 卡池等级定义 */
export enum CardKind {
export enum CardLV {
LV1 = 1,
LV2 = 2,
LV3 = 3,
LV4 = 4,
LV5 = 5,
LV6 = 6,
}
/** 通用卡牌配置 */
@@ -33,8 +32,9 @@ export interface CardConfig {
cost: number
weight: number
kind: CKind
lv: CardKind
lv: CardLV
hero_lv?: number
card_lv?:number
}
export const CardsUpSet: Record<number, number> = {
1: 50,
@@ -43,14 +43,15 @@ export const CardsUpSet: Record<number, number> = {
4: 200,
5: 250,
}
/**初始coin数 */
export const CardInitCoins = 4
/** 卡池升级每波减免金额 */
export const CARD_POOL_UPGRADE_DISCOUNT_PER_WAVE = 10
/** 卡池默认初始等级 */
export const CARD_POOL_INIT_LEVEL = CardKind.LV1
export const CARD_POOL_INIT_LEVEL = CardLV.LV1
/** 卡池等级上限 */
export const CARD_POOL_MAX_LEVEL = CardKind.LV6
export const CARD_POOL_MAX_LEVEL = CardLV.LV5
/** 英雄最高等级限制 */
export const CARD_HERO_MAX_LEVEL = 3
/** 基础卡池(英雄、技能、功能) */
@@ -67,7 +68,7 @@ export const CardPoolList: CardConfig[] = [
{ 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, 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 },
@@ -110,22 +111,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,kind:CKind.Card,name:"战术晋升",info: "升级场上随机1个1级英雄到2级",
7001: { uuid: 7001,type: CardType.SpecialUpgrade,cost: 6,weight: 16,lv: CardLV.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,kind:CKind.Card,name:"进阶战术",info: "升级场上随机1个2级英雄到3级",
7002: { uuid: 7002,type: CardType.SpecialUpgrade,cost: 6,weight: 14,lv: CardLV.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,kind:CKind.Card,name:"近战征召",info: "刷新卡池,都是近战英雄",
7101: { uuid: 7101,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardLV.LV1,kind:CKind.Card,name:"近战征召",info: "刷新卡池,都是近战英雄",
refreshLv: 0, refreshHeroType: SpecialRefreshHeroType.Melee,
},
7102: { uuid: 7102,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardKind.LV1,kind:CKind.Card,name:"远程征召",info: "刷新卡池,都是远程英雄",
7102: { uuid: 7102,type: CardType.SpecialRefresh,cost: 4,weight: 14,lv: CardLV.LV1,kind:CKind.Card,name:"远程征召",info: "刷新卡池,都是远程英雄",
refreshLv: 0, refreshHeroType: SpecialRefreshHeroType.Ranged,
},
7103: { uuid: 7103,type: CardType.SpecialRefresh,cost: 5,weight: 12,lv: CardKind.LV2,kind:CKind.Card,name:"精英筛选",info: "刷新卡池都是3级卡池等级英雄",
7103: { uuid: 7103,type: CardType.SpecialRefresh,cost: 5,weight: 12,lv: CardLV.LV2,kind:CKind.Card,name:"精英筛选",info: "刷新卡池都是3级卡池等级英雄",
refreshLv: 3, refreshHeroType: SpecialRefreshHeroType.Any,
},
}
@@ -133,11 +134,11 @@ export const SpecialRefreshCardList: Record<number, SpecialRefreshCardConfig> =
/** 规范等级到合法区间 [LV1, LV6] */
const clampCardLv = (lv: number): CardKind => {
const clampCardLv = (lv: number): CardLV => {
const value = Math.floor(lv)
if (value < CARD_POOL_INIT_LEVEL) return CARD_POOL_INIT_LEVEL
if (value > CARD_POOL_MAX_LEVEL) return CARD_POOL_MAX_LEVEL
return value as CardKind
return value as CardLV
}
/** 单次按权重抽取一张卡 */

View File

@@ -382,6 +382,24 @@ export class CardComp extends CCComp {
});
}
const cardLvStr = `lv${this.cardData.lv}`;
if (this.BG_node) {
this.BG_node.children.forEach(child => {
child.active = (child.name === cardLvStr);
});
}
const isHighLevel = (this.cardData.hero_lv ?? 0) > 1 || (this.cardData.card_lv ?? 0) > 1;
if (this.HF_node) this.HF_node.active = isHighLevel;
if (this.NF_node) this.NF_node.active = !isHighLevel;
const activeFrameNode = isHighLevel ? this.HF_node : this.NF_node;
if (activeFrameNode) {
activeFrameNode.children.forEach(child => {
child.active = (child.name === cardLvStr);
});
}
if(this.card_type===CardType.Hero){
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, Math.floor(this.cardData.hero_lv ?? hero?.lv ?? 1));
@@ -468,6 +486,11 @@ export class CardComp extends CCComp {
child.active = false;
});
}
if (this.BG_node) {
this.BG_node.children.forEach(child => child.active = false);
}
if (this.HF_node) this.HF_node.active = false;
if (this.NF_node) this.NF_node.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;

View File

@@ -18,6 +18,13 @@ export class HInfoComp extends CCComp {
icon_node=null!
@property(Node)
sell_node=null!
@property(Node)
NF_node=null!
@property(Node)
HF_node=null!
private eid: number = 0;
private model: HeroAttrsComp | null = null;
private apLabel: Label | null = null;