Update - 1.9.0.107
EN: 1.9.0.107 CN: 1.9.0.108 JP: 1.9.0.112 KR: 1.9.0.112
This commit is contained in:
@@ -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 = "30102/BreakOutThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30102.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, "30102/SpriteAtlas/3010103", 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 = "30102/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,324 @@
|
||||
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] or 1
|
||||
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 self.nCurGroupIndex == nil then
|
||||
self.nCurGroupIndex = 1
|
||||
end
|
||||
if type(nActivityId) ~= "number" then
|
||||
return
|
||||
end
|
||||
self.ins_ActivityTaskData = PlayerActivityData:GetActivityDataById(nActivityId)
|
||||
if self.ins_ActivityTaskData == nil then
|
||||
return
|
||||
end
|
||||
local func_Parse_ActivityTaskGroup = function(mapData)
|
||||
if mapData.ActivityId == nActivityId then
|
||||
local _nGroupId = mapData.Id
|
||||
local nIdx = table.indexof(self.tbGroupId, _nGroupId)
|
||||
if nIdx <= 0 then
|
||||
local _mapData = {
|
||||
nGroupId = _nGroupId,
|
||||
nGroupOrder = mapData.Order,
|
||||
nTabType = mapData.TaskTabType,
|
||||
tbGroupRewardId = {},
|
||||
tbGroupRewardNum = {},
|
||||
tbTaskId = {},
|
||||
tbTaskData = {},
|
||||
nTaskDoneNum = 0,
|
||||
nTaskOKNum = 0
|
||||
}
|
||||
for i = 1, 6 do
|
||||
local nRewardId = mapData["Reward" .. tostring(i)]
|
||||
local nRewardNum = mapData["RewardQty" .. tostring(i)]
|
||||
if 0 < nRewardId and 0 < nRewardNum then
|
||||
table.insert(_mapData.tbGroupRewardId, nRewardId)
|
||||
table.insert(_mapData.tbGroupRewardNum, nRewardNum)
|
||||
end
|
||||
end
|
||||
table.insert(self.tbData, _mapData)
|
||||
table.insert(self.tbGroupId, _nGroupId)
|
||||
else
|
||||
local _mapData = self.tbData[nIdx]
|
||||
_mapData.nTaskDoneNum = 0
|
||||
_mapData.nTaskOKNum = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTaskGroup, func_Parse_ActivityTaskGroup)
|
||||
local func_Parse_ActivityTask = function(mapData)
|
||||
local nIdx = table.indexof(self.tbGroupId, mapData.ActivityTaskGroupId)
|
||||
if 0 < nIdx then
|
||||
local _mapData = self.tbData[nIdx]
|
||||
local _tbTaskId = _mapData.tbTaskId
|
||||
local _tbTaskData = _mapData.tbTaskData
|
||||
local _nTaskId = mapData.Id
|
||||
local taskData = self.ins_ActivityTaskData.mapActivityTaskDatas[_nTaskId]
|
||||
local nIndex = table.indexof(_tbTaskId, _nTaskId)
|
||||
if nIndex <= 0 then
|
||||
local _mapTaskData = {
|
||||
nTaskId = _nTaskId,
|
||||
nStatus = taskData.nStatus,
|
||||
sDesc = mapData.Desc,
|
||||
nRarity = mapData.Rarity,
|
||||
nJumpTo = mapData.JumpTo,
|
||||
nCur = taskData.nCur,
|
||||
nMax = taskData.nMax,
|
||||
tbTaskRewardId = {},
|
||||
tbTaskRewardNum = {}
|
||||
}
|
||||
if taskData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
_mapData.nTaskDoneNum = _mapData.nTaskDoneNum + 1
|
||||
end
|
||||
if taskData.nStatus ~= AllEnum.ActQuestStatus.UnComplete then
|
||||
_mapData.nTaskOKNum = _mapData.nTaskOKNum + 1
|
||||
end
|
||||
for i = 1, 2 do
|
||||
local nRewardId = mapData["Tid" .. tostring(i)]
|
||||
local nRewardNum = mapData["Qty" .. tostring(i)]
|
||||
if 0 < nRewardId and 0 < nRewardNum then
|
||||
table.insert(_mapTaskData.tbTaskRewardId, nRewardId)
|
||||
table.insert(_mapTaskData.tbTaskRewardNum, nRewardNum)
|
||||
end
|
||||
end
|
||||
table.insert(_tbTaskId, _nTaskId)
|
||||
table.insert(_tbTaskData, _mapTaskData)
|
||||
else
|
||||
local _mapTaskData = _tbTaskData[nIndex]
|
||||
_mapTaskData.nStatus = taskData.nStatus
|
||||
_mapTaskData.nCur = taskData.nCur
|
||||
_mapTaskData.nMax = taskData.nMax
|
||||
if taskData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
_mapData.nTaskDoneNum = _mapData.nTaskDoneNum + 1
|
||||
end
|
||||
if taskData.nStatus ~= AllEnum.ActQuestStatus.UnComplete then
|
||||
_mapData.nTaskOKNum = _mapData.nTaskOKNum + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.ActivityTask, func_Parse_ActivityTask)
|
||||
table.sort(self.tbData, function(a, b)
|
||||
return a.nGroupOrder < b.nGroupOrder
|
||||
end)
|
||||
for i, v in ipairs(self.tbData) do
|
||||
self.tbGroupId[i] = v.nGroupId
|
||||
end
|
||||
for i, mapData in ipairs(self.tbData) do
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
table.sort(tbTaskData, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.nTaskId < b.nTaskId
|
||||
else
|
||||
return a.nStatus < b.nStatus
|
||||
end
|
||||
end)
|
||||
for ii, vv in ipairs(tbTaskData) do
|
||||
mapData.tbTaskId[ii] = vv.nTaskId
|
||||
end
|
||||
end
|
||||
end
|
||||
function 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 = "30102/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30102.Task.BreakOutTaskCtrl"
|
||||
}
|
||||
}
|
||||
return BreakOutTaskPanel
|
||||
Reference in New Issue
Block a user