feat(card): 添加卡牌等级视觉区分与配置调整
- 在卡牌预制件中新增背景(BG_node)、普通边框(NF_node)和高阶边框(HF_node)节点 - 根据卡牌等级和英雄等级动态显示对应的背景和边框样式 - 调整卡牌等级枚举定义,移除LV6并重命名为CardLV - 为CardConfig接口添加card_lv字段以支持独立卡牌等级 - 优化buff提示框的布局和字体大小
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
/** 单次按权重抽取一张卡 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user