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