98 lines
2.8 KiB
JavaScript
98 lines
2.8 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'ac2efaTUQ9IKpN0zoQg5Vf8', 'cmp.guildmarket.item.bag');
|
|
// Scripts/mod/guild/marketplace/cmp/cmp.guildmarket.item.bag.js
|
|
|
|
"use strict";
|
|
|
|
var ItemBase = require("nx.fx.sv.expand.item");
|
|
cc.Class({
|
|
"extends": ItemBase,
|
|
properties: {
|
|
tag: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
fabItem: {
|
|
"default": null,
|
|
type: cc.Prefab
|
|
},
|
|
selectCot: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
focus: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
onLoad: function onLoad() {
|
|
// this.is_hold = false;
|
|
this.select_num = 0;
|
|
},
|
|
rebind: function rebind(_index, _data, _key) {
|
|
this._super(_index, _data, _key);
|
|
this.setData(_data);
|
|
},
|
|
setData: function setData(data) {
|
|
if (nx.dt.objEmpty(data)) {
|
|
return;
|
|
}
|
|
if (!this.item) {
|
|
this.item = cc.instantiate(this.fabItem);
|
|
this.item.parent = this.tag;
|
|
}
|
|
var cmp = nx.gui.getComponent(this.item, "", "cmp.item.base");
|
|
if (cmp) {
|
|
cmp.tipSelf = false;
|
|
cmp.openTip(false);
|
|
cmp.rebind(0, {
|
|
bid: data.base_id,
|
|
num: 0
|
|
}, "");
|
|
}
|
|
nx.gui.setString(this.selectCot, "", data.quantity);
|
|
},
|
|
// resitEvent(){
|
|
// let hold_sec = game.configs.guild_marketplace_data.data_const.press_select_time.val;
|
|
// this.focus.on(cc.Node.EventType.TOUCH_START,()=>{
|
|
// this.is_hold = true;
|
|
// this.schedule(()=>{
|
|
// if(!this.is_hold)return;
|
|
// this.select_num++;
|
|
// if(this.mdata && this.select_num >= this.mdata.quantity){
|
|
// this.select_num = this.mdata.quantity;
|
|
// }
|
|
// nx.gui.setString(this.selectCot,"",cc.js.formatStr("%s/%s",this.select_num,this.mdata.quantity));
|
|
// },hold_sec/1000,cc.macro.REPEAT_FOREVER);
|
|
// });
|
|
// this.focus.on(cc.Node.EventType.TOUCH_END,()=>{
|
|
// if(this.is_hold){
|
|
// this.unscheduleAllCallbacks();
|
|
// }
|
|
// });
|
|
// this.focus.on(cc.Node.EventType.TOUCH_CANCEL,()=>{
|
|
// if(this.is_hold){
|
|
// this.unscheduleAllCallbacks();
|
|
// }
|
|
// });
|
|
// },
|
|
// offEvents(){
|
|
// this.focus.off(cc.Node.EventType.TOUCH_START,this);
|
|
// this.focus.off(cc.Node.EventType.TOUCH_END,this);
|
|
// this.focus.off(cc.Node.EventType.TOUCH_CANCEL,this);
|
|
// },
|
|
onFocus: function onFocus() {
|
|
this.focus.active = true;
|
|
// this.resitEvent();
|
|
},
|
|
outFocus: function outFocus() {
|
|
this.focus.active = false;
|
|
this.select_num = 0;
|
|
nx.gui.setString(this.selectCot, "", this.mdata.quantity);
|
|
// this.offEvents();
|
|
} // touchSell(){
|
|
// nx.bridge.createPanel("WndGuildMarketBuy",{data:this.mdata,is_sell:true});
|
|
// }
|
|
});
|
|
|
|
cc._RF.pop(); |