通用扫荡弹窗

This commit is contained in:
xiekaidong 2023-07-19 10:39:22 +08:00
parent 27ef576c8f
commit 854ce2b986
7 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,18 @@
local CommonManager = class("CommonManager", BaseModule)
function CommonManager:showMopUpUI(rewards, remainCount, callback, customtitleTx, targetReward, targetDesc, targetTotalProgress)
local params = {
customtitleTx = customtitleTx,
rewards = rewards,
remainCount = remainCount,
callback = callback,
---- 有目标的扫荡 可为nil
targetReward = targetReward,
targetDesc = targetDesc,
targetTotalProgress = targetTotalProgress,
}
UIManager:showUI("app/ui/common/mop_up_ui", params)
end
return CommonManager

View File

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

View File

@ -59,6 +59,8 @@ local MODULE_PATHS = {
ArenaManager = "app/module/arena/arena_manager",
-- 图鉴
CollectionManager = "app/module/collection/collection_manager",
-- 通用
CommonManager = "app/module/common/common_manager",
}
-- 这里的key对应func_open里的id

View File

@ -358,6 +358,9 @@ local localization_global =
["DUNGEON_WEAPON_DESC_1"] = "帝国军械库",
["DUNGEON_WEAPON_DESC_2"] = "帝国军械库帮助文本",
["DUNGEON_WEAPON_DESC_3"] = "帝国军械库副本描述",
["MOP_UP_DESC_1"] = "扫荡完成",
["MOP_UP_DESC_2"] = "再次扫荡",
}
return localization_global

View File

@ -111,6 +111,7 @@ function RewardCell:showMask(show, syncCheck)
end
function RewardCell:hideCountTx()
self:setNumTx(GConst.EMPTY_STRING)
end
function RewardCell:showCheck(show)

View File

@ -0,0 +1,109 @@
local MopUpUI = class("MopUpUI", BaseUI)
function MopUpUI:isFullScreen()
return false
end
function MopUpUI:getPrefabPath()
return "assets/prefabs/ui/common/mop_up_ui.prefab"
end
function MopUpUI:ctor(params)
self.customtitleTx = params.customtitleTx
self.rewards = params.rewards
self.remainCount = params.remainCount
self.callback = params.callback
---- 有目标的扫荡
self.targetReward = params.targetReward
self.targetDesc = params.targetDesc
self.targetTotalProgress = params.targetTotalProgress
end
function MopUpUI:onLoadRootComplete()
self:_display()
self:_addListeners()
end
function MopUpUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["mop_up_ui.bg.title_text"]:setText(self.customtitleTx or I18N:getGlobalText(I18N.GlobalConst.MOP_UP_DESC_1))
uiMap["mop_up_ui.bg.tx_none"]:setText(I18N:getGlobalText(I18N.GlobalConst.GET_REWARDS_DESC))
uiMap["mop_up_ui.bg.ok_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MOP_UP_DESC_2))
local remianTxObj = uiMap["mop_up_ui.bg.remain_tx"]
if self.remainCount then
remianTxObj:setVisible(true)
remianTxObj:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_21, self.remainCount))
else
remianTxObj:setVisible(false)
end
self:refreshTarget()
self:refreshScrollrect()
end
function MopUpUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["mop_up_ui.bg.close_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["mop_up_ui.bg.ok_btn"]:addClickListener(function()
self:closeUI()
if self.callback then
self.callback()
end
end)
end
function MopUpUI:refreshScrollrect()
if not self.scrollRect then
local uiMap = self.root:genAllChildren()
self.scrollRect = uiMap["mop_up_ui.bg.scroll_rect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.rewards[index])
end)
end
self.scrollRect:refillCells(#self.rewards)
end
function MopUpUI:refreshTarget()
local uiMap = self.root:genAllChildren()
local bg = uiMap["mop_up_ui.bg"]
local node = uiMap["mop_up_ui.bg.item_node"]
if not self.targetReward then
node:setVisible(false)
bg:setSizeDeltaY(518)
return
end
bg:setSizeDeltaY(632)
node:setVisible(true)
if not self.rewardCell then
self.rewardCell = CellManager:addCellComp(uiMap["mop_up_ui.bg.item_node.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
self.rewardCell:refreshByConfig(self.targetReward)
self.rewardCell:hideCountTx()
uiMap["mop_up_ui.bg.item_node.desc_1"]:setText(self.targetDesc)
local curProgress = 0
if GFunc.getRewardType(self.targetReward) == GConst.REWARD_TYPE.ITEM then
local id = GFunc.getRewardId(self.targetReward)
curProgress = DataManager.BagData.ItemData:getItemNumById(id) or 0
end
local progressTx
if curProgress >= self.targetTotalProgress then
progressTx = string.format("<color=#49FF49>%s</color>/%s", curProgress, self.targetTotalProgress)
else
progressTx = string.format("<color=#FF4949>%s</color>/%s", curProgress, self.targetTotalProgress)
end
uiMap["mop_up_ui.bg.item_node.desc_2"]:setText(progressTx)
uiMap["mop_up_ui.bg.item_node.progress_slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = curProgress / self.targetTotalProgress
end
return MopUpUI

View File

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