From 854ce2b986ca2dc7f0ab537e865c63dad5cb6732 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 19 Jul 2023 10:39:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=89=AB=E8=8D=A1=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/common_manager.lua | 18 ++++ lua/app/common/common_manager.lua.meta | 10 +++ lua/app/common/module_manager.lua | 2 + lua/app/config/strings/cn/global.lua | 3 + lua/app/ui/common/cell/reward_cell.lua | 1 + lua/app/ui/common/mop_up_ui.lua | 109 +++++++++++++++++++++++++ lua/app/ui/common/mop_up_ui.lua.meta | 10 +++ 7 files changed, 153 insertions(+) create mode 100644 lua/app/common/common_manager.lua create mode 100644 lua/app/common/common_manager.lua.meta create mode 100644 lua/app/ui/common/mop_up_ui.lua create mode 100644 lua/app/ui/common/mop_up_ui.lua.meta diff --git a/lua/app/common/common_manager.lua b/lua/app/common/common_manager.lua new file mode 100644 index 00000000..66b5a688 --- /dev/null +++ b/lua/app/common/common_manager.lua @@ -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 \ No newline at end of file diff --git a/lua/app/common/common_manager.lua.meta b/lua/app/common/common_manager.lua.meta new file mode 100644 index 00000000..95be7962 --- /dev/null +++ b/lua/app/common/common_manager.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 67801c6593529c84d8b2f218d5c629a6 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua index 86c61778..dcef1743 100644 --- a/lua/app/common/module_manager.lua +++ b/lua/app/common/module_manager.lua @@ -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 diff --git a/lua/app/config/strings/cn/global.lua b/lua/app/config/strings/cn/global.lua index 44e39fa8..bd002398 100644 --- a/lua/app/config/strings/cn/global.lua +++ b/lua/app/config/strings/cn/global.lua @@ -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 \ No newline at end of file diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua index 524d4a87..a7f5672e 100644 --- a/lua/app/ui/common/cell/reward_cell.lua +++ b/lua/app/ui/common/cell/reward_cell.lua @@ -111,6 +111,7 @@ function RewardCell:showMask(show, syncCheck) end function RewardCell:hideCountTx() + self:setNumTx(GConst.EMPTY_STRING) end function RewardCell:showCheck(show) diff --git a/lua/app/ui/common/mop_up_ui.lua b/lua/app/ui/common/mop_up_ui.lua new file mode 100644 index 00000000..9ea6db60 --- /dev/null +++ b/lua/app/ui/common/mop_up_ui.lua @@ -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("%s/%s", curProgress, self.targetTotalProgress) + else + progressTx = string.format("%s/%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 \ No newline at end of file diff --git a/lua/app/ui/common/mop_up_ui.lua.meta b/lua/app/ui/common/mop_up_ui.lua.meta new file mode 100644 index 00000000..a6a67acd --- /dev/null +++ b/lua/app/ui/common/mop_up_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e94c75a778017db4ab49d11d551655ad +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}