163 lines
3.9 KiB
JavaScript
163 lines
3.9 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '0715bFRa/xDRLNoN9S3UCtt', 'cmp.skin.reward.wnd');
|
||
|
|
// Scripts/mod/partner/cmps/skin/cmp.skin.reward.wnd.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 新皮肤获取提示
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
|
||
|
|
var BridgeWindow = require("bridge.window");
|
||
|
|
var NxSpine = require("nx.fx.spine");
|
||
|
|
var HeroController = require("hero_controller");
|
||
|
|
|
||
|
|
// 准备动画
|
||
|
|
var EID_READY = "E50093";
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeWindow,
|
||
|
|
properties: {
|
||
|
|
spReady: {
|
||
|
|
"default": null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
spRole: {
|
||
|
|
"default": null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
spMini: {
|
||
|
|
"default": null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
nodAttrs: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodName: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodTake: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 重载:参数打开
|
||
|
|
onOpenConfigs: function onOpenConfigs(_params) {
|
||
|
|
var _this = this;
|
||
|
|
var sid = _params.skin_id;
|
||
|
|
var cfgs = game.configs.partner_skin_data.data_skin_info[sid];
|
||
|
|
if (nx.dt.objEmpty(cfgs)) {
|
||
|
|
nx.error("无效皮肤:", sid);
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
_this.close();
|
||
|
|
}, 0.01);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.skin = cfgs;
|
||
|
|
this.startShow();
|
||
|
|
},
|
||
|
|
// 展示
|
||
|
|
startShow: function startShow() {
|
||
|
|
var _this2 = this;
|
||
|
|
// 动画
|
||
|
|
var anim = nx.gui.getComponent(this, "", cc.Animation);
|
||
|
|
if (anim) {
|
||
|
|
anim.play("anim_show");
|
||
|
|
}
|
||
|
|
|
||
|
|
// 角色
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
_this2.showRole();
|
||
|
|
}, 0.2);
|
||
|
|
|
||
|
|
// 名字
|
||
|
|
nx.gui.setString(this.nodName, "txt", nx.text.getKey(this.skin.skin_name));
|
||
|
|
|
||
|
|
// 属性
|
||
|
|
var attrs = this.skin.skin_attr || [];
|
||
|
|
nx.gui.setActive(this.nodAttrs, "", nx.dt.arrNEmpty(attrs));
|
||
|
|
if (nx.dt.arrNEmpty(attrs)) {
|
||
|
|
var chds = this.nodAttrs.children;
|
||
|
|
nx.gui.gocChildren(this.nodAttrs, "", attrs.length, chds[0]);
|
||
|
|
for (var i = 0; i < attrs.length; ++i) {
|
||
|
|
nx.bridge.attrs.setAttribute(chds[i], attrs[i]);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 角色展示
|
||
|
|
showRole: function showRole() {
|
||
|
|
var _this3 = this;
|
||
|
|
var self = this;
|
||
|
|
|
||
|
|
// 准备动画
|
||
|
|
var path = PathTool.getSpinePath(EID_READY, "action", false);
|
||
|
|
this.spReady.node.opacity = 255;
|
||
|
|
this.spReady.load(path, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
self.spReady.action("action", false);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 1秒后渐变切换
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
nx.tween.fadeOut(_this3.spReady, "", 0.5);
|
||
|
|
}, 1);
|
||
|
|
|
||
|
|
// 角色动画
|
||
|
|
path = PathTool.getSpinePath(this.skin.res_id, "show", false);
|
||
|
|
this.spRole.node.opacity = 0;
|
||
|
|
this.spRole.stop();
|
||
|
|
this.spRole.load(path, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this3.spRole.action("action1", true);
|
||
|
|
} else {
|
||
|
|
_this3.spRole.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 迷你动画
|
||
|
|
path = PathTool.getSpinePath(this.skin.res_id, this.skin.res_id, false);
|
||
|
|
this.spMini.node.opacity = 0;
|
||
|
|
this.spMini.stop();
|
||
|
|
this.spMini.load(path, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this3.spMini.action("stand2", true);
|
||
|
|
} else {
|
||
|
|
_this3.spMini.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 0.8秒后渐变切换
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
nx.tween.fadeIn(_this3.spRole, "", 0.5);
|
||
|
|
nx.tween.fadeIn(_this3.spMini, "", 0.5);
|
||
|
|
}, 0.8);
|
||
|
|
},
|
||
|
|
// 穿戴
|
||
|
|
onTouchTake: function onTouchTake() {
|
||
|
|
var mod = HeroController.getInstance().getModel();
|
||
|
|
var bid = this.skin ? this.skin.bid : 0;
|
||
|
|
var lst = mod ? mod.getHeroListByBid(bid) : [];
|
||
|
|
if (nx.dt.arrEmpty(lst)) {
|
||
|
|
nx.tbox("该伙伴还未获得");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 最高战力排序
|
||
|
|
lst.sort(function (_a, _b) {
|
||
|
|
return _b.power - _a.power;
|
||
|
|
});
|
||
|
|
|
||
|
|
// 打开伙伴详情页
|
||
|
|
nx.bridge.createPanel("WndPartnerInfo", {
|
||
|
|
hero_vo: lst[0],
|
||
|
|
page: "skin"
|
||
|
|
});
|
||
|
|
this.close();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|