"use strict"; cc._RF.push(module, 'c4bd28h05xEXKMkm5pMY1JW', 'cmp.item.battledrama.form'); // Scripts/mod/battle_drama/cmp/form/cmp.item.battledrama.form.js "use strict"; var SvcItem = require("nx.fx.sv.expand.item"); var PathTool = require("pathtool"); cc.Class({ "extends": SvcItem, properties: { smod: { "default": null, type: cc.Prefab }, player: { "default": null, type: cc.Node }, circle: { "default": null, type: sp.Skeleton } }, // LIFE-CYCLE CALLBACKS: // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.setData(_data); }, onLoad: function onLoad() {}, start: function start() {}, onFocus: function onFocus() { if (nx.dt.objEmpty(this.mdata)) { return false; } }, outFocus: function outFocus() {}, setData: function setData(data) { var _this = this; this.resetPlayerPos(); if (this.splayer) { var cmp = nx.gui.getComponent(this.splayer, "", "cmp.partner.smod"); this.splayer.active = false; cmp.setEmpty(); } if (nx.dt.objEmpty(data)) { //加载一个灰色特效 return false; } this.scheduleOnce(function () { _this.splayer = cc.instantiate(_this.smod); _this.splayer.parent = _this.player; _this.splayer.position = cc.v2(0, 0); var cmp = nx.gui.getComponent(_this.splayer, "", "cmp.partner.smod"); cmp.setData(_this.mdata, true); }, 0.1); }, onDisable: function onDisable() {}, circlePlay: function circlePlay(type) { this.circle.clearTracks(); var effect_id = "blue"; if (this.mdata.camp_type == 2) { effect_id = "red"; } else if (this.mdata.camp_type == 3) { effect_id = "green"; } else if (this.mdata.camp_type == 4) { effect_id = "yellow"; } else if (this.mdata.camp_type == 5) { effect_id = "puple"; } var action_str = cc.js.formatStr("action%s_%s", type, effect_id); this.circle.setAnimation(0, action_str, false); }, resetPlayerPos: function resetPlayerPos() { this.player.active = true; this.player.position = cc.v2(0, -65); } // update (dt) {}, }); cc._RF.pop();