This commit is contained in:
puxuan 2025-10-21 14:51:28 +08:00
parent 07632f410f
commit 6f87b9f938
13 changed files with 99 additions and 142 deletions

View File

@ -88,6 +88,8 @@ EventManager.CUSTOM_EVENT = {
BATTLE_REVIVE_FAILED = "BATTLE_REVIVE_FAILED",
BATTLE_DOUBLE_REWARD = "BATTLE_DOUBLE_REWARD",
REFRESH_MAIN_CITY_BOTTOM = "REFRESH_MAIN_CITY_BOTTOM",
CROSS_DAY = "CROSS_DAY",-- 跨天
}

View File

@ -46,6 +46,8 @@ local LOCAL_DATA_KEY = {
FOURTEEN_DAY_TODAY_EXCHANGE = "FOURTEEN_DAY_TODAY_EXCHANGE",
ACT_BOSS_RUSH_EXCHANGE = "ACT_BOSS_RUSH_EXCHANGE",
ACT_PVP_SHOW_HELP = "ACT_PVP_SHOW_HELP",
FUNC_OPEN = "FUNC_OPEN",
FUNC_OPEN_POP = "FUNC_OPEN_POP",
}
LocalData.KEYS = LOCAL_DATA_KEY
@ -521,4 +523,22 @@ function LocalData:setTutorialSkip(value)
self:setInt(LOCAL_DATA_KEY.TRUTORIAL_SKIP_FLAG, value)
end
function LocalData:getFuncOpenPopSkip()
return self:getInt(self:getRoleKey(LOCAL_DATA_KEY.FUNC_OPEN_POP), 0)
end
function LocalData:setFuncOpenPopSkip(value)
self:setInt(self:getRoleKey(LOCAL_DATA_KEY.FUNC_OPEN_POP), value)
end
function LocalData:getFuncOpenShowList()
local jsonStr = self:getString(self:getRoleKey(LOCAL_DATA_KEY.FUNC_OPEN), "{}")
return json.decode(jsonStr)
end
function LocalData:setFuncOpenShowList(list)
local jsonStr = json.encode(list)
self:setString(self:getRoleKey(LOCAL_DATA_KEY.FUNC_OPEN), jsonStr)
end
return LocalData

View File

@ -152,7 +152,7 @@ function ChapterManager:endFightFinish(result)
-- DataManager.ShopData:markPopUpGiftForActChapterStore(maxChapter)
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_PASS_CHAPTER)
-- 章节通关 检查是否要弹出功能解锁界面
DataManager.PlayerData:checkIfCanShowModuleUnlock(maxChapter)
-- DataManager.PlayerData:checkIfCanShowModuleUnlock(maxChapter)
-- 评价弹窗
-- self:tryShowEvaluationPopup(maxChapter)
end

View File

@ -33,32 +33,34 @@ function MaincityManager:firstEnterMainCity()
SDKManager:doUncompletePay()
end
function MaincityManager:changeMainCityLeftSideBarOpenOrClose()
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
--@region 功能开启
function MaincityManager:getFuncOpenShowList()
if EDITOR_MODE then
if LocalData:getFuncOpenPopSkip() > 0 then
return nil
end
self.isLeftSideBarClose = not self.isLeftSideBarClose
mainUI:refreshLeftBtns()
end
function MaincityManager:getIsMainCityLeftSideBarClose()
return self.isLeftSideBarClose
local showList = {}
for moduleKey, info in pairs(ConfigManager:getConfig("func_open")) do
if ModuleManager:showPop(moduleKey) and not LocalData:getFuncOpenShowList()[moduleKey] then
if ModuleManager:getIsOpen(moduleKey, true) then
table.insert(showList, moduleKey)
elseif moduleKey == ModuleManager.MODULE_KEY.EQUIP_SKIN and DataManager.WeaponData:isOpen() then
table.insert(showList, moduleKey)
elseif moduleKey == ModuleManager.MODULE_KEY.SKIN and DataManager.SkinData:isOpen() then
table.insert(showList, moduleKey)
end
end
end
function MaincityManager:changeMainCityRightSideBarOpenOrClose()
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
return showList
end
self.isRightSideBarClose = not self.isRightSideBarClose
mainUI:refreshRightBtns()
end
function MaincityManager:getIsMainCityRightSideBarClose()
return self.isRightSideBarClose
function MaincityManager:markFuncOpen(key)
local list = LocalData:getFuncOpenShowList()
list[key] = true
LocalData:setFuncOpenShowList(list)
end
-- 获取主界面各个模块的入口坐标
@ -85,31 +87,7 @@ function MaincityManager:getModuleEntrancePos(moduleKey)
return mainUI:getSideBarActIconPos(moduleKey)
end
end
-- 模块在侧边栏,-10不在侧边栏1
function MaincityManager:getModuleInSideBarWhere(moduleKey)
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
if mainUI:isInSideBarLeft(moduleKey) then
return -1
elseif mainUI:isInSideBarRight(moduleKey) then
return 1
else
return 0
end
end
function MaincityManager:isActivSideBarModule(moduleKey)
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
return mainUI:isActivSideBarModule(moduleKey)
end
--@endregion
--@region 战斗力
function MaincityManager:checkShowPowerUI()

