import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil"; import GameModel from "../ts/core/GameModel"; import Report from "../ts/gear_2.3.4/net/Report"; import SKDataUtil from "../ts/gear_2.3.4/util/SKDataUtil"; import SkillUtil from "../ts/game/skill/core/SkillUtil"; import AudioUtil from "../ts/core/AudioUtil"; import PetUtil from "../ts/game/pet/PetUtil"; import {EAttrTypeL1} from "../ts/core/EEnum"; import GameUtil from "../ts/core/GameUtil"; import ItemUtil from "../ts/core/ItemUtil"; import MsgAlert from "../ts/game/msg/MsgAlert"; import SKLogger from "../ts/gear_2.3.4/util/SKLogger"; import ChangeNameAlert from "../ts/game/role/ChangeNameAlert"; let logic = require('../game/PetLogic'); cc.Class({ extends: cc.Component, properties: { petNode: cc.Node, nameLabel: cc.Label, scoreLabel: cc.Label, levelLabel: cc.Label, rateLabel: cc.Label, longguLabel: cc.Label, tiliLabel: cc.Label, skillItem: cc.Node, skillContent: cc.Node, propertyItem: cc.Node, propertyContent: cc.Node, }, onLoad() { this.petLogic = new logic.PetLogic(); }, loadInfo(info) { this.petLogic.setInfo(info); cc.log(this.petLogic); this.showInfo(); }, showInfo() { let info = { rate: this.petLogic.rate, cur_hp: this.petLogic.hp, cur_mp: this.petLogic.mp, cur_atk: this.petLogic.atk, cur_spd: this.petLogic.spd, max_rate: this.petLogic.maxRate }; for (let key in GameModel.conf_pet) { if (SKDataUtil.hasProperty(GameModel.conf_pet, key)) { let item = GameModel.conf_pet[key]; if (item.id== this.petLogic.dataid) { //info.max_rate = SKDataUtil.jsonBy(item.rate)[1]; info.max_hp = SKDataUtil.jsonBy(item.hp)[1]; info.max_mp = SKDataUtil.jsonBy(item.mp)[1]; info.max_atk = SKDataUtil.jsonBy(item.atk)[1]; info.max_spd = SKDataUtil.jsonBy(item.spd)[1]; } } } let hp_progress = this.hpNode.getChildByName('ImageLoadingBg'); let hp_label = hp_progress.getChildByName('progressLabel').getComponent(cc.Label); let hpProgress = (info.cur_hp == 0) ? 0 : (info.cur_hp / info.max_hp); hp_progress.getComponent(cc.ProgressBar).progress = hpProgress > 1 ? 1 : hpProgress; hp_label.string = info.cur_hp + '/' + info.max_hp; let mp_progress = this.mpNode.getChildByName('ImageLoadingBg'); let mp_label = mp_progress.getChildByName('progressLabel').getComponent(cc.Label); let mpProgress = (info.cur_mp == 0) ? 0 : (info.cur_mp / info.max_mp); mp_progress.getComponent(cc.ProgressBar).progress = mpProgress > 1 ? 1 : mpProgress; mp_label.string = info.cur_mp + '/' + info.max_mp; let att_progress = this.attNode.getChildByName('ImageLoadingBg'); let att_label = att_progress.getChildByName('progressLabel').getComponent(cc.Label); let atkProgress = (info.cur_atk == 0) ? 0 : (info.cur_atk / info.max_atk); att_progress.getComponent(cc.ProgressBar).progress = atkProgress > 1 ? 1 : atkProgress; att_label.string = info.cur_atk + '/' + info.max_atk; let spe_progress = this.speedNode.getChildByName('ImageLoadingBg'); let spe_label = spe_progress.getChildByName('progressLabel').getComponent(cc.Label); let spdProgress = (info.cur_spd == 0) ? 0 : (info.cur_spd / info.max_spd); spe_progress.getComponent(cc.ProgressBar).progress = spdProgress > 1 ? 1 : spdProgress; spe_label.string = info.cur_spd + '/' + info.max_spd; //let currate = info.rate + this.petLogic.longgu * 0.01; this.rateLabel.string = info.rate.toFixed(3) + '/' + info.max_rate.toFixed(3); let petcolor = null; if (this.petLogic && this.petLogic.petinfo) { petcolor = this.petLogic.petinfo.color; } else { cc.warn(`$警告:召喚獸變色信息異常!`); } this.petNode.getComponent('UIRole').setInfo({ resid: this.petLogic.resid, name: '', petcolor: petcolor }); this.longguLabel.string = `龍骨x${this.petLogic.getMaxLongGu()}`; }, Close() { this.node.destroy(); }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, // update (dt) {}, });