feat(卡牌): 添加卡牌大类标识并更新UI显示
- 在CardSet中新增CKind枚举,区分英雄、技能、卡牌、药水等大类 - 在卡牌配置中增加kind字段,并更新所有卡牌配置 - 在CardComp组件中添加Ckind_node属性,用于显示卡牌大类图标 - 重构card.prefab,将大类图标节点重命名为更具语义的名称(如lv1-lv5),并调整节点激活状态 - 在卡牌初始化和重置时,根据cardData.kind动态显示对应的大类图标
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user