View File

@ -33,10 +33,12 @@ function TaskCell:refresh(id, period)
if DataManager.ActSevenDayData:canClaimTask(id) then
uiMap["task_cell.bg.red_point"]:setVisible(true)
self.rewardCell:showFrameAnimation()
self.rewardCell:addClickListener(function()
self:onClick(id, period)
end)
else
self.rewardCell:hideFrameAnimation()
uiMap["task_cell.bg.red_point"]:setVisible(false)
end
end

View File

@ -44,7 +44,7 @@ function TaskComp:refresh(parentUI, day, period)
end)
else
self.rewardCells[id]:hideFrameAnimation()
-- self.rewardCells[id]:setClickShowTips()
self.rewardCells[id]:removeClickListener()
end
end

View File

@ -28,6 +28,9 @@ function GMToolUI:onRefresh()
local skipTutorialTx = self.uiMap["gm_tool_ui.skip_tutoria.text"]
local skipTutorialBtn = self.uiMap["gm_tool_ui.skip_tutoria"]
local skipTutorialCheck = self.uiMap["gm_tool_ui.skip_tutoria.check"]
local skipPopTx = self.uiMap["gm_tool_ui.skip_pop.text"]
local skipPopBtn = self.uiMap["gm_tool_ui.skip_pop"]
local skipPopCheck = self.uiMap["gm_tool_ui.skip_pop.check"]
self.uiMap['gm_tool_ui.close_btn']:addClickListener(function() self:closeUI() end)
self.scrollRect = scrollView:getLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
@ -46,6 +49,7 @@ function GMToolUI:onRefresh()
titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "GM面板"
okBtnText:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "确定"
skipTutorialTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "跳过引导"
skipPopTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "跳过功能开启"
okBtn:addClickListener(function()
local gmCommand = self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_INPUT_FIELD).text
@ -90,6 +94,16 @@ function GMToolUI:onRefresh()
end
skipTutorialCheck:setActive(LocalData:getTutorialSkip() > 0)
end)
skipPopCheck:setVisible(LocalData:getTutorialSkip() > 0)
skipPopBtn:addClickListener(function()
if LocalData:getFuncOpenPopSkip() == 0 then
LocalData:setFuncOpenPopSkip(1)
else
LocalData:setFuncOpenPopSkip(0)
end
skipPopCheck:setActive(LocalData:getFuncOpenPopSkip() > 0)
end)
end
function GMToolUI:initScrollRectCell(index, cell)

View File

@ -2,11 +2,11 @@ local SideBarComp = class("SideBarComp", LuaComponent)
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
-- 侧边栏整体边距
local SIDE_BAR_NODE_INTERVAL_X = 10
local SIDE_BAR_NODE_INTERVAL_X = 0
-- 侧边栏每项间距
local SIDE_BAR_INTERVAL_X = 30
local SIDE_BAR_INTERVAL_Y = 45
local SIDE_BAR_INTERVAL_Y = 50
function SideBarComp:onReshow()
self:checkSideBarOpenStatus()
@ -151,7 +151,7 @@ function SideBarComp:refreshLeftSideBars()
local initY = self.sideBarHeight/2
local addY = SIDE_BAR_INTERVAL_Y + self.sideBarHeight
local x = 100
local x = 110
for index, cell in ipairs(self.leftBarList) do
if self.showLeftSideBar or index <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
local addMulX = math.floor((index - 1) / self.sideBarMaxCount)
@ -171,7 +171,7 @@ function SideBarComp:refreshLeftSideBars()
end
end
local y = 110
local y = 120
if listCount > GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
self.leftArrow:setActive(true)
self.leftArrowRp:setVisible(false)
@ -243,7 +243,7 @@ function SideBarComp:refreshRightSideBars()
local addX = SIDE_BAR_INTERVAL_X + self.sideBarWidth
local initY = self.sideBarHeight/2
local addY = SIDE_BAR_INTERVAL_Y + self.sideBarHeight
local x = 100
local x = 110
for index, cell in ipairs(self.rightBarList) do
if self.showRightSideBar or index <= GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
local addMulX = math.floor((index - 1) / self.sideBarMaxCount)
@ -263,7 +263,7 @@ function SideBarComp:refreshRightSideBars()
end
end
local y = 110
local y = 120
if listCount > GConst.MainCityConst.SIDE_BAR_MIN_COUNT then
self.rightArrow:setActive(true)
self.rightArrowRp:setVisible(false)

