feat(界面): 为MissionCardComp添加关闭按钮和物品价格显示
在MissionCardComp组件中添加关闭按钮属性btnClose,并在显示物品卡片时增加价格信息显示。修改卡片描述逻辑,当卡片类型为物品且存在价格时,在描述后追加价格信息。
This commit is contained in:
9
assets/script/game/common/config/ItemSet.ts.meta
Normal file
9
assets/script/game/common/config/ItemSet.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a29f50fa-c2f5-4516-b108-ac1ae313c0c3",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -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