Update - 1.13.0.124

EN: 1.13.0.124
CN: 1.13.0.124
JP: 1.13.0.128
KR: 1.13.0.130
This commit is contained in:
SL1900
2026-07-21 12:30:00 +09:00
parent a12087abad
commit 8c4bd41668
1334 changed files with 873026 additions and 95164 deletions
@@ -91,7 +91,7 @@ function DoubleDropActQuestCtrl:OnGridQuestRefresh(goGrid, gridIndex)
local btn_item = goRoot.transform:Find("btn_item"):GetComponent("UIButton")
local item = goRoot.transform:Find("btn_item/AnimRoot/item")
if self.tbItemCtrl[instanceId] == nil then
self.tbItemCtrl[instanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
self.tbItemCtrl[instanceId] = self:BindCtrlByNode(item.gameObject, "Game.UI.TemplateEx.TemplateItemCtrl")
end
local txtTarget = goRoot.transform:Find("txt_target"):GetComponent("TMP_Text")
local txt_com1 = goRoot.transform:Find("txt_com1"):GetComponent("TMP_Text")
@@ -0,0 +1,87 @@
local FollowSocialMediaActCtrl = class("FollowSocialMediaActCtrl", BaseCtrl)
local SDKManager = CS.SDKManager.Instance
FollowSocialMediaActCtrl._mapNodeConfig = {
btnEntrance = {
nCount = 3,
sComponentName = "UIButton",
callback = "OnBtnClick_Entrance"
}
}
FollowSocialMediaActCtrl._mapEventConfig = {}
FollowSocialMediaActCtrl._mapRedDotConfig = {}
function FollowSocialMediaActCtrl:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self.config = ConfigTable.GetData("FollowSocialMediaControl", self.nActId)
if self.config == nil then
return
end
for _, v in ipairs(self._mapNode.btnEntrance) do
v.gameObject:SetActive(false)
end
self.tbEntrance = self.config.LinkList
for i, v in ipairs(self.tbEntrance) do
if i > #self._mapNode.btnEntrance then
break
end
local btn = self._mapNode.btnEntrance[i]
self:InitEntrance(btn, v)
end
end
function FollowSocialMediaActCtrl:InitEntrance(btn, nlinkConfigId)
local linkConfig = ConfigTable.GetData("FollowSocialMediaLinkConfig", nlinkConfigId)
if linkConfig == nil then
return
end
local imgIcon = btn.transform:Find("AnimRoot/grpBg/imgIcon"):GetComponent("Image")
local txtTitle1 = btn.transform:Find("AnimRoot/grpBg/txtTitle1"):GetComponent("TMP_Text")
local imgReward1 = btn.transform:Find("AnimRoot/grpBg/imgItem/imgReward1"):GetComponent("Image")
local imgReward2 = btn.transform:Find("AnimRoot/grpBg/imgItem/imgReward2"):GetComponent("Image")
local txtCount = btn.transform:Find("AnimRoot/grpBg/txtCount"):GetComponent("TMP_Text")
local imgItem = btn.transform:Find("AnimRoot/grpBg/imgItem").gameObject
self:SetPngSprite(imgIcon, linkConfig.Icon)
NovaAPI.SetTMPText(txtTitle1, linkConfig.Name)
local itemCfg = ConfigTable.GetData("Item", linkConfig.RewardId)
if itemCfg == nil then
return
end
self:SetPngSprite(imgReward1, itemCfg.Icon)
self:SetPngSprite(imgReward2, itemCfg.Icon)
NovaAPI.SetTMPText(txtCount, linkConfig.RewardCount)
btn.gameObject:SetActive(true)
local bReceived = self.actData:GetRewardData(nlinkConfigId)
local UIParticle1 = btn.transform:Find("AnimRoot/grpBg/imgItem/UIParticle1")
local UIParticle2 = btn.transform:Find("AnimRoot/grpBg/imgItem/UIParticle2")
imgReward2.gameObject:SetActive(bReceived)
imgReward1.gameObject:SetActive(not bReceived)
UIParticle1.gameObject:SetActive(not bReceived)
UIParticle2.gameObject:SetActive(not bReceived)
imgItem.gameObject:SetActive(not bReceived)
txtCount.gameObject:SetActive(not bReceived)
end
function FollowSocialMediaActCtrl:OnBtnClick_Entrance(btn, nIndex)
if self.tbEntrance[nIndex] == nil then
return
end
local linkConfig = ConfigTable.GetData("FollowSocialMediaLinkConfig", self.tbEntrance[nIndex])
if linkConfig == nil then
return
end
if SDKManager:IsSDKInit() then
if NovaAPI.IsMobilePlatform() then
SDKManager:ShowWebView(false, "", linkConfig.DeepLink, 1, 1, true)
else
SDKManager:ShowWebView(false, "", linkConfig.URL, 1, 1, true)
end
else
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Function_NotAvailable"))
end
local bReceived = self.actData:GetRewardData(self.tbEntrance[nIndex])
if not bReceived then
local callback = function()
self:InitEntrance(btn, self.tbEntrance[nIndex])
end
self.actData:SendRewardReceive(self.tbEntrance[nIndex], callback)
end
end
return FollowSocialMediaActCtrl
@@ -1,175 +0,0 @@
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
JointDrillActCtrl._mapNodeConfig = {
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnWaitStart = {
sComponentName = "UIButton",
callback = "OnEvent_WaitStart"
},
txtBtnWaitStart = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Act_Wait_Start"
},
imgBtnMask = {},
btnStart = {
sComponentName = "UIButton",
callback = "OnBtnClick_Start"
},
txtBtnStart = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Act_Goto"
},
txtActDesc = {sComponentName = "TMP_Text"},
txtActTime = {sComponentName = "TMP_Text"},
txtFuncLock = {sComponentName = "TMP_Text"},
txtBeta = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Beta_Tip"
},
goCommon = {
sNodeName = "---Common---"
}
}
JointDrillActCtrl._mapEventConfig = {
PlayJointDrillActAnim = "OnEvent_PlayAnim"
}
function JointDrillActCtrl:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self.mapActCfg = self.actData:GetJointDrillActCfg()
if self.mapActCfg == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txtActDesc, self.mapActCfg.DescText)
self:StartActTimer()
local bPlayCond, sTips = self.actData:CheckActJumpCond()
self._mapNode.txtFuncLock.gameObject:SetActive(not bPlayCond)
if not bPlayCond then
NovaAPI.SetTMPText(self._mapNode.txtFuncLock, sTips)
end
end
function JointDrillActCtrl:GetTimeStr(nRemainTime)
local sTimeStr = ""
if nRemainTime <= 60 then
local sec = math.floor(nRemainTime)
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
elseif 60 < nRemainTime and nRemainTime <= 3600 then
local min = math.floor(nRemainTime / 60)
local sec = math.floor(nRemainTime - 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 < nRemainTime and nRemainTime <= 86400 then
local hour = math.floor(nRemainTime / 3600)
local min = math.floor((nRemainTime - 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 < nRemainTime then
local day = math.floor(nRemainTime / 86400)
local hour = math.floor((nRemainTime - 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
return sTimeStr
end
function JointDrillActCtrl:StartActTimer()
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
local nOpenTime = self.actData:GetActOpenTime()
local nCloseTime = self.actData:GetActEndTime()
local nStartTime = nOpenTime + self.mapActCfg.DrillStartTime
local nEndTime = nStartTime + self.mapActCfg.DrillDurationTime
local nStatus = 0
local refreshTime = function()
local nCurTime = ClientManager.serverTimeStamp
local sTime = ""
local nRemainTime = 0
if nCurTime < nStartTime then
nStatus = AllEnum.JointDrillActStatus.WaitStart
nRemainTime = math.max(nStartTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Time"), self:GetTimeStr(nRemainTime))
elseif nCurTime >= nStartTime and nCurTime < nEndTime then
nStatus = AllEnum.JointDrillActStatus.Start
nRemainTime = math.max(nEndTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Start_Time"), self:GetTimeStr(nRemainTime))
else
nStatus = AllEnum.JointDrillActStatus.WaitClose
nRemainTime = math.max(nCloseTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Close_Time"), self:GetTimeStr(nRemainTime))
end
if nRemainTime <= 0 and self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
self._mapNode.btnStart.gameObject:SetActive(nStatus ~= AllEnum.JointDrillActStatus.WaitStart)
self._mapNode.btnWaitStart.gameObject:SetActive(nStatus == AllEnum.JointDrillActStatus.WaitStart)
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
end
refreshTime()
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
end
function JointDrillActCtrl:ClearActivity()
end
function JointDrillActCtrl:OnEvent_WaitStart()
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Tip"))
end
function JointDrillActCtrl:OnBtnClick_Start()
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510003, self.actData.nActId)
end)
end
function JointDrillActCtrl:OnBtnClick_Detail()
if self.mapActCfg == nil then
return
end
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = self.mapActCfg.DetailDesc,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function JointDrillActCtrl:OnEvent_PlayAnim(sAnim, callback)
if self.animRoot ~= nil then
local nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {sAnim})
self.animRoot:Play(sAnim, 0, 0)
self:AddTimer(1, nAnimTime, function()
if callback ~= nil then
callback()
end
end, true, true, true)
elseif callback ~= nil then
callback()
end
end
function JointDrillActCtrl:OnEnable()
self.animRoot = self.gameObject:GetComponent("Animator")
end
function JointDrillActCtrl:OnDisable()
end
return JointDrillActCtrl
@@ -1,175 +0,0 @@
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
JointDrillActCtrl._mapNodeConfig = {
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnWaitStart = {
sComponentName = "UIButton",
callback = "OnEvent_WaitStart"
},
txtBtnWaitStart = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Act_Wait_Start"
},
imgBtnMask = {},
btnStart = {
sComponentName = "UIButton",
callback = "OnBtnClick_Start"
},
txtBtnStart = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Act_Goto"
},
txtActDesc = {sComponentName = "TMP_Text"},
txtActTime = {sComponentName = "TMP_Text"},
txtFuncLock = {sComponentName = "TMP_Text"},
txtBeta = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Beta_Tip"
},
goCommon = {
sNodeName = "---Common---"
}
}
JointDrillActCtrl._mapEventConfig = {
PlayJointDrillActAnim = "OnEvent_PlayAnim"
}
function JointDrillActCtrl:InitActData(actData)
self.actData = actData
self.nActId = actData:GetActId()
self.mapActCfg = self.actData:GetJointDrillActCfg()
if self.mapActCfg == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txtActDesc, self.mapActCfg.DescText)
self:StartActTimer()
local bPlayCond, sTips = self.actData:CheckActJumpCond()
self._mapNode.txtFuncLock.gameObject:SetActive(not bPlayCond)
if not bPlayCond then
NovaAPI.SetTMPText(self._mapNode.txtFuncLock, sTips)
end
end
function JointDrillActCtrl:GetTimeStr(nRemainTime)
local sTimeStr = ""
if nRemainTime <= 60 then
local sec = math.floor(nRemainTime)
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
elseif 60 < nRemainTime and nRemainTime <= 3600 then
local min = math.floor(nRemainTime / 60)
local sec = math.floor(nRemainTime - 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 < nRemainTime and nRemainTime <= 86400 then
local hour = math.floor(nRemainTime / 3600)
local min = math.floor((nRemainTime - 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 < nRemainTime then
local day = math.floor(nRemainTime / 86400)
local hour = math.floor((nRemainTime - 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
return sTimeStr
end
function JointDrillActCtrl:StartActTimer()
if self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
local nOpenTime = self.actData:GetActOpenTime()
local nCloseTime = self.actData:GetActEndTime()
local nStartTime = nOpenTime + self.mapActCfg.DrillStartTime
local nEndTime = nStartTime + self.mapActCfg.DrillDurationTime
local nStatus = 0
local refreshTime = function()
local nCurTime = ClientManager.serverTimeStamp
local sTime = ""
local nRemainTime = 0
if nCurTime < nStartTime then
nStatus = AllEnum.JointDrillActStatus.WaitStart
nRemainTime = math.max(nStartTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Time"), self:GetTimeStr(nRemainTime))
elseif nCurTime >= nStartTime and nCurTime < nEndTime then
nStatus = AllEnum.JointDrillActStatus.Start
nRemainTime = math.max(nEndTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Start_Time"), self:GetTimeStr(nRemainTime))
else
nStatus = AllEnum.JointDrillActStatus.WaitClose
nRemainTime = math.max(nCloseTime - nCurTime, 0)
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Close_Time"), self:GetTimeStr(nRemainTime))
end
if nRemainTime <= 0 and self.timer ~= nil then
self.timer:Cancel()
self.timer = nil
end
self._mapNode.btnStart.gameObject:SetActive(nStatus ~= AllEnum.JointDrillActStatus.WaitStart)
self._mapNode.btnWaitStart.gameObject:SetActive(nStatus == AllEnum.JointDrillActStatus.WaitStart)
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
end
refreshTime()
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
end
function JointDrillActCtrl:ClearActivity()
end
function JointDrillActCtrl:OnEvent_WaitStart()
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Tip"))
end
function JointDrillActCtrl:OnBtnClick_Start()
local bPlayCond = self.actData:CheckActJumpCond(true)
if not bPlayCond then
return
end
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510005, self.actData.nActId)
end)
end
function JointDrillActCtrl:OnBtnClick_Detail()
if self.mapActCfg == nil then
return
end
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = self.mapActCfg.DetailDesc,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function JointDrillActCtrl:OnEvent_PlayAnim(sAnim, callback)
if self.animRoot ~= nil then
local nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {sAnim})
self.animRoot:Play(sAnim, 0, 0)
self:AddTimer(1, nAnimTime, function()
if callback ~= nil then
callback()
end
end, true, true, true)
elseif callback ~= nil then
callback()
end
end
function JointDrillActCtrl:OnEnable()
self.animRoot = self.gameObject:GetComponent("Animator")
end
function JointDrillActCtrl:OnDisable()
end
return JointDrillActCtrl
@@ -1,3 +1,4 @@
local JointDrillContext = require("Game.UI.JointDrill.JointDrillContext")
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
JointDrillActCtrl._mapNodeConfig = {
@@ -140,7 +141,7 @@ function JointDrillActCtrl:OnBtnClick_Start()
return
end
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect_510001, self.actData.nActId)
EventManager.Hit(EventId.OpenPanel, JointDrillContext.GetPanelId(self.actData.nActId, "LevelSelect"), self.actData.nActId)
end)
end
function JointDrillActCtrl:OnBtnClick_Detail()
@@ -0,0 +1,152 @@
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
LoginRewardPopUpCtrl_01._mapNodeConfig = {
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Activity"
},
txtTips = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_PopUp_Tip"
},
goRewardItem = {
nCount = 7,
sCtrlName = "Game.UI.Activity.LoginReward.LoginSpRewardItemCtrl_01"
},
imgActor = {nCount = 2, sComponentName = "Image"}
}
LoginRewardPopUpCtrl_01._mapEventConfig = {}
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
self._mapNode.goActTime.gameObject:SetActive(false)
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.txtActivityTime, sTimeStr)
end
function LoginRewardPopUpCtrl_01:RefreshActData()
self.nActId = self._panel.nActId
self.actData = self._panel.actData
self.remainTimer = nil
self:RefreshRewardList()
self:RefreshNPC2D()
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
end
end
function LoginRewardPopUpCtrl_01:RefreshRewardList()
local tbRewardList = self.actData:GetActLoginRewardList()
if nil ~= tbRewardList then
for k, v in ipairs(self._mapNode.goRewardItem) do
local mapReward = tbRewardList[k]
v.gameObject:SetActive(mapReward ~= nil)
if mapReward ~= nil then
v:SetRewardItem(k, mapReward)
end
end
end
end
function LoginRewardPopUpCtrl_01:RefreshNPC2D()
local tbRewardList = self.actData:GetActLoginRewardList()
local nReceive = self.actData:GetCanReceive()
local nNpcId = tbRewardList[nReceive].NpcId
local sPath = "LoginNpc_" .. nNpcId
for i = 1, 2 do
self:SetActivityAtlasSprite(self._mapNode.imgActor[i], "_" .. self.nActId, sPath)
end
end
function LoginRewardPopUpCtrl_01:PlayOutAnim()
local nAnimLength = 0
if self.animRoot ~= nil then
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_out"
})
self.animRoot:Play("LoginReward_01_out")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
return nAnimLength
end
function LoginRewardPopUpCtrl_01:Awake()
self.animRoot = self.gameObject:GetComponent("Animator")
end
function LoginRewardPopUpCtrl_01:OnEnable()
if self.animRoot ~= nil then
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_in"
})
self.animRoot:Play("LoginReward_01_in")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
end
function LoginRewardPopUpCtrl_01:OnDisable()
end
function LoginRewardPopUpCtrl_01:OnDestroy()
end
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
local bOpen = self.actData:CheckActivityOpen()
if not bOpen then
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
callbackConfirm = callback
})
return
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
EventManager.Hit("RefreshLoginRewardPanel")
return
end
local tbRewardList = self.actData:GetActLoginRewardList()
local nReceive = self.actData:GetCanReceive()
local mapNpc = {
nNpcId = tbRewardList[nReceive].NpcId,
nVoiceId = tbRewardList[nReceive].VoiceId
}
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback, mapNpc)
end
return LoginRewardPopUpCtrl_01
@@ -0,0 +1,28 @@
local LoginRewardCtrl_01 = class("LoginRewardCtrl_01", BaseCtrl)
LoginRewardCtrl_01._mapNodeConfig = {
goCommon = {
sNodeName = "---Common---"
}
}
LoginRewardCtrl_01._mapEventConfig = {}
function LoginRewardCtrl_01:UnbindCtrl()
if self.activityCtrl ~= nil then
self:UnbindCtrlByNode(self.activityCtrl)
self.activityCtrl = nil
end
end
function LoginRewardCtrl_01:InitActData(actData)
if self.activityCtrl == nil then
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginSpRewardCtrl_List_01")
end
self.actData = actData
self.nActId = actData:GetActId()
self.activityCtrl:InitActData(actData)
end
function LoginRewardCtrl_01:ClearActivity()
self:UnbindCtrl()
end
function LoginRewardCtrl_01:OnDisable()
self:UnbindCtrl()
end
return LoginRewardCtrl_01
@@ -0,0 +1,28 @@
local LoginRewardCtrl_01 = class("LoginRewardCtrl_01", BaseCtrl)
LoginRewardCtrl_01._mapNodeConfig = {
goCommon = {
sNodeName = "---Common---"
}
}
LoginRewardCtrl_01._mapEventConfig = {}
function LoginRewardCtrl_01:UnbindCtrl()
if self.activityCtrl ~= nil then
self:UnbindCtrlByNode(self.activityCtrl)
self.activityCtrl = nil
end
end
function LoginRewardCtrl_01:InitActData(actData)
if self.activityCtrl == nil then
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginRewardCtrl_List")
end
self.actData = actData
self.nActId = actData:GetActId()
self.activityCtrl:InitActData(actData)
end
function LoginRewardCtrl_01:ClearActivity()
self:UnbindCtrl()
end
function LoginRewardCtrl_01:OnDisable()
self:UnbindCtrl()
end
return LoginRewardCtrl_01
@@ -0,0 +1,142 @@
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
LoginRewardPopUpCtrl_01._mapNodeConfig = {
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Activity"
},
txtTips = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_PopUp_Tip"
},
goRewardItem = {
nCount = 7,
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl_01"
},
imgActor = {nCount = 2, sComponentName = "Image"}
}
LoginRewardPopUpCtrl_01._mapEventConfig = {}
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
self._mapNode.goActTime.gameObject:SetActive(false)
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.txtActivityTime, sTimeStr)
end
function LoginRewardPopUpCtrl_01:RefreshActData()
self.nActId = self._panel.nActId
self.actData = self._panel.actData
self.remainTimer = nil
self:RefreshRewardList()
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
end
end
function LoginRewardPopUpCtrl_01:RefreshRewardList()
local tbRewardList = self.actData:GetActLoginRewardList()
if nil ~= tbRewardList then
for k, v in ipairs(self._mapNode.goRewardItem) do
local mapReward = tbRewardList[k]
v.gameObject:SetActive(mapReward ~= nil)
if mapReward ~= nil then
v:SetRewardItem(k, mapReward)
end
end
end
end
function LoginRewardPopUpCtrl_01:PlayOutAnim()
local nAnimLength = 0
if self.animRoot ~= nil then
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_out"
})
self.animRoot:Play("LoginReward_01_out")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
return nAnimLength
end
function LoginRewardPopUpCtrl_01:Awake()
self.animRoot = self.gameObject:GetComponent("Animator")
end
function LoginRewardPopUpCtrl_01:OnEnable()
if self.animRoot ~= nil then
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
"LoginReward_01_in"
})
self.animRoot:Play("LoginReward_01_in")
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
end
function LoginRewardPopUpCtrl_01:OnDisable()
end
function LoginRewardPopUpCtrl_01:OnDestroy()
end
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
local bOpen = self.actData:CheckActivityOpen()
if not bOpen then
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
callbackConfirm = callback
})
return
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
EventManager.Hit("RefreshLoginRewardPanel")
return
end
local tbRewardList = self.actData:GetActLoginRewardList()
local nReceive = self.actData:GetCanReceive()
local mapNpc = {
nNpcId = tbRewardList[nReceive].NpcId,
nVoiceId = tbRewardList[nReceive].VoiceId
}
local callback = function()
EventManager.Hit("RefreshLoginRewardPanel")
end
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback)
end
return LoginRewardPopUpCtrl_01
@@ -0,0 +1,294 @@
local LoginSpRewardCtrl_List_01 = class("LoginSpRewardCtrl_List_01", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
local PlayerVoiceData = PlayerData.Voice
LoginSpRewardCtrl_List_01._mapNodeConfig = {
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
goActTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
goRewardItem = {
nCount = 7,
sCtrlName = "Game.UI.Activity.LoginReward.LoginSpRewardItemCtrl_01"
},
btnRewardItem = {
nCount = 7,
sComponentName = "UIButton",
callback = "OnBtnClick_Item"
},
btnActivity = {
sComponentName = "Button",
callback = "OnBtnClick_Activity"
},
rawImgActor2D = {
sNodeName = "----Actor2D----",
sComponentName = "RawImage"
},
trActor2D_PNG = {
sNodeName = "----Actor2D_PNG----",
sComponentName = "Transform"
},
animActorL2D = {
sNodeName = "----Actor2D----",
sComponentName = "Animator"
},
animActor2D = {
sNodeName = "----Actor2D_PNG----",
sComponentName = "Animator"
},
goBubbleRoot = {
sNodeName = "----fixed_bubble----"
},
btnActor2D = {
sComponentName = "UIButton",
callback = "OnBtnClick_Actor2D"
}
}
LoginSpRewardCtrl_List_01._mapEventConfig = {
ClickLoginRewardTips = "OnEvent_ClickLoginRewardTips",
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText",
ActivityListChangeTab = "OnEvent_ActivityListChangeTab",
[EventId.ClosePanel] = "OnEvent_ClosePanel"
}
function LoginSpRewardCtrl_List_01:RefreshRemainTime()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
end
})
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.txtActivityTime, sTimeStr)
end
function LoginSpRewardCtrl_List_01:RefreshRewardList()
local tbRewardList = self.actData:GetActLoginRewardList()
if nil ~= tbRewardList then
local nReceiveDay = self.actData:GetCanReceive()
self.nActual = self.actData:GetReceived()
local canReceive = self.actData:CheckCanReceive()
if canReceive then
self.nSelectIndex = self.actData:GetCanReceive()
else
self.nSelectIndex = self.nActual
end
for k, v in ipairs(self._mapNode.goRewardItem) do
local mapReward = tbRewardList[k]
v.gameObject:SetActive(mapReward ~= nil)
if mapReward ~= nil then
v:SetRewardItem(k, mapReward, true, nReceiveDay == self.nActual and k == self.nActual + 1, true)
v:SetSelect(self.nSelectIndex == k)
end
end
end
end
function LoginSpRewardCtrl_List_01:RefreshNPC2D(bSwitch)
local tbRewardList = self.actData:GetActLoginRewardList()
local nNpcId = tbRewardList[self.nSelectIndex].NpcId
if nNpcId ~= self.nNpcId then
self.nNpcId = nNpcId
local bUseL2D = LocalSettingData.mapData.UseLive2D
self._mapNode.rawImgActor2D.transform.localScale = bUseL2D == true and Vector3.one or Vector3.zero
self._mapNode.trActor2D_PNG.localScale = bUseL2D == true and Vector3.zero or Vector3.one
if bUseL2D == true then
Actor2DManager.SetBoardNPC2D(PanelId.LoginSpReward_301011, self._mapNode.rawImgActor2D, self.nNpcId)
else
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, PanelId.LoginSpReward_301011, self.nNpcId)
end
self._mapNode.animActor2D:Play("Actor2D_PNG_right_middle_in", 0, 0)
self._mapNode.animActorL2D:Play("Actor2D_PNG_right_middle_in", 0, 0)
end
if bSwitch and self.bPlayVoice then
self.bPlayVoice = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
if self.timer then
self.timer:Cancel()
self.timer = nil
end
else
self:PlayVoice()
end
end
function LoginSpRewardCtrl_List_01:PlayVoice()
if self.bPlayVoice then
return
end
local tbRewardList = self.actData:GetActLoginRewardList()
local nVoiceId = tbRewardList[self.nSelectIndex].VoiceId
local mapVoDirectoryData = ConfigTable.GetData("VoDirectory", nVoiceId)
if not mapVoDirectoryData then
return
end
local vo = PlayerVoiceData:PlayCharVoice(mapVoDirectoryData.votype, self.nNpcId, nil, true)
if vo == 0 then
return
end
end
function LoginSpRewardCtrl_List_01:RefreshDetail()
local mapActCfg = self.actData:GetLoginRewardControlCfg()
local bEmpty = mapActCfg.DesText == ""
self._mapNode.btnDetail.gameObject:SetActive(not bEmpty)
end
function LoginSpRewardCtrl_List_01:InitActData(actData)
self.actData = actData
self.nNpcId = nil
self.bPlayVoice = false
self:RefreshRewardList()
self:RefreshNPC2D()
self:RefreshDetail()
local canReceive = self.actData:CheckCanReceive()
self._mapNode.btnActivity.gameObject:SetActive(canReceive)
local actCfg = self.actData:GetActCfgData()
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
self._mapNode.goActTime.gameObject:SetActive(false)
else
self._mapNode.goActTime.gameObject:SetActive(true)
self:RefreshRemainTime()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
end
end
end
function LoginSpRewardCtrl_List_01:Awake()
end
function LoginSpRewardCtrl_List_01:OnEnable()
end
function LoginSpRewardCtrl_List_01:OnDisable()
Actor2DManager.UnsetBoardNPC2D()
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
end
function LoginSpRewardCtrl_List_01:OnDestroy()
end
function LoginSpRewardCtrl_List_01:OnBtnClick_Detail()
local mapActCfg = self.actData:GetLoginRewardControlCfg()
local msg = {
nType = AllEnum.MessageBox.Desc,
sContent = mapActCfg.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function LoginSpRewardCtrl_List_01:OnBtnClick_Actor2D()
self:PlayVoice()
end
function LoginSpRewardCtrl_List_01:OnBtnClick_Activity()
local callback = function()
self._mapNode.btnActivity.gameObject:SetActive(false)
local actData = PlayerData.Activity:GetActivityDataById(self.actData:GetActId())
self:InitActData(actData)
end
local canReceive = self.actData:CheckCanReceive()
if not canReceive then
callback()
return
end
local tbRewardList = self.actData:GetActLoginRewardList()
local nReceive = self.actData:GetCanReceive()
local mapNpc = {
nNpcId = tbRewardList[nReceive].NpcId,
nVoiceId = tbRewardList[nReceive].VoiceId
}
PlayerData.Activity:SendReceiveLoginRewardMsg(self.actData:GetActId(), callback, mapNpc)
end
function LoginSpRewardCtrl_List_01:OnEvent_ClickLoginRewardTips(callback, index)
callback()
end
function LoginSpRewardCtrl_List_01:OnBtnClick_Item(btn, nIndex)
if nIndex > self.nActual then
return
end
if self.nSelectIndex == nIndex then
self:RefreshNPC2D()
return
end
if self.nSelectIndex then
self._mapNode.goRewardItem[self.nSelectIndex]:SetSelect(false)
end
self._mapNode.goRewardItem[nIndex]:SetSelect(true)
self.nSelectIndex = nIndex
self:RefreshNPC2D(true)
end
function LoginSpRewardCtrl_List_01:OnEvent_ShowBubbleVoiceText(nNpcId, nId)
if nNpcId ~= self.nNpcId then
return
end
local mapVoDirectoryData = ConfigTable.GetData("VoDirectory", nId)
if mapVoDirectoryData == nil then
printError("VoDirectory未找到数据id:" .. nId)
return
end
BubbleVoiceManager.PlayFixedBubbleAnim(self._mapNode.goBubbleRoot, mapVoDirectoryData.voResource)
local nTime = BubbleVoiceManager.GetVoResLen(mapVoDirectoryData.voResource)
if 0 < nTime then
self.bPlayVoice = true
self.timer = self:AddTimer(1, nTime, function()
self.bPlayVoice = false
end, true, true, true)
end
end
function LoginSpRewardCtrl_List_01:OnEvent_ActivityListChangeTab(nId)
if nId == self.actData:GetActId() then
self.bChangeTabStop = true
elseif nId ~= self.actData:GetActId() and self.bChangeTabStop then
self.bChangeTabStop = false
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
end
end
function LoginSpRewardCtrl_List_01:OnEvent_ClosePanel(nPanelId)
if nPanelId == PanelId.DiscSample then
self.bPlayVoice = false
self:PlayVoice()
end
end
return LoginSpRewardCtrl_List_01
@@ -0,0 +1,93 @@
local LoginSpRewardItemCtrl_01 = class("LoginSpRewardItemCtrl_01", BaseCtrl)
LoginSpRewardItemCtrl_01._mapNodeConfig = {
imgCanReceiveBg = {},
imgBg = {},
imgPlusBg = {},
imgDay = {nCount = 2, sComponentName = "Image"},
imgIcon = {sComponentName = "Image"},
txtItemCount = {sComponentName = "TMP_Text"},
btnItem = {sComponentName = "UIButton"},
txtItemName = {sComponentName = "TMP_Text"},
goReceived = {},
imgPlay = {},
Select = {},
imgCanReceive = {},
txtCanReceive = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_Can_Receive"
},
imgNextReceive = {},
txtNextReceive = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_Next_Receive"
},
txtReceived = {
sComponentName = "TMP_Text",
sLanguageId = "LoginReward_Received"
},
goParticle = {sNodeName = "UIParticle"}
}
LoginSpRewardItemCtrl_01._mapEventConfig = {}
LoginSpRewardItemCtrl_01._mapRedDotConfig = {}
function LoginSpRewardItemCtrl_01:SetRewardItem(nDay, mapReward, bEnableSelect, bNextDay, bClickTips)
self.nDay = nDay
self._mapNode.imgCanReceiveBg.gameObject:SetActive(mapReward.Status == 1)
self._mapNode.imgBg.gameObject:SetActive(not mapReward.DisRare)
self._mapNode.imgPlusBg.gameObject:SetActive(mapReward.DisRare)
for _, v in ipairs(self._mapNode.imgDay) do
self:SetAtlasSprite(v, "05_number", "zs_activity_02_num_" .. nDay)
end
self:SetPngSprite(self._mapNode.imgIcon, mapReward.RewardIcon or "")
NovaAPI.SetTMPText(self._mapNode.txtItemCount, orderedFormat(ConfigTable.GetUIText("LoginReward_Reward_Count"), mapReward.RewardCount))
NovaAPI.SetTMPText(self._mapNode.txtItemName, mapReward.RewardDesc)
self._mapNode.imgCanReceive.gameObject:SetActive(mapReward.Status == 1)
self._mapNode.goReceived.gameObject:SetActive(mapReward.Status == 2)
self._mapNode.imgNextReceive.gameObject:SetActive(bNextDay)
self._mapNode.goParticle.gameObject:SetActive(mapReward.DisRare and mapReward.Status ~= 2)
self:SetItemFxSate(mapReward.DisRare and mapReward.Status ~= 2)
self._mapNode.imgPlay.gameObject:SetActive(mapReward.Status == 2 and bEnableSelect)
self:SetSelect(false)
self.tbRewardList = {}
for i = 1, 3 do
local nTid = mapReward["RewardId" .. i]
local nCount = mapReward["Qty" .. i]
if nTid ~= 0 then
table.insert(self.tbRewardList, {nTid = nTid, nCount = nCount})
end
end
if bClickTips then
if self.handler then
self:UnBindHandler()
end
self:BindHandler()
end
end
function LoginSpRewardItemCtrl_01:SetSelect(bEnable)
self._mapNode.Select.gameObject:SetActive(bEnable)
end
function LoginSpRewardItemCtrl_01:BindHandler()
self.handler = {}
local comp = self._mapNode.btnItem
self.handler = ui_handler(self, self.OnBtnClick_Item, comp)
comp.onClick:AddListener(self.handler)
end
function LoginSpRewardItemCtrl_01:UnBindHandler()
local comp = self._mapNode.btnItem
comp.onClick:RemoveListener(self.handler)
self.handler = nil
end
function LoginSpRewardItemCtrl_01:OnBtnClick_Item(btn)
local callback = function()
UTILS.ClickItemGridWithTips(self.tbRewardList[1].nTid, btn.transform, true, true, false)
end
EventManager.Hit("ClickLoginRewardTips", callback, self.nDay)
end
function LoginSpRewardItemCtrl_01:SetItemFxSate(bShowFx)
local FX = self.gameObject.transform:Find("FX")
if FX then
FX.gameObject:SetActive(bShowFx)
else
return
end
end
return LoginSpRewardItemCtrl_01
@@ -0,0 +1,21 @@
local MiningGameGuidePanel = class("MiningGameGuidePanel", BasePanel)
MiningGameGuidePanel._sUIResRootPath = "UI_Activity/"
MiningGameGuidePanel._tbDefine = {
{
sPrefabPath = "_400014/MiningGameGuidePanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.MiningGameGuideCtrl"
}
}
function MiningGameGuidePanel:Awake()
end
function MiningGameGuidePanel:OnEnable()
end
function MiningGameGuidePanel:OnAfterEnter()
end
function MiningGameGuidePanel:OnDisable()
end
function MiningGameGuidePanel:OnDestroy()
end
function MiningGameGuidePanel:OnRelease()
end
return MiningGameGuidePanel
@@ -0,0 +1,24 @@
local MiningGamePanel = class("MiningGamePanel", BasePanel)
MiningGamePanel._bIsMainPanel = true
MiningGamePanel._bAddToBackHistory = true
MiningGamePanel._sUIResRootPath = "UI_Activity/"
MiningGamePanel._tbDefine = {
{
sPrefabPath = "_400014/MiningGamePanel.prefab",
sCtrlName = "Game.UI.Activity.Mining.MiningGameCtrl"
}
}
function MiningGamePanel:Awake()
self.nGuidePanelId = PanelId.MiningGameGuidePanel_400014
end
function MiningGamePanel:OnEnable()
end
function MiningGamePanel:OnAfterEnter()
end
function MiningGamePanel:OnDisable()
end
function MiningGamePanel:OnDestroy()
end
function MiningGamePanel:OnRelease()
end
return MiningGamePanel
@@ -0,0 +1,22 @@
local MiningGameQuestPanel = class("MiningGamePanel", BasePanel)
MiningGameQuestPanel._bIsMainPanel = false
MiningGameQuestPanel._sUIResRootPath = "UI_Activity/"
MiningGameQuestPanel._tbDefine = {
{
sPrefabPath = "_400014/MiningGameQuest.prefab",
sCtrlName = "Game.UI.Activity.Mining.MiningGameQuestCtrl"
}
}
function MiningGameQuestPanel:Awake()
end
function MiningGameQuestPanel:OnEnable()
end
function MiningGameQuestPanel:OnAfterEnter()
end
function MiningGameQuestPanel:OnDisable()
end
function MiningGameQuestPanel:OnDestroy()
end
function MiningGameQuestPanel:OnRelease()
end
return MiningGameQuestPanel
@@ -2,22 +2,100 @@ local ActivityMiningCtrl = class("ActivityMiningCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
local axeItemId = 0
local barMinX = -365
local barMaxX = 0
ActivityMiningCtrl._mapNodeConfig = {
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_Go"
},
txtBtnActDetail = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_ActDetail"
},
btnActDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtTime = {sComponentName = "TMP_Text"},
txtAdvanceMat = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_RewardPre"
},
svItem = {
sNodeName = "PreviewUpgradeMaterial",
sComponentName = "LoopScrollView"
},
txt_quest = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_QuestTitle"
},
redDotQuest = {},
btn_quest = {
sComponentName = "UIButton",
callback = "OnBtnClick_Quest"
},
txt_mainProcess = {sComponentName = "TMP_Text"},
imgMainBarFill = {
sComponentName = "RectTransform"
}
}
ActivityMiningCtrl._mapEventConfig = {
MiningQuestUpdate = "InitQuest",
MiningCloseQuestPanel = "OnEvent_CloseQuestPanel"
}
ActivityMiningCtrl._mapRedDotConfig = {
[RedDotDefine.Activity_Mining_AllQuest] = {
sNodeName = "redDotQuest"
}
}
function ActivityMiningCtrl:OnDestroy(...)
self:UnInit()
end
function ActivityMiningCtrl:InitActData(actData)
self.actData = actData
self.nActId = self.actData:GetActId()
self:ShowAddAxeCount()
self:RefreshTimeout()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, false)
end
self:InitItem()
self:InitQuest()
end
function ActivityMiningCtrl:UnInit(...)
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Mining_Quest_Group, nil, self._mapNode.reddot_Task)
function ActivityMiningCtrl:InitItem()
local config = ConfigTable.GetData("MiningControl", self.nActId)
if config == nil then
return
end
local rewardData = config.RewardsShow
self.tbReward = decodeJson(rewardData)
self.tbItemIns = {}
self._mapNode.svItem:Init(#self.tbReward, self, self.OnGridRefresh, self.OnGridBtnClick)
end
function ActivityMiningCtrl:OnGridRefresh(go, nIndex)
local nDataIndex = nIndex + 1
local itemId = self.tbReward[nDataIndex]
local goItem = go.transform:Find("AnimRoot/item").gameObject
local instanceId = goItem:GetInstanceID()
if self.tbItemIns[instanceId] == nil then
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
end
self.tbItemIns[instanceId]:SetItem(itemId)
end
function ActivityMiningCtrl:OnGridBtnClick(go, nIndex)
local nDataIndex = nIndex + 1
local itemId = self.tbReward[nDataIndex]
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("AnimRoot/item"), true, true, false)
end
function ActivityMiningCtrl:InitQuest()
local allCount = self.actData:GetAllQuestCount()
local receivedCount = self.actData:GetAllReceivedCount()
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
end
function ActivityMiningCtrl:RefreshTimeout()
local endTime = self.actData:GetActEndTime()
@@ -38,33 +116,21 @@ function ActivityMiningCtrl:RefreshTimeout()
local sTimeStr = ""
if remainTime <= 60 then
local sec = math.floor(remainTime)
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
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 = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
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 = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
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 = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
end
NovaAPI.SetTMPText(self._mapNode.txtTimeout, sTimeStr)
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
end
function ActivityMiningCtrl:ShowAddAxeCount()
local nActId = self.actData:GetActId()
@@ -80,59 +146,40 @@ function ActivityMiningCtrl:ShowAddAxeCount()
data:ResetAddAxeCount()
end
end
function ActivityMiningCtrl:OnBtnClick_Go(...)
local nActId = self.actData:GetActId()
local tbStoryConfig = self.actData:GetStoryConfigIdList()
local nCurLevel = self.actData:GetLevel()
local sNeedPlayAvgyId = 0
local nStoryId = 0
local tbAllData = self.actData:GetGroupStoryData()
for _, v in pairs(tbStoryConfig) do
if nCurLevel >= v.config.UnlockLayer then
local temp = v.config.Id
if not tbAllData[temp].bIsRead then
sNeedPlayAvgyId = v.config.AvgId
nStoryId = v.config.Id
end
break
end
end
local bAvgReadState = true
if tbAllData[nStoryId] ~= nil then
bAvgReadState = false
end
if sNeedPlayAvgyId ~= 0 and not bAvgReadState then
local callback = function(...)
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
self.actData:RequestFinishAvg(nStoryId)
end
local mapData = {
nType = AllEnum.StoryAvgType.Plot,
sAvgId = sNeedPlayAvgyId,
nNodeId = nil,
callback = callback
}
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
function ActivityMiningCtrl:OnBtnClick_Go()
local config = ConfigTable.GetData("MiningControl", self.nActId)
if config == nil then
return
end
local callback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGame, nActId)
EventManager.Hit(EventId.OpenPanel, config.GamePanelId, self.nActId)
end
self.actData:RequestLevelData(0, callback)
end
function ActivityMiningCtrl:OnBtnClick_Story(...)
local nActId = self.actData:GetActId()
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameStory, nActId)
function ActivityMiningCtrl:OnBtnClick_Quest()
local config = ConfigTable.GetData("MiningControl", self.nActId)
if config == nil then
return
end
EventManager.Hit(EventId.OpenPanel, config.QuestPanelId, self.nActId)
end
function ActivityMiningCtrl:OnBtnClick_Task(...)
local nActId = self.actData:GetActId()
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameQuest, nActId)
end
function ActivityMiningCtrl:OnBtnClick_Shop(...)
local nActId = self.actData:GetActId()
local tbConfig = ConfigTable.GetData("MiningControl", nActId)
local nShopId = tbConfig.ShopId
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, nShopId)
function ActivityMiningCtrl:OnBtnClick_Detail()
local config = ConfigTable.GetData("MiningControl", self.nActId)
if config == nil then
return
end
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Desc,
sContent = config.Desc,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
})
end
function ActivityMiningCtrl:ClearActivity()
if self.tbItemIns ~= nil then
for _, ctrl in pairs(self.tbItemIns) do
self:UnbindCtrlByNode(ctrl)
end
end
self.tbItemIns = {}
end
return ActivityMiningCtrl
+28 -16
View File
@@ -130,6 +130,8 @@ function MiningGameCtrl:OnEnable()
}, self._mapNode.reward_reddot)
return
end
else
RedDotManager.RegisterNode(RedDotDefine.Activity_Mining_AllQuest, nil, self._mapNode.reward_reddot)
end
end
function MiningGameCtrl:OnDisable(...)
@@ -153,6 +155,8 @@ function MiningGameCtrl:OnDestroy()
}, self._mapNode.reward_reddot)
return
end
else
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Mining_AllQuest, nil, self._mapNode.reward_reddot)
end
end
function MiningGameCtrl:InitData()
@@ -286,23 +290,31 @@ function MiningGameCtrl:OnBtnClick_OpenGuidePanel()
EventManager.Hit(EventId.OpenPanel, self._panel.nGuidePanelId, self.nActId)
end
function MiningGameCtrl:OnBtnClick_OpenTask()
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
EventManager.Hit(EventId.OpenPanel, PanelId.Task_11100, taskActId, GameEnum.ActivityTaskTabType.Tab4)
return
local controllConfig = ConfigTable.GetData("MiningControl", self.nActId)
if controllConfig == nil then
return
end
if controllConfig.UseType == GameEnum.ActivityUseType.Group then
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
local actGroupId = mapActivityData.MidGroupId
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
if taskActData ~= nil and taskActData:CheckActivityOpen() then
EventManager.Hit(EventId.OpenPanel, PanelId.Task_11100, taskActId, GameEnum.ActivityTaskTabType.Tab4)
return
end
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
self._mapNode.reward_reddot:SetActive(false)
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
end
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
actGroupId,
taskActId,
mapActivityData.MiniGameRedDot
}, self._mapNode.reward_reddot)
self._mapNode.reward_reddot:SetActive(false)
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
else
EventManager.Hit(EventId.OpenPanel, controllConfig.QuestPanelId, self.nActId)
end
end
function MiningGameCtrl:OnBtnClick_OpenAxeTips()
@@ -1,73 +1,192 @@
local MiningGameQuestCtrl = class("MiningGameQuestCtrl", BaseCtrl)
local totalLength = 520
local totalHeight = 37
local barMinX = -622
local barMaxX = 0
MiningGameQuestCtrl._mapNodeConfig = {
loopSv = {
sNodeName = "questList",
blur = {
sNodeName = "t_fullscreen_blur_blue"
},
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_QuestPanelTitle"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnAllClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btn_GetReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_GetAllReward"
},
btn_GetReward_None = {
sComponentName = "UIButton",
callback = "OnBtnClick_GetAllReward_None"
},
txt_getAllReward = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_Quest_GetAllReward"
},
Group_loop_sv = {
sNodeName = "sv_group",
sComponentName = "LoopScrollView"
},
rtBarFill = {
Quest_loop_sv = {
sNodeName = "sv_quest",
sComponentName = "LoopScrollView"
},
title_process = {
sComponentName = "TMP_Text",
sLanguageId = "MiningGame_QuestPanel_CurProcess"
},
txt_GroupProcess = {sComponentName = "TMP_Text"},
imgGroupProcessBarFill = {
sComponentName = "RectTransform"
},
btn_AllReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_AllReceive"
},
txt_AllReceive = {
ComponentName = "TMP_Text",
"Mining_Quest_AllReceive"
}
animator = {sNodeName = "Quest", sComponentName = "Animator"}
}
MiningGameQuestCtrl._mapEventConfig = {
MiningQuestUpdate = "InitQuestData"
MiningQuestUpdate = "OnEvent_QuestUpdate"
}
function MiningGameQuestCtrl:Awake(...)
MiningGameQuestCtrl._mapRedDotConfig = {}
function MiningGameQuestCtrl:Awake()
self.tbQuestGridCtrl = {}
local param = self:GetPanelParam()
local actId
if type(param) == "table" then
self.nActId = param[1]
actId = param[1]
end
self:InitData()
self:SetData(actId)
end
function MiningGameQuestCtrl:OnEnable()
self._mapNode.blur:SetActive(true)
self:PlayAnim_In()
end
function MiningGameQuestCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function MiningGameQuestCtrl:InitData()
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.tbQuestList = {}
self.tbGridCtrl = {}
end
function MiningGameQuestCtrl:InitQuestData()
self.tbQuestList = self.actData:GetAllQuestData()
table.sort(self.tbQuestList, function(a, b)
if a.nStatus == b.nStatus then
return a.Id < b.Id
if self.tbQuestGridCtrl ~= nil then
for _, ctrl in pairs(self.tbQuestGridCtrl) do
self:UnbindCtrlByNode(ctrl)
end
return a.nStatus < b.nStatus
end
self.tbQuestGridCtrl = {}
end
function MiningGameQuestCtrl:OnDestroy()
end
function MiningGameQuestCtrl:PlayAnim_In()
self._mapNode.animator:Play("t_window_04_t_in")
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
end
function MiningGameQuestCtrl:SetData(nActId)
self.nActId = nActId
self.MiningGameData = PlayerData.Activity:GetActivityDataById(self.nActId)
self.nSelectedGroupId = 0
self.tbGroup = self.MiningGameData:GetAllGroupId()
table.sort(self.tbGroup, function(a, b)
return a < b
end)
if nil ~= self.tbQuestList then
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
local nSelectIndex = 1
for i, v in ipairs(self.tbGroup) do
local bRed = RedDotManager.GetValid(RedDotDefine.Activity_Mining_QuestGroup, {v})
if bRed then
nSelectIndex = i
break
end
self._mapNode.loopSv:SetAnim(0.1)
self._mapNode.loopSv:Init(#self.tbQuestList, self, self.OnGridRefresh)
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
end
self._mapNode.rtBarFill.sizeDelta = Vector2(self.actData:GetCompleteCount() / #self.tbQuestList * totalLength, totalHeight)
self.nSelectedGroupId = self.tbGroup[nSelectIndex]
self._mapNode.Group_loop_sv:Init(#self.tbGroup, self, self.OnRefreshGroupGrid)
self:UpdateQuestList(self.nSelectedGroupId)
end
function MiningGameQuestCtrl:OnGridRefresh(goGrid, gridIndex)
function MiningGameQuestCtrl:UpdateQuestList(nGroupId)
self.questList = self.MiningGameData:GetQuestbyGroupId(nGroupId)
if self.questList == nil then
return
end
local sortFunc = function(a, b)
if a.nStatus ~= b.nStatus then
return a.nStatus < b.nStatus
end
return a.nId < b.nId
end
table.sort(self.questList, sortFunc)
local nFinishCount = self.MiningGameData:GetGroupQuestReceiveCount(nGroupId)
self._mapNode.Quest_loop_sv:Init(#self.questList, self, self.OnRefreshQuestGrid)
NovaAPI.SetTMPText(self._mapNode.txt_GroupProcess, string.format("%d/%d", nFinishCount, #self.questList))
self._mapNode.imgGroupProcessBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (nFinishCount / #self.questList), self._mapNode.imgGroupProcessBarFill.anchoredPosition.y)
local bHasFinish = false
for _, questData in ipairs(self.questList) do
if questData.nStatus == AllEnum.ActQuestStatus.Complete then
bHasFinish = true
break
end
end
self._mapNode.btn_GetReward.gameObject:SetActive(bHasFinish)
self._mapNode.btn_GetReward_None.gameObject:SetActive(not bHasFinish)
end
function MiningGameQuestCtrl:OnRefreshGroupGrid(goGrid, gridIndex)
local nIndex = gridIndex + 1
local txtName = goGrid.transform:Find("btnGrid/AnimRoot/txt_Name")
local config = ConfigTable.GetData("MiningQuestGroup", self.tbGroup[nIndex])
if config == nil then
return
end
NovaAPI.SetTMPText(txtName:GetComponent("TMP_Text"), config.GroupName)
local nFinishCount = self.MiningGameData:GetGroupQuestReceiveCount(self.tbGroup[nIndex])
local nAllCount = 0
for _, value in pairs(self.MiningGameData:GetQuestbyGroupId(self.tbGroup[nIndex])) do
nAllCount = nAllCount + 1
end
local txtCount = goGrid.transform:Find("btnGrid/AnimRoot/txt_Process")
NovaAPI.SetTMPText(txtCount:GetComponent("TMP_Text"), string.format("%d/%d", nFinishCount, nAllCount))
local goSelected = goGrid.transform:Find("btnGrid/AnimRoot/img_selected")
goSelected.gameObject:SetActive(self.tbGroup[nIndex] == self.nSelectedGroupId)
if self.tbGroup[nIndex] == self.nSelectedGroupId then
self.selectedGrid = goGrid
end
local reddot = goGrid.transform:Find("btnGrid/AnimRoot/reddot")
RedDotManager.RegisterNode(RedDotDefine.Activity_Mining_QuestGroup, {
self.tbGroup[nIndex]
}, reddot, nil, nil, true)
local go_Button = goGrid.transform:Find("btnGrid")
local btn_Select = go_Button:GetComponent("UIButton")
btn_Select.onClick:RemoveAllListeners()
local nGroupId = self.tbGroup[nIndex]
btn_Select.onClick:AddListener(function()
if self.selectedGrid ~= nil then
local oldGoSelected = self.selectedGrid.transform:Find("btnGrid/AnimRoot/img_selected")
oldGoSelected.gameObject:SetActive(false)
end
self.nSelectedGroupId = nGroupId
self.selectedGrid = goGrid
goSelected.gameObject:SetActive(true)
self:UpdateQuestList(self.nSelectedGroupId)
end)
end
function MiningGameQuestCtrl:OnRefreshQuestGrid(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceId = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceId] then
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.MiningQuestCellCtrl")
if not self.tbQuestGridCtrl[nInstanceId] then
self.tbQuestGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.MiningQuestCellCtrl")
end
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
self.tbQuestGridCtrl[nInstanceId]:SetData(self.nActId, self.questList[nIndex])
end
function MiningGameQuestCtrl:OnBtnClick_AllReceive()
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, nil)
function MiningGameQuestCtrl:OnBtnClick_GetAllReward()
self.MiningGameData:SendQuestReceive(0, self.nSelectedGroupId)
end
function MiningGameQuestCtrl:OnBtnClick_GetAllReward_None()
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TowerDefense_Quest_ReceiveNone"))
end
function MiningGameQuestCtrl:OnBtnClick_Close()
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
self._mapNode.animator:Play("t_window_04_t_out")
self:AddTimer(1, 0.2, function()
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
end, true, true, true)
end
function MiningGameQuestCtrl:OnEvent_QuestUpdate()
self._mapNode.Group_loop_sv:Init(#self.tbGroup, self, self.OnRefreshGroupGrid)
self:UpdateQuestList(self.nSelectedGroupId)
end
return MiningGameQuestCtrl
@@ -1,83 +1,75 @@
local MiningQuestCellCtrl = class("MiningQuestCellCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local totalLength = 520
local totalHeight = 37
local barMinX = -505
local barMaxX = 0
MiningQuestCellCtrl._mapNodeConfig = {
txtTitle = {sComponentName = "TMP_Text"},
btn_Receive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
txt_Receive = {
sComponentName = "TMP_Text",
"Mining_Quest_Receive"
},
btn_JumpTo = {
sComponentName = "UIButton",
callback = "OnBtnClick_JumpTo"
},
txt_JumoTo = {
sComponentName = "TMP_Text",
"Mining_Quest_Jump"
},
go_UnComplete = {},
go_Received = {},
go_ReceivedMask = {},
rtBarFill = {
sComponentName = "RectTransform"
rtReward = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnReward = {
sComponentName = "UIButton",
callback = "OnBtnClick_Reward"
},
rtReward = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
TMPTitle = {sComponentName = "TMP_Text"},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_GetReward"
},
txtBtnReceive = {
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Quest_Receive"
},
go_UnComplete = {
sNodeName = "TMPUncomplete"
},
TMPUncomplete = {
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_Quest_UnComplete"
},
imgComplete = {},
imgCompleteMask = {},
txt_process = {sComponentName = "TMP_Text"},
imgBarFill = {
sComponentName = "RectTransform"
}
}
function MiningQuestCellCtrl:Init()
end
function MiningQuestCellCtrl:Awake(...)
end
function MiningQuestCellCtrl:OnDisable()
end
MiningQuestCellCtrl._mapEventConfig = {}
MiningQuestCellCtrl._mapRedDotConfig = {}
function MiningQuestCellCtrl:SetData(nActId, questData)
self.nActId = nActId
self.questData = questData
self.tbConfig = ConfigTable.GetData("MiningQuestConfig", self.questData.nId)
NovaAPI.SetText(self._mapNode.txtTitle, ConfigTable.GetUIText(self.tbConfig.QuestDes))
end
function MiningQuestCellCtrl:UpdateCellStatus()
self._mapNode.btn_Receive:SetActive(false)
self._mapNode.btn_JumpTo:SetActive(false)
self._mapNode.go_UnComplete:SetActive(false)
self._mapNode.go_Received:SetActive(false)
self._mapNode.go_ReceivedMask:SetActive(false)
if self.questData.nStatus == AllEnum.ActQuestStatus.Complete then
self._mapNode.btn_Receive:SetActive(true)
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
elseif self.questData.nStatus == AllEnum.ActQuestStatus.UnComplete then
self._mapNode.rtBarFill.sizeDelta = Vector2(self.questData.progress.Cur / self.questData.progress.Max * totalLength, totalHeight)
if self.tbConfig.JumpTo ~= nil or next(self.tbConfig.JumpTo) ~= nil then
self._mapNode.btn_JumpTo:SetActive(true)
else
self._mapNode.go_UnComplete:SetActive(true)
end
self.MiningGameData = PlayerData.Activity:GetActivityDataById(self.nActId)
local config = ConfigTable.GetData("MiningQuest", self.questData.nId)
if config == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.TMPTitle, config.QuestDes)
if self.questData.nStatus == AllEnum.ActQuestStatus.Received then
self._mapNode.imgBarFill.anchoredPosition = Vector2(barMaxX, self._mapNode.imgBarFill.anchoredPosition.y)
NovaAPI.SetTMPText(self._mapNode.txt_process, questData.progress[1].Max .. "/" .. questData.progress[1].Max)
else
self._mapNode.go_Received:SetActive(true)
self._mapNode.go_ReceivedMask:SetActive(true)
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
self._mapNode.imgBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (math.min(questData.progress[1].Cur, questData.progress[1].Max) / questData.progress[1].Max), self._mapNode.imgBarFill.anchoredPosition.y)
NovaAPI.SetTMPText(self._mapNode.txt_process, questData.progress[1].Cur .. "/" .. questData.progress[1].Max)
end
self._mapNode.imgComplete:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.Received)
self._mapNode.imgCompleteMask:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.Received)
self._mapNode.go_UnComplete:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.UnComplete)
self._mapNode.btnReceive.gameObject:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.Complete)
self._mapNode.btnReward.gameObject:SetActive(true)
self._mapNode.rtReward:SetItem(config.RewardId, nil, config.RewardQty, nil, self.questData.nStatus == AllEnum.ActQuestStatus.Received)
end
function MiningQuestCellCtrl:OnBtnClick_Receive()
PlayerData.Activity:SendReceivePerQuest(self.nActId, self.nQuestId, nil)
end
function MiningQuestCellCtrl:OnBtnClick_JumpTo()
if nil ~= self.nJumpTo and 0 ~= self.nJumpTo then
JumpUtil.JumpTo(self.nJumpTo)
function MiningQuestCellCtrl:OnBtnClick_GetReward()
if self.questData == nil then
return
end
self.MiningGameData:SendQuestReceive(self.questData.nId, 0)
end
function MiningQuestCellCtrl:OnBtnClick_Reward(btn)
if nil ~= self.rewardId then
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
function MiningQuestCellCtrl:OnBtnClick_Reward()
local config = ConfigTable.GetData("MiningQuest", self.questData.nId)
if config == nil then
return
end
if config.RewardId > 0 then
UTILS.ClickItemGridWithTips(config.RewardId, self._mapNode.btnReward.transform, true, true, false)
end
end
return MiningQuestCellCtrl
@@ -0,0 +1,143 @@
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
local SoldierActCtrl = class("SoldierActCtrl", BaseCtrl)
SoldierActCtrl._mapNodeConfig = {
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Soldier_Entrance"
},
txtBtnActDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Soldier_ActDesc"
},
btnActDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
imgTimeBg = {},
txtTime = {sComponentName = "TMP_Text"},
txtDate = {sComponentName = "TMP_Text"},
imgLock = {},
txtLock = {sComponentName = "TMP_Text"},
txtAdvanceMat = {
sComponentName = "TMP_Text",
sLanguageId = "Soldier_RewardPre"
},
svItem = {
sNodeName = "PreviewUpgradeMaterial",
sComponentName = "LoopScrollView"
}
}
SoldierActCtrl._mapEventConfig = {}
SoldierActCtrl._mapRedDotConfig = {}
function SoldierActCtrl:InitActData(actData)
self.actData = actData
self.nActId = self.actData:GetActId()
local bOpen = self.actData:CheckActShow()
self._mapNode.btnGo.gameObject:SetActive(bOpen)
self._mapNode.imgLock.gameObject:SetActive(not bOpen)
if not bOpen then
NovaAPI.SetTMPText(self._mapNode.txtLock, orderedFormat(ConfigTable.GetUIText("ActivityEnter_Lock"), self.actData.actCfg.LimitParam))
end
self:RefreshTimeout()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, false)
end
self:InitItem()
self:RefreshDate()
end
function SoldierActCtrl:InitItem()
local config = ConfigTable.GetData("SoldierControl", self.nActId)
if config == nil then
return
end
local rewardData = config.RewardsShow
self.tbReward = decodeJson(rewardData)
self.tbItemIns = {}
self._mapNode.svItem:Init(#self.tbReward, self, self.OnGridRefresh, self.OnGridBtnClick)
end
function SoldierActCtrl:OnGridRefresh(go, nIndex)
local nDataIndex = nIndex + 1
local itemId = self.tbReward[nDataIndex]
local goItem = go.transform:Find("AnimRoot/item").gameObject
local instanceId = goItem:GetInstanceID()
if self.tbItemIns[instanceId] == nil then
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
end
self.tbItemIns[instanceId]:SetItem(itemId)
end
function SoldierActCtrl:OnGridBtnClick(go, nIndex)
local nDataIndex = nIndex + 1
local itemId = self.tbReward[nDataIndex]
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("AnimRoot/item"), true, true, false)
end
function SoldierActCtrl:RefreshTimeout()
local endTime = self.actData:GetActEndTime()
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
callbackConfirm = function()
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
end
})
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)
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)
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)
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
end
NovaAPI.SetTMPText(self._mapNode.txtLock, sTimeStr)
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
end
function SoldierActCtrl:RefreshDate()
local actCfg = ConfigTable.GetData("Activity", self.actData.nActId)
local nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(actCfg.StartTime)
local nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(actCfg.EndTime)
local nOpenYear = tonumber(os.date("%Y", nOpenTime))
local nOpenMonth = tonumber(os.date("%m", nOpenTime))
local nOpenDay = tonumber(os.date("%d", nOpenTime))
local nEndYear = tonumber(os.date("%Y", nEndTime))
local nEndMonth = tonumber(os.date("%m", nEndTime))
local nEndDay = tonumber(os.date("%d", nEndTime))
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 SoldierActCtrl:OnBtnClick_Go()
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierMainViewPanel)
end
function SoldierActCtrl:OnBtnClick_Detail()
local config = ConfigTable.GetData("SoldierControl", self.nActId)
if config == nil then
return
end
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Desc,
sContent = config.DesText,
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
})
end
return SoldierActCtrl
+48 -2
View File
@@ -40,7 +40,9 @@ local sActTypePath = {
[GameEnum.activityType.Advertise] = "Advertise",
[GameEnum.activityType.Task] = "ActivityTask",
[GameEnum.activityType.PenguinCard] = "PenguinCard",
[GameEnum.activityType.Double] = "DoubleDrop"
[GameEnum.activityType.Double] = "DoubleDrop",
[GameEnum.activityType.FollowSocialMedia] = "FollowSocialMedia",
[GameEnum.activityType.Soldier] = "Soldier"
}
function ActivityListCtrl:InitActivityList(nCurActId)
local tbActList = PlayerData.Activity:GetSortedActList()
@@ -205,7 +207,7 @@ function ActivityListCtrl:AddMiningActivityCtrl(actData)
if sFolder == nil then
return
end
local sPrefabPath = string.format(sEntranceFolder_old, sFolder, miningActCfg.UIAssets)
local sPrefabPath = string.format(sEntranceFolder, miningActCfg.UIAssets)
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, miningActCfg.CtrlName)
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
@@ -401,6 +403,46 @@ function ActivityListCtrl:AddDoubleDropActivityCtrl(actData)
actCtrl.gameObject:SetActive(true)
actCtrl:InitActData(actData)
end
function ActivityListCtrl:AddFollowSocialMediaActivityCtrl(actData)
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
if nil == actCtrl then
local sFolder = sActTypePath[GameEnum.activityType.FollowSocialMedia]
if sFolder == nil then
return
end
local mapActCfg = ConfigTable.GetData("FollowSocialMediaControl", actData:GetActId())
if not mapActCfg then
return
end
local sPrefabPath = string.format(sEntranceFolder, mapActCfg.UIAssets)
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, mapActCfg.CtrlName)
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
self.tbActCtrlObj[actData:GetActId()] = actCtrl
end
actCtrl.gameObject:SetActive(true)
actCtrl:InitActData(actData)
end
function ActivityListCtrl:AddSoldierActivityCtrl(actData)
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
if nil == actCtrl then
local sFolder = sActTypePath[GameEnum.activityType.Soldier]
if sFolder == nil then
return
end
local mapActCfg = ConfigTable.GetData("SoldierControl", actData:GetActId())
if not mapActCfg then
return
end
local sPrefabPath = string.format(sEntranceFolder, mapActCfg.UIAssets)
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, mapActCfg.CtrlName)
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
self.tbActCtrlObj[actData:GetActId()] = actCtrl
end
actCtrl.gameObject:SetActive(true)
actCtrl:InitActData(actData)
end
function ActivityListCtrl:RefreshSelectActivity(bResetDay)
for _, v in pairs(self.tbActCtrlObj) do
v.gameObject:SetActive(false)
@@ -437,6 +479,10 @@ function ActivityListCtrl:RefreshSelectActivity(bResetDay)
self:AddPenguinCardActivityCtrl(actData.actData)
elseif actType == GameEnum.activityType.Double then
self:AddDoubleDropActivityCtrl(actData.actData)
elseif actType == GameEnum.activityType.FollowSocialMedia then
self:AddFollowSocialMediaActivityCtrl(actData.actData)
elseif actType == GameEnum.activityType.Soldier then
self:AddSoldierActivityCtrl(actData.actData)
end
elseif actData.nType == AllEnum.ActivityMainType.ActivityGroup then
self.nSelectActId = actData.actData:GetActGroupId()
@@ -1,8 +1,8 @@
local ActivityJointDrill_510003PopUpCtrl = class("ActivityJointDrill_510003PopUpCtrl", BaseCtrl)
local ActivityJointDrillPopUpCtrl = class("ActivityJointDrillPopUpCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local ClientManager = CS.ClientManager.Instance
ActivityJointDrill_510003PopUpCtrl._mapNodeConfig = {
ActivityJointDrillPopUpCtrl._mapNodeConfig = {
goContent = {
sNodeName = "---Common---"
},
@@ -35,8 +35,8 @@ ActivityJointDrill_510003PopUpCtrl._mapNodeConfig = {
sLanguageId = "JointDrill_Beta_Tip"
}
}
ActivityJointDrill_510003PopUpCtrl._mapEventConfig = {}
function ActivityJointDrill_510003PopUpCtrl:ShowPopUp(actId, callback, index)
ActivityJointDrillPopUpCtrl._mapEventConfig = {}
function ActivityJointDrillPopUpCtrl:ShowPopUp(actId, callback, index)
self.popUpIndex = index
self.dontShowAgain = false
self.nCurActId = actId
@@ -58,12 +58,12 @@ function ActivityJointDrill_510003PopUpCtrl:ShowPopUp(actId, callback, index)
self.anim = self.gameObject:GetComponent("Animator")
self:PlayOpenAnim()
end
function ActivityJointDrill_510003PopUpCtrl:PlayOpenAnim()
function ActivityJointDrillPopUpCtrl:PlayOpenAnim()
if self.anim then
self.anim:Play("open", 0, 0)
end
end
function ActivityJointDrill_510003PopUpCtrl:RefreshDate()
function ActivityJointDrillPopUpCtrl:RefreshDate()
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
@@ -73,7 +73,7 @@ function ActivityJointDrill_510003PopUpCtrl:RefreshDate()
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityJointDrill_510003PopUpCtrl:RefreshTimeout()
function ActivityJointDrillPopUpCtrl:RefreshTimeout()
local endTime = self.nEndTime
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
@@ -115,7 +115,7 @@ function ActivityJointDrill_510003PopUpCtrl:RefreshTimeout()
end
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
end
function ActivityJointDrill_510003PopUpCtrl:ClosePopUp(callback)
function ActivityJointDrillPopUpCtrl:ClosePopUp(callback)
if self.anim ~= nil then
self.anim:Play("close", 0, 0)
self:AddTimer(1, 0.1, function()
@@ -128,16 +128,16 @@ function ActivityJointDrill_510003PopUpCtrl:ClosePopUp(callback)
callback()
end
end
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_DontShowAgain()
function ActivityJointDrillPopUpCtrl:OnBtnClick_DontShowAgain()
self.dontShowAgain = not self.dontShowAgain
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
end
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Close()
function ActivityJointDrillPopUpCtrl:OnBtnClick_Close()
self:ClosePopUp(self.callback)
end
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Goto()
function ActivityJointDrillPopUpCtrl:OnBtnClick_Goto()
local callback = function()
if nil ~= self.nCurActId then
PopUpManager.InterruptPopUp(self.popUpIndex)
@@ -158,4 +158,4 @@ function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Goto()
end
self:ClosePopUp(callback)
end
return ActivityJointDrill_510003PopUpCtrl
return ActivityJointDrillPopUpCtrl
@@ -1,8 +1,12 @@
local ActivityJointDrill_510003PopUpCtrl = class("ActivityJointDrill_510003PopUpCtrl", BaseCtrl)
local ActivitySoldierPopUpCtrl = class("ActivitySoldierPopUpCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local ClientManager = CS.ClientManager.Instance
ActivityJointDrill_510003PopUpCtrl._mapNodeConfig = {
ActivitySoldierPopUpCtrl._mapNodeConfig = {
btnCloseFullscreen = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
goContent = {
sNodeName = "---Common---"
},
@@ -29,24 +33,16 @@ ActivityJointDrill_510003PopUpCtrl._mapNodeConfig = {
txtDontShow = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_DontShow_PopUp_Again"
},
txtBeta = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Beta_Tip"
}
}
ActivityJointDrill_510003PopUpCtrl._mapEventConfig = {}
function ActivityJointDrill_510003PopUpCtrl:ShowPopUp(actId, callback, index)
ActivitySoldierPopUpCtrl._mapEventConfig = {}
function ActivitySoldierPopUpCtrl:ShowPopUp(actId, callback, index)
self.popUpIndex = index
self.dontShowAgain = false
self.nCurActId = actId
self.callback = callback
self.actCfg = ConfigTable.GetData("Activity", self.nCurActId)
local actData = PlayerData.Activity:GetActivityDataById(self.nCurActId)
if actData == nil then
return
end
self.nOpenTime = actData:GetChallengeStartTime()
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.StartTime)
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.EndTime)
self:RefreshTimeout()
self:RefreshDate()
@@ -58,12 +54,12 @@ function ActivityJointDrill_510003PopUpCtrl:ShowPopUp(actId, callback, index)
self.anim = self.gameObject:GetComponent("Animator")
self:PlayOpenAnim()
end
function ActivityJointDrill_510003PopUpCtrl:PlayOpenAnim()
function ActivitySoldierPopUpCtrl:PlayOpenAnim()
if self.anim then
self.anim:Play("open", 0, 0)
end
end
function ActivityJointDrill_510003PopUpCtrl:RefreshDate()
function ActivitySoldierPopUpCtrl:RefreshDate()
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
@@ -73,7 +69,7 @@ function ActivityJointDrill_510003PopUpCtrl:RefreshDate()
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityJointDrill_510003PopUpCtrl:RefreshTimeout()
function ActivitySoldierPopUpCtrl:RefreshTimeout()
local endTime = self.nEndTime
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
@@ -115,7 +111,7 @@ function ActivityJointDrill_510003PopUpCtrl:RefreshTimeout()
end
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
end
function ActivityJointDrill_510003PopUpCtrl:ClosePopUp(callback)
function ActivitySoldierPopUpCtrl:ClosePopUp(callback)
if self.anim ~= nil then
self.anim:Play("close", 0, 0)
self:AddTimer(1, 0.1, function()
@@ -128,16 +124,16 @@ function ActivityJointDrill_510003PopUpCtrl:ClosePopUp(callback)
callback()
end
end
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_DontShowAgain()
function ActivitySoldierPopUpCtrl:OnBtnClick_DontShowAgain()
self.dontShowAgain = not self.dontShowAgain
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
end
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Close()
function ActivitySoldierPopUpCtrl:OnBtnClick_Close()
self:ClosePopUp(self.callback)
end
function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Goto()
function ActivitySoldierPopUpCtrl:OnBtnClick_Goto()
local callback = function()
if nil ~= self.nCurActId then
PopUpManager.InterruptPopUp(self.popUpIndex)
@@ -158,4 +154,4 @@ function ActivityJointDrill_510003PopUpCtrl:OnBtnClick_Goto()
end
self:ClosePopUp(callback)
end
return ActivityJointDrill_510003PopUpCtrl
return ActivitySoldierPopUpCtrl
@@ -1,8 +1,8 @@
local ActivityJointDrill_510001PopUpCtrl = class("ActivityJointDrill_510001PopUpCtrl", BaseCtrl)
local ActivitySummerAdv_10110PopUpCtrl = class("ActivitySummerAdv_10110PopUpCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local ClientManager = CS.ClientManager.Instance
ActivityJointDrill_510001PopUpCtrl._mapNodeConfig = {
ActivitySummerAdv_10110PopUpCtrl._mapNodeConfig = {
goContent = {
sNodeName = "---Common---"
},
@@ -12,12 +12,16 @@ ActivityJointDrill_510001PopUpCtrl._mapNodeConfig = {
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_PopUp_Goto_1"
sLanguageId = "Activity_PopUp_Goto"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnCloseFullscreen = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
txtDate = {sComponentName = "TMP_Text"},
txtTime = {sComponentName = "TMP_Text"},
btnDontShow = {
@@ -29,25 +33,17 @@ ActivityJointDrill_510001PopUpCtrl._mapNodeConfig = {
txtDontShow = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_DontShow_PopUp_Again"
},
txtBeta = {
sComponentName = "TMP_Text",
sLanguageId = "JointDrill_Beta_Tip"
}
}
ActivityJointDrill_510001PopUpCtrl._mapEventConfig = {}
function ActivityJointDrill_510001PopUpCtrl:ShowPopUp(actId, callback, index)
ActivitySummerAdv_10110PopUpCtrl._mapEventConfig = {}
function ActivitySummerAdv_10110PopUpCtrl:ShowPopUp(actId, callback, index)
self.popUpIndex = index
self.dontShowAgain = false
self.nCurActId = actId
self.callback = callback
self.actCfg = ConfigTable.GetData("Activity", self.nCurActId)
local actData = PlayerData.Activity:GetActivityDataById(self.nCurActId)
if actData == nil then
return
end
self.nOpenTime = actData:GetChallengeStartTime()
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.EndTime)
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
self:RefreshTimeout()
self:RefreshDate()
if nil == self.remainTimer then
@@ -58,12 +54,12 @@ function ActivityJointDrill_510001PopUpCtrl:ShowPopUp(actId, callback, index)
self.anim = self.gameObject:GetComponent("Animator")
self:PlayOpenAnim()
end
function ActivityJointDrill_510001PopUpCtrl:PlayOpenAnim()
function ActivitySummerAdv_10110PopUpCtrl:PlayOpenAnim()
if self.anim then
self.anim:Play("open", 0, 0)
end
end
function ActivityJointDrill_510001PopUpCtrl:RefreshDate()
function ActivitySummerAdv_10110PopUpCtrl:RefreshDate()
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
@@ -73,7 +69,7 @@ function ActivityJointDrill_510001PopUpCtrl:RefreshDate()
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityJointDrill_510001PopUpCtrl:RefreshTimeout()
function ActivitySummerAdv_10110PopUpCtrl:RefreshTimeout()
local endTime = self.nEndTime
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
@@ -115,33 +111,30 @@ function ActivityJointDrill_510001PopUpCtrl:RefreshTimeout()
end
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
end
function ActivityJointDrill_510001PopUpCtrl:ClosePopUp(callback)
if self.anim ~= nil then
self.anim:Play("close", 0, 0)
self:AddTimer(1, 0.1, function()
if callback ~= nil then
callback()
end
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
elseif callback ~= nil then
callback()
end
end
function ActivityJointDrill_510001PopUpCtrl:OnBtnClick_DontShowAgain()
function ActivitySummerAdv_10110PopUpCtrl:OnBtnClick_DontShowAgain()
self.dontShowAgain = not self.dontShowAgain
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
end
function ActivityJointDrill_510001PopUpCtrl:OnBtnClick_Close()
self:ClosePopUp(self.callback)
function ActivitySummerAdv_10110PopUpCtrl:OnBtnClick_Close()
if self.callback ~= nil then
if self.anim then
self.anim:Play("close")
self:AddTimer(1, 0.2, function()
self.callback()
end, true, true, true)
else
self.callback()
end
end
end
function ActivityJointDrill_510001PopUpCtrl:OnBtnClick_Goto()
local callback = function()
if nil ~= self.nCurActId then
PopUpManager.InterruptPopUp(self.popUpIndex)
PlayerData.Activity:SendActivityDetailMsg()
function ActivitySummerAdv_10110PopUpCtrl:OnBtnClick_Goto()
if nil ~= self.nCurActId then
PopUpManager.InterruptPopUp(self.popUpIndex)
PlayerData.Activity:SendActivityDetailMsg()
self.anim:Play("close")
self:AddTimer(1, 0.2, function()
local endTime = self.nEndTime
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
@@ -153,9 +146,15 @@ function ActivityJointDrill_510001PopUpCtrl:OnBtnClick_Goto()
return
end
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, self.nCurActId)
end
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
local callback = function()
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id, true)
end
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id, true)
end
end, true, true, true)
end
self:ClosePopUp(callback)
end
return ActivityJointDrill_510001PopUpCtrl
return ActivitySummerAdv_10110PopUpCtrl
@@ -0,0 +1,160 @@
local ActivitySummerCheckin_20103PopUpCtrl = class("ActivitySummerCheckin_20103PopUpCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local ClientManager = CS.ClientManager.Instance
ActivitySummerCheckin_20103PopUpCtrl._mapNodeConfig = {
goContent = {
sNodeName = "---Common---"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnBtnClick_Goto"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_PopUp_Goto"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnCloseFullscreen = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
txtDate = {sComponentName = "TMP_Text"},
txtTime = {sComponentName = "TMP_Text"},
btnDontShow = {
sComponentName = "UIButton",
callback = "OnBtnClick_DontShowAgain"
},
imgDontShow1 = {},
imgDontShow2 = {},
txtDontShow = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_DontShow_PopUp_Again"
}
}
ActivitySummerCheckin_20103PopUpCtrl._mapEventConfig = {}
function ActivitySummerCheckin_20103PopUpCtrl:ShowPopUp(actId, callback, index)
self.popUpIndex = index
self.dontShowAgain = false
self.nCurActId = actId
self.callback = callback
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
self:RefreshTimeout()
self:RefreshDate()
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
end
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
self.anim = self.gameObject:GetComponent("Animator")
self:PlayOpenAnim()
end
function ActivitySummerCheckin_20103PopUpCtrl:PlayOpenAnim()
if self.anim then
self.anim:Play("open", 0, 0)
end
end
function ActivitySummerCheckin_20103PopUpCtrl:RefreshDate()
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
local nEndDay = tonumber(os.date("%d", self.nEndTime))
local strOpenDay = string.format("%d", nOpenDay)
local strEndDay = string.format("%d", nEndDay)
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivitySummerCheckin_20103PopUpCtrl:RefreshTimeout()
local endTime = self.nEndTime
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime < 0 then
if self.remainTimer ~= nil then
self.remainTimer:Cancel()
self.remainTimer = nil
end
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 ActivitySummerCheckin_20103PopUpCtrl:OnBtnClick_DontShowAgain()
self.dontShowAgain = not self.dontShowAgain
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
end
function ActivitySummerCheckin_20103PopUpCtrl:OnBtnClick_Close()
if self.callback ~= nil then
if self.anim then
self.anim:Play("close")
self:AddTimer(1, 0.2, function()
self.callback()
end, true, true, true)
else
self.callback()
end
end
end
function ActivitySummerCheckin_20103PopUpCtrl:OnBtnClick_Goto()
if nil ~= self.nCurActId then
PopUpManager.InterruptPopUp(self.popUpIndex)
PlayerData.Activity:SendActivityDetailMsg()
self.anim:Play("close")
self:AddTimer(1, 0.2, function()
local endTime = self.nEndTime
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
if remainTime <= 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
if self.callback ~= nil then
self.callback()
end
return
end
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
local callback = function()
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id, true)
end
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id, true)
end
end, true, true, true)
end
end
return ActivitySummerCheckin_20103PopUpCtrl
@@ -67,7 +67,7 @@ OurRegimentTaskCtrl._mapRedDotConfig = {}
function OurRegimentTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function OurRegimentTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function OurRegimentTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function OurRegimentTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -67,7 +67,7 @@ DreamTaskCtrl._mapRedDotConfig = {}
function DreamTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function DreamTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function DreamTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function DreamTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -67,7 +67,7 @@ MiracleTaskCtrl._mapRedDotConfig = {}
function MiracleTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function MiracleTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function MiracleTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function MiracleTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -67,7 +67,7 @@ SpringTaskCtrl._mapRedDotConfig = {}
function SpringTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function SpringTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function SpringTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function SpringTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -67,7 +67,7 @@ WinterNightTaskCtrl._mapRedDotConfig = {}
function WinterNightTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function WinterNightTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function WinterNightTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function WinterNightTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -67,7 +67,7 @@ PostalTaskCtrl._mapRedDotConfig = {}
function PostalTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -86,9 +86,6 @@ function PostalTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -201,6 +198,30 @@ function PostalTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function PostalTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -61,7 +61,7 @@ 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.nCurGroupIndex = tbParam[2]
self.imgDbType = tbParam[3] or tbImgDbType.SizeDelta
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
@@ -83,9 +83,6 @@ function GunStormTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function GunStormTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function GunStormTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -0,0 +1,163 @@
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
local lvIndexTitle = "{0}-{1}"
local colorLockSelectImage = Color(1, 1, 1, 1)
local colorLockUnSelectImage = Color(0.16470588235294117, 0.28627450980392155, 0.4627450980392157, 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 = {},
rtLockInfoDay = {sComponentName = "Image"},
imgLockMask = {},
bgCondition = {},
rtLockPreLv = {},
rtLockPreLvSelect = {sComponentName = "Image"},
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
self._mapNode.rtLockInfoDay.gameObject:SetActive(false)
self.isShowTexLv = false
self.isOpen = isOpen
if isOpen and isLevelUnLock then
self.isShowTexLv = true
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.rtLockInfoDay.gameObject: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"), "08d3d4", hour))
elseif 0 < min then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min))
elseif 0 < sec then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", 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"), "08d3d4", 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)
if self.isShowTexLv then
self._mapNode.txt_Select.gameObject:SetActive(isOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
else
self._mapNode.txt_Select.gameObject:SetActive(false)
self._mapNode.txt_unSelect.gameObject:SetActive(false)
end
if isOn then
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockSelectImage)
else
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockUnSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockUnSelectImage)
end
if not self.isOpen then
self._mapNode.imgLockMask:SetActive(not isOn)
end
if not self.lvLock and isOn then
self._mapNode.SelectAni:Play("10110_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,790 @@
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 colorLockSelectImage = Color(1, 1, 1, 1)
local colorLockUnSelectImage = Color(0.20784313725490197, 0.4, 0.9019607843137255, 1)
local colorConditionsUnLock = Color(1, 1, 1, 0.5)
local colorConditionsLock = Color(1, 1, 1, 1)
local lvIndexTitle = "{0}-{1}"
local twelveLvGroupPadding = {
81,
88,
-107,
0
}
local twelveLvGroupPaddingOpen = {
81,
818,
-107,
0
}
local fourLvGroupPadding = {
320,
88,
-107,
0
}
local fourLvGroupPaddingOpen = {
81,
818,
-107,
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.10110.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
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
local tmpImageAdventure = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
local tmpImageHard = self._mapNode.lockHard.gameObject.transform:Find("Image"):GetComponent("Image")
if nType == GameEnum.ActivityLevelType.Explore then
tabLevelInfo = self.activityLevelsData.levelTabExplore
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
elseif nType == GameEnum.ActivityLevelType.Adventure then
tabLevelInfo = self.activityLevelsData.levelTabAdventure
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
if isOpenAdventure then
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
else
NovaAPI.SetImageColor(tmpImageAdventure, colorLockSelectImage)
end
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
else
tabLevelInfo = self.activityLevelsData.levelTabHard
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
if isOpenHard then
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
else
NovaAPI.SetImageColor(tmpImageHard, colorLockSelectImage)
end
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(-3060, 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(-3060, 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(-1620, 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(-180, 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)
self._mapNode.btn_itemTemp.gameObject:SetActive(false)
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 = "10110/ActivityLevels/ActivityLevelsSelect.prefab",
sCtrlName = "Game.UI.ActivityTheme.10110.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,173 @@
local ActivitySummerAdvCtrl = class("ActivitySummerAdvCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
ActivitySummerAdvCtrl._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 = "TowerDef_EnterActivity"
},
txtBtnActDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnActDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
}
}
function ActivitySummerAdvCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivitySummerAdvCtrl:OnDisable()
self:UnbindCtrl()
end
function ActivitySummerAdvCtrl:InitActData(actData)
self.actData = actData
self:RefreshLockState()
self:RefreshDate()
self:RefreshTimeout()
self:RefreshReward()
end
function ActivitySummerAdvCtrl:UnInit()
self:UnbindCtrl()
end
function ActivitySummerAdvCtrl:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivitySummerAdvCtrl: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 ActivitySummerAdvCtrl: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 and self.remainTimer ~= nil 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 ActivitySummerAdvCtrl: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 ActivitySummerAdvCtrl: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 ActivitySummerAdvCtrl: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 ActivitySummerAdvCtrl: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 ActivitySummerAdvCtrl:OnBtnClick_Go()
local actGroupCfg = self.actData:GetActGroupCfgData()
if actGroupCfg ~= nil and actGroupCfg ~= nil and actGroupCfg.PanelId ~= nil and actGroupCfg.PanelId > 0 then
if actGroupCfg.TransitionId ~= nil and 0 < actGroupCfg.TransitionId then
local callback = function()
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
end
end
function ActivitySummerAdvCtrl: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 ActivitySummerAdvCtrl:ClearActivity()
end
return ActivitySummerAdvCtrl
@@ -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_summeradv_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10110/SpriteAtlas/10110" .. "04", 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 = "10110/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,460 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SummerAdvStoryCtrl = class("SummerAdvStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResType = GameResourceLoader.ResType
local typeof = typeof
SummerAdvStoryCtrl._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"
},
btnReview = {
sComponentName = "UIButton",
callback = "OnBtn_ClickReview"
},
imgCharHead = {sComponentName = "Image"},
txtCharName = {sComponentName = "TMP_Text"},
goPersonalityRoot = {
sNodeName = "grpUnderBar"
},
goPersonality = {
sNodeName = "goPersonality",
sComponentName = "GameObject"
},
txtPersonalityPercent = {
nCount = 3,
sNodeName = "txtPersonalityPercent",
sComponentName = "TMP_Text"
},
txtPersonality1 = {
sComponentName = "TMP_Text",
sLanguageId = "Personality_Instinct"
},
txtPersonality2 = {
sComponentName = "TMP_Text",
sLanguageId = "Personality_Analyze"
},
txtPersonality3 = {
sComponentName = "TMP_Text",
sLanguageId = "Personality_Chaos"
}
}
SummerAdvStoryCtrl._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
local REVIEW_ACTIVITY_ID = 2010302
function SummerAdvStoryCtrl: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 SummerAdvStoryCtrl:OnEnable()
self:RefreshPanel()
self:BindBehindBGScroll()
end
function SummerAdvStoryCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function SummerAdvStoryCtrl:OnDisable()
self:UnbindBehindBGScroll()
end
function SummerAdvStoryCtrl: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, origin.y)
end
scrollRect.onValueChanged:AddListener(self.onStoryScrollChanged)
end
function SummerAdvStoryCtrl: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 SummerAdvStoryCtrl:RefreshPanel()
self:RefreshStoryList()
self:RefreshPersonality()
end
function SummerAdvStoryCtrl:RefreshPersonality()
local cfg = ConfigTable.GetData("ActivityStoryChapter", self.nActId)
local personalityId = cfg.PersonalityId
self._mapNode.goPersonalityRoot:SetActive(0 < personalityId)
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[2], math.floor(tbRetPercent[2] * 100) .. "%")
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[3], math.floor(tbRetPercent[3] * 100) .. "%")
local sIcon = "Icon/PlayerHead/" .. sHead
self:SetPngSprite(self._mapNode.imgCharHead, sIcon)
end
function SummerAdvStoryCtrl: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 SummerAdvStoryCtrl: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 = RootNode:Find("imgStory"):GetComponent("Image")
local imgGo = RootNode:Find("imgGo")
local txtGo = imgGo:Find("txtIndex"):GetComponent("TMP_Text")
local goNotOpen = RootNode:Find("goNotOpen").gameObject
local imgNumDb = grid.transform:Find("btnGridText/scale_on_click/imgNumDb")
local txtLevel = grid.transform:Find("btnGridText/scale_on_click/imgNumDb/txtIndex"):GetComponent("TMP_Text")
local txtStoryTitle = RootNode:Find("imgStoryTitle/txtPlot"):GetComponent("TMP_Text")
local txtBattleTitle = RootNode:Find("imgBattleTitle/txtPlot"):GetComponent("TMP_Text")
local imgStoryTitleBg = RootNode:Find("imgStoryTitle")
local imgBattleTitleBg = RootNode:Find("imgBattleTitle")
local RedDot = grid.transform:Find("btnGridText/scale_on_click/grpTitle/RedDot").gameObject
local goComplete = grid.transform:Find("btnGridText/scale_on_click/grpTitle/goComplete").gameObject
local goImgTime = grid.transform:Find("btnGridText/scale_on_click/imgTime")
local txtTime = goImgTime:Find("txtTime"):GetComponent("TMP_Text")
local txtTitle = grid.transform:Find("btnGridText/scale_on_click/grpTitle/tmpGroupDone"):GetComponent("TMP_Text")
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local goLockState = grid.transform:Find("btnGridText/scale_on_click/goLockState").gameObject
local imgDb = grid.transform:Find("btnGridText/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
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
NovaAPI.SetTMPText(txtLevel, avgcfg.Index)
NovaAPI.SetTMPText(txtGo, ConfigTable.GetUIText("PerActivity_Quest_Jump"))
if avgcfg.IsBattle then
NovaAPI.SetTMPText(txtBattleTitle, ConfigTable.GetUIText("Story_BattleTitle"))
else
NovaAPI.SetTMPText(txtStoryTitle, ConfigTable.GetUIText("Story_StoryTitle"))
end
local bgIndex = string.sub(avgcfg.Icon, -1)
local sFullPath = Settings.AB_ROOT_PATH .. "UI_Activity/10110/FX/Textures/fx_ui_SummerAdv_Dissolve" .. bgIndex .. ".png"
local tex = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(Texture), "UI", self._panel._nPanelId)
NovaAPIHotfix.ChangeUIDissolveTarget(imgStory.gameObject, tex)
self:SetPngSprite(imgStory, avgcfg.Icon)
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)
goNotOpen.gameObject:SetActive(not bOpen or not isUnlock)
imgBattleTitleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
imgStoryTitleBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
imgNumDb.gameObject:SetActive(isUnlock and bOpen)
imgGo.gameObject:SetActive(isUnlock and bOpen)
goLockState:SetActive(not isUnlock and bOpen)
imgStory.gameObject:SetActive(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 SummerAdvStoryCtrl: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 SummerAdvStoryCtrl: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"), "08d3d4", day)
elseif 0 < hour then
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour)
elseif 0 < min then
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min)
elseif 0 < sec then
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec)
end
return timeStr, 0 < nRemainTime
end
function SummerAdvStoryCtrl:OnBtn_ClickBack()
EventManager.Hit(EventId.ClosePanel, PanelId.SummerAdvStory_10110)
end
function SummerAdvStoryCtrl:OnBtn_ClickHome()
PanelManager.Home()
end
function SummerAdvStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
end
function SummerAdvStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
if bHasReward then
self.bCantClick = true
end
end
function SummerAdvStoryCtrl: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 SummerAdvStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
end
end
function SummerAdvStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
end
function SummerAdvStoryCtrl:OnBtn_ClickReview()
EventManager.Hit(EventId.OpenPanel, PanelId.SummerCheckinStory_20103, REVIEW_ACTIVITY_ID)
end
return SummerAdvStoryCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerAdvStoryPanel = class("SummerAdvStoryPanel", BasePanel)
SummerAdvStoryPanel._sUIResRootPath = "UI_Activity/"
SummerAdvStoryPanel._tbDefine = {
{
sPrefabPath = "10110/Story/SummerAdvStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10110.Story.SummerAdvStoryCtrl"
}
}
function SummerAdvStoryPanel:Awake()
end
function SummerAdvStoryPanel:OnEnable()
end
function SummerAdvStoryPanel:OnDisable()
end
function SummerAdvStoryPanel:OnDestroy()
end
function SummerAdvStoryPanel:OnRelease()
end
return SummerAdvStoryPanel
@@ -0,0 +1,613 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local SummerAdvCtrl = class("SummerAdvCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
SummerAdvCtrl._mapNodeConfig = {
goBg = {sNodeName = "---Bg---"},
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_MiniGame_ThrowGifts"
},
imgMiniGameEnd = {},
txtMiniGameEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_MiniGame_ThrowGifts"
},
txtMiniGame_End = {},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "Cookie_Act_QuestTitle"
},
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 = "JointDrill_Btn_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 = "Cookie_Act_QuestTitle"
},
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 = "JointDrill_Btn_Shop"
},
imgShopEnd = {},
txtShop_End = {},
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
dbTaskEnd = {},
miniGameRedDot = {},
redDotEntrance2 = {},
storyRedDot = {},
reddotLevel = {},
goMiniGameEnd = {},
imgStoryEnd = {}
}
SummerAdvCtrl._mapEventConfig = {}
local ActivityState = {
NotOpen = 1,
Open = 2,
Closed = 3
}
function SummerAdvCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.SummerAdvData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
if self.SummerAdvData ~= nil then
self.ActivityGroupCfg = self.SummerAdvData.actGroupConfig
end
self.tbBtnAnimator = {}
end
function SummerAdvCtrl:OnEnable()
if #self.tbBtnAnimator == 0 then
for k, v in pairs(self._mapNode.btnEntrance_) do
local anim = v.transform:GetChild(0):GetComponent("Animator")
if anim ~= nil and anim:IsNull() == false then
table.insert(self.tbBtnAnimator, anim)
anim.enabled = false
end
end
end
self:RefreshPanel()
for i = 1, 5 do
local actData = self.SummerAdvData:GetActivityDataByIndex(i)
local nActId = actData ~= nil and actData.ActivityId or 0
local state = self.tbActState[nActId]
if nActId ~= nil and 0 < nActId and state ~= nil then
if i == AllEnum.ActivityThemeFuncIndex.Task then
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
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
self.nActId,
nActId
}, self._mapNode.reddotLevel)
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
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_IceCreamTruck_New, {nActId}, self._mapNode.miniGameRedDot)
end
end
end
local sAnimName = "SummerAdvPanel_in"
if self.animRoot ~= nil then
self.animRoot = self.gameObject:GetComponent("Animator")
sAnimName = "SummerAdvPanel_in1"
end
self.animRoot = self.gameObject:GetComponent("Animator")
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
self.animRoot:Play(sAnimName, 0, 0)
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
self:AddTimer(1, nAnimLength, function()
for k, v in pairs(self.tbBtnAnimator) do
v.enabled = true
v:Play("btnEntrance_idle")
end
end, true, true, true)
end
function SummerAdvCtrl: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
for i = 1, #self.tbBtnAnimator do
self.tbBtnAnimator[i] = nil
end
end
function SummerAdvCtrl:RefreshPanel()
if self.SummerAdvData == nil or self.ActivityGroupCfg == nil then
return
end
self:RefreshTime()
self:RefreshButtonState()
end
function SummerAdvCtrl:RefreshTime()
local bOpen = self.SummerAdvData:CheckActivityGroupOpen()
if bOpen then
self:RefreshRemainTime(self.SummerAdvData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, function()
local remainTime = self:RefreshRemainTime(self.SummerAdvData: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.SummerAdvData: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 SummerAdvCtrl:RefreshRemainTime(endTime, txtComp)
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
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(txtComp, sTimeStr)
return remainTime
end
function SummerAdvCtrl: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 SummerAdvCtrl:RefreshButtonState()
self.tbActState = {}
for i = 1, 5 do
local actData = self.SummerAdvData: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 SummerAdvCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
local countDowmTimer
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
local sEndTime = ""
if activityData ~= nil then
sEndTime = activityData.EndTime
end
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.SummerAdvData:GetActGroupEndTime() then
bShowCountDown = true
elseif endTime < self.SummerAdvData:GetActGroupEndTime() then
bShowCountDown = endTime - curTime <= 259200
end
if timer == nil and bShowCountDown then
self:RefreshRemainTime(endTime, txtTrans)
do
local fcTimer = function()
local remainTime = self: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 SummerAdvCtrl: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 SummerAdvCtrl: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.imgTaskEnd.gameObject: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 SummerAdvCtrl: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.imgStoryActivityTime, 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 SummerAdvCtrl: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)
self.tbActState[activityId] = state
local anim = self._mapNode.btnEntrance_[AllEnum.ActivityThemeFuncIndex.Level].transform:GetChild(0):GetComponent("Animator")
anim.enabled = state == ActivityState.Open
end
end
function SummerAdvCtrl: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 SummerAdvCtrl: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 SummerAdvCtrl:RefreshActivityData()
if self.bRequiredActData then
return
end
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
end
function SummerAdvCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
local actData = self.SummerAdvData: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
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
LocalData.SetPlayerLocalData("Activity_MiniGame_10110_New", true)
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
actData.ActivityId
}, false)
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
elseif self.ActivityGroupCfg.TransitionId ~= nil and self.ActivityGroupCfg.TransitionId > 0 then
EventManager.Hit(EventId.SetTransition, self.ActivityGroupCfg.TransitionId, function()
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
end)
else
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
end
end
end
return SummerAdvCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerAdvPanel = class("SummerAdvPanel", BasePanel)
SummerAdvPanel._sUIResRootPath = "UI_Activity/"
SummerAdvPanel._tbDefine = {
{
sPrefabPath = "10110/SummerAdvPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10110.SummerAdvCtrl"
}
}
function SummerAdvPanel:Awake()
end
function SummerAdvPanel:OnEnable()
end
function SummerAdvPanel:OnDisable()
end
function SummerAdvPanel:OnDestroy()
end
function SummerAdvPanel:OnRelease()
end
return SummerAdvPanel
@@ -0,0 +1,16 @@
local SummerAdvTaskPanel = class("SummerAdvTaskPanel", BasePanel)
SummerAdvTaskPanel._sUIResRootPath = "UI_Activity/"
SummerAdvTaskPanel._tbDefine = {
{
sPrefabPath = "10110/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
}
}
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
function SummerAdvTaskPanel:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" and tbParam[3] == nil then
tbParam[3] = tbImgDbType.FillAmount
end
end
return SummerAdvTaskPanel
@@ -67,7 +67,7 @@ ChristmasTaskCtrl._mapRedDotConfig = {}
function ChristmasTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function ChristmasTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function ChristmasTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function ChristmasTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -67,7 +67,7 @@ SoloDanceTaskCtrl._mapRedDotConfig = {}
function SoloDanceTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -86,9 +86,6 @@ function SoloDanceTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -201,6 +198,30 @@ function SoloDanceTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function SoloDanceTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -0,0 +1,169 @@
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
local lvIndexTitle = "{0}-{1}"
ActivityLevelsLvCtrl._mapNodeConfig = {
tog = {sComponentName = "UIButton"},
Select = {},
unSelect = {},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
rt_Targets = {},
btnTarget = {sComponentName = "Button", nCount = 3},
rtLockInfo = {},
imgLockMask = {},
imgDbMask = {},
imgDbMask2 = {},
imgMaskStar1 = {},
imgMaskStar2 = {},
bgCondition = {},
rtLockPreLv = {},
redH = {},
AnimSwitch = {sComponentName = "Animator"},
imgSlc = {},
goUnOpen = {}
}
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
self.isOpening = isOpen
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)
self._mapNode.goUnOpen:SetActive(false)
self._mapNode.imgDbMask:SetActive(false)
self._mapNode.imgDbMask2:SetActive(false)
self._mapNode.imgMaskStar1:SetActive(false)
self._mapNode.imgMaskStar2: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)
self._mapNode.goUnOpen:SetActive(false)
self._mapNode.imgDbMask:SetActive(false)
self._mapNode.imgDbMask2:SetActive(false)
self._mapNode.imgMaskStar1:SetActive(false)
self._mapNode.imgMaskStar2: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)
self._mapNode.goUnOpen:SetActive(false)
self._mapNode.imgDbMask:SetActive(true)
self._mapNode.imgDbMask2:SetActive(false)
self._mapNode.imgMaskStar1:SetActive(false)
self._mapNode.imgMaskStar2:SetActive(false)
local day = activityData:GetUnLockDay(nType, data.baseData.Id)
if day == 0 then
local timerCount = function()
local hour, min, sec = parent.activityLevelsData:GetUnLockHour(nType, data.baseData.Id)
if 0 < hour then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour))
elseif 0 < min then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min))
elseif 0 < sec then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", 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"), "08d3d4", 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, isOpen)
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 self.isOpening then
if isOn then
self._mapNode.imgDbMask:SetActive(false)
self._mapNode.imgDbMask2:SetActive(true)
self._mapNode.imgMaskStar1:SetActive(true)
self._mapNode.imgMaskStar2:SetActive(true)
else
self._mapNode.imgDbMask:SetActive(true)
self._mapNode.imgDbMask2:SetActive(false)
self._mapNode.imgMaskStar1:SetActive(false)
self._mapNode.imgMaskStar2:SetActive(false)
end
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)
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,835 @@
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.16862745098039217, 0.28627450980392155, 0.5019607843137255, 0.5)
local colorConditionsLock = Color(0.16862745098039217, 0.28627450980392155, 0.5019607843137255, 1)
local lvIndexTitle = "{0}-{1}"
local twelveLvGroupPadding = {
128,
499,
0,
0
}
local twelveLvGroupPaddingOpen = {
128,
818,
0,
0
}
local fourLvGroupPadding = {
450,
499,
0,
0
}
local fourLvGroupPaddingOpen = {
128,
499,
0,
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"
},
lockExploreSel = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockExplore"
},
redExplore = {},
redExploreUn = {},
iconCertExplore = {},
iconCertExploreUn = {},
togTypeAdventure = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeAdventure"
},
togTypeAdventureCtrl = {
sNodeName = "togTypeAdventure",
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
},
lockAdventure = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockAdventure"
},
lockAdventureSel = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockAdventure"
},
redAdventure = {},
redAdventureUn = {},
iconCertAdventure = {},
iconCertAdventureUn = {},
togTypeHard = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeHard"
},
togTypeHardCtrl = {
sNodeName = "togTypeHard",
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
},
lockHard = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockHard"
},
lockHardSel = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockHard"
},
redHard = {},
redHardUn = {},
iconCertHard = {},
iconCertHardUn = {},
rtToggles = {
sNodeName = "srToggle",
sComponentName = "UIScrollRect"
},
rtTogglesTmp = {
sNodeName = "rt_ToggleTmp",
sComponentName = "Transform"
},
togRoot = {
nCount = 12,
sCtrlName = "Game.UI.ActivityTheme.20103.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_Explore, {nActGroupId}, self._mapNode.redExploreUn)
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventureUn)
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHardUn)
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)
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
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)
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
self._mapNode.iconCertExplore:SetActive(true)
self._mapNode.iconCertExploreUn:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
if v.Star < 3 then
self._mapNode.iconCertExplore:SetActive(false)
self._mapNode.iconCertExploreUn:SetActive(false)
break
end
end
self._mapNode.iconCertAdventure:SetActive(true)
self._mapNode.iconCertAdventureUn:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
if v.Star < 3 then
self._mapNode.iconCertAdventure:SetActive(false)
self._mapNode.iconCertAdventureUn:SetActive(false)
break
end
end
self._mapNode.iconCertHard:SetActive(true)
self._mapNode.iconCertHardUn:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabHard) do
if v.Star < 3 then
self._mapNode.iconCertHard:SetActive(false)
self._mapNode.iconCertHardUn: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_Switch")
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_Switch")
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_Switch")
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:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD)
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.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
if not isOpenExplore then
if nType == GameEnum.ActivityLevelType.Explore then
self._mapNode.lockExplore.gameObject:SetActive(false)
self._mapNode.lockExploreSel.gameObject:SetActive(true)
else
self._mapNode.lockExplore.gameObject:SetActive(true)
self._mapNode.lockExploreSel.gameObject:SetActive(false)
end
else
self._mapNode.lockExplore.gameObject:SetActive(false)
self._mapNode.lockExploreSel.gameObject:SetActive(false)
end
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
if not isOpenAdventure then
if nType == GameEnum.ActivityLevelType.Adventure then
self._mapNode.lockAdventure.gameObject:SetActive(false)
self._mapNode.lockAdventureSel.gameObject:SetActive(true)
else
self._mapNode.lockAdventure.gameObject:SetActive(true)
self._mapNode.lockAdventureSel.gameObject:SetActive(false)
end
else
self._mapNode.lockAdventure.gameObject:SetActive(false)
self._mapNode.lockAdventureSel.gameObject:SetActive(false)
end
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
if not isOpenHard then
if nType == GameEnum.ActivityLevelType.HARD then
self._mapNode.lockHard.gameObject:SetActive(false)
self._mapNode.lockHardSel.gameObject:SetActive(true)
else
self._mapNode.lockHard.gameObject:SetActive(true)
self._mapNode.lockHardSel.gameObject:SetActive(false)
end
else
self._mapNode.lockHard.gameObject:SetActive(false)
self._mapNode.lockHardSel.gameObject:SetActive(false)
end
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 = "20103/ActivityLevels/ActivityLevelsSelect.prefab",
sCtrlName = "Game.UI.ActivityTheme.20103.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,173 @@
local ActivitySummerCheckinCtrl = class("ActivitySummerCheckinCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
ActivitySummerCheckinCtrl._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 ActivitySummerCheckinCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivitySummerCheckinCtrl:OnDisable()
self:UnbindCtrl()
end
function ActivitySummerCheckinCtrl:InitActData(actData)
self.actData = actData
self:RefreshLockState()
self:RefreshDate()
self:RefreshTimeout()
self:RefreshReward()
end
function ActivitySummerCheckinCtrl:UnInit()
self:UnbindCtrl()
end
function ActivitySummerCheckinCtrl:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivitySummerCheckinCtrl: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 ActivitySummerCheckinCtrl: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 and self.remainTimer ~= nil 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 ActivitySummerCheckinCtrl: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 ActivitySummerCheckinCtrl: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 ActivitySummerCheckinCtrl: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 ActivitySummerCheckinCtrl: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 ActivitySummerCheckinCtrl:OnBtnClick_Go()
local actGroupCfg = self.actData:GetActGroupCfgData()
if actGroupCfg ~= nil and actGroupCfg ~= nil and actGroupCfg.PanelId ~= nil and actGroupCfg.PanelId > 0 then
if actGroupCfg.TransitionId ~= nil and 0 < actGroupCfg.TransitionId then
local callback = function()
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
end
end
function ActivitySummerCheckinCtrl: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 ActivitySummerCheckinCtrl:ClearActivity()
end
return ActivitySummerCheckinCtrl
@@ -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_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "20103/SpriteAtlas/2010304", 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 = "20103/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,418 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SummerCheckinStoryCtrl = class("SummerCheckinStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
SummerCheckinStoryCtrl._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"
},
Content = {
sComponentName = "RectTransform"
},
imgCharHead = {sComponentName = "Image"},
txtCharName = {sComponentName = "TMP_Text"},
goPersonalityRoot = {
sNodeName = "grpUnderBar"
},
goPersonality = {
sNodeName = "goPersonality",
sComponentName = "GameObject"
},
txtPersonalityPercent = {
nCount = 3,
sNodeName = "txtPersonalityPercent",
sComponentName = "TMP_Text"
},
txtPersonality1 = {
sComponentName = "TMP_Text",
sLanguageId = "Personality_Instinct"
},
txtPersonality2 = {
sComponentName = "TMP_Text",
sLanguageId = "Personality_Analyze"
},
txtPersonality3 = {
sComponentName = "TMP_Text",
sLanguageId = "Personality_Chaos"
}
}
SummerCheckinStoryCtrl._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 SummerCheckinStoryCtrl: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 SummerCheckinStoryCtrl:OnEnable()
self:RefreshPanel()
self:BindBehindBGScroll()
end
function SummerCheckinStoryCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function SummerCheckinStoryCtrl:OnDisable()
self:UnbindBehindBGScroll()
end
function SummerCheckinStoryCtrl:BindBehindBGScroll()
local scrollRect = self._mapNode.svStory.gameObject:GetComponent("ScrollRect")
if scrollRect == nil then
return
end
self.scrollRectStory = scrollRect
end
function SummerCheckinStoryCtrl:UnbindBehindBGScroll()
self.scrollRectStory = nil
end
function SummerCheckinStoryCtrl:RefreshPanel()
self:RefreshStoryList()
self:RefreshPersonality()
end
function SummerCheckinStoryCtrl:RefreshPersonality()
local cfg = ConfigTable.GetData("ActivityStoryChapter", self.nActId)
local personalityId = cfg.PersonalityId
self._mapNode.goPersonalityRoot:SetActive(0 < personalityId)
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[2], math.floor(tbRetPercent[2] * 100) .. "%")
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[3], math.floor(tbRetPercent[3] * 100) .. "%")
local sIcon = "Icon/PlayerHead/" .. sHead
self:SetPngSprite(self._mapNode.imgCharHead, sIcon)
end
function SummerCheckinStoryCtrl: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 SummerCheckinStoryCtrl: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 imgStoryBg = RootNode:Find("imgStoryBg")
local imgBattleBg = RootNode:Find("imgBattleBg")
local goNotOpen = RootNode:Find("goNotOpen").gameObject
local imgNumDb = RootNode:Find("imgNumDb")
local txtLevel = RootNode:Find("imgNumDb/txtIndex"):GetComponent("TMP_Text")
local txtStoryTitle = RootNode:Find("imgStoryTitle/txtIndex"):GetComponent("TMP_Text")
local txtBattleTitle = RootNode:Find("imgBattleTitle/txtIndex"):GetComponent("TMP_Text")
local imgStoryTitleBg = RootNode:Find("imgStoryTitle")
local imgBattleTitleBg = RootNode:Find("imgBattleTitle")
local RedDot = RootNode:Find("RedDot").gameObject
local goComplete = RootNode:Find("goComplete").gameObject
local goImgTime = RootNode:Find("imgTime")
local txtTime = goImgTime:Find("txtTime"):GetComponent("TMP_Text")
local txtTitle = RootNode:Find("grpTitle/tmpGroupDone"):GetComponent("TMP_Text")
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local btnStart = RootNode:Find("btnStart").gameObject:GetComponent("UIButton")
local goLockBg = RootNode:Find("goNotOpen/goLockBg")
local goimgCheck = avgcfg.IsBattle and RootNode:Find("imgBattleTitle/imgCheck").gameObject or RootNode:Find("imgStoryTitle/imgCheck").gameObject
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
NovaAPI.SetTMPText(txtTitle, avgcfg.Title)
NovaAPI.SetTMPText(txtLevel, avgcfg.Index)
if avgcfg.IsBattle then
NovaAPI.SetTMPText(txtBattleTitle, ConfigTable.GetUIText("Story_BattleTitle"))
else
NovaAPI.SetTMPText(txtStoryTitle, ConfigTable.GetUIText("Story_StoryTitle"))
end
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)
goNotOpen.gameObject:SetActive(not bOpen or not isUnlock)
goLockBg.gameObject:SetActive(not bOpen)
imgBattleTitleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
imgStoryTitleBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
imgBattleBg.gameObject:SetActive(avgcfg.IsBattle and isUnlock and bOpen)
imgStoryBg.gameObject:SetActive(not avgcfg.IsBattle and isUnlock and bOpen)
imgNumDb.gameObject:SetActive(isUnlock and bOpen)
btnStart.gameObject:SetActive(isUnlock and bOpen)
goimgCheck:SetActive(isReaded and isUnlock and 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)
btnStart.onClick:RemoveAllListeners()
btnStart.onClick:AddListener(clickFuc)
end
function SummerCheckinStoryCtrl: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 SummerCheckinStoryCtrl: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"), "08d3d4", day)
elseif 0 < hour then
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "08d3d4", hour)
elseif 0 < min then
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "08d3d4", min)
elseif 0 < sec then
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "08d3d4", sec)
end
return timeStr, 0 < nRemainTime
end
function SummerCheckinStoryCtrl:OnBtn_ClickBack()
EventManager.Hit(EventId.ClosePanel, PanelId.SummerCheckinStory_20103)
end
function SummerCheckinStoryCtrl:OnBtn_ClickHome()
PanelManager.Home()
end
function SummerCheckinStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
end
function SummerCheckinStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
if bHasReward then
self.bCantClick = true
end
end
function SummerCheckinStoryCtrl: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 SummerCheckinStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
end
end
function SummerCheckinStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
end
return SummerCheckinStoryCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerCheckinStoryPanel = class("SummerCheckinStoryPanel", BasePanel)
SummerCheckinStoryPanel._sUIResRootPath = "UI_Activity/"
SummerCheckinStoryPanel._tbDefine = {
{
sPrefabPath = "20103/Story/SummerCheckinStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.20103.Story.SummerCheckinStoryCtrl"
}
}
function SummerCheckinStoryPanel:Awake()
end
function SummerCheckinStoryPanel:OnEnable()
end
function SummerCheckinStoryPanel:OnDisable()
end
function SummerCheckinStoryPanel:OnDestroy()
end
function SummerCheckinStoryPanel:OnRelease()
end
return SummerCheckinStoryPanel
@@ -0,0 +1,755 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local SummerCheckinThemeCtrl = class("SummerCheckinThemeCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
SummerCheckinThemeCtrl._mapNodeConfig = {
goBg = {sNodeName = "---Bg---"},
btnEntrance_ = {
nCount = 7,
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 = "IceCreamTruck_PlayTitle"
},
imgMiniGameEnd = {},
txtMiniGameEnd = {
sComponentName = "TMP_Text",
sLanguageId = "IceCreamTruck_PlayTitle"
},
txtMiniGame_End = {},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "Cookie_Act_QuestTitle"
},
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 = "JointDrill_Btn_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 = "Cookie_Act_QuestTitle"
},
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 = "JointDrill_Btn_Shop"
},
imgShopEnd = {},
txtShop_End = {},
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
txtShow = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_ChallengeTitle"
},
imgShowEnd = {},
imgShowActivityTime = {},
txtShowActivityTime = {sComponentName = "TMP_Text"},
goShowEnd = {},
txtShowEnd = {
sNodeName = "txtShow_End",
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_ChallengeTitle"
},
imgShowActivityUnlockTime = {},
txtShowActivityUnlockTime = {sComponentName = "TMP_Text"},
imgShowLock = {},
txtLock = {sComponentName = "TMP_Text"},
imgFateCard = {sComponentName = "Image"},
txtFateCard = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Fate_Card_20102"
},
imgFateCardEnd = {},
txtFateCardEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Fate_Card_20102"
},
txtFateCard_End = {},
goFateCardEnd = {},
txtFateCardEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgFateCardActivityUnlockTime = {},
txtFateCardActivityUnlockTime = {sComponentName = "TMP_Text"},
imgFateCardActivityTime = {},
txtFateCardActivityTime = {sComponentName = "TMP_Text"},
reddotShow = {},
dbTaskEnd = {},
dbFateCardEnd = {},
miniGameRedDot = {},
redDotEntrance2 = {},
storyRedDot = {},
reddotLevel = {},
reddotFatecard = {},
goMiniGameEnd = {},
imgStoryEnd = {}
}
SummerCheckinThemeCtrl._mapEventConfig = {}
local ActivityState = {
NotOpen = 1,
Open = 2,
Closed = 3
}
function SummerCheckinThemeCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.SummerCheckinData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
if self.SummerCheckinData ~= nil then
self.ActivityGroupCfg = self.SummerCheckinData.actGroupConfig
end
self.tbBtnAnimator = {}
end
function SummerCheckinThemeCtrl:OnEnable()
if #self.tbBtnAnimator == 0 then
for k, v in pairs(self._mapNode.btnEntrance_) do
local anim = v.transform:GetChild(0):GetComponent("Animator")
if anim ~= nil and anim:IsNull() == false then
table.insert(self.tbBtnAnimator, anim)
anim.enabled = false
end
end
end
self:RefreshPanel()
self:RegisterReddot()
local sAnimName = "SummerCheckinPanel_Pullback"
local sSoundName = "mode_20103_activity"
if self.animRoot ~= nil then
self.animRoot = self.gameObject:GetComponent("Animator")
sAnimName = "SummerCheckinPanel_Full"
sSoundName = "mode_20103_activity_1"
end
self.animRoot = self.gameObject:GetComponent("Animator")
self.animRoot.enabled = true
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
self.animRoot:Play(sAnimName, 0, 0)
CS.WwiseAudioManager.Instance:PlaySound(sSoundName)
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
self:AddTimer(1, nAnimLength, function()
self.animRoot.enabled = false
for k, v in pairs(self.tbBtnAnimator) do
v.enabled = true
v:Play("btnEntrance_idle")
end
end, true, true, true)
end
function SummerCheckinThemeCtrl: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.showRemainTimer then
TimerManager.Remove(self.showRemainTimer)
self.showRemainTimer = nil
end
for i = 1, #self.tbBtnAnimator do
self.tbBtnAnimator[i] = nil
end
end
function SummerCheckinThemeCtrl:RegisterReddot()
for i = 1, 7 do
local actData = self.SummerCheckinData:GetActivityDataByIndex(i)
local nActId = actData ~= nil and actData.ActivityId or 0
local state = self.tbActState[nActId]
if nActId ~= nil and 0 < nActId and state ~= nil then
if i == AllEnum.ActivityThemeFuncIndex.Task then
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
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
self.nActId,
nActId
}, self._mapNode.reddotLevel)
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
self.nActId,
nActId
}, self._mapNode.storyRedDot)
elseif i == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
local activityData = ConfigTable.GetData("Activity", actData.ActivityId)
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
if nNeedWorldLevel > PlayerData.Base:GetWorldClass() then
self._mapNode.reddotShow:SetActive(false)
end
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersus, {
self.nActId,
nActId
}, self._mapNode.reddotShow)
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_PenguinCard_Level, {
self.nActId
}, self._mapNode.reddotFatecard)
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
local nActId = actData.ActivityId
RedDotManager.RegisterNode(RedDotDefine.Activity_IceCreamTruck_New, {nActId}, self._mapNode.miniGameRedDot)
end
end
end
end
function SummerCheckinThemeCtrl:RefreshPanel()
if self.SummerCheckinData == nil or self.ActivityGroupCfg == nil then
return
end
self:RefreshTime()
self:RefreshButtonState()
end
function SummerCheckinThemeCtrl:RefreshTime()
local bOpen = self.SummerCheckinData:CheckActivityGroupOpen()
if bOpen then
self:RefreshRemainTime(self.SummerCheckinData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, function()
local remainTime = self:RefreshRemainTime(self.SummerCheckinData: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.SummerCheckinData: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 SummerCheckinThemeCtrl:RefreshRemainTime(endTime, txtComp)
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
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(txtComp, sTimeStr)
return remainTime
end
function SummerCheckinThemeCtrl: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 SummerCheckinThemeCtrl:RefreshButtonState()
self.tbActState = {}
for i = 1, 7 do
local actData = self.SummerCheckinData: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)
elseif i == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
self:RefreshOtherButtonState(actData)
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
self:RefreshFateCardButtonState(actData)
end
end
end
function SummerCheckinThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
local countDowmTimer
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
local sEndTime = activityData.EndTime
if activityData ~= nil and (activityData.ActivityType == GameEnum.activityType.Story or activityData.ActivityType == GameEnum.activityType.HistoryStory) and activityData.MidGroupId ~= nil and activityData.MidGroupId > 0 then
local activityGroupData = ConfigTable.GetData("ActivityGroup", activityData.MidGroupId)
if activityGroupData ~= nil and activityGroupData.StoryShowTime ~= nil and activityGroupData.StoryShowTime ~= "" then
sEndTime = activityGroupData.StoryShowTime
end
end
local state = ActivityState.NotOpen
local bShowCountDown = false
if activityData ~= nil then
local curTime = ClientManager.serverTimeStamp
if activityData.StartTime ~= "" and sEndTime ~= "" then
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(sEndTime)
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 sEndTime ~= "" 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 sEndTime ~= "" then
do
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(sEndTime)
if endTime > self.SummerCheckinData:GetActGroupEndTime() then
bShowCountDown = true
elseif endTime < self.SummerCheckinData:GetActGroupEndTime() then
bShowCountDown = endTime - curTime <= 259200
elseif sEndTime ~= activityData.EndTime and sEndTime ~= "" then
bShowCountDown = true
end
if timer == nil and bShowCountDown then
self:RefreshRemainTime(endTime, txtTrans)
do
local fcTimer = function()
local remainTime = self: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 SummerCheckinThemeCtrl: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 SummerCheckinThemeCtrl: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.imgTaskEnd.gameObject: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 SummerCheckinThemeCtrl: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.imgStoryActivityTime, 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 SummerCheckinThemeCtrl: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)
self.tbActState[activityId] = state
end
end
function SummerCheckinThemeCtrl: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 SummerCheckinThemeCtrl:RefreshOtherButtonState(actData)
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
if activityData ~= nil then
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
local bNeedLv = nNeedWorldLevel <= PlayerData.Base:GetWorldClass()
local refreshFunc = function(actData)
self:RefreshOtherButtonState(actData)
end
local state, bShowCountDown, countDowmTimer
if bNeedLv then
state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.showRemainTimer, self._mapNode.txtShowActivityTime, self._mapNode.imgShowActivityUnlockTime, refreshFunc)
if self.showRemainTimer == nil then
self.showRemainTimer = countDowmTimer
end
else
state = ActivityState.NotOpen
end
self._mapNode.imgShowActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
self._mapNode.imgShowActivityUnlockTime:SetActive(state == ActivityState.NotOpen and bNeedLv)
self._mapNode.imgShowEnd:SetActive(state == ActivityState.Closed or not bNeedLv)
self._mapNode.txtShow.gameObject:SetActive(state ~= ActivityState.Closed and bNeedLv)
self._mapNode.txtShowEnd.gameObject:SetActive(state == ActivityState.Closed or not bNeedLv)
self._mapNode.goShowEnd:SetActive(state == ActivityState.Closed)
self._mapNode.imgShowLock:SetActive(state == ActivityState.NotOpen and not bNeedLv)
local txtLock = orderedFormat(ConfigTable.GetUIText("ActivityEnter_Lock"), nNeedWorldLevel)
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
self.tbActState[activityId] = state
end
end
function SummerCheckinThemeCtrl:RefreshFateCardButtonState(actData)
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
if activityData ~= nil then
local refreshFunc = function(actData)
self:RefreshFateCardButtonState(actData)
end
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.fateCardRemainTimer, self._mapNode.txtFateCardActivityTime, self._mapNode.imgFateCardActivityUnlockTime, refreshFunc)
if self.fateCardRemainTimer == nil then
self.fateCardRemainTimer = countDowmTimer
end
self._mapNode.imgFateCardActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
self._mapNode.imgFateCardActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
self._mapNode.imgFateCardEnd:SetActive(state == ActivityState.Closed)
self._mapNode.txtFateCard_End:SetActive(state == ActivityState.Closed)
self._mapNode.txtFateCardEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.goFateCardEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.dbFateCardEnd:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
end
end
function SummerCheckinThemeCtrl: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 SummerCheckinThemeCtrl:RefreshActivityData()
if self.bRequiredActData then
return
end
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
end
function SummerCheckinThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
local actData = self.SummerCheckinData: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
if nIndex == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
local activityData = ConfigTable.GetData("Activity", actData.ActivityId)
if activityData ~= nil then
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
local bNeedLv = nNeedWorldLevel <= PlayerData.Base:GetWorldClass()
if not bNeedLv then
local txtLock = orderedFormat(ConfigTable.GetUIText("ActivityEnter_Lock"), nNeedWorldLevel)
EventManager.Hit(EventId.OpenMessageBox, txtLock)
return
end
end
end
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
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
LocalData.SetPlayerLocalData("Activity_MiniGame_20103_New", true)
RedDotManager.SetValid(RedDotDefine.Activity_GroupNew_MiniGame, {
actData.ActivityId
}, false)
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
else
local nTransitionIdx = self.ActivityGroupCfg.TransitionId
if (nTransitionIdx == nil or nTransitionIdx == 0) and nIndex == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
nTransitionIdx = 30
end
if nTransitionIdx ~= nil and 0 < nTransitionIdx 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
end
return SummerCheckinThemeCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerCheckinThemePanel = class("SummerCheckinThemePanel", BasePanel)
SummerCheckinThemePanel._sUIResRootPath = "UI_Activity/"
SummerCheckinThemePanel._tbDefine = {
{
sPrefabPath = "20103/SummerCheckinPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.20103.SummerCheckinThemeCtrl"
}
}
function SummerCheckinThemePanel:Awake()
end
function SummerCheckinThemePanel:OnEnable()
end
function SummerCheckinThemePanel:OnDisable()
end
function SummerCheckinThemePanel:OnDestroy()
end
function SummerCheckinThemePanel:OnRelease()
end
return SummerCheckinThemePanel
@@ -0,0 +1,409 @@
local SummerCheckinTaskCtrl = class("SummerCheckinTaskCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local PlayerActivityData = PlayerData.Activity
local TabType = GameEnum.ActivityTaskTabType
local ItemType = GameEnum.itemType
local tbTabNameUITextId = {
[TabType.Tab1] = "Quest_Normal",
[TabType.Tab2] = "Quest_Story",
[TabType.Tab3] = "Quest_Challenge",
[TabType.Tab4] = "Quest_Play",
[TabType.Tab5] = "Quest_Active"
}
SummerCheckinTaskCtrl._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"
}
}
SummerCheckinTaskCtrl._mapEventConfig = {
onClick_RewardItem = "onEvent_ClickRewardItem",
onClick_TaskDone = "onEvent_ClickTaskDone",
onClick_TaskJump = "onEvent_ClickTaskJump"
}
SummerCheckinTaskCtrl._mapRedDotConfig = {}
function SummerCheckinTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2]
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 SummerCheckinTaskCtrl:BuildData(nActivityId)
if self.tbData == nil then
self.tbData = {}
end
if self.tbGroupId == nil then
self.tbGroupId = {}
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
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function SummerCheckinTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
end
function SummerCheckinTaskCtrl: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
self:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
local goRedDot_on = tr:Find("scale_on_click/imgDb_on/redDotTab_on")
local goRedDot_off = tr:Find("scale_on_click/imgDb_off/redDotTab_off")
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local tbRedDot = {goRedDot_on, goRedDot_off}
if bInActGroup == false then
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
mapData.nGroupId
}, tbRedDot, nil, nil, true)
else
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
mapData.nGroupId
}, tbRedDot, nil, nil, true)
end
end
function SummerCheckinTaskCtrl:onGridBtnClick_Tab(go)
local nIndex = tonumber(go.name) + 1
if self.nCurGroupIndex ~= nIndex then
local tr = go.transform.parent:GetChild(self.nCurGroupIndex - 1)
self:PlayClickAnimatorOff(tr)
self.nCurGroupIndex = nIndex
self:refresh_Tab()
self:refresh_Task(true)
self:refresh_Group()
end
end
function SummerCheckinTaskCtrl:PlayClickAnimatorOff(tr)
local tabAnimator = tr:Find("scale_on_click"):GetComponent("Animator")
tabAnimator:Play("TaskClick_off")
end
function SummerCheckinTaskCtrl:PlayClickAnimatorOn(tr)
local tabAnimator = tr:Find("scale_on_click"):GetComponent("Animator")
tabAnimator:Play("TaskClick_on")
end
function SummerCheckinTaskCtrl:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
if self.nCurGroupIndex == nIndex then
self:PlayClickAnimatorOn(tr)
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabName_on"):GetComponent("TMP_Text"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabProgress_on"):GetComponent("TMP_Text"), sProgress)
else
self:PlayClickAnimatorOff(tr)
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabName_off"):GetComponent("TMP_Text"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabProgress_off"):GetComponent("TMP_Text"), sProgress)
end
end
function SummerCheckinTaskCtrl: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 SummerCheckinTaskCtrl: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
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 imgProgressBar = tr:Find("imgProgessBar"):GetComponent("Image")
NovaAPI.SetImageFillAmount(imgProgressBar, 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)))
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 = 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 SummerCheckinTaskCtrl: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 SummerCheckinTaskCtrl: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 SummerCheckinTaskCtrl:onEvent_ClickTaskJump(goBtn)
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
if 0 < nJumpId then
JumpUtil.JumpTo(nJumpId)
end
end
function SummerCheckinTaskCtrl: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, ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
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 SummerCheckinTaskCtrl: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.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 SummerCheckinTaskCtrl:onGridBtnClick_GroupRewardItem(go)
local nIndex = tonumber(go.transform.parent.name) + 1
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
end
function SummerCheckinTaskCtrl:onBtn_GroupDone()
local mapData = self.tbData[self.nCurGroupIndex]
local cb = function()
self.ins_ActivityTaskData:RefreshTaskRedDot()
self:BuildData(self.nActivityId)
self:refresh_Tab()
self:refresh_Task(true)
self:refresh_Group()
end
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
end
return SummerCheckinTaskCtrl
@@ -0,0 +1,9 @@
local SoloDanceTaskPanel = class("SummerCheckinTaskPanel", BasePanel)
SoloDanceTaskPanel._sUIResRootPath = "UI_Activity/"
SoloDanceTaskPanel._tbDefine = {
{
sPrefabPath = "20103/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.20103.Task.SummerCheckinTaskCtrl"
}
}
return SoloDanceTaskPanel
@@ -49,7 +49,7 @@ BreakOutTaskCtrl._mapRedDotConfig = {}
function BreakOutTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -64,9 +64,6 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -179,6 +176,30 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function BreakOutTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -49,7 +49,7 @@ BreakOutTaskCtrl._mapRedDotConfig = {}
function BreakOutTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -64,9 +64,6 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -179,6 +176,30 @@ function BreakOutTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function BreakOutTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -0,0 +1,186 @@
local ActivityBreakOutCtrl = class("ActivityBreakOutCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
ActivityBreakOutCtrl._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"},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtBtnDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
imgEnd = {},
txtActivityEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgRemaineTime = {},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "GoToChallenge"
},
imgProgressBg = {
sNodeName = "imgProgressBg"
},
imgFill = {sNodeName = "imgFill"},
txt_Target = {
sNodeName = "txt_Target",
sComponentName = "TMP_Text",
sLanguageId = "ChallengingGoals"
},
txtProgress = {
sNodeName = "txtProgress",
sComponentName = "TMP_Text"
},
btn_goTaskPanel = {
sComponentName = "UIButton",
callback = "OnBtnClick_GoTaskPanel"
}
}
function ActivityBreakOutCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivityBreakOutCtrl:OnDisable()
self:UnbindCtrl()
end
function ActivityBreakOutCtrl:InitActData(actData)
self.actData = actData
self:RefreshLockState()
self:RefreshDate()
self:RefreshTimeout()
self:RefreshReward()
end
function ActivityBreakOutCtrl:UnInit()
self:UnbindCtrl()
end
function ActivityBreakOutCtrl:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivityBreakOutCtrl: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 ActivityBreakOutCtrl: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 ActivityBreakOutCtrl: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 ActivityBreakOutCtrl: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 ActivityBreakOutCtrl: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 ActivityBreakOutCtrl: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 ActivityBreakOutCtrl:OnBtnClick_Go()
local actGroupCfg = self.actData:GetActGroupCfgData()
if actGroupCfg ~= nil then
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutThemePanel_S2, actGroupCfg.Id)
end
end
function ActivityBreakOutCtrl:OnBtnClick_GoTaskPanel()
EventManager.Hit(EventId.OpenPanel, PanelId.Task_30102, self.nActTaskId)
end
function ActivityBreakOutCtrl: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 ActivityBreakOutCtrl:ClearActivity()
end
return ActivityBreakOutCtrl
@@ -0,0 +1,405 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local BreakOutThemeCtrl = class("BreakOutThemeCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
BreakOutThemeCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
BreakOutLevelSelectPanel = {
sNodeName = "----BreakOutLevelSelect----",
sCtrlName = "Game.UI.Play_BreakOut_30101.LevelSelectCtrl"
},
imgProgressBg = {
sNodeName = "imgProgressBg"
},
txt_Target = {
sNodeName = "txt_Target",
sComponentName = "TMP_Text",
sLanguageId = "ChallengingGoals"
},
imgFill = {sNodeName = "imgFill"},
txtProgress = {
sNodeName = "txtProgress",
sComponentName = "TMP_Text"
},
TaskActivityTime = {},
txtTaskActivityTime = {
sNodeName = "txtTaskActivityTime",
sComponentName = "TMP_Text"
},
TaskMask = {},
txt_TaskEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
ShopActivityTime = {},
txt_Shop = {
sComponentName = "TMP_Text",
sLanguageId = "ExchangeShop"
},
txtShopActivityTime = {
sNodeName = "txtShopActivityTime",
sComponentName = "TMP_Text"
},
btnEntrance_ = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtn_ClickActivityEntrance"
},
redDotEntrance2 = {}
}
BreakOutThemeCtrl._mapEventConfig = {
JumpToLevelDetail = "JumpTo_LevelDetail",
SetAnimatorState = "SetAnimatorState"
}
BreakOutThemeCtrl._mapRedDotConfig = {}
local ActivityState = {
NotOpen = 1,
Open = 2,
Closed = 3
}
function BreakOutThemeCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.BreakOut_30101Data = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
if self.BreakOut_30101Data == nil then
printError("活动组 id:" .. self.nActId .. " 数据为空")
return
else
self.ActivityGroupCfg = self.BreakOut_30101Data.actGroupConfig
end
self.isLevelEnd = false
end
function BreakOutThemeCtrl:OnEnable()
self.BreakOutTheme_Animator = self.gameObject:GetComponent("Animator")
if self.BreakOut_30101Data == nil then
printError("活动组 id:" .. self.nActId .. " 数据为空")
return
end
self:RefreshPanel()
for i = 1, 5 do
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
if actData ~= nil and i == AllEnum.ActivityThemeFuncIndex.Task then
local nActId = actData.ActivityId
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
self.nActId,
nActId
}, self._mapNode.redDotEntrance2)
end
end
self:SetAnimatorState()
end
function BreakOutThemeCtrl:OnDisable()
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.avgRemainTimer then
TimerManager.Remove(self.avgRemainTimer)
self.avgRemainTimer = nil
end
if nil ~= self.taskRemainTimer then
TimerManager.Remove(self.taskRemainTimer)
self.taskRemainTimer = nil
end
end
function BreakOutThemeCtrl:RefreshPanel()
if self.BreakOut_30101Data == nil or self.ActivityGroupCfg == nil then
return
end
self:RefreshTime()
self:RefreshButtonState()
end
function BreakOutThemeCtrl:RefreshTime()
local bOpen = self.BreakOut_30101Data:CheckActivityGroupOpen()
if bOpen then
self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, function()
local remainTime = self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if remainTime <= 0 then
TimerManager.Remove(self.remainTimer)
self.remainTimer = nil
end
end, true, true, false)
end
end
end
function BreakOutThemeCtrl:RefreshRemainTime(endTime, txtComp)
local curTime = ClientManager.serverTimeStamp
local remainTime = endTime - curTime
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(txtComp, sTimeStr)
return remainTime
end
function BreakOutThemeCtrl: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 BreakOutThemeCtrl:RefreshButtonState()
self.tbActState = {}
for i = 1, 5 do
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
if actData ~= nil then
if i == AllEnum.ActivityThemeFuncIndex.Task then
self:RefreshTaskButtonState(actData)
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
self:RefreshShopButtonState(actData)
end
end
end
end
function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
local countDownTimer
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 imgTrans == nil then
return
end
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(timer)
countDownTimer = nil
self.tbActState[activityId] = ActivityState.Open
refreshFunc(actData)
self:RefreshActivityData()
end
end
fcTimer()
countDownTimer = 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.BreakOut_30101Data:GetActGroupEndTime() then
bShowCountDown = true
elseif endTime < self.BreakOut_30101Data:GetActGroupEndTime() then
bShowCountDown = endTime - curTime <= 259200
end
if timer == nil and bShowCountDown then
self:RefreshRemainTime(endTime, txtTrans)
do
local fcTimer = function()
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
if remainTime <= 0 then
TimerManager.Remove(timer)
countDownTimer = nil
refreshFunc(actData)
end
end
fcTimer()
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
end
end
end
end
end
return state, bShowCountDown, countDownTimer
end
function BreakOutThemeCtrl: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, countDownTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, nil, refreshFunc)
if self.taskRemainTimer == nil then
self.taskRemainTimer = countDownTimer
end
if state == ActivityState.Closed and actInsData ~= nil then
actInsData:RefreshTaskRedDot()
end
self._mapNode.TaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
self._mapNode.TaskMask:SetActive(state == ActivityState.Closed)
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)
local rt = self._mapNode.imgProgressBg:GetComponent("RectTransform")
local nWidth = 0 < nTotal and nDone / nTotal * rt.rect.width or 0
self._mapNode.imgFill:GetComponent("RectTransform").sizeDelta = Vector2(nWidth, rt.rect.height)
NovaAPI.SetTMPText(self._mapNode.txtProgress, progress)
end
end
function BreakOutThemeCtrl: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, countDownTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, nil, refreshFunc)
if self.shopRemainTimer == nil then
self.shopRemainTimer = countDownTimer
end
self._mapNode.ShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
self.tbActState[activityId] = state
end
end
function BreakOutThemeCtrl:RequireActivityData()
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 BreakOutThemeCtrl:RefreshActivityData()
if self.bRequiredActData then
return
end
self:AddTimer(1, 3, self.RequireActivityData, true, true, true)
end
function BreakOutThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
local actData
if nIndex == 1 then
nIndex = AllEnum.ActivityThemeFuncIndex.Shop
actData = self.BreakOut_30101Data:GetActivityDataByIndex(nIndex)
elseif nIndex == 2 then
nIndex = AllEnum.ActivityThemeFuncIndex.Task
actData = self.BreakOut_30101Data:GetActivityDataByIndex(nIndex)
end
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 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:RequireActivityData()
return
end
end
end
if actData.PanelId ~= nil and ActivityState.Open == state then
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
end
end
function BreakOutThemeCtrl:JumpTo_LevelDetail(nActId, nLevelId)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutLevelDetailPanelS2, nActId, nLevelId)
end
EventManager.Hit(EventId.SetTransition, 3, OpenPanel)
end
function BreakOutThemeCtrl:SetAnimatorState()
self.BreakOutTheme_Animator:Play("BreakOutThemePanel_idle", 0, 0)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForSeconds(0.02))
self.BreakOutTheme_Animator:Play("BreakOutThemePanel_in", 0, 0)
end
cs_coroutine.start(wait)
end
return BreakOutThemeCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local BreakOutThemePanel = class("BreakOutThemePanel", BasePanel)
BreakOutThemePanel._sUIResRootPath = "UI_Activity/"
BreakOutThemePanel._tbDefine = {
{
sPrefabPath = "30103/BreakOutThemePanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.30103.BreakOutThemeCtrl"
}
}
function BreakOutThemePanel:Awake()
end
function BreakOutThemePanel:OnEnable()
end
function BreakOutThemePanel:OnDisable()
end
function BreakOutThemePanel:OnDestroy()
end
function BreakOutThemePanel:OnRelease()
end
return BreakOutThemePanel
@@ -0,0 +1,125 @@
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"},
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)
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
else
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
self._mapNode.imgElement.gameObject:SetActive(false)
end
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
local sPath = "db_arkanoid_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "30103/SpriteAtlas/3010303", 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 = "30103/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,345 @@
local BreakOutTaskCtrl = class("BreakOutTaskCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local PlayerActivityData = PlayerData.Activity
local TabType = GameEnum.ActivityTaskTabType
local ItemType = GameEnum.itemType
BreakOutTaskCtrl._mapNodeConfig = {
TopBarPanel = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
svList_Tab = {
sComponentName = "LoopScrollView"
},
svList_Task = {
sComponentName = "LoopScrollView"
},
svList_GroupReward = {
sComponentName = "LoopScrollView"
},
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"
}
}
BreakOutTaskCtrl._mapEventConfig = {
onClick_RewardItem = "onEvent_ClickRewardItem",
onClick_TaskDone = "onEvent_ClickTaskDone",
onClick_TaskJump = "onEvent_ClickTaskJump"
}
BreakOutTaskCtrl._mapRedDotConfig = {}
function BreakOutTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
self:BuildData(self.nActivityId)
self:refresh_Tab()
self:refresh_Task()
end
function BreakOutTaskCtrl:BuildData(nActivityId)
if self.tbData == nil then
self.tbData = {}
end
if self.tbGroupId == nil then
self.tbGroupId = {}
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
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function BreakOutTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
end
function BreakOutTaskCtrl: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 canvasGroupOn = tr:Find("scale_on_click/imgDb_on"):GetComponent("CanvasGroup")
local canvasGroupOff = tr:Find("scale_on_click/imgDb_off"):GetComponent("CanvasGroup")
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 BreakOutTaskCtrl: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)
end
end
function BreakOutTaskCtrl: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 BreakOutTaskCtrl: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 BreakOutTaskCtrl: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
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, tr:Find("imgProgessBar"):GetComponent("RectTransform").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)))
local nCount = #mapTask.tbTaskRewardId
for i = 1, 2 do
local _tr = tr:Find("TaskRewards/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("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 = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
local nNum = mapTask.tbTaskRewardNum[i]
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:GetChild(0).name = tostring(nId)
_tr:Find("scale_on_click/goTimeLimit").localScale = 0 < mapCfgData_Item.ExpireType and Vector3.one or Vector3.zero
else
_tr.localScale = Vector3.zero
_tr.gameObject:SetActive(false)
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 BreakOutTaskCtrl: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 BreakOutTaskCtrl: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)
end
local mapData = self.tbData[self.nCurGroupIndex]
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
end
end
function BreakOutTaskCtrl:onEvent_ClickTaskJump(goBtn)
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
if 0 < nJumpId then
JumpUtil.JumpTo(nJumpId)
end
end
return BreakOutTaskCtrl
@@ -0,0 +1,9 @@
local BreakOutTaskPanel = class("BreakOutTaskPanel", BasePanel)
BreakOutTaskPanel._sUIResRootPath = "UI_Activity/"
BreakOutTaskPanel._tbDefine = {
{
sPrefabPath = "30103/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.30103.Task.BreakOutTaskCtrl"
}
}
return BreakOutTaskPanel
@@ -67,7 +67,7 @@ SwimTaskCtrl._mapRedDotConfig = {}
function SwimTaskCtrl:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
@@ -83,9 +83,6 @@ function SwimTaskCtrl:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function SwimTaskCtrl:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function SwimTaskCtrl:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
@@ -61,7 +61,7 @@ TaskCommonCtrl_01._mapRedDotConfig = {}
function TaskCommonCtrl_01:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2] or 1
self.nCurGroupIndex = tbParam[2]
self.imgDbType = tbParam[3] or tbImgDbType.SizeDelta
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
@@ -83,9 +83,6 @@ function TaskCommonCtrl_01:BuildData(nActivityId)
if self.tbGroupId == nil then
self.tbGroupId = {}
end
if self.nCurGroupIndex == nil then
self.nCurGroupIndex = 1
end
if type(nActivityId) ~= "number" then
return
end
@@ -198,6 +195,30 @@ function TaskCommonCtrl_01:BuildData(nActivityId)
mapData.tbTaskId[ii] = vv.nTaskId
end
end
if self.nCurGroupIndex == nil then
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
local nFirstReddot = 1
for i, v in ipairs(self.tbData) do
local bRed = false
if bInActGroup == false then
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
self.nActivityId,
v.nGroupId
})
else
bRed = RedDotManager.GetValid(RedDotDefine.Activity_Group_Task_Group, {
nActGroupId,
self.nActivityId,
v.nGroupId
})
end
if bRed then
nFirstReddot = i
break
end
end
self.nCurGroupIndex = nFirstReddot
end
end
function TaskCommonCtrl_01:refresh_Tab()
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
+5 -5
View File
@@ -10,7 +10,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_134",
"avg1_134_BB_002",
"002",
"我、我们得赶紧去接师父……",
0,
@@ -70,7 +70,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_134",
"avg1_134_BB_002",
"002",
"唔,既然师父是这么交代的……==RT==我明白了。",
0,
@@ -108,7 +108,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_134",
"avg1_134_BB_002",
"002",
"有些像寄生之庭……==RT==不过它好像不会散发有毒的雾气……",
0,
@@ -161,7 +161,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_134",
"avg1_134_BB_002",
"002",
"是幸运绿洲号吗?",
0,
@@ -191,7 +191,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_134",
"avg1_134_BB_002",
"002",
"师父,对不起……==RT==我们一定会回来接您的!",
0,
+6 -6
View File
@@ -40,7 +40,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"若能为主公分忧,妾身自当全力以赴。",
0,
@@ -93,7 +93,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"虽不知各位来历。",
0,
@@ -108,7 +108,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"但若敢对主公兵刃相向,妾身绝不留情。",
0,
@@ -123,7 +123,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"凡是阻碍主公前路的障碍……千都世,必将其一刀两断。",
0,
@@ -176,7 +176,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"攻击后马上拉开距离……是想以此拖延时间吗?",
0,
@@ -236,7 +236,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"主公,请再稍待片刻……妾身这便赶去您身边。",
0,
+6 -6
View File
@@ -10,7 +10,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"主公,恳请您暂退至妾身身后。接下来的路,由妾身为您斩开。",
0,
@@ -25,7 +25,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"比起直接攻击星骸,理应先肃清她的仆从们。",
0,
@@ -40,7 +40,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"那些躁动不安的书本,似乎正是星骸力量的源泉。",
0,
@@ -63,7 +63,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"迷途的星骸啊……你终于愿意直面那盈满的执念,睁开紧闭的双眼了吗?",
0,
@@ -78,7 +78,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"此处不可久留,回到你本该归去之处吧。",
0,
@@ -101,7 +101,7 @@ return {
{
cmd = "SetBubble",
param = {
"avg1_144",
"avg1_144_BB_002",
"002",
"苦难已至终焉,愿你……在彼岸寻得安息。",
0,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+131
View File
@@ -0,0 +1,131 @@
return {
{
cmd = "SetGroupId",
param = {"16001"}
},
{
cmd = "SetCharL2D",
param = {
"avg1_160",
3,
"none",
"",
0
}
},
{
cmd = "SetCharL2D",
param = {
"avg1_160",
0,
"avg_emoji_question",
"",
0
}
},
{
cmd = "SetCharL2D",
param = {
"avg1_160",
0,
"none",
"chat_a",
0
}
},
{
cmd = "SetTalk",
param = {
0,
"avg1_160",
"回来的时候路过海滩,发现安全员好像还没到岗。",
0,
"",
false,
""
}
},
{
cmd = "SetTalk",
param = {
0,
"avg1_160",
"要不还通知一下当地负责人好了。",
0,
"",
false,
""
}
},
{
cmd = "SetGroupId",
param = {"16002"}
},
{
cmd = "SetCharL2D",
param = {
"avg1_160",
3,
"none",
"",
0
}
},
{
cmd = "SetCharL2D",
param = {
"avg1_160",
0,
"avg_emoji_happy",
"",
0
}
},
{
cmd = "SetCharL2D",
param = {
"avg1_160",
0,
"none",
"presents_a",
0
}
},
{
cmd = "SetTalk",
param = {
0,
"avg1_160",
"嗯?觉得我看上去很开心?",
0,
"",
false,
""
}
},
{
cmd = "SetTalk",
param = {
0,
"avg1_160",
"哈哈,因为路上遇到了以前帮助过的旅人,大家现在都过得很好呢。",
0,
"",
false,
""
}
},
{
cmd = "SetTalk",
param = {
0,
"avg1_160",
"看来我们协会之家的工作还是很有意义的!",
0,
"",
false,
""
}
},
{cmd = "End"}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3244,7 +3244,7 @@ return {
param = {
1,
"avg3_100",
"刚才那通话是伊格娜打来的?她说了什么?",
"刚才那通话是伊格娜打来的?她说了什么?",
0,
"",
false,
+1 -1
View File
@@ -1840,7 +1840,7 @@ return {
param = {
2,
"avg3_100",
"竟然都这个时间了?!==W==有好几个鸢尾的未接来电,我们睡得也太死了吧……",
"竟然都这个时间了?!==W==有好几个鸢尾的未接通话,我们睡得也太死了吧……",
0,
"",
false,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4722,7 +4722,7 @@ return {
param = {
0,
"avg1_110",
"太好了,魔<r=BOSS></r>王。你终于接话了。我担心你是不是也出事了。",
"太好了,魔<r=BOSS></r>王。你终于接起通话了。我担心你是不是也出事了。",
0,
"",
false,
+181 -13
View File
@@ -317,7 +317,7 @@ return {
},
{
id = "avg1_160",
name = "***",
name = "薇洛",
name_bg_color = "#b0e0f6",
ver = "1.13.0"
},
@@ -348,6 +348,36 @@ return {
name = "树树鼠·掷弹兵",
name_bg_color = "#0ABEC5"
},
{
id = "avg2_938",
name = "***",
name_bg_color = "#0ABEC5",
ver = "1.14.0"
},
{
id = "avg2_939",
name = "***",
name_bg_color = "#0ABEC5",
ver = "1.14.0"
},
{
id = "avg2_940",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg2_941",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg2_942",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg2_943",
name = "禁断丽容",
@@ -362,7 +392,7 @@ return {
},
{
id = "avg2_945",
name = "***",
name = "寄居蟹",
name_bg_color = "#0ABEC5",
ver = "1.13.0"
},
@@ -374,13 +404,13 @@ return {
},
{
id = "avg2_947",
name = "***",
name = "黎明近卫士兵女",
name_bg_color = "#0ABEC5",
ver = "1.13.0"
},
{
id = "avg2_948",
name = "***",
name = "黎明近卫士兵男",
name_bg_color = "#0ABEC5",
ver = "1.13.0"
},
@@ -1168,6 +1198,90 @@ return {
name_bg_color = "#a5cdc3",
ver = "1.15.0"
},
{
id = "avg3_224",
name = "***",
name_bg_color = "#0ABEC5",
ver = "1.15.0"
},
{
id = "avg3_225",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg3_226",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg3_227",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg3_228",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg3_229",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.0.0"
},
{
id = "avg3_230",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.1.0"
},
{
id = "avg3_231",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.1.0"
},
{
id = "avg3_232",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.1.0"
},
{
id = "avg3_233",
name = "***",
name_bg_color = "#0ABEC5",
ver = "1.14.0"
},
{
id = "avg3_234",
name = "***",
name_bg_color = "#0ABEC5",
ver = "1.14.0"
},
{
id = "avg3_235",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.2.0"
},
{
id = "avg3_236",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.2.0"
},
{
id = "avg3_237",
name = "***",
name_bg_color = "#0ABEC5",
ver = "2.2.0"
},
{
id = "avg3_873",
name = "克莱儿",
@@ -1886,7 +2000,7 @@ return {
},
{
id = "avg3_1047",
name = "电话那头的男人",
name = "通话另一端的男人",
name_bg_color = "#0ABEC5"
},
{
@@ -2836,60 +2950,102 @@ return {
},
{
id = "avg3_1305",
name = "***",
name = "泳薇洛A",
name_bg_color = "#b0e0f6",
reuse = "avg1_160",
ver = "1.13.0"
},
{
id = "avg3_1306",
name = "***",
name = "黎明近卫士兵男A",
name_bg_color = "#0ABEC5",
reuse = "avg2_948",
ver = "1.13.0"
},
{
id = "avg3_1307",
name = "***",
name = "黎明近卫士兵男B",
name_bg_color = "#0ABEC5",
reuse = "avg2_948",
ver = "1.13.0"
},
{
id = "avg3_1308",
name = "***",
name = "黎明近卫士兵女A",
name_bg_color = "#0ABEC5",
reuse = "avg2_947",
ver = "1.13.0"
},
{
id = "avg3_1309",
name = "***",
name = "黎明近卫士兵女B",
name_bg_color = "#0ABEC5",
reuse = "avg2_947",
ver = "1.13.0"
},
{
id = "avg3_1310",
name = "***",
name = "灰风成员乙",
name_bg_color = "#0ABEC5",
reuse = "avg2_991",
ver = "1.13.0"
},
{
id = "avg3_1311",
name = "***",
name = "塞拉女A",
name_bg_color = "#0ABEC5",
reuse = "avg3_100",
ver = "1.13.0"
},
{
id = "avg3_1312",
name = "***",
name = "塞拉男A",
name_bg_color = "#0ABEC5",
reuse = "avg3_101",
ver = "1.13.0"
},
{
id = "avg3_1313",
name = "艾蕾A",
name_bg_color = "#555559",
reuse = "avg1_139",
ver = "1.13.0"
},
{
id = "avg3_1314",
name = "***",
name_bg_color = "#0ABEC5",
reuse = "avg2_975",
ver = "1.14.0"
},
{
id = "avg3_1315",
name = "***",
name_bg_color = "#0ABEC5",
reuse = "avg2_975",
ver = "1.14.0"
},
{
id = "avg3_1316",
name = "***",
name_bg_color = "#0ABEC5",
reuse = "avg2_975",
ver = "1.14.0"
},
{
id = "avg3_1317",
name = "***",
name_bg_color = "#0ABEC5",
reuse = "avg2_945",
ver = "1.14.0"
},
{
id = "avg3_1318",
name = "***",
name_bg_color = "#0ABEC5",
reuse = "avg2_945",
ver = "1.14.0"
},
{
id = "avg4_100",
name = "菈露发光",
@@ -2910,6 +3066,18 @@ return {
name = "火垂发光",
name_bg_color = "#0ABEC5"
},
{
id = "avg4_104",
name = "一块左侧的石头",
name_bg_color = "#0ABEC5",
ver = "1.13.0"
},
{
id = "avg4_105",
name = "一块右侧的石头",
name_bg_color = "#0ABEC5",
ver = "1.13.0"
},
{
id = "avg4_999",
name = "维塔",
+17 -1
View File
@@ -75,7 +75,7 @@ return {
icon = "Icon/Head/head_11701_S",
name = "璟麟",
landmark = "菲莱城阿斯旺街八号",
signature = "怀璟食府欢迎您,定桌请提前致电"
signature = "怀璟食府欢迎您,定桌请提前联络"
},
{
id = 118,
@@ -255,6 +255,14 @@ return {
landmark = "菲莱城外东部森林花令旅团驻地",
signature = "你有看见过我的布娃娃吗?"
},
{
id = 157,
icon = "Icon/Head/head_15701_S",
name = "***",
landmark = "塞尔斯泰晨曦街78号",
signature = "变态……",
ver = "1.14.0"
},
{
id = 158,
icon = "Icon/Head/head_15801_S",
@@ -269,6 +277,14 @@ return {
landmark = "菲莱的“那个”诊所",
signature = "休假外出中。"
},
{
id = 160,
icon = "Icon/Head/head_16001_S",
name = "薇洛(盛夏)",
landmark = "埃摩协会之家",
signature = "在海边也要注意安全!",
ver = "1.13.0"
},
{
id = 3136,
icon = "Icon/Head/head_npc13601_S",
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More