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:
@@ -121,10 +121,10 @@ end
|
||||
function BreakOutThemeCtrl:RefreshTime()
|
||||
local bOpen = self.BreakOut_30101Data:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
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)
|
||||
local remainTime = RefreshRemainTime(self.BreakOut_30101Data:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
@@ -133,41 +133,6 @@ function BreakOutThemeCtrl:RefreshTime()
|
||||
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
|
||||
@@ -244,7 +209,7 @@ function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans
|
||||
end
|
||||
else
|
||||
imgTrans:SetActive(false)
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDownTimer)
|
||||
countDownTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
@@ -263,12 +228,12 @@ function BreakOutThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if timer == nil and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, txtTrans)
|
||||
RefreshRemainTime(endTime, txtTrans)
|
||||
do
|
||||
local fcTimer = function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
|
||||
local remainTime = RefreshRemainTime(endTime, txtTrans)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(timer)
|
||||
TimerManager.Remove(countDownTimer)
|
||||
countDownTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
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, nil, true)
|
||||
else
|
||||
local nIndex = math.random(1, 2)
|
||||
local sVoice = nIndex == 1 and sTimeVoice or "greet_npc"
|
||||
PlayerData.Voice:PlayCharVoice(sVoice, self.nNpcId, nil, true)
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:PlayBuyVoice(bLimit)
|
||||
local sVoice = ""
|
||||
if bLimit then
|
||||
sVoice = "limited"
|
||||
else
|
||||
sVoice = "thank_npc"
|
||||
end
|
||||
PlayerData.Voice:PlayCharVoice(sVoice, self.nNpcId, nil, true)
|
||||
end
|
||||
function ActivityShopCtrl:PlaySwitchTogVoice()
|
||||
PlayerData.Voice:PlayCharVoice("Tab", self.nNpcId, nil, true)
|
||||
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
|
||||
@@ -1,75 +0,0 @@
|
||||
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
|
||||
@@ -1,256 +0,0 @@
|
||||
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
|
||||
@@ -3,7 +3,7 @@ ActivityShopPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityShopPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "30101/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.30101.Shop.ActivityShopCtrl"
|
||||
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPanel:Awake()
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
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
|
||||
@@ -1,18 +0,0 @@
|
||||
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
|
||||
Reference in New Issue
Block a user