7363298dc1
EN: 1.15.0.134 CN: 1.15.0.133 JP: 1.15.0.137 KR: 1.15.0.139
91 lines
3.1 KiB
Lua
91 lines
3.1 KiB
Lua
local ReengagementBDPreviewCtrl = class("ReengagementBDPreviewCtrl", BaseCtrl)
|
|
ReengagementBDPreviewCtrl._mapNodeConfig = {
|
|
window = {},
|
|
animRoot = {sNodeName = "window", sComponentName = "Animator"},
|
|
goBlur = {},
|
|
btnShortcutClose = {sComponentName = "NaviButton", callback = "ClosePanel"},
|
|
btnClose = {sComponentName = "UIButton", callback = "ClosePanel"},
|
|
txtWindowTitle = {
|
|
sComponentName = "TMP_Text",
|
|
sLanguageId = "Reengagement_BDTrialPreview_Title"
|
|
},
|
|
txtLevelInterval = {
|
|
sComponentName = "TMP_Text",
|
|
sLanguageId = "Reengagement_BDTrialPreview_LevelInterval"
|
|
},
|
|
txtTip = {
|
|
sComponentName = "TMP_Text",
|
|
sLanguageId = "Reengagement_BDTrialPreview_Tip"
|
|
},
|
|
txtCurLevel = {
|
|
sComponentName = "TMP_Text",
|
|
sLanguageId = "TD_TitleCurLevel"
|
|
},
|
|
txtLevelCn = {
|
|
sComponentName = "TMP_Text",
|
|
sLanguageId = "Quest_WorldClass_Level"
|
|
},
|
|
svAll = {
|
|
sComponentName = "LoopScrollView"
|
|
}
|
|
}
|
|
ReengagementBDPreviewCtrl._mapEventConfig = {}
|
|
function ReengagementBDPreviewCtrl:OpenPanel()
|
|
self.gameObject:SetActive(true)
|
|
self._mapNode.window:SetActive(false)
|
|
local wait = function()
|
|
self._mapNode.goBlur:SetActive(true)
|
|
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
|
self._mapNode.window:SetActive(true)
|
|
self._mapNode.btnShortcutClose.gameObject:SetActive(true)
|
|
self:InitPanel()
|
|
self._mapNode.animRoot:Play("t_window_04_t_in")
|
|
end
|
|
end
|
|
function ReengagementBDPreviewCtrl:InitPanel()
|
|
self.tbLevelInterval = {}
|
|
local foreachData = function(mapData)
|
|
table.insert(self.tbLevelInterval, mapData)
|
|
end
|
|
ForEachTableLine(ConfigTable.GetData("ReengagementBDTrial"), foreachData)
|
|
self.nWorldLevel = PlayerData.Base:GetWorldClass()
|
|
NovaAPI.SetTMPText(self._mapNode.txtLevel, self.nWorldLevel)
|
|
self._mapNode.svAll:Init(#self.tbLevelInterval, self, self.OnGridRefresh)
|
|
end
|
|
function ReengagementBDPreviewCtrl:OnGridRefresh(goGrid, nGridIndex)
|
|
local nIndex = nGridIndex + 1
|
|
local mapData = self.tbLevelInterval[nIndex]
|
|
local imgOnBg = goGrid.transform:Find("imgOnBg").gameObject
|
|
local imgOffBg = goGrid.transform:Find("imgOffBg").gameObject
|
|
local imgSelect = goGrid.transform:Find("imgSelect").gameObject
|
|
if self.nWorldLevel >= mapData.MinLevel and self.nWorldLevel <= mapData.MaxLevel then
|
|
imgOnBg:SetActive(true)
|
|
imgOffBg:SetActive(false)
|
|
imgSelect:SetActive(true)
|
|
else
|
|
imgOnBg:SetActive(false)
|
|
imgOffBg:SetActive(true)
|
|
imgSelect:SetActive(false)
|
|
end
|
|
local txtDesc = goGrid.transform:Find("txtDesc"):GetComponent("TMP_Text")
|
|
if txtDesc ~= nil then
|
|
local sText = ConfigTable.GetUIText("Reengagement_BDTrialPreview_WorldClass")
|
|
sText = sText .. mapData.MinLevel .. "~" .. mapData.MaxLevel
|
|
NovaAPI.SetTMPText(txtDesc, sText)
|
|
end
|
|
local imgIcon = goGrid.transform:Find("imgIcon"):GetComponent("Image")
|
|
if imgIcon ~= nil then
|
|
self:SetPngSprite(imgIcon, mapData.Icon)
|
|
end
|
|
end
|
|
function ReengagementBDPreviewCtrl:ClosePanel()
|
|
self._mapNode.animRoot:Play("t_window_04_t_out")
|
|
local animLength = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
|
"t_window_04_t_out"
|
|
})
|
|
self:AddTimer(1, animLength, function()
|
|
self.gameObject:SetActive(false)
|
|
end, true, true, true)
|
|
end
|
|
return ReengagementBDPreviewCtrl
|