|
-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 经验副本模块Controller,只用于控制界面开关,相关协议逻辑移步BaseDungeonController
|
|
-- *>
|
|
|
|
require("game.expDun.ExpDunModel")
|
|
require("game.expDun.ExpHangupMainView") -- 经验副本主界面(新)
|
|
require("game.expDun.ExpQuickHangUpView") -- 经验副本快速挂机购买界面
|
|
require("game.expDun.ExpHangUpReceiveView") -- 经验副本放置挂机奖励界面
|
|
-- 2020年5月12日第三版重构经验副本新增
|
|
require("game.expDun.ExpDunAnimConst")
|
|
require("game.expDun.ExpDunRouteItem") -- 经验副本主入口副本里程碑按钮
|
|
require("game.expDun.ExpHangupAwardItem") -- 经验副本通用奖励item
|
|
require("game.expDun.ExpHangupMonModelItem") -- 经验副本怪物模型节点
|
|
require("game.expDun.ExpHangupBulletItem") -- 经验副本子弹例子效果容器
|
|
require("game.expDun.ExpDunRouteWaveItem") -- 经验副本路线节点内波数节点
|
|
-- 2021年5月11日第七版优化新增
|
|
require("game.expDun.ExpDunWaveRankView") -- 经验副本路线排行界面
|
|
require("game.expDun.ExpDunWaveRankTopItem") -- 经验副本路线排行界面前三名节点
|
|
require("game.expDun.ExpDunWaveRankItem") -- 经验副本路线排行界面滚动节点
|
|
|
|
|
|
ExpDunController = ExpDunController or BaseClass(BaseController, true)
|
|
local ExpDunController = ExpDunController
|
|
|
|
function ExpDunController:__init()
|
|
ExpDunController.Instance = self
|
|
self.model = ExpDunModel:getInstance()
|
|
self:AddEvents()
|
|
end
|
|
|
|
function ExpDunController:__delete()
|
|
|
|
end
|
|
|
|
function ExpDunController:AddEvents()
|
|
-- do return end
|
|
local function open_exp_main_view(show, need_show_guide, need_show_offline_con)
|
|
self:OpenView("ExpHangupMainView", show, need_show_guide, need_show_offline_con)
|
|
end
|
|
self.model:Bind(ExpDunModel.OPEN_EXP_HANGUP_MAIN_VIEW, open_exp_main_view)
|
|
|
|
local function open_hangup_view(show)
|
|
self:OpenView("ExpQuickHangUpView", show)
|
|
end
|
|
self.model:Bind(ExpDunModel.OPEN_QUICK_HANGUP_VIEW, open_hangup_view)
|
|
|
|
local function open_hangup_receive_view(show, reward_list)
|
|
self:OpenView("ExpHangUpReceiveView", show, reward_list)
|
|
end
|
|
self.model:Bind(ExpDunModel.OPEN_HANGUP_RECEIVE_VIEW, open_hangup_receive_view)
|
|
|
|
local function check_open_hangup_receive_view()
|
|
local condition = Config.Modulesub["610@16"].open_lv
|
|
local lv = RoleManager.Instance.mainRoleInfo.level
|
|
if condition > lv then
|
|
local str = string.format("%s级开放", condition)
|
|
Message.show(str, "fault")
|
|
else
|
|
-- 满足条件的情况下,要判断当前的挂机时间是否满足1个小时,否则用不可领取奖励界面的表现显示
|
|
-- 获取已累计的挂机时间
|
|
local contain_time = self.model:GetHangUpContainTimeData()
|
|
-- local pass_time = TimeUtil:getServerTime() - last_time
|
|
if contain_time > 3601 then
|
|
BaseDungeonModel:getInstance():Fire(BaseDungeonModel.REQUEST_CCMD_EVENT, 61050, 0, 0)
|
|
else
|
|
open_hangup_receive_view(true, nil)
|
|
end
|
|
end
|
|
end
|
|
self.model:Bind(ExpDunModel.CHECK_OPEN_HANGUP_RECEIVE_VIEW, check_open_hangup_receive_view)
|
|
|
|
local function open_wave_rank_view(show)
|
|
self:OpenView("ExpDunWaveRankView", show)
|
|
end
|
|
self.model:Bind(ExpDunModel.OPEN_WAVE_RANK_VIEW, open_wave_rank_view)
|
|
|
|
local main_role = RoleManager.Instance.mainRoleInfo
|
|
-- 战力更新时刷新主界面经验副本按钮tips
|
|
local function update_expdun_tips_by_power_change()
|
|
self.model:UpdateMainTipsOnChangePowerOrWave(true, false)
|
|
end
|
|
if self.update_expdun_tips_by_power_change_id then
|
|
main_role:UnBind(self.update_expdun_tips_by_power_change_id)
|
|
self.update_expdun_tips_by_power_change_id = nil
|
|
end
|
|
if self.update_expdun_tips_by_level_change_id then
|
|
main_role:UnBind(self.update_expdun_tips_by_level_change_id)
|
|
self.update_expdun_tips_by_level_change_id = nil
|
|
end
|
|
self.update_expdun_tips_by_power_change_id = main_role:BindOne("fighting", update_expdun_tips_by_power_change)
|
|
self.update_expdun_tips_by_level_change_id = main_role:Bind(EventName.CHANGE_LEVEL, update_expdun_tips_by_power_change) -- 等级变化也要刷
|
|
|
|
-- 如果有需要在返回大世界重新打开经验副本界面
|
|
local function onSceneLoadViewFinish()
|
|
if SceneManager:getInstance():IsMainCityorYieldScene() then
|
|
if self.model._need_open_exp_view then
|
|
self.model._need_open_exp_view = false
|
|
--新手期间不要停,继续做任务就好了
|
|
if RoleManager.Instance.mainRoleInfo.level <= Config.ConfigTaskEffect.GuideLevel then
|
|
GlobalEventSystem:Fire(EventName.FORCE_TO_DO_TASK)
|
|
return
|
|
end
|
|
open_exp_main_view(true)
|
|
-- open_exp_dun_main_view(true)
|
|
end
|
|
end
|
|
-- 无论如何都要置false,不然这个会影响正常流程
|
|
self.model._need_open_exp_view = false
|
|
end
|
|
self:Bind(EventName.SCENE_LOAD_VIEW_COMPLETE, onSceneLoadViewFinish)
|
|
|
|
-- 监听限制红点的任务完成情况
|
|
local function update_newly_red_by_finishtasks(id)
|
|
if not self.model:GetExpDunLimitNewlyRed() then
|
|
if not id or id == ExpDunModel.Newly_Limit_Taskid then
|
|
self.model:CheckExpDunLimitNewlyRed()
|
|
self.model:CheckExpRedDotAll()
|
|
end
|
|
end
|
|
end
|
|
self:Bind(TaskEvent.ANS_FINISHED_TASK_LIST, update_newly_red_by_finishtasks)
|
|
|
|
-- 如果激活了经验挂机相关的宝宝生活技能,则需要推送更新刷新挂机时间相关的逻辑
|
|
local function on_pet_life_skill_actived(skill_id)
|
|
if skill_id == PetConst.LifeSkill.ExpOnHookTimeUp then
|
|
self.model:CheckExpRedDot(ExpDunModel.Red_Type.HangUp)
|
|
self.model:Fire(ExpDunModel.UPDATE_HANGUP_RECEIVE_TIME)
|
|
end
|
|
end
|
|
PetModel:getInstance():Bind(PetConst.PET_LIFE_SKILL_ACTIVED, on_pet_life_skill_actived)
|
|
|
|
local function updata_buff_state(id)--刷新免费BUFF次数状态
|
|
if id == KfActivityModel.TabID.MaterialSubmit then--
|
|
self.model:CheckExpRedDot(ExpDunModel.Red_Type.QuickHangUp)
|
|
end
|
|
end
|
|
KfActivityModel:getInstance():Bind(KfActivityModel.ANS_UPDATE_VIEW,updata_buff_state)
|
|
end
|
|
|