63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'b0070E1E3JGh5F+DE6FsTUQ', 'cmp.online.item');
|
|
// Scripts/mod/battle_drama/onlinegift/cmp/cmp.online.item.js
|
|
|
|
"use strict";
|
|
|
|
var ItemBase = require("cmp.item.base");
|
|
var NxSpine = require("nx.fx.spine");
|
|
var BackPackConst = require("backpack_const");
|
|
var OnlinegiftController = require("onlinegift_controller");
|
|
cc.Class({
|
|
"extends": ItemBase,
|
|
properties: {
|
|
imgframe: {
|
|
"default": null,
|
|
type: cc.Button
|
|
},
|
|
spBlink: {
|
|
"default": null,
|
|
type: NxSpine
|
|
}
|
|
},
|
|
onGetReward: function onGetReward() {
|
|
if (nx.dt.objEmpty(this.mdata)) {
|
|
return false;
|
|
}
|
|
if (this.mdata.status == 0) return;
|
|
OnlinegiftController.getInstance().send10927(this.mdata.config.index);
|
|
},
|
|
onFocus: function onFocus() {},
|
|
freshAll: function freshAll() {
|
|
this._super();
|
|
this.setLockStatus(this.mdata.status);
|
|
},
|
|
setLockStatus: function setLockStatus(status) {
|
|
var _this = this;
|
|
if (status == 0) {
|
|
this.spBlink.stop();
|
|
this.imgframe.enabled = false;
|
|
this.imgframe.interactable = false;
|
|
nx.gui.setActive(this, "got", true);
|
|
} else if (status == 1) {
|
|
this.imgframe.enabled = true;
|
|
this.imgframe.interactable = true;
|
|
var res_path = PathTool.getSpinePath("E80030", false);
|
|
this.spBlink.load(res_path, function (_e) {
|
|
if (!_e) {
|
|
_this.spBlink.action("action", true);
|
|
} else {
|
|
_this.spBlink.stop();
|
|
}
|
|
});
|
|
nx.gui.setActive(this, "got", false);
|
|
} else {
|
|
this.spBlink.stop();
|
|
this.imgframe.enabled = true;
|
|
this.imgframe.interactable = true;
|
|
nx.gui.setActive(this, "got", false);
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |