12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- /** @format */
- import {BaseUI} from './BaseUI'
- import {Data, Mgr} from '../GameControl'
- import {ccUtils} from '../utils/ccUtils'
- import {observer, render, node, label, editBox, list} from '../mobx/observer'
- import {ATTR_NAME, LANGUAGE_TYPE} from '../enums/Enum'
- import {IEquip} from '../interface/GlobalInterface'
- import {SOUND} from '../enums/Sound'
- const {ccclass, property} = cc._decorator
- @ccclass
- @observer
- export class EquipBreakSuccessUI extends BaseUI {
- attrNodes: cc.Node[] = []
- onOpenAniOver() {
- let t = cc.tween
- for (let i = 0; i < this.attrNodes.length; i++) {
- let attrNode = this.attrNodes[i]
- attrNode.stopAllActions()
- attrNode.x = -560
- attrNode.opacity = 0
- t(attrNode)
- .delay(i * 0.1)
- .then(t().to(0.2, {opacity: 255}).to(0.3, {x: 0}, {easing: 'sineIn'}).union())
- .start()
- }
- }
- onShow(args: IEquip, fromUI: number) {
- Mgr.audio.playSFX(SOUND.goodsUp)
- let iEquip = args
- Mgr.global.initEquipItem(iEquip, cc.find('equip', this.node), this)
- ccUtils.setLabel(iEquip.cfg.name, this.node, 'name')
- this.loadTexImg(`Public/role/streamer_${iEquip.cfg.qualityType}`, this.node, 'streamer')
- ccUtils.instantChildren(cc.find('stars/star', this.node), iEquip.grade)
- //属性
- let lastQualityIEquip = Mgr.global.buildIEquip({
- id: iEquip.equip.id - 1,
- lv: iEquip.equip.lv,
- sid: iEquip.equip.sid,
- hero: '',
- })
- let breakTip = cc.find('breakTip', this.node)
- let attrOrigin = cc.find('scrollView/view/content/attrs/attr', breakTip)
- let attrs = [
- iEquip.HP > 0
- ? ATTR_NAME.HP
- : iEquip.spellAttack > iEquip.attack
- ? ATTR_NAME.spellAttack
- : ATTR_NAME.attack,
- ]
- let allAttrs = ccUtils.instantChildren(attrOrigin, attrs.length)
- this.attrNodes = allAttrs
- for (let i = 0; i < attrs.length; i++) {
- let attr = attrs[i]
- let attrNode = allAttrs[i]
- attrNode.x = -560
- ccUtils.setLabel(LANGUAGE_TYPE[attr.toString()], attrNode, 'attrName')
- ccUtils.setLabel(lastQualityIEquip[attr.toString()], attrNode, 'attrNum')
- ccUtils.setLabel(iEquip[attr.toString()], attrNode, 'nextNum')
- }
- ccUtils.setRichLabel(Mgr.i18n.getEntryLabel(iEquip.cfg.entry), breakTip, 'scrollView/view/content/rtL/rt')
- }
- }
|