80 lines
2.7 KiB
JavaScript
80 lines
2.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '94d07TNWVZD6aTK2yktpyQJ', 'cmp.guildmarket.log');
|
|
// Scripts/mod/guild/marketplace/cmp/cmp.guildmarket.log.js
|
|
|
|
"use strict";
|
|
|
|
var BridgeCmp = require("bridge.component");
|
|
var GuildmarketplaceEvent = require("guildmarketplace_event");
|
|
var MarketMod = require("guildmarketplace_controller");
|
|
var TimeTool = require("timetool");
|
|
cc.Class({
|
|
"extends": BridgeCmp,
|
|
properties: {
|
|
scroll: {
|
|
"default": null,
|
|
type: cc.ScrollView
|
|
},
|
|
logItem: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
content: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// LIFE-CYCLE CALLBACKS:
|
|
onLoad: function onLoad() {
|
|
var _this$DoTxt;
|
|
this._super();
|
|
this.DoTxt = (_this$DoTxt = {}, _this$DoTxt[1] = nx.text.getKey("GuildMktF"), _this$DoTxt[2] = nx.text.getKey("GuildMktD"), _this$DoTxt[3] = nx.text.getKey("GuildMktG"), _this$DoTxt);
|
|
this.bindGEvent(GuildmarketplaceEvent.GUILD_MARKET_PLACE_MESSAGE_EVENT, this.updateLogs.bind(this));
|
|
},
|
|
updateLogs: function updateLogs(data) {
|
|
var list = data.board_list;
|
|
this.content.removeAllChildren();
|
|
this.content.height = 0;
|
|
for (var i in list) {
|
|
var d = list[i];
|
|
var t = cc.instantiate(this.logItem);
|
|
t.parent = this.content;
|
|
var str = this.setTxttype(d);
|
|
nx.gui.setString(t, "txt", str);
|
|
var txtNd = nx.gui.find(t, "txt");
|
|
if (txtNd) {
|
|
t.height = 80;
|
|
}
|
|
t.y = -this.content.height;
|
|
this.content.height += t.height;
|
|
}
|
|
this.scroll.scrollToTop(0.1);
|
|
},
|
|
setTxttype: function setTxttype(data) {
|
|
var str = "";
|
|
var iCfg = game.configs.guild_marketplace_data.data_item_info[data.reward_list[0].base_id];
|
|
var timex = TimeTool.getYMDHMS(data.unixtime);
|
|
if (data.type == 1) {
|
|
str = cc.js.formatStr("%s%s %s%s*%s %s", nx.text.getKey("Player"), data.name, this.DoTxt[data.operation], iCfg[1], data.reward_list[0].num, timex);
|
|
} else if (data.type == 2) {
|
|
//寶庫操作,針對過期的
|
|
str = cc.js.formatStr("%s*%s%s %s", iCfg[1], data.reward_list[0].num, this.DoTxt[data.operation], timex);
|
|
} else if (data.type == 3) {
|
|
//秘境
|
|
str = cc.js.formatStr("%s %s%s*%s %s", nx.text.getKey("GuildSecretArea"), this.DoTxt[data.operation], iCfg[1], data.reward_list[0].num, timex);
|
|
} else if (data.type == 4) {
|
|
//工會戰
|
|
str = cc.js.formatStr("%s %s%s*%s %s", nx.text.getKey("GuildBatTitle"), this.DoTxt[data.operation], iCfg[1], data.reward_list[0].num, timex);
|
|
}
|
|
return str;
|
|
},
|
|
onEnable: function onEnable() {
|
|
MarketMod.getInstance().sender26903();
|
|
},
|
|
onDisable: function onDisable() {
|
|
// 监听事件释放
|
|
this.unbindGEvents();
|
|
} // update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |