/** @format */ import {BaseUI} from './BaseUI' import {Data, Mgr} from '../GameControl' import {ccUtils} from '../utils/ccUtils' import {observer, node, label} from '../mobx/observer' import {IRoleLevelConfig, RoleLevelConfig} from '../config/RoleLevelConfig' import {EVENT} from '../enums/Enum' import {i18nLabel} from '../uiutils/i18nLabel' import {idNum} from '../proto/typedef' import {IRewardNty} from '../interface/UIInterface' import {IRanksLevelConfig, RanksLevelConfig} from '../config/RanksLevelConfig' import {SOUND} from '../enums/Sound' const {ccclass, property} = cc._decorator @ccclass @observer export class RoleUpgradeUI extends BaseUI { @node('rewardBox') rewardBox: cc.Node @node('levelLb') levelLb: cc.Node @node('rewardBox/rewardItem') rewarditem: cc.Node @node('dec_effect_1') effect: cc.Node @label('congratLb') upLevelI18n: cc.Label rewards: idNum[] onShow(args: IRewardNty, fromUI: number) { Mgr.audio.playSFX(SOUND.roleLvUp) this.rewards = args.changeArr //特效缓动 cc.tween(this.effect).by(-1, {angle: -1}).repeatForever().start() //显示等级 ccUtils.setLabel(Data.user.level.toString(), this.levelLb) this.upLevelI18n.getComponent(i18nLabel).setParamByIndex(Data.user.level.toString(), 0) //显示奖励 let goodsNode = ccUtils.instantChildren(this.rewarditem, this.rewards.length) Mgr.goods.initGoods(this.rewards, goodsNode, this) } onDisable(): any { //显示动效 let index = 0 this.rewards.forEach(goods => { let starPos = ccUtils.convertToWorldSpaceCanvasAR(this.rewardBox.children[index]) Mgr.goods.flyGoods(goods.id, starPos, () => { Mgr.event.trigger(EVENT.goodsChangeSync, goods.id, goods.num) }) index += 1 }) Mgr.event.removeAll(this) Mgr.event.trigger(EVENT.mainPopAnyUI) } //UI或者其他函数======================================= //网络事件======================================= //触发事件======================================= // 点击事件======================================= }