69 lines
1.8 KiB
JavaScript
69 lines
1.8 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'b6744YDsQtJc6dNv3TDjbPv', 'cmp.guildbat.item.seat');
|
|
// Scripts/mod/guild/guildbat/cmp/cmp.guildbat.item.seat.js
|
|
|
|
"use strict";
|
|
|
|
var GuildBatMod = require("guildbat.mod");
|
|
var GuildwarConst = require("guildbat.define");
|
|
var GuildMainCmp = require("cmp.guildbat.main");
|
|
cc.Class({
|
|
"extends": cc.Component,
|
|
properties: {
|
|
posOrder: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
powerNum: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
occupFlag: {
|
|
//正在攻占的標志
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
mainCmp: {
|
|
"default": null,
|
|
type: GuildMainCmp
|
|
}
|
|
},
|
|
setData: function setData(data) {
|
|
if (nx.dt.objEmpty(data)) {
|
|
nx.warn("公會戰據點數據異常");
|
|
return;
|
|
}
|
|
this.data = data;
|
|
var cfg = game.configs.guild_war_data.data_position[data.pos];
|
|
if (cfg) {
|
|
this.node.x = cfg.pos_x;
|
|
this.node.y = cfg.pos_y;
|
|
}
|
|
nx.gui.setString(this.posOrder, "", data.pos);
|
|
nx.gui.setString(this.powerNum, "", data.power);
|
|
nx.gui.setActive(this.occupFlag, "", data.hp == 0);
|
|
for (var i = 3; i > data.hp; i--) {
|
|
nx.gui.setActive(this, String(i) + "/star", false);
|
|
}
|
|
var pos_type = this.mainCmp.getPositionType();
|
|
this.pos_type = pos_type;
|
|
if (pos_type == GuildwarConst.positions.others) {
|
|
nx.gui.setActive(this, "other", true);
|
|
} else {
|
|
nx.gui.setActive(this, "self", true);
|
|
}
|
|
},
|
|
touchPosInfo: function touchPosInfo() {
|
|
if (this.data.status == 1) {
|
|
return nx.tbox("GuildBatAtki");
|
|
}
|
|
if (GuildBatMod.getInstance().getGuildWarStatus() == 5) {
|
|
return nx.tbox("GuildBatEnd");
|
|
}
|
|
if (this.pos_type == GuildwarConst.positions.others) {
|
|
GuildBatMod.getInstance().requestEnemyPositionData(this.data.pos);
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |