Files
fc/dev/project/library/imports/5e/5efe0121-104e-459f-94fa-c43a48f739f2.js
2026-05-24 10:21:26 +08:00

64 lines
1.9 KiB
JavaScript

"use strict";
cc._RF.push(module, '5efe0EhEE5Fn5T6xDpI9zny', 'cmp.partner.bag.volume');
// Scripts/mod/partner/cmps/bag/cmp.partner.bag.volume.js
"use strict";
/******************************************************************
*
* 伙伴背包容量
*
******************************************************************/
var BridgeComponent = require("bridge.component");
var HeroEvent = require("hero_event");
var HeroController = require("hero_controller");
cc.Class({
"extends": BridgeComponent,
properties: {},
// 载入
onLoad: function onLoad() {
this._super();
this.bindGEvent(HeroEvent.Buy_Hero_Max_Count_Event, this.onFreshVolume.bind(this));
this.bindGEvent(HeroEvent.Del_Hero_Event, this.onFreshVolume.bind(this));
this.bindGEvent(HeroEvent.Hero_Data_Add, this.onFreshVolume.bind(this));
this.onFreshVolume();
},
// 关闭
onDestroy: function onDestroy() {
this._super();
},
// 容量刷新
onFreshVolume: function onFreshVolume() {
var HM = HeroController.getInstance().getModel();
var info = HM.getHeroMaxCount();
nx.gui.setString(this, "cur", info.have_coutn);
nx.gui.setString(this, "max", info.max_count);
var DATA = game.configs.partner_data.data_partner_buy;
var num = HM.getHeroBuyNum();
var cfg = DATA[num + 1];
nx.gui.setActive(this, "add", nx.dt.objNEmpty(cfg));
},
// 点击扩容
onTouchBuy: function onTouchBuy() {
var HC = HeroController.getInstance();
var HM = HC.getModel();
var DATA = game.configs.partner_data.data_partner_buy;
var num = HM.getHeroBuyNum();
var cfg = DATA[num + 1];
if (nx.dt.objEmpty(cfg)) {
return;
}
var item_id = cfg.expend[0][0] || 3;
var count = cfg.expend[0][1];
var str = nx.text.format("msg_addBagNum", count, item_id, cfg.add_num);
nx.mbox(str, ["no", "yes"], function (_key, _box) {
_box.close();
if (_key == "yes") {
HC.sender11009();
}
});
}
});
cc._RF.pop();