Files
fc/dev/project/assets/Scripts/mod/open_server/cmp.item.act.openserver.wnd.js
T
2026-05-23 22:10:14 +08:00

168 lines
4.4 KiB
JavaScript

const SvcItem = require("nx.fx.sv.expand.item");
const BaseLayout = require( "cmp.common.itemlayout" );
const themeMod = require( "acts.mod" );
const RoleController = require( "role_controller" );
cc.Class({
extends: SvcItem,
properties: {
lay:{
default:null,
type:BaseLayout
},
name_lb:{
default:null,
type:cc.Label
},
name_desc:{
default:null,
type:cc.RichText
},
name_level:{
default:null,
type:cc.Label
},
goto_btn:{
default:null,
type:cc.Node
},
notOpenText:{
default:null,
type:cc.Node
},
notOpenText2:{
default:null,
type:cc.Node
},
nodTip:{
default:null,
type:cc.Node
},
},
// LIFE-CYCLE CALLBACKS:
// 数据重置
rebind: function( _idx, _data, _key ) {
this._super( _idx, _data, _key );
// 刷新
this.setData(_data,_key)
},
onLoad () {
},
start () {
},
onDisable(){
this.lay.rebuild([]);
},
setData(data,_key){
if(nx.dt.objEmpty(data)){
return false;
}
this.name_lb.string = data.name;
this.name_desc.string = data.desc;
var str = cc.js.formatStr(nx.text.getKey("action_str36"), data.lv);
this.name_level.string = str;
// 展示掉落物品
this.updateDramaDropInfo(data.items);
//判断活动有没有开启
this.goto_btn.active = false;
this.nodTip.active = data.tip?true:false;
this.notOpenText.active = false;
this.notOpenText2.active = false;
this.source_id = data.source_id;
switch(this.source_id)
{
case 334: //七日特訓
{
var theme = themeMod.getInstance().queryThemeBySource( this.source_id );
if(theme)
this.goto_btn.active = true;
else
this.notOpenText.active = true;
}
break;
case 367: //自選派對
case 454: //百抽盛宴
case 354: //成長衝刺
{
var theme = themeMod.getInstance().queryTheme( 101 );
if(theme)
{
var bFind = false
for( let k in theme.theme_holiday_list )
{
let act = theme.theme_holiday_list[ k ];
if( act && act.source == this.source_id )
{
bFind = true
this.goto_btn.active = true;
this.camp_id = act.camp_id;
break;
}
}
if(bFind == false)
this.notOpenText.active = true;
}
else
this.notOpenText.active = true;
}
break;
}
if(this.notOpenText.active)
{
var binder = RoleController.getInstance().getRoleVo();
if(binder.lev < data.lv)
{
this.notOpenText.active = false;
this.notOpenText2.active = true;
}
}
},
// 更新副本掉落物品展示信息
updateDramaDropInfo: function (item_datas) {
if(nx.dt.arrEmpty(item_datas)){
return false;
}
// 创建物品显示对象,只展示1个
let list = [];
for (let index = 0; index < item_datas.length; index++) {
const element = item_datas[index];
list.push({ bid: element[0], num: element[1] });
}
this.lay.rebuild(list);
},
touchGoto()
{
nx.bridge.closePanel("WndOpenServer");
cc.sys.localStorage.setItem( "needBackOpenServerAct", 1);
switch(this.source_id)
{
case 334: //七日特訓
nx.bridge.createPanel( "WndActTraining7" ); break;
case 367: //自選派對
case 454: //百抽盛宴
case 354: //成長衝刺
nx.bridge.jumper.jump2ActTheme( 101, this.camp_id );
break;
}
}
// update (dt) {},
});