diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua index 043108bc..e4cabaa8 100644 --- a/lua/app/common/module_manager.lua +++ b/lua/app/common/module_manager.lua @@ -33,6 +33,7 @@ local MODULE_PATHS = { GameSettingManager = "app/module/game_setting/game_setting_manager", -- 活动 ActivityManager = "app/module/activity/activity_manager", + ActivityPopManager = "app/module/activity/activity_pop_manager", -- 礼包 CommerceManager = "app/module/commerce/commerce_manager", -- 战令 diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index f3af667a..950e2926 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -189,6 +189,7 @@ GConst.TYPEOF_LUA_CLASS = { -- 资源条 CURRENCY_BAR = "app/ui/currency_bar/currency_bar", CURRENCY_BAR_CELL = "app/ui/currency_bar/cell/currency_cell", + POP_SKIP_BAR = "app/ui/pop_skip_bar/pop_skip_bar", -- cell ITEM_CELL = "app/ui/common/cell/item_cell", diff --git a/lua/app/module/activity/activity_pop_manager.lua b/lua/app/module/activity/activity_pop_manager.lua new file mode 100644 index 00000000..67243377 --- /dev/null +++ b/lua/app/module/activity/activity_pop_manager.lua @@ -0,0 +1,102 @@ +local ActivityPopManager = class("ActivityPopManager", BaseModule) + +function ActivityPopManager:setFirstLogin(isFirstEnter) + self.firstRechargePop = isFirstEnter + self.giftPop = isFirstEnter + self.giftPopChain = isFirstEnter + self.activityPop = { + isActSummon = isFirstEnter, + isActSprint = isFirstEnter, + } +end + +-- 增加今日不再提示组件(注意只可以在 onLoadRootComplete 里调用且只可以调用一次) +function ActivityPopManager:addPopBar(parent, node) + if not parent then + return + end + local childList = parent:getChildList() + for _, uiObj in pairs(childList) do + if uiObj:getTag() == GConst.GAME_OBJECT_TAG.POP_SKIP_BAR then + return + end + end + local targetNode = node or parent + UIPrefabManager:loadUIWidgetAsync("assets/prefabs/ui/common/pop_skip_bar.prefab", targetNode, function(prefabObject) + local popBar = prefabObject:addLuaComponent(GConst.TYPEOF_LUA_CLASS.POP_SKIP_BAR) + prefabObject:setTag(GConst.GAME_OBJECT_TAG.POP_SKIP_BAR) + popBar:show() + end) +end + +function ActivityPopManager:checkFirstRechargePop() + if DataManager.TutorialData:getIsInTutorial() then + return false + end + + if DataManager.ShopData:getNeedShowFirstRechargePop() then + ModuleManager.ShopManager:showFirstRechargeUI() + return true + end + + return false +end + +-- function ActivityPopManager:setGiftPopState(state) +-- self.giftPop = state +-- end + +-- function ActivityPopManager:checkGiftPop() +-- if not self.giftPop then +-- return false +-- end + +-- if self:checkPopGift() then +-- return true +-- end + +-- return false +-- end + +-- function ActivityPopManager:setGiftPopChainState(state) +-- self.giftPopChain = state +-- end + +function ActivityPopManager:checkActivityPop() + if self:checkActivityActivityPop() then + return true + end + + return false +end + +-- function ActivityPopManager:checkPopGift() +-- local giftType, _ = DataManager.GiftPopData:getPopGiftType(self.giftPop) +-- self.giftPop = false +-- if not giftType then +-- return false +-- end +-- ModuleManager.GiftPopManager:showPopGiftUI({ +-- popType = giftType +-- }) +-- return true +-- end + +function ActivityPopManager:checkActivityActivityPop() + return self:checkActSprint() +end + +-- 冲刺活动 +function ActivityPopManager:checkActSprint() + if not DataManager.ActSprintData:getIsOpen() or not DataManager.ActSprintData:showSideBar() then + return false + end + local params = {} + params.autoPop = true + params.showToday = GConst.MESSAGE_BOX_SHOW_TODAY.ACT_SPRINT + ModuleManager.ActSprintManager:showActSprintListUI(params) + self.activityPop.isActSprint = false + return true +end + +return ActivityPopManager \ No newline at end of file diff --git a/lua/app/module/activity/activity_pop_manager.lua.meta b/lua/app/module/activity/activity_pop_manager.lua.meta new file mode 100644 index 00000000..fbc647d6 --- /dev/null +++ b/lua/app/module/activity/activity_pop_manager.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 087c7df512aa24c2dbbabee10af49464 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/maincity/maincity_manager.lua b/lua/app/module/maincity/maincity_manager.lua index 960f2cfc..22935fb4 100644 --- a/lua/app/module/maincity/maincity_manager.lua +++ b/lua/app/module/maincity/maincity_manager.lua @@ -14,6 +14,7 @@ end -- 从登录界面第一次进入主城 function MaincityManager:firstEnterMainCity() + ModuleManager.ActivityPopManager:setFirstLogin(true) if (EDITOR_MODE or not Platform:getIsPublishChannel()) and LocalData:getTutorialSkip() > 0 then -- 如果是新号就直接进入战斗 self:showMainCityUI(true) diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index d09967ba..6b395991 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -680,16 +680,23 @@ function MainCityUI:checkMainPop() return end + -- 首充 + if ModuleManager.ActivityPopManager:checkFirstRechargePop() then + return + end + -- 礼包 -- if self:checkGift() then -- return -- end - -- 圆月活动 - -- local showType = DataManager.FullMoonData:getNeedShowActPanel() - -- if showType then - -- ModuleManager.FullMoonManager:showActMainUI(showType) - -- return + -- local actPopShowFlag = (not self.popSkipFlag) or DataManager.ActivityData:getTheDayFirstLogin() + -- if self.selectedInedx == GConst.MainCityConst.BOTTOM_PAGE.MAIN and not GFunc.isShenhe() then + -- if not DataManager.TutorialData:getIsInTutorial() and actPopShowFlag then + -- if ModuleManager.ActivityPopManager:checkActivityPop() then + -- return + -- end + -- end -- end end diff --git a/lua/app/ui/pop_skip_bar.meta b/lua/app/ui/pop_skip_bar.meta new file mode 100644 index 00000000..e1a32a47 --- /dev/null +++ b/lua/app/ui/pop_skip_bar.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 04ee08c712f07446d9d4921703631967 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/ui/pop_skip_bar/pop_skip_bar.lua b/lua/app/ui/pop_skip_bar/pop_skip_bar.lua new file mode 100644 index 00000000..fcbf2a21 --- /dev/null +++ b/lua/app/ui/pop_skip_bar/pop_skip_bar.lua @@ -0,0 +1,52 @@ +local Component = require (GConst.TYPEOF_LUA_CLASS.LUA_COMPONENT) +local PopSkipBar = class("PopSkipBar", Component) + +function PopSkipBar:init() + self.currVisible = true + local uiMap = self.baseObject:genAllChildren() + + self.onIcon = uiMap["pop_skip_bar.bg.toggle_bg.ok"] + self.text = uiMap["pop_skip_bar.bg.toggle_bg.Label"] + self.toggle_Btn = uiMap["pop_skip_bar.bg.toggle_bg"] + + self.Bg = uiMap["pop_skip_bar.bg"] + + self.Bg:setAnchoredPositionY(-110) + self:setVisible(false) + self.text:setText(I18N:getGlobalText(I18N.GlobalConst.CONFIRM_IGNORE)) + self:_addClickListener(self.toggle_Btn,function () + local flag = DataManager.ActivityData:getLoginPopSkipFlag() + DataManager.ActivityData:setLoginPopSkipFlag(not flag) + self:refreshIcon() + end) +end + +function PopSkipBar:show() + self:setVisible(true) + self:refreshIcon() +end + +function PopSkipBar:setVisible(visible) + if self.currVisible == visible then + return + end + self.currVisible = visible + if visible then + self.baseObject:setVisible(true) + else + self.baseObject:setVisible(false) + end +end + +function PopSkipBar:_addClickListener(Btn, callback) + if callback then + Btn:addClickListener(callback) + end +end + +function PopSkipBar:refreshIcon() + local flag = DataManager.ActivityData:getLoginPopSkipFlag() + self.onIcon:setActive(flag) +end + +return PopSkipBar \ No newline at end of file diff --git a/lua/app/ui/pop_skip_bar/pop_skip_bar.lua.meta b/lua/app/ui/pop_skip_bar/pop_skip_bar.lua.meta new file mode 100644 index 00000000..83a0f79c --- /dev/null +++ b/lua/app/ui/pop_skip_bar/pop_skip_bar.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 62e233795e5c0614e91e02a08b160baa +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}