"use strict"; cc._RF.push(module, 'd6c36U7XM9MqKPFPVkuHVv1', 'cmp.wing.item'); // Scripts/mod/partner/wings/cmp/cmp.wing.item.js "use strict"; var ItemBase = require("cmp.item.base"); var BackPackConst = require("backpack_const"); var BackPackController = require("backpack_controller"); var BTT = BackPackConst.item_type; /********** * * 僚机展示 */ cc.Class({ "extends": ItemBase, properties: { nodLock: { "default": null, type: cc.Node } }, // 重载:刷新 freshAll: function freshAll() { this._super(); this.focus = false; // this.setLocked( true ); }, // 置空 setEmpty: function setEmpty() { this.outFocus(); this.setQuality(-1); this.setIcon(0); this.setName(nx.text.getKey("NoneWingsOn")); this.setDescribe(""); this.setStars(0); this.freshLT(); this.freshRT(); nx.gui.setString(this.nodCount, "", ""); }, // 单设:数量 setCount: function setCount(_count) { // 碎片获取合成配置,显示进度 if (this.nodCount && this.info && this.info.type == BTT.PARTNER_DEBRIS) { var cfg = gdata("partner_data", "data_get_compound_info", this.info.item_id); if (nx.dt.objNEmpty(cfg)) { this.nodCount.string = _count + "/" + cfg.num; return; } } if (this.nodCount && this.info && this.info.type == BTT.ELFIN_EGG) { // let cfg = gdata( "partner_data", "data_get_compound_info", this.info.item_id ); var BC = BackPackController.getInstance(); var count = BC.getModel().getItemNumByBid(this.info.item_id); // if( nx.dt.objNEmpty( cfg ) ) { this.nodCount.string = count + "/" + 1; return; // } } this._super(_count); }, // 单设:品质 setQuality: function setQuality(_qa) { if (this.nodBG) { var qa = null; if (nx.dt.numPositive(_qa)) { switch (_qa) { case 2: { qa = cc.path.join("prefab/partner/wing/ui/partner_82"); } break; case 3: { qa = cc.path.join("prefab/partner/wing/ui/partner_57"); } break; case 4: { qa = cc.path.join("prefab/partner/wing/ui/partner_83"); } break; } } nx.gui.setSpriteFrame(this.nodBG, "", qa); } }, // 左上角标更新 freshLT: function freshLT() { if (!this.imgLT) { return; } var sf = null; // 区别处理 if (nx.dt.objNEmpty(this.info)) { // console.log( "当前的数据信息" + JSON.stringify( this.info ) ); // let cfg = // 精灵等级 if (!sf && this.info.type == BackPackConst.item_type.ELFIN) { var sfg = gdata("sprite_data", "data_elfin_data", this.info.item_id); if (sfg.skill) { var data = gskilldata('data_get_skill', sfg.skill); // console.log( "技能信息" + JSON.stringify( data ) ); sf = cc.path.join("coms/images/ico_lv" + data.level); } } } nx.gui.setSpriteFrame(this.imgLT, "", sf); }, // 单设:锁定 setLocked: function setLocked(_locked) { this.locked = !!_locked; if (this.nodLock) { nx.gui.setActive(this.nodLock, "", this.locked); } }, // 聚焦获得 onFocus: function onFocus() { if (this.nodFocus) { this.nodFocus.node.active = true; this.focus = true; } }, // 聚焦失去 outFocus: function outFocus() { if (this.nodFocus) { this.nodFocus.node.active = false; this.focus = false; } } }); cc._RF.pop();