From a1a5c37ad05c1967714f68a15637f455e87c6a13 Mon Sep 17 00:00:00 2001 From: walkpan Date: Sun, 12 Oct 2025 22:39:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E6=8E=89=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=94=99=E8=AF=AF,=20=E9=87=8D=E6=96=B0=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/script/game/map/VictoryComp.ts | 52 ++------------------------- 1 file changed, 3 insertions(+), 49 deletions(-) diff --git a/assets/script/game/map/VictoryComp.ts b/assets/script/game/map/VictoryComp.ts index b345d48d..e40054e5 100644 --- a/assets/script/game/map/VictoryComp.ts +++ b/assets/script/game/map/VictoryComp.ts @@ -33,72 +33,27 @@ export class VictoryComp extends CCComp { if(args.game_data){ this.game_data=args.game_data } - if(args.rewards){ - this.add_reward(args.rewards) - this.rewards=args.rewards - } - this.node.getChildByName("box").getChildByName("items").getChildByName("exp").getChildByName("num").getComponent(Label)!.string="x"+this.game_data["exp"].toString() - this.node.getChildByName("box").getChildByName("items").getChildByName("gold").getChildByName("num").getComponent(Label)!.string="x"+this.game_data["gold"].toString() - this.node.getChildByName("box").getChildByName("items").getChildByName("diamond").getChildByName("num").getComponent(Label)!.string="x"+this.game_data["diamond"].toString() - this.node.getChildByName("title").getChildByName("victory").active=args.victory - this.node.getChildByName("title").getChildByName("defeat").active=!args.victory + this.node.getChildByName("title").getChildByName("victory").active=true this.node.getChildByName("btns").getChildByName("next").active=false this.scheduleOnce(()=>{ this.node.getChildByName("btns").getChildByName("next").active=true },0.2) } - add_reward(rewards:any[]){ - let parent=this.node.getChildByName("box").getChildByName("items") - let items=parent.children - for(let i=0;ido_drop] 预制体加载失败:", path); - return; - } - const node = instantiate(prefab) as unknown as Node; - node.parent=parent - node.getComponent(ItemComp)!.update_data(d_item.item_uuid,d_item.count,{no_show:true}) - } - } + victory_end(){ this.clear_data() oops.message.dispatchEvent(GameEvent.MissionEnd) oops.gui.removeByNode(this.node) } clear_data(){ - this.game_data={ - exp:0, - gold:0, - diamond:0 - } - this.rewards=[] - let items=this.node.getChildByName("box").getChildByName("items") - items.children.forEach(element => { - if(element.name=="exp"||element.name=="gold"||element.name=="diamond"){ - element.getChildByName("num").getComponent(Label)!.string="0" - }else{ - element.destroy() - } - }); + } //看广告双倍 watch_ad(){ return true } double_reward(){ - if(this.watch_ad()){ - smc.addExp(this.game_data["exp"]) - smc.addGold(this.game_data["gold"]) - smc.addDiamond(this.game_data["diamond"]) - this.rewards.forEach(d_item=>{ - smc.addItem(d_item.item_uuid,d_item.count) - }) - this.node.getChildByName("btns").getChildByName("double").active=false - } // console.log("[VictoryComp]double_reward",smc.items,this.rewards) } restart(){ @@ -106,7 +61,6 @@ export class VictoryComp extends CCComp { oops.message.dispatchEvent(GameEvent.MissionStart) oops.gui.removeByNode(this.node) } - item_show(e:any,val:any){ // console.log("item_show",val) }