"use strict"; cc._RF.push(module, '89c67DBr39CD6o7N3bQ7Nnc', 'cmp.summon.animation.card'); // Scripts/mod/summon/animation/cmp.summon.animation.card.js "use strict"; /****************************************************************** * Copyright(C) 2019 - 2020 Nx Studio * * 抽卡召唤动画卡片 * ******************************************************************/ var NxSpine = require("nx.fx.spine"); var SummonMod = require("summon.mod"); cc.Class({ "extends": cc.Component, properties: { spFrame: { "default": null, type: NxSpine } }, // 翻卡 flip: function flip(_info) { var key = _info.partner_bid + "_" + _info.init_star; var base = game.configs.partner_data.data_partner_base[_info.partner_bid]; var info = gdata("partner_data", "data_partner_star", key); if (!base || !info) { this.infos = null; this.node.opacity = 0; nx.error("$FlipCard:无效伙伴", key); return; } // 信息汇总 this.infos = { bid: base.bid, name: base.name, camp: base.camp_type, quality: base.quality, star: info.star, res: info.res_id, args: nx.dt.objClone(_info) }; // 展示 this.clear(); this.show(); }, // 卡片清理 clear: function clear() { nx.gui.setSpriteFrame(this, "camp", null); nx.gui.setSpriteFrame(this, "star", null); nx.gui.setSpriteFrame(this, "mask/img", null); nx.gui.setSpriteFrame(this, "qa", null); nx.gui.setSpriteFrame(this, "bg", null); }, // 展示 show: function show() { var _this = this; this.node.opacity = 255; // 阵营标记 var path = cc.path.join("coms/images", "camps" + this.infos.camp); nx.gui.setSpriteFrame(this, "camp", path); // 星级 path = cc.path.join("coms/images", "star" + this.infos.star); nx.gui.setSpriteFrame(this, "star", path); // 角色 path = cc.path.join("resDB/models", this.infos.res, "half_show2"); nx.gui.setSpriteFrame(this, "mask/img", path, function (_ret) { if (!_ret) { nx.gui.setSpriteFrame(_this, "mask/img", "resDB/empty/half_show2"); } }); // 品质&&背景&&边框 var qa = ""; var showqa = ""; var frame = ""; var bg = cc.path.join("prefab/summon/animation/images", "bg3"); if (this.infos.star >= 5) { // SSR bg = cc.path.join("prefab/summon/animation/images", "bg4"); switch (this.infos.quality) { case 6: { showqa = "mk_partner_qa6"; } ; break; case 5: { showqa = "mk_partner_qa5"; } ; break; case 4: { showqa = "mk_partner_qa4"; } ; break; case 3: { showqa = "mk_partner_qa3"; } ; break; } qa = cc.path.join("coms/images", showqa); frame = cc.path.join("prefab/summon/animation/spines/ssr/action"); } else if (this.infos.star == 4) { // SR qa = cc.path.join("coms/images", "mk_partner_qa3"); frame = cc.path.join("prefab/summon/animation/spines/sr/action"); } nx.gui.setSpriteFrame(this, "qa", qa); nx.gui.setSpriteFrame(this, "bg", bg); if (nx.dt.strEmpty(frame)) { this.spFrame.stop(); } else { this.spFrame.play(frame, "action", function (_key) { if (_key == "complete") { _this.spFrame.action("action2", true); } }, false); } }, // 点击 onTouch: function onTouch() { if (nx.dt.objEmpty(this.infos) || nx.dt.objEmpty(this.infos.args)) { return; } var SC = SummonMod.getInstance(); var partners = [this.infos.args]; SC.openSummonGainShowWindow(true, partners); } }); cc._RF.pop();