Merge branch 'card0515' of git.eoxnet.com:pan/pixelheros into card0515

This commit is contained in:
walkpan
2026-05-25 15:47:35 +08:00
9 changed files with 4888 additions and 8041 deletions

View File

@@ -1,3 +1,5 @@
import { Color } from "cc";
/** 碰撞分组 */
export enum BoxSet {
//物理碰撞tag
@@ -121,3 +123,14 @@ export class NumberFormatter {
}
}
}
export function getLvColor(lv: number): Color {
switch (lv) {
case 2: return new Color("#2ECC71");
case 3: return new Color("#3498DB");
case 4: return new Color("#9B59B6");
case 5: return new Color("#F1C40F");
case 6: return new Color("#E74C3C");
default: return Color.WHITE;
}
}

View File

@@ -33,6 +33,7 @@ import { smc } from "../common/SingletonModuleComp";
import { UIID } from "../common/config/GameUIConfig";
import { HeroAttrsComp } from "../hero/HeroAttrsComp";
import { TalentType } from "../common/config/TalentSet";
import { getLvColor } from "../common/config/GameSet";
import { MissionEconomy } from "./MissionEconomy";
@@ -88,7 +89,11 @@ export class CardComp extends CCComp {
HF_node=null!
@property(Node)
lv_node=null!
pool_lv_node=null! //英雄对应的卡池等级
@property(Label)
lvl_node: Label = null! //英雄本身的等级
@property(Node)
ap_node=null!
@property(Node)
@@ -705,15 +710,15 @@ export class CardComp extends CCComp {
// ---- 卡牌等级标识 ----
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 {
if (this.pool_lv_node) {
this.pool_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);
}
// }
});
}
@@ -743,11 +748,11 @@ export class CardComp extends CCComp {
});
}
if (this.lv_node) {
const widget = this.lv_node.getComponent(Widget);
if (this.pool_lv_node) {
const widget = this.pool_lv_node.getComponent(Widget);
if (widget) widget.updateAlignment();
this.lv_node.children.forEach(child => {
this.pool_lv_node.children.forEach(child => {
const childWidget = child.getComponent(Widget);
if (childWidget) childWidget.updateAlignment();
});
@@ -817,11 +822,15 @@ export class CardComp extends CCComp {
}
if(this.card_type===CardType.Hero){
// 英雄卡:显示英雄名 + 星级 + AP/HP
// 英雄卡:显示英雄名 + AP/HP
const hero = HeroInfo[this.card_uuid];
const heroLv = Math.max(1, Math.floor(this.cardData.hero_lv ?? hero?.lv ?? 1));
const suffix = heroLv >= 2 ? "★".repeat(heroLv - 1) : "";
this.setLabel(this.name_node, `${suffix}${hero?.name || ""}${suffix}`);
const heroLv = Math.max(1, hero?.lv);
this.setLabel(this.name_node, `${hero?.name || ""}`);
if (this.lvl_node) {
this.lvl_node.string = `Lv.${heroLv}`;
this.lvl_node.color = getLvColor(heroLv);
this.lvl_node.node.active = true;
}
this.ap_node.getChildByName("val").getComponent(Label).string = `${(hero?.ap ?? 0) * heroLv}`;
this.hp_node.getChildByName("val").getComponent(Label).string = `${(hero?.hp ?? 0) * heroLv}`;
if (this.oinfo_node) {
@@ -838,6 +847,7 @@ export class CardComp extends CCComp {
this.oinfo_node.active = false;
}
}else if(this.card_type===CardType.Skill){
if (this.lvl_node) this.lvl_node.node.active = false;
// 技能卡:显示技能名 + 品质后缀 + 描述
const skill = SkillSet[this.card_uuid];
const skillCard = CardPoolList.find(c => c.uuid === this.card_uuid);
@@ -855,6 +865,7 @@ export class CardComp extends CCComp {
this.oinfo_node.active = false;
}
}else{
if (this.lvl_node) this.lvl_node.node.active = false;
// 特殊卡(升级 / 刷新):显示卡名 + 品质后缀 + 描述
const specialCard = this.card_type === CardType.SpecialUpgrade
? SpecialUpgradeCardList[this.card_uuid]
@@ -998,11 +1009,11 @@ export class CardComp extends CCComp {
}
});
}
if (this.lv_node) {
const widget = this.lv_node.getComponent(Widget);
if (this.pool_lv_node) {
const widget = this.pool_lv_node.getComponent(Widget);
if (widget) widget.updateAlignment();
this.lv_node.children.forEach(child => {
this.pool_lv_node.children.forEach(child => {
const childWidget = child.getComponent(Widget);
if (childWidget) childWidget.updateAlignment();
});
@@ -1073,6 +1084,7 @@ export class CardComp extends CCComp {
if (this.ap_node) this.ap_node.active = false;
if (this.hp_node) this.hp_node.active = false;
if (this.oinfo_node) this.oinfo_node.active = false;
if (this.lvl_node) this.lvl_node.node.active = false;
// if (this.Ckind_node) {
// this.Ckind_node.children.forEach(child => {
// child.active = false;
@@ -1086,8 +1098,8 @@ export class CardComp extends CCComp {
// 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.pool_lv_node) {
// this.pool_lv_node.children.forEach(child => child.active = false);
// }
if (this.cost_node) this.cost_node.active = false;
if (this.icon_node) (this.icon_node as Node).setScale(new Vec3(1, 1, 1));

View File

@@ -34,7 +34,7 @@ import { UIID } from "../common/config/GameUIConfig";
import { mLogger } from "../common/Logger";
import { MissionHeroComp } from "./MissionHeroComp";
import { MoveComp } from "../hero/MoveComp";
import { FacSet } from "../common/config/GameSet";
import { FacSet, getLvColor } from "../common/config/GameSet";
import { MissionEconomy } from "./MissionEconomy";
const {property, ccclass } = _decorator;
@@ -67,9 +67,11 @@ export class HInfoComp extends CCComp {
@property(Node)
info_node=null!
@property(Node)
lv_node=null!
@property(Label)
lv_node: Label = null!
@property(Node)
pool_lvnode: Node = null!
@property(Node)
ap_node=null!
@@ -165,11 +167,21 @@ export class HInfoComp extends CCComp {
// ---- 卡牌等级显示 ----
if (this.lv_node) {
const currentLv = this.model.lv ?? 1;
this.lv_node.children.forEach(child => {
if (child.name.startsWith('lv')) {
const nodeLv = parseInt(child.name.substring(2));
child.active = !isNaN(nodeLv) && nodeLv <= currentLv;
}
this.lv_node.string = `Lv.${currentLv}`;
this.lv_node.color = getLvColor(currentLv);
}
// ---- 卡池等级标识 ----
if (this.pool_lvnode) {
const poolLvStr = `lv${this.model.pool_lv ?? 1}`;
this.pool_lvnode.children.forEach(child => {
// if (child.name === "light") {
// child.active = false;
// } else if (child.name === "bg") {
// child.active = true;
// } else {
child.active = (child.name === poolLvStr);
// }
});
}

View File

@@ -55,12 +55,12 @@ export class MissionHeroComp extends CCComp {
/** 硬编码的6个英雄占位点 */
public static readonly HERO_POSITIONS: Vec3[] = [
v3(-200, BoxSet.GAME_LINE + 100, 0), // index 0 (node_index 1): Top Front
v3(-200, BoxSet.GAME_LINE, 0), // index 1 (node_index 2): Mid Front
v3(-200, BoxSet.GAME_LINE - 100, 0), // index 2 (node_index 3): Bot Front
v3(-300, BoxSet.GAME_LINE + 100, 0), // index 3 (node_index 4): Top Back
v3(-300, BoxSet.GAME_LINE, 0), // index 4 (node_index 5): Mid Back
v3(-300, BoxSet.GAME_LINE - 100, 0), // index 5 (node_index 6): Bot Back
v3(-185, BoxSet.GAME_LINE + 90, 0), // index 0 (node_index 1): Top Front
v3(-170, BoxSet.GAME_LINE, 0), // index 1 (node_index 2): Mid Front
v3(-200, BoxSet.GAME_LINE - 90, 0), // index 2 (node_index 3): Bot Front
v3(-285, BoxSet.GAME_LINE + 90, 0), // index 3 (node_index 4): Top Back
v3(-270, BoxSet.GAME_LINE, 0), // index 4 (node_index 5): Mid Back
v3(-300, BoxSet.GAME_LINE - 90, 0), // index 5 (node_index 6): Bot Back
];
/** 英雄出生时的掉落高度(从空中落到地面的像素差) */