3 Commits

Author SHA1 Message Date
walkpan
e24d169161 refactor(ui): 优化卡牌等级显示逻辑和布局更新
- 移除HInfoComp中品质边框切换逻辑,专注卡牌等级显示
- 简化CardComp中等级节点的布局更新逻辑,仅使用Widget组件
- 调整card.prefab的布局参数和原始宽度
- 禁用role_controller.prefab的_active属性
2026-04-21 21:05:21 +08:00
walkpan
9363f8f1d7 refactor(游戏配置): 调整英雄配置和游戏平衡参数
- 更新英雄配置文档,完善战士技能描述
- 修改英雄升级和合并相关参数
- 移除后退相关逻辑和配置
- 重构卡牌显示逻辑,优化UI组件管理
2026-04-21 21:05:05 +08:00
walkpan
183fe111ef feat(card): 为卡牌组件添加等级显示节点
在 CardComp 类中添加 lv_node 属性,并在卡牌预制体中创建对应的等级显示 UI 结构,包含背景和多个星级图标,用于展示卡牌的等级信息。
2026-04-21 20:30:20 +08:00
9 changed files with 6144 additions and 2061 deletions

View File

@@ -0,0 +1,6 @@
---
alwaysApply: true
scene: git_message
---
在此处编写规则,自定义 AI 生成提交信息的风格。

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1938,7 +1938,7 @@
"__id__": 92
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 100

View File

