【特权优化】特权任务在关卡界面增加快捷入口

dev_chengFeng
gaoxin 2021-05-20 21:00:29 +08:00
parent da17fb96ed
commit aecc6eb692
3 changed files with 84 additions and 8 deletions

View File

@ -127,7 +127,6 @@ function FightPointPassMainPanel:InitComponent()
this.getRewardButton = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton")
this.mainTaskGRewardImage = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton/getRewardImage")
this.mainTaskJumpImage = Util.GetGameObject(self.gameObject, "Bg/RightDown/mainTask/getRewardButton/jumpImage")
this.mainTask:SetActive(false)
this.GuideEffectGo = poolManager:LoadAsset("GuideEffect", PoolManager.AssetType.GameObject)
this.GuideEffectGo.transform:SetParent(this.mainTaskGRewardImage.transform)
@ -300,6 +299,16 @@ function FightPointPassMainPanel:BindEvent()
UIManager.OpenPanel(UIName.FightLevelChapterPanel)
end)
Util.AddClick(this.getRewardButton, function()
local t, task = VipManager.GetVipTaskShowInFight()
if t == 1 and task.state == VipTaskStatusDef.NotFinished then
local taskConfigInfo = ConfigManager.GetConfigData(ConfigName.TaskConfig, task.missionId)
JumpManager.GoJump(taskConfigInfo.Jump[1])
else
UIManager.OpenPanel(UIName.VipPanelV2)
end
end)
BindRedPointObject(RedPointType.DailyTaskMain, this.dailyRedPoint)
BindRedPointObject(RedPointType.SecretTer_IsCanFight, this.fightRP)
BindRedPointObject(RedPointType.XiaoYaoYouRedPoint, this.xiaoyaoRedPoint)
@ -338,6 +347,7 @@ function FightPointPassMainPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Mission.GetOpenServerRewardRefreshFightPoint, this.UpdateOpenSeverWelfare)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
Game.GlobalEvent:AddEvent(GameEvent.Player.OnPlayerLvChange, this.SetFightBtnText)
Game.GlobalEvent:AddEvent(GameEvent.Vip.OnVipTaskStatusChanged, this.refreshVipTask)
end
--移除事件监听(用于子类重写)
@ -351,6 +361,7 @@ function FightPointPassMainPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Mission.GetOpenServerRewardRefreshFightPoint, this.UpdateOpenSeverWelfare)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnShowBattleUpLvTip, this.RefreshBattleUpLvTip)
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayerLvChange, this.SetFightBtnText)
Game.GlobalEvent:RemoveEvent(GameEvent.Vip.OnVipTaskStatusChanged, this.refreshVipTask)
end
--界面打开时调用(用于子类重写)
@ -442,7 +453,31 @@ function FightPointPassMainPanel:OnShow()
-- 刷新一次编队战斗力
FormationManager.RefreshMainFormationPower()
PatFaceManager.RefreshPatface()
-- 刷新任务显示
this.refreshVipTask()
end
-- 刷新任务显示
function this.refreshVipTask()
local t, task = VipManager.GetVipTaskShowInFight()
-- 满级后不再显示
this.mainTask:SetActive(t ~= -1)
if t == 0 then
-- 能激活时显示激活特权
this.titleText.text = "前往升级特权"
this.progressText.text = ""
elseif t == 1 then
-- 不能激活时显示任务
local taskConfigInfo = ConfigManager.GetConfigData(ConfigName.TaskConfig, task.missionId)
this.titleText.text = GetLanguageStrById(taskConfigInfo.Desc)..string.format("(%s/%s)", task.progress, taskConfigInfo.TaskValue[2][1])
this.progressText.text = ""
this.mainTaskGRewardImage:SetActive(task.state ~= VipTaskStatusDef.NotFinished)
this.mainTaskJumpImage:SetActive(task.state == VipTaskStatusDef.NotFinished)
end
end
--寻宝显示
function this.UpdateFindTreasureMaterialNum()
local mazeTreasureMax = ConfigManager.GetConfigData(ConfigName.PlayerLevelConfig,PlayerManager.level).MazeTreasureMax
@ -657,11 +692,11 @@ end
--界面销毁时调用(用于子类重写)
function FightPointPassMainPanel:OnDestroy()
orginLayer=0
invadeMonster:OnDestroy()
this.spLoader:Destroy()
poolManager:UnLoadAsset("GuideEffect", this.GuideEffectGo, PoolManager.AssetType.GameObject)
poolManager:UnLoadAsset("GuideEffect", this.GuideJumpEffectGo, PoolManager.AssetType.GameObject)
-- poolManager:UnLoadAsset("GuideEffect", this.GuideEffectGo, PoolManager.AssetType.GameObject)
-- poolManager:UnLoadAsset("GuideEffect", this.GuideJumpEffectGo, PoolManager.AssetType.GameObject)
poolManager:UnLoadLive(fightAnimRes, this.animGo, PoolManager.AssetType.GameObject)
SubUIManager.Close(this.UpView)
SubUIManager.Close(this.BtView)

View File

@ -1,4 +1,4 @@
JumpManager = {};
JumpManager = {};
local this = JumpManager
local JumpConfig=ConfigManager.GetConfig(ConfigName.JumpConfig)
function this.Initialize()
@ -242,10 +242,14 @@ local jumpDic = {
UIManager.OpenPanel(UIName.GoodFriendMainPanel,nil,data[1])
end,
[JumpType.Level] = function(data)--关卡
UIManager.CloseAllStack(true)
local openPanle
openPanle = UIManager.OpenPanel(UIName.FightPointPassMainPanel)
if UIManager.IsTopShow(UIName.FightPointPassMainPanel) then
openPanle = UIManager.GetOpenPanel(UIName.FightPointPassMainPanel)
else
UIManager.CloseAllStack(true)
openPanle = UIManager.OpenPanel(UIName.FightPointPassMainPanel)
end
if openPanle then
openPanle.ShowGuideGo(data[1])
end

View File

@ -505,4 +505,41 @@ function this.GetCurMinCanGetRewardLevel()
end
return math.min(VipManager.GetVipLevel() + 1, VipManager.GetMaxVipLevel())
end
-- 获取挂机界面显示内容
function this.GetVipTaskShowInFight()
-- 满级
if this.GetVipLevel() >= this.GetMaxVipLevel() then
return -1
end
local taskListInfo = TaskManager.GetTypeTaskList(TaskTypeDef.VipTask)
local isfinish = true
local isGetReward = 0
for i = 1, #taskListInfo do
-- 不是回收状态则未完成
if taskListInfo[i].state ~= VipTaskStatusDef.Received then
isfinish = false
end
-- 找到第一个未领取的奖励
if isGetReward == 0 then
if taskListInfo[i].state == VipTaskStatusDef.NotFinished then
isGetReward = i
end
end
-- 找到第一个可领取的奖励
if taskListInfo[i].state == VipTaskStatusDef.CanReceive then
isGetReward = i
break
end
end
-- 激活
if isfinish then
return 0
else
return 1, taskListInfo[isGetReward]
end
end
return this