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

77 lines
2.3 KiB
JavaScript

const ItemLay = require("cmp.common.itemlayout");
const HeroNewChalMod = require("act.heronewchal.mod");
const HCT = require( "hero_controller" );
const PartnerConst = require( "partner_const" );
cc.Class({
extends: cc.Component,
properties: {
rewards:{
default:null,
type:ItemLay
},
orderLev:{
default:null,
type:cc.Node
},
orderName:{
default:null,
type:cc.Node
},
batNd:{
default:null,
type:cc.Node
},
getNd:{
default:null,
type:cc.Node
},
maskNd:{
default:null,
type:cc.Node
},
day_id:0
},
setData(data){
if(nx.dt.objEmpty(data))return;
this.data = data;
this.maskNd.active = false;
if(data.status1 == 1){
if(data.status2 == 2){
this.maskNd.active = true;
}
nx.gui.setActive(this.batNd,"",data.status2 == 0);
nx.gui.setActive(this.getNd,"",data.status2 == 1);
}else{
this.maskNd.active = true;
let cur_day = HeroNewChalMod.getInstance().getCurDay();
let next_day = HeroNewChalMod.getInstance().getNextDay();
if(cur_day == data.id){
nx.gui.setString(this.maskNd,"lock/txt",cc.js.formatStr(nx.text.getKey("DayNeedLock"),next_day));
}else{
nx.gui.setString(this.maskNd,"lock/txt",nx.text.getKey("Locked"));
}
}
nx.gui.setActive(this.maskNd,"got",data.status2 == 2);
nx.gui.setActive(this.maskNd,"lock",data.status1 == 0);
let info = game.configs.fake_battle_data.data_new_info[HeroNewChalMod.getInstance().getCampId()][data.id];
if(info){
nx.gui.setString(this.orderLev,"",info.id);
nx.gui.setString(this.orderName,"",info.name);
this.rewards.rebuild(info.reward);
}
},
clickBat(){
if(!this.data)return;
HCT.getInstance().openFormGoFightPanel( true, PartnerConst.Fun_Form.Encounter, {id:this.data.id}, 1, false);
},
clickReward(){
if(!this.data)return;
HeroNewChalMod.getInstance().send31002(this.data.id);
}
});