113 lines
3.0 KiB
JavaScript
113 lines
3.0 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '11933aDNyNKerOkmLu8941t', 'cmp.act.stepup.preview');
|
|
// Scripts/mod/acts/stepup/cmp/cmp.act.stepup.preview.js
|
|
|
|
"use strict";
|
|
|
|
/******************************************************************
|
|
* Copyright(C) 2019 - 2020 Nx Studio
|
|
*
|
|
* STEP-UP 预览页
|
|
*
|
|
******************************************************************/
|
|
|
|
var BridgeComponent = require("bridge.component");
|
|
var STModel = require("act.stepup.mod");
|
|
var NxSpine = require("nx.fx.spine");
|
|
cc.Class({
|
|
"extends": BridgeComponent,
|
|
properties: {
|
|
spRole: {
|
|
"default": null,
|
|
type: NxSpine
|
|
},
|
|
spMini: {
|
|
"default": null,
|
|
type: NxSpine
|
|
},
|
|
ndInfo: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
ndRTS: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 显示
|
|
onEnable: function onEnable() {
|
|
var _this = this;
|
|
var configs = STModel.getInstance().getConfig();
|
|
|
|
// const bid = 10507;
|
|
var bid = configs.cfgs.partner_bid;
|
|
var dat = game.configs.partner_data.data_partner_base[bid];
|
|
var star = dat.init_star || (dat ? dat.star : 0);
|
|
var scfgs = gdata("partner_data", "data_partner_star", bid + "_" + star);
|
|
if (nx.dt.objEmpty(scfgs)) {
|
|
nx.error("STEP-UP 角色无效:", bid);
|
|
return;
|
|
}
|
|
|
|
// 名字
|
|
nx.gui.setString(this.ndInfo, "name", nx.text.getKey(dat.name));
|
|
|
|
// 角色动画
|
|
path = PathTool.getSpinePath(scfgs.res_id, "show", false);
|
|
this.spRole.load(path, function (_e) {
|
|
if (!_e) {
|
|
_this.spRole.action("action1", true);
|
|
} else {
|
|
_this.spRole.stop();
|
|
}
|
|
});
|
|
|
|
// MINI动画
|
|
path = PathTool.getSpinePath(scfgs.res_id, scfgs.res_id, false);
|
|
this.spMini.load(path, function (_e) {
|
|
if (!_e) {
|
|
_this.spMini.action("stand2", true);
|
|
} else {
|
|
_this.spMini.stop();
|
|
}
|
|
});
|
|
|
|
// 技能
|
|
var sknode = nx.gui.find(this, "infos/skills");
|
|
for (var i = 0; i < sknode.children.length; ++i) {
|
|
// 技能数组[0]为普攻,直接忽略,最多4个技能
|
|
var item = sknode.children[i];
|
|
var sifo = scfgs.skills[i + 1];
|
|
if (!sifo) {
|
|
item.active = false;
|
|
continue;
|
|
}
|
|
item.active = true;
|
|
var cmp = nx.gui.getComponent(item, "", "cmp.skill.base");
|
|
if (cmp) {
|
|
cmp.setData(sifo[1]);
|
|
}
|
|
}
|
|
|
|
// 广告图
|
|
path = cc.path.join("resDB/acts/steps", "001", nx.getLocLanguage() + "_preview");
|
|
// path = cc.path.join( "locals", nx.getLocLanguage(), "images/acts", "step002" );
|
|
nx.gui.setSpriteFrame(this.ndRTS, "img", path);
|
|
|
|
// 开启日期
|
|
var txt = "";
|
|
var now = new Date();
|
|
var time = configs.cfgs.start_time1;
|
|
// let time = [2023, 4, 26, 0, 0, 0];
|
|
if (now.getFullYear() != time[0]) {
|
|
txt += nx.text.format("SYear", time[0]);
|
|
}
|
|
txt += nx.text.format("SMonth", time[1]);
|
|
txt += nx.text.format("SDay", time[2]);
|
|
nx.gui.setString(this.ndRTS, "open/txt", nx.text.format("StepUpPreviewOpen", txt));
|
|
},
|
|
// 皮肤预览
|
|
onSkinPreview: function onSkinPreview() {}
|
|
});
|
|
|
|
cc._RF.pop(); |