Update - 1.12.0.120
EN: 1.12.0.120 CN: 1.12.0.120 JP: 1.12.0.124 KR: 1.12.0.124
This commit is contained in:
@@ -587,7 +587,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -575,7 +575,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -651,7 +651,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -747,7 +747,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -731,7 +731,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -759,7 +759,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -757,7 +757,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
|
||||
@@ -744,7 +744,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityGunStormCtrl = class("ActivityGunStormCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityGunStormCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
svReward = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Reward"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
imgLock = {},
|
||||
txtLock = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
}
|
||||
}
|
||||
function ActivityGunStormCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityGunStormCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityGunStormCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityGunStormCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityGunStormCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityGunStormCtrl:RefreshLockState()
|
||||
local IsUnlock, txtLock = self.actData:IsUnlock()
|
||||
self._mapNode.imgLock.gameObject:SetActive(not IsUnlock)
|
||||
self._mapNode.btnGo.gameObject:SetActive(IsUnlock)
|
||||
if not IsUnlock then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
|
||||
end
|
||||
end
|
||||
function ActivityGunStormCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActGroupEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgRemaineTime:SetActive(0 < remainTime)
|
||||
self._mapNode.imgEnd:SetActive(remainTime <= 0)
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityGunStormCtrl:RefreshDate()
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityGunStormCtrl:RefreshReward()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self._mapNode.svReward:Init(#rewardData, self, self.RefreshRewardGridItem, self.BtnRewardGridClick)
|
||||
end
|
||||
function ActivityGunStormCtrl:RefreshRewardGridItem(go, index)
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local rewardId = rewardData[index + 1]
|
||||
local nInstanceID = go:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(go, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetItem(rewardId)
|
||||
end
|
||||
function ActivityGunStormCtrl:BtnRewardGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
local rewardData = actGroupCfg.RewardsShow
|
||||
local item = goGrid.transform:Find("AnimRoot/item")
|
||||
UTILS.ClickItemGridWithTips(rewardData[nIndex], item.transform, true, true, false)
|
||||
end
|
||||
function ActivityGunStormCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil and actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GunStormPanel, actGroupCfg.Id, true)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GunStormPanel, actGroupCfg.Id, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityGunStormCtrl:OnBtnClick_Detail()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = actGroupCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityGunStormCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityGunStormCtrl
|
||||
@@ -0,0 +1,139 @@
|
||||
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
ActivityLevelsLvCtrl._mapNodeConfig = {
|
||||
tog = {sComponentName = "UIButton"},
|
||||
Select = {},
|
||||
SelectAni = {sNodeName = "Select", sComponentName = "Animator"},
|
||||
unSelect = {},
|
||||
txt_Select = {sComponentName = "TMP_Text"},
|
||||
txt_unSelect = {sComponentName = "TMP_Text"},
|
||||
rt_Targets = {},
|
||||
btnTarget = {sComponentName = "Button", nCount = 3},
|
||||
rtLockInfo = {},
|
||||
imgLockMask = {},
|
||||
bgCondition = {},
|
||||
rtLockPreLv = {},
|
||||
redH = {},
|
||||
AnimSwitch = {sComponentName = "Animator"},
|
||||
imgSlc = {}
|
||||
}
|
||||
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock)
|
||||
self._mapNode.imgSlc:SetActive(false)
|
||||
local txtLockConditionTime = self._mapNode.bgCondition.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.rtLockInfo:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(true)
|
||||
self._mapNode.imgLockMask:SetActive(false)
|
||||
self._mapNode.rtLockPreLv:SetActive(true)
|
||||
self._mapNode.bgCondition:SetActive(false)
|
||||
elseif not isOpen then
|
||||
self._mapNode.rt_Targets:SetActive(false)
|
||||
self._mapNode.rtLockInfo:SetActive(true)
|
||||
self._mapNode.imgLockMask:SetActive(true)
|
||||
self._mapNode.rtLockPreLv:SetActive(false)
|
||||
self._mapNode.bgCondition:SetActive(true)
|
||||
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"), "c76153", hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "c76153", min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "c76153", 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"), "c76153", 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.imgSlc:SetActive(isOn)
|
||||
self._mapNode.txt_Select.gameObject:SetActive(isOn)
|
||||
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
|
||||
if not self.lvLock and isOn then
|
||||
self._mapNode.SelectAni:Play("10109_ActitvityLevels_Select")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsLvCtrl:ShowArrowAni(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
|
||||
@@ -0,0 +1,769 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
local colorSelect = Color(1.0, 0.9882352941176471, 0.9568627450980393, 1)
|
||||
local colorUnSelect = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
|
||||
local colorSelectLock = Color(0.11764705882352941, 0.12549019607843137, 0.17254901960784313, 1)
|
||||
local colorUnSelectLock = Color(0.4823529411764706, 0.5333333333333333, 0.6509803921568628, 1)
|
||||
local timeUnLockColor = "fff7ca"
|
||||
local colorConditionsUnLock = Color(0.3843137254901961, 0.28627450980392155, 0.21568627450980393, 1)
|
||||
local colorConditionsLock = Color(0.24313725490196078, 0.18823529411764706, 0.18823529411764706, 1)
|
||||
local lvIndexTitle = "{0}-{1}"
|
||||
local twelveLvGroupPadding = {
|
||||
64,
|
||||
88,
|
||||
-140,
|
||||
0
|
||||
}
|
||||
local twelveLvGroupPaddingOpen = {
|
||||
64,
|
||||
818,
|
||||
-140,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPadding = {
|
||||
320,
|
||||
88,
|
||||
-140,
|
||||
0
|
||||
}
|
||||
local fourLvGroupPaddingOpen = {
|
||||
64,
|
||||
818,
|
||||
-140,
|
||||
0
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
togTypeHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeHard"
|
||||
},
|
||||
togTypeHardCtrl = {
|
||||
sNodeName = "togTypeHard",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockHard = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockHard"
|
||||
},
|
||||
redHard = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
rtTogglesTmp = {
|
||||
sNodeName = "rt_ToggleTmp",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
togRoot = {
|
||||
nCount = 12,
|
||||
sCtrlName = "Game.UI.ActivityTheme.10109.ActivityLevels.ActivityLevelsLvCtrl"
|
||||
},
|
||||
rt_Toggle = {},
|
||||
rt_ToggleTrans = {sNodeName = "rt_Toggle", sComponentName = "Transform"},
|
||||
btnCloseBg = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseBossInfo"
|
||||
},
|
||||
rtBoss = {},
|
||||
rtBossAni = {sNodeName = "rtBoss", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
TMPLevel = {sComponentName = "TMP_Text"},
|
||||
detailDescSc = {sComponentName = "Transform"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGoRaidUnlock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
btnRaidUnlock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
goCoinRaidUnlock = {},
|
||||
txtTicketsCountRaidUnlock = {sComponentName = "TMP_Text"},
|
||||
grpRaidUnlock = {},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_CondStar"
|
||||
},
|
||||
ListConditions = {},
|
||||
ListConditionsObj = {
|
||||
sNodeName = "Conditions_",
|
||||
nCount = 2
|
||||
}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy",
|
||||
[EventId.ClosePanel] = "OnEvent_ClosePanel"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
self.detailDescContent = self._mapNode.detailDescSc:Find("Viewport/Content").transform
|
||||
self.curRequireEnergy = 0
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.isOpenLvMsg = false
|
||||
self:ShowBossInfo(false, true)
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
function self.onScrollValueChanged(value)
|
||||
self._mapNode.rtTogglesTmp.localPosition = self._mapNode.rt_ToggleTrans.localPosition
|
||||
end
|
||||
self._mapNode.rtToggles.onValueChanged:AddListener(self.onScrollValueChanged)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
for i = 1, #self.tabRewardList do
|
||||
local go = self.tabRewardList[i].gameObject
|
||||
local btnSelect = self.tabRewardList[i].gameObject:GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
self:UnbindCtrlByNode(self.tabRewardList[i])
|
||||
destroy(go)
|
||||
end
|
||||
self.tabRewardList = {}
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.SelectObj = nil
|
||||
if self.onScrollValueChanged ~= nil then
|
||||
self._mapNode.rtToggles.onValueChanged:RemoveListener(self.onScrollValueChanged)
|
||||
self.onScrollValueChanged = nil
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDestroy(...)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Init()
|
||||
self.activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self:RefreshTogTypeCount()
|
||||
self:Refresh()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Refresh()
|
||||
self.nLevelType = self.activityLevelsData:GetDefaultSelectionType()
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeHardCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Hard"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD)
|
||||
local objExploreCert = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objAdventureCert = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
local objHardCert = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
local txt_SelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
|
||||
local txt_unSelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
|
||||
txt_SelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
|
||||
txt_unSelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
|
||||
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
|
||||
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
self._mapNode.lockHard.gameObject:SetActive(not isOpenHard)
|
||||
local txt_SelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
|
||||
local txt_unSelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
|
||||
txt_SelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
|
||||
txt_unSelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
|
||||
objExploreCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
|
||||
if v.Star < 3 then
|
||||
objExploreCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objAdventureCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
|
||||
if v.Star < 3 then
|
||||
objAdventureCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
objHardCert:SetActive(true)
|
||||
for i, v in pairs(self.activityLevelsData.levelTabHard) do
|
||||
if v.Star < 3 then
|
||||
objHardCert:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockHard()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeHard()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.HARD then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.HARD
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.HARD)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
self.SelectObj = nil
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
self.currentTypeLvCount = 0
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabHard
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
|
||||
end
|
||||
self.currentTypeLvCount = #tabLevelInfoDifficulty
|
||||
self._mapNode.rtToggles.gameObject:SetActive(true)
|
||||
local isFour = self.currentTypeLvCount == 4
|
||||
if self.isOpenLvMsg == false then
|
||||
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
else
|
||||
local tmpPadding = isFour and fourLvGroupPaddingOpen or twelveLvGroupPaddingOpen
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
end
|
||||
for i = 1, 12 do
|
||||
self._mapNode.togRoot[i].gameObject:SetActive(i <= self.currentTypeLvCount)
|
||||
end
|
||||
for i = 1, self.currentTypeLvCount do
|
||||
do
|
||||
local tmpId = tabLevelInfoDifficulty[i]
|
||||
local tmpData = tabLevelInfo[tmpId]
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
self._mapNode.togRoot[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isLevelUnLock, self._nSortingOrder)
|
||||
if nDifficulty == i then
|
||||
if self.isOpenLvMsg then
|
||||
self.SelectObj = self._mapNode.togRoot[i]
|
||||
self._mapNode.togRoot[i]:SetDefault(true)
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true)
|
||||
else
|
||||
self._mapNode.togRoot[i]:SetDefault(false)
|
||||
local wait = function()
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rt_ToggleTrans.gameObject:GetComponent("RectTransform"))
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
if i < 3 then
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
elseif 10 < i then
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-3444, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400 * (i - 2), self._mapNode.rt_ToggleTrans.localPosition.y, 0)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
else
|
||||
self._mapNode.togRoot[i]:SetDefault(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:SetSelectObj(tmpSelectObj)
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
end
|
||||
self.SelectObj = tmpSelectObj
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_CloseBossInfo()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_out")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self:ShowBossInfo(false, false)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow, isOnEnable)
|
||||
self.isOpenLvMsg = isShow
|
||||
self._mapNode.rtBoss:SetActive(isShow)
|
||||
self._mapNode.btnCloseBg.gameObject:SetActive(isShow)
|
||||
if not isShow and self.SelectObj ~= nil then
|
||||
self.SelectObj:SetDefault(false)
|
||||
self.SelectObj = nil
|
||||
end
|
||||
if not isShow and not isOnEnable then
|
||||
local isFour = self.currentTypeLvCount == 4
|
||||
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
|
||||
if isFour then
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
local moveTime = 0.2
|
||||
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
|
||||
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or tmpPadding[1]
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
CS.DG.Tweening.DOVirtual.Float(startLeft, tmpPadding[1], moveTime, function(v)
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
end)
|
||||
else
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, isInit)
|
||||
if self.currentTypeLvCount == 12 then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
if nHard < 3 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 10 < nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-3444, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-400 * (nHard - 2), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
elseif self.currentTypeLvCount == 8 then
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
if nHard < 3 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 6 < nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-1857, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-400 * (nHard - 2), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local moveTime = isInit and 0.4 or 0.2
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, moveTime)
|
||||
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
|
||||
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or fourLvGroupPadding[1]
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
CS.DG.Tweening.DOVirtual.Float(startLeft, fourLvGroupPaddingOpen[1], moveTime, function(v)
|
||||
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
|
||||
end)
|
||||
if nHard < 2 then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
|
||||
elseif 3 <= nHard then
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-270, moveTime)
|
||||
else
|
||||
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-75 * (nHard - 1), moveTime)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabHardDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabHard[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
local strTitle = ""
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
strTitle = orderedFormat(lvIndexTitle, 1, self.selectLevelData.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.Adventure then
|
||||
strTitle = orderedFormat(lvIndexTitle, 2, self.selectLevelData.baseData.Difficulty)
|
||||
elseif nType == GameEnum.ActivityLevelType.HARD then
|
||||
strTitle = orderedFormat(lvIndexTitle, 3, self.selectLevelData.baseData.Difficulty)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPLevel, strTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.detailDescContent:DOLocalMoveY(0, 0)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.ListConditions:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
if self.selectLevelData.Star == 3 then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.btnGo.gameObject:SetActive(true)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
self._mapNode.btnGo.gameObject:SetActive(false)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.grpRaidUnlock:SetActive(true)
|
||||
end
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
self._mapNode.btnGo.gameObject:SetActive(false)
|
||||
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
|
||||
self._mapNode.grpRaidUnlock:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCountRaidUnlock, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoinRaidUnlock:SetActive(true)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local lvPreNeedStar = self.selectLevelData.baseData.PreLevelStar
|
||||
local lvPreStar = self.activityLevelsData:GetPreLevelStar(nType, self.selectLevelData.baseData.Id)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
imgConditions_Lock_1:SetActive(lvPreNeedStar > lvPreStar)
|
||||
imgConditions_UnLock_1:SetActive(lvPreNeedStar <= lvPreStar)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
NovaAPI.SetTMPColor(txt, lvPreNeedStar <= lvPreStar and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPText(txt, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
end
|
||||
local preActivityStory = self.selectLevelData.baseData.PreActivityStory
|
||||
if preActivityStory ~= nil and preActivityStory[1] ~= nil then
|
||||
local isRead = PlayerData.ActivityAvg:IsStoryReaded(preActivityStory[2])
|
||||
local imgConditions_Lock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_UnLock").gameObject
|
||||
local txt = self._mapNode.ListConditionsObj[2].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
imgConditions_Lock_2:SetActive(not isRead)
|
||||
imgConditions_UnLock_2:SetActive(isRead)
|
||||
local cfgdata = ConfigTable.GetData("ActivityStory", preActivityStory[2])
|
||||
if cfgdata ~= nil then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Avg"), cfgdata.Title))
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(true)
|
||||
NovaAPI.SetTMPColor(txt, isRead and colorConditionsUnLock or colorConditionsLock)
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
else
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.ListConditions:SetActive(true)
|
||||
self._mapNode.ListConditionsObj[2]:SetActive(false)
|
||||
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
|
||||
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
|
||||
imgConditions_Lock_1:SetActive(true)
|
||||
imgConditions_UnLock_1:SetActive(false)
|
||||
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
|
||||
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
end
|
||||
else
|
||||
local _day, _hour = self.activityLevelsData:GetUnLockDayHour(nType, self.selectLevelData.baseData.Id)
|
||||
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayHourOpen"), _day, _hour))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
if self._mapNode.rtBoss.activeSelf == false then
|
||||
self:ShowBossInfo(true, false)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
else
|
||||
self._mapNode.rtBossAni:Play("rtBoss_Empty")
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.rtBossAni:Play("rtBoss_in")
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
if self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(true)
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
if type(nPanelId) == "number" and nPanelId == PanelId.Raid and self.SelectObj ~= nil then
|
||||
self.SelectObj:ShowArrowAni(false)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10109/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10109.ActivityLevels.ActivityLevelsSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsSelectPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnRelease()
|
||||
end
|
||||
return ActivityLevelsSelectPanel
|
||||
@@ -0,0 +1,575 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local GunStormCtrl = class("GunStormCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
GunStormCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10109"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10109"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
dbTaskEnd = {},
|
||||
miniGameRedDot = {},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {},
|
||||
goMiniGameEnd = {},
|
||||
imgStoryEnd = {},
|
||||
reddotMiniGame = {
|
||||
sNodeName = "miniGameRedDot"
|
||||
}
|
||||
}
|
||||
GunStormCtrl._mapEventConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function GunStormCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.GunStormData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.GunStormData ~= nil then
|
||||
self.ActivityGroupCfg = self.GunStormData.actGroupConfig
|
||||
end
|
||||
for k, v in pairs(self._mapNode.btnEntrance_) do
|
||||
v.interactable = false
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
local sAnimName = "GunStormPanel_in"
|
||||
local sSoundName = "Mode_Maoyan_activity"
|
||||
if self.animRoot ~= nil then
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
sAnimName = "GunStormPanel_in1"
|
||||
sSoundName = "Mode_Maoyan_activity_01"
|
||||
end
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
self.animRoot:Play(sAnimName, 0, 0)
|
||||
CS.WwiseAudioManager.Instance:PlaySound(sSoundName)
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
|
||||
self:AddTimer(1, nAnimLength, function()
|
||||
for k, v in pairs(self._mapNode.btnEntrance_) do
|
||||
v.interactable = true
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
function GunStormCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.GunStormData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
local state = self.tbActState[nActId]
|
||||
if state == ActivityState.Closed then
|
||||
self._mapNode.redDotEntrance2:SetActive(false)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
end
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.storyRedDot)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GoldenSpy, {
|
||||
self.nActId
|
||||
}, self._mapNode.reddotMiniGame)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.eatingAnimationTimer then
|
||||
TimerManager.Remove(self.eatingAnimationTimer)
|
||||
self.eatingAnimationTimer = nil
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RefreshPanel()
|
||||
if self.GunStormData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function GunStormCtrl:RefreshTime()
|
||||
local bOpen = self.GunStormData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
RefreshRemainTime(self.GunStormData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = RefreshRemainTime(self.GunStormData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgRemaineTime:SetActive(bOpen)
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.GunStormData:GetActGroupDate()
|
||||
local strOpenDay = string.format("%d", nOpenDay)
|
||||
local strEndDay = string.format("%d", nEndDay)
|
||||
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function GunStormCtrl:RefreshRemainOpenTime(openTime)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Min") or "", min)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time") or "", hour)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Open_Time_Day") or "", day)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function GunStormCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.GunStormData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
self:RefreshStoryButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
local state = ActivityState.NotOpen
|
||||
local bShowCountDown = false
|
||||
if activityData ~= nil then
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif curTime >= openTime and curTime <= endTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
elseif activityData.EndType == GameEnum.activityEndType.NoLimit then
|
||||
state = ActivityState.Open
|
||||
if activityData.StartTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
if curTime < openTime then
|
||||
state = ActivityState.NotOpen
|
||||
end
|
||||
end
|
||||
end
|
||||
if state == ActivityState.NotOpen then
|
||||
if nil == timer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local fcTimer = function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
local txtUnlock = imgTrans:GetComponentInChildren(typeof(CS.TMPro.TMP_Text))
|
||||
if txtUnlock ~= nil then
|
||||
NovaAPI.SetTMPText(txtUnlock, sTimeStr)
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.GunStormData:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.GunStormData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(countDowmTimer)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function GunStormCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
if state ~= ActivityState.Open then
|
||||
end
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, self._mapNode.imgTaskActivityUnlockTime, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.dbTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RefreshStoryButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= avgData then
|
||||
avgData:RefreshAvgRedDot()
|
||||
end
|
||||
self:RefreshStoryButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.avgRemainTimer, self._mapNode.txtStoryActivityTime, self._mapNode.imgStoryActivityUnlockTime, refreshFunc)
|
||||
if self.avgRemainTimer == nil then
|
||||
self.avgRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= avgData then
|
||||
avgData:RefreshAvgRedDot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgStoryActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.goStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtStory_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
self:RefreshLevelButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.levelRemainTimer, self._mapNode.txtLevelActivityTime, self._mapNode.imgLevelActivityUnlockTime, refreshFunc)
|
||||
if self.levelRemainTimer == nil then
|
||||
self.levelRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
local animRoot = self._mapNode.btnEntrance_[5].transform:Find("AnimRoot"):GetComponent("Animator")
|
||||
animRoot.enabled = state == ActivityState.Open
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function GunStormCtrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function GunStormCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function GunStormCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData = self.GunStormData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
local nTransitionIdx = self.ActivityGroupCfg.TransitionId
|
||||
if nTransitionIdx == nil or nTransitionIdx == 0 and nIndex == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
|
||||
nTransitionIdx = 30
|
||||
end
|
||||
if nTransitionIdx ~= 0 then
|
||||
EventManager.Hit(EventId.SetTransition, nTransitionIdx, function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return GunStormCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local GunStormPanel = class("GunStormPanel", BasePanel)
|
||||
GunStormPanel._sUIResRootPath = "UI_Activity/"
|
||||
GunStormPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10109/GunStormPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10109.GunStormCtrl"
|
||||
}
|
||||
}
|
||||
function GunStormPanel:Awake()
|
||||
end
|
||||
function GunStormPanel:OnEnable()
|
||||
end
|
||||
function GunStormPanel:OnDisable()
|
||||
end
|
||||
function GunStormPanel:OnDestroy()
|
||||
end
|
||||
function GunStormPanel:OnRelease()
|
||||
end
|
||||
return GunStormPanel
|
||||
@@ -0,0 +1,134 @@
|
||||
local ActivityShopGoodsItemCtrl = class("ActivityShopGoodsItemCtrl", BaseCtrl)
|
||||
ActivityShopGoodsItemCtrl._mapNodeConfig = {
|
||||
imgRare = {sComponentName = "Image"},
|
||||
imgLeft = {},
|
||||
txtLeft = {sComponentName = "TMP_Text"},
|
||||
imgTime = {},
|
||||
txtLeftTime = {sComponentName = "TMP_Text"},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
imgElement = {sComponentName = "Image"},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
imgExpire = {sComponentName = "Image"},
|
||||
txtCount = {sComponentName = "TMP_Text"},
|
||||
imgCoin = {sComponentName = "Image"},
|
||||
txtPrice = {sComponentName = "TMP_Text"},
|
||||
imgMask = {},
|
||||
goRestock = {},
|
||||
txtRestock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Mall_Package_SoldOut"
|
||||
},
|
||||
goCondition = {},
|
||||
txtCondition = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityShopGoodsItemCtrl._mapEventConfig = {}
|
||||
function ActivityShopGoodsItemCtrl:Refresh(mapData, nCurrencyItemId)
|
||||
self.mapData = mapData
|
||||
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
|
||||
if not self.mapGoodsCfg then
|
||||
return
|
||||
end
|
||||
self:RefreshInfo()
|
||||
self:RefreshPrice(nCurrencyItemId)
|
||||
self:RefreshTime()
|
||||
self:RefreshLimit()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshInfo()
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.mapGoodsCfg.ItemId)
|
||||
if not mapItemCfg then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
|
||||
if mapItemCfg.Type == GameEnum.itemType.Disc then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon .. AllEnum.OutfitIconSurfix.Item)
|
||||
self._mapNode.imgElement.gameObject:SetActive(true)
|
||||
self._mapNode.goStar.gameObject:SetActive(true)
|
||||
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
|
||||
if mapDiscCfgData then
|
||||
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
|
||||
end
|
||||
local nStar = 6 - mapItemCfg.Rarity
|
||||
self._mapNode.goStar:SetStar(nStar, nStar)
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
|
||||
self._mapNode.imgElement.gameObject:SetActive(false)
|
||||
self._mapNode.goStar.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
|
||||
local sPath = "db_gunstorm_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10109/SpriteAtlas/1010904", sPath)
|
||||
local bLimit = 0 < self.mapData.nMaximumLimit
|
||||
if bLimit then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), self.mapData.nMaximumLimit - self.mapData.nBoughtCount))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeft, orderedFormat(ConfigTable.GetUIText("Shop_Left"), ConfigTable.GetUIText("Shop_Unlimited")))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCount, orderedFormat(ConfigTable.GetUIText("Shop_GoodsItem_Count"), self.mapGoodsCfg.ItemQuantity))
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshPrice(nCurrencyItemId)
|
||||
self:SetSprite_Coin(self._mapNode.imgCoin, nCurrencyItemId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPrice, self.mapGoodsCfg.Price)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshTime()
|
||||
local bTime = self.mapData.bPurchasTime and self.mapData.nNextRefreshTime > 0
|
||||
self._mapNode.imgTime:SetActive(bTime)
|
||||
if not bTime then
|
||||
return
|
||||
end
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHour")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Hour"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_Day"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTime, sTime)
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:RefreshLimit()
|
||||
local bMask = not self.mapData.bPurchasable or not self.mapData.bPurchasTime or self.mapData.bSoldOut
|
||||
self._mapNode.imgMask:SetActive(bMask)
|
||||
if self.mapData.bSoldOut then
|
||||
self._mapNode.goRestock:SetActive(true)
|
||||
self._mapNode.goCondition:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goRestock:SetActive(false)
|
||||
self._mapNode.goCondition:SetActive(true)
|
||||
if self.mapData.nUnlockPurchaseTime > 0 and self.mapData.nUnlockPurchaseTime == self.mapData.nNextRefreshTime then
|
||||
local sTime = ""
|
||||
local nRemaining = self.mapData.nNextRefreshTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
if nRemaining <= 3600 and 0 < nRemaining then
|
||||
sTime = ConfigTable.GetUIText("Shop_WithinHourUnLock")
|
||||
elseif 3600 < nRemaining and nRemaining <= 86400 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_HourUnLock"), math.floor(nRemaining / 3600))
|
||||
elseif 86400 < nRemaining then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("Shop_DayUnLock"), math.floor(nRemaining / 86400))
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sTime)
|
||||
return
|
||||
end
|
||||
if not self.mapData.bPurchasable then
|
||||
local sCond = ""
|
||||
if self.mapData.nPurchaseCondType == GameEnum.shopCond.WorldClassSpecific then
|
||||
sCond = orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClass"), self.mapData.tbPurchaseCondParams[1])
|
||||
elseif self.mapData.nPurchaseCondType == GameEnum.shopCond.ShopPreGoodsSellOut or self.mapData.nPurchaseCondType == GameEnum.shopCond.ActivityShopPreGoodsSellOut then
|
||||
sCond = ConfigTable.GetUIText("Shop_Cond_PreGoodsSellOut")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCondition, sCond)
|
||||
return
|
||||
end
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:Awake()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnEnable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDisable()
|
||||
end
|
||||
function ActivityShopGoodsItemCtrl:OnDestroy()
|
||||
end
|
||||
return ActivityShopGoodsItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local ActivityShopPanel = class("ActivityShopPanel", BasePanel)
|
||||
ActivityShopPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10109/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPanel:Awake()
|
||||
self.nDefaultId = nil
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.nActId = tbParam[1]
|
||||
self.nDefaultId = tbParam[2]
|
||||
end
|
||||
self.actShopData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
end
|
||||
function ActivityShopPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPanel
|
||||
@@ -0,0 +1,398 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local GunStormStoryCtrl = class("GunStormStoryCtrl", BaseCtrl)
|
||||
local ActivityAvgData = PlayerData.ActivityAvg
|
||||
GunStormStoryCtrl._mapNodeConfig = {
|
||||
svStory = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
ctlAvgRoot = {
|
||||
sNodeName = "goAvgInfoRoot",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
|
||||
},
|
||||
t_fullscreen_blur_black = {},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChapterComplete = {},
|
||||
snapshot_complete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickCloseCompete"
|
||||
},
|
||||
ctlgoEnemyInfo = {
|
||||
sNodeName = "goEnemyInfo",
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
behindBG = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
GunStormStoryCtrl._mapEventConfig = {
|
||||
Story_Done = "OnEvent_Story_Done",
|
||||
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
|
||||
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed"
|
||||
}
|
||||
local UnlockConditionPriority = {
|
||||
[1] = "MustStoryIds",
|
||||
[2] = "OneofStoryIds",
|
||||
[3] = "MustEvIds",
|
||||
[4] = "OneofEvIds",
|
||||
[5] = "WorldLevel",
|
||||
[6] = "MustAchievementIds",
|
||||
[7] = "MustActivityLevel"
|
||||
}
|
||||
local BRANCH_GRID_INDEX = 0
|
||||
local BRANCH_COUNT = 0
|
||||
function GunStormStoryCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.storyNodePos = {0, -66.1}
|
||||
self.tbGridTimer = {}
|
||||
self.tbPlayedAnim = {}
|
||||
self.nScrollTime = 0.5
|
||||
self.bInit = false
|
||||
end
|
||||
function GunStormStoryCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
self:BindBehindBGScroll()
|
||||
end
|
||||
function GunStormStoryCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function GunStormStoryCtrl:OnDisable()
|
||||
self:UnbindBehindBGScroll()
|
||||
end
|
||||
function GunStormStoryCtrl:BindBehindBGScroll()
|
||||
local scrollRect = self._mapNode.svStory.gameObject:GetComponent("ScrollRect")
|
||||
if scrollRect == nil then
|
||||
return
|
||||
end
|
||||
self.scrollRectStory = scrollRect
|
||||
if self.behindBGOriginPos == nil then
|
||||
self.behindBGOriginPos = self._mapNode.behindBG.anchoredPosition
|
||||
end
|
||||
self.contentOriginX = nil
|
||||
function self.onStoryScrollChanged(_value)
|
||||
local content = scrollRect.content
|
||||
if content == nil then
|
||||
return
|
||||
end
|
||||
local contentPos = content.anchoredPosition
|
||||
if self.contentOriginX == nil then
|
||||
self.contentOriginX = contentPos.x
|
||||
end
|
||||
if contentPos.x > self.contentOriginX then
|
||||
return
|
||||
end
|
||||
local origin = self.behindBGOriginPos
|
||||
local deltaX = contentPos.x - self.contentOriginX
|
||||
self._mapNode.behindBG.anchoredPosition = Vector2(origin.x + deltaX / 4, origin.y)
|
||||
end
|
||||
scrollRect.onValueChanged:AddListener(self.onStoryScrollChanged)
|
||||
end
|
||||
function GunStormStoryCtrl:UnbindBehindBGScroll()
|
||||
if self.scrollRectStory ~= nil and self.onStoryScrollChanged ~= nil then
|
||||
self.scrollRectStory.onValueChanged:RemoveListener(self.onStoryScrollChanged)
|
||||
end
|
||||
self.onStoryScrollChanged = nil
|
||||
self.scrollRectStory = nil
|
||||
end
|
||||
function GunStormStoryCtrl:RefreshPanel()
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
function GunStormStoryCtrl:RefreshStoryList()
|
||||
self.tbPlayedAnim = {}
|
||||
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
|
||||
local recentIndex = 1
|
||||
for i = 1, #self.tbAllStory do
|
||||
if self.tbAllStory[i] == recentStoryId then
|
||||
recentIndex = i
|
||||
break
|
||||
end
|
||||
end
|
||||
local scrollIndex = recentIndex
|
||||
if 0 < BRANCH_COUNT then
|
||||
local branchEnd = BRANCH_GRID_INDEX + BRANCH_COUNT - 1
|
||||
if recentIndex >= BRANCH_GRID_INDEX and recentIndex <= branchEnd then
|
||||
scrollIndex = BRANCH_GRID_INDEX
|
||||
elseif recentIndex > branchEnd then
|
||||
scrollIndex = recentIndex - (BRANCH_COUNT - 1)
|
||||
end
|
||||
end
|
||||
self.curIndex = recentIndex
|
||||
self._mapNode.svStory:SetAnim(0.07)
|
||||
local branchCount = 0 < BRANCH_COUNT and BRANCH_COUNT - 1 or 0
|
||||
self._mapNode.svStory:Init(#self.tbAllStory - branchCount, self, self.OnRefreshGrid)
|
||||
local time = self.bInit and 0 or self.nScrollTime
|
||||
self:AddTimer(1, 0.1, function()
|
||||
self._mapNode.svStory:SetScrollGridPos(scrollIndex, time, 0)
|
||||
self.bInit = true
|
||||
end, true, true, true)
|
||||
end
|
||||
function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local avgcfg = ConfigTable.GetData("ActivityStory", storyId)
|
||||
local goInstanceID = grid:GetInstanceID()
|
||||
local btnGrid = grid.transform:Find("btnGrid"):GetComponent("UIButton")
|
||||
local RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode")
|
||||
local imgStory = bBranch and RootNode:Find("imgStory/imgBg2"):GetComponent("Image") or RootNode:Find("imgStory"):GetComponent("Image")
|
||||
local goNotOpen = RootNode:Find("goNotOpen").gameObject
|
||||
local txtLevel = grid.transform:Find("btnGridText/scale_on_click/imgNumDb/txtIndex"):GetComponent("TMP_Text")
|
||||
local imgStoryTitleBg = RootNode:Find("imgStoryTitle")
|
||||
local imgBattleTitleBg = RootNode:Find("imgBattleTitle")
|
||||
local RedDot = RootNode:Find("RedDot").gameObject
|
||||
local goLock = grid.transform:Find("btnGridText/scale_on_click/goLockState").gameObject
|
||||
local goComplete = grid.transform:Find("btnGridText/scale_on_click/goComplete").gameObject
|
||||
local goImgTime = grid.transform:Find("btnGridText/scale_on_click/imgTime")
|
||||
local txtTime = goImgTime:Find("txtTime"):GetComponent("TMP_Text")
|
||||
local txtTitle = bBranch and RootNode:Find("tmpGroupDone"):GetComponent("TMP_Text") or grid.transform:Find("btnGridText/scale_on_click/grpTitle/tmpGroupDone"):GetComponent("TMP_Text")
|
||||
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
|
||||
local btnGridText = grid.transform:Find("btnGridText")
|
||||
local imgDb = btnGridText:Find("scale_on_click/grpTitle/imgDb")
|
||||
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
|
||||
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
|
||||
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
|
||||
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
|
||||
local nIndex = 0
|
||||
if isUnlock then
|
||||
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
|
||||
if nIndex > BRANCH_GRID_INDEX then
|
||||
nIndex = nIndex - (BRANCH_COUNT - 1)
|
||||
end
|
||||
end
|
||||
local branchSuffix = bBranch and string.char(string.byte("a") + nBranchIndex - 1) or ""
|
||||
local bShowImgStory = not bBranch or not not isUnlock
|
||||
imgStory.gameObject:SetActive(bShowImgStory)
|
||||
if bShowImgStory then
|
||||
if bOpen and isUnlock then
|
||||
self:SetPngSprite(imgStory, avgcfg.Icon .. branchSuffix)
|
||||
else
|
||||
self:SetPngSprite(imgStory, string.format("Icon/ActivityStory/ep_event09_00"))
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
|
||||
NovaAPI.SetTMPText(txtLevel, avgcfg.Index)
|
||||
txtLevel.gameObject:SetActive(not bBranch or not not isUnlock)
|
||||
txtTitle.gameObject:SetActive(isUnlock and bOpen)
|
||||
goImgTime.gameObject:SetActive(not bOpen)
|
||||
goComplete.gameObject:SetActive(isUnlock and isReaded and bOpen)
|
||||
goLock.gameObject:SetActive(not isUnlock and bOpen)
|
||||
goNotOpen.gameObject:SetActive(not bOpen or bBranch and not isUnlock)
|
||||
imgBattleTitleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
|
||||
imgStoryTitleBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
|
||||
imgDb.gameObject:SetActive(bOpen)
|
||||
if not bOpen then
|
||||
local strTime = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if self.tbGridTimer[goInstanceID] ~= nil then
|
||||
self.tbGridTimer[goInstanceID]:Cancel()
|
||||
self.tbGridTimer[goInstanceID] = nil
|
||||
end
|
||||
self.tbGridTimer[goInstanceID] = self:AddTimer(0, 1, function()
|
||||
local strTime, bLock = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
else
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
end, true, true, true)
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
end
|
||||
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
nActGroupId,
|
||||
self.nActId,
|
||||
avgcfg.Id
|
||||
}, RedDot, nil, nil, true)
|
||||
local clickFuc = function()
|
||||
if not bOpen or self.bCantClick then
|
||||
return
|
||||
end
|
||||
if isUnlock then
|
||||
local bNew = not isReaded
|
||||
self.avgId = avgcfg.StoryId
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
|
||||
self.curIndex = gridIndex
|
||||
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
elseif tbResult ~= nil then
|
||||
local lockTxt = ""
|
||||
for i = 1, #tbResult do
|
||||
local value = tbResult[i]
|
||||
if value[1] == false then
|
||||
if UnlockConditionPriority[i] == "MustStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofStoryIds" then
|
||||
do
|
||||
local tbStoryIds = value[2]
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
if v == false then
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if lockTxt == "" then
|
||||
for k, v in pairs(tbStoryIds) do
|
||||
local storyData = ConfigTable.GetData("ActivityStory", k)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "OneofEvIds" then
|
||||
lockTxt = ConfigTable.GetUIText("Story_UnlockClueCondition")
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "WorldLevel" then
|
||||
do
|
||||
local level = value[2]
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", level)
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustAchievementIds" then
|
||||
if self.bHasAchievementData == true then
|
||||
local tbAchievementList = value[2]
|
||||
for k, v in pairs(tbAchievementList) do
|
||||
if v == false then
|
||||
local achievementId = k
|
||||
local achievement = ConfigTable.GetData("Achievement", achievementId)
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", achievement.Title) .. "\n" .. "(" .. achievement.Desc .. ")"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
if UnlockConditionPriority[i] == "MustActivityLevel" then
|
||||
local levelId = value[2]
|
||||
if 0 < levelId then
|
||||
local levelData = ConfigTable.GetData("ActivityLevelsLevel", levelId)
|
||||
if levelData then
|
||||
lockTxt = orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), levelData.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
btnGrid.onClick:AddListener(clickFuc)
|
||||
end
|
||||
function GunStormStoryCtrl:OnRefreshGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local normalRoot = grid.transform:Find("Normal")
|
||||
local branchRoot = grid.transform:Find("Branch")
|
||||
if 0 < BRANCH_GRID_INDEX and gridIndex == BRANCH_GRID_INDEX then
|
||||
for i = 1, BRANCH_COUNT do
|
||||
local branchGrid = branchRoot:Find("tog" .. i)
|
||||
self:RefreshGridInfo(branchGrid.gameObject, gridIndex + i - 1, true, i)
|
||||
end
|
||||
normalRoot.gameObject:SetActive(false)
|
||||
branchRoot.gameObject:SetActive(true)
|
||||
else
|
||||
if 0 < BRANCH_COUNT and gridIndex > BRANCH_GRID_INDEX then
|
||||
gridIndex = gridIndex + (BRANCH_COUNT - 1)
|
||||
end
|
||||
self:RefreshGridInfo(normalRoot.gameObject, gridIndex, false)
|
||||
normalRoot.gameObject:SetActive(true)
|
||||
branchRoot.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function GunStormStoryCtrl:GetRemainTimeStr(nOpenTime, openDay)
|
||||
local timeStr = ""
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local openTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
|
||||
local nRemainTime = openTime + openDay * 86400 - curTime
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
local sec = nRemainTime - hour * 3600 - min * 60
|
||||
if 0 < day then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "c76153", day)
|
||||
elseif 0 < hour then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "c76153", hour)
|
||||
elseif 0 < min then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "c76153", min)
|
||||
elseif 0 < sec then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "c76153", sec)
|
||||
end
|
||||
return timeStr, 0 < nRemainTime
|
||||
end
|
||||
function GunStormStoryCtrl:OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.GunStormStory_10109)
|
||||
end
|
||||
function GunStormStoryCtrl:OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function GunStormStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function GunStormStoryCtrl:OnEvent_Story_Done(bHasReward)
|
||||
self:RefreshPanel()
|
||||
if bHasReward then
|
||||
self.bCantClick = true
|
||||
end
|
||||
end
|
||||
function GunStormStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
|
||||
local OpenPanel = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
|
||||
end
|
||||
if bConfirm then
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
end
|
||||
function GunStormStoryCtrl:OnEvent_Activity_Story_RewardClosed()
|
||||
self.bCantClick = false
|
||||
if self.curIndex == #self.tbAllStory then
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
end
|
||||
end
|
||||
function GunStormStoryCtrl:OnBtn_ClickCloseCompete()
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
return GunStormStoryCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local GunStormStoryPanel = class("GunStormStoryPanel", BasePanel)
|
||||
GunStormStoryPanel._sUIResRootPath = "UI_Activity/"
|
||||
GunStormStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10109/Story/GunStormStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10109.Story.GunStormStoryCtrl"
|
||||
}
|
||||
}
|
||||
function GunStormStoryPanel:Awake()
|
||||
end
|
||||
function GunStormStoryPanel:OnEnable()
|
||||
end
|
||||
function GunStormStoryPanel:OnDisable()
|
||||
end
|
||||
function GunStormStoryPanel:OnDestroy()
|
||||
end
|
||||
function GunStormStoryPanel:OnRelease()
|
||||
end
|
||||
return GunStormStoryPanel
|
||||
@@ -0,0 +1,423 @@
|
||||
local GunStormTaskCtrl = class("GunStormTaskCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local PlayerActivityData = PlayerData.Activity
|
||||
local TabType = GameEnum.ActivityTaskTabType
|
||||
local ItemType = GameEnum.itemType
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
GunStormTaskCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgGroupDone = {},
|
||||
tmpGroupName = {sComponentName = "TMP_Text"},
|
||||
tmpGroupProgress = {sComponentName = "TMP_Text"},
|
||||
tmpGroupUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
btnGroupDone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "onBtn_GroupDone"
|
||||
},
|
||||
tb_tmpReceived = {
|
||||
nCount = 3,
|
||||
sNodeName = "tmpReceived_",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
tmpUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
tmpDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
tmpJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
tmpGroupDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
}
|
||||
}
|
||||
GunStormTaskCtrl._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
GunStormTaskCtrl._mapRedDotConfig = {}
|
||||
function GunStormTaskCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2] or 1
|
||||
self.imgDbType = tbParam[3] or tbImgDbType.SizeDelta
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
self:refresh_Group()
|
||||
end
|
||||
function GunStormTaskCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function GunStormTaskCtrl:BuildData(nActivityId)
|
||||
self.tbData = {}
|
||||
self.tbGroupId = {}
|
||||
if self.tbData == nil then
|
||||
self.tbData = {}
|
||||
end
|
||||
if self.tbGroupId == nil then
|
||||
self.tbGroupId = {}
|
||||
end
|
||||
if self.nCurGroupIndex == nil then
|
||||
self.nCurGroupIndex = 1
|
||||
end
|
||||
if type(nActivityId) ~= "number" then
|
||||
return
|
||||
end
|
||||
self.ins_ActivityTaskData = PlayerActivityData:GetActivityDataById(nActivityId)
|
||||
if self.ins_ActivityTaskData == nil then
|
||||
return
|
||||
end
|
||||
local func_Parse_ActivityTaskGroup = function(mapData)
|
||||
if mapData.ActivityId == nActivityId then
|
||||
local _nGroupId = mapData.Id
|
||||
local nIdx = table.indexof(self.tbGroupId, _nGroupId)
|
||||
if nIdx <= 0 then
|
||||
local _mapData = {
|
||||
nGroupId = _nGroupId,
|
||||
nGroupOrder = mapData.Order,
|
||||
nTabType = mapData.TaskTabType,
|
||||
tbGroupRewardId = {},
|
||||
tbGroupRewardNum = {},
|
||||
tbTaskId = {},
|
||||
tbTaskData = {},
|
||||
nTaskDoneNum = 0,
|
||||
nTaskOKNum = 0
|
||||
}
|
||||
for i = 1, 6 do
|
||||
local nRewardId = mapData["Reward" .. tostring(i)]
|
||||
local nRewardNum = mapData["RewardQty" .. tostring(i)]
|
||||
if 0 < nRewardId and 0 < nRewardNum then
|
||||
table.insert(_mapData.tbGroupRewardId, nRewardId)
|
||||
table.insert(_mapData.tbGroupRewardNum, nRewardNum)
|
||||
end
|
||||
end
|
||||
table.insert(self.tbData, _mapData)
|
||||
table.insert(self.tbGroupId, _nGroupId)
|
||||
else
|
||||
local _mapData = self.tbData[nIdx]
|
||||
_mapData.nTaskDoneNum = 0
|
||||
_mapData.nTaskOKNum = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTaskGroup, func_Parse_ActivityTaskGroup)
|
||||
local func_Parse_ActivityTask = function(mapData)
|
||||
local nIdx = table.indexof(self.tbGroupId, mapData.ActivityTaskGroupId)
|
||||
if 0 < nIdx then
|
||||
local _mapData = self.tbData[nIdx]
|
||||
local _tbTaskId = _mapData.tbTaskId
|
||||
local _tbTaskData = _mapData.tbTaskData
|
||||
local _nTaskId = mapData.Id
|
||||
local taskData = self.ins_ActivityTaskData.mapActivityTaskDatas[_nTaskId]
|
||||
local nIndex = table.indexof(_tbTaskId, _nTaskId)
|
||||
if nIndex <= 0 then
|
||||
local _mapTaskData = {
|
||||
nTaskId = _nTaskId,
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
tbTaskRewardNum = {}
|
||||
}
|
||||
if taskData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
_mapData.nTaskDoneNum = _mapData.nTaskDoneNum + 1
|
||||
end
|
||||
if taskData.nStatus ~= AllEnum.ActQuestStatus.UnComplete then
|
||||
_mapData.nTaskOKNum = _mapData.nTaskOKNum + 1
|
||||
end
|
||||
for i = 1, 2 do
|
||||
local nRewardId = mapData["Tid" .. tostring(i)]
|
||||
local nRewardNum = mapData["Qty" .. tostring(i)]
|
||||
if 0 < nRewardId and 0 < nRewardNum then
|
||||
table.insert(_mapTaskData.tbTaskRewardId, nRewardId)
|
||||
table.insert(_mapTaskData.tbTaskRewardNum, nRewardNum)
|
||||
end
|
||||
end
|
||||
table.insert(_tbTaskId, _nTaskId)
|
||||
table.insert(_tbTaskData, _mapTaskData)
|
||||
else
|
||||
local _mapTaskData = _tbTaskData[nIndex]
|
||||
_mapTaskData.nStatus = taskData.nStatus
|
||||
_mapTaskData.nCur = taskData.nCur
|
||||
_mapTaskData.nMax = taskData.nMax
|
||||
if taskData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
_mapData.nTaskDoneNum = _mapData.nTaskDoneNum + 1
|
||||
end
|
||||
if taskData.nStatus ~= AllEnum.ActQuestStatus.UnComplete then
|
||||
_mapData.nTaskOKNum = _mapData.nTaskOKNum + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTask, func_Parse_ActivityTask)
|
||||
table.sort(self.tbData, function(a, b)
|
||||
return a.nGroupOrder < b.nGroupOrder
|
||||
end)
|
||||
for i, v in ipairs(self.tbData) do
|
||||
self.tbGroupId[i] = v.nGroupId
|
||||
end
|
||||
for i, mapData in ipairs(self.tbData) do
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
table.sort(tbTaskData, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.nTaskId < b.nTaskId
|
||||
else
|
||||
return a.nStatus < b.nStatus
|
||||
end
|
||||
end)
|
||||
for ii, vv in ipairs(tbTaskData) do
|
||||
mapData.tbTaskId[ii] = vv.nTaskId
|
||||
end
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function GunStormTaskCtrl:onGridRefresh_Tab(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapData = self.tbData[nIndex]
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", mapData.nGroupId)
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nTotal = #mapData.tbTaskData
|
||||
local sProgress = string.format("%s/%s", tostring(nDone), tostring(nTotal))
|
||||
local tr = go.transform
|
||||
local objChain = tr:Find("imgChain1")
|
||||
if #self.tbData == nIndex and objChain then
|
||||
objChain.gameObject:SetActive(false)
|
||||
end
|
||||
self:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
|
||||
local goRedDot = tr:Find("scale_on_click/redDotTab")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
|
||||
if bInActGroup == false then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
self.nActivityId,
|
||||
mapData.nGroupId
|
||||
}, goRedDot, nil, nil, true)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
nActGroupId,
|
||||
self.nActivityId,
|
||||
mapData.nGroupId
|
||||
}, goRedDot, nil, nil, true)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:onGridBtnClick_Tab(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
if self.nCurGroupIndex ~= nIndex then
|
||||
local canvasGroupOn = go.transform.parent:GetChild(self.nCurGroupIndex - 1):Find("scale_on_click/imgDb_on"):GetComponent("CanvasGroup")
|
||||
local canvasGroupOff = go.transform.parent:GetChild(self.nCurGroupIndex - 1):Find("scale_on_click/imgDb_off"):GetComponent("CanvasGroup")
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOn, 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOff, 1)
|
||||
self.nCurGroupIndex = nIndex
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
self:refresh_Group()
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
|
||||
local canvasGroupOn = tr:Find("scale_on_click/imgDb_on"):GetComponent("CanvasGroup")
|
||||
local canvasGroupOff = tr:Find("scale_on_click/imgDb_off"):GetComponent("CanvasGroup")
|
||||
if self.nCurGroupIndex == nIndex then
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOn, 1)
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOff, 0)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabName_on"):GetComponent("TMP_Text"), mapCfgData_ActivityTaskGroup.TabText)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabProgress_on"):GetComponent("TMP_Text"), sProgress)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOn, 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(canvasGroupOff, 1)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabName_off"):GetComponent("TMP_Text"), mapCfgData_ActivityTaskGroup.TabText)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabProgress_off"):GetComponent("TMP_Text"), sProgress)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:refresh_Task(bPlayAnim)
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
if bPlayAnim == true then
|
||||
self._mapNode.svList_Task:SetAnim(0.05)
|
||||
end
|
||||
self._mapNode.svList_Task:Init(#mapData.tbTaskData, self, self.onGridRefresh_Task, nil)
|
||||
end
|
||||
function GunStormTaskCtrl:onGridRefresh_Task(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local mapTask = mapData.tbTaskData[nIndex]
|
||||
local tr = go.transform:GetChild(0)
|
||||
for i = 1, 5 do
|
||||
tr:Find("imgRare_" .. tostring(i)).localScale = i == mapTask.nRarity and Vector3.one or Vector3.zero
|
||||
end
|
||||
if self.imgDbType == tbImgDbType.SizeDelta then
|
||||
self:SetImgBar_SizeDelta(mapTask, tr)
|
||||
elseif self.imgDbType == tbImgDbType.FillAmount then
|
||||
self:SetImgBar_FillAmount(mapTask, tr)
|
||||
end
|
||||
local nCount = #mapTask.tbTaskRewardId
|
||||
for i = 1, 2 do
|
||||
local _tr = tr:Find("goTaskReward" .. tostring(i))
|
||||
if i <= nCount then
|
||||
_tr.localScale = Vector3.one
|
||||
local nId = mapTask.tbTaskRewardId[i]
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", nId)
|
||||
self:SetSprite_FrameColor(_tr:Find("Size/scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
|
||||
self:SetPngSprite(_tr:Find("Size/scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
|
||||
_tr:Find("Size/scale_on_click/goReceived").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
local nNum = self:SetBigNum(mapTask.tbTaskRewardNum[i])
|
||||
local sNum = mapCfgData_Item.Type ~= ItemType.Char and mapCfgData_Item.Type ~= ItemType.Disc and "×" .. tostring(nNum) or ""
|
||||
NovaAPI.SetTMPText(_tr:Find("Size/scale_on_click/tmpCount").gameObject:GetComponent("TMP_Text"), sNum)
|
||||
_tr:GetChild(0).name = tostring(nId)
|
||||
_tr:Find("Size/scale_on_click/goTimeLimit").localScale = 0 < mapCfgData_Item.ExpireType and Vector3.one or Vector3.zero
|
||||
else
|
||||
_tr.localScale = Vector3.zero
|
||||
end
|
||||
end
|
||||
tr:Find("tmpUndone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 >= mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Complete and Vector3.one or Vector3.zero
|
||||
tr:Find("btnDone"):GetChild(0).name = tostring(mapTask.nTaskId)
|
||||
tr:Find("btnJump").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.UnComplete and 0 < mapTask.nJumpTo and Vector3.one or Vector3.zero
|
||||
tr:Find("btnJump"):GetChild(0).name = tostring(mapTask.nJumpTo)
|
||||
tr:Find("goDone").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
|
||||
end
|
||||
function GunStormTaskCtrl:onEvent_ClickRewardItem(goBtn)
|
||||
local nItemId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nItemId ~= nil then
|
||||
UTILS.ClickItemGridWithTips(nItemId, goBtn.transform, true, true, true)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
local nTaskId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nTaskId ~= nil then
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
self:refresh_Group()
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nJumpId ~= nil and 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
end
|
||||
end
|
||||
function GunStormTaskCtrl:refresh_Group()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local nGroupId = mapData.nGroupId
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
self.bGot = table.indexof(self.ins_ActivityTaskData.tbActivityTaskGroupIds, nGroupId) > 0
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nOK = mapData.nTaskOKNum
|
||||
local nTotal = #tbTaskData
|
||||
local bDone = nOK == nTotal
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, mapCfgData_ActivityTaskGroup.TabText)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupProgress, string.format("%s/%s", tostring(nDone), tostring(nTotal)))
|
||||
self._mapNode.tmpGroupUndone.transform.localScale = bDone == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.btnGroupDone.transform.localScale = bDone == true and self.bGot == false and Vector3.one or Vector3.zero
|
||||
self._mapNode.imgGroupDone.transform.localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
self.tbCurGroupRewardId = mapData.tbGroupRewardId
|
||||
self.tbCurGroupRewardNum = mapData.tbGroupRewardNum
|
||||
self._mapNode.svList_GroupReward:Init(#self.tbCurGroupRewardId, self, self.onGridRefresh_GroupRewardItem, self.onGridBtnClick_GroupRewardItem)
|
||||
end
|
||||
function GunStormTaskCtrl:onGridRefresh_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
|
||||
local tr = go.transform
|
||||
self:SetSprite_FrameColor(tr:Find("scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
|
||||
self:SetPngSprite(tr:Find("scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
|
||||
tr:Find("scale_on_click/goReceived").localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
local nNum = self:SetBigNum(self.tbCurGroupRewardNum[nIndex])
|
||||
local sNum = mapCfgData_Item.Type ~= ItemType.Char and mapCfgData_Item.Type ~= ItemType.Disc and "×" .. tostring(nNum) or ""
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/tmpCount").gameObject:GetComponent("TMP_Text"), sNum)
|
||||
tr:Find("scale_on_click/goTimeLimit").localScale = mapCfgData_Item.ExpireType > 0 and Vector3.one or Vector3.zero
|
||||
end
|
||||
function GunStormTaskCtrl:onGridBtnClick_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.transform.parent.name) + 1
|
||||
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
|
||||
end
|
||||
function GunStormTaskCtrl:onBtn_GroupDone()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Group()
|
||||
end
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
|
||||
end
|
||||
function GunStormTaskCtrl:SetImgBar_SizeDelta(mapTask, tr)
|
||||
local nCur = mapTask.nCur
|
||||
local nMax = mapTask.nMax
|
||||
if nMax <= 0 then
|
||||
nMax = 0 < nCur and nCur or 1
|
||||
end
|
||||
if nCur > nMax then
|
||||
nCur = nMax
|
||||
end
|
||||
if mapTask.nStatus == AllEnum.ActQuestStatus.Complete or mapTask.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
nCur = nMax
|
||||
end
|
||||
local rt = tr:Find("imgProgessDb"):GetComponent("RectTransform")
|
||||
local nWidth = nCur / nMax * rt.rect.width
|
||||
if 0 < nWidth and nWidth < 40 then
|
||||
nWidth = 40
|
||||
end
|
||||
tr:Find("imgProgessBar"):GetComponent("RectTransform").sizeDelta = Vector2(nWidth, rt.rect.height)
|
||||
NovaAPI.SetTMPText(tr:Find("tmpTaskDesc"):GetComponent("TMP_Text"), mapTask.sDesc)
|
||||
NovaAPI.SetTMPText(tr:Find("tmpTaskProgress"):GetComponent("TMP_Text"), string.format("%s/%s", tostring(nCur), tostring(nMax)))
|
||||
end
|
||||
function GunStormTaskCtrl:SetImgBar_FillAmount(mapTask, tr)
|
||||
local nCur = mapTask.nCur
|
||||
local nMax = mapTask.nMax
|
||||
if nMax <= 0 then
|
||||
nMax = 0 < nCur and nCur or 1
|
||||
end
|
||||
if nCur > nMax then
|
||||
nCur = nMax
|
||||
end
|
||||
if mapTask.nStatus == AllEnum.ActQuestStatus.Complete or mapTask.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
nCur = nMax
|
||||
end
|
||||
local imgProgessBar = tr:Find("imgProgessBar"):GetComponent("Image")
|
||||
NovaAPI.SetImageFillAmount(imgProgessBar, nCur / nMax)
|
||||
NovaAPI.SetTMPText(tr:Find("tmpTaskDesc"):GetComponent("TMP_Text"), mapTask.sDesc)
|
||||
NovaAPI.SetTMPText(tr:Find("tmpTaskProgress"):GetComponent("TMP_Text"), string.format("%s/%s", tostring(nCur), tostring(nMax)))
|
||||
end
|
||||
function GunStormTaskCtrl:SetBigNum(number)
|
||||
local nNum = number
|
||||
if 999999 < nNum then
|
||||
local nFloor = math.floor(nNum / 100)
|
||||
local nK = string.format("%.0f", nFloor / 10)
|
||||
nNum = nK .. "k"
|
||||
end
|
||||
return nNum
|
||||
end
|
||||
return GunStormTaskCtrl
|
||||
@@ -0,0 +1,16 @@
|
||||
local GunStormTaskPanel = class("GunStormTaskPanel", BasePanel)
|
||||
GunStormTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
GunStormTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10109/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10109.Task.GunStormTaskCtrl"
|
||||
}
|
||||
}
|
||||
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
|
||||
function GunStormTaskPanel:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" and tbParam[3] == nil then
|
||||
tbParam[3] = tbImgDbType.FillAmount
|
||||
end
|
||||
end
|
||||
return GunStormTaskPanel
|
||||
@@ -610,7 +610,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -533,7 +533,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
@@ -876,7 +876,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
end
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
|
||||
|
||||
@@ -97,6 +97,7 @@ function ActivityLevelsInstanceResultCtrl:Awake()
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OnEnable()
|
||||
self.bOpenReward = false
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
@@ -323,6 +324,10 @@ function ActivityLevelsInstanceResultCtrl:OnBtnClick_Close(btn)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OpenReward()
|
||||
if self.bOpenReward then
|
||||
return
|
||||
end
|
||||
self.bOpenReward = true
|
||||
if #self.mapReward > 0 then
|
||||
local nAnimTime = 2
|
||||
self._mapNode.goGacha.gameObject:SetActive(true)
|
||||
|
||||
@@ -564,7 +564,7 @@ function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
|
||||
Reference in New Issue
Block a user