This commit is contained in:
puxuan 2025-07-28 21:38:05 +08:00
parent f7ed30face
commit 7d4a361039
3 changed files with 53 additions and 1 deletions

View File

@ -7,7 +7,7 @@ MainCityConst.BOTTOM_PAGE = {
HERO = 2,
MAIN = 3,
DUNGEON = 4,
MAIN_5 = 5,
COMPANY = 5,
}
MainCityConst.BOTTOM_ICON = {

View File

@ -0,0 +1,45 @@
local CompanyComp = class("CompanyComp", LuaComponent)
function CompanyComp:init()
self.uiMap = self:getBaseObject():genAllChildren()
self.scrollRect = self.uiMap["dungeon_comp.scrollrect"]
self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function()
return "app/ui/dungeon/dungeon_board_cell"
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.openDungeons[index].module)
end)
self.scrollRectComp:setTotalCount(0)
end
function CompanyComp:refresh(targetMuduleKey)
if EDITOR_MODE then
Logger.logHighlight("更新副本显示."..tostring(Time:getTodaySurplusTime()))
end
self.openDungeons = DataManager.DungeonData:getOpenDungeons()
local targetIndex
if targetMuduleKey then
for index, dungeon in ipairs(self.openDungeons) do
if dungeon.module == targetMuduleKey then
targetIndex = index
break
end
end
end
self.scrollRectComp:clearCells()
self.scrollRectComp:refillCells(#self.openDungeons, nil, targetIndex)
-- 跨天定时器
if self.countdownSid then
self:getBaseObject():unscheduleGlobal(self.countdownSid)
self.countdownSid = nil
end
self.countdownSid = self:getBaseObject():scheduleGlobal(function()
ModuleManager.DungeonManager:checkDayChange()
end, Time:getTodaySurplusTime() + 1)
end
return CompanyComp

View File

@ -11,6 +11,7 @@ local HERO_COMP = "app/ui/hero/hero_comp"
local MAIN_COMP = "app/ui/main_city/component/main_comp"
local SHOP_COMP = "app/ui/shop/shop_comp"
local DUNGEON_COMP = "app/ui/dungeon/dungeon_comp"
local COMPANY_COMP = "app/ui/company/company_comp"
local BOTTOM_BTN_CELL = "app/ui/main_city/cell/bottom_btn_cell"
@ -311,6 +312,12 @@ function MainCityUI:initComp()
dungeonComp:initPrefabHelper()
dungeonComp:genAllChildren()
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.DUNGEON] = dungeonComp:addLuaComponent(DUNGEON_COMP)
-- 公司
local companyComp = uiMap["main_ui.sub_ui_node.company_comp"]
companyComp:initPrefabHelper()
companyComp:genAllChildren()
self.subComps[GConst.MainCityConst.BOTTOM_PAGE.COMPANY] = companyComp:addLuaComponent(COMPANY_COMP)
end
end