每日挑战战斗内部界面

This commit is contained in:
xiekaidong 2023-05-25 19:16:03 +08:00 committed by Fang
parent b8bbad816b
commit 13d470ad5b
7 changed files with 126 additions and 6 deletions

View File

@ -11,8 +11,8 @@ local BATTLE_CONTROLLER = {
[BattleConst.BATTLE_TYPE.DAILY_CHALLENGE] = "app/module/battle/controller/battle_controller_daily_challenge", [BattleConst.BATTLE_TYPE.DAILY_CHALLENGE] = "app/module/battle/controller/battle_controller_daily_challenge",
} }
function BattleManager:showPauseUI() function BattleManager:showPauseUI(battleType)
UIManager:showUI("app/ui/battle/battle_pause_ui") UIManager:showUI("app/ui/battle/battle_pause_ui", {battleType = battleType})
end end
function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx) function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx)

View File

@ -26,11 +26,29 @@ end
function BattleControllerDailyChallenge:getBuffs() function BattleControllerDailyChallenge:getBuffs()
if not self.initBuffs then if not self.initBuffs then
self.initBuffs = {} self.initBuffs = {}
local buffs = DataManager.DailyChallengeData:getTodayBuff()
local cfg = ConfigManager:getConfig("buff_daily_challenge")
for _, buffId in ipairs(buffs) do
local effect = cfg[buffId] and cfg[buffId].effect
if effect then
local buffEntity = BattleBuffEntity:create()
buffEntity:init(effect[1])
buffEntity:setTargetSide(cfg[buffId].obj)
buffEntity:setIsCantRemove(true)
table.insert(self.initBuffs, buffEntity)
end
end
end end
return self.initBuffs return self.initBuffs
end end
function BattleControllerDailyChallenge:onLoadComplete(...)
BattleController.onLoadComplete(self, ...)
ModuleManager.DailyChallengeManager:showBattleBuffUI()
end
function BattleControllerDailyChallenge:initOther() function BattleControllerDailyChallenge:initOther()
local ChapterId = DataManager.DailyChallengeData:getFixedChapterId() local ChapterId = DataManager.DailyChallengeData:getFixedChapterId()
local cfg = ConfigManager:getConfig("chapter")[ChapterId] local cfg = ConfigManager:getConfig("chapter")[ChapterId]
@ -216,7 +234,11 @@ function BattleControllerDailyChallenge:controllBattleEnd()
if not self.victory then if not self.victory then
self.combatReport.wave = self.combatReport.wave - 1 self.combatReport.wave = self.combatReport.wave - 1
end end
ModuleManager.DailyChallengeManager:endFight(self.chapterId, self.combatReport, self.taskProgress, heroInfo) local lastBossRound = 0
if self.victory then
lastBossRound = self.waveRoundCount[self.waveIndex]
end
ModuleManager.DailyChallengeManager:endFight(self.chapterId, self.combatReport, self.taskProgress, heroInfo, lastBossRound)
end end
function BattleControllerDailyChallenge:postWaveOver(atkDead, isQuit) function BattleControllerDailyChallenge:postWaveOver(atkDead, isQuit)

View File

@ -4,6 +4,15 @@ function DailyChallengeManager:init()
-- body -- body
end end
function DailyChallengeManager:showBattleBuffUI()
UIManager:showUI("app/ui/battle/battle_daily_challenge_buff_ui")
end
function DailyChallengeManager:getBuffDesc(id)
local desc = I18N:getText("buff_daily_challenge", id, "desc")
return desc
end
-- 开始挑战 -- 开始挑战
function DailyChallengeManager:startChallenge() function DailyChallengeManager:startChallenge()
if not DataManager.DailyChallengeData:isEnoughChallengeTime() then if not DataManager.DailyChallengeData:isEnoughChallengeTime() then
@ -42,12 +51,13 @@ function DailyChallengeManager:rspStartChallenge(result)
end end
-- 挑战结束 -- 挑战结束
function DailyChallengeManager:endChallenge(chapterId, combatReport, taskProgress, heroInfo) function DailyChallengeManager:endChallenge(chapterId, combatReport, taskProgress, heroInfo, lastBossRound)
local parmas = { local parmas = {
win = combatReport.victory, win = combatReport.victory,
chapter_id = chapterId, chapter_id = chapterId,
pass_wave = combatReport.wave, pass_wave = combatReport.wave,
hero_info = heroInfo, hero_info = heroInfo,
kills_boss_turn = lastBossRound,
combatReport = combatReport, combatReport = combatReport,
} }
for fieldName, value in pairs(taskProgress) do for fieldName, value in pairs(taskProgress) do
@ -62,7 +72,7 @@ function DailyChallengeManager:endChallengeFinish(result)
local reqData = result.reqData local reqData = result.reqData
local rewards = result.rewards local rewards = result.rewards
ModuleManager.BattleManager:showBattleResultUI(rewards, reqData.combatReport) ModuleManager.BattleManager:showBattleResultUI(rewards, reqData.combatReport)
-- todo DataManager.DailyChallengeData:init(result.daily_challenge)
ModuleManager.TaskManager:addFightTaskProgress(reqData) ModuleManager.TaskManager:addFightTaskProgress(reqData)
end end

