1124 lines
39 KiB
JavaScript
1124 lines
39 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'd616bq/0d9FxLtJtxnRWNx8', 'cmp.battledrama.onhook');
|
||
|
|
// Scripts/mod/battle_drama/cmp/cmp.battledrama.onhook.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
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");
|
||
|
|
var BTD = require("battle_drama_controller");
|
||
|
|
var BTC = require("battle_controller");
|
||
|
|
var HSC = require("hallows_controller");
|
||
|
|
var PathTool = require("pathtool");
|
||
|
|
var HeroConst = require("hero_const");
|
||
|
|
var NxSpine = require("nx.fx.spine");
|
||
|
|
var DramaSpecial = require("cmp.battledrama.special");
|
||
|
|
var DramaConst = require("battle_drama_event");
|
||
|
|
var _require = require("define"),
|
||
|
|
SCENE_TAG = _require.SCENE_TAG;
|
||
|
|
var _require2 = require("define"),
|
||
|
|
PlayerAction = _require2.PlayerAction;
|
||
|
|
var FID = require("bridge.function.ids");
|
||
|
|
var RoleController = require("role_controller");
|
||
|
|
var FxBGM = require("nx.fx.BGM");
|
||
|
|
var _require3 = require("bridge.conditions"),
|
||
|
|
CKeys = _require3.CKeys;
|
||
|
|
var 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: function onLoad() {
|
||
|
|
var _this = this;
|
||
|
|
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(function (a, b) {
|
||
|
|
return a.sort - b.sort;
|
||
|
|
});
|
||
|
|
|
||
|
|
// 角色属性监听
|
||
|
|
this.role = RoleController.getInstance().getRoleVo();
|
||
|
|
this.handler = this.role.bind(EventId.UPDATE_ROLE_ATTRIBUTE, function (_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 = [];
|
||
|
|
var role = RoleController.getInstance().getRoleVo();
|
||
|
|
for (var i in this.cfg) {
|
||
|
|
var 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: function onEnable() {
|
||
|
|
var _this2 = this;
|
||
|
|
var 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(function () {
|
||
|
|
self.tweenAct = cc.tween(_this2.bubbleNod).delay(0.01).call(function () {
|
||
|
|
self.doAnimin(self.first);
|
||
|
|
}).delay(self["const"].bubble_time.val).call(function () {
|
||
|
|
self.schedule(function () {
|
||
|
|
var id = nx.dt.randomRange(0, _this2.showLog.length - 1);
|
||
|
|
var show = self.showLog[id];
|
||
|
|
nx.gui.setString(self.bubbleNod, "desc/txt", show.talk);
|
||
|
|
self.tweenAct = cc.tween(self.bubbleNod).delay(0.01).call(function () {
|
||
|
|
nx.tween.fadeIn(self.bubbleNod, 0.01);
|
||
|
|
}).delay(self["const"].bubble_time.val).call(function () {
|
||
|
|
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);
|
||
|
|
}
|
||
|
|
|
||
|
|
//判断是否需要打开副本奖励
|
||
|
|
var needShow = cc.sys.localStorage.getItem("openServer1Open");
|
||
|
|
if (needShow == 1) {
|
||
|
|
cc.sys.localStorage.removeItem("openServer1Open");
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
_this2.touchPassNode();
|
||
|
|
}, 0.1);
|
||
|
|
}
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
var cur = nx.bridge.plot.vget("id");
|
||
|
|
if (nx.dt.strEmpty(cur)) {
|
||
|
|
var cmp = nx.gui.getComponent(_this2, "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 onRoleAttrChanged(_key, _val) {
|
||
|
|
if (!nx.dt.arrMember(CKeys, _key)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 功能解锁检查
|
||
|
|
nx.bridge.mods.checkUnLock();
|
||
|
|
nx.bridge.acts.freshForeshow();
|
||
|
|
|
||
|
|
// 解锁条件更新
|
||
|
|
var cmps = game.node.getComponentsInChildren("bridge.condition.locker");
|
||
|
|
if (nx.dt.arrNEmpty(cmps)) {
|
||
|
|
for (var i in cmps) {
|
||
|
|
cmps[i].updateLocker(_key, _val);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 关卡更新
|
||
|
|
onDramaLevelChanged: function onDramaLevelChanged() {
|
||
|
|
// 功能解锁检查
|
||
|
|
nx.bridge.mods.checkUnLock();
|
||
|
|
|
||
|
|
// 解锁条件更新
|
||
|
|
var cmps = game.node.getComponentsInChildren("bridge.condition.locker");
|
||
|
|
if (nx.dt.arrNEmpty(cmps)) {
|
||
|
|
for (var i in cmps) {
|
||
|
|
cmps[i].updateLocker("max_dun_id");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
doAnimin: function doAnimin(_first) {
|
||
|
|
var self = this;
|
||
|
|
var id = nx.dt.randomRange(0, this.showLog.length - 1);
|
||
|
|
var show = self.showLog[id];
|
||
|
|
nx.gui.setString(this.bubbleNod, "desc/txt", show.talk);
|
||
|
|
self.tweenAct = cc.tween(this.bubbleNod).delay(0.01).call(function () {
|
||
|
|
nx.tween.fadeIn(self.bubbleNod, 0.01);
|
||
|
|
}).delay(self["const"].bubble_time.val).call(function () {
|
||
|
|
nx.tween.fadeOut(self.bubbleNod, 0.01);
|
||
|
|
_first++;
|
||
|
|
}).start();
|
||
|
|
},
|
||
|
|
onDestroy: function onDestroy() {
|
||
|
|
// 角色属性监听解除
|
||
|
|
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")) {
|
||
|
|
var nod = nx.gui.find(nx.bridge.ui.getSceneNode(SCENE_TAG.msg), "gm");
|
||
|
|
nod.destroy();
|
||
|
|
}
|
||
|
|
|
||
|
|
// 监听事件释放
|
||
|
|
this.unbindGEvents();
|
||
|
|
},
|
||
|
|
onDisable: function onDisable() {},
|
||
|
|
//----------------------消息绑定
|
||
|
|
getOnlineData: function getOnlineData(data) {
|
||
|
|
this.removeOnlineSprite(data);
|
||
|
|
this.receiveChangeData();
|
||
|
|
},
|
||
|
|
upRoleLevInfo: function upRoleLevInfo(key, value) {
|
||
|
|
if (key == "lev") {
|
||
|
|
this.updateRoleLevInfo();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
upDramaData: function upDramaData(data) {
|
||
|
|
if (this.cur_chapter_id != data.chapter_id) {
|
||
|
|
BTD.getInstance().getModel().initDungeonList(data.mode, data.chapter_id); //战斗副本界面没对应刷新函数,暂时在这里初始化
|
||
|
|
}
|
||
|
|
|
||
|
|
this.updateMiniMapInfo();
|
||
|
|
this.checkQuickRed();
|
||
|
|
},
|
||
|
|
upQuickStatus: function upQuickStatus(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.checkQuickRed();
|
||
|
|
},
|
||
|
|
upDramaTopData: function upDramaTopData() {
|
||
|
|
this.updateMiniMapInfo();
|
||
|
|
this.checkQuickRed();
|
||
|
|
this.onDramaLevelChanged();
|
||
|
|
},
|
||
|
|
upQuickBattleData: function upQuickBattleData(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
this.checkQuickRed();
|
||
|
|
},
|
||
|
|
upQuickBtnStatus: function 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: function jumpHallow() {
|
||
|
|
nx.bridge.jumper.jump2Window(39);
|
||
|
|
},
|
||
|
|
// 更新神器
|
||
|
|
updateHallowSpine: function updateHallowSpine() {
|
||
|
|
var hallows_model = HSC.getInstance().getModel();
|
||
|
|
var 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) {
|
||
|
|
var 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;
|
||
|
|
var bar = nx.gui.getComponent(this.hallowNd, "bar", cc.ProgressBar);
|
||
|
|
bar.progress = percent;
|
||
|
|
var 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 onShowPop(_pop) {
|
||
|
|
if (_pop == 1) {
|
||
|
|
var 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: function start() {},
|
||
|
|
onOpenConfigs: function 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: function 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 updateMiniMapInfo() {
|
||
|
|
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;
|
||
|
|
var 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 clearCoolTimer() {
|
||
|
|
if (this.time_ticker) {
|
||
|
|
gcore.Timer.del(this.time_ticker);
|
||
|
|
this.time_ticker = null;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 挑战boss状态,可能冷却中,也可能进入下一章节
|
||
|
|
updateChallengeBossStatus: function updateChallengeBossStatus() {
|
||
|
|
var _this3 = this;
|
||
|
|
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"); // 显示前往下一章
|
||
|
|
}
|
||
|
|
|
||
|
|
var boss_res = PathTool.getSpinePath("E80011", "action", false);
|
||
|
|
this.bossSp.load(boss_res, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this3.bossSp.action("action", true);
|
||
|
|
} else {
|
||
|
|
_this3.bossSp.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
;
|
||
|
|
},
|
||
|
|
// 点击挑战BOSS
|
||
|
|
touchChallengeBoss: function touchChallengeBoss() {
|
||
|
|
var _this4 = this;
|
||
|
|
// this.deleteLastTimeHandle();
|
||
|
|
|
||
|
|
if (BTC.getInstance().getModel().isInRealBattle()) {
|
||
|
|
nx.tbox(nx.text.getKey("battle_str7"));
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var role = RoleController.getInstance().getRoleVo();
|
||
|
|
var 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(function (_event) {
|
||
|
|
if (_event != "start") {
|
||
|
|
// 出击
|
||
|
|
_this4.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: function onTouchBattle() {
|
||
|
|
var _this5 = this;
|
||
|
|
this.scheduleOnce(function () {
|
||
|
|
_this5.touchChallengeBoss();
|
||
|
|
}, 0.05);
|
||
|
|
},
|
||
|
|
//点击快速挑战
|
||
|
|
touchBattleQuick: function touchBattleQuick() {
|
||
|
|
if (this.guildsign_open) BTD.getInstance().openDramBattleQuickView(true);
|
||
|
|
if (this.quick_battle_status) {
|
||
|
|
BTD.getInstance().getModel().setOpenQuickBattleStatus(true);
|
||
|
|
BTD.getInstance().getModel().checkRedPoint();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
touchWorldMap: function touchWorldMap() {
|
||
|
|
// var WorldmapController = require("worldmap_controller");
|
||
|
|
// var data = BTD.getInstance().getModel().getDramaData()
|
||
|
|
// WorldmapController.getInstance().openWorldMapMainWindow(true, data)
|
||
|
|
nx.bridge.createPanel("WndWorldMap");
|
||
|
|
},
|
||
|
|
touchStrongerWin: function touchStrongerWin() {
|
||
|
|
require("stronger_controller").getInstance().openMainWin(true);
|
||
|
|
},
|
||
|
|
//更新快速作战红点状态
|
||
|
|
checkQuickRed: function checkQuickRed() {
|
||
|
|
var drama_data = BTD.getInstance().getModel().getDramaData();
|
||
|
|
// 空属性
|
||
|
|
if (nx.dt.objEmpty(drama_data)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
//------------------在线奖励
|
||
|
|
isCreateOnlineGift: function isCreateOnlineGift() {
|
||
|
|
var status = false;
|
||
|
|
var data = OnlineGiftController.getInstance().getModel().getOnlineGiftData();
|
||
|
|
if (data) {
|
||
|
|
for (var i = 0; i < data.length; ++i) {
|
||
|
|
var 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: function removeOnlineSprite(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
var 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: function clearOnlineInfo() {
|
||
|
|
// this.receivenode.active = false;
|
||
|
|
|
||
|
|
if (this.time_tichet) {
|
||
|
|
gcore.Timer.del(this.time_tichet);
|
||
|
|
this.time_tichet = null;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
close: function close() {
|
||
|
|
this._super();
|
||
|
|
if (this.bgnCmp) {
|
||
|
|
this.bgnCmp.restoreLastBGM = true;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onlineCreate: function onlineCreate() {
|
||
|
|
// this.receivenode.active = true;
|
||
|
|
},
|
||
|
|
touchOnlineGift: function touchOnlineGift() {
|
||
|
|
OnlineGiftController.getInstance().openOnlineGiftView(true);
|
||
|
|
},
|
||
|
|
updateOnlineGiftInfo: function updateOnlineGiftInfo() {
|
||
|
|
OnlineGiftController.getInstance().send10926();
|
||
|
|
},
|
||
|
|
receiveChangeData: function receiveChangeData() {
|
||
|
|
var data = OnlineGiftController.getInstance().getModel().getOnlineGiftData();
|
||
|
|
var num = 0;
|
||
|
|
var _get_time_items = game.configs.misc_data.data_get_time_items;
|
||
|
|
var _get_time_length = game.configs.misc_data.data_get_time_items_length;
|
||
|
|
if (data) {
|
||
|
|
data.sort(function (a, b) {
|
||
|
|
return a.time - b.time;
|
||
|
|
});
|
||
|
|
for (var i in _get_time_items) {
|
||
|
|
var 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;
|
||
|
|
}
|
||
|
|
var 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: function touchPassNode() {
|
||
|
|
BTD.getInstance().openDramaRewardWindow(true);
|
||
|
|
},
|
||
|
|
//更新通关奖励红点
|
||
|
|
updatePassRewardRedPoint: function updatePassRewardRedPoint() {
|
||
|
|
// var status = BTD.getInstance().getModel().getDramaRewardRedPointInfo();
|
||
|
|
// this.passtips.active = status;
|
||
|
|
// this.speGift.updateSpecialAward();
|
||
|
|
this.refreshDramaRewardIcon();
|
||
|
|
},
|
||
|
|
refreshDramaRewardIcon: function 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; // 名字
|
||
|
|
}
|
||
|
|
|
||
|
|
var cur_cfg = null;
|
||
|
|
var blink_status = BTD.getInstance().getModel().getDramaRewardRedPointInfo();
|
||
|
|
var 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) {
|
||
|
|
var 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;
|
||
|
|
//創建圖標
|
||
|
|
var 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: function setLockStatus(status) {
|
||
|
|
var _this6 = this;
|
||
|
|
if (status == 0) {
|
||
|
|
this.passEft.stop();
|
||
|
|
} else if (status == 1) {
|
||
|
|
var res_path = PathTool.getSpinePath("E80030", null, false);
|
||
|
|
this.passEft.load(res_path, function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this6.passEft.action("action", true);
|
||
|
|
} else {
|
||
|
|
_this6.passEft.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
},
|
||
|
|
//------------------作战奖励
|
||
|
|
|
||
|
|
//------------------下线挂机收益
|
||
|
|
// 收集金币
|
||
|
|
touchResourceBox: function touchResourceBox() {
|
||
|
|
if (this.is_in_collect) return; // 收集动画过程中 不做处理
|
||
|
|
this.is_in_collect = true;
|
||
|
|
var requestGetAwardFunc = function () {
|
||
|
|
var _this7 = this;
|
||
|
|
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(function () {
|
||
|
|
_this7.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 (var index = 0; index < hook_info.list.length; index++) {
|
||
|
|
var 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 updateResourceCollect() {
|
||
|
|
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 changeCollectAction() {
|
||
|
|
var _this8 = this;
|
||
|
|
if (this.res_skeletonData == null) {
|
||
|
|
// 这个时候需要先加载
|
||
|
|
var resources_path = PathTool.getSpinePath("E80024", "action", false);
|
||
|
|
cc.loader.loadRes(resources_path, sp.SkeletonData, function (err, res_object) {
|
||
|
|
if (err) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
_this8.res_skeleton.skeletonData = res_object;
|
||
|
|
_this8.res_skeletonData = res_object;
|
||
|
|
_this8.changeCollectAction();
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
if (this.resources_action) {
|
||
|
|
this.res_skeleton.setAnimation(0, this.resources_action, true);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 刷新假战斗掉落
|
||
|
|
playResourceCollect: function playResourceCollect(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);
|
||
|
|
var item_ids = [1, 5, 7, 22];
|
||
|
|
var action_ids = {
|
||
|
|
1: "action1",
|
||
|
|
5: "action2",
|
||
|
|
7: "action3",
|
||
|
|
22: "action4"
|
||
|
|
};
|
||
|
|
for (var 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);
|
||
|
|
// 设置资源
|
||
|
|
var 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 onFreshCd(_cd) {
|
||
|
|
var dealCd = function dealCd(_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;
|
||
|
|
}
|
||
|
|
var self = this;
|
||
|
|
nx.gui.setActive(this, "bottom_container/btn_cd", true);
|
||
|
|
var time = _cd == 0.1 ? _cd : nx.bridge.time.toNeedTime(_cd);
|
||
|
|
nx.gui.setCdTxt(this, "bottom_container/btn_cd/cd", time, function () {
|
||
|
|
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 flyEnergyToWealth(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);
|
||
|
|
var first_scale = cc.scaleTo(0.3, 1);
|
||
|
|
var 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: function touchChat() {
|
||
|
|
var ChatCtrl = require("chat_controller");
|
||
|
|
ChatCtrl.getInstance().openChatPanel();
|
||
|
|
},
|
||
|
|
touchDrop: function touchDrop() {
|
||
|
|
var max_dun_id = BTD.getInstance().getModel().getDramaData().max_dun_id;
|
||
|
|
var drama_config = game.configs.dungeon_data.data_drama_dungeon_info[max_dun_id];
|
||
|
|
nx.bridge.createPanel("WndWorldMapReward", drama_config);
|
||
|
|
},
|
||
|
|
onTouchCd: function onTouchCd() {
|
||
|
|
nx.tbox("BattleTip");
|
||
|
|
},
|
||
|
|
// update (dt) {},
|
||
|
|
|
||
|
|
// 尝试出击前剧情触发
|
||
|
|
// ingore: 未触发剧情,可直接进入战斗
|
||
|
|
// start: 成功触发剧情,等待结束
|
||
|
|
// done: 剧情触发完毕
|
||
|
|
tryPlot: function tryPlot(_cb) {
|
||
|
|
nx.debug("$Plot:进入编队界面,剧情触发检查...");
|
||
|
|
|
||
|
|
// 未开启引导
|
||
|
|
if (!nx.bridge.plot) {
|
||
|
|
nx.dt.fnInvoke(_cb, 'ingore');
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 进行中
|
||
|
|
var cur = nx.bridge.plot.vget("id");
|
||
|
|
if (nx.dt.strNEmpty(cur)) {
|
||
|
|
nx.dt.fnInvoke(_cb, 'ingore');
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 逐个触发
|
||
|
|
var queue = nx.dt.objClone(nx.bridge.plot.configs.base.drama_team);
|
||
|
|
var check = function check() {
|
||
|
|
// 检查完毕
|
||
|
|
if (nx.dt.arrEmpty(queue)) {
|
||
|
|
nx.dt.fnInvoke(_cb, 'ingore');
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 尝试触发
|
||
|
|
var ok = nx.bridge.plot.fire(queue.shift(), function (_ret, _data) {
|
||
|
|
// 未触发
|
||
|
|
if (!_ret) {
|
||
|
|
check();
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
// 引导完成
|
||
|
|
nx.dt.fnInvoke(_cb, 'done');
|
||
|
|
});
|
||
|
|
|
||
|
|
// 触发成功
|
||
|
|
if (ok) {
|
||
|
|
nx.dt.fnInvoke(_cb, 'start');
|
||
|
|
}
|
||
|
|
};
|
||
|
|
check();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|