feat(界面): 为MissionCardComp添加关闭按钮和物品价格显示
在MissionCardComp组件中添加关闭按钮属性btnClose,并在显示物品卡片时增加价格信息显示。修改卡片描述逻辑,当卡片类型为物品且存在价格时,在描述后追加价格信息。
This commit is contained in:
@@ -29,6 +29,9 @@ export class MissionCardComp extends CCComp {
|
||||
@property(Node)
|
||||
card4:Node = null!
|
||||
|
||||
@property(Node)
|
||||
btnClose: Node = null!
|
||||
|
||||
card1_data:any = null!
|
||||
card2_data:any = null!
|
||||
card3_data:any = null!
|
||||
@@ -148,7 +151,12 @@ export class MissionCardComp extends CCComp {
|
||||
let info = card.getChildByName("info")?.getChildByName("Label")
|
||||
if(info){
|
||||
// 根据类型显示不同描述,目前天赋用desc
|
||||
info.getComponent(Label)!.string = data.desc || "";
|
||||
let desc = data.desc || "";
|
||||
// 如果是物品,显示价格
|
||||
if (this.curCardType === CardType.Potion && data.price) {
|
||||
desc += `\n价格: ${data.price}`;
|
||||
}
|
||||
info.getComponent(Label)!.string = desc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user