From 14da4fb2d14b9c7669f30b53b0fab108acf16339 Mon Sep 17 00:00:00 2001 From: panfudan Date: Tue, 6 May 2025 00:06:20 +0800 Subject: [PATCH] dd --- assets/resources/game/gui/card.prefab | 2 +- assets/script/game/map/CardComp.ts | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/assets/resources/game/gui/card.prefab b/assets/resources/game/gui/card.prefab index 72a8c179..78a87be8 100644 --- a/assets/resources/game/gui/card.prefab +++ b/assets/resources/game/gui/card.prefab @@ -5170,7 +5170,7 @@ "b": 255, "a": 255 }, - "_string": "使用", + "_string": "召唤", "_horizontalAlign": 1, "_verticalAlign": 1, "_actualFontSize": 25, diff --git a/assets/script/game/map/CardComp.ts b/assets/script/game/map/CardComp.ts index d3826a88..a0d9fab4 100644 --- a/assets/script/game/map/CardComp.ts +++ b/assets/script/game/map/CardComp.ts @@ -5,6 +5,8 @@ import { GameEvent } from "../common/config/GameEvent"; import { HeroInfo, HeroList } from "../common/config/heroSet"; import { RandomManager } from "db://oops-framework/core/common/random/RandomManager"; import { oops } from "db://oops-framework/core/Oops"; +import { HeroModelComp } from "../hero/HeroModelComp"; +import { HeroViewComp } from "../hero/HeroViewComp"; const { ccclass, property } = _decorator; @@ -55,7 +57,19 @@ export class CardComp extends CCComp { const sprite = show.getChildByName("mask").getChildByName("icon").getComponent(Sprite); sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[uuid].path); }); - + this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros() + } + check_heros(){ + let heros=ecs.query(ecs.allOf(HeroModelComp)) + for(let hero of heros){ + if(hero.get(HeroViewComp).hero_uuid == this.c_uuid){ + return "升级" + } + if(hero.get(HeroViewComp).type==HeroInfo[this.c_uuid].type){ + return "替换" + } + } + return "召唤" } use_card(){ if(this.is_used) return