Update - 1.4.0.73

EN: 1.4.0.73
CN: 1.4.0.74
JP: 1.4.0.77
KR: 1.4.0.80
This commit is contained in:
SL1900
2025-12-25 19:00:00 +09:00
parent 5f417fbe9d
commit 35c8d87e86
1183 changed files with 893278 additions and 92778 deletions
@@ -0,0 +1,206 @@
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()
self:RefreshTaskData()
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("%02d", nOpenDay)
local strEndDay = string.format("%02d", 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:RefreshTaskData()
self.nActTaskId = self.actData.tbAllActivity[1].ActivityId
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(self.nActTaskId)
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 = nDone / nTotal * rt.rect.width
if 0 < nWidth and nWidth < 309 then
nWidth = 309
end
self._mapNode.imgFill:GetComponent("RectTransform").sizeDelta = Vector2(nWidth, rt.rect.height)
NovaAPI.SetTMPText(self._mapNode.txtProgress, progress)
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
local callback = function()
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutThemePanel, actGroupCfg.Id)
end
end
EventManager.Hit(EventId.OpenPanel, PanelId.BreakOutThemePanel, actGroupCfg.Id)
end
function ActivityBreakOutCtrl:OnBtnClick_GoTaskPanel()
EventManager.Hit(EventId.OpenPanel, PanelId.Task_30101, 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,382 @@
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 = {}
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
self.ActivityGroupCfg = self.BreakOut_30101Data.actGroupConfig
end
end
function BreakOutThemeCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function BreakOutThemeCtrl:OnEnable()
self:RefreshPanel()
for i = 1, 5 do
local actData = self.BreakOut_30101Data:GetActivityDataByIndex(i)
if i == AllEnum.ActivityThemeFuncIndex.Task then
local nActId = actData.ActivityId
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
self.nActId,
nActId
}, self._mapNode.redDotEntrance2)
end
end
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 i == AllEnum.ActivityThemeFuncIndex.Task then
self:RefreshTaskButtonState(actData)
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
self:RefreshShopButtonState(actData)
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 = nDone / nTotal * rt.rect.width
if 0 < nWidth and nWidth < 309 then
nWidth = 309
end
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.RequireActiviyData, 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
return BreakOutThemeCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local BreakOutThemePanel = class("BreakOutThemePanel", BasePanel)
BreakOutThemePanel._sUIResRootPath = "UI_Activity/"
BreakOutThemePanel._tbDefine = {
{
sPrefabPath = "30101/BreakOutThemePanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.30101.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,250 @@
local ActivityShopCtrl = class("ActivityShopCtrl", BaseCtrl)
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local BubbleVoiceManager = require("Game.Actor2D.BubbleVoiceManager")
local PlayerVoiceData = PlayerData.Voice
ActivityShopCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
rawImgActor2D = {
sNodeName = "----Actor2D----",
sComponentName = "RawImage"
},
trActor2D_PNG = {
sNodeName = "----Actor2D_PNG----",
sComponentName = "Transform"
},
aniRoot = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "Animator"
},
btnActor2D = {
sComponentName = "Button",
callback = "OnBtnClick_Actor2D"
},
svTog = {
sComponentName = "LoopScrollView"
},
trSvTog = {sNodeName = "svTog", sComponentName = "Transform"},
Goods = {
sNodeName = "---Goods---",
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopGoodsCtrl"
},
goBubbleRoot = {
sNodeName = "----fixed_bubble----"
}
}
ActivityShopCtrl._mapEventConfig = {
ActivityShopTimeRefresh = "OnEvent_TimeRefresh",
[EventId.ShowBubbleVoiceText] = "OnEvent_ShowBubbleVoiceText",
ActivityShopBuyVoice = "PlayBuyVoice",
[EventId.UIBackConfirm] = "OnEvent_UIBack",
[EventId.UIHomeConfirm] = "OnEvent_Home"
}
function ActivityShopCtrl:CheckShopData()
EventManager.Hit("ActivityShopCloseDetail")
self._panel.actShopData:RefreshActivityShopData()
self:RefreshData()
if self.nShopCount == 0 or not self.nSelectShop then
return
end
self:RefreshTog()
self:SetTimer()
self:SwitchTog()
self:RefreshNPC2D()
end
function ActivityShopCtrl:RefreshData()
self.tbShops = self._panel.actShopData:GetShopList()
self.nShopCount = #self.tbShops
self.ctrlTog = {}
if self.nCurTog == nil then
self.nCurTog = 1
if self._panel.nDefaultId then
for k, v in ipairs(self.tbShops) do
if v.nId == self._panel.nDefaultId then
self.nCurTog = k
break
end
end
end
end
if not self.tbShops[self.nCurTog] or self.nSelectShop and self.tbShops[self.nCurTog].nId ~= self.nSelectShop then
self.nCurTog = 1
end
if self.tbShops[self.nCurTog] then
self.nSelectShop = self.tbShops[self.nCurTog].nId
end
end
function ActivityShopCtrl:RefreshTog()
if self.nShopCount > 1 then
self._mapNode.svTog.gameObject:SetActive(true)
for nInstanceID, objCtrl in pairs(self.ctrlTog) do
self:UnbindCtrlByNode(objCtrl)
self.ctrlTog[nInstanceID] = nil
end
self._mapNode.svTog:Init(self.nShopCount, self, self.OnGridRefresh, self.OnGridBtnClick)
else
self._mapNode.svTog.gameObject:SetActive(false)
end
end
function ActivityShopCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceID = goGrid:GetInstanceID()
if not self.ctrlTog[nInstanceID] then
self.ctrlTog[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.TemplateEx.TemplateToggleCtrl")
end
local mapCfg = ConfigTable.GetData("ActivityShop", self.tbShops[nIndex].nId)
if mapCfg then
self.ctrlTog[nInstanceID]:SetText(mapCfg.Name)
end
self.ctrlTog[nInstanceID]:SetDefault(nIndex == self.nCurTog)
end
function ActivityShopCtrl:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
local nInstanceID = goGrid:GetInstanceID()
if nIndex == self.nCurTog then
return
end
self.ctrlTog[nInstanceID]:SetTrigger(true)
if self.nCurTog then
local goSelect = self._mapNode.trSvTog:Find("Viewport/Content/" .. self.nCurTog - 1)
if goSelect then
self.ctrlTog[goSelect.gameObject:GetInstanceID()]:SetTrigger(false)
end
end
self.nCurTog = nIndex
self.nSelectShop = self.tbShops[self.nCurTog].nId
self:SwitchTog()
self._mapNode.aniRoot:Play("ShopPanel_in")
self:PlaySwitchTogVoice()
end
function ActivityShopCtrl:SetTimer()
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
local nTime = self._panel.actShopData:GetShopAutoUpdateTime()
if 0 < nTime then
self.timer = self:AddTimer(1, nTime, function()
self:CheckShopData()
if self.nShopCount == 0 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
EventManager.Hit(EventId.CloseMessageBox)
EventManager.Hit(EventId.CloesCurPanel)
else
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_ShopRefresh"))
end
end, true, true, false)
end
end
function ActivityShopCtrl:SwitchTog()
local mapShop = self.tbShops[self.nCurTog]
local mapCfg = ConfigTable.GetData("ActivityShop", mapShop.nId)
if not mapCfg then
return
end
self._mapNode.TopBar:CreateCoin({
mapCfg.CurrencyItemId
})
self._mapNode.Goods:Open(mapShop.nId, mapShop.nNextRefreshTime)
end
function ActivityShopCtrl:RefreshNPC2D()
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.SwimShop, self._mapNode.rawImgActor2D, self.nNpcId)
else
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, PanelId.SwimShop, self.nNpcId)
end
end
function ActivityShopCtrl:PlayEnterVoice()
local bFirst = self._panel.actShopData:GetShopFirstIn()
local sTimeVoice = PlayerData.Voice:GetNPCGreetTimeVoiceKey()
if bFirst then
PlayerData.Voice:PlayCharVoice(sTimeVoice, self.nNpcId)
else
local nIndex = math.random(1, 2)
local sVoice = nIndex == 1 and sTimeVoice or "greet_npc"
PlayerData.Voice:PlayCharVoice(sVoice, self.nNpcId)
end
end
function ActivityShopCtrl:PlayBuyVoice(bLimit)
local sVoice = ""
if bLimit then
sVoice = "limited"
else
sVoice = "thank_npc"
end
PlayerData.Voice:PlayCharVoice(sVoice, self.nNpcId)
end
function ActivityShopCtrl:PlaySwitchTogVoice()
PlayerData.Voice:PlayCharVoice("Tab", self.nNpcId)
end
function ActivityShopCtrl:RefreshNPCId()
local mapCfg = ConfigTable.GetData("ActivityShopControl", self._panel.nActId)
if not mapCfg then
return
end
local tbNpc = mapCfg.Npc
local nRandomIndex = math.random(1, #tbNpc)
self.nNpcId = tbNpc[nRandomIndex]
end
function ActivityShopCtrl:FadeIn(bPlayFadeIn)
self._mapNode.aniRoot:Play("ShopPanel_in")
end
function ActivityShopCtrl:Awake()
self.nCurTog = nil
end
function ActivityShopCtrl:OnEnable()
self:RefreshNPCId()
PlayerVoiceData:StartBoardFreeTimer(self.nNpcId)
self:PlayEnterVoice()
self:CheckShopData()
end
function ActivityShopCtrl:OnDisable()
if self.ctrlTog then
for nInstanceId, objCtrl in pairs(self.ctrlTog) do
self:UnbindCtrlByNode(objCtrl)
self.ctrlTog[nInstanceId] = nil
end
self.ctrlTog = {}
end
Actor2DManager.UnsetBoardNPC2D()
BubbleVoiceManager.StopBubbleAnim()
PlayerVoiceData:ClearTimer()
PlayerVoiceData:StopCharVoice()
end
function ActivityShopCtrl:OnDestroy()
end
function ActivityShopCtrl:OnBtnClick_Actor2D()
PlayerVoiceData:PlayBoardNPCClickVoice(self.nNpcId)
end
function ActivityShopCtrl:OnEvent_TimeRefresh()
self:CheckShopData()
end
function ActivityShopCtrl: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)
end
function ActivityShopCtrl:OnEvent_UIBack(nPanelId)
if PanelId.DiscSample ~= nPanelId or PanelId.CharBgTrialPanel ~= nPanelId then
PlayerVoiceData:StartBoardFreeTimer(self.nNpcId)
CS.WwiseAudioManager.Instance:SetState("menuTransition", "open")
end
end
function ActivityShopCtrl:OnEvent_Home(nPanelId)
if PanelId.DiscSample ~= nPanelId or PanelId.CharBgTrialPanel ~= nPanelId then
PlayerVoiceData:StartBoardFreeTimer(self.nNpcId)
end
end
return ActivityShopCtrl
@@ -0,0 +1,75 @@
local ActivityShopGoodsCtrl = class("ActivityShopGoodsCtrl", BaseCtrl)
ActivityShopGoodsCtrl._mapNodeConfig = {
sv = {
sComponentName = "LoopScrollView"
}
}
ActivityShopGoodsCtrl._mapEventConfig = {
ActivityShopRefreshGoods = "CheckGoodsData"
}
function ActivityShopGoodsCtrl:Open(nShopId, nShopAutoTime)
self.nShopId = nShopId
self.nShopAutoTime = nShopAutoTime
self:CheckGoodsData(true)
end
function ActivityShopGoodsCtrl:CheckGoodsData(bResetPos)
self._panel.actShopData:CheckGoodsData(self.nShopId)
self.tbGoods = self._panel.actShopData:GetGoodsList(self.nShopId)
self:SetTimer()
self:RefreshList(bResetPos)
end
function ActivityShopGoodsCtrl:SetTimer()
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
local nTime = self._panel.actShopData:GetGoodsAutoUpdateTime(self.nShopId)
if 0 < nTime and (self.nShopAutoTime == 0 or nTime < self.nShopAutoTime) then
self.timer = self:AddTimer(1, nTime, function()
EventManager.Hit("ActivityShopCloseDetail")
EventManager.Hit(EventId.CloseMessageBox)
self:CheckGoodsData(true)
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_GoodsRefresh"))
end, true, true, false)
end
end
function ActivityShopGoodsCtrl:RefreshList(bResetPos)
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self._mapNode.sv:SetAnim(0.04)
self._mapNode.sv:Init(#self.tbGoods, self, self.OnGridRefresh, self.OnGridBtnClick, not bResetPos)
end
function ActivityShopGoodsCtrl:OnGridRefresh(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapData = self.tbGoods[nIndex]
local nInstanceID = goGrid:GetInstanceID()
if not self.tbGridCtrl[nInstanceID] then
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.ActivityTheme.30101.Shop.ActivityShopGoodsItemCtrl")
end
local mapCfg = ConfigTable.GetData("ActivityShop", self.nShopId)
if mapCfg then
self.tbGridCtrl[nInstanceID]:Refresh(mapData, mapCfg.CurrencyItemId)
end
end
function ActivityShopGoodsCtrl:OnGridBtnClick(goGrid, gridIndex)
local nIndex = gridIndex + 1
local mapData = self.tbGoods[nIndex]
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPopup_30101, mapData, self.nShopId, self._panel.nActId)
end
function ActivityShopGoodsCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivityShopGoodsCtrl:OnEnable()
end
function ActivityShopGoodsCtrl:OnDisable()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivityShopGoodsCtrl:OnDestroy()
end
return ActivityShopGoodsCtrl
@@ -0,0 +1,256 @@
local ActivityShopGoodsDetailCtrl = class("ActivityShopGoodsDetailCtrl", BaseCtrl)
ActivityShopGoodsDetailCtrl._mapNodeConfig = {
txtWindowTitle = {
sComponentName = "TMP_Text",
sLanguageId = "Shop_TitleBuy"
},
goItem = {
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
},
btnDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
},
txtName = {sComponentName = "TMP_Text"},
txtDesc = {sComponentName = "TMP_Text"},
txtHas = {sComponentName = "TMP_Text"},
txtPriceCn = {
sComponentName = "TMP_Text",
sLanguageId = "Shop_UnitPrice"
},
imgCoin = {nCount = 2, sComponentName = "Image"},
txtPrice = {sComponentName = "TMP_Text"},
txtStock = {sComponentName = "TMP_Text"},
goStock = {},
txtBtnBuy = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Shop_Btn_Buy"
},
txtCoinCount = {sComponentName = "TMP_Text"},
btnBuy = {
sComponentName = "UIButton",
callback = "OnBtnClick_Buy"
},
btnClose = {
sComponentName = "UIButton",
callback = "OnBtnClick_Close"
},
btnBuy2 = {
sComponentName = "UIButton",
callback = "OnBtnClick_Disable"
},
txtDisable = {sComponentName = "TMP_Text"},
goQuantitySelector = {
sNodeName = "tc_quantity_selector",
sCtrlName = "Game.UI.TemplateEx.TemplateQuantitySelectorCtrl"
}
}
ActivityShopGoodsDetailCtrl._mapEventConfig = {}
function ActivityShopGoodsDetailCtrl:Refresh(mapData, nShopId, nActId)
self.mapGoodsCfg = ConfigTable.GetData("ActivityGoods", mapData.nId)
local mapShopCfg = ConfigTable.GetData("ActivityShop", nShopId)
if not self.mapGoodsCfg or not mapShopCfg then
return
end
self.mapData = mapData
self.nShopId = nShopId
self.nCurrencyItemId = mapShopCfg.CurrencyItemId
self.bAble = mapData.bPurchasTime and mapData.bPurchasable and not mapData.bSoldOut
self.actShopData = PlayerData.Activity:GetActivityDataById(nActId)
self:PlayInAni()
self:RefreshInfo()
self:RefreshPrice()
self:RefreshBuyState()
self:RefreshBuyCount()
end
function ActivityShopGoodsDetailCtrl:RefreshInfo()
local nItemId = self.mapGoodsCfg.ItemId
local mapCfg = ConfigTable.GetData_Item(nItemId)
if not mapCfg then
return
end
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapGoodsCfg.Name)
self._mapNode.goItem:SetItem(nItemId, nil, self.mapGoodsCfg.ItemQuantity, nil, nil, nil, nil, true)
if mapCfg.Type == GameEnum.itemType.Disc or mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin then
self._mapNode.txtHas.gameObject:SetActive(false)
else
self._mapNode.txtHas.gameObject:SetActive(true)
local nCount = PlayerData.Item:GetItemCountByID(nItemId)
if 999999 < nCount then
local nFloor = math.floor(nCount / 100)
local nK = string.format("%.0f", nFloor / 10)
local sCount = nK .. "k"
NovaAPI.SetTMPText(self._mapNode.txtHas, ConfigTable.GetUIText("Shop_Has") .. sCount)
else
NovaAPI.SetTMPText(self._mapNode.txtHas, ConfigTable.GetUIText("Shop_Has") .. nCount)
end
end
NovaAPI.SetTMPText(self._mapNode.txtDesc, self.mapGoodsCfg.Desc)
local bLimit = self.mapData.nMaximumLimit > 0
if bLimit then
local nLeft = self.mapData.nMaximumLimit - self.mapData.nBoughtCount
NovaAPI.SetTMPText(self._mapNode.txtStock, orderedFormat(ConfigTable.GetUIText("Shop_Stock"), nLeft))
NovaAPI.SetTMPColor(self._mapNode.txtStock, nLeft == 0 and Red_Unable or Blue_Dark)
else
NovaAPI.SetTMPText(self._mapNode.txtStock, ConfigTable.GetUIText("Shop_Unlimited"))
NovaAPI.SetTMPColor(self._mapNode.txtStock, Blue_Dark)
end
self._mapNode.btnDetail.interactable = mapCfg and (mapCfg.Stype == GameEnum.itemStype.Disc or mapCfg.Stype == GameEnum.itemStype.Char or mapCfg.Stype == GameEnum.itemStype.RandomPackage or mapCfg.Stype == GameEnum.itemStype.ComCYO or mapCfg.Stype == GameEnum.itemStype.OutfitCYO)
end
function ActivityShopGoodsDetailCtrl:RefreshPrice()
for i = 1, 2 do
self:SetSprite_Coin(self._mapNode.imgCoin[i], self.nCurrencyItemId)
end
NovaAPI.SetTMPText(self._mapNode.txtPrice, self.mapGoodsCfg.Price)
end
function ActivityShopGoodsDetailCtrl:RefreshBuyCount()
local nCost = self.nBuyCount * self.mapGoodsCfg.Price
NovaAPI.SetTMPText(self._mapNode.txtCoinCount, nCost)
local nHasCoin = PlayerData.Item:GetItemCountByID(self.nCurrencyItemId)
NovaAPI.SetTMPColor(self._mapNode.txtCoinCount, nCost > nHasCoin and Red_Unable or Blue_Normal)
end
function ActivityShopGoodsDetailCtrl:RefreshBuyState()
self._mapNode.btnBuy.gameObject:SetActive(self.bAble)
self._mapNode.btnBuy2.gameObject:SetActive(not self.bAble)
self._mapNode.txtDisable.gameObject:SetActive(not self.mapData.bPurchasable or self.mapData.bSoldOut)
self.nBuyCount = self.bAble and 1 or 0
local nMax = self:CountMaxBuy()
local callback = function(nCount)
self.nBuyCount = nCount
self:RefreshBuyCount()
end
self._mapNode.goQuantitySelector:Init(callback, self.nBuyCount, nMax)
if self.mapData.bSoldOut then
NovaAPI.SetTMPText(self._mapNode.txtDisable, ConfigTable.GetUIText("Shop_Cond_SoldOutShort"))
elseif not self.mapData.bPurchasable then
if self.mapData.nPurchaseCondType == GameEnum.shopCond.WorldClassSpecific then
NovaAPI.SetTMPText(self._mapNode.txtDisable, orderedFormat(ConfigTable.GetUIText("Shop_Cond_WorldClassShort"), self.mapData.tbPurchaseCondParams[1]))
elseif self.mapData.nPurchaseCondType == GameEnum.shopCond.ShopPreGoodsSellOut or self.mapData.nPurchaseCondType == GameEnum.shopCond.ActivityShopPreGoodsSellOut then
NovaAPI.SetTMPText(self._mapNode.txtDisable, ConfigTable.GetUIText("Shop_Cond_PreGoodsSellOut"))
end
end
end
function ActivityShopGoodsDetailCtrl:CountMaxBuy()
local nHasCoin = PlayerData.Item:GetItemCountByID(self.nCurrencyItemId)
local nMax = math.floor(nHasCoin / self.mapGoodsCfg.Price)
if nMax == 0 then
return 1
end
if 0 < self.mapData.nMaximumLimit then
local nRemain = self.mapData.nMaximumLimit - self.mapData.nBoughtCount
return nMax > nRemain and nRemain or nMax
else
return nMax
end
end
function ActivityShopGoodsDetailCtrl:PlayInAni()
self.gameObject:SetActive(true)
self.ani:Play("t_window_04_t_in")
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
function ActivityShopGoodsDetailCtrl:PlayOutAni()
self.ani:Play("t_window_04_t_out")
self:AddTimer(1, 0.2, "Close", true, true, true)
end
function ActivityShopGoodsDetailCtrl:Close()
self.gameObject:SetActive(false)
end
function ActivityShopGoodsDetailCtrl:Awake()
self.ani = self.gameObject.transform:GetComponent("Animator")
end
function ActivityShopGoodsDetailCtrl:OnEnable()
end
function ActivityShopGoodsDetailCtrl:OnDisable()
end
function ActivityShopGoodsDetailCtrl:OnDestroy()
end
function ActivityShopGoodsDetailCtrl:OnBtnClick_Buy()
local nCost = self.nBuyCount * self.mapGoodsCfg.Price
local nHasCoin = PlayerData.Item:GetItemCountByID(self.nCurrencyItemId)
local sName = ConfigTable.GetData_Item(self.nCurrencyItemId).Title
if nCost > nHasCoin then
EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("Shop_NotEnough"), sName))
return
end
local buy = function()
local callback = function()
EventManager.Hit("ActivityShopRefreshGoods")
EventManager.Hit("ActivityShopCloseDetail")
local bLimit = self.mapData.nMaximumLimit > 0
EventManager.Hit("ActivityShopBuyVoice", bLimit)
end
self.actShopData:SendActivityShopPurchaseReq(self.nShopId, self.mapData.nId, self.nBuyCount, callback)
end
local buy_confirm = function()
local nAll = self.mapGoodsCfg.ItemQuantity * self.nBuyCount
local sTip = 1 < nAll and orderedFormat(ConfigTable.GetUIText("Shop_MultiBuyComfirm"), nCost, sName, nAll, self.mapGoodsCfg.Name) or orderedFormat(ConfigTable.GetUIText("Shop_BuyComfirm"), nCost, sName, self.mapGoodsCfg.Name)
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = sTip,
callbackConfirm = buy,
bBlur = false
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
local nItemId = self.mapGoodsCfg.ItemId
local mapCfg = ConfigTable.GetData_Item(nItemId)
local sTip
if mapCfg then
if mapCfg.Type == GameEnum.itemType.Disc then
sTip = PlayerData.Item:GetDiscHoldingState(nItemId, self.nBuyCount)
elseif mapCfg.Type == GameEnum.itemType.Char then
sTip = PlayerData.Item:GetCharHoldingState(nItemId, self.nBuyCount)
elseif mapCfg.Stype == GameEnum.itemStype.CharShard then
local nCharId = PlayerData.Talent:GetFragmentsToChar(nItemId)
sTip = PlayerData.Item:GetCharHoldingState(nCharId, 0, self.nBuyCount)
end
end
if sTip then
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = sTip,
callbackConfirm = buy_confirm,
bBlur = false
}
EventManager.Hit(EventId.OpenMessageBox, msg)
else
buy_confirm()
end
end
function ActivityShopGoodsDetailCtrl:OnBtnClick_Close()
EventManager.Hit("ActivityShopCloseDetail")
end
function ActivityShopGoodsDetailCtrl:OnBtnClick_Detail()
local nItemId = self.mapGoodsCfg.ItemId
local mapCfg = ConfigTable.GetData_Item(nItemId)
if not mapCfg then
return
end
if mapCfg.Stype == GameEnum.itemStype.Disc then
EventManager.Hit(EventId.OpenPanel, PanelId.DiscSample, nItemId)
elseif mapCfg.Stype == GameEnum.itemStype.Char then
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, nItemId)
elseif mapCfg.Stype == GameEnum.itemStype.RandomPackage or mapCfg.Stype == GameEnum.itemStype.ComCYO then
local tbDetailItem, sDetailTitle = PlayerData.Item:GetCYODisplayItem(nItemId)
local msg = {
nType = AllEnum.MessageBox.ItemList,
tbItem = tbDetailItem,
sTitle = sDetailTitle,
bBlur = false
}
EventManager.Hit(EventId.OpenMessageBox, msg)
elseif mapCfg.Stype == GameEnum.itemStype.OutfitCYO then
EventManager.Hit(EventId.OpenPanel, PanelId.DiscPreview, nItemId)
end
end
function ActivityShopGoodsDetailCtrl:OnBtnClick_Disable()
if self.mapData.bSoldOut then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_GoodsEmpty"))
elseif not self.mapData.bPurchasable then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_Condition"))
elseif not self.mapData.bPurchasTime then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Shop_NotPurchasTime"))
end
end
return ActivityShopGoodsDetailCtrl
@@ -0,0 +1,118 @@
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"},
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)
else
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
end
local sPath = "db_arkanoid_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "30101/SpriteAtlas_3010103", sPath)
local bLimit = self.mapData.nMaximumLimit > 0
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 = "30101/Shop/ActivityShopPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.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,64 @@
local ActivityShopPopupCtrl = class("ActivityShopPopupCtrl", BaseCtrl)
ActivityShopPopupCtrl._mapNodeConfig = {
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
blur = {
sNodeName = "t_fullscreen_blur_blue"
},
aniBlur = {
sNodeName = "t_fullscreen_blur_blue",
sComponentName = "Animator"
},
btnCloseDatail = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "OnBtnClick_CloseDetail"
},
Detail = {
sNodeName = "---Detail---",
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopGoodsDetailCtrl"
}
}
ActivityShopPopupCtrl._mapEventConfig = {
ActivityShopCloseDetail = "OnBtnClick_CloseDetail"
}
function ActivityShopPopupCtrl:Open()
local mapCfg = ConfigTable.GetData("ActivityShop", self.nShopId)
if not mapCfg then
return
end
self._mapNode.TopBar:CreateCoin({
mapCfg.CurrencyItemId
}, true)
self._mapNode.blur:SetActive(true)
self._mapNode.Detail:Refresh(self.mapData, self.nShopId, self.nActId)
end
function ActivityShopPopupCtrl:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.mapData = tbParam[1]
self.nShopId = tbParam[2]
self.nActId = tbParam[3]
end
end
function ActivityShopPopupCtrl:OnEnable()
self:Open()
end
function ActivityShopPopupCtrl:OnDisable()
end
function ActivityShopPopupCtrl:OnDestroy()
end
function ActivityShopPopupCtrl:OnBtnClick_CloseDetail()
if self._mapNode.Detail.gameObject.activeSelf == false then
return
end
self._mapNode.Detail:PlayOutAni()
self._mapNode.aniBlur:SetTrigger("tOut")
self:AddTimer(1, 0.2, function()
EventManager.Hit(EventId.ClosePanel, PanelId.ShopPopup_30101)
end, true, true, true)
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
end
return ActivityShopPopupCtrl
@@ -0,0 +1,18 @@
local ActivityShopPopupPanel = class("ActivityShopPopupPanel", BasePanel)
ActivityShopPopupPanel._sUIResRootPath = "UI_Activity/"
ActivityShopPopupPanel._bIsMainPanel = false
ActivityShopPopupPanel._tbDefine = {
{
sPrefabPath = "30101/Shop/ActivityShopPopupPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopPopupCtrl"
}
}
function ActivityShopPopupPanel:Awake()
end
function ActivityShopPopupPanel:OnEnable()
end
function ActivityShopPopupPanel:OnDisable()
end
function ActivityShopPopupPanel:OnDestroy()
end
return ActivityShopPopupPanel
@@ -0,0 +1,330 @@
local BreakOutTaskCtrl = class("BreakOutTaskCtrl", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local PlayerActivityData = PlayerData.Activity
local TabType = GameEnum.ActivityTaskTabType
local ItemType = GameEnum.itemType
local tbTabNameUITextId = {
[TabType.Tab1] = "Quest_Normal",
[TabType.Tab2] = "Quest_Story",
[TabType.Tab3] = "Quest_Challenge",
[TabType.Tab4] = "Quest_Play",
[TabType.Tab5] = "Quest_Active"
}
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"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
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"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
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, rt.rect.height)
NovaAPI.SetTMPText(tr:Find("tmpTaskDesc"):GetComponent("TMP_Text"), mapTask.sDesc)
NovaAPI.SetTMPText(tr:Find("tmpTaskProgress"):GetComponent("TMP_Text"), string.format("%s/%s", tostring(nCur), tostring(nMax)))
local nCount = #mapTask.tbTaskRewardId
for i = 1, 2 do
local _tr = tr:Find("goTaskReward" .. tostring(i))
if i <= nCount then
_tr.localScale = Vector3.one
local nId = mapTask.tbTaskRewardId[i]
local mapCfgData_Item = ConfigTable.GetData("Item", nId)
self:SetSprite_FrameColor(_tr:Find("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
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 = "30101/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.30101.Task.BreakOutTaskCtrl"
}
}
return BreakOutTaskPanel