From f862d42b1364099f21760b87462a7c4da18aa93a Mon Sep 17 00:00:00 2001 From: "guoqing.zhu" <1521292690@qq.com> Date: Wed, 15 Jun 2022 11:04:13 +0800 Subject: [PATCH] add upfailed --- assets/scripts/UI/Academy/Academy_block.ts | 11 +++++++++-- assets/scripts/tips/UpFail.ts | 5 ++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/assets/scripts/UI/Academy/Academy_block.ts b/assets/scripts/UI/Academy/Academy_block.ts index 6b35d3a7..d863f2ef 100644 --- a/assets/scripts/UI/Academy/Academy_block.ts +++ b/assets/scripts/UI/Academy/Academy_block.ts @@ -1,4 +1,5 @@ const NetManage = require('../../manages/NetManage'); +import { UpFail } from '../../tips/UpFail'; import { UpSuccess } from '../../tips/UpSuccess'; import { uimanger } from '../UIManger'; import { ChooseHeroUpdate } from './ChooseHeroUpdate'; @@ -147,8 +148,14 @@ export default class Academy_block extends cc.Component { type, this.currentData.info.hero_uniid, (res) => { - // wait... - uimanger.showUI(UpSuccess.prefabPath, res); + if (res.state == 0) { + // failed + uimanger.showUI(UpFail.prefabPath, res); + } else { + //success + uimanger.showUI(UpSuccess.prefabPath, res); + } + var node = cc .find('Canvas') .getComponentInChildren(UIUpdateHero).node; diff --git a/assets/scripts/tips/UpFail.ts b/assets/scripts/tips/UpFail.ts index 7453683f..c5f542e3 100644 --- a/assets/scripts/tips/UpFail.ts +++ b/assets/scripts/tips/UpFail.ts @@ -20,9 +20,8 @@ export class UpFail extends UIBase { @property(QualityStar) newStar: QualityStar = null; init(data: any) { - console.log(JSON.stringify(data)); - this.beforeNode.getComponent('herochoseone').initdata(); - + this.beforeNode.getComponent('herochoseone').initdata(data.old_hero); + this.lb_lv.string = data.old_hero.hero_lv; this.lb_hp.string = data.old_hero.hp; this.lb_atk.string = data.old_hero.atk; this.lb_def.string = data.old_hero.def;