1224 lines
44 KiB
JavaScript
1224 lines
44 KiB
JavaScript
|
|
var BridgeWindow = require( "bridge.window" );
|
||
|
|
var DramaEvent = require( "battle_drama_event" );
|
||
|
|
var TimeTool = require( "timetool" );
|
||
|
|
var OnlineGiftController = require( "onlinegift_controller" )
|
||
|
|
var OnlineGiftEvent = require( "onlinegift_event" );
|
||
|
|
var HallowsEvent = require( "hallows_event" );
|
||
|
|
var RCT = require( "role_controller" );
|
||
|
|
const BTD = require( "battle_drama_controller" );
|
||
|
|
const BTC = require( "battle_controller" );
|
||
|
|
const HSC = require( "hallows_controller" );
|
||
|
|
const PathTool = require( "pathtool" );
|
||
|
|
const HeroConst = require( "hero_const" );
|
||
|
|
const NxSpine = require( "nx.fx.spine" );
|
||
|
|
const DramaSpecial = require( "cmp.battledrama.special" );
|
||
|
|
const DramaConst = require( "battle_drama_event" );
|
||
|
|
const { SCENE_TAG } = require( "define" );
|
||
|
|
|
||
|
|
const { PlayerAction } = require( "define" );
|
||
|
|
const FID = require( "bridge.function.ids" );
|
||
|
|
const RoleController = require( "role_controller" );
|
||
|
|
const FxBGM = require("nx.fx.BGM");
|
||
|
|
const { CKeys } = require( "bridge.conditions" );
|
||
|
|
const data2Icon = require( "bridge.utils.item" );
|
||
|
|
|
||
|
|
cc.Class( {
|
||
|
|
extends: BridgeWindow,
|
||
|
|
|
||
|
|
properties: {
|
||
|
|
bgnCmp:{
|
||
|
|
default:null,
|
||
|
|
type:FxBGM
|
||
|
|
},
|
||
|
|
bottom_container: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
res_skeleton: {
|
||
|
|
default: null,
|
||
|
|
type: sp.Skeleton
|
||
|
|
},
|
||
|
|
res_model: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
time_label: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Label
|
||
|
|
},
|
||
|
|
quick_btn: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Button
|
||
|
|
},
|
||
|
|
// receivenode: {
|
||
|
|
// default: null,
|
||
|
|
// type: cc.Node
|
||
|
|
// },
|
||
|
|
// receivename: {
|
||
|
|
// default: null,
|
||
|
|
// type: cc.Label
|
||
|
|
// },
|
||
|
|
passnode: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
passnode_name_txt: {
|
||
|
|
default: null,
|
||
|
|
type: cc.RichText
|
||
|
|
},
|
||
|
|
pass_dungeon_name: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Label
|
||
|
|
},
|
||
|
|
passTag: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
mapname: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Label
|
||
|
|
},
|
||
|
|
chapName: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Label
|
||
|
|
},
|
||
|
|
hallowNd: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
collectNd: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
fabItem: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Prefab
|
||
|
|
},
|
||
|
|
passEft: {
|
||
|
|
default: null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
// speGift: {
|
||
|
|
// default: null,
|
||
|
|
// type: DramaSpecial
|
||
|
|
// },
|
||
|
|
bossSp: {
|
||
|
|
default: null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
bossBtn: {
|
||
|
|
default: null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
rewardSpriteBack:{
|
||
|
|
default: null,
|
||
|
|
type: cc.Sprite
|
||
|
|
},
|
||
|
|
rewardNormalSpriteFrame:{
|
||
|
|
default: null,
|
||
|
|
type: cc.SpriteFrame
|
||
|
|
},
|
||
|
|
rewardSepSpriteFrame:{
|
||
|
|
default: null,
|
||
|
|
type: cc.SpriteFrame
|
||
|
|
},
|
||
|
|
},
|
||
|
|
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
|
||
|
|
onLoad() {
|
||
|
|
|
||
|
|
if( nx.bridge.vget( "gm" ) ) {
|
||
|
|
|
||
|
|
var GmCmd = require( "gmcmd" );
|
||
|
|
GmCmd.show();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
this.battle_controller = require( "battle_controller" ).getInstance();
|
||
|
|
this.resources_action = null;
|
||
|
|
this.is_onshow = false;
|
||
|
|
this.res_skeletonData = null;
|
||
|
|
this.challenge_condition = { status: 0, lev: 0 }; // 挑战BOSS的按钮状态
|
||
|
|
|
||
|
|
this.fly_item_pools = new cc.NodePool(); // 假战斗对象池列表,根据物品icon区分
|
||
|
|
this.auto_id = 0; // 当前假战斗的物品列表
|
||
|
|
this.fly_item_list = {}; // 储存当前生成的资产item
|
||
|
|
|
||
|
|
this.cur_hallows_id = 0;
|
||
|
|
this.cur_chapter_id = null;
|
||
|
|
this.hallow_spine_path = "";
|
||
|
|
this.guildsign_open = false; //快速作战是否开启;
|
||
|
|
// this.receivenode.active = false;
|
||
|
|
|
||
|
|
//缓存下通关奖励表,因为要排序
|
||
|
|
this.pass_reward_list = [];
|
||
|
|
for( var key in game.configs.dungeon_data.data_drama_reward )
|
||
|
|
{
|
||
|
|
var config = game.configs.dungeon_data.data_drama_reward[ key ];
|
||
|
|
this.pass_reward_list.push(config)
|
||
|
|
}
|
||
|
|
this.pass_reward_list.sort( ( a, b ) => {
|
||
|
|
return a.sort - b.sort;
|
||
|
|
} );
|
||
|
|
|
||
|
|
|
||
|
|
// 角色属性监听
|
||
|
|
this.role = RoleController.getInstance().getRoleVo();
|
||
|
|
this.handler = this.role.bind( EventId.UPDATE_ROLE_ATTRIBUTE, ( _key, _val ) => {
|
||
|
|
this.onRoleAttrChanged( _key, _val );
|
||
|
|
} );
|
||
|
|
|
||
|
|
|
||
|
|
//快速战斗数据更新
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Quick_Battle_Data, this.upQuickBattleData.bind( this ) );
|
||
|
|
// 更新快速战斗状态
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Update_Max_Id, this.upQuickBtnStatus.bind( this ) );
|
||
|
|
//更新物品掉落
|
||
|
|
this.bindGEvent( DramaEvent.UpdateHookAccumulateTime, this.updateResourceCollect.bind( this ) );
|
||
|
|
//冷却时间发生变化
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Update_Cool_Time, this.updateChallengeBossStatus.bind( this ) )
|
||
|
|
//挑战成功后开始制作minimap
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Update_Dun_Id, this.updateMiniMapInfo.bind( this ) );
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Update_Data, this.upDramaData.bind( this ) )
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Top_Update_Data, this.upDramaTopData.bind( this ) )
|
||
|
|
//通关奖励红点
|
||
|
|
this.bindGEvent( DramaEvent.BattleDrama_Drama_Reward_Data, this.updatePassRewardRedPoint.bind( this ) )
|
||
|
|
//人物数据变化
|
||
|
|
this.bindGEvent( EventId.UPDATE_ROLE_ATTRIBUTE, this.upRoleLevInfo.bind( this ) );
|
||
|
|
//onlinegift
|
||
|
|
this.bindGEvent( OnlineGiftEvent.Get_Data, this.getOnlineData.bind( this ) );
|
||
|
|
//行星武器
|
||
|
|
this.bindGEvent( HallowsEvent.UpdateHallowsTaskEvent, this.updateHallowSpine.bind( this ) )
|
||
|
|
this.bindGEvent( HallowsEvent.HallowsActivityEvent, this.updateHallowSpine.bind( this ) )
|
||
|
|
//掉落金币收集
|
||
|
|
this.bindGEvent( DramaEvent.ResourceCollect, this.playResourceCollect.bind( this ) );
|
||
|
|
|
||
|
|
this.bubbleNod = nx.gui.find( this, "bubble" );
|
||
|
|
this.allcfg = game.configs.dungeon_data.data_drama_talk_length;
|
||
|
|
nx.bridge.vbind( this, [
|
||
|
|
[ "BattleDrameCd", this.onFreshCd.bind( this ) ],
|
||
|
|
[ "DailyPop", this.onShowPop.bind( this ) ],
|
||
|
|
] );
|
||
|
|
this.const = game.configs.dungeon_data.data_drama_const;
|
||
|
|
this.cfg = game.configs.dungeon_data.data_drama_talk;
|
||
|
|
this.showLog = [];
|
||
|
|
let role = RoleController.getInstance().getRoleVo();
|
||
|
|
for (let i in this.cfg ) {
|
||
|
|
let info = this.cfg[i];
|
||
|
|
if( role.lev >= info.min_lev && role.lev <= info.max_lev ){
|
||
|
|
this.showLog.push( info );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
nx.tween.fadeOut( this.bubbleNod, 0.3 );
|
||
|
|
this.first = 0;
|
||
|
|
},
|
||
|
|
|
||
|
|
onEnable() {
|
||
|
|
|
||
|
|
|
||
|
|
let self = this;
|
||
|
|
this.unscheduleAllCallbacks();
|
||
|
|
if( self.tweenAct ){
|
||
|
|
self.tweenAct.stop();
|
||
|
|
}
|
||
|
|
|
||
|
|
// let time = self.first <= 0 ? self.const.bubble_time.val : ( self.const.bubble_time.val * 2 );
|
||
|
|
if( self.const ){
|
||
|
|
// nx.gui.setActive( this.nodInfo, "camp/img", true );
|
||
|
|
this.scheduleOnce( ()=>{
|
||
|
|
self.tweenAct = cc.tween( this.bubbleNod )
|
||
|
|
.delay( 0.01 )
|
||
|
|
.call( ()=>{
|
||
|
|
self.doAnimin( self.first );
|
||
|
|
} )
|
||
|
|
.delay( self.const.bubble_time.val )
|
||
|
|
.call( ()=>{
|
||
|
|
self.schedule( () => {
|
||
|
|
let id = nx.dt.randomRange( 0, this.showLog.length - 1 );
|
||
|
|
let show = self.showLog[id];
|
||
|
|
nx.gui.setString( self.bubbleNod, "desc/txt", show.talk );
|
||
|
|
self.tweenAct = cc.tween( self.bubbleNod )
|
||
|
|
.delay( 0.01 )
|
||
|
|
.call( ()=>{
|
||
|
|
nx.tween.fadeIn( self.bubbleNod, 0.01 );
|
||
|
|
|
||
|
|
} )
|
||
|
|
.delay( self.const.bubble_time.val )
|
||
|
|
.call( ()=>{
|
||
|
|
nx.tween.fadeOut( self.bubbleNod, 0.01 );
|
||
|
|
} )
|
||
|
|
.start();
|
||
|
|
self.first ++;
|
||
|
|
// nx.tween.fadeIn( this.bubbleNod, 0.3 );
|
||
|
|
}, ( self.const.bubble_time.val * 2 ), cc.macro.REPEAT_FOREVER );
|
||
|
|
} )
|
||
|
|
.start();
|
||
|
|
|
||
|
|
}, self.const.bubble_time.val );
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
//判断是否需要打开副本奖励
|
||
|
|
let needShow = cc.sys.localStorage.getItem("openServer1Open");
|
||
|
|
if(needShow == 1){
|
||
|
|
cc.sys.localStorage.removeItem("openServer1Open")
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
this.touchPassNode();
|
||
|
|
}, 0.1 );
|
||
|
|
}
|
||
|
|
|
||
|
|
this.scheduleOnce( ()=>{
|
||
|
|
let cur = nx.bridge.plot.vget( "id" );
|
||
|
|
if( nx.dt.strEmpty( cur ) ) {
|
||
|
|
let cmp = nx.gui.getComponent( this, "pres/plot", "cmp.main.ui.plot" );
|
||
|
|
if( cmp && nx.bridge.plot && !nx.bridge.plot.isDoing() ){
|
||
|
|
if( game.views && nx.gui.find( game.views, "plots" ) && nx.gui.find( game.views, "plots" ).children.length == 0 ){
|
||
|
|
cmp.backDramaHook();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
}, 0.2 );
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
// 角色属性改变
|
||
|
|
onRoleAttrChanged: function( _key, _val ) {
|
||
|
|
|
||
|
|
if( !nx.dt.arrMember( CKeys, _key ) ) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 功能解锁检查
|
||
|
|
nx.bridge.mods.checkUnLock();
|
||
|
|
nx.bridge.acts.freshForeshow();
|
||
|
|
|
||
|
|
// 解锁条件更新
|
||
|
|
let cmps = game.node.getComponentsInChildren( "bridge.condition.locker" );
|
||
|
|
if( nx.dt.arrNEmpty( cmps ) ) {
|
||
|
|
for( let i in cmps ) {
|
||
|
|
cmps[ i ].updateLocker( _key, _val );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 关卡更新
|
||
|
|
onDramaLevelChanged: function() {
|
||
|
|
|
||
|
|
// 功能解锁检查
|
||
|
|
nx.bridge.mods.checkUnLock();
|
||
|
|
|
||
|
|
// 解锁条件更新
|
||
|
|
let cmps = game.node.getComponentsInChildren( "bridge.condition.locker" );
|
||
|
|
if( nx.dt.arrNEmpty( cmps ) ) {
|
||
|
|
for( let i in cmps ) {
|
||
|
|
cmps[ i ].updateLocker( "max_dun_id" );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
doAnimin: function( _first ){
|
||
|
|
|
||
|
|
let self = this;
|
||
|
|
let id = nx.dt.randomRange( 0, this.showLog.length - 1 );
|
||
|
|
let show = self.showLog[id];
|
||
|
|
nx.gui.setString( this.bubbleNod, "desc/txt", show.talk );
|
||
|
|
self.tweenAct = cc.tween( this.bubbleNod )
|
||
|
|
.delay( 0.01 )
|
||
|
|
.call( ()=>{
|
||
|
|
nx.tween.fadeIn( self.bubbleNod, 0.01 );
|
||
|
|
|
||
|
|
} )
|
||
|
|
.delay( self.const.bubble_time.val )
|
||
|
|
.call( ()=>{
|
||
|
|
nx.tween.fadeOut( self.bubbleNod, 0.01 );
|
||
|
|
_first ++;
|
||
|
|
} )
|
||
|
|
.start();
|
||
|
|
},
|
||
|
|
|
||
|
|
onDestroy: function(){
|
||
|
|
|
||
|
|
// 角色属性监听解除
|
||
|
|
if( this.role && this.handler ) {
|
||
|
|
this.role.unbind( this.handler );
|
||
|
|
this.handler = null;
|
||
|
|
this.role = null;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( nx.gui.find( nx.bridge.ui.getSceneNode( SCENE_TAG.msg ), "gm" ) ) {
|
||
|
|
let nod = nx.gui.find( nx.bridge.ui.getSceneNode( SCENE_TAG.msg ), "gm" );
|
||
|
|
nod.destroy();
|
||
|
|
}
|
||
|
|
|
||
|
|
// 监听事件释放
|
||
|
|
this.unbindGEvents();
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onDisable() {
|
||
|
|
},
|
||
|
|
|
||
|
|
//----------------------消息绑定
|
||
|
|
getOnlineData( data ) {
|
||
|
|
this.removeOnlineSprite( data )
|
||
|
|
this.receiveChangeData()
|
||
|
|
},
|
||
|
|
|
||
|
|
upRoleLevInfo( key, value ) {
|
||
|
|
if( key == "lev" ) {
|
||
|
|
this.updateRoleLevInfo();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
upDramaData( data ) {
|
||
|
|
if( this.cur_chapter_id != data.chapter_id ) {
|
||
|
|
BTD.getInstance().getModel().initDungeonList( data.mode, data.chapter_id )//战斗副本界面没对应刷新函数,暂时在这里初始化
|
||
|
|
}
|
||
|
|
this.updateMiniMapInfo();
|
||
|
|
this.checkQuickRed();
|
||
|
|
},
|
||
|
|
|
||
|
|
upQuickStatus( data ) {
|
||
|
|
if( nx.dt.objEmpty( data ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.checkQuickRed();
|
||
|
|
},
|
||
|
|
|
||
|
|
upDramaTopData() {
|
||
|
|
this.updateMiniMapInfo();
|
||
|
|
this.checkQuickRed();
|
||
|
|
this.onDramaLevelChanged();
|
||
|
|
},
|
||
|
|
|
||
|
|
upQuickBattleData( data ) {
|
||
|
|
if( nx.dt.objEmpty( data ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.checkQuickRed();
|
||
|
|
},
|
||
|
|
|
||
|
|
upQuickBtnStatus( id ) {
|
||
|
|
//更新物品掉落展示
|
||
|
|
gcore.GlobalEvent.fire( DramaEvent.UpDramaDropInfo )
|
||
|
|
// this.updateDramaDropInfo();
|
||
|
|
this.updateChallengeBossStatus();
|
||
|
|
if( !this.guildsign_open ) {
|
||
|
|
if( id >= game.configs.dungeon_data.data_drama_const.fast_combat_first.val ) {
|
||
|
|
this.guildsign_open = true;
|
||
|
|
nx.gui.setLocked( this.quick_btn.node, "", false );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
jumpHallow() {
|
||
|
|
nx.bridge.jumper.jump2Window( 39 );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 更新神器
|
||
|
|
updateHallowSpine: function() {
|
||
|
|
let hallows_model = HSC.getInstance().getModel();
|
||
|
|
let is_open = HSC.getInstance().checkIsOpen();
|
||
|
|
if( !this.is_real_combat && !is_open && !hallows_model.checkIsHaveAllHallows() ) {
|
||
|
|
this.hallowNd.active = true;
|
||
|
|
var hallows_id = hallows_model.getCurActivityHallowsId();
|
||
|
|
if( this.cur_hallows_id != hallows_id ) {
|
||
|
|
this.cur_hallows_id = hallows_id;
|
||
|
|
|
||
|
|
var hallows_config = game.configs.hallows_data.data_base[ hallows_id ];
|
||
|
|
if( hallows_config ) {
|
||
|
|
let res_path = cc.js.formatStr( "prefab/battle/battledrama/ui/planet0%s", hallows_id );
|
||
|
|
nx.gui.setSpriteFrame( this.hallowNd, "plane", res_path );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
var hallows_task_list = hallows_model.getHallowsTaskList( this.cur_hallows_id );
|
||
|
|
if( hallows_task_list ) {
|
||
|
|
var max_num = hallows_task_list.length;
|
||
|
|
var cur_num = 0;
|
||
|
|
for( var i in hallows_task_list ) {
|
||
|
|
if( hallows_task_list[ i ].finish == 2 ) {
|
||
|
|
cur_num = cur_num + 1;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
var percent = cur_num / max_num;
|
||
|
|
let bar = nx.gui.getComponent( this.hallowNd, "bar", cc.ProgressBar );
|
||
|
|
bar.progress = percent;
|
||
|
|
let tag = nx.gui.find( this.hallowNd, "tag" );
|
||
|
|
nx.gui.setString( tag, "txt", cc.js.formatStr( nx.text.getKey( "HallowTaskDetail" ), cur_num, max_num ) );
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
this.hallowNd.active = false;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onShowPop: function( _pop ) {
|
||
|
|
|
||
|
|
|
||
|
|
if( _pop == 1 ) {
|
||
|
|
let showDaily = nx.bridge.vget( "DailyLimit" );
|
||
|
|
if( showDaily ) {
|
||
|
|
switch( showDaily ) {
|
||
|
|
case 1: {
|
||
|
|
nx.bridge.jumper.jump2Window( FID.ActFirst );
|
||
|
|
nx.bridge.vset( "DailyLimit", null );
|
||
|
|
}; break;
|
||
|
|
case 2: {
|
||
|
|
nx.bridge.jumper.jump2Window( FID.ActMySteryGift );
|
||
|
|
nx.bridge.vset( "DailyLimit", null );
|
||
|
|
}; break;
|
||
|
|
case 3: {
|
||
|
|
nx.bridge.jumper.jump2Window( FID.ActOptional );
|
||
|
|
nx.bridge.vset( "DailyLimit", null );
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
//----------------------消息绑定
|
||
|
|
|
||
|
|
start() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onOpenConfigs( params ) {
|
||
|
|
this.is_real_combat = params.is_real_combat; // 是否真假战斗
|
||
|
|
|
||
|
|
this.is_onshow = true;
|
||
|
|
// this.updateDramaDropInfo();
|
||
|
|
this.updateResourceCollect();
|
||
|
|
this.updateMiniMapInfo();
|
||
|
|
this.updateChallengeBossStatus();
|
||
|
|
this.updateOnlineGiftInfo();
|
||
|
|
this.refreshDramaRewardIcon();
|
||
|
|
|
||
|
|
if( !this.is_real_combat ) {
|
||
|
|
// 神器模型
|
||
|
|
this.updateHallowSpine();
|
||
|
|
}
|
||
|
|
|
||
|
|
//快速作战红点
|
||
|
|
this.checkQuickRed();
|
||
|
|
if( BTD.getInstance().getModel().getDramaData().max_dun_id < game.configs.dungeon_data.data_drama_const.fast_combat_first.val ) {
|
||
|
|
nx.gui.setLocked( this.quick_btn.node, "", true );
|
||
|
|
} else {
|
||
|
|
this.guildsign_open = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onPreClosed() {
|
||
|
|
this.is_onshow = false;
|
||
|
|
this.clearCoolTimer();
|
||
|
|
if( !BTC.getInstance().getModel().isInRealBattle() ) {
|
||
|
|
BTC.getInstance().getModel().clearBattleNd();
|
||
|
|
// 只要不是剧情副本,都切出战斗
|
||
|
|
BTC.getInstance().requestCutOutBattle()
|
||
|
|
BTC.getInstance().setUIFightType( 0 );
|
||
|
|
}
|
||
|
|
this.fly_item_pools.clear();
|
||
|
|
},
|
||
|
|
|
||
|
|
// 小地图图片和名字宣誓,以及小地图位置,小地图是要判断当前 dun_id
|
||
|
|
updateMiniMapInfo: function() {
|
||
|
|
var drama_data = BTD.getInstance().getModel().getDramaData();
|
||
|
|
if( nx.dt.objEmpty( drama_data ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( this.cur_drama_dun_id == drama_data.dun_id ) return;
|
||
|
|
this.cur_drama_dun_id = drama_data.dun_id;
|
||
|
|
var drama_config = gdata( "dungeon_data", "data_drama_dungeon_info", drama_data.dun_id );
|
||
|
|
if( nx.dt.objEmpty( drama_config ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.mapname.string = drama_config.name; // 名字
|
||
|
|
this.cur_chapter_id = drama_data.chapter_id;
|
||
|
|
let chap_data = gdata( "dungeon_data", "data_drama_world_info", 1 );
|
||
|
|
if( nx.dt.objEmpty( chap_data[ drama_data.chapter_id ] ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.chapName.string = chap_data[ drama_data.chapter_id ].name;
|
||
|
|
},
|
||
|
|
|
||
|
|
// 清除面板所属唯一定时器
|
||
|
|
clearCoolTimer: function() {
|
||
|
|
if( this.time_ticker ) {
|
||
|
|
gcore.Timer.del( this.time_ticker );
|
||
|
|
this.time_ticker = null;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 挑战boss状态,可能冷却中,也可能进入下一章节
|
||
|
|
updateChallengeBossStatus: function() {
|
||
|
|
if( !this.is_onshow ) return;
|
||
|
|
var drama_data = BTD.getInstance().getModel().getDramaData();
|
||
|
|
if( nx.dt.objEmpty( drama_data ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
var cur_key = Utils.getNorKey( drama_data.cool_time, drama_data.status );
|
||
|
|
if( this.drama_cur_status == cur_key ) return;
|
||
|
|
this.drama_cur_status = cur_key;
|
||
|
|
var cur_drama_max_id = drama_data.max_dun_id || 10010;
|
||
|
|
var drama_config = game.configs.dungeon_data.data_drama_dungeon_info[ cur_drama_max_id ];
|
||
|
|
if( nx.dt.objEmpty( drama_config ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
this.challenge_cool_time = 0; // 可挑战时间
|
||
|
|
this.challenge_condition.status = 0;
|
||
|
|
this.challenge_condition.lev = 0;
|
||
|
|
// this.clearCoolTimer();
|
||
|
|
|
||
|
|
if( !drama_config || drama_config.next_id == 0 ) {
|
||
|
|
this.bossBtn.active = false;
|
||
|
|
nx.gui.setActive( this, "bottom_container/btn_cd", false );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if( drama_data.status == 2 && drama_data.cool_time == 0 ) { // 可挑战
|
||
|
|
this.bossBtn.active = true;
|
||
|
|
nx.gui.setActive( this, "bottom_container/btn_cd", false );
|
||
|
|
// this.next_battle_time.active = false;
|
||
|
|
this.challenge_condition.status = 2; // 记录状态
|
||
|
|
// 这里需要判断当前等级和需求等级
|
||
|
|
var config = game.configs.dungeon_data.data_drama_dungeon_info[ drama_data.dun_id ]; // 取出当前副本配置数据
|
||
|
|
if( config ) {
|
||
|
|
if( config.lev_limit <= RCT.getInstance().getRoleVo().lev ) {
|
||
|
|
// this.notice_label.string = "";
|
||
|
|
// this.challenge_item.active = true;
|
||
|
|
} else { // 等级不足
|
||
|
|
// this.notice_label.string = cc.js.formatStr(nx.text.getKey("battle_str5"), config.lev_limit)
|
||
|
|
// this.challenge_item.active = false;
|
||
|
|
|
||
|
|
this.challenge_condition.lev = config.lev_limit; // 保存需要挑战的等级
|
||
|
|
}
|
||
|
|
}
|
||
|
|
} else if( drama_data.status == 1 && drama_data.cool_time != 0 ) { // 冷却中
|
||
|
|
this.challenge_condition.status = 1; // 记录状态
|
||
|
|
this.bossBtn.active = false;
|
||
|
|
|
||
|
|
// this.next_battle_time.active = true;
|
||
|
|
this.challenge_cool_time = drama_data.cool_time;
|
||
|
|
// this.next_label.string = TimeTool.getMinSecTime(this.challenge_cool_time - client.socket.getTime());
|
||
|
|
// this.startCoolTimer();
|
||
|
|
} else if( drama_data.status == 3 ) { // 已通过,前往下一章
|
||
|
|
this.challenge_condition.status = 3; // 记录状态
|
||
|
|
this.bossBtn.active = true;
|
||
|
|
nx.gui.setActive( this, "bottom_container/btn_cd", false );
|
||
|
|
// nx.gui.setActive( this, "bottom_container/btn_cd", true );
|
||
|
|
// let time = nx.bridge.time.toNeedTime( drama_data.cool_time );
|
||
|
|
// time = time > 0 ? time : 0.1;
|
||
|
|
// nx.gui.setCdTxt( this, "bottom_container/btn_cd/cd", time, ()=>{
|
||
|
|
// nx.gui.setActive( this, "bottom_container/btn_cd", false );
|
||
|
|
// } )
|
||
|
|
// this.next_battle_time.active = false; // 冷却倒计时
|
||
|
|
// this.challenge_item.active = false; // 隐藏掉挑战BOSS
|
||
|
|
// this.notice_label.string = nx.text.getKey("battle_str6"); // 显示前往下一章
|
||
|
|
}
|
||
|
|
|
||
|
|
let boss_res = PathTool.getSpinePath( "E80011", "action", false );
|
||
|
|
this.bossSp.load( boss_res, ( _e ) => {
|
||
|
|
if( !_e ) {
|
||
|
|
this.bossSp.action( "action", true );
|
||
|
|
} else {
|
||
|
|
this.bossSp.stop();
|
||
|
|
}
|
||
|
|
} );;
|
||
|
|
},
|
||
|
|
|
||
|
|
// 点击挑战BOSS
|
||
|
|
touchChallengeBoss: function() {
|
||
|
|
// this.deleteLastTimeHandle();
|
||
|
|
|
||
|
|
if( BTC.getInstance().getModel().isInRealBattle() ) {
|
||
|
|
nx.tbox( nx.text.getKey( "battle_str7" ) );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
let role = RoleController.getInstance().getRoleVo();
|
||
|
|
|
||
|
|
let config = game.configs.dungeon_data.data_drama_dungeon_info[ this.cur_drama_dun_id ];
|
||
|
|
if( role.lev < config.lev_limit ) {
|
||
|
|
nx.tbox( nx.text.format( "BattleDrameTip", config.lev_limit ) );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
if( this.challenge_condition.status == 3 ) { //前往下一章
|
||
|
|
BTD.getInstance().send13002();
|
||
|
|
} else if( this.challenge_condition.status == 2 ) { // 可挑战
|
||
|
|
if( config ){
|
||
|
|
if(config.is_big == 1){
|
||
|
|
this.bgnCmp.restoreLastBGM = false;
|
||
|
|
BTD.getInstance().openDramBossInfoView( true, this.cur_drama_dun_id );
|
||
|
|
}else{
|
||
|
|
this.tryPlot( _event => {
|
||
|
|
if( _event != "start" ) {
|
||
|
|
// 出击
|
||
|
|
this.bgnCmp.restoreLastBGM = false;
|
||
|
|
BTD.getInstance().send13003( 0 );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
} );
|
||
|
|
}
|
||
|
|
// if( config.is_big == 1 ) {
|
||
|
|
// BTD.getInstance().openDramBossInfoView( true, this.cur_drama_dun_id );
|
||
|
|
// } else {
|
||
|
|
// HeroController.getInstance().openFormGoFightPanel( true, 0, {}, HeroConst.FormShowType.eFormFight, true );//剧情限定阵容
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 引导出击
|
||
|
|
onTouchBattle() {
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
this.touchChallengeBoss();
|
||
|
|
}, 0.05 );
|
||
|
|
},
|
||
|
|
|
||
|
|
//点击快速挑战
|
||
|
|
touchBattleQuick() {
|
||
|
|
if( this.guildsign_open )
|
||
|
|
BTD.getInstance().openDramBattleQuickView( true );
|
||
|
|
if( this.quick_battle_status ) {
|
||
|
|
BTD.getInstance().getModel().setOpenQuickBattleStatus( true );
|
||
|
|
BTD.getInstance().getModel().checkRedPoint();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
touchWorldMap() {
|
||
|
|
// var WorldmapController = require("worldmap_controller");
|
||
|
|
// var data = BTD.getInstance().getModel().getDramaData()
|
||
|
|
// WorldmapController.getInstance().openWorldMapMainWindow(true, data)
|
||
|
|
nx.bridge.createPanel( "WndWorldMap" );
|
||
|
|
},
|
||
|
|
|
||
|
|
touchStrongerWin() {
|
||
|
|
require( "stronger_controller" ).getInstance().openMainWin( true )
|
||
|
|
},
|
||
|
|
|
||
|
|
//更新快速作战红点状态
|
||
|
|
checkQuickRed: function() {
|
||
|
|
let drama_data = BTD.getInstance().getModel().getDramaData();
|
||
|
|
// 空属性
|
||
|
|
if( nx.dt.objEmpty( drama_data ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
//------------------在线奖励
|
||
|
|
isCreateOnlineGift() {
|
||
|
|
let status = false
|
||
|
|
let data = OnlineGiftController.getInstance().getModel().getOnlineGiftData()
|
||
|
|
if( data ) {
|
||
|
|
for( let i = 0; i < data.length; ++i ) {
|
||
|
|
let v = data[ i ]
|
||
|
|
if( v.time == game.configs.misc_data.data_get_time_items[ game.configs.misc_data.data_get_time_items_length ].time ) {
|
||
|
|
status = true
|
||
|
|
break
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return status
|
||
|
|
},
|
||
|
|
// --避免网络时间延迟导致在线奖励领取完毕还在剧情副本中
|
||
|
|
removeOnlineSprite( data ) {
|
||
|
|
if( nx.dt.objEmpty( data ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
let status = false
|
||
|
|
if( !nx.dt.arrEmpty( data.list ) ) {
|
||
|
|
// --删除图标
|
||
|
|
if( data.list.length >= game.configs.misc_data.data_get_time_items_length ) {
|
||
|
|
status = false
|
||
|
|
} else {
|
||
|
|
status = true
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
status = true
|
||
|
|
}
|
||
|
|
if( !status ) {
|
||
|
|
this.clearOnlineInfo()
|
||
|
|
} else {
|
||
|
|
// --创建图标
|
||
|
|
this.onlineCreate()
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
clearOnlineInfo() {
|
||
|
|
// this.receivenode.active = false;
|
||
|
|
|
||
|
|
if( this.time_tichet ) {
|
||
|
|
gcore.Timer.del( this.time_tichet );
|
||
|
|
this.time_tichet = null;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
close(){
|
||
|
|
this._super();
|
||
|
|
if( this.bgnCmp ){
|
||
|
|
this.bgnCmp.restoreLastBGM = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onlineCreate() {
|
||
|
|
// this.receivenode.active = true;
|
||
|
|
},
|
||
|
|
|
||
|
|
touchOnlineGift() {
|
||
|
|
OnlineGiftController.getInstance().openOnlineGiftView( true )
|
||
|
|
},
|
||
|
|
|
||
|
|
updateOnlineGiftInfo() {
|
||
|
|
OnlineGiftController.getInstance().send10926()
|
||
|
|
},
|
||
|
|
|
||
|
|
receiveChangeData() {
|
||
|
|
let data = OnlineGiftController.getInstance().getModel().getOnlineGiftData()
|
||
|
|
let num = 0
|
||
|
|
let _get_time_items = game.configs.misc_data.data_get_time_items
|
||
|
|
let _get_time_length = game.configs.misc_data.data_get_time_items_length
|
||
|
|
if( data ) {
|
||
|
|
data.sort( ( a, b ) => {
|
||
|
|
return a.time - b.time;
|
||
|
|
} );
|
||
|
|
|
||
|
|
for( let i in _get_time_items ) {
|
||
|
|
let v = _get_time_items[ i ]
|
||
|
|
if( data[ data.length - 1 ] ) {
|
||
|
|
if( data[ data.length - 1 ].time >= v.time ) {
|
||
|
|
num = i
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
num = Number( num ) + 1
|
||
|
|
if( num >= _get_time_length ) {
|
||
|
|
num = _get_time_length
|
||
|
|
}
|
||
|
|
|
||
|
|
let online_time = OnlineGiftController.getInstance().getModel().getOnlineTime()
|
||
|
|
|
||
|
|
// if( online_time >= _get_time_items[ num ].time ) {
|
||
|
|
// if( this.receivenode.active ) {//this.online_gift_node
|
||
|
|
// if( this.time_tichet ) {
|
||
|
|
// gcore.Timer.del( this.time_tichet );
|
||
|
|
// this.time_tichet = null;
|
||
|
|
// }
|
||
|
|
// this.receivename.string = nx.text.getKey( "battle_str2" )
|
||
|
|
// }
|
||
|
|
// } else {
|
||
|
|
// let time = _get_time_items[ num ].time - online_time
|
||
|
|
// if( this.time_tichet ) {
|
||
|
|
// gcore.Timer.del( this.time_tichet );
|
||
|
|
// this.time_tichet = null;
|
||
|
|
// }
|
||
|
|
// nx.gui.setCdTxt( this.receivename, "", time );
|
||
|
|
// }
|
||
|
|
},
|
||
|
|
//------------------在线奖励
|
||
|
|
|
||
|
|
//------------------作战奖励
|
||
|
|
touchPassNode() {
|
||
|
|
BTD.getInstance().openDramaRewardWindow( true );
|
||
|
|
},
|
||
|
|
|
||
|
|
//更新通关奖励红点
|
||
|
|
updatePassRewardRedPoint: function() {
|
||
|
|
// var status = BTD.getInstance().getModel().getDramaRewardRedPointInfo();
|
||
|
|
// this.passtips.active = status;
|
||
|
|
// this.speGift.updateSpecialAward();
|
||
|
|
this.refreshDramaRewardIcon();
|
||
|
|
},
|
||
|
|
|
||
|
|
refreshDramaRewardIcon() {
|
||
|
|
var pass_list = BTD.getInstance().getModel().getDramaRewardPassList(); // 已通关列表
|
||
|
|
var drama_data = BTD.getInstance().getModel().getDramaData(); // 当前剧情副本数据
|
||
|
|
var max_dun_id = drama_data.max_dun_id;
|
||
|
|
var cur_drama_dungeon_info = game.configs.dungeon_data.data_drama_dungeon_info[ max_dun_id ];
|
||
|
|
var floor = 0;
|
||
|
|
if( cur_drama_dungeon_info ) {
|
||
|
|
floor = cur_drama_dungeon_info.floor || 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
//已经通过显示
|
||
|
|
if(drama_data.max_dun_id == null || drama_data.max_dun_id == 0)
|
||
|
|
{
|
||
|
|
this.pass_dungeon_name.string = "--"; // 名字
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
var per_drama_dungeon_info = game.configs.dungeon_data.data_drama_dungeon_info[ drama_data.max_dun_id ];
|
||
|
|
this.pass_dungeon_name.string = per_drama_dungeon_info.name; // 名字
|
||
|
|
}
|
||
|
|
|
||
|
|
let cur_cfg = null;
|
||
|
|
let blink_status = BTD.getInstance().getModel().getDramaRewardRedPointInfo();
|
||
|
|
let rec_num = 0;
|
||
|
|
// 遍历出整个列表,現在統一設置下一個領取的文字即可
|
||
|
|
for( var key in this.pass_reward_list )
|
||
|
|
{
|
||
|
|
var config = this.pass_reward_list[ key ];
|
||
|
|
if( max_dun_id < config.limit_id )
|
||
|
|
{
|
||
|
|
this.passnode_name_txt.string = config.desc;
|
||
|
|
if (config.title_res == 1)
|
||
|
|
{
|
||
|
|
let Partner_res = PathTool.getIconPath(config.extend_icon,"action");
|
||
|
|
nx.gui.setSpriteFrame(this.passnode,"mask/tagSep",Partner_res);
|
||
|
|
// this.rewardSpriteBack.spriteFrame = this.rewardSepSpriteFrame;
|
||
|
|
nx.gui.setActive( this.passnode, "mask/tagItem", false );
|
||
|
|
nx.gui.setActive( this.passnode, "mask/tagSep", true );
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
// this.rewardSpriteBack.spriteFrame = this.rewardNormalSpriteFrame;
|
||
|
|
//創建圖標
|
||
|
|
let vof = data2Icon.data2Icon(config.items[0][0]);
|
||
|
|
nx.bridge.setIcon( this.passnode, "mask/tagItem", vof.icon );
|
||
|
|
nx.gui.setActive( this.passnode, "mask/tagItem", true );
|
||
|
|
nx.gui.setActive( this.passnode, "mask/tagSep", false );
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// for( var key in this.pass_reward_list ) {
|
||
|
|
// var config = this.pass_reward_list[ key ];
|
||
|
|
// if( config ) {
|
||
|
|
// var target_config = game.configs.dungeon_data.data_drama_dungeon_info[ config.limit_id ];
|
||
|
|
// if( target_config ) {
|
||
|
|
// cur_cfg = config;
|
||
|
|
// if( max_dun_id >= config.limit_id ) {//可领取
|
||
|
|
// // nx.gui.setActive( this.passnode, "check", true );
|
||
|
|
// let is_received = pass_list[ config.id ]//已领取
|
||
|
|
// if( is_received ) {
|
||
|
|
// rec_num++;
|
||
|
|
// blink_status = 0;
|
||
|
|
// // this.passnode_name_txt.string = cc.js.formatStr( "<color=#fbeba2>%s</c>", nx.text.getKey( "lab_vipLqed" ) );
|
||
|
|
// } else {
|
||
|
|
// blink_status = 1;
|
||
|
|
// // this.passnode_name_txt.string = cc.js.formatStr( "<color=#fbeba2>%s</c>", nx.text.getKey( "battle_str2" ) );
|
||
|
|
// break;
|
||
|
|
// }
|
||
|
|
// } else if( max_dun_id < config.limit_id ) {//下次领取
|
||
|
|
// // nx.gui.setActive( this.passnode, "check", false );
|
||
|
|
// blink_status = 0;
|
||
|
|
// // this.passnode_name_txt.string = cc.js.formatStr( nx.text.getKey( "DramaRewardTip" ), game.configs.dungeon_data.data_drama_dungeon_info[ config.limit_id ].floor - floor )
|
||
|
|
// break;
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
|
||
|
|
|
||
|
|
// if( rec_num >= 75 ) {//全部领取
|
||
|
|
// this.setLockStatus( 0 );
|
||
|
|
// nx.gui.setActive( this.passTag.parent, "", false );
|
||
|
|
// return;
|
||
|
|
// }
|
||
|
|
|
||
|
|
// if( !this.passItem ) {
|
||
|
|
// this.passItem = cc.instantiate( this.fabItem );
|
||
|
|
// this.passItem.parent = this.passTag;
|
||
|
|
// }
|
||
|
|
|
||
|
|
// let cmp = nx.gui.getComponent( this.passItem, "", "cmp.item.base" );
|
||
|
|
// if( cur_cfg && cmp ) {
|
||
|
|
// cmp.rebind( 0, cur_cfg.items[ 0 ], "" );
|
||
|
|
// }
|
||
|
|
// this.setLockStatus( blink_status );
|
||
|
|
nx.gui.setActive( this.passnode, "tip", blink_status == 1 );
|
||
|
|
},
|
||
|
|
|
||
|
|
setLockStatus( status ) {
|
||
|
|
if( status == 0 ) {
|
||
|
|
this.passEft.stop();
|
||
|
|
} else if( status == 1 ) {
|
||
|
|
let res_path = PathTool.getSpinePath( "E80030", null, false );
|
||
|
|
this.passEft.load( res_path, ( _e ) => {
|
||
|
|
if( !_e ) {
|
||
|
|
this.passEft.action( "action", true );
|
||
|
|
} else {
|
||
|
|
this.passEft.stop();
|
||
|
|
}
|
||
|
|
} );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
//------------------作战奖励
|
||
|
|
|
||
|
|
//------------------下线挂机收益
|
||
|
|
// 收集金币
|
||
|
|
touchResourceBox: function() {
|
||
|
|
if( this.is_in_collect ) return; // 收集动画过程中 不做处理
|
||
|
|
this.is_in_collect = true;
|
||
|
|
var requestGetAwardFunc = function() {
|
||
|
|
var play_action = PlayerAction.action_2; // 目标动作
|
||
|
|
if( this.resources_action == PlayerAction.action_3 ) {
|
||
|
|
play_action = PlayerAction.action_4;
|
||
|
|
} else if( this.resources_action == PlayerAction.action_5 ) {
|
||
|
|
play_action = PlayerAction.action_6;
|
||
|
|
}
|
||
|
|
this.res_skeleton.setToSetupPose()
|
||
|
|
this.res_skeleton.setAnimation( 0, play_action, false );
|
||
|
|
|
||
|
|
this.scheduleOnce( () => {
|
||
|
|
this.is_in_collect = false;
|
||
|
|
BTD.getInstance().openDramHookRewardView( true, null );
|
||
|
|
// BTD.getInstance().requestGetHookTimeAwards();
|
||
|
|
}, 1.5 );
|
||
|
|
}.bind( this );
|
||
|
|
|
||
|
|
var hook_info = BTD.getInstance().getModel().getHookAccumulateInfo();
|
||
|
|
if( !hook_info ) return;
|
||
|
|
// var cur_energy = RCT.getInstance().getRoleVo().energy;
|
||
|
|
// var max_energy = RCT.getInstance().getRoleVo().energy_max;
|
||
|
|
var qingbao_val = 0;//可领取的请报值
|
||
|
|
if( hook_info && hook_info.list ) {
|
||
|
|
for( let index = 0; index < hook_info.list.length; index++ ) {
|
||
|
|
const element = hook_info.list[ index ];
|
||
|
|
if( element.bid == game.configs.item_data.data_assets_label2id.energy ) {
|
||
|
|
qingbao_val = element.num;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 剧情引导中,不要选择
|
||
|
|
if( nx.bridge.plot && nx.bridge.plot.vget( "id" ) != "" ) {
|
||
|
|
requestGetAwardFunc();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
requestGetAwardFunc();
|
||
|
|
},
|
||
|
|
|
||
|
|
// 更新金币收集情况
|
||
|
|
updateResourceCollect: function() {
|
||
|
|
if( !this.is_onshow ) return;
|
||
|
|
var cost_config = game.configs.dungeon_data.data_drama_const.hangup_revenue;
|
||
|
|
var min_config = game.configs.dungeon_data.data_drama_const.hangup_revenue_small;
|
||
|
|
var max_config = game.configs.dungeon_data.data_drama_const.hangup_revenue_big;
|
||
|
|
|
||
|
|
var hook_info = BTD.getInstance().getModel().getHookAccumulateInfo();
|
||
|
|
if( !hook_info ) return;
|
||
|
|
var hook_time = hook_info.hook_time || 1; //挂机时间
|
||
|
|
var action = PlayerAction.action;
|
||
|
|
|
||
|
|
if( hook_time >= max_config.val ) {
|
||
|
|
action = PlayerAction.action_5
|
||
|
|
} else if( hook_time >= min_config.val ) {
|
||
|
|
action = PlayerAction.action_3
|
||
|
|
} else if( hook_time >= cost_config.val ) {
|
||
|
|
action = PlayerAction.action_1
|
||
|
|
} else {
|
||
|
|
action = PlayerAction.action
|
||
|
|
}
|
||
|
|
if( this.resources_action != action ) {
|
||
|
|
this.resources_action = action
|
||
|
|
this.changeCollectAction();
|
||
|
|
}
|
||
|
|
// 挂机时间显示
|
||
|
|
this.time_label.string = TimeTool.getTimeFormatIII( hook_time );
|
||
|
|
nx.gui.setActive( this.bottom_container, "collect_container/bonus", ( hook_info.list1.length > 0 ) );
|
||
|
|
},
|
||
|
|
|
||
|
|
// 切换
|
||
|
|
changeCollectAction: function() {
|
||
|
|
if( this.res_skeletonData == null ) { // 这个时候需要先加载
|
||
|
|
var resources_path = PathTool.getSpinePath( "E80024", "action", false );
|
||
|
|
cc.loader.loadRes( resources_path, sp.SkeletonData, ( err, res_object ) => {
|
||
|
|
if( err ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.res_skeleton.skeletonData = res_object;
|
||
|
|
this.res_skeletonData = res_object;
|
||
|
|
this.changeCollectAction();
|
||
|
|
} )
|
||
|
|
} else {
|
||
|
|
if( this.resources_action ) {
|
||
|
|
this.res_skeleton.setAnimation( 0, this.resources_action, true );
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
// 刷新假战斗掉落
|
||
|
|
playResourceCollect: function( x, y ) {
|
||
|
|
if( this.is_real_combat ) return;
|
||
|
|
var init_pos = this.bottom_container.convertToNodeSpaceAR( cc.v2( x, y ) );
|
||
|
|
var target_pos = cc.v2( this.res_model.x, this.res_model.y + this.res_model.height );
|
||
|
|
|
||
|
|
var sum = Utils.randomNum( 3, 9 );
|
||
|
|
let item_ids = [ 1, 5, 7, 22 ];
|
||
|
|
let action_ids = {
|
||
|
|
1: "action1",
|
||
|
|
5: "action2",
|
||
|
|
7: "action3",
|
||
|
|
22: "action4",
|
||
|
|
};
|
||
|
|
for( let index = 0; index < sum; index++ ) {
|
||
|
|
var _x = ( 1 - Utils.randomNum( 0, 2 ) ) * Utils.randomNum( 0, 60 ) + init_pos.x; // 初始坐标
|
||
|
|
var _y = ( 1 - Utils.randomNum( 0, 2 ) ) * Utils.randomNum( 0, 20 ) + init_pos.y + 120;
|
||
|
|
var id = item_ids[ Math.floor( Math.random() * 4 ) ];
|
||
|
|
var node = null;
|
||
|
|
if( this.fly_item_pools.size() > 0 ) {
|
||
|
|
node = this.fly_item_pools.get();
|
||
|
|
} else {
|
||
|
|
node = cc.instantiate( this.collectNd );
|
||
|
|
// new cc.Node();
|
||
|
|
// node.setAnchorPoint(0.5, 0.5);
|
||
|
|
// node.addComponent(cc.Sprite);
|
||
|
|
}
|
||
|
|
node.setPosition( _x, _y );
|
||
|
|
node.scale = 0;
|
||
|
|
this.bottom_container.addChild( node );
|
||
|
|
// 设置资源
|
||
|
|
let spCmp = nx.gui.getComponent( node, "", sp.Skeleton );
|
||
|
|
spCmp.setAnimation( 0, action_ids[ id ], true );
|
||
|
|
// nx.gui.setSpriteFrame( node.getComponent(cc.Sprite), "", PathTool.querySmallIconPath(id) );
|
||
|
|
this.flyEnergyToWealth( node, id, target_pos, _x, _y, index, this.auto_id );
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onFreshCd: function( _cd ) {
|
||
|
|
|
||
|
|
let dealCd = function( _time ) {
|
||
|
|
if( _time == -1 ) {
|
||
|
|
nx.gui.setActive( self, "bottom_container/btn_cd", false );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
if( _cd == 0 ) {
|
||
|
|
nx.gui.setActive( self, "bottom_container/btn_cd", false );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
let self = this;
|
||
|
|
nx.gui.setActive( this, "bottom_container/btn_cd", true );
|
||
|
|
let time = _cd == 0.1 ? _cd : nx.bridge.time.toNeedTime( _cd );
|
||
|
|
nx.gui.setCdTxt( this, "bottom_container/btn_cd/cd", time, () => {
|
||
|
|
nx.gui.setActive( self, "bottom_container/btn_cd", false );
|
||
|
|
// nx.bridge.vset( "BattleDrameCd", 0 );
|
||
|
|
dealCd( -1 );
|
||
|
|
} )
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 资产物品飞行动作
|
||
|
|
* @param {*} node 当前资产节点
|
||
|
|
* @param {*} id 对象池下表
|
||
|
|
* @param {*} target_pos 目标位置
|
||
|
|
* @param {*} x 起始点
|
||
|
|
* @param {*} y
|
||
|
|
* @param {*} index 这一批里面的第几个物品
|
||
|
|
* @param {*} auto_id
|
||
|
|
*/
|
||
|
|
flyEnergyToWealth: function( node, id, target_pos, x, y, index, auto_id ) {
|
||
|
|
var bezier = [];
|
||
|
|
var begin_pos = cc.v2( x, y );
|
||
|
|
bezier.push( begin_pos );
|
||
|
|
var end_pos = cc.v2( target_pos.x, target_pos.y );
|
||
|
|
var min_pos = begin_pos.add( end_pos ).mul( 0.5 );
|
||
|
|
var off_x = - 30;
|
||
|
|
var off_y = 10;
|
||
|
|
if( index % 2 == 0 ) {
|
||
|
|
off_y = Utils.randomNum( 100, 150 );
|
||
|
|
off_x = 30;
|
||
|
|
}
|
||
|
|
var controller_pos = cc.v2( min_pos.x + off_x, min_pos.y + off_y );
|
||
|
|
bezier.push( controller_pos );
|
||
|
|
bezier.push( end_pos );
|
||
|
|
var delatTimer = cc.delayTime( index * 0.1 );
|
||
|
|
var bezierTo = cc.bezierTo( 0.3, bezier );
|
||
|
|
var call_fun = cc.callFunc( function() {
|
||
|
|
this.fly_item_pools.put( node );
|
||
|
|
}.bind( this ) );
|
||
|
|
|
||
|
|
var seq = cc.sequence( bezierTo, call_fun );
|
||
|
|
var scale_to = cc.scaleTo( 1, 1 );
|
||
|
|
let first_scale = cc.scaleTo( 0.3, 1 );
|
||
|
|
let jump_act = cc.jumpBy( 0.3, 0, 60, 50, 1 );
|
||
|
|
node.runAction( cc.sequence( cc.spawn( first_scale, jump_act ), delatTimer, cc.spawn( scale_to, seq ) ) );
|
||
|
|
},
|
||
|
|
//------------------下线挂机收益
|
||
|
|
|
||
|
|
|
||
|
|
touchChat() {
|
||
|
|
let ChatCtrl = require( "chat_controller" );
|
||
|
|
ChatCtrl.getInstance().openChatPanel();
|
||
|
|
},
|
||
|
|
|
||
|
|
touchDrop() {
|
||
|
|
let max_dun_id = BTD.getInstance().getModel().getDramaData().max_dun_id;
|
||
|
|
let drama_config = game.configs.dungeon_data.data_drama_dungeon_info[ max_dun_id ];
|
||
|
|
nx.bridge.createPanel( "WndWorldMapReward", drama_config );
|
||
|
|
},
|
||
|
|
|
||
|
|
onTouchCd: function() {
|
||
|
|
|
||
|
|
nx.tbox( "BattleTip" );
|
||
|
|
},
|
||
|
|
// update (dt) {},
|
||
|
|
|
||
|
|
// 尝试出击前剧情触发
|
||
|
|
// ingore: 未触发剧情,可直接进入战斗
|
||
|
|
// start: 成功触发剧情,等待结束
|
||
|
|
// done: 剧情触发完毕
|
||
|
|
tryPlot: function( _cb ) {
|
||
|
|
|
||
|
|
nx.debug( "$Plot:进入编队界面,剧情触发检查..." );
|
||
|
|
|
||
|
|
// 未开启引导
|
||
|
|
if( !nx.bridge.plot ) {
|
||
|
|
nx.dt.fnInvoke( _cb, 'ingore' );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 进行中
|
||
|
|
let cur = nx.bridge.plot.vget( "id" );
|
||
|
|
if( nx.dt.strNEmpty( cur ) ) {
|
||
|
|
nx.dt.fnInvoke( _cb, 'ingore' );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 逐个触发
|
||
|
|
let queue = nx.dt.objClone( nx.bridge.plot.configs.base.drama_team );
|
||
|
|
let check = function() {
|
||
|
|
|
||
|
|
// 检查完毕
|
||
|
|
if( nx.dt.arrEmpty( queue ) ) {
|
||
|
|
nx.dt.fnInvoke( _cb, 'ingore' );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 尝试触发
|
||
|
|
let ok = nx.bridge.plot.fire( queue.shift(), ( _ret, _data ) => {
|
||
|
|
|
||
|
|
// 未触发
|
||
|
|
if( !_ret ) {
|
||
|
|
check();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 引导完成
|
||
|
|
nx.dt.fnInvoke( _cb, 'done' );
|
||
|
|
} );
|
||
|
|
|
||
|
|
// 触发成功
|
||
|
|
if( ok ) {
|
||
|
|
nx.dt.fnInvoke( _cb, 'start' );
|
||
|
|
}
|
||
|
|
|
||
|
|
};
|
||
|
|
check();
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
} );
|