Files
fc/dev/project/library/imports/a4/a473afa9-ffa5-49a4-a3ff-41d9e20f81e2.js
2026-05-24 10:21:26 +08:00

274 lines
8.4 KiB
JavaScript

"use strict";
cc._RF.push(module, 'a473a+p/6VJpKP/QdniD4Hi', 'cmp.partner.baseinfo');
// Scripts/mod/partner/cmps/basic/cmp.partner.baseinfo.js
"use strict";
/******************************************************************
*
* 伙伴信息页 --- 基础展示
*
******************************************************************/
var BridgeComponent = require("bridge.component");
var NxSpine = require("nx.fx.spine");
var CpartnerBody = require("cmp.partner.body.show");
var HeroConst = require("hero_const");
var HeroEvent = require("hero_event");
var TipsController = require("tips_controller");
var HeroController = require("hero_controller");
var HomeMod = require("home.mod");
var FID = require("bridge.function.ids");
cc.Class({
"extends": BridgeComponent,
properties: {
spRole: {
"default": null,
type: CpartnerBody
},
spMini: {
"default": null,
type: NxSpine
},
nodInfo: {
"default": null,
type: cc.Node
},
nodLike: {
"default": null,
type: cc.Node
},
nodOps: {
"default": null,
type: cc.Node
},
nodTrial: {
"default": null,
type: cc.Node
}
},
// 显示
onLoad: function onLoad() {
this.partner = {};
// 视图监听
this.vbind([["ShowPartner", this.onPartnerChanged.bind(this)]]);
// 事件监听
// this.bindGEvent( HeroEvent.Hero_Data_Update, this.onPartnerUpdate.bind( this ) );
},
onDestroy: function onDestroy() {
this.partner = {};
nx.bridge.vset("ShowPartner", {});
this._super();
},
// 置空
setEmpty: function setEmpty() {
if (this.spRole.spRole) {
this.spRole.spRole.stop();
this.spRole.spRole.node.active = false;
this.spMini.stop();
this.spMini.node.active = false;
nx.gui.setActive(this, "qa", false);
nx.gui.setActive(this.nodInfo, "", false);
nx.gui.setActive(this.nodLike, "", false);
nx.gui.setActive(this.nodOps, "", false);
}
},
// 有伙伴数据更新
onPartnerUpdate: function onPartnerUpdate(_vo) {
if (_vo && this.partner && _vo.partner_id == this.partner.partner_id) {
this.onPartnerChanged(_vo, true);
}
},
// 更新伙伴
onPartnerChanged: function onPartnerChanged(_partner, _update) {
var update = false;
if (nx.dt.objNEmpty(this.partner)) {
if (this.partner.bid == _partner.bid) {
update = true;
} else {
update = false;
}
}
this.partner = _partner;
// 置空
if (nx.dt.objEmpty(this.partner)) {
this.setEmpty();
return;
}
// if( this.spRole.spRole.node.active ) {
// update = true;
// }else{
// update = false;
// }
nx.gui.setActive(this.nodInfo, "", true);
nx.gui.setActive(this.nodLike, "", true);
nx.gui.setActive(this.nodOps, "", true);
nx.gui.setActive(this.nodOps, "like/like_popup", false);
nx.gui.setActive(this.nodInfo, "camp/img", false);
nx.gui.setActive(this.nodOps, "lock/off", this.partner.is_lock == 0);
nx.gui.setActive(this.nodOps, "lock/on", this.partner.is_lock != 0);
nx.gui.setActive(this.nodOps, "back", this.partner.lev != 1);
var desc = game.configs.partner_data.data_partner_base[this.partner.bid];
// 单次设置
if (update != true) {
// 名字
nx.gui.setString(this.nodInfo, "names/name", this.partner.name);
nx.gui.setString(this.nodInfo, "names/ename", this.partner.e_name);
// 品质
var _path = cc.path.join("coms/images", "mk_partner_qa" + this.partner.quality);
nx.gui.setSpriteFrame(this, "qa/qa", _path);
var noddd = nx.gui.find(this, "qa/qa/spine");
if (noddd) {
nx.gui.setActive(noddd, "", this.partner.quality == 5);
}
// 職業
var career = this.partner.type || 4;
var icon = cc.path.join("coms/images", "career" + career);
var name = nx.text.getKey(HeroConst.CareerName[career]) || nx.text.getKey("lab_none");
nx.gui.setString(this, "qa/career/career", nx.text.getKey(name));
nx.gui.setSpriteFrame(this, "qa/career/ico", icon);
// 描述
nx.gui.setString(this, "qa/desc/txt", desc ? desc.introduce_str : "");
nx.gui.setActive(this, "qa/desc", desc);
// 阵营
_path = cc.path.join("prefab/partner/ui/camp" + this.partner.camp_type);
nx.gui.setString(this.nodInfo, "camp/img/txt", nx.text.getKey("AnyNameCampName" + this.partner.camp_type));
nx.gui.setSpriteFrame(this.nodInfo, "camp", _path);
// 动画
this.freshSpines();
}
// 等级
nx.gui.setString(this.nodInfo, "lv", "Lv." + this.partner.lev || 1);
// 星级
var path = cc.path.join("coms/images", "star" + this.partner.star);
nx.gui.setSpriteFrame(this.nodInfo, "stars", path);
nx.gui.setString(this.nodInfo, "power/nod/power", this.partner.power);
// 亲密度
if (!game.configs.favor_data) {
nx.gui.setActive(this.nodOps, "gift", false);
nx.gui.setActive(this.nodOps, "like", false);
} else {
var girl = HomeMod.getInstance().queryGirl(this.partner.bid);
if (girl) {
nx.gui.setActive(this.nodOps, "gift", true);
nx.gui.setActive(this.nodOps, "like", true);
nx.gui.setString(this.nodOps, "like/count/txt", girl.intimacy_lev);
nx.gui.setString(this.nodOps, "like/like_popup/like_txts/lev", girl.intimacy_lev);
} else {
nx.gui.setActive(this.nodOps, "gift", false);
nx.gui.setActive(this.nodOps, "like", false);
}
}
nx.gui.setActive(this, "qa", true);
// 試用英雄
if (this.partner.trial_end_time > 0) {
nx.gui.setActive(this.nodTrial, "", true);
var cds = this.partner.trial_end_time - client.socket.getTime();
nx.gui.setCdTxt(this.nodTrial, "txt", cds);
} else {
nx.gui.setActive(this.nodTrial, "", false);
}
},
// 刷新模型显示
freshSpines: function freshSpines() {
var _this = this;
var sinfo = nx.bridge.partner.getShowInfo(this.partner);
if (!sinfo) {
this.spRole.spRole.stop();
this.spRole.spRole.node.active = false;
this.spMini.stop();
this.spMini.node.active = false;
return;
}
// 展示
this.spRole.setPartner(this.partner);
// 战斗迷你
this.spMini.load(sinfo.sp_model, function (_e) {
if (!_e) {
_this.spMini.action("stand2", true);
_this.spMini.node.active = true;
} else {
_this.spMini.stop();
_this.spMini.node.active = false;
}
});
},
// 鎖定
onTouchLock: function onTouchLock() {
if (this.partner.resonate_lev != 0) {
nx.tbox("HomeCenterTip");
return;
}
var lock = this.partner.is_lock;
HeroController.getInstance().sender11015(this.partner.partner_id, lock == 0);
},
// 点赞
onTouchLike: function onTouchLike() {
nx.gui.setString(nx.gui.find(this.nodOps, "like/like_popup/like_txts/title"), "", nx.text.getKey("Current intimacy level"));
nx.gui.setActive(this.nodOps, "like/like_popup", !nx.gui.find(this.nodOps, "like/like_popup").active);
},
// 点赞
onTouchBack: function onTouchBack() {
this.unscheduleAllCallbacks();
if (this.partner.is_lock) {
nx.tbox("LockTip");
return;
}
nx.bridge.vset("PartnerBack", this.partner);
nx.bridge.jumper.jump2Window(FID.Back);
var cmp = nx.gui.getComponent(this.node.parent.parent, "", "cmp.partner.info.wnd");
if (cmp) {
this.scheduleOnce(function () {
cmp.close();
}, 0.3);
}
},
// 观察
onTouchWatch: function onTouchWatch() {
HeroController.getInstance().openHeroLookDrawWindowTest(true, this.partner);
},
// 礼物
onTouchGift: function onTouchGift() {
nx.bridge.createPanel("WndHome");
this.scheduleOnce(function () {
nx.bridge.createPanel("WndBedroom");
}, 0.2);
},
// 皮肤
onTouchSkin: function onTouchSkin() {},
// 人物介绍
onTouchStory: function onTouchStory() {
// const TC = TipsController.getInstance();
// let txt = nx.text.getKey( "story" + this.partner.bid );
// TC.showTextPanel( "PartnerStory", txt );
nx.bridge.createPanel("WndLibraryPartner", {
bid: this.partner.bid,
auto: false
});
},
onTouchCamp: function onTouchCamp() {
var _this2 = this;
this.unscheduleAllCallbacks();
nx.gui.setActive(this.nodInfo, "camp/img", true);
this.scheduleOnce(function () {
nx.gui.setActive(_this2.nodInfo, "camp/img", false);
}, 2);
}
});
cc._RF.pop();