108 lines
2.9 KiB
JavaScript
108 lines
2.9 KiB
JavaScript
|
|
var BattleDramaController = require("battle_drama_controller");
|
||
|
|
var DramaEvent = require("battle_drama_event");
|
||
|
|
const ItemLayout = require( "cmp.item.layout" );
|
||
|
|
var PathTool = require("pathtool");
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
extends: cc.Component,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
curDropName:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Label
|
||
|
|
},
|
||
|
|
nodList: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
incomList: {
|
||
|
|
default: null,
|
||
|
|
type: ItemLayout
|
||
|
|
},
|
||
|
|
incomNd:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
},
|
||
|
|
mainView:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
},
|
||
|
|
beacon:{
|
||
|
|
default:null,
|
||
|
|
type:cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
|
||
|
|
onLoad () {
|
||
|
|
this.drama_controller = BattleDramaController.getInstance();
|
||
|
|
this.drama_model = this.drama_controller.getModel();
|
||
|
|
|
||
|
|
if(this.up_drop_info == null){
|
||
|
|
this.up_drop_info = gcore.GlobalEvent.bind(DramaEvent.UpDramaDropInfo,this.updateDramaDropInfo.bind(this));
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
start () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onEnable(){
|
||
|
|
this.updateDramaDropInfo();
|
||
|
|
},
|
||
|
|
|
||
|
|
touchShow(){
|
||
|
|
nx.gui.setActive( this.mainView, "", !this.mainView.active );
|
||
|
|
this.beacon.scaleY = -this.beacon.scaleY;
|
||
|
|
// nx.gui.setActive( this.incomNd, "", !this.incomNd.active );
|
||
|
|
},
|
||
|
|
|
||
|
|
//------------------资产掉落
|
||
|
|
// 更新副本掉落物品展示信息
|
||
|
|
updateDramaDropInfo: function () {
|
||
|
|
// if (!this.is_onshow) return;
|
||
|
|
var drama_data = this.drama_model.getDramaData();
|
||
|
|
if(nx.dt.objEmpty(drama_data)){
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (this.cur_drama_max_id == drama_data.max_dun_id) return;
|
||
|
|
this.cur_drama_max_id = drama_data.max_dun_id;
|
||
|
|
if (this.cur_drama_max_id == 0) {
|
||
|
|
this.cur_drama_max_id = 10010;
|
||
|
|
}
|
||
|
|
var drama_config = game.configs.dungeon_data.data_drama_dungeon_info[this.cur_drama_max_id];
|
||
|
|
if(nx.dt.objEmpty(drama_config)){
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.curDropName.string = nx.text.getKey("tip_battle_button_title6");
|
||
|
|
|
||
|
|
this.updatePerHookInfo(drama_config);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 掉落资产信息展示
|
||
|
|
updatePerHookInfo: function (config) {
|
||
|
|
var item_datas = config.per_hook_items;
|
||
|
|
|
||
|
|
let setProp = (_node,_data)=>{
|
||
|
|
let cfg = gitemdata(_data[0]);
|
||
|
|
|
||
|
|
nx.gui.setSpriteFrame(_node,"icon",PathTool.querySmallIconPath(cfg.icon));
|
||
|
|
nx.gui.setString(_node,"num",cc.js.formatStr("%s/m",_data[1]));
|
||
|
|
}
|
||
|
|
|
||
|
|
// 列表创建
|
||
|
|
const chds = this.nodList.children;
|
||
|
|
nx.gui.gocChildren( this.nodList, "", item_datas.length, chds[ 0 ] );
|
||
|
|
for( let i = 0; i < item_datas.length; ++i ) {
|
||
|
|
setProp( chds[ i ], item_datas[ i ] );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
//------------------资产掉落
|
||
|
|
|
||
|
|
// update (dt) {},
|
||
|
|
});
|