c1_lua/lua/app/ui/talent/talent_main_ui.lua
2025-08-04 09:42:30 +08:00

56 lines
1.4 KiB
Lua

local TalentMainUI = class("TalentMainUI", BaseUI)
local TALENT_CELL = "app/ui/talent/cell/talent_cell"
function TalentMainUI:ctor()
end
function TalentMainUI:isFullScreen()
return false
end
function TalentMainUI:getCurrencyParams()
if self.currencyParams == nil then
self.currencyParams = {
itemIds = {
GConst.ItemConst.ITEM_ID_GOLD,
}
}
end
return self.currencyParams
end
function TalentMainUI:getPrefabPath()
return "assets/prefabs/ui/talent/talent_ui.prefab"
end
function TalentMainUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["talent_ui.close_btn"]:addClickListener(function()
self:closeUI()
end)
self.getBtn = uiMap["talent_ui.get_btn"]
local text = uiMap["talent_ui.get_btn.text"]
local costTx = uiMap["talent_ui.get_btn.cost.cost_tx"]
-- uiMap["talent_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TALENT))
uiMap["talent_ui.title_tx"]:setText("研发中心")
uiMap["talent_ui.get_btn.text"]:setText("研发")
self.scrollRect = uiMap["talent_ui.bottom_bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return TALENT_CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(index, self.list[index])
end)
self.scrollRect:clearCells()
end
function TalentMainUI:onRefresh()
self.list = DataManager.TalentData:getCfgList()
self.scrollRect:setTotalCount(#self.list)
end
return TalentMainUI