e0549005e1
EN: 1.9.0.103 CN: 1.9.0.104 JP: 1.9.0.106 KR: 1.9.0.108
149 lines
5.8 KiB
Lua
149 lines
5.8 KiB
Lua
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
|
local lvIndexTitle = "{0}-{1}"
|
|
ActivityLevelsLvCtrl._mapNodeConfig = {
|
|
tog = {sComponentName = "UIButton"},
|
|
Select = {},
|
|
DecoRootCanvas = {sNodeName = "DecoRoot", sComponentName = "Canvas"},
|
|
unSelect = {},
|
|
txt_Select = {sComponentName = "TMP_Text"},
|
|
txt_unSelect = {sComponentName = "TMP_Text"},
|
|
rt_Targets = {},
|
|
btnTarget = {sComponentName = "Button", nCount = 3},
|
|
rtLockInfo = {},
|
|
AnimRootTitle = {},
|
|
tmpGroupDone = {sComponentName = "TMP_Text"},
|
|
bgCondition = {},
|
|
rtLockPreLv = {},
|
|
goUnOpen = {},
|
|
redH = {},
|
|
AnimSwitch = {sComponentName = "Animator"},
|
|
arrowRoot = {},
|
|
imgCert = {}
|
|
}
|
|
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isPreLevelOpen, isLevelUnLock)
|
|
NovaAPI.SetCanvasSortingName(self._mapNode.DecoRootCanvas, AllEnum.SortingLayerName.UI)
|
|
NovaAPI.SetCanvasSortingOrder(self._mapNode.DecoRootCanvas, parent._nSortingOrder + 1)
|
|
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
|
local txtLockConditionLv = self._mapNode.goUnOpen.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
|
|
if self.timerRun ~= nil then
|
|
self.timerRun:Pause(true)
|
|
self.timerRun = nil
|
|
end
|
|
self._mapNode.Select:SetActive(false)
|
|
self.lvLock = false
|
|
if isOpen and isLevelUnLock then
|
|
self._mapNode.rt_Targets:SetActive(true)
|
|
for i = 1, 3 do
|
|
self._mapNode.btnTarget[i].interactable = i <= data.Star
|
|
end
|
|
self._mapNode.imgCert:SetActive(data.Star == 3)
|
|
self._mapNode.rtLockInfo:SetActive(false)
|
|
self._mapNode.rtLockPreLv:SetActive(false)
|
|
self._mapNode.bgCondition:SetActive(false)
|
|
self._mapNode.AnimRootTitle:SetActive(true)
|
|
NovaAPI.SetTMPText(self._mapNode.tmpGroupDone, data.baseData.Name)
|
|
self._mapNode.goUnOpen:SetActive(false)
|
|
elseif isOpen and not isLevelUnLock then
|
|
self._mapNode.rt_Targets:SetActive(false)
|
|
self._mapNode.rtLockInfo:SetActive(false)
|
|
self._mapNode.rtLockPreLv:SetActive(true)
|
|
self._mapNode.bgCondition:SetActive(false)
|
|
self._mapNode.goUnOpen:SetActive(false)
|
|
NovaAPI.SetTMPText(txtLockConditionLv, ConfigTable.GetUIText("ActivityLevels_Lock_LastLV"))
|
|
self._mapNode.AnimRootTitle:SetActive(false)
|
|
elseif not isOpen then
|
|
self._mapNode.rt_Targets:SetActive(false)
|
|
self._mapNode.rtLockInfo:SetActive(true)
|
|
self._mapNode.rtLockPreLv:SetActive(false)
|
|
self._mapNode.bgCondition:SetActive(isPreLevelOpen)
|
|
self._mapNode.AnimRootTitle:SetActive(false)
|
|
self._mapNode.goUnOpen:SetActive(false)
|
|
local day = activityData:GetUnLockDay(nType, data.baseData.Id)
|
|
if day == 0 then
|
|
local timerCount = function()
|
|
local hour, min, sec = parent.activityLevelsData:GetUnLockHour(nType, data.baseData.Id)
|
|
if 0 < hour then
|
|
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "e0c27c", hour))
|
|
elseif 0 < min then
|
|
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "e0c27c", min))
|
|
elseif 0 < sec then
|
|
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "e0c27c", sec))
|
|
end
|
|
end
|
|
timerCount()
|
|
self.timerRun = self:AddTimer(0, 1, function()
|
|
timerCount()
|
|
end, true, true, false)
|
|
else
|
|
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "e0c27c", day))
|
|
end
|
|
self.lvLock = true
|
|
end
|
|
local strTitle = ""
|
|
if nType == GameEnum.ActivityLevelType.Explore then
|
|
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
|
|
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
|
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
|
|
elseif nType == GameEnum.ActivityLevelType.HARD then
|
|
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
|
|
end
|
|
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
|
|
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
|
|
self._mapNode.tog.onClick:RemoveAllListeners()
|
|
local clickCb = function()
|
|
if self._mapNode.Select.activeSelf == true then
|
|
return
|
|
end
|
|
self:SetDefault(true)
|
|
parent:SetSelectObj(self)
|
|
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
|
|
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
|
|
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
|
end
|
|
self._mapNode.tog.onClick:AddListener(clickCb)
|
|
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
|
|
if bInActGroup then
|
|
if nType == GameEnum.ActivityLevelType.Explore then
|
|
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
|
nActGroupId,
|
|
data.baseData.Id
|
|
}, self._mapNode.redH)
|
|
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
|
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
|
nActGroupId,
|
|
data.baseData.Id
|
|
}, self._mapNode.redH)
|
|
elseif nType == GameEnum.ActivityLevelType.HARD then
|
|
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
|
|
nActGroupId,
|
|
data.baseData.Id
|
|
}, self._mapNode.redH)
|
|
end
|
|
end
|
|
end
|
|
function ActivityLevelsLvCtrl:SetDefault(isOn)
|
|
if self._mapNode.AnimSwitch.enabled == true then
|
|
self._mapNode.AnimSwitch.enabled = false
|
|
end
|
|
if not isOn then
|
|
self:ShowArrowAni(false)
|
|
end
|
|
self._mapNode.Select:SetActive(isOn)
|
|
self._mapNode.unSelect:SetActive(not isOn)
|
|
self._mapNode.txt_Select.gameObject:SetActive(isOn)
|
|
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
|
|
end
|
|
function ActivityLevelsLvCtrl:ShowArrowAni(isShow)
|
|
self._mapNode.arrowRoot:SetActive(isShow)
|
|
end
|
|
function ActivityLevelsLvCtrl:FadeIn()
|
|
EventManager.Hit(EventId.SetTransition)
|
|
end
|
|
function ActivityLevelsLvCtrl:OnDisable()
|
|
if self.timerRun ~= nil then
|
|
self.timerRun:Pause(true)
|
|
self.timerRun = nil
|
|
end
|
|
end
|
|
return ActivityLevelsLvCtrl
|