@@ -24,14 +24,14 @@ export enum FightSet {
MORE_RC=10,//更多次数 广告获取的次数
HEARTPOS=-320,//基地位置
HERO_MAX_NUM=3,//英雄最大数量
MERGE_MAX=2, //英雄最大等级
MERGE_NEED=3, //英雄升级需要的英雄数
MERGE_MAX=3, //英雄最大等级
MERGE_NEED=2, //英雄升级需要的英雄数
LVUP_GOLD=50,//升级需要的金币
LVUP_GOLD_UP=50,//升级需要的金币
CHOU_GOLD=100,//抽卡需要的金币
BACK_RANG=30,//后退范围
// BACK_RANG=30,//后退范围
FiIGHT_TIME=30,//战斗时间
BACK_CHANCE=40,//击退概率
// BACK_CHANCE=40,//击退概率
FROST_TIME=3,//冰冻时间
SKILL_CAST_DELAY=0.15,
CSKILL_START_X=-340,

View File

@@ -7,7 +7,6 @@
可叠加类型:
双击(风怒)概率
特殊效果
护盾: 抵挡攻击
治疗: 回血
@@ -27,9 +26,7 @@
被攻击技能触发2次
战士1普通攻击 被攻击3次获得3次格挡的护盾
战士2
战士3
战士4
战士5
战士2普通攻击 就是皮厚血量普通展示2倍
战士3普通攻击 
战士4普通攻击 20%血量复活1次数
战士5普通攻击

View File

@@ -480,30 +480,30 @@ export class HeroViewComp extends CCComp {
//后退
back(){
// 🔥 防止重复调用后退动画
if (this.isBackingUp) return;
this.isBackingUp = true; // 🔥 设置后退状态
// if (this.isBackingUp) return;
// this.isBackingUp = true; // 🔥 设置后退状态
if(this.model.fac==FacSet.MON) {
let tx=this.node.position.x+FightSet.BACK_RANG
if(tx > 320) tx=320
tween(this.node)
.to(0.1, { position:v3(tx,this.node.position.y,0)})
.call(() => {
this.isBackingUp = false; // 🔥 动画完成后重置状态
})
.start()
}
// if(this.model.fac==FacSet.MON) {
// let tx=this.node.position.x+FightSet.BACK_RANG
// if(tx > 320) tx=320
// tween(this.node)
// .to(0.1, { position:v3(tx,this.node.position.y,0)})
// .call(() => {
// this.isBackingUp = false; // 🔥 动画完成后重置状态
// })
// .start()
// }
if(this.model.fac==FacSet.HERO) {
let tx=this.node.position.x-5
if(tx < -320) tx=-320
tween(this.node)
.to(0.1, { position:v3(tx,this.node.position.y,0)})
.call(() => {
this.isBackingUp = false; // 🔥 动画完成后重置状态
})
.start()
}
// if(this.model.fac==FacSet.HERO) {
// let tx=this.node.position.x-5
// if(tx < -320) tx=-320
// tween(this.node)
// .to(0.1, { position:v3(tx,this.node.position.y,0)})
// .call(() => {
// this.isBackingUp = false; // 🔥 动画完成后重置状态
// })
// .start()
// }
}
// 伤害计算和战斗逻辑已迁移到 HeroBattleSystem

View File

@@ -83,6 +83,9 @@ export class CardComp extends CCComp {
@property(Node)
HF_node=null!
@property(Node)
lv_node=null!
// ======================== 运行时状态 ========================
/** 当前卡牌的金币费用 */
@@ -662,33 +665,41 @@ export class CardComp extends CCComp {
this.node.setPosition(targetX, targetY, this.restPosition.z);
// ---- 卡牌种类标识(近战 / 远程 / 辅助等) ----
// if (this.Ckind_node) {
// const kindName = CKind[this.cardData.kind];
// this.Ckind_node.children.forEach(child => {
// child.active = (child.name === kindName);
// });
// }
const kindName = CKind[this.cardData.kind];
// ---- 背景底框(按卡池等级显示对应子节点) ----
const cardLvStr = `lv${this.cardData.pool_lv}`;
// ---- 背景底框与高级边框(现在按 Ckind 显示对应子节点) ----
if (this.BG_node) {
this.BG_node.children.forEach(child => {
child.active = (child.name === cardLvStr);
child.active = (child.name === kindName);
});
}
// ---- 品质边框(高级 vs 普通) ----
const card_lv_val = this.cardData.card_lv ?? 1;
const isHighLevel = (this.cardData.hero_lv ?? 0) > 1 || card_lv_val > 1;
if (this.HF_node) this.HF_node.active = isHighLevel;
if (this.NF_node) this.NF_node.active = !isHighLevel;
this.node.getChildByName("HB").active = isHighLevel;
const activeFrameNode = isHighLevel ? this.HF_node : this.NF_node;
if (activeFrameNode) {
activeFrameNode.children.forEach(child => {
child.active = (child.name === cardLvStr);
if (this.HF_node) {
this.HF_node.active = true;
this.HF_node.children.forEach(child => {
child.active = (child.name === kindName);
});
}
if (this.NF_node) {
this.NF_node.active = false;
}
const hbNodeUI = this.node.getChildByName("HB");
if (hbNodeUI) hbNodeUI.active = false;
// ---- 卡牌等级标识 ----
const cardLvStr = `lv${this.cardData.pool_lv}`;
if (this.lv_node) {
this.lv_node.children.forEach(child => {
if (child.name === "light") {
child.active = false;
} else if (child.name === "bg") {
child.active = true;
} else {
child.active = (child.name === cardLvStr);
}
});
if(isHighLevel){activeFrameNode.getChildByName("light").active=true}
}
// ---- 按卡牌类型渲染具体内容 ----
@@ -717,6 +728,16 @@ export class CardComp extends CCComp {
});
}
if (this.lv_node) {
const widget = this.lv_node.getComponent(Widget);
if (widget) widget.updateAlignment();
this.lv_node.children.forEach(child => {
const childWidget = child.getComponent(Widget);
if (childWidget) childWidget.updateAlignment();
});
}
if (this.HF_node) {
const hfTrans = this.HF_node.getComponent(UITransform);
if (hfTrans) {
@@ -827,7 +848,17 @@ export class CardComp extends CCComp {
}
// ---- 费用标签 ----
this.setLabel(this.cost_node, `${this.card_cost}`);
if (this.card_type === CardType.Hero) {
if (this.cost_node) this.cost_node.active = false;
} else {
if (this.cost_node) {
this.cost_node.active = true;
const numNode = this.cost_node.getChildByName("num");
if (numNode) {
this.setLabel(numNode, `${this.card_cost}`);
}
}
}
// ---- 名字节点位置调整 ----
if (this.name_node) {
@@ -942,6 +973,15 @@ export class CardComp extends CCComp {
}
});
}
if (this.lv_node) {
const widget = this.lv_node.getComponent(Widget);
if (widget) widget.updateAlignment();
this.lv_node.children.forEach(child => {
const childWidget = child.getComponent(Widget);
if (childWidget) childWidget.updateAlignment();
});
}
if (this.HF_node) {
const hfTrans = this.HF_node.getComponent(UITransform);
if (hfTrans) {
@@ -999,7 +1039,12 @@ export class CardComp extends CCComp {
}
this.iconVisualToken += 1;
this.setLabel(this.name_node, "");
this.setLabel(this.cost_node, "");
if (this.cost_node) {
const numNode = this.cost_node.getChildByName("num");
if (numNode) {
this.setLabel(numNode, "");
}
}
if (this.info_node) this.info_node.active = false;
if (this.oinfo_node) this.oinfo_node.active = false;
// if (this.Ckind_node) {
@@ -1010,8 +1055,15 @@ export class CardComp extends CCComp {
if (this.BG_node) {
this.BG_node.children.forEach(child => child.active = false);
}
if (this.HF_node) this.HF_node.active = false;
if (this.HF_node) {
this.HF_node.active = false;
this.HF_node.children.forEach(child => child.active = false);
}
if (this.NF_node) this.NF_node.active = false;
if (this.lv_node) {
this.lv_node.children.forEach(child => child.active = false);
}
if (this.cost_node) this.cost_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

@@ -53,6 +53,9 @@ export class HInfoComp extends CCComp {
@property(Node)
HF_node=null!
@property(Node)
lv_node=null!
/** 绑定的英雄 ECS 实体 ID */
private eid: number = 0;
/** 绑定的英雄属性数据模型引用 */
@@ -96,16 +99,10 @@ export class HInfoComp extends CCComp {
refresh() {
if (!this.model) return;
// ---- 品质边框切换 ----
const isHighLevel = (this.model.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) {
// ---- 卡牌等级显示 ----
if (this.lv_node) {
const cardLvStr = `lv${this.model.pool_lv ?? 1}`;
activeFrameNode.children.forEach(child => {
this.lv_node.children.forEach(child => {
child.active = (child.name === cardLvStr);
});
}