PGRData/Script/matrix/xui/xuisummerepisode/XUiGridSummerEpisodeMap.lua

51 lines
1.9 KiB
Lua
Raw Normal View History

local XUiGridSummerEpisodeMap = XClass(nil, "XUiGridSummerEpisodeMap")
function XUiGridSummerEpisodeMap:Ctor(ui,stageId,rootUi)
self.GameObject = ui
self.Transform = ui.transform
self.StageId = stageId
self.RootUi = rootUi
XTool.InitUiObject(self)
self:InitUiView()
end
function XUiGridSummerEpisodeMap:InitUiView()
2024-09-01 20:49:41 +00:00
local isRandomStage = XDataCenter.FubenSpecialTrainManager.CheckHasRandomStage(self.StageId)
if not isRandomStage then
local config = XDataCenter.FubenManager.GetStageCfg(self.StageId)
if config then
self.RImgMap:SetRawImage(config.StoryIcon)
self.TxtMapName.text = config.Description
end
self.UnLock=XDataCenter.FubenSpecialTrainManager.CheckStageIsUnlock(self.StageId)
if self.Lock then
self.Lock.gameObject:SetActiveEx(not self.UnLock)
local unlockTime=XDataCenter.FubenSpecialTrainManager.GetMapUnLockTime(self.StageId)
self.TxtCondition.text=XUiHelper.GetText("SummerEpisodeMapUnLock",XUiHelper.GetTimeMonthDayHourMinutes(unlockTime))
end
if self.Red then
self.Red.gameObject:SetActiveEx(XDataCenter.FubenSpecialTrainManager.CheckStageIsNewUnLock(self.StageId) and not self.RootUi.IgnoreRedPoint)
end
else
self.UnLock=true
local storyIcon = XFubenSpecialTrainConfig.GetRandomStageStoryIconById(self.StageId)
self.RImgMap:SetRawImage(storyIcon)
self.TxtMapName.text = XFubenSpecialTrainConfig.GetRandomStageNameById(self.StageId)
end
end
function XUiGridSummerEpisodeMap:SetClickEvent(event)
self.RootUi:RegisterClickEvent(self.BtnMap, function()
2024-09-01 20:49:41 +00:00
if self.UnLock then
event(self.StageId)
end
end)
end
function XUiGridSummerEpisodeMap:SetSelect(isSelect)
self.Activate.gameObject:SetActiveEx(isSelect)
end
return XUiGridSummerEpisodeMap