View File

@ -46,8 +46,9 @@ function MainCityUI:getCurrencyParams()
self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GEM
self.currencyParams.itemIds[3] = GConst.ItemConst.ITEM_ID_VIT
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GOLD
self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_VIT
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.COMPANY then
-- self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GOLD
-- self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_VIT
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_GOLD
self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GEM
@ -132,7 +133,6 @@ end
function MainCityUI:_display()
self:initBottomUI()
self:initComp()
self:initLeftRightBtns()
self:initTopNode()
self:refreshBottom()
end
@ -178,6 +178,9 @@ function MainCityUI:_addListeners()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP, function()
self:checkMainPop()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.REFRESH_MAIN_CITY_BOTTOM, function(params)
self:refreshBottomCell()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function(params)
params = params or {}
@ -398,12 +401,6 @@ function MainCityUI:refreshBottom(selectedIndex, playAnim)
self:refreshSideBarComp()
end
function MainCityUI:refreshBottomBtns()
for page, cell in pairs(self.bottomCells) do
cell:refresh(page, self.selectedIndex)
end
end
function MainCityUI:refreshSideBarComp()
if self.sideBarComp == nil then
local uiMap = self.root:genAllChildren()
@ -427,42 +424,11 @@ function MainCityUI:getIsInMainPage()
return self.selectedIndex == MAIN_COMP_INEDX
end
function MainCityUI:initLeftRightBtns()
self.leftNode = self.uiMap["main_ui.left_node"]
self.leftSideBar = self.uiMap["main_ui.left_node.side_bar"]
self.leftSideBar:setAnchorMin(0, 1)
self.leftSideBar:setAnchorMax(0, 1)
self.leftSideBar:getTransform().pivot = BF.Vector2(0, 1)
local addY = SafeAreaManager:getNotchScreenHeight()
self.leftSideBar:setAnchoredPosition(17, -280 - addY)
self.leftArrowBtn = self.uiMap["main_ui.left_node.arrow_node"]
self.leftArrowBtn:setAnchorMin(0, 1)
self.leftArrowBtn:setAnchorMax(0, 1)
self.leftArrowBtn:addClickListener(function()
self:openOrCloseLeftSideBar()
end)
self.leftArrowImg = self.uiMap["main_ui.left_node.arrow_node.arrow"]
self.rightNode = self.uiMap["main_ui.right_node"]
self.rightSideBar = self.uiMap["main_ui.right_node.side_bar"]
self.rightSideBar:setAnchorMin(1, 1)
self.rightSideBar:setAnchorMax(1, 1)
self.rightSideBar:getTransform().pivot = BF.Vector2(1, 1)
self.rightSideBar:setAnchoredPosition(-17, -280 - addY)
self.rightArrowBtn = self.uiMap["main_ui.right_node.arrow_node"]
self.rightArrowBtn:setAnchorMin(1, 1)
self.rightArrowBtn:setAnchorMax(1, 1)
self.rightArrowBtn:addClickListener(function()
self:openOrCloseRightSideBar()
end)
self.rightArrowImg = self.uiMap["main_ui.right_node.arrow_node.arrow"]
end
function MainCityUI:refreshPlayerInfo()
if not self.playerInfoCell then
self.playerInfoCell = CellManager:addCellComp(self.uiMap["main_ui.player_info_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_INFO_CELL)
end
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.COMPANY then
if self.selectedIndex ~= GConst.MainCityConst.BOTTOM_PAGE.MAIN then
self.playerInfoCell:setActive(false)
return
end
@ -594,6 +560,7 @@ function MainCityUI:switchComp(index)
else
self:setTopNodeVisible(false)
end
self:refreshPlayerInfo()
end
-- 切换主界面活动模块
@ -605,7 +572,6 @@ function MainCityUI:switchMainCompModule(moduleKey)
self:checkMainPop()
self:setTopNodeVisible(true)
self:refreshBounty()
self:refreshPlayerInfo()
UIManager:updateBarsState(self)
end
@ -688,6 +654,13 @@ function MainCityUI:checkMainPop()
ModuleManager.MaincityManager:showModuleUnlockUI()
return
end
-- 功能解锁
local showFuncList = ModuleManager.MaincityManager:getFuncOpenShowList()
if showFuncList and #showFuncList > 0 and not GFunc.isShenhe() then
ModuleManager.MaincityManager:showModuleUnlockUI()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.REFRESH_MAIN_CITY_BOTTOM)
return
end
-- 引导
if self:checkTutorial() then
@ -913,38 +886,6 @@ function MainCityUI:getSideBarActIconPos(moduleKey)
end
end
function MainCityUI:isInSideBarLeft(moduleKey)
for name, cell in pairs(self.leftBarList) do
if moduleKey == cell:getModuleKey() then
return true
end
end
return false
end
function MainCityUI:isInSideBarRight(moduleKey)
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return true
end
end
return false
end
function MainCityUI:isActivSideBarModule(moduleKey)
for name, cell in pairs(self.leftBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getIsActive() and cell:getIsVisible()
end
end
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getIsActive() and cell:getIsVisible()
end
end
return nil
end
function MainCityUI:getHeroComp()
return self.subComps[GConst.MainCityConst.BOTTOM_PAGE.HERO]
end

View File

@ -65,6 +65,8 @@ function ModuleUnlockUI:checkShowNext()
return
end
self.moduleKey = table.remove(self.unlockList, 1)
ModuleManager.MaincityManager:markFuncOpen(self.moduleType)
local info = ConfigManager:getConfig("func_open")[self.moduleKey]
local i18nInfo = I18N:getConfig("func_open")[self.moduleKey]
if info == nil or i18nInfo == nil then
@ -76,14 +78,6 @@ function ModuleUnlockUI:checkShowNext()
self.moduleIcon:setSprite(GConst.ATLAS_PATH.MODULE, info.icon)
end
-- 侧边栏功能,检查处理侧边栏打开
if not ModuleManager.MaincityManager:isActivSideBarModule(self.moduleKey) then
if ModuleManager.MaincityManager:getModuleInSideBarWhere(self.moduleKey) == -1 then
ModuleManager.MaincityManager:changeMainCityLeftSideBarOpenOrClose()
elseif ModuleManager.MaincityManager:getModuleInSideBarWhere(self.moduleKey) == 1 then
ModuleManager.MaincityManager:changeMainCityRightSideBarOpenOrClose()
end
end
self:showModuleUnlockAppearAnim()
AudioManager:playEffect(AudioManager.EFFECT_ID.FUNC_OPEN)
end

View File

@ -72,7 +72,7 @@ function SummonShopCell:refreshItem()
self.heroBg:setActive(false)
local itemInfo = ConfigManager:getConfig("item")[self.id]
self.itemBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[itemInfo.qlt])
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(itemInfo.icon))
self.itemIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(itemInfo.icon))
self.nameTx:setText(ModuleManager.ItemManager:getItemName(self.id))
self.itemNumTx:setText(self.cfg.hero.num)
self.maskImg:setActive(false)

