支线副本战斗中的任务
This commit is contained in:
parent
100e125c19
commit
ef1b59db67
@ -16,6 +16,10 @@ function DungeonArmorManager:showStarRewardUI()
|
|||||||
UIManager:showUI("app/ui/dungeon_armor/dungeon_armor_star_reward_ui")
|
UIManager:showUI("app/ui/dungeon_armor/dungeon_armor_star_reward_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function DungeonArmorManager:showBattleTaskUI()
|
||||||
|
UIManager:showUI("app/ui/dungeon_armor/dungeon_armor_task_ui")
|
||||||
|
end
|
||||||
|
|
||||||
function DungeonArmorManager:reqFight(chapterId)
|
function DungeonArmorManager:reqFight(chapterId)
|
||||||
if not DataManager.FormationData:formationIsFull(GConst.BattleConst.FORMATION_TYPE.DUNGEON_ARMOR) then
|
if not DataManager.FormationData:formationIsFull(GConst.BattleConst.FORMATION_TYPE.DUNGEON_ARMOR) then
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8))
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8))
|
||||||
|
|||||||
@ -455,6 +455,11 @@ function BattleUI:refreshTaskBtn()
|
|||||||
taskBtn:addClickListener(function()
|
taskBtn:addClickListener(function()
|
||||||
ModuleManager.DailyChallengeManager:showBattleTaskUI()
|
ModuleManager.DailyChallengeManager:showBattleTaskUI()
|
||||||
end)
|
end)
|
||||||
|
elseif self.battleController.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_ARMOR then
|
||||||
|
taskBtn:setActive(true)
|
||||||
|
taskBtn:addClickListener(function()
|
||||||
|
ModuleManager.DungeonArmorManager:showBattleTaskUI()
|
||||||
|
end)
|
||||||
else
|
else
|
||||||
taskBtn:setActive(false)
|
taskBtn:setActive(false)
|
||||||
end
|
end
|
||||||
|
|||||||
16
lua/app/ui/dungeon_armor/cell/task_cell.lua
Normal file
16
lua/app/ui/dungeon_armor/cell/task_cell.lua
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
local TaskCell = class("TaskCell", BaseCell)
|
||||||
|
|
||||||
|
local ICON_BG = {"dungeon_armor_bg_9", "dungeon_armor_bg_10"}
|
||||||
|
local ICON = {"dungeon_armor_star_2", "dungeon_armor_star_1"}
|
||||||
|
|
||||||
|
function TaskCell:refresh(desc, over)
|
||||||
|
local uiMap = self:getUIMap()
|
||||||
|
local icon = over and ICON_BG[2] or ICON_BG[1]
|
||||||
|
uiMap["task_cell.task_icon_bg"]:setSprite(GConst.ATLAS_PATH.UI_DUGEON_ARMOR, icon)
|
||||||
|
icon = over and ICON[2] or ICON[1]
|
||||||
|
uiMap["task_cell.task_icon"]:setSprite(GConst.ATLAS_PATH.UI_DUGEON_ARMOR, icon)
|
||||||
|
uiMap["task_cell.desc"]:setText(desc)
|
||||||
|
uiMap["task_cell.check"]:setVisible(over)
|
||||||
|
end
|
||||||
|
|
||||||
|
return TaskCell
|
||||||
10
lua/app/ui/dungeon_armor/cell/task_cell.lua.meta
Normal file
10
lua/app/ui/dungeon_armor/cell/task_cell.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f0e420201dbebf48b3a42345380a006
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -52,6 +52,8 @@ function DungeonArmorMainUI:_display()
|
|||||||
uiMap["dungeon_armor_main_ui.banner.btn_formation.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_4))
|
uiMap["dungeon_armor_main_ui.banner.btn_formation.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_4))
|
||||||
self.bg1 = uiMap["dungeon_armor_main_ui.scrollrect.viewport.content.bg_1"]
|
self.bg1 = uiMap["dungeon_armor_main_ui.scrollrect.viewport.content.bg_1"]
|
||||||
self.bg2 = uiMap["dungeon_armor_main_ui.scrollrect.viewport.content.bg_2"]
|
self.bg2 = uiMap["dungeon_armor_main_ui.scrollrect.viewport.content.bg_2"]
|
||||||
|
self.bg1:setAnchoredPositionY(-1)
|
||||||
|
self.bg2:setAnchoredPositionY(-1)
|
||||||
|
|
||||||
self:refreshScrollrect()
|
self:refreshScrollrect()
|
||||||
self:refreshFormation()
|
self:refreshFormation()
|
||||||
|
|||||||
55
lua/app/ui/dungeon_armor/dungeon_armor_task_ui.lua
Normal file
55
lua/app/ui/dungeon_armor/dungeon_armor_task_ui.lua
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
local DungeonArmorTaskUI = class("DungeonArmorTaskUI", BaseUI)
|
||||||
|
|
||||||
|
local TASK_CELL = "app/ui/dungeon_armor/cell/task_cell"
|
||||||
|
|
||||||
|
function DungeonArmorTaskUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function DungeonArmorTaskUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/dungeon_armor/dungeon_armor_task_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
---- 构建数据
|
||||||
|
function DungeonArmorTaskUI:ctor()
|
||||||
|
local battleController = ModuleManager.BattleManager.battleController
|
||||||
|
if not battleController then
|
||||||
|
self.taskCurProgress = {}
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.armorData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR)
|
||||||
|
self.chapterId = battleController.chapterId
|
||||||
|
self.taskProgrees = self.armorData:formatTaskByController(battleController, self.chapterId)
|
||||||
|
end
|
||||||
|
|
||||||
|
function DungeonArmorTaskUI:onLoadRootComplete()
|
||||||
|
self:_display()
|
||||||
|
self:_addListeners()
|
||||||
|
end
|
||||||
|
|
||||||
|
function DungeonArmorTaskUI:_display()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
if not self.taskCells then
|
||||||
|
self.taskCells = {}
|
||||||
|
for i = 1, 3 do
|
||||||
|
self.taskCells[i] = CellManager:addCellComp(uiMap["dungeon_armor_task_ui.bg.task_cell_" .. i], TASK_CELL)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for index, cell in ipairs(self.taskCells) do
|
||||||
|
local desc, over = self.armorData:getTaskDescByIndex(self.chapterId, index, nil, self.taskProgrees)
|
||||||
|
print(desc)
|
||||||
|
cell:refresh(desc, over)
|
||||||
|
end
|
||||||
|
|
||||||
|
uiMap["dungeon_armor_task_ui.bg.title_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_NAME))
|
||||||
|
end
|
||||||
|
|
||||||
|
function DungeonArmorTaskUI:_addListeners()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
uiMap["dungeon_armor_task_ui.bg.close_btn"]:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return DungeonArmorTaskUI
|
||||||
10
lua/app/ui/dungeon_armor/dungeon_armor_task_ui.lua.meta
Normal file
10
lua/app/ui/dungeon_armor/dungeon_armor_task_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 435821f2a3c024445a78df73d06107fe
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -299,4 +299,77 @@ function DungeonArmorEntity:getMinLowThreeStarId()
|
|||||||
return self.maxPassedId
|
return self.maxPassedId
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function DungeonArmorEntity:formatTaskByController(battleBaseController, chapterId)
|
||||||
|
local taskProgress = {}
|
||||||
|
if not battleBaseController then
|
||||||
|
return taskProgress
|
||||||
|
end
|
||||||
|
local pass = self:getPassedMaxId() >= chapterId and 1 or 0
|
||||||
|
local hpp = math.floor(battleBaseController.battleData:getAtkTeam():getHpPercent() * 100 + 0.0001)
|
||||||
|
local bossRoundCount = 0
|
||||||
|
if battleBaseController.waveIndex >= battleBaseController.maxWaveIndex then -- 最后一波
|
||||||
|
bossRoundCount = battleBaseController.waveRoundCount[battleBaseController.waveIndex] or 0
|
||||||
|
end
|
||||||
|
local totalRound = 0
|
||||||
|
for wave, round in pairs(battleBaseController.waveRoundCount) do
|
||||||
|
totalRound = totalRound + round
|
||||||
|
end
|
||||||
|
|
||||||
|
taskProgress = {
|
||||||
|
[0] = pass,
|
||||||
|
[1] = hpp,
|
||||||
|
[2] = bossRoundCount,
|
||||||
|
[3] = totalRound,
|
||||||
|
}
|
||||||
|
|
||||||
|
return taskProgress
|
||||||
|
end
|
||||||
|
|
||||||
|
function DungeonArmorEntity:getTaskDesc(chapterId, taskId, progress)
|
||||||
|
local config = ConfigManager:getConfig("task_dungeon_armor")[taskId]
|
||||||
|
if not config then
|
||||||
|
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_7), self:getPassedMaxId() >= chapterId
|
||||||
|
end
|
||||||
|
|
||||||
|
local desc = I18N:getConfig("task_dungeon_armor")[taskId].desc
|
||||||
|
|
||||||
|
progress = progress or 0
|
||||||
|
local taskNum = config.param
|
||||||
|
local over = false
|
||||||
|
if taskId == 1 then -- 特殊处理
|
||||||
|
over = progress >= taskNum
|
||||||
|
progress = progress .. "%"
|
||||||
|
taskNum = taskNum .. "%"
|
||||||
|
elseif taskId == 2 then
|
||||||
|
over = progress <= taskNum
|
||||||
|
elseif taskId == 3 then
|
||||||
|
over = progress <= taskNum
|
||||||
|
end
|
||||||
|
local color = "#FF4949"
|
||||||
|
if over then
|
||||||
|
color = "#49FF49"
|
||||||
|
end
|
||||||
|
local progressStr = string.format("<color=%s>(%s/%s)</color>", color, progress, taskNum)
|
||||||
|
return desc .. progressStr, over
|
||||||
|
end
|
||||||
|
|
||||||
|
function DungeonArmorEntity:getTaskDescByIndex(chapterId, index, battleBaseController, taskProgress)
|
||||||
|
taskProgress = taskProgress or self:formatTaskByController(battleBaseController, chapterId)
|
||||||
|
|
||||||
|
if not self.taskList then
|
||||||
|
self.taskList = {}
|
||||||
|
end
|
||||||
|
if not self.taskList[chapterId] then
|
||||||
|
self.taskList[chapterId] = GFunc.getTable(self:getConfig(chapterId).star_task)
|
||||||
|
table.insert(self.taskList[chapterId], 1, 0) -- 首位添加默认任务
|
||||||
|
end
|
||||||
|
|
||||||
|
local taskId = self.taskList[chapterId][index]
|
||||||
|
if not taskId then
|
||||||
|
return GConst.EMPTY_STRING
|
||||||
|
end
|
||||||
|
|
||||||
|
return self:getTaskDesc(chapterId, taskId, taskProgress[taskId])
|
||||||
|
end
|
||||||
|
|
||||||
return DungeonArmorEntity
|
return DungeonArmorEntity
|
||||||
Loading…
x
Reference in New Issue
Block a user