View File

@ -0,0 +1,44 @@
local BattleDailyChallengeBuffUI = class("BattleDailyChallengeBuffUI", BaseUI)
function BattleDailyChallengeBuffUI:isFullScreen()
return false
end
function BattleDailyChallengeBuffUI:getPrefabPath()
return "assets/prefabs/ui/battle/battle_daily_challenge_buff_ui.prefab"
end
function BattleDailyChallengeBuffUI:ctor()
self.buffDescs = {}
for _, id in ipairs(DataManager.DailyChallengeData:getTodayBuff()) do
local cfg = ConfigManager:getConfig("buff_daily_challenge")[id]
if cfg then
self.buffDescs[cfg.buff_type] = ModuleManager.DailyChallengeManager:getBuffDesc(id)
end
end
end
function BattleDailyChallengeBuffUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function BattleDailyChallengeBuffUI:_display()
local uiMap = self.root:genAllChildren()
local buffDescs = {
uiMap["battle_daily_challenge_buff_ui.raw_img.desc_1"],
uiMap["battle_daily_challenge_buff_ui.raw_img.desc_2"]
}
for index, obj in ipairs(buffDescs) do
obj:setText(self.buffDescs[index])
end
end
function BattleDailyChallengeBuffUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["battle_daily_challenge_buff_ui.mask"]:addClickListener(function()
self:closeUI()
end)
end
return BattleDailyChallengeBuffUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f8cfb53ae0f60824da0759e9827d46f5
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -20,6 +20,7 @@ function BattlePauseUI:getPrefabPath()
end end
function BattlePauseUI:ctor(params) function BattlePauseUI:ctor(params)
self.battleType = params.battleType
local map = DataManager.BattleData:getSelectSkillMap() local map = DataManager.BattleData:getSelectSkillMap()
self.skillList = {} self.skillList = {}
for skillId, info in pairs(map) do for skillId, info in pairs(map) do
@ -39,6 +40,7 @@ function BattlePauseUI:_display()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
uiMap["battle_pause_ui.skill_node.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_2)) uiMap["battle_pause_ui.skill_node.title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_2))
self:_refreshScrollRect() self:_refreshScrollRect()
self:refreshDailyChallengeNode()
end end
function BattlePauseUI:_addListeners() function BattlePauseUI:_addListeners()
@ -91,4 +93,36 @@ function BattlePauseUI:_refreshScrollRect()
self.scrollRect:refillCells(#self.skillList) self.scrollRect:refillCells(#self.skillList)
end end
function BattlePauseUI:refreshDailyChallengeNode()
local uiMap = self.root:genAllChildren()
local node = uiMap["battle_pause_ui.daily_challenge_node"]
if self.battleType ~= GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE then
node:setVisible(false)
return
end
node:setVisible(true)
local buffDescs = {}
for _, id in ipairs(DataManager.DailyChallengeData:getTodayBuff()) do
local cfg = ConfigManager:getConfig("buff_daily_challenge")[id]
if cfg then
buffDescs[cfg.buff_type] = ModuleManager.DailyChallengeManager:getBuffDesc(id)
end
end
local buffBtns = {
uiMap["battle_pause_ui.daily_challenge_node.buff_1"],
uiMap["battle_pause_ui.daily_challenge_node.buff_2"]
}
for i, obj in ipairs(buffBtns) do
obj:addClickListener(function()
ModuleManager.TipsManager:showDescTips(buffDescs[i] or GConst.EMPTY_STRING, obj)
end)
end
uiMap["battle_pause_ui.daily_challenge_node.task"]:addClickListener(function()
end)
uiMap["battle_pause_ui.daily_challenge_node.buff_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BUFF_NAME))
uiMap["battle_pause_ui.daily_challenge_node.task_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_NAME))
end
return BattlePauseUI return BattlePauseUI

View File

@ -73,7 +73,7 @@ end
function BattleUI:_addListeners() function BattleUI:_addListeners()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
uiMap["battle_ui.top_node.close_btn"]:addClickListener(function() uiMap["battle_ui.top_node.close_btn"]:addClickListener(function()
ModuleManager.BattleManager:showPauseUI() ModuleManager.BattleManager:showPauseUI(self.battleController.battleType)
end) end)
self:addEventListener(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, function(posIdList) self:addEventListener(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, function(posIdList)