View File

@ -60,12 +60,13 @@ function TalentInfoUI:onRefresh()
local str = I18N:getText("talent", self.id, "desc")
if attr and #attr > 0 then
str = str .. GFunc.getFinalAttrValue(attr[1].type, attr[1].num)
elseif self.id == DataManager.TalentData.SKILL_REFESH_ID or self.id == DataManager.TalentData.SELECT_SKILL_ID then
elseif self.id == DataManager.TalentData.SELECT_SKILL_ID then
elseif self.id == DataManager.TalentData.SKILL_REFESH_ID then
str = str .. (num or 0)
elseif self.id == DataManager.TalentData.HP_RESTORE_ID then
str = str .. (num or 0) // GConst.DEFAULT_FACTOR
else
str = str .. (num or 0) / GConst.DEFAULT_FACTOR .. "%"
str = str .. (num or 0) // 100 .. "%"
end
self.descTx:setText(str)
end

View File

@ -112,9 +112,14 @@ function TalentMainUI:onUpgrade()
local attr, num = DataManager.TalentData:getAttrById(upData.id)
local str = I18N:getText("talent", upData.id, "desc")
if attr and #attr > 0 then
str = str .. GFunc.getFinalAttrValue(attr[1].type, attr[1].num, 2)
-- else
-- str = str .. (num or 0)
str = str .. GFunc.getFinalAttrValue(attr[1].type, attr[1].num)
elseif self.id == DataManager.TalentData.SELECT_SKILL_ID then
elseif self.id == DataManager.TalentData.SKILL_REFESH_ID then
str = str .. (num or 0)
elseif self.id == DataManager.TalentData.HP_RESTORE_ID then
str = str .. (num or 0) // GConst.DEFAULT_FACTOR
else
str = str .. (num or 0) // 100 .. "%"
end
self.upDescTx:setText(str)
self.upDescTx:setActive(false)