pubgv3/assets/scripts/tips/UpSuccess.ts
guoqing.zhu 499bed03a9 update
2022-06-15 18:09:05 +08:00

68 lines
2.0 KiB
TypeScript

import { QualityStar } from '../UI/QualityStar';
import { UIBase } from '../UI/UIBase';
import { uimanger } from '../UI/UIManger';
import { AdvanceAnim } from './AdvanceAnim';
import { LevelUp } from './LevelUp';
const { ccclass, property } = cc._decorator;
@ccclass
export class UpSuccess extends UIBase {
public static prefabPath = 'prefabs/UIPrefab/pb_herosuccess';
@property(cc.Node) beforeNode: cc.Node = null;
@property(cc.Label) lb_lv: cc.Label = null;
@property(cc.Label) lb_hp: cc.Label = null;
@property(cc.Label) lb_atk: cc.Label = null;
@property(cc.Label) lb_def: cc.Label = null;
@property(cc.Label) lb_lucky: cc.Label = null;
@property(cc.Label) lb_adv: cc.Label = null;
@property(cc.Label) lb_hpaf: cc.Label = null;
@property(cc.Label) lb_atkaf: cc.Label = null;
@property(cc.Label) lb_defaf: cc.Label = null;
@property(cc.Label) lb_luckyaf: cc.Label = null;
@property(cc.Label) lb_advaf: cc.Label = null;
@property(QualityStar) oldStar: QualityStar = null;
@property(QualityStar) newStar: QualityStar = null;
private type = 0;
private currentQ = 0;
init(tmp: any) {
var data = tmp.data;
this.type = tmp.type;
this.beforeNode.getComponent('herochoseone').initdata(data.old_hero);
this.lb_lv.string = data.new_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;
this.lb_lucky.string = data.old_hero.lucky;
this.lb_adv.string = data.old_hero.advanced_count;
this.lb_hpaf.string = data.new_hero.hp;
this.lb_atkaf.string = data.new_hero.atk;
this.lb_defaf.string = data.new_hero.def;
this.lb_luckyaf.string = data.new_hero.lucky;
this.lb_advaf.string = data.new_hero.advanced_count;
this.oldStar.initStar(data.old_hero.quality);
this.newStar.initStar(data.new_hero.quality);
this.currentQ = data.old_hero.quality;
}
protected async start() {
if (this.type == 1) {
uimanger.showUI(LevelUp.prefabPath, {});
} else {
uimanger.showUI(AdvanceAnim.prefabPath, this.currentQ);
}
}
onClose() {
this.node.destroy();
}
}