const ItemBase = require( "nx.fx.sv.expand.item" ); cc.Class({ extends: ItemBase, properties: { select_tab:{ default:null, type:cc.Node }, off_txt:{ default:null, type:cc.Label }, select_txt:{ default:null, type:cc.Label } }, // LIFE-CYCLE CALLBACKS: onLoad () { }, // 数据重置 rebind: function( _idx, _data, _key ) { this._super( _idx, _data, _key ); // 刷新 this.setData( _data ); }, setData(data){ if(nx.dt.objEmpty(data)){ return false; } this.data = data; this.off_txt.string = game.configs.dungeon_stone_data.data_type_open[this.data.id].name; this.select_txt.string = game.configs.dungeon_stone_data.data_type_open[this.data.id].name; let id = game.configs.dungeon_stone_data.data_type_open[this.data.id].activate; if( id ){ let cmp = nx.gui.getComponent( this, "lock", "bridge.condition.locker" ); if( cmp ){ cmp.setCondition( id ); } } //紅點處理 let dot = nx.gui.getComponent( this, "tip", "nx.vb.visible" ); let cfgs = game.configs.source_data.data_source_data[ id ]; if( !cfgs ) { nx.gui.setActive( dot, "", false ); return; } if(cfgs.lev_limit){ this.result = nx.bridge.checkConditions( cfgs.lev_limit ); if(!nx.dt.objNEmpty(this.result)){ if( !dot ) { nx.gui.setActive( dot, "", false ); } else { let key = cc.js.formatStr("pve.dungeon.%s",data.id); dot.setTarget( nx.mTip, key ); } } return; } nx.gui.setActive( dot, "", false ); }, onFocus(){ this.select_tab.active = true; }, outFocus(){ this.select_tab.active = false; } // update (dt) {}, });