Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
local AchievementCtrl = class("AchievementCtrl", BaseCtrl)
|
||||
AchievementCtrl._mapNodeConfig = {
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnAchievement = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 5,
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
rtHomePage = {
|
||||
sCtrlName = "Game.UI.AchievementEx.AchievementHomepageCtrl"
|
||||
},
|
||||
rtDetail = {
|
||||
sCtrlName = "Game.UI.AchievementEx.AchievementDetailCtrl"
|
||||
}
|
||||
}
|
||||
AchievementCtrl._mapEventConfig = {
|
||||
[EventId.UIBackConfirm] = "OnEvent_Back",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome"
|
||||
}
|
||||
AchievementCtrl._mapRedDotConfig = {}
|
||||
function AchievementCtrl:Awake()
|
||||
end
|
||||
function AchievementCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self._mapNode.animRoot:Play("AchievementPanel_in")
|
||||
end
|
||||
function AchievementCtrl:FadeOut()
|
||||
end
|
||||
function AchievementCtrl:OnEnable()
|
||||
self._mapNode.rtHomePage.gameObject:SetActive(false)
|
||||
self._mapNode.rtDetail.gameObject:SetActive(false)
|
||||
local callback = function()
|
||||
self._mapNode.rtHomePage:OnEvent_ReceiveReward()
|
||||
self._mapNode.rtDetail:UpdateData()
|
||||
if self._panel.nDetailIdx ~= nil and self._panel.nDetailIdx > 0 then
|
||||
self._mapNode.rtDetail.gameObject:SetActive(true)
|
||||
self._mapNode.rtDetail:OpenDetail(self._panel.nDetailIdx)
|
||||
self.bDetail = true
|
||||
else
|
||||
self._mapNode.rtHomePage.gameObject:SetActive(true)
|
||||
end
|
||||
PlayerData.Achievement:CheckReddot()
|
||||
end
|
||||
PlayerData.Achievement:SendAchievementInfoReq(callback)
|
||||
self.bDetail = false
|
||||
self:RegisterReddot()
|
||||
end
|
||||
function AchievementCtrl:OnDisable()
|
||||
end
|
||||
function AchievementCtrl:OnDestroy()
|
||||
end
|
||||
function AchievementCtrl:OnRelease()
|
||||
end
|
||||
function AchievementCtrl:OnBtnClick_Detail(btn, nIdx)
|
||||
self._mapNode.rtDetail:OpenDetail(nIdx)
|
||||
self._mapNode.rtHomePage.gameObject:SetActive(false)
|
||||
self._mapNode.rtDetail.gameObject:SetActive(true)
|
||||
self.bDetail = true
|
||||
self._panel.nDetailIdx = nIdx
|
||||
end
|
||||
function AchievementCtrl:RegisterReddot(...)
|
||||
for k, v in pairs(self._mapNode.btnAchievement) do
|
||||
local goReddot = v.transform:Find("AnimRoot/reddot").gameObject
|
||||
RedDotManager.RegisterNode(RedDotDefine.Achievement_Tab, k, goReddot)
|
||||
end
|
||||
end
|
||||
function AchievementCtrl:OnEvent_Back(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
if self.bDetail then
|
||||
self._mapNode.rtHomePage.gameObject:SetActive(true)
|
||||
self._mapNode.rtDetail.gameObject:SetActive(false)
|
||||
self.bDetail = false
|
||||
self._panel.nDetailIdx = 0
|
||||
self._mapNode.animRoot:Play("AchievementPanel_in")
|
||||
else
|
||||
self._panel.nDetailIdx = 0
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
end
|
||||
end
|
||||
function AchievementCtrl:OnEvent_BackHome(nPanelId)
|
||||
if self._panel._nPanelId ~= nPanelId then
|
||||
return
|
||||
end
|
||||
self._panel.nDetailIdx = 0
|
||||
PanelManager.Home()
|
||||
end
|
||||
return AchievementCtrl
|
||||
@@ -0,0 +1,172 @@
|
||||
local AchievementDetailCtrl = class("AchievementDetailCtrl", BaseCtrl)
|
||||
AchievementDetailCtrl._mapNodeConfig = {
|
||||
TMPCupCount = {sComponentName = "TMP_Text", nCount = 3},
|
||||
txtBtnAllReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Btn_ReceiveAll"
|
||||
},
|
||||
imgFlagIcon = {sComponentName = "Image"},
|
||||
svAchievementList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btnAllReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_AllReceive"
|
||||
},
|
||||
btnTab = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 5,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
imgTabBg = {
|
||||
sCtrlName = "Game.UI.AchievementEx.AchievementToggle"
|
||||
},
|
||||
imgIconF0 = {nCount = 5},
|
||||
AnimFlag = {sNodeName = "imgFlag", sComponentName = "Animator"}
|
||||
}
|
||||
AchievementDetailCtrl._mapEventConfig = {
|
||||
AchievementRefresh = "OnEvent_ReceiveReward"
|
||||
}
|
||||
AchievementDetailCtrl._mapRedDotConfig = {}
|
||||
function AchievementDetailCtrl:Awake()
|
||||
self.mapAllAchievement = {}
|
||||
self.mapAllAchievementCount = {}
|
||||
self.mapGrid = {}
|
||||
self.curIdx = 1
|
||||
end
|
||||
function AchievementDetailCtrl:FadeIn()
|
||||
end
|
||||
function AchievementDetailCtrl:FadeOut()
|
||||
end
|
||||
function AchievementDetailCtrl:OnEnable()
|
||||
self._mapNode.imgTabBg:SetText(ConfigTable.GetUIText("Achievement_Type_1"), ConfigTable.GetUIText("Achievement_Type_2"), ConfigTable.GetUIText("Achievement_Type_3"), ConfigTable.GetUIText("Achievement_Type_4"), ConfigTable.GetUIText("Achievement_Type_5"))
|
||||
self:RegisterReddot()
|
||||
end
|
||||
function AchievementDetailCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
if self.mapGrid[goGrid] == nil then
|
||||
local mapCtrl = self:BindCtrlByNode(goGrid, "Game.UI.AchievementEx.AchievementGridCtrl")
|
||||
self.mapGrid[goGrid] = mapCtrl
|
||||
end
|
||||
local nIdx = gridIndex
|
||||
if nIdx == nil then
|
||||
return
|
||||
end
|
||||
nIdx = nIdx + 1
|
||||
local mapAllAchievement = self.mapAllAchievement[self.curType][nIdx]
|
||||
self.mapGrid[goGrid]:OnGridRefresh(mapAllAchievement)
|
||||
end
|
||||
function AchievementDetailCtrl:OnDisable()
|
||||
for goGrid, mapCtrl in pairs(self.mapGrid) do
|
||||
self:UnbindCtrlByNode(mapCtrl)
|
||||
end
|
||||
self.mapGrid = {}
|
||||
end
|
||||
function AchievementDetailCtrl:OnDestroy()
|
||||
end
|
||||
function AchievementDetailCtrl:OnRelease()
|
||||
end
|
||||
function AchievementDetailCtrl:OpenDetail(nIdx)
|
||||
self.curType = nIdx
|
||||
for i = 1, 5 do
|
||||
self._mapNode.imgIconF0[i]:SetActive(nIdx == i)
|
||||
end
|
||||
self._mapNode.imgTabBg:SetState(nIdx)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local sAnimName = "imgFlagIcon_in0" .. self.curType
|
||||
self._mapNode.AnimFlag:Play(sAnimName)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self._mapNode.svAchievementList:Init(#self.mapAllAchievement[self.curType], self, self.OnGridRefresh)
|
||||
self:SetPngSprite(self._mapNode.imgFlagIcon, "UI/big_sprites/zs_achievement_icon_0" .. nIdx)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgFlagIcon)
|
||||
local bShowAllReceive = false
|
||||
for _, mapAchievement in ipairs(self.mapAllAchievement[self.curType]) do
|
||||
if mapAchievement.nStatus == 1 then
|
||||
bShowAllReceive = true
|
||||
end
|
||||
end
|
||||
self._mapNode.btnAllReceive.gameObject:SetActive(bShowAllReceive)
|
||||
local mapCount = PlayerData.Achievement:GetAchievementTypeCount(self.curType)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[1], mapCount.tbRarity[GameEnum.itemRarity.SSR])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[2], mapCount.tbRarity[GameEnum.itemRarity.SR])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[3], mapCount.tbRarity[GameEnum.itemRarity.R])
|
||||
end
|
||||
function AchievementDetailCtrl:UpdateData()
|
||||
for _, nValue in pairs(GameEnum.achievementType) do
|
||||
self.mapAllAchievement[nValue] = {}
|
||||
local mapAllAchievement = PlayerData.Achievement:GetAchievementTypeList(nValue)
|
||||
if mapAllAchievement ~= nil then
|
||||
for _, value in pairs(mapAllAchievement) do
|
||||
if not PlayerData.Achievement:JudgeHide(nValue, value) then
|
||||
table.insert(self.mapAllAchievement[nValue], value)
|
||||
end
|
||||
end
|
||||
local sortAchievement = function(a, b)
|
||||
if a.nStatus ~= b.nStatus then
|
||||
return a.nStatus < b.nStatus
|
||||
end
|
||||
return a.nId < b.nId
|
||||
end
|
||||
table.sort(self.mapAllAchievement[nValue], sortAchievement)
|
||||
end
|
||||
end
|
||||
end
|
||||
function AchievementDetailCtrl:RegisterReddot(...)
|
||||
for k, v in pairs(self._mapNode.btnTab) do
|
||||
local goReddot = v.transform:Find("reddot_Tab").gameObject
|
||||
RedDotManager.RegisterNode(RedDotDefine.Achievement_Tab, k, goReddot)
|
||||
end
|
||||
end
|
||||
function AchievementDetailCtrl:OnBtnClick_Tog(btn, nIdx)
|
||||
if nIdx == self.curType then
|
||||
return
|
||||
end
|
||||
self.curType = nIdx
|
||||
for i = 1, 5 do
|
||||
self._mapNode.imgIconF0[i]:SetActive(nIdx == i)
|
||||
end
|
||||
self._mapNode.imgTabBg:SetState(nIdx)
|
||||
self._mapNode.svAchievementList:SetAnim(0.06)
|
||||
self._mapNode.svAchievementList:Init(#self.mapAllAchievement[self.curType], self, self.OnGridRefresh)
|
||||
local mapCount = PlayerData.Achievement:GetAchievementTypeCount(self.curType)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[1], mapCount.tbRarity[GameEnum.itemRarity.SSR])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[2], mapCount.tbRarity[GameEnum.itemRarity.SR])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[3], mapCount.tbRarity[GameEnum.itemRarity.R])
|
||||
self:SetPngSprite(self._mapNode.imgFlagIcon, "UI/big_sprites/zs_achievement_icon_0" .. nIdx)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgFlagIcon)
|
||||
local bShowAllReceive = false
|
||||
for _, mapAchievement in ipairs(self.mapAllAchievement[self.curType]) do
|
||||
if mapAchievement.nStatus == 1 then
|
||||
bShowAllReceive = true
|
||||
end
|
||||
end
|
||||
self._panel.nDetailIdx = nIdx
|
||||
self._mapNode.btnAllReceive.gameObject:SetActive(bShowAllReceive)
|
||||
end
|
||||
function AchievementDetailCtrl:OnBtnClick_AllReceive(btn, nIdx)
|
||||
local tbId = {}
|
||||
for _, mapAchievement in ipairs(self.mapAllAchievement[self.curType]) do
|
||||
if mapAchievement.nStatus == 1 then
|
||||
table.insert(tbId, mapAchievement.nId)
|
||||
end
|
||||
end
|
||||
PlayerData.Achievement:SendAchievementRewardReq(tbId, self.curType, nil)
|
||||
end
|
||||
function AchievementDetailCtrl:OnEvent_ReceiveReward()
|
||||
self:UpdateData()
|
||||
self._mapNode.svAchievementList:Init(#self.mapAllAchievement[self.curType], self, self.OnGridRefresh)
|
||||
local mapCount = PlayerData.Achievement:GetAchievementTypeCount(self.curType)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[1], mapCount.tbRarity[GameEnum.itemRarity.SSR])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[2], mapCount.tbRarity[GameEnum.itemRarity.SR])
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[3], mapCount.tbRarity[GameEnum.itemRarity.R])
|
||||
local bShowAllReceive = false
|
||||
for _, mapAchievement in ipairs(self.mapAllAchievement[self.curType]) do
|
||||
if mapAchievement.nStatus == 1 then
|
||||
bShowAllReceive = true
|
||||
end
|
||||
end
|
||||
self._mapNode.btnAllReceive.gameObject:SetActive(bShowAllReceive)
|
||||
end
|
||||
return AchievementDetailCtrl
|
||||
@@ -0,0 +1,113 @@
|
||||
local AchievementGridCtrl = class("AchievementGridCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local nBarLength = 512
|
||||
local nBarHeight = 512
|
||||
AchievementGridCtrl._mapNodeConfig = {
|
||||
imgCup = {sComponentName = "Image"},
|
||||
TMPTitle = {sComponentName = "TMP_Text"},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
TMPProcess = {sComponentName = "TMP_Text"},
|
||||
TMPTimeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Achievement_Tips_Completed"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
},
|
||||
TMPTime = {sComponentName = "TMP_Text"},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnItem = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Jumpto"
|
||||
},
|
||||
rtItem = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
imgCup0 = {nCount = 3},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Receive_Btn_Text"
|
||||
},
|
||||
TMPUncomplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_UnComplete_Text"
|
||||
}
|
||||
}
|
||||
AchievementGridCtrl._mapEventConfig = {}
|
||||
AchievementGridCtrl._mapRedDotConfig = {}
|
||||
function AchievementGridCtrl:Awake()
|
||||
end
|
||||
function AchievementGridCtrl:FadeIn()
|
||||
end
|
||||
function AchievementGridCtrl:FadeOut()
|
||||
end
|
||||
function AchievementGridCtrl:OnEnable()
|
||||
end
|
||||
function AchievementGridCtrl:OnDisable()
|
||||
end
|
||||
function AchievementGridCtrl:OnDestroy()
|
||||
end
|
||||
function AchievementGridCtrl:OnRelease()
|
||||
end
|
||||
function AchievementGridCtrl:OnGridRefresh(mapAchievement)
|
||||
self.mapAchievement = mapAchievement
|
||||
local mapAchievementCfgData = ConfigTable.GetData("Achievement", mapAchievement.nId)
|
||||
if mapAchievementCfgData == nil then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle, mapAchievementCfgData.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, mapAchievementCfgData.Desc)
|
||||
if mapAchievementCfgData.Tid1 ~= 0 then
|
||||
self._mapNode.rtItem.gameObject:SetActive(true)
|
||||
self._mapNode.rtItem:SetItem(mapAchievementCfgData.Tid1, nil, mapAchievementCfgData.Qty1, nil, mapAchievement.nStatus == 3)
|
||||
else
|
||||
self._mapNode.rtItem.gameObject:SetActive(false)
|
||||
end
|
||||
self._mapNode.btnReceive.gameObject:SetActive(mapAchievement.nStatus == 1)
|
||||
self._mapNode.btnJump.gameObject:SetActive(mapAchievement.nStatus == 2 and 0 < mapAchievementCfgData.JumpTo)
|
||||
self._mapNode.TMPTimeTitle.gameObject:SetActive(mapAchievement.nStatus == 3)
|
||||
self._mapNode.TMPUncomplete.gameObject:SetActive(mapAchievement.nStatus == 2 and mapAchievementCfgData.JumpTo == 0)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPProcess, string.format("%d/%d", mapAchievement.nCur, mapAchievement.nMax))
|
||||
if mapAchievement.nStatus == 3 then
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(nBarLength, nBarHeight)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTime, mapAchievement.sTime)
|
||||
elseif 0 < mapAchievement.nMax then
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(nBarLength * (mapAchievement.nCur / mapAchievement.nMax), nBarHeight)
|
||||
else
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(0, nBarHeight)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgCup, "UI/big_sprites/zs_achievement_cup_0" .. mapAchievementCfgData.Rarity)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgCup0[i]:SetActive(i == mapAchievementCfgData.Rarity and mapAchievement.nStatus == 3)
|
||||
end
|
||||
end
|
||||
function AchievementGridCtrl:OnBtnClick_Receive()
|
||||
local mapAchievementCfgData = ConfigTable.GetData("Achievement", self.mapAchievement.nId)
|
||||
PlayerData.Achievement:SendAchievementRewardReq({
|
||||
self.mapAchievement.nId
|
||||
}, mapAchievementCfgData.Type, nil)
|
||||
end
|
||||
function AchievementGridCtrl:OnBtnClick_Jumpto()
|
||||
local mapAchievementCfgData = ConfigTable.GetData("Achievement", self.mapAchievement.nId) or {}
|
||||
JumpUtil.JumpTo(mapAchievementCfgData.JumpTo)
|
||||
end
|
||||
function AchievementGridCtrl:OnBtnClick_Item(btn)
|
||||
local mapAchievementCfgData = ConfigTable.GetData("Achievement", self.mapAchievement.nId)
|
||||
if mapAchievementCfgData == nil then
|
||||
return
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(mapAchievementCfgData.Tid1, btn.gameObject, true, true, true)
|
||||
end
|
||||
return AchievementGridCtrl
|
||||
@@ -0,0 +1,35 @@
|
||||
local AchievementHomepageCtrl = class("AchievementHomepageCtrl", BaseCtrl)
|
||||
AchievementHomepageCtrl._mapNodeConfig = {
|
||||
TMPAcheivementCount = {sComponentName = "TMP_Text"},
|
||||
TMPTitle = {sComponentName = "TMP_Text", nCount = 5},
|
||||
TMPCupCount = {sComponentName = "TMP_Text", nCount = 3}
|
||||
}
|
||||
AchievementHomepageCtrl._mapEventConfig = {
|
||||
AchievementRefresh = "OnEvent_ReceiveReward"
|
||||
}
|
||||
AchievementHomepageCtrl._mapRedDotConfig = {}
|
||||
function AchievementHomepageCtrl:Awake()
|
||||
end
|
||||
function AchievementHomepageCtrl:FadeIn()
|
||||
end
|
||||
function AchievementHomepageCtrl:FadeOut()
|
||||
end
|
||||
function AchievementHomepageCtrl:OnEnable()
|
||||
for i = 1, 5 do
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle[i], ConfigTable.GetUIText("Achievement_Type_" .. i))
|
||||
end
|
||||
end
|
||||
function AchievementHomepageCtrl:OnDisable()
|
||||
end
|
||||
function AchievementHomepageCtrl:OnDestroy()
|
||||
end
|
||||
function AchievementHomepageCtrl:OnRelease()
|
||||
end
|
||||
function AchievementHomepageCtrl:OnEvent_ReceiveReward()
|
||||
self.mapCount = PlayerData.Achievement:GetAchievementAllTypeCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPAcheivementCount, self.mapCount.nCompleted)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[1], self.mapCount.nSSR)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[2], self.mapCount.nSR)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPCupCount[3], self.mapCount.nR)
|
||||
end
|
||||
return AchievementHomepageCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local AchievementPanel = class("AchievementPanel", BasePanel)
|
||||
AchievementPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "AchievementEx/AchievementPanel.prefab",
|
||||
sCtrlName = "Game.UI.AchievementEx.AchievementCtrl"
|
||||
}
|
||||
}
|
||||
function AchievementPanel:Awake()
|
||||
end
|
||||
function AchievementPanel:OnEnable()
|
||||
end
|
||||
function AchievementPanel:OnAfterEnter()
|
||||
end
|
||||
function AchievementPanel:OnDisable()
|
||||
end
|
||||
function AchievementPanel:OnDestroy()
|
||||
end
|
||||
function AchievementPanel:OnRelease()
|
||||
end
|
||||
return AchievementPanel
|
||||
@@ -0,0 +1,40 @@
|
||||
local AchievementToggle = class("AchievementToggle", BaseCtrl)
|
||||
AchievementToggle._mapNodeConfig = {
|
||||
TMPTitle = {sComponentName = "TMP_Text", nCount = 5},
|
||||
TMPTitleOpen = {sComponentName = "TMP_Text", nCount = 5},
|
||||
imgTab = {nCount = 5}
|
||||
}
|
||||
AchievementToggle._mapEventConfig = {}
|
||||
AchievementToggle._mapRedDotConfig = {}
|
||||
function AchievementToggle:Awake()
|
||||
end
|
||||
function AchievementToggle:FadeIn()
|
||||
end
|
||||
function AchievementToggle:FadeOut()
|
||||
end
|
||||
function AchievementToggle:OnEnable()
|
||||
end
|
||||
function AchievementToggle:OnDisable()
|
||||
end
|
||||
function AchievementToggle:OnDestroy()
|
||||
end
|
||||
function AchievementToggle:OnRelease()
|
||||
end
|
||||
function AchievementToggle:SetText(sTitle1, sTitle2, sTitle3, sTitle4, sTitle5)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle[1], sTitle1)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle[2], sTitle2)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle[3], sTitle3)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle[4], sTitle4)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle[5], sTitle5)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitleOpen[1], sTitle1)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitleOpen[2], sTitle2)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitleOpen[3], sTitle3)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitleOpen[4], sTitle4)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitleOpen[5], sTitle5)
|
||||
end
|
||||
function AchievementToggle:SetState(nIdx)
|
||||
for index, goTab in ipairs(self._mapNode.imgTab) do
|
||||
goTab:SetActive(nIdx == index)
|
||||
end
|
||||
end
|
||||
return AchievementToggle
|
||||
@@ -0,0 +1,81 @@
|
||||
local ActionBarCtrl = class("ActionBarCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ActionBarCtrl._mapNodeConfig = {
|
||||
rtContent = {sComponentName = "Transform"},
|
||||
goAction = {}
|
||||
}
|
||||
ActionBarCtrl._mapEventConfig = {
|
||||
GamepadUIChange = "OnEvent_GamepadUIChange"
|
||||
}
|
||||
function ActionBarCtrl:InitActionBar(tbConfig)
|
||||
if self.tbConfig and #tbConfig == #self.tbConfig then
|
||||
local bAllSame = true
|
||||
for i, v in ipairs(tbConfig) do
|
||||
if v.sAction ~= self.tbConfig[i].sAction then
|
||||
bAllSame = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if bAllSame then
|
||||
return
|
||||
end
|
||||
end
|
||||
self.tbActionObj = {}
|
||||
self.tbActionImg = {}
|
||||
self.tbConfig = tbConfig
|
||||
delChildren(self._mapNode.rtContent)
|
||||
for _, v in pairs(tbConfig) do
|
||||
local goAction = instantiate(self._mapNode.goAction, self._mapNode.rtContent)
|
||||
goAction:SetActive(true)
|
||||
local imgAction = goAction.transform:Find("imgAction"):GetComponent("Image")
|
||||
local imgAction2 = goAction.transform:Find("imgAction2"):GetComponent("Image")
|
||||
local txtAction = goAction.transform:Find("txtAction"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtAction, ConfigTable.GetUIText(v.sLang))
|
||||
self.tbActionObj[v.sAction] = goAction
|
||||
self.tbActionImg[v.sAction] = imgAction
|
||||
if v.sAction2 then
|
||||
imgAction2.gameObject:SetActive(true)
|
||||
self.tbActionObj[v.sAction2] = goAction
|
||||
self.tbActionImg[v.sAction2] = imgAction2
|
||||
end
|
||||
end
|
||||
self:RefreshActionImage()
|
||||
end
|
||||
function ActionBarCtrl:ClearActionBar()
|
||||
self.tbActionObj = {}
|
||||
self.tbActionImg = {}
|
||||
self.tbConfig = nil
|
||||
delChildren(self._mapNode.rtContent)
|
||||
end
|
||||
function ActionBarCtrl:RefreshActionImage()
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType == AllEnum.GamepadUIType.Other then
|
||||
self.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.gameObject:SetActive(true)
|
||||
for sAction, imgAction in pairs(self.tbActionImg) do
|
||||
local sIcon
|
||||
if nUIType == AllEnum.GamepadUIType.PS then
|
||||
sIcon = ConfigTable.GetField("GamepadAction", sAction, "PlayStationIcon")
|
||||
elseif nUIType == AllEnum.GamepadUIType.Xbox then
|
||||
sIcon = ConfigTable.GetField("GamepadAction", sAction, "XboxIcon")
|
||||
elseif nUIType == AllEnum.GamepadUIType.Keyboard or nUIType == AllEnum.GamepadUIType.Mouse then
|
||||
sIcon = ConfigTable.GetField("GamepadAction", sAction, "KeyboardIcon")
|
||||
end
|
||||
if sIcon == nil or sIcon == "" then
|
||||
self.tbActionObj[sAction]:SetActive(false)
|
||||
else
|
||||
self.tbActionObj[sAction]:SetActive(true)
|
||||
self:SetPngSprite(imgAction, sIcon)
|
||||
NovaAPI.SetImageNativeSize(imgAction)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActionBarCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
|
||||
if not self.tbActionImg then
|
||||
return
|
||||
end
|
||||
self:RefreshActionImage()
|
||||
end
|
||||
return ActionBarCtrl
|
||||
@@ -0,0 +1,109 @@
|
||||
local ActivityTaskCtrl_01 = class("ActivityTaskCtrl_01", BaseCtrl)
|
||||
ActivityTaskCtrl_01._mapNodeConfig = {
|
||||
goTaskItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.ActivityTask.ActivityTaskItemCtrl_01"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
btnTask = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Task"
|
||||
},
|
||||
txtActivityTime = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Energy_Item_Permanent_Time"
|
||||
}
|
||||
}
|
||||
ActivityTaskCtrl_01._mapEventConfig = {}
|
||||
function ActivityTaskCtrl_01:RefreshTaskList()
|
||||
self.tbTaskList = {}
|
||||
self.tbRewardList = {}
|
||||
self.nGroupId = 0
|
||||
local tbTaskGroup, tbTaskList = self.actData:GetAllTaskList()
|
||||
for nGroupId, tbTask in pairs(tbTaskGroup) do
|
||||
self.nGroupId = nGroupId
|
||||
for _, nId in ipairs(tbTask) do
|
||||
local mapQuest = tbTaskList[nId]
|
||||
if mapQuest ~= nil then
|
||||
local mapData = {
|
||||
nId = nId,
|
||||
nStatus = mapQuest.nStatus,
|
||||
nExpire = mapQuest.nExpire,
|
||||
nCur = mapQuest.nCur,
|
||||
nMax = mapQuest.nMax
|
||||
}
|
||||
table.insert(self.tbTaskList, mapData)
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("ActivityTask", nId)
|
||||
if mapCfg ~= nil and mapCfg.Tid1 ~= 0 then
|
||||
table.insert(self.tbRewardList, mapCfg.Tid1)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(self.tbTaskList, function(a, b)
|
||||
return a.nId < b.nId
|
||||
end)
|
||||
for k, v in ipairs(self._mapNode.goTaskItem) do
|
||||
local mapQuestData = self.tbTaskList[k]
|
||||
v.gameObject:SetActive(mapQuestData ~= nil)
|
||||
if mapQuestData ~= nil then
|
||||
v:SetTaskItem(mapQuestData)
|
||||
if self._mapNode.btnItem[k] ~= nil then
|
||||
NovaAPI.SetRaycastTarget(self._mapNode.btnItem[k].gameObject, mapQuestData.nStatus ~= AllEnum.ActQuestStatus.Complete)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskCtrl_01:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshTaskList()
|
||||
end
|
||||
function ActivityTaskCtrl_01:ClearActivity()
|
||||
end
|
||||
function ActivityTaskCtrl_01:Awake()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnEnable()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnDisable()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnDestroy()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnBtnClick_Detail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbRewardList[nIndex] ~= nil then
|
||||
UTILS.ClickItemGridWithTips(self.tbRewardList[nIndex], btn.gameObject.transform, true, true, false)
|
||||
end
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnBtnClick_Task(btn, nIndex)
|
||||
if self.tbTaskList ~= nil and self.tbTaskList[nIndex] ~= nil then
|
||||
local mapQuest = self.tbTaskList[nIndex]
|
||||
if mapQuest.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
local mapGroupCfg = ConfigTable.GetData("ActivityTaskGroup", self.nGroupId)
|
||||
if self.actData ~= nil and mapGroupCfg ~= nil then
|
||||
local callback = function()
|
||||
self:RefreshTaskList()
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.actData:GetActId(), false)
|
||||
end
|
||||
self.actData:SendMsg_ActivityTaskRewardReceiveReq(self.nGroupId, mapQuest.nId, mapGroupCfg.TaskTabType, callback)
|
||||
end
|
||||
elseif mapQuest.nStatus == AllEnum.ActQuestStatus.UnComplete then
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnEvent_RefreshActivityTask()
|
||||
self:RefreshTaskList()
|
||||
end
|
||||
return ActivityTaskCtrl_01
|
||||
@@ -0,0 +1,45 @@
|
||||
local ActivityTaskItemCtrl_01 = class("ActivityTaskItemCtrl_01", BaseCtrl)
|
||||
ActivityTaskItemCtrl_01._mapNodeConfig = {
|
||||
imgCanReceiveBg = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtItemCount = {sComponentName = "TMP_Text"},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
goReceived = {},
|
||||
txtReceived = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Received"
|
||||
},
|
||||
imgReceived = {},
|
||||
imgCanReceive = {},
|
||||
txtCanReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Can_Receive"
|
||||
}
|
||||
}
|
||||
ActivityTaskItemCtrl_01._mapEventConfig = {}
|
||||
ActivityTaskItemCtrl_01._mapRedDotConfig = {}
|
||||
function ActivityTaskItemCtrl_01:SetTaskItem(mapQuest)
|
||||
local mapCfg = ConfigTable.GetData("ActivityTask", mapQuest.nId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
self.mapQuest = mapQuest
|
||||
local nTid = mapCfg.Tid1
|
||||
local nCount = mapCfg.Qty1
|
||||
if nTid ~= 0 then
|
||||
local itemCfg = ConfigTable.GetData_Item(nTid)
|
||||
if itemCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, itemCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, itemCfg.Title)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemCount, orderedFormat(ConfigTable.GetUIText("LoginReward_Reward_Count"), nCount))
|
||||
local sDesc = orderedFormat(mapCfg.Desc, mapCfg.AimNumShow)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, sDesc)
|
||||
self._mapNode.imgCanReceiveBg.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.imgCanReceive.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.goReceived.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgReceived.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
end
|
||||
return ActivityTaskItemCtrl_01
|
||||
@@ -0,0 +1,168 @@
|
||||
local InfinityTowerActCtrl = class("InfinityTowerActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local rabbitRightId = 917302
|
||||
local rabbitLeftId = 917402
|
||||
InfinityTowerActCtrl._mapNodeConfig = {
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
txtActDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Des"
|
||||
},
|
||||
txtActTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Tip"
|
||||
},
|
||||
btn_Go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtBtn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
},
|
||||
imgActTimeBg = {},
|
||||
trRoot_L = {
|
||||
sNodeName = "----Actor2DLeft302----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
trRoot_R = {
|
||||
sNodeName = "----Actor2DRight402----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
Actor2DLeft = {
|
||||
sNodeName = "rawImg_L_302",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
Actor2DPngL = {sNodeName = "png_L_302", sComponentName = "Transform"},
|
||||
Actor2DRight = {
|
||||
sNodeName = "rawImg_R_402",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
Actor2DPngR = {sNodeName = "png_R_402", sComponentName = "Transform"}
|
||||
}
|
||||
InfinityTowerActCtrl._mapEventConfig = {}
|
||||
function InfinityTowerActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self:StartActTimer()
|
||||
self.UseLive2D = LocalSettingData.mapData.UseLive2D
|
||||
self:LoadRabbit()
|
||||
end
|
||||
function InfinityTowerActCtrl:ClearActivity()
|
||||
end
|
||||
function InfinityTowerActCtrl:OnDisable()
|
||||
self:UnLoadRabbit()
|
||||
end
|
||||
function InfinityTowerActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function InfinityTowerActCtrl:StartActTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
local nStartTime = self.actData:GetActOpenTime()
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
self.isTimeVisible = self._mapNode.imgActTimeBg.gameObject.activeSelf
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local sTime = ""
|
||||
local IsTimeVisible = true
|
||||
local nRemainTime = 0
|
||||
if nCurTime >= nStartTime and nCurTime < nEndTime then
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
else
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
end
|
||||
if nRemainTime <= 0 then
|
||||
IsTimeVisible = false
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
end
|
||||
if self.isTimeVisible ~= IsTimeVisible then
|
||||
self._mapNode.imgActTimeBg.gameObject:SetActive(IsTimeVisible)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function InfinityTowerActCtrl:OnBtnClick_Detail()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCfg.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function InfinityTowerActCtrl:OnBtnClick_Go()
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nEndTime < nCurTime then
|
||||
return
|
||||
end
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.InfinityTowerSelectTower)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 8, func)
|
||||
end
|
||||
function InfinityTowerActCtrl:LoadRabbit()
|
||||
self._mapNode.Actor2DLeft.transform.localScale = self.UseLive2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.Actor2DRight.transform.localScale = self.UseLive2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.Actor2DPngL.localScale = self.UseLive2D == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.Actor2DPngR.localScale = self.UseLive2D == true and Vector3.zero or Vector3.one
|
||||
if self.UseLive2D == true then
|
||||
Actor2DManager.SetBoardNPC2D(PanelId.ActivityInfinity, self._mapNode.Actor2DLeft, rabbitLeftId, nil, nil, 1)
|
||||
Actor2DManager.SetBoardNPC2D(PanelId.ActivityInfinity, self._mapNode.Actor2DRight, rabbitRightId, nil, nil, 2)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.Actor2DPngL, PanelId.ActivityInfinity, rabbitLeftId)
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.Actor2DPngR, PanelId.ActivityInfinity, rabbitRightId)
|
||||
end
|
||||
end
|
||||
function InfinityTowerActCtrl:UnLoadRabbit()
|
||||
Actor2DManager.UnsetBoardNPC2D(1)
|
||||
Actor2DManager.UnsetBoardNPC2D(2)
|
||||
end
|
||||
return InfinityTowerActCtrl
|
||||
@@ -0,0 +1,85 @@
|
||||
NewTutorialsActCtrl = class("NewTutorialsActCtrl", BaseCtrl)
|
||||
NewTutorialsActCtrl._mapNodeConfig = {
|
||||
btn_GoGuideQusetPanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoGuideQusetPanel"
|
||||
},
|
||||
txt_Title1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "QuestPanel_Tab_1"
|
||||
},
|
||||
txt_Plan1 = {sNodeName = "txt_Plan1", sComponentName = "TMP_Text"},
|
||||
txt_Complete1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Complete"
|
||||
},
|
||||
txtBtnGo1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
},
|
||||
btn_GoTutorialPanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoTutorialPanel"
|
||||
},
|
||||
txt_Title2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "QuestPanel_Tab_4"
|
||||
},
|
||||
txt_Plan2 = {sNodeName = "txt_Plan2", sComponentName = "TMP_Text"},
|
||||
txt_Complete2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Complete"
|
||||
},
|
||||
txtBtnGo2 = {
|
||||
sNodeName = "txtBtnGo2",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
}
|
||||
}
|
||||
NewTutorialsActCtrl._mapEventConfig = {}
|
||||
function NewTutorialsActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.AdConfig = ConfigTable.GetData("AdControl", self.nActId)
|
||||
self:Init()
|
||||
end
|
||||
function NewTutorialsActCtrl:Init()
|
||||
self:RefreshGuideQuset()
|
||||
self:RefreshTutorial()
|
||||
end
|
||||
function NewTutorialsActCtrl:RefreshGuideQuset()
|
||||
local nReceivedCount = 0
|
||||
local nTotalCount = PlayerData.Quest:GetMaxTourGroupOrderIndex()
|
||||
local nCurTourGroupOrder = PlayerData.Quest:GetCurTourGroupOrder()
|
||||
if PlayerData.Quest:CheckTourGroupReward(nTotalCount) then
|
||||
self._mapNode.btn_GoGuideQusetPanel.gameObject:SetActive(false)
|
||||
self._mapNode.txt_Complete1.gameObject:SetActive(true)
|
||||
nReceivedCount = nTotalCount
|
||||
else
|
||||
nReceivedCount = nCurTourGroupOrder - 1
|
||||
end
|
||||
local sPanel = orderedFormat(ConfigTable.GetUIText("NewTutorialsAct_Complete") or "", nReceivedCount, nTotalCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Plan1, sPanel)
|
||||
end
|
||||
function NewTutorialsActCtrl:RefreshTutorial()
|
||||
local nTotalCount, nReceivedCount = PlayerData.TutorialData:GetProgress()
|
||||
local sPanel = orderedFormat(ConfigTable.GetUIText("NewTutorialsAct_Complete") or "", nReceivedCount, nTotalCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Plan2, sPanel)
|
||||
if nTotalCount == nReceivedCount then
|
||||
self._mapNode.btn_GoTutorialPanel.gameObject:SetActive(false)
|
||||
self._mapNode.txt_Complete2.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
function NewTutorialsActCtrl:OnBtnClick_GoGuideQusetPanel()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Quest, AllEnum.QuestPanelTab.GuideQuest)
|
||||
end
|
||||
function NewTutorialsActCtrl:OnBtnClick_GoTutorialPanel()
|
||||
local bPlayCond = PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.TutorialLevel, true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Quest, AllEnum.QuestPanelTab.Tutorial)
|
||||
end
|
||||
function NewTutorialsActCtrl:ClearActivity()
|
||||
end
|
||||
return NewTutorialsActCtrl
|
||||
@@ -0,0 +1,119 @@
|
||||
local StoryCollectionActCtrl = class("StoryCollectionActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
StoryCollectionActCtrl._mapNodeConfig = {
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
btn_Go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
btn_Wait = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Wait"
|
||||
},
|
||||
txtBtn_GoRead = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ActivityAdv_StoryRead_Go"
|
||||
},
|
||||
txtBtn_Wait = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ActivityAdv_StoryRead_Wait"
|
||||
}
|
||||
}
|
||||
StoryCollectionActCtrl._mapEventConfig = {}
|
||||
function StoryCollectionActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.AdConfig = ConfigTable.GetData("AdControl", self.nActId)
|
||||
self:StartActTimer()
|
||||
end
|
||||
function StoryCollectionActCtrl:ClearActivity()
|
||||
end
|
||||
function StoryCollectionActCtrl:OnDisable()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
end
|
||||
self.timer = nil
|
||||
end
|
||||
function StoryCollectionActCtrl:StartActTimer()
|
||||
local startTime = self.AdConfig.StartTime
|
||||
local nStartTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(startTime)
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = 0
|
||||
local isOpen = false
|
||||
local sTime = ""
|
||||
if nCurTime < nStartTime then
|
||||
isOpen = false
|
||||
nRemainTime = math.max(nStartTime - nCurTime, 0)
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, ConfigTable.GetUIText("ActivityAdv_StoryCountDown") .. sTime)
|
||||
elseif nCurTime >= nStartTime then
|
||||
isOpen = true
|
||||
local sStartTime = os.date("%Y/%m/%d", nStartTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sStartTime .. ConfigTable.GetUIText("ActivityAdv_StoryUpdate"))
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
end
|
||||
self._mapNode.btn_Go.gameObject:SetActive(isOpen)
|
||||
self._mapNode.btn_Wait.gameObject:SetActive(not isOpen)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function StoryCollectionActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function StoryCollectionActCtrl:OnBtnClick_Go()
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nEndTime < nCurTime then
|
||||
return
|
||||
end
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
local jumpToId = self.AdConfig.JumpTo[1]
|
||||
JumpUtil.JumpTo(jumpToId)
|
||||
end
|
||||
function StoryCollectionActCtrl:OnBtnClick_Wait()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("ActivityAdv_StoryWait_Tip"))
|
||||
end
|
||||
return StoryCollectionActCtrl
|
||||
@@ -0,0 +1,438 @@
|
||||
local BdConvertBuildCtrl = class("BdConvertBuildCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local newDayTime = UTILS.GetDayRefreshTimeOffset()
|
||||
BdConvertBuildCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
BuildListContent = {},
|
||||
BuildListContent_Empty = {},
|
||||
txt_empty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_BuildEmpty"
|
||||
},
|
||||
BuildList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btn_sort_time = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SortTime"
|
||||
},
|
||||
btn_sort_score = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SortScore"
|
||||
},
|
||||
img_icon = {
|
||||
sNodeName = "img_icon_detail",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txt_title = {sComponentName = "TMP_Text"},
|
||||
txt_reward = {sComponentName = "TMP_Text"},
|
||||
sv = {},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txt_SubmitTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_BuildTips"
|
||||
},
|
||||
txt_srot_timeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SortTime"
|
||||
},
|
||||
txt_srot_ScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SortScore"
|
||||
},
|
||||
txt_Allselect = {sComponentName = "TMP_Text"},
|
||||
btn_submit = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Submit"
|
||||
},
|
||||
txt_submit = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Submit"
|
||||
},
|
||||
btn_submit_none = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Submit"
|
||||
},
|
||||
BdConvertFinishPanel = {
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertFinishCtrl"
|
||||
},
|
||||
bg_anim = {sNodeName = "----BG----", sComponentName = "Animator"},
|
||||
anim = {
|
||||
sNodeName = "SafeAreaRoot",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txt_detailTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_DesTips"
|
||||
}
|
||||
}
|
||||
BdConvertBuildCtrl._mapEventConfig = {
|
||||
BdConvert_ShowReward = "OnEvent_ShowReward",
|
||||
BdConvert_FinishPanelClose = "OnEvent_CloseReward",
|
||||
[EventId.UIBackConfirm] = "OnEvent_BackHome",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home"
|
||||
}
|
||||
BdConvertBuildCtrl._mapRedDotConfig = {}
|
||||
local SortType = {Time = 1, Score = 2}
|
||||
local SortOrder = {Descending = true, Ascending = false}
|
||||
local BtnTextColor = {
|
||||
[true] = Color(0.3288888888888889, 0.43555555555555553, 0.5422222222222223, 1),
|
||||
[false] = Color(0.7288888888888889, 0.8, 0.8711111111111111, 1)
|
||||
}
|
||||
function BdConvertBuildCtrl:Awake()
|
||||
self._mapNode.BdConvertFinishPanel.gameObject:SetActive(false)
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
self.nOptionId = param[2]
|
||||
end
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.nSortype = SortType.Score
|
||||
self.nSortOrder = SortOrder.Ascending
|
||||
self.tbSelected = {}
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEnable()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.6)
|
||||
self.tbItemIns = {}
|
||||
self.mapListItemCtrl = {}
|
||||
self:InitSort()
|
||||
self:InitData()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnDisable()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
if self.mapListItemCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.mapListItemCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildCtrl:InitData()
|
||||
self._tbAllBuild = self.actData:GetAllBuildByOpId(self.nOptionId)
|
||||
self.bdCfg = self.actData:GetBdConvertConfig()
|
||||
self.contentCfg = ConfigTable.GetData("BdConvertContent", self.nOptionId)
|
||||
self.data = self.actData:GetBdDataBy(self.nOptionId)
|
||||
if self.data == nil then
|
||||
return
|
||||
end
|
||||
if self.contentCfg.Icon ~= "" then
|
||||
self:SetPngSprite(self._mapNode.img_icon, self.contentCfg.Icon)
|
||||
end
|
||||
self.tbItem = {}
|
||||
local tbReward = decodeJson(self.contentCfg.BasicReward)
|
||||
local tbTemp = {}
|
||||
for key, value in pairs(tbReward) do
|
||||
tbTemp[tonumber(key)] = tonumber(value)
|
||||
end
|
||||
for _, rewardId in ipairs(self.contentCfg.BasicRewardPreview) do
|
||||
table.insert(self.tbItem, {
|
||||
itemId = rewardId,
|
||||
itemCount = tbTemp[rewardId]
|
||||
})
|
||||
end
|
||||
self._mapNode.svItem:Init(#self.tbItem, self, self.OnRewardItemGridRefresh, self.OnGridBtnClick)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_title, self.contentCfg.Des)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_reward, ConfigTable.GetUIText("BdConvert_RewardTitle") .. " " .. self.data.nCurSub .. "/" .. self.data.nMaxSub)
|
||||
local tbTarget = {}
|
||||
for i = 1, 5 do
|
||||
local target = self._mapNode.sv.transform:Find("Viewport/Content/target" .. i)
|
||||
target.gameObject:SetActive(false)
|
||||
table.insert(tbTarget, target)
|
||||
end
|
||||
for index, optionId in ipairs(self.contentCfg.ConvertConditionList) do
|
||||
local txt_target = tbTarget[index]:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local targetCfg = ConfigTable.GetData("BdConvertCondition", optionId)
|
||||
if targetCfg ~= nil then
|
||||
NovaAPI.SetTMPText(txt_target, targetCfg.RequestDes)
|
||||
tbTarget[index].gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.sv.transform:Find("Viewport/Content"):GetComponent("RectTransform"))
|
||||
self:RefreshList()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnTargetGridRefresh(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local txt_target = goGrid.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local targetId = self.contentCfg.ConvertConditionList[nDataIndex]
|
||||
local targetCfg = ConfigTable.GetData("BdConvertCondition", targetId)
|
||||
if targetCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(txt_target, targetCfg.RequestDes)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnRewardItemGridRefresh(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
local goItem = goGrid.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local bGet = self.data.nCurSub == self.data.nMaxSub
|
||||
self.tbItemIns[instanceId]:SetItem(itemId, nil, self.tbItem[nDataIndex].itemCount, nil, bGet)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnGridBtnClick(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
UTILS.ClickItemGridWithTips(itemId, goGrid.transform:Find("btnGrid"), true, false, false)
|
||||
end
|
||||
function BdConvertBuildCtrl:InitSort()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Descending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Descending
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_AAA()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_AAA()
|
||||
end
|
||||
function BdConvertBuildCtrl:RefreshList()
|
||||
self._tbAllBuild = self.actData:GetAllBuildByOpId(self.nOptionId)
|
||||
if #self._tbAllBuild == 0 then
|
||||
self._mapNode.BuildListContent:SetActive(false)
|
||||
self._mapNode.BuildListContent_Empty:SetActive(true)
|
||||
self._mapNode.btn_submit_none.gameObject:SetActive(true)
|
||||
self._mapNode.btn_submit.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Empty, ConfigTable.GetUIText("RoguelikeBuild_Manage_EmptyList"))
|
||||
self:RerfeshSelected()
|
||||
return
|
||||
else
|
||||
self._mapNode.BuildListContent:SetActive(true)
|
||||
self._mapNode.btn_submit_none.gameObject:SetActive(false)
|
||||
self._mapNode.btn_submit.gameObject:SetActive(true)
|
||||
end
|
||||
self:SortBuildData()
|
||||
self._mapNode.BuildList:Init(#self._tbAllBuild, self, self.RefreshBuildGrid, self.OnBtnCal)
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
function BdConvertBuildCtrl:RefreshBuildGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self._tbAllBuild[nIndex]
|
||||
if self.mapListItemCtrl[goGrid] == nil then
|
||||
self.mapListItemCtrl[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.BdConvert._500001.BdConvertBuildItemCtrl")
|
||||
self.mapListItemCtrl[goGrid]:Init(self)
|
||||
end
|
||||
self.mapListItemCtrl[goGrid]:RefreshGrid(mapData)
|
||||
local index = table.indexof(self.tbSelected, mapData)
|
||||
if 0 < index then
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:RerfeshSelected()
|
||||
EventManager.Hit("BdConvert_BuildCancleSelect")
|
||||
for index, data in ipairs(self.tbSelected) do
|
||||
EventManager.Hit("BdConvert_BuildRefreshIndex", data, index)
|
||||
end
|
||||
local str = string.format("<color=#0abec5>%s</color>/%s", #self.tbSelected, self.data.nMaxSub - self.data.nCurSub)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Allselect, ConfigTable.GetUIText("BdConvert_Selected") .. " " .. str)
|
||||
end
|
||||
function BdConvertBuildCtrl:ClearSelectedData()
|
||||
self.tbSelected = {}
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
function BdConvertBuildCtrl:SortBuildData()
|
||||
if self.nSortype == SortType.Time then
|
||||
local sortByTime = function(a, b)
|
||||
if self.nSortOrder == SortOrder.Descending then
|
||||
return a.nBuildId > b.nBuildId
|
||||
else
|
||||
return a.nBuildId < b.nBuildId
|
||||
end
|
||||
end
|
||||
table.sort(self._tbAllBuild, sortByTime)
|
||||
else
|
||||
local sortByScore = function(a, b)
|
||||
if self.nSortOrder == SortOrder.Descending then
|
||||
if a.nScore ~= b.nScore then
|
||||
return a.nScore > b.nScore
|
||||
else
|
||||
return a.nBuildId > b.nBuildId
|
||||
end
|
||||
elseif a.nScore ~= b.nScore then
|
||||
return a.nScore < b.nScore
|
||||
else
|
||||
return a.nBuildId > b.nBuildId
|
||||
end
|
||||
end
|
||||
table.sort(self._tbAllBuild, sortByScore)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_SortTime(btn)
|
||||
if self.nSortype == SortType.Time then
|
||||
self.nSortOrder = not self.nSortOrder
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
|
||||
else
|
||||
self.nSortype = SortType.Time
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_SortScore(btn)
|
||||
if self.nSortype == SortType.Score then
|
||||
self.nSortOrder = not self.nSortOrder
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
|
||||
else
|
||||
self.nSortype = SortType.Score
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClickGrid(nIdx, itemCtrl)
|
||||
local mapBuild = self._tbAllBuild[nIdx]
|
||||
if mapBuild.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BdConvert_LockTips"))
|
||||
return
|
||||
end
|
||||
local index = table.indexof(self.tbSelected, itemCtrl._mapData)
|
||||
if index ~= nil and 0 < index then
|
||||
table.remove(self.tbSelected, index)
|
||||
self:RerfeshSelected()
|
||||
return
|
||||
end
|
||||
if #self.tbSelected >= self.data.nMaxSub - self.data.nCurSub then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BdConvert_SelectedMaxTips"))
|
||||
return
|
||||
end
|
||||
table.insert(self.tbSelected, mapBuild)
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
function BdConvertBuildCtrl:OpenBuildDes(nIdx, itemCtrl)
|
||||
local mapBuild = self._tbAllBuild[nIdx]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertBuildDetail, mapBuild, self.actData)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBuildGridLock(nIdx, itemCtrl)
|
||||
local mapBuild = self._tbAllBuild[nIdx]
|
||||
local callback = function()
|
||||
itemCtrl:SetLockState(mapBuild.bLock)
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
self.actData:ChangeBuildLock(mapBuild.nBuildId, not mapBuild.bLock, callback)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_Submit()
|
||||
if #self.tbSelected == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BdConvert_SubmitNoneTips"))
|
||||
return
|
||||
end
|
||||
local bHasHighLevelBuild = false
|
||||
for _, mapBuild in ipairs(self.tbSelected) do
|
||||
if mapBuild.mapRank.Level >= self.contentCfg.DoubleCheckMinLevel then
|
||||
bHasHighLevelBuild = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local tbBuildId = {}
|
||||
for _, buildData in ipairs(self.tbSelected) do
|
||||
table.insert(tbBuildId, buildData.nBuildId)
|
||||
end
|
||||
if bHasHighLevelBuild then
|
||||
local TipsTime = LocalData.GetPlayerLocalData("BdConvert_BuildTips_Time")
|
||||
local _tipDay = 0
|
||||
if TipsTime ~= nil then
|
||||
_tipDay = tonumber(TipsTime)
|
||||
end
|
||||
local curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local fixedTimeStamp = curTimeStamp + newDayTime * 3600
|
||||
local nYear = tonumber(os.date("!%Y", fixedTimeStamp))
|
||||
local nMonth = tonumber(os.date("!%m", fixedTimeStamp))
|
||||
local nDay = tonumber(os.date("!%d", fixedTimeStamp))
|
||||
local nowD = nYear * 366 + nMonth * 31 + nDay
|
||||
if nowD == _tipDay then
|
||||
self.actData:RequestSubmitBuild(self.nOptionId, tbBuildId)
|
||||
self:ClearSelectedData()
|
||||
else
|
||||
local isSelectAgain = false
|
||||
local confirmCallback = function()
|
||||
if isSelectAgain then
|
||||
local _curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local _fixedTimeStamp = _curTimeStamp + newDayTime * 3600
|
||||
local _nYear = tonumber(os.date("!%Y", _fixedTimeStamp))
|
||||
local _nMonth = tonumber(os.date("!%m", _fixedTimeStamp))
|
||||
local _nDay = tonumber(os.date("!%d", _fixedTimeStamp))
|
||||
local _nowD = _nYear * 366 + _nMonth * 31 + _nDay
|
||||
LocalData.SetPlayerLocalData("BdConvert_BuildTips_Time", tostring(_nowD))
|
||||
end
|
||||
self:ClearSelectedData()
|
||||
self.actData:RequestSubmitBuild(self.nOptionId, tbBuildId)
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("BdConvert_CheckTips"),
|
||||
callbackConfirmAfterClose = confirmCallback,
|
||||
callbackAgain = againCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
else
|
||||
self.actData:RequestSubmitBuild(self.nOptionId, tbBuildId)
|
||||
self:ClearSelectedData()
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_ShowReward(tbItem, icon)
|
||||
if tbItem == nil or #tbItem == 0 then
|
||||
return
|
||||
end
|
||||
local tbItemData = {}
|
||||
for _, itemData in ipairs(tbItem) do
|
||||
table.insert(tbItemData, {
|
||||
id = itemData.Tid,
|
||||
count = itemData.Qty
|
||||
})
|
||||
end
|
||||
local callback = function()
|
||||
self:InitData()
|
||||
if self.data.nCurSub == self.data.nMaxSub then
|
||||
self:OnEvent_BackHome(PanelId.BdConvertBuildPanel)
|
||||
end
|
||||
end
|
||||
self._mapNode.BdConvertFinishPanel.gameObject:SetActive(true)
|
||||
self._mapNode.BdConvertFinishPanel:ShowReward(tbItemData, icon, callback)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_CloseReward()
|
||||
self._mapNode.BdConvertFinishPanel.gameObject:SetActive(false)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_BackHome(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertBuildPanel then
|
||||
self._mapNode.anim:Play("BdConvertBuildPanel_out")
|
||||
self._mapNode.bg_anim:Play("BdConvertBuildPanel_Bg_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BdConvertBuildPanel)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_Home(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertBuildPanel then
|
||||
PanelManager.Home()
|
||||
end
|
||||
end
|
||||
return BdConvertBuildCtrl
|
||||
@@ -0,0 +1,98 @@
|
||||
local BdConvertBuildDetailCtrl = class("BdConvertBuildDetailCtrl", BaseCtrl)
|
||||
BdConvertBuildDetailCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
TMPBuildSaveTime = {sComponentName = "TMP_Text"},
|
||||
btnRename = {},
|
||||
btn_Preference = {},
|
||||
txtBuildLock = {sComponentName = "TMP_Text"},
|
||||
btn_Lock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
btn_LockIcon = {sComponentName = "Button"},
|
||||
btnDelete = {},
|
||||
ani_root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
BuildDetail = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildDetailItemCtrl"
|
||||
},
|
||||
ContentList = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildContentCtrl"
|
||||
}
|
||||
}
|
||||
BdConvertBuildDetailCtrl._mapEventConfig = {}
|
||||
function BdConvertBuildDetailCtrl:InitPanel()
|
||||
self._mapNode.btnRename:SetActive(false)
|
||||
self._mapNode.btn_Preference:SetActive(false)
|
||||
self._mapNode.btnDelete:SetActive(false)
|
||||
if not self.mapBuild.bDetail then
|
||||
print("build数据错误 无详细数据")
|
||||
return
|
||||
end
|
||||
self._mapNode.BuildDetail:Refresh(self.mapBuild)
|
||||
self._mapNode.ContentList:Refresh(self.mapBuild)
|
||||
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuildSaveTime, string.format("<color=#5e89b4>保存时间:</color>%s", os.date("%Y/%m/%d %H:%M", math.floor(self.mapBuild.nBuildId / 1.0E9))))
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OpenConfirmHint()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:Awake()
|
||||
self.tbCoinRate = ConfigTable.GetConfigArray("StarTowerBuildTransformParas")
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.mapBuild = tbParam[1]
|
||||
self.actData = tbParam[2]
|
||||
end
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnEnable()
|
||||
self:InitPanel()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnDisable()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnRelease()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_Preference(btn)
|
||||
local tbPreferenceCheckIn = {}
|
||||
local tbPreferenceCheckOut = {}
|
||||
local callback = function()
|
||||
self._mapNode.btn_PreferenceIcon.interactable = self.mapBuild.bPreference
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLike, self.mapBuild.bPreference and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
if self.mapBuild.bPreference then
|
||||
table.insert(tbPreferenceCheckOut, self.mapBuild.nBuildId)
|
||||
else
|
||||
table.insert(tbPreferenceCheckIn, self.mapBuild.nBuildId)
|
||||
end
|
||||
PlayerData.Build:SetBuildPreference(tbPreferenceCheckIn, tbPreferenceCheckOut, callback)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_Lock(btn)
|
||||
local callback = function()
|
||||
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
self.actData:ChangeBuildLock(self.mapBuild.nBuildId, not self.mapBuild.bLock, callback)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_DeleteBuild(btn)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_Rename(btn)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_CharInfo(btn, nIndex)
|
||||
local nCharTid = self.mapBuild.tbChar[nIndex].nTid
|
||||
local tbChar = {
|
||||
self.mapBuild.tbChar[1].nTid,
|
||||
self.mapBuild.tbChar[2].nTid,
|
||||
self.mapBuild.tbChar[3].nTid
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, tbChar)
|
||||
end
|
||||
return BdConvertBuildDetailCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local BdConvertBuildDetailPanel = class("BdConvertBuildDetailPanel", BasePanel)
|
||||
BdConvertBuildDetailPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertBuildDetailPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertBuildDetailPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertBuildDetailCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertBuildDetailPanel:Awake()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnEnable()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnDisable()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnRelease()
|
||||
end
|
||||
return BdConvertBuildDetailPanel
|
||||
@@ -0,0 +1,165 @@
|
||||
local BdConvertBuildItemCtrl = class("BdConvertBuildItemCtrl", BaseCtrl)
|
||||
local PanelState = {
|
||||
Normal = 1,
|
||||
Delete = 2,
|
||||
Preference = 3
|
||||
}
|
||||
BdConvertBuildItemCtrl._mapNodeConfig = {
|
||||
img_SelectPreference = {},
|
||||
btn_LockIcon = {sComponentName = "Button"},
|
||||
btn_grid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Grid"
|
||||
},
|
||||
btn_Lock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
imgRareFrame = {sComponentName = "Image"},
|
||||
imgRareScore = {sComponentName = "Image"},
|
||||
txtBuildName = {sComponentName = "TMP_Text"},
|
||||
imgLike = {},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Sub"
|
||||
},
|
||||
imgCharIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgCharFrame = {nCount = 3, sComponentName = "Image"},
|
||||
txtPotentialCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgCharElement = {nCount = 3, sComponentName = "Image"},
|
||||
txtChar = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Char_Title"
|
||||
},
|
||||
txtDisc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_MainDisc_Title"
|
||||
},
|
||||
goDiscItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Build.BuildSimpleDiscItem"
|
||||
},
|
||||
objUnavailable = {},
|
||||
objUnavailableIcon = {sComponentName = "Image"},
|
||||
imgRareScoreMask = {sComponentName = "Image"},
|
||||
texUnavailable = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Build_NotAvailable"
|
||||
},
|
||||
imgUnavailable = {},
|
||||
imgBuildUsed = {},
|
||||
txtBuildUsed = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Used"
|
||||
},
|
||||
imgCharUsed = {},
|
||||
txtCharUsed = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Char_Used"
|
||||
},
|
||||
selectedIndex = {},
|
||||
txt_select_index = {sComponentName = "TMP_Text"},
|
||||
txt_select = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Selected"
|
||||
}
|
||||
}
|
||||
BdConvertBuildItemCtrl._mapEventConfig = {
|
||||
BdConvert_BuildRefreshIndex = "RefreshIndex",
|
||||
BdConvert_BuildCancleSelect = "CancleSelected"
|
||||
}
|
||||
function BdConvertBuildItemCtrl:RefreshGrid(mapData)
|
||||
self._mapData = mapData
|
||||
self:RefreshInfo()
|
||||
self:RefreshChar()
|
||||
self:RefreshDisc()
|
||||
self:CancleSelected()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshInfo()
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. self._mapData.mapRank.Id
|
||||
local sFrame = AllEnum.FrameType_New.BuildRankDB .. AllEnum.FrameColor_New[self._mapData.mapRank.Rarity]
|
||||
self:SetPngSprite(self._mapNode.imgRareScore, sScore)
|
||||
self:SetAtlasSprite(self._mapNode.imgRareFrame, "12_rare", sFrame)
|
||||
if self._mapData.sName == "" or self._mapData.sName == nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, ConfigTable.GetUIText("RoguelikeBuild_EmptyBuildName"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, self._mapData.sName)
|
||||
end
|
||||
self._mapNode.imgLike:SetActive(self._mapData.bPreference)
|
||||
self._mapNode.btn_LockIcon.interactable = self._mapData.bLock
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshChar()
|
||||
for i = 1, 3 do
|
||||
local nCharTid = self._mapData.tbChar[i].nTid
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharTid)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nCharTid)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharFrame[i], "12_rare", sFrame)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialCount[i], self._mapData.tbChar[i].nPotentialCount)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharElement[i], "12_rare", AllEnum.Char_Element[mapCharCfg.EET].icon)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshDisc()
|
||||
local tbDisc = self._mapData.tbDisc
|
||||
local nIndex = 1
|
||||
for _, nId in ipairs(tbDisc) do
|
||||
if nil ~= self._mapNode.goDiscItem[nIndex] and nIndex <= 3 then
|
||||
self._mapNode.goDiscItem[nIndex]:Init(nId)
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshIndex(mapData, nIndex)
|
||||
if mapData ~= self._mapData then
|
||||
return
|
||||
end
|
||||
self:Selected(nIndex)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:Init(parentCtrl)
|
||||
self._parentCtrl = parentCtrl
|
||||
end
|
||||
function BdConvertBuildItemCtrl:SetLockState(bLock)
|
||||
self._mapNode.btn_LockIcon.interactable = bLock
|
||||
end
|
||||
function BdConvertBuildItemCtrl:CancleSelected()
|
||||
self._mapNode.img_SelectPreference:SetActive(false)
|
||||
self._mapNode.selectedIndex:SetActive(false)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:Selected(nIndex)
|
||||
self._mapNode.img_SelectPreference:SetActive(true)
|
||||
self._mapNode.selectedIndex:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_select_index, nIndex)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:Awake()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnEnable()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnDisable()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnRelease()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnBtnClick_Grid(btn)
|
||||
if btn.Operate_Type == 0 then
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBtnClickGrid(nIndex, self)
|
||||
elseif btn.Operate_Type == 2 then
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OpenBuildDes(nIndex, self)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnBtnClick_Lock(btn)
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBuildGridLock(nIndex, self)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnBtnClick_Preference(btn)
|
||||
end
|
||||
return BdConvertBuildItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local BdConvertBuildPanel = class("BdConvertBuildPanel", BasePanel)
|
||||
BdConvertBuildPanel._bIsMainPanel = true
|
||||
BdConvertBuildPanel._bAddToBackHistory = true
|
||||
BdConvertBuildPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
BdConvertBuildPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertBuildPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertBuildPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertBuildCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertBuildPanel:Awake()
|
||||
end
|
||||
function BdConvertBuildPanel:OnEnable()
|
||||
end
|
||||
function BdConvertBuildPanel:OnAfterEnter()
|
||||
end
|
||||
function BdConvertBuildPanel:OnDisable()
|
||||
end
|
||||
function BdConvertBuildPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildPanel:OnRelease()
|
||||
end
|
||||
return BdConvertBuildPanel
|
||||
@@ -0,0 +1,167 @@
|
||||
local BdConvertCellCtrl = class("BdConvertCellCtrl", BaseCtrl)
|
||||
local minHeight = 85.26
|
||||
BdConvertCellCtrl._mapNodeConfig = {
|
||||
bg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
img_unOpen = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_unOpenTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_UnopenTips"
|
||||
},
|
||||
txt_unOpen = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Unopen"
|
||||
},
|
||||
txt_finishTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Finish"
|
||||
},
|
||||
icon = {sComponentName = "Image"},
|
||||
txt_title = {sComponentName = "TMP_Text"},
|
||||
bg_reward = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_reward = {sComponentName = "TMP_Text"},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
icon_com = {},
|
||||
img_finish = {},
|
||||
btnGrid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
btnGrid_None = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
txt_btn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_ToBuild"
|
||||
},
|
||||
txt_tip = {sComponentName = "TMP_Text"},
|
||||
icon_star = {},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
target = {nCount = 3}
|
||||
}
|
||||
function BdConvertCellCtrl:Awake()
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
function BdConvertCellCtrl:OnDisable()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
function BdConvertCellCtrl:SetData(actId, optionId)
|
||||
self.nActId = actId
|
||||
self.nOptionId = optionId
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.contentData = self.actData:GetBdDataBy(self.nOptionId)
|
||||
local contentCfg = ConfigTable.GetData("BdConvertContent", self.nOptionId)
|
||||
if contentCfg == nil then
|
||||
return
|
||||
end
|
||||
local data = self.actData:GetBdDataBy(optionId)
|
||||
if data == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.img_unOpen.gameObject:SetActive(data.bIsOpen == false)
|
||||
if contentCfg.Icon ~= "" then
|
||||
self:SetPngSprite(self._mapNode.icon, contentCfg.Icon)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_title, contentCfg.Des)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_reward, ConfigTable.GetUIText("BdConvert_RewardTitle") .. " " .. data.nCurSub .. "/" .. data.nMaxSub)
|
||||
self.tbItem = {}
|
||||
local tbReward = decodeJson(contentCfg.BasicReward)
|
||||
local tbTemp = {}
|
||||
for key, value in pairs(tbReward) do
|
||||
tbTemp[tonumber(key)] = tonumber(value)
|
||||
end
|
||||
for _, rewardId in ipairs(contentCfg.BasicRewardPreview) do
|
||||
table.insert(self.tbItem, {
|
||||
itemId = rewardId,
|
||||
itemCount = tbTemp[rewardId]
|
||||
})
|
||||
end
|
||||
self._mapNode.svItem:Init(#self.tbItem, self, self.OnRewardItemGridRefresh, self.OnGridBtnClick)
|
||||
self._mapNode.icon_com:SetActive(data.nCurSub == data.nMaxSub)
|
||||
self._mapNode.img_finish:SetActive(data.nCurSub == data.nMaxSub)
|
||||
self._mapNode.icon_star:SetActive(data.nCurSub ~= data.nMaxSub)
|
||||
self._mapNode.txt_unOpen.gameObject:SetActive(data.bIsOpen == false)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.target[i].gameObject:SetActive(false)
|
||||
end
|
||||
for index, optionId in ipairs(contentCfg.ConvertConditionList) do
|
||||
if index <= 3 then
|
||||
local txt_target = self._mapNode.target[index].transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local targetCfg = ConfigTable.GetData("BdConvertCondition", optionId)
|
||||
if targetCfg ~= nil then
|
||||
NovaAPI.SetTMPText(txt_target, targetCfg.RequestDes)
|
||||
self._mapNode.target[index].gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
local nCount = 0
|
||||
local tbAllbuild = self.actData:GetAllBuildByOpId(self.nOptionId)
|
||||
if tbAllbuild ~= nil then
|
||||
nCount = #tbAllbuild
|
||||
end
|
||||
self._mapNode.btnGrid_None.gameObject:SetActive(nCount == 0)
|
||||
self._mapNode.btnGrid.gameObject:SetActive(nCount ~= 0)
|
||||
if nCount == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_tip, ConfigTable.GetUIText("BdConvert_BuildCountTips1"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_tip, orderedFormat(ConfigTable.GetUIText("BdConvert_BuildCountTips2"), nCount))
|
||||
end
|
||||
local bGet = self.contentData.nCurSub == self.contentData.nMaxSub
|
||||
if bGet then
|
||||
self._mapNode.btnGrid_None.gameObject:SetActive(false)
|
||||
self._mapNode.btnGrid.gameObject:SetActive(false)
|
||||
self._mapNode.txt_tip.gameObject:SetActive(false)
|
||||
self._mapNode.txt_finishTips.gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.txt_finishTips.gameObject:SetActive(false)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.bg_reward)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.Content)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local curHeight = self._mapNode.Content.sizeDelta.y
|
||||
local rectTransform = self.gameObject:GetComponent("RectTransform")
|
||||
rectTransform.sizeDelta = Vector2(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y + curHeight - minHeight)
|
||||
self._mapNode.bg.sizeDelta = Vector2(self._mapNode.bg.sizeDelta.x, self._mapNode.bg.sizeDelta.y + curHeight - minHeight)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.bg)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function BdConvertCellCtrl:OnRewardItemGridRefresh(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
local goItem = goGrid.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local bGet = self.contentData.nCurSub == self.contentData.nMaxSub
|
||||
self.tbItemIns[instanceId]:SetItem(itemId, nil, self.tbItem[nDataIndex].itemCount, nil, bGet)
|
||||
end
|
||||
function BdConvertCellCtrl:OnGridBtnClick(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
UTILS.ClickItemGridWithTips(itemId, goGrid.transform:Find("btnGrid").transform, true, true, false)
|
||||
end
|
||||
function BdConvertCellCtrl:OnBtnClick_JumpTo()
|
||||
EventManager.Hit("BdConvert_JumpToBuildPanel", self.nOptionId)
|
||||
end
|
||||
return BdConvertCellCtrl
|
||||
@@ -0,0 +1,223 @@
|
||||
local BdConvertCtrl = class("BdConvertCtrl", BaseCtrl)
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local barMinX = -378
|
||||
local barMaxX = 0
|
||||
BdConvertCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
Actor2D = {
|
||||
sNodeName = "----Actor2D----"
|
||||
},
|
||||
btn_starTower = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoStarTower"
|
||||
},
|
||||
anim = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
bg_anim = {sNodeName = "----BG----", sComponentName = "Animator"},
|
||||
imgBgLevelSelect = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
cell = {},
|
||||
ListContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ListCanvasGroup = {
|
||||
sNodeName = "ListContent",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txt_starTower = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_GoToStarTower"
|
||||
}
|
||||
}
|
||||
BdConvertCtrl._mapEventConfig = {
|
||||
BdConvertQuestUpdate = "InitQuest",
|
||||
BdConvert_JumpToBuildPanel = "OnEvent_JumpTo",
|
||||
[EventId.UIBackConfirm] = "OnEvent_BackHome",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home"
|
||||
}
|
||||
BdConvertCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_BdConvert_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function BdConvertCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.bInAnim_In = false
|
||||
end
|
||||
function BdConvertCtrl:OnEnable()
|
||||
if self._panel.bPlayedAnim_In then
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.anim:Play("BdConVertPanel_in_02")
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_out_02")
|
||||
self.bInAnim_In = true
|
||||
self:AddTimer(1, 0.7, function()
|
||||
self.bInAnim_In = false
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end, true, true, true)
|
||||
else
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.anim:Play("BdConVertPanel_in_01")
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_in_01")
|
||||
self.bInAnim_In = true
|
||||
self:AddTimer(1, 0.67, function()
|
||||
self.bInAnim_In = false
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end, true, true, true)
|
||||
end
|
||||
self._panel.bPlayedAnim_In = true
|
||||
local bUseL2D = LocalSettingData.mapData.UseLive2D
|
||||
self._mapNode.imgBgLevelSelect.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(self:GetPanelId(), self._mapNode.imgBgLevelSelect, 9102)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, self:GetPanelId(), 9102)
|
||||
end
|
||||
local bResult = self.actData:CheckBuildsData()
|
||||
if bResult then
|
||||
self:UpdateOptionList()
|
||||
else
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self.actData:RequestAllBuildData(function()
|
||||
if not self.bInAnim_In then
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end
|
||||
self:UpdateOptionList()
|
||||
end)
|
||||
end
|
||||
self:InitQuest()
|
||||
end
|
||||
function BdConvertCtrl:OnDisable()
|
||||
Actor2DManager.UnsetBoardNPC2D()
|
||||
if self.GridIns ~= nil then
|
||||
for _, ctrl in pairs(self.GridIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.GridIns = {}
|
||||
if self.tbListCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbListCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbListCtrl = {}
|
||||
end
|
||||
function BdConvertCtrl:UpdateOptionList()
|
||||
self.bdConfig = self.actData:GetBdConvertConfig()
|
||||
self.optionList = self.bdConfig.OptionList
|
||||
local sort = function(a, b)
|
||||
local contentA_Data = self.actData:GetBdDataBy(a)
|
||||
local contentB_Data = self.actData:GetBdDataBy(b)
|
||||
local bFinish_A = contentA_Data.nCurSub == contentA_Data.nMaxSub
|
||||
local bFinish_B = contentB_Data.nCurSub == contentB_Data.nMaxSub
|
||||
if bFinish_A and not bFinish_B then
|
||||
return false
|
||||
elseif not bFinish_A and bFinish_B then
|
||||
return true
|
||||
end
|
||||
return a < b
|
||||
end
|
||||
table.sort(self.optionList, sort)
|
||||
self.tbGridSize = {}
|
||||
for _, optionId in ipairs(self.optionList) do
|
||||
local contentCfg = ConfigTable.GetData("BdConvertContent", optionId)
|
||||
if contentCfg ~= nil then
|
||||
local height = 0
|
||||
if #contentCfg.ConvertConditionList >= 3 then
|
||||
height = 360
|
||||
else
|
||||
height = 310
|
||||
end
|
||||
table.insert(self.tbGridSize, height)
|
||||
end
|
||||
end
|
||||
delChildren(self._mapNode.ListContent.gameObject)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.ListCanvasGroup, 0)
|
||||
if self.tbListCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbListCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbListCtrl = {}
|
||||
self.GridIns = {}
|
||||
for _, opId in ipairs(self.optionList) do
|
||||
local go = instantiate(self._mapNode.cell, self._mapNode.ListContent)
|
||||
local ctrl = self:BindCtrlByNode(go, "Game.UI.Activity.BdConvert._500001.BdConvertCellCtrl")
|
||||
ctrl:SetData(self.nActId, opId)
|
||||
table.insert(self.tbListCtrl, ctrl)
|
||||
go:SetActive(true)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.ListCanvasGroup, 1)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.ListContent)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function BdConvertCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function BdConvertCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertQuestPanel, self.nActId)
|
||||
end
|
||||
function BdConvertCtrl:OnBtnClick_GoStarTower()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.LevelMenu, 2)
|
||||
end
|
||||
function BdConvertCtrl:OnEvent_JumpTo(nOptionId)
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_in_02")
|
||||
self._mapNode.anim:Play("BdConVertPanel_out_01")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.17)
|
||||
self:AddTimer(1, 0.17, function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertBuildPanel, self.nActId, nOptionId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function BdConvertCtrl:OnEvent_BackHome(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertPanel then
|
||||
self._mapNode.anim:Play("BdConVertPanel_out_02")
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_out_01")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.23)
|
||||
self:AddTimer(1, 0.23, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BdConvertPanel)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function BdConvertCtrl:OnEvent_Home(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertPanel then
|
||||
PanelManager.Home()
|
||||
end
|
||||
end
|
||||
return BdConvertCtrl
|
||||
@@ -0,0 +1,144 @@
|
||||
local BdConvertFinishCtrl = class("BdConvertFinishCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
BdConvertFinishCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_black"
|
||||
},
|
||||
btn_close = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
HideRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnSkip = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Skip"
|
||||
},
|
||||
btnGrid = {},
|
||||
img_icon = {sComponentName = "Image"},
|
||||
txt_tips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_RewardTips"
|
||||
},
|
||||
goItemList1 = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
BdConvertFinishCtrl._mapEventConfig = {}
|
||||
BdConvertFinishCtrl._mapRedDotConfig = {}
|
||||
function BdConvertFinishCtrl:RefreshNormal()
|
||||
for _, v in ipairs(self.tbReward) do
|
||||
local nItemId = v.id
|
||||
local goItem = instantiate(self._mapNode.btnGrid, self._mapNode.goItemList1)
|
||||
local ctrlObj = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if mapCfg then
|
||||
if mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin then
|
||||
ctrlObj:SetChar(nItemId, v.count, nil, v.rewardType)
|
||||
else
|
||||
ctrlObj:SetItem(nItemId, mapCfg.Rarity, v.count, nil, nil, v.rewardType and v.rewardType == AllEnum.RewardType.First, v.rewardType and v.rewardType == AllEnum.RewardType.Three, true, false, false, v.rewardType and v.rewardType == AllEnum.RewardType.Extra)
|
||||
end
|
||||
end
|
||||
local btnGrid = goItem:GetComponent("UIButton")
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
local cbSelect = function()
|
||||
self:OnSelectItem(nItemId, btnGrid, v.nHasCount)
|
||||
EventManager.Hit("Stop_InfinityTowerAutoNextLv")
|
||||
end
|
||||
btnGrid.onClick:AddListener(cbSelect)
|
||||
goItem.gameObject:SetActive(true)
|
||||
NovaAPI.SetCanvasGroupAlpha(goItem:GetComponent("CanvasGroup"), 0)
|
||||
end
|
||||
self:PlayNormalAni()
|
||||
end
|
||||
function BdConvertFinishCtrl:OnSelectItem(itemId, btn, nHasCount)
|
||||
UTILS.ClickItemGridWithTips(itemId, btn.transform, false, true, false, nHasCount)
|
||||
end
|
||||
function BdConvertFinishCtrl:PlayNormalAni()
|
||||
self.sequence = DOTween.Sequence()
|
||||
self.sequence:AppendInterval(0.18)
|
||||
for i = 1, self.nRewardCount do
|
||||
self.sequence:AppendCallback(function()
|
||||
local goGrid = self._mapNode.goItemList1:GetChild(i - 1)
|
||||
if goGrid then
|
||||
NovaAPI.SetCanvasGroupAlpha(goGrid:GetComponent("CanvasGroup"), 1)
|
||||
local ani = goGrid.transform:Find("AnimRoot/aniGrid"):GetComponent("Animator")
|
||||
ani:Play("receiveprops_icon_t_in")
|
||||
end
|
||||
end)
|
||||
self.sequence:AppendInterval(0.14)
|
||||
end
|
||||
self.sequence.onComplete = dotween_callback_handler(self, function()
|
||||
self:CloseSkip()
|
||||
end)
|
||||
self.sequence:SetUpdate(true)
|
||||
end
|
||||
function BdConvertFinishCtrl:ShowReward(tbReward, sIconPath, callback)
|
||||
self.tbReward = tbReward
|
||||
self.nRewardCount = #tbReward
|
||||
self.callback = callback
|
||||
local sort = function(a, b)
|
||||
local cfgA = ConfigTable.GetData_Item(a.id)
|
||||
local cfgB = ConfigTable.GetData_Item(b.id)
|
||||
local rarityA = cfgA.Rarity
|
||||
local rarityB = cfgB.Rarity
|
||||
local typeA = cfgA.Type
|
||||
local typeB = cfgB.Type
|
||||
if a.rewardType ~= nil ~= (b.rewardType ~= nil) then
|
||||
return a.rewardType ~= nil and b.rewardType == nil
|
||||
elseif a.rewardType and b.rewardType and a.rewardType ~= b.rewardType then
|
||||
return a.rewardType < b.rewardType
|
||||
elseif rarityA ~= rarityB then
|
||||
return rarityA < rarityB
|
||||
elseif typeA ~= typeB then
|
||||
return typeA < typeB
|
||||
elseif a.count ~= b.count then
|
||||
return a.count > b.count
|
||||
else
|
||||
return a.id < b.id
|
||||
end
|
||||
end
|
||||
table.sort(self.tbReward, sort)
|
||||
self:RefreshNormal()
|
||||
self:SetPngSprite(self._mapNode.img_icon:GetComponent("Image"), sIconPath)
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.HideRoot:SetActive(true)
|
||||
self._mapNode.aniRoot:Play("receiveprops_t_in")
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_gacha_reward")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
end
|
||||
function BdConvertFinishCtrl:CloseSkip()
|
||||
self._mapNode.btnSkip.gameObject:SetActive(false)
|
||||
self._mapNode.btn_close.interactable = true
|
||||
end
|
||||
function BdConvertFinishCtrl:OnBtnClick_Close()
|
||||
delChildren(self._mapNode.goItemList1)
|
||||
EventManager.Hit("BdConvert_FinishPanelClose")
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
function BdConvertFinishCtrl:OnBtnClick_Skip(btn)
|
||||
if self.sequence then
|
||||
self.sequence:Kill()
|
||||
self.sequence = nil
|
||||
end
|
||||
for i = 1, self.nRewardCount do
|
||||
local goGrid = self._mapNode.goItemList1:GetChild(i - 1)
|
||||
if goGrid then
|
||||
NovaAPI.SetCanvasGroupAlpha(goGrid:GetComponent("CanvasGroup"), 1)
|
||||
end
|
||||
end
|
||||
self:CloseSkip()
|
||||
end
|
||||
return BdConvertFinishCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local BdConvertPanel = class("BdConvertPanel", BasePanel)
|
||||
BdConvertPanel._bIsMainPanel = true
|
||||
BdConvertPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
BdConvertPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertPanel:Awake()
|
||||
end
|
||||
function BdConvertPanel:OnEnable()
|
||||
end
|
||||
function BdConvertPanel:OnAfterEnter()
|
||||
end
|
||||
function BdConvertPanel:OnDisable()
|
||||
end
|
||||
function BdConvertPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertPanel:OnRelease()
|
||||
end
|
||||
return BdConvertPanel
|
||||
@@ -0,0 +1,143 @@
|
||||
local BdConvertQuestCtrl = class("BdConvertQuestCtrl", BaseCtrl)
|
||||
local barMinX = -750
|
||||
local barMaxX = 0
|
||||
BdConvertQuestCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
animator = {sNodeName = "quest", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_QuestTitle"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnFullClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txt_socreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Score"
|
||||
},
|
||||
txt_score = {sComponentName = "TMP_Text"},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btn_GetAllReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetAllReward"
|
||||
},
|
||||
btn_GetAllReward_None = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetAllReward"
|
||||
},
|
||||
txt_GetAll = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_GetQuestReward"
|
||||
}
|
||||
}
|
||||
BdConvertQuestCtrl._mapEventConfig = {}
|
||||
BdConvertQuestCtrl._mapRedDotConfig = {}
|
||||
function BdConvertQuestCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self:InitData()
|
||||
end
|
||||
function BdConvertQuestCtrl:OnEnable()
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnDestory()
|
||||
if self.tbItemCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BdConvertQuestCtrl:InitData()
|
||||
self.tbItemCtrl = {}
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.bdConfig = self.actData:GetBdConvertConfig()
|
||||
self:InitQuest()
|
||||
self:UpdateScore()
|
||||
local bHasComQuest = self.actData:CheckHasComQuest()
|
||||
self._mapNode.btn_GetAllReward.gameObject:SetActive(bHasComQuest)
|
||||
self._mapNode.btn_GetAllReward_None.gameObject:SetActive(not bHasComQuest)
|
||||
end
|
||||
function BdConvertQuestCtrl:InitQuest()
|
||||
self.questIdList = self.actData:GetQuestIdList()
|
||||
self._mapNode.sv:Init(#self.questIdList, self, self.OnGridRefresh)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local instanceId = goGrid:GetInstanceID()
|
||||
local nId = self.questIdList[nIndex]
|
||||
local questData = self.actData:GetQuestDataById(nId)
|
||||
local img_Received = goGrid.transform:Find("GameObject/AnimRoot/Root/img_Received")
|
||||
local btn_item = goGrid.transform:Find("GameObject/AnimRoot/Root/btn_item"):GetComponent("UIButton")
|
||||
local item = goGrid.transform:Find("GameObject/AnimRoot/Root/btn_item/AnimRoot/item")
|
||||
if self.tbItemCtrl[instanceId] == nil then
|
||||
self.tbItemCtrl[instanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local txtTarget = goGrid.transform:Find("GameObject/AnimRoot/Root/txt_target"):GetComponent("TMP_Text")
|
||||
local txt_com1 = goGrid.transform:Find("GameObject/AnimRoot/txt_com1"):GetComponent("TMP_Text")
|
||||
local txt_com2 = goGrid.transform:Find("GameObject/AnimRoot/txt_com2"):GetComponent("TMP_Text")
|
||||
local bar = goGrid.transform:Find("GameObject/AnimRoot/Root/imgBarBg/rtBarFill/imgMainBarFill"):GetComponent("RectTransform")
|
||||
local img_state1 = goGrid.transform:Find("GameObject/AnimRoot/Root/img_state1").gameObject
|
||||
local img_state2 = goGrid.transform:Find("GameObject/AnimRoot/Root/img_state2").gameObject
|
||||
local img_state3 = goGrid.transform:Find("GameObject/AnimRoot/Root/img_state3").gameObject
|
||||
img_state1:SetActive(questData.nState == AllEnum.ActQuestStatus.Complete)
|
||||
img_state2:SetActive(questData.nState == AllEnum.ActQuestStatus.Received)
|
||||
img_state3:SetActive(questData.nState == AllEnum.ActQuestStatus.UnComplete)
|
||||
img_Received.gameObject:SetActive(questData.nState == AllEnum.ActQuestStatus.Received)
|
||||
btn_item.onClick:RemoveAllListeners()
|
||||
local questConfig = ConfigTable.GetData("BdConvertRewardGroup", questData.nId)
|
||||
local tbReward = decodeJson(questConfig.Rewards)
|
||||
local itemId = 0
|
||||
local itemCount = 0
|
||||
for k, v in pairs(tbReward) do
|
||||
itemId = tonumber(k)
|
||||
itemCount = tonumber(v)
|
||||
end
|
||||
btn_item.onClick:AddListener(function()
|
||||
UTILS.ClickItemGridWithTips(itemId, btn_item.transform, true, false, false)
|
||||
end)
|
||||
self.tbItemCtrl[instanceId]:SetItem(itemId, nil, itemCount, false, questData.nState == AllEnum.ActQuestStatus.Received, false, false)
|
||||
NovaAPI.SetTMPText(txtTarget, questConfig.Des)
|
||||
if questData.nState == AllEnum.ActQuestStatus.UnComplete then
|
||||
NovaAPI.SetTMPText(txt_com1, tostring(questData.nCur) .. "/" .. tostring(questData.nMax))
|
||||
NovaAPI.SetTMPText(txt_com2, tostring(questData.nCur) .. "/" .. tostring(questData.nMax))
|
||||
else
|
||||
NovaAPI.SetTMPText(txt_com1, ConfigTable.GetUIText("BdConvert_QuestFinish"))
|
||||
NovaAPI.SetTMPText(txt_com2, ConfigTable.GetUIText("BdConvert_QuestFinish"))
|
||||
end
|
||||
txt_com1.gameObject:SetActive(questData.nState ~= AllEnum.ActQuestStatus.Received)
|
||||
txt_com2.gameObject:SetActive(questData.nState == AllEnum.ActQuestStatus.Received)
|
||||
bar.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (questData.nCur / questData.nMax), bar.anchoredPosition.y)
|
||||
end
|
||||
function BdConvertQuestCtrl:UpdateScore()
|
||||
local nCurScore = self.actData:GetScore()
|
||||
local nMaxScore = self.bdConfig.ScoreItemLimit
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_score, string.format("<color=#D19C62>%s</color>/%s", nCurScore, nMaxScore))
|
||||
end
|
||||
function BdConvertQuestCtrl:OnBtnClick_Close()
|
||||
self._mapNode.animator:Play("t_window_04_t_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
self:AddTimer(1, 0.3, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BdConvertQuestPanel)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnBtnClick_GetAllReward()
|
||||
local callback = function()
|
||||
self:InitData()
|
||||
end
|
||||
self.actData:RequestReceiveQuest(callback)
|
||||
end
|
||||
return BdConvertQuestCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local BdConvertQuestPanel = class("BdConvertQuestPanel", BasePanel)
|
||||
BdConvertQuestPanel._bIsMainPanel = false
|
||||
BdConvertQuestPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
BdConvertQuestPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertQuestCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertQuestPanel:Awake()
|
||||
end
|
||||
function BdConvertQuestPanel:OnEnable()
|
||||
end
|
||||
function BdConvertQuestPanel:OnAfterEnter()
|
||||
end
|
||||
function BdConvertQuestPanel:OnDisable()
|
||||
end
|
||||
function BdConvertQuestPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertQuestPanel:OnRelease()
|
||||
end
|
||||
return BdConvertQuestPanel
|
||||
@@ -0,0 +1,182 @@
|
||||
local BdConvertActCtrl = class("BdConvertActCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local barMinX = -378
|
||||
local barMaxX = 0
|
||||
BdConvertActCtrl._mapNodeConfig = {
|
||||
txt_time = {sComponentName = "TMP_Text"},
|
||||
txt_des = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_DesTitle"
|
||||
},
|
||||
btn_des = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_go = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_EnterActivity"
|
||||
},
|
||||
btn_go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_RewardPre"
|
||||
},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgBgLevelSelect = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
}
|
||||
}
|
||||
BdConvertActCtrl._mapEventConfig = {BdConvertQuestUpdate = "InitQuest"}
|
||||
BdConvertActCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_BdConvert_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function BdConvertActCtrl:RefreshRemainTime()
|
||||
if self.actData.actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.txt_time.transform.parent.gameObject:SetActive(false)
|
||||
else
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
end
|
||||
local sTimeStr = self:GetTimeText(remainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_time, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
|
||||
end
|
||||
end
|
||||
function BdConvertActCtrl:GetTimeText(remainTime)
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function BdConvertActCtrl:InitItem()
|
||||
local rewardData = ConfigTable.GetData("BdConvertControl", self.nActId)
|
||||
if rewardData == nil then
|
||||
return
|
||||
end
|
||||
self.tbReward = rewardData.RewardsShow
|
||||
self.tbItemIns = {}
|
||||
self._mapNode.svItem:Init(#self.tbReward, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
end
|
||||
function BdConvertActCtrl:OnGridRefresh(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
local goItem = go.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbItemIns[instanceId]:SetItem(itemId)
|
||||
end
|
||||
function BdConvertActCtrl:OnGridBtnClick(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("btnGrid"), true, false, false)
|
||||
end
|
||||
function BdConvertActCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function BdConvertActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
self:InitItem()
|
||||
self:InitQuest()
|
||||
local bUseL2D = LocalSettingData.mapData.UseLive2D
|
||||
self._mapNode.imgBgLevelSelect.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.BdConvertActPanel, self._mapNode.imgBgLevelSelect, 9102)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, PanelId.BdConvertActPanel, 9102)
|
||||
end
|
||||
end
|
||||
function BdConvertActCtrl:ClearActivity()
|
||||
Actor2DManager.UnsetBoardNPC2D()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
function BdConvertActCtrl:OnBtnClick_Detail()
|
||||
local config = ConfigTable.GetData("BdConvertControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = config.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
})
|
||||
end
|
||||
function BdConvertActCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertQuestPanel, self.nActId)
|
||||
end
|
||||
function BdConvertActCtrl:OnBtnClick_Go()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
self.actData:RequestAllBuildData(function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertPanel, self.nActId)
|
||||
end)
|
||||
end
|
||||
return BdConvertActCtrl
|
||||
@@ -0,0 +1,140 @@
|
||||
local CookieActCtrl = class("CookieActCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
CookieActCtrl._mapNodeConfig = {
|
||||
btnEnter = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Enter"
|
||||
},
|
||||
txtBtnEnter = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Settings_Btn_Go"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ActDetail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
txtLabelPreview = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Daily_Quest_Reward_Tip_Title"
|
||||
},
|
||||
txtRemainTime = {sComponentName = "TMP_Text"},
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
function CookieActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshTimeout()
|
||||
self.mapActCtrl = ConfigTable.GetData("CookieControl", self.actData:GetActId())
|
||||
if self.mapActCtrl ~= nil then
|
||||
local rewardData = self.mapActCtrl.RewardsShow
|
||||
local tbReward = decodeJson(rewardData)
|
||||
self.tbPreviewItem = tbReward
|
||||
end
|
||||
self._mapNode.svItem:Init(#self.tbPreviewItem, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
local nStartTime = self.actData:GetActOpenTime() or 0
|
||||
local nEndTime = self.actData:GetActEndTime() or 0
|
||||
local sStartTime = os.date("%m.%d", nStartTime)
|
||||
local sEndTime = os.date("%m.%d", nEndTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sStartTime .. " - " .. sEndTime)
|
||||
end
|
||||
function CookieActCtrl:OnGridRefresh(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemData = self.tbPreviewItem[nDataIndex]
|
||||
if itemData == nil then
|
||||
return
|
||||
end
|
||||
local goItem = go.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
if goItem == nil then
|
||||
return
|
||||
end
|
||||
local itemCtrl = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
if itemCtrl ~= nil then
|
||||
itemCtrl:SetItem(itemData)
|
||||
end
|
||||
end
|
||||
function CookieActCtrl:OnGridBtnClick(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemData = self.tbPreviewItem[nDataIndex]
|
||||
if itemData == nil then
|
||||
return
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(itemData[1], go.transform, true, false, false)
|
||||
end
|
||||
function CookieActCtrl:UnInit()
|
||||
end
|
||||
function CookieActCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
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.txtRemainTime, sTimeStr)
|
||||
end
|
||||
function CookieActCtrl:OnBtnClick_Enter(...)
|
||||
local nRandom = math.random(28, 29)
|
||||
local nActId = self.actData:GetActId()
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CookieGamePanel, nActId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, nRandom, func)
|
||||
end
|
||||
function CookieActCtrl:OnBtnClick_ActDetail(...)
|
||||
if self.mapActCtrl == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCtrl.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function CookieActCtrl:ClearActivity()
|
||||
end
|
||||
return CookieActCtrl
|
||||
@@ -0,0 +1,46 @@
|
||||
local JointDrillActCtrl_01 = class("JointDrillActCtrl_01", BaseCtrl)
|
||||
JointDrillActCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
JointDrillActCtrl_01._mapEventConfig = {
|
||||
PlayJointDrillActAnim = "OnEvent_PlayAnim"
|
||||
}
|
||||
function JointDrillActCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl_01:InitActData(actData)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.JointDrill.JointDrillActCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData)
|
||||
end
|
||||
function JointDrillActCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function JointDrillActCtrl_01:OnEvent_PlayAnim(sAnim, callback)
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {sAnim})
|
||||
self.animRoot:Play(sAnim, 0, 0)
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl_01:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function JointDrillActCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
return JointDrillActCtrl_01
|
||||
@@ -0,0 +1,149 @@
|
||||
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillActCtrl._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnWaitStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnEvent_WaitStart"
|
||||
},
|
||||
txtBtnWaitStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Act_Wait_Start"
|
||||
},
|
||||
imgBtnMask = {},
|
||||
btnStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtBtnStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Act_Goto"
|
||||
},
|
||||
txtActDesc = {sComponentName = "TMP_Text"},
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
txtFuncLock = {sComponentName = "TMP_Text"},
|
||||
txtBeta = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Beta_Tip"
|
||||
}
|
||||
}
|
||||
JointDrillActCtrl._mapEventConfig = {}
|
||||
function JointDrillActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.mapActCfg = self.actData:GetJointDrillActCfg()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActDesc, self.mapActCfg.DescText)
|
||||
self:StartActTimer()
|
||||
local bPlayCond, sTips = self.actData:CheckActJumpCond()
|
||||
self._mapNode.txtFuncLock.gameObject:SetActive(not bPlayCond)
|
||||
if not bPlayCond then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFuncLock, sTips)
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function JointDrillActCtrl:StartActTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
local nOpenTime = self.actData:GetActOpenTime()
|
||||
local nCloseTime = self.actData:GetActCloseTime()
|
||||
local nStartTime = nOpenTime + self.mapActCfg.DrillStartTime
|
||||
local nEndTime = nStartTime + self.mapActCfg.DrillDurationTime
|
||||
local nStatus = 0
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local sTime = ""
|
||||
local nRemainTime = 0
|
||||
if nCurTime < nStartTime then
|
||||
nStatus = AllEnum.JointDrillActStatus.WaitStart
|
||||
nRemainTime = math.max(nStartTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Time"), self:GetTimeStr(nRemainTime))
|
||||
elseif nCurTime >= nStartTime and nCurTime < nEndTime then
|
||||
nStatus = AllEnum.JointDrillActStatus.Start
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Start_Time"), self:GetTimeStr(nRemainTime))
|
||||
else
|
||||
nStatus = AllEnum.JointDrillActStatus.WaitClose
|
||||
nRemainTime = math.max(nCloseTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Close_Time"), self:GetTimeStr(nRemainTime))
|
||||
end
|
||||
if nRemainTime <= 0 and self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
self._mapNode.btnStart.gameObject:SetActive(nStatus ~= AllEnum.JointDrillActStatus.WaitStart)
|
||||
self._mapNode.btnWaitStart.gameObject:SetActive(nStatus == AllEnum.JointDrillActStatus.WaitStart)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function JointDrillActCtrl:OnEvent_WaitStart()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Tip"))
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Start()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect, self.actData.nActId)
|
||||
end)
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Detail()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCfg.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
return JointDrillActCtrl
|
||||
@@ -0,0 +1,28 @@
|
||||
local LoginRewardCtrl_01 = class("LoginRewardCtrl_01", BaseCtrl)
|
||||
LoginRewardCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
LoginRewardCtrl_01._mapEventConfig = {}
|
||||
function LoginRewardCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl_01:InitActData(actData)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginRewardCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData)
|
||||
end
|
||||
function LoginRewardCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function LoginRewardCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
return LoginRewardCtrl_01
|
||||
@@ -0,0 +1,134 @@
|
||||
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
LoginRewardPopUpCtrl_01._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
goRewardList = {},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_PopUp_Tip"
|
||||
}
|
||||
}
|
||||
LoginRewardPopUpCtrl_01._mapEventConfig = {}
|
||||
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
|
||||
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
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(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshActData()
|
||||
self.nActId = self._panel.nActId
|
||||
self.actData = self._panel.actData
|
||||
self.remainTimer = nil
|
||||
self:RefreshRewardList()
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshRewardList()
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nMaxDay = #self._mapNode.goRewardItem
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
v.gameObject:SetActive(tbRewardList[k] ~= nil)
|
||||
if tbRewardList[k] ~= nil then
|
||||
v:SetRewardItem(k, tbRewardList[k], k == nMaxDay)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:PlayOutAnim()
|
||||
local nAnimLength = 0
|
||||
if self.animRoot ~= nil then
|
||||
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_out"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
return nAnimLength
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnEnable()
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_in"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
|
||||
local bOpen = self.actData:CheckActivityOpen()
|
||||
if not bOpen then
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
|
||||
callbackConfirm = callback
|
||||
})
|
||||
return
|
||||
end
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if not canReceive then
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback)
|
||||
end
|
||||
return LoginRewardPopUpCtrl_01
|
||||
@@ -0,0 +1,146 @@
|
||||
local LoginRewardCtrl = class("LoginRewardCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginRewardCtrl._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
}
|
||||
}
|
||||
LoginRewardCtrl._mapEventConfig = {}
|
||||
function LoginRewardCtrl:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardCtrl:RefreshRewardList()
|
||||
self.tbRewardList = {}
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nMaxDay = #self._mapNode.goRewardItem
|
||||
local nReceiveDay = self.actData:GetCanReceive()
|
||||
local nActual = self.actData:GetReceived()
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
self.tbRewardList[k] = {}
|
||||
local mapReward = tbRewardList[k]
|
||||
v.gameObject:SetActive(mapReward ~= nil)
|
||||
if mapReward ~= nil then
|
||||
v:SetRewardItem(k, mapReward, k == nMaxDay, nReceiveDay == nActual and k == nActual + 1)
|
||||
for i = 1, 3 do
|
||||
local nTid = mapReward["RewardId" .. i]
|
||||
local nCount = mapReward["Qty" .. i]
|
||||
if nTid ~= 0 then
|
||||
table.insert(self.tbRewardList[k], {nTid = nTid, nCount = nCount})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshRewardList()
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl:Awake()
|
||||
end
|
||||
function LoginRewardCtrl:OnEnable()
|
||||
end
|
||||
function LoginRewardCtrl:OnDisable()
|
||||
end
|
||||
function LoginRewardCtrl:OnDestroy()
|
||||
end
|
||||
function LoginRewardCtrl:OnBtnClick_Detail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function LoginRewardCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbRewardList[nIndex] ~= nil then
|
||||
if #self.tbRewardList[nIndex] == 1 then
|
||||
local nTid = self.tbRewardList[nIndex][1].nTid
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.gameObject.transform, true, true, false)
|
||||
else
|
||||
local tbReward = {}
|
||||
for _, v in ipairs(self.tbRewardList[nIndex]) do
|
||||
local rewardData = {
|
||||
[1] = v.nTid,
|
||||
[5] = v.nCount
|
||||
}
|
||||
table.insert(tbReward, rewardData)
|
||||
end
|
||||
EventManager.Hit("ShowActRewardList", tbReward)
|
||||
end
|
||||
end
|
||||
end
|
||||
return LoginRewardCtrl
|
||||
@@ -0,0 +1,52 @@
|
||||
local LoginRewardItemCtrl = class("LoginRewardItemCtrl", BaseCtrl)
|
||||
LoginRewardItemCtrl._mapNodeConfig = {
|
||||
imgCanReceiveBg = {},
|
||||
imgBg = {},
|
||||
imgPlusBg = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtItemCount = {sComponentName = "TMP_Text"},
|
||||
imgDay = {nCount = 2, sComponentName = "Image"},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
goReceived = {},
|
||||
txtReceived = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Received"
|
||||
},
|
||||
imgCanReceive = {},
|
||||
txtCanReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Can_Receive"
|
||||
},
|
||||
imgNextReceive = {},
|
||||
txtNextReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Next_Receive"
|
||||
},
|
||||
goParticle = {sNodeName = "UIParticle"}
|
||||
}
|
||||
LoginRewardItemCtrl._mapEventConfig = {}
|
||||
LoginRewardItemCtrl._mapRedDotConfig = {}
|
||||
function LoginRewardItemCtrl:SetRewardItem(nDay, mapReward, bFinalDay, bNextDay)
|
||||
for _, v in ipairs(self._mapNode.imgDay) do
|
||||
self:SetAtlasSprite(v, "05_number", "zs_activity_02_num_" .. nDay)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapReward.RewardIcon or "")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemCount, orderedFormat(ConfigTable.GetUIText("LoginReward_Reward_Count"), mapReward.RewardCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, mapReward.RewardDesc)
|
||||
self._mapNode.imgCanReceive.gameObject:SetActive(mapReward.Status == 1)
|
||||
self._mapNode.imgCanReceiveBg.gameObject:SetActive(mapReward.Status == 1)
|
||||
self._mapNode.goReceived.gameObject:SetActive(mapReward.Status == 2)
|
||||
self._mapNode.imgNextReceive.gameObject:SetActive(bNextDay)
|
||||
self._mapNode.imgPlusBg.gameObject:SetActive(mapReward.DisRare)
|
||||
self._mapNode.goParticle.gameObject:SetActive(mapReward.DisRare and mapReward.Status ~= 2)
|
||||
self._mapNode.imgBg.gameObject:SetActive(not mapReward.DisRare)
|
||||
self.tbRewardList = {}
|
||||
for i = 1, 3 do
|
||||
local nTid = mapReward["RewardId" .. i]
|
||||
local nCount = mapReward["Qty" .. i]
|
||||
if nTid ~= 0 then
|
||||
table.insert(self.tbRewardList, {nTid = nTid, nCount = nCount})
|
||||
end
|
||||
end
|
||||
end
|
||||
return LoginRewardItemCtrl
|
||||
@@ -0,0 +1,85 @@
|
||||
local LoginRewardPopUpCtrl = class("LoginRewardPopUpCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
LoginRewardPopUpCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
imgBlurMask = {},
|
||||
rtContent = {
|
||||
sNodeName = "---Content---",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
LoginRewardPopUpCtrl._mapEventConfig = {
|
||||
RefreshLoginRewardPanel = "OnEvent_RefreshLoginRewardPanel"
|
||||
}
|
||||
LoginRewardPopUpCtrl._mapRedDotConfig = {}
|
||||
local sPrefabFolder = "UI_Activity/%s.prefab"
|
||||
function LoginRewardPopUpCtrl:ShowLoginReward()
|
||||
if self.tbActivityList == nil or #self.tbActivityList == 0 then
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.LoginRewardPopUp)
|
||||
if nil ~= self.callback then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
local actData = table.remove(self.tbActivityList, 1)
|
||||
self._panel.nActId = actData:GetActId()
|
||||
self._panel.actData = PlayerData.Activity:GetActivityDataById(self._panel.nActId)
|
||||
if nil ~= self._panel.actData then
|
||||
self:RefreshActContent()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl:RefreshActContent()
|
||||
self:ResetActContent()
|
||||
local mapActCfg = ConfigTable.GetData("LoginRewardControl", self._panel.nActId)
|
||||
if mapActCfg ~= nil then
|
||||
local sPrefabPath = string.format(sPrefabFolder, mapActCfg.PopUpUIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.LoginReward.%s.LoginRewardPopUpCtrl_01", "_" .. self._panel.nActId)
|
||||
self.curPopUpCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.curPopUpCtrl:RefreshActData()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl:ResetActContent()
|
||||
if nil ~= self.curPopUpCtrl then
|
||||
destroy(self.curPopUpCtrl.gameObject)
|
||||
self:UnbindCtrlByNode(self.curPopUpCtrl)
|
||||
end
|
||||
self.curPopUpCtrl = nil
|
||||
end
|
||||
function LoginRewardPopUpCtrl:Awake()
|
||||
self:ResetActContent()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.tbActivityList = tbParam[1]
|
||||
self.callback = tbParam[2]
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnEnable()
|
||||
self._mapNode.rtContent.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurMask.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.imgBlurMask.gameObject:SetActive(true)
|
||||
self._mapNode.rtContent.gameObject:SetActive(true)
|
||||
self:ShowLoginReward()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnEvent_RefreshLoginRewardPanel()
|
||||
if self.curPopUpCtrl == nil then
|
||||
self:ShowLoginReward()
|
||||
else
|
||||
self._panel.actData = PlayerData.Activity:GetActivityDataById(self._panel.nActId)
|
||||
self.curPopUpCtrl:RefreshActData()
|
||||
local nAnimTime = self.curPopUpCtrl:PlayOutAnim()
|
||||
self:AddTimer(1, nAnimTime, "ShowLoginReward", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
end
|
||||
end
|
||||
return LoginRewardPopUpCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local LoginRewardPopUpPanel = class("LoginRewardPopUpPanel", BasePanel)
|
||||
LoginRewardPopUpPanel._bIsMainPanel = false
|
||||
LoginRewardPopUpPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "LoginRewardPopUp/LoginRewardPopUpPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardPopUpCtrl"
|
||||
}
|
||||
}
|
||||
function LoginRewardPopUpPanel:Awake()
|
||||
self.nActId = nil
|
||||
self.actData = nil
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnEnable()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnAfterEnter()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnRelease()
|
||||
end
|
||||
return LoginRewardPopUpPanel
|
||||
@@ -0,0 +1,138 @@
|
||||
local ActivityMiningCtrl = class("ActivityMiningCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local axeItemId = 0
|
||||
ActivityMiningCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
}
|
||||
}
|
||||
function ActivityMiningCtrl:OnDestory(...)
|
||||
self:UnInit()
|
||||
end
|
||||
function ActivityMiningCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:ShowAddAxeCount()
|
||||
self:RefreshTimeout()
|
||||
end
|
||||
function ActivityMiningCtrl:UnInit(...)
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Mining_Quest_Group, nil, self._mapNode.reddot_Task)
|
||||
end
|
||||
function ActivityMiningCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTimeout, sTimeStr)
|
||||
end
|
||||
function ActivityMiningCtrl:ShowAddAxeCount()
|
||||
local nActId = self.actData:GetActId()
|
||||
local data = PlayerData.Activity:GetActivityDataById(nActId)
|
||||
local nAddAxeCount = data:GetAddAxeCount()
|
||||
if 0 < nAddAxeCount then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
tbItem = {
|
||||
[1] = {nTid = axeItemId, nCount = nAddAxeCount}
|
||||
}
|
||||
})
|
||||
data:ResetAddAxeCount()
|
||||
end
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Go(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
local tbStoryConfig = self.actData:GetStoryConfigIdList()
|
||||
local nCurLevel = self.actData:GetLevel()
|
||||
local sNeedPlayAvgyId = 0
|
||||
local nStoryId = 0
|
||||
local tbAllData = self.actData:GetGroupStoryData()
|
||||
for _, v in pairs(tbStoryConfig) do
|
||||
if nCurLevel >= v.config.UnlockLayer then
|
||||
local temp = v.config.Id
|
||||
if not tbAllData[temp].bIsRead then
|
||||
sNeedPlayAvgyId = v.config.AvgId
|
||||
nStoryId = v.config.Id
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local bAvgReadState = true
|
||||
if tbAllData[nStoryId] ~= nil then
|
||||
bAvgReadState = false
|
||||
end
|
||||
if sNeedPlayAvgyId ~= 0 and not bAvgReadState then
|
||||
local callback = function(...)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
|
||||
self.actData:RequestFinishAvg(nStoryId)
|
||||
end
|
||||
local mapData = {
|
||||
nType = AllEnum.StoryAvgType.Plot,
|
||||
sAvgId = sNeedPlayAvgyId,
|
||||
nNodeId = nil,
|
||||
callback = callback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGame, nActId)
|
||||
end
|
||||
self.actData:RequestLevelData(0, callback)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Story(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameStory, nActId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Task(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameQuest, nActId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Shop(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
local tbConfig = ConfigTable.GetData("MiningControl", nActId)
|
||||
local nShopId = tbConfig.ShopId
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, nShopId)
|
||||
end
|
||||
function ActivityMiningCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityMiningCtrl
|
||||
@@ -0,0 +1,172 @@
|
||||
local PeriodicQuestCtrl_01 = class("PeriodicQuestCtrl_01", BaseCtrl)
|
||||
PeriodicQuestCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
goQuestProcess = {},
|
||||
txtProcess = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Process"
|
||||
},
|
||||
txtQuestProcess = {sComponentName = "TMP_Text"},
|
||||
btnReceiveFinal = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceiveFinal = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
imgCompleteFinal = {},
|
||||
txtComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
btnUnComplete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_UnComplete"
|
||||
},
|
||||
txtBtnUnComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
btnRewardPreview = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RewardPreview"
|
||||
},
|
||||
txtRewardName = {sComponentName = "TMP_Text"},
|
||||
btnCharDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CharPreview"
|
||||
}
|
||||
}
|
||||
PeriodicQuestCtrl_01._mapEventConfig = {
|
||||
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
|
||||
}
|
||||
function PeriodicQuestCtrl_01:RefreshActInfo()
|
||||
if self.activityCtrl ~= nil then
|
||||
self.activityCtrl:RefreshQuestList()
|
||||
end
|
||||
self:RefreshQuestProgress()
|
||||
self:RefreshQuestReward()
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
self.nShowType = perQuestActCfg.PreviewType
|
||||
self.nRewardId = 0
|
||||
if self.nShowType == GameEnum.itemType.Char then
|
||||
self.nRewardId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= self.nRewardId then
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(true)
|
||||
local charConfig = ConfigTable.GetData_Character(self.nRewardId)
|
||||
if charConfig ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardName, charConfig.Name)
|
||||
end
|
||||
end
|
||||
elseif self.nShowType == GameEnum.itemType.Disc then
|
||||
self.nRewardId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= self.nRewardId then
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(true)
|
||||
local itemCfg = ConfigTable.GetData_Item(self.nRewardId)
|
||||
if itemCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardName, itemCfg.Title)
|
||||
end
|
||||
end
|
||||
elseif self.nShowType == GameEnum.itemType.Item then
|
||||
self.nRewardId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= self.nRewardId then
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(true)
|
||||
local itemCfg = ConfigTable.GetData_Item(self.nRewardId)
|
||||
if itemCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardName, itemCfg.Title)
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:RefreshQuestProgress()
|
||||
local curProgress, allProgress, canReceive = self.actData:GetQuestProgress()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtQuestProcess, string.format("%s/%s", curProgress, allProgress))
|
||||
self.bAllReceive = curProgress == allProgress
|
||||
end
|
||||
function PeriodicQuestCtrl_01:RefreshQuestReward()
|
||||
self._mapNode.btnReceiveFinal.gameObject:SetActive(not self.actData:CheckFinalReward() and self.bAllReceive)
|
||||
self._mapNode.btnUnComplete.gameObject:SetActive(not self.bAllReceive)
|
||||
self._mapNode.imgCompleteFinal.gameObject:SetActive(self.actData:CheckFinalReward())
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:InitActData(actData, bResetGroup)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.PeriodicQuest.PeriodicQuestCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData, bResetGroup)
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:Awake()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:FadeIn()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:FadeOut()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnEnable()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnRelease()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_Receive()
|
||||
local callback = function()
|
||||
self:RefreshQuestReward()
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceiveFinalReward(self.nActId, callback)
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_UnComplete()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_UnComplete"))
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_RewardPreview()
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
local nShowType = perQuestActCfg.PreviewType
|
||||
if nShowType == GameEnum.itemType.Char then
|
||||
local nCharId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= nCharId then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GachaPreview, nCharId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnEvent_RefreshPeriodicAct(nActId)
|
||||
if nActId == self.nActId then
|
||||
self.bQuestAnim = false
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_CharPreview()
|
||||
if self.nRewardId == nil then
|
||||
return
|
||||
end
|
||||
if self.nShowType == GameEnum.itemType.Char then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, self.nRewardId)
|
||||
elseif self.nShowType == GameEnum.itemType.Item then
|
||||
local itemCfg = ConfigTable.GetData_Item(self.nRewardId)
|
||||
if itemCfg ~= nil then
|
||||
local sType = itemCfg.Stype
|
||||
if sType == GameEnum.itemStype.OutfitCYO then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscPreview, self.nRewardId, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return PeriodicQuestCtrl_01
|
||||
@@ -0,0 +1,259 @@
|
||||
local PeriodicQuestCtrl = class("PeriodicQuestCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
PeriodicQuestCtrl._mapNodeConfig = {
|
||||
loopSv = {
|
||||
sNodeName = "srGuideQuest",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtDays = {},
|
||||
PerActGroupItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.PeriodicQuest.PeriodicQuestGroupCtrl"
|
||||
},
|
||||
btnGroup = {
|
||||
sNodeName = "PerActGroupItem",
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Group"
|
||||
},
|
||||
btnGroupLock = {
|
||||
sNodeName = "btnGroupLock",
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GroupLock"
|
||||
},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnQuickRec = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_QuickRec"
|
||||
},
|
||||
txtBtnQuickRec = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Quick_Receive"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
PeriodicQuestCtrl._mapEventConfig = {}
|
||||
function PeriodicQuestCtrl:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
|
||||
end
|
||||
function PeriodicQuestCtrl:RefreshQuestList()
|
||||
self.tbAllQuestList = self.actData:GetQuestListByGroup()
|
||||
if nil == self.tbAllQuestList[self._panel.nSelectGroup] then
|
||||
printLog(string.format("任务列表为空!!!actId = %s, group = %s", self.nActId, self._panel.nSelectGroup))
|
||||
return
|
||||
end
|
||||
self.tbQuestList = self.tbAllQuestList[self._panel.nSelectGroup]
|
||||
table.sort(self.tbQuestList, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.Id < b.Id
|
||||
end
|
||||
return a.nStatus < b.nStatus
|
||||
end)
|
||||
for k, v in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbGridCtrl[k] = nil
|
||||
end
|
||||
if nil ~= self.tbQuestList then
|
||||
self.nPageCount = 0
|
||||
self._mapNode.loopSv:SetAnim(0.06)
|
||||
self._mapNode.loopSv:Init(#self.tbQuestList, self, self.OnGridRefresh, nil, false, self.GetGridPageCount)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
local _, _, canReceive = self.actData:GetQuestProgress()
|
||||
self._mapNode.btnQuickRec.gameObject:SetActive(0 < canReceive)
|
||||
for k, v in ipairs(self._mapNode.PerActGroupItem) do
|
||||
local nAllQuest, nReceivedQuest = self.actData:GetDayQuestStatus(k)
|
||||
v:RefreshStatus(nAllQuest <= nReceivedQuest and 0 < nReceivedQuest)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl:GetGridPageCount(pageCount)
|
||||
self.nPageCount = pageCount > #self.tbQuestList and #self.tbQuestList or pageCount
|
||||
end
|
||||
function PeriodicQuestCtrl:InitGroupList()
|
||||
local nCurDay = self.actData:GetCurOpenDay()
|
||||
self.nMaxOpenGroup = 0
|
||||
local tbNextOpenGroupList = {}
|
||||
if nil ~= CacheTable.GetData("_PeriodicQuestGroup", self.nActId) then
|
||||
local tbGroup = CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay]
|
||||
if nil ~= tbGroup then
|
||||
for _, v in ipairs(tbGroup) do
|
||||
if v > self.nMaxOpenGroup then
|
||||
self.nMaxOpenGroup = v
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil ~= CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay + 1] then
|
||||
for _, v in ipairs(CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay + 1]) do
|
||||
tbNextOpenGroupList[v] = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
local nSelectGroup = self.actData:GetCanReceiveRewardGroup()
|
||||
if 0 == nSelectGroup then
|
||||
nSelectGroup = self.nMaxOpenGroup
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.PerActGroupItem) do
|
||||
v:Init(self.nActId, k, self.nMaxOpenGroup)
|
||||
if nil ~= tbNextOpenGroupList[k] then
|
||||
local nHour = self.actData:GetNextDayOpenTime()
|
||||
if nHour < 1 then
|
||||
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_2") or "", 1))
|
||||
else
|
||||
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_1") or "", nHour))
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil == self._panel.nSelectGroup then
|
||||
self._panel.nSelectGroup = nSelectGroup
|
||||
end
|
||||
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(true)
|
||||
end
|
||||
function PeriodicQuestCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.PeriodicQuest.PeriodicQuestItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
|
||||
end
|
||||
function PeriodicQuestCtrl:InitActData(actData, bResetGroup)
|
||||
self.actData = actData
|
||||
if bResetGroup then
|
||||
self._panel.nSelectGroup = nil
|
||||
end
|
||||
self.nActId = actData:GetActId()
|
||||
self.bQuestAnim = false
|
||||
self:InitGroupList()
|
||||
local tbAllQuestList = self.actData:GetQuestListByGroup()
|
||||
if nil == tbAllQuestList[self._panel.nSelectGroup] then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1")
|
||||
})
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
return
|
||||
end
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
self.tbSequences = {}
|
||||
end
|
||||
function PeriodicQuestCtrl:FadeIn()
|
||||
end
|
||||
function PeriodicQuestCtrl:FadeOut()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnEnable()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function PeriodicQuestCtrl:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnRelease()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_Group(_, nIndex)
|
||||
if self._panel.nSelectGroup == nIndex then
|
||||
return
|
||||
end
|
||||
if nIndex > self.nMaxOpenGroup then
|
||||
return
|
||||
end
|
||||
if nil == self.tbAllQuestList[nIndex] or nil == next(self.tbAllQuestList[nIndex]) then
|
||||
printError(string.format("当前任务组下没有任务!!! 活动id = %d, 任务组 = %s", self.nActId, nIndex))
|
||||
return
|
||||
end
|
||||
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(false)
|
||||
if nil ~= self._mapNode.PerActGroupItem[nIndex] then
|
||||
self._mapNode.PerActGroupItem[nIndex]:SetSelect(true)
|
||||
end
|
||||
self._panel.nSelectGroup = nIndex
|
||||
self.bQuestAnim = true
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_GroupLock()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_Not_Open"))
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_Detail()
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = perQuestActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_QuickRec()
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshPeriodicAct", self.nActId)
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, callback)
|
||||
end
|
||||
return PeriodicQuestCtrl
|
||||
@@ -0,0 +1,54 @@
|
||||
local PeriodicQuestCtrl_02 = class("PeriodicQuestCtrl_02", BaseCtrl)
|
||||
PeriodicQuestCtrl_02._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
PeriodicQuestCtrl_02._mapEventConfig = {
|
||||
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
|
||||
}
|
||||
function PeriodicQuestCtrl_02:RefreshActInfo()
|
||||
if self.activityCtrl ~= nil then
|
||||
self.activityCtrl:RefreshQuestList()
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_02:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_02:InitActData(actData, bResetGroup)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.PeriodicQuest.PeriodicQuestCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData, bResetGroup)
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:Awake()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:FadeIn()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:FadeOut()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnEnable()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnRelease()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnEvent_RefreshPeriodicAct(nActId)
|
||||
if nActId == self.nActId then
|
||||
self.bQuestAnim = false
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
end
|
||||
return PeriodicQuestCtrl_02
|
||||
@@ -0,0 +1,56 @@
|
||||
local PeriodicQuestGroupCtrl = class("PeriodicQuestGroupCtrl", BaseCtrl)
|
||||
PeriodicQuestGroupCtrl._mapNodeConfig = {
|
||||
goNormal = {},
|
||||
goSelect = {},
|
||||
goLock = {},
|
||||
txt_Group = {sComponentName = "TMP_Text", nCount = 3},
|
||||
goTime = {},
|
||||
txtOpenTime = {sComponentName = "TMP_Text"},
|
||||
redDotGroup = {},
|
||||
imgComplete = {}
|
||||
}
|
||||
PeriodicQuestGroupCtrl._mapEventConfig = {}
|
||||
function PeriodicQuestGroupCtrl:Init(nActId, nGroup, nCurGroup)
|
||||
self.nActId = nActId
|
||||
self.nGroup = nGroup
|
||||
for _, v in ipairs(self._mapNode.txt_Group) do
|
||||
NovaAPI.SetTMPText(v, self.nGroup)
|
||||
end
|
||||
self._mapNode.goNormal.gameObject:SetActive(true)
|
||||
self._mapNode.goSelect.gameObject:SetActive(false)
|
||||
self._mapNode.goLock.gameObject:SetActive(false)
|
||||
self._mapNode.goTime.gameObject:SetActive(false)
|
||||
self._mapNode.redDotGroup.gameObject:SetActive(false)
|
||||
self.bUnlock = nGroup <= nCurGroup
|
||||
self:SetSelect(false)
|
||||
self._mapNode.goNormal.gameObject:SetActive(nGroup <= nCurGroup)
|
||||
self._mapNode.goLock.gameObject:SetActive(nCurGroup < nGroup)
|
||||
self:RegisterRedDot()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Periodic_Quest_Group, {
|
||||
self.nActId,
|
||||
self.nGroup
|
||||
}, self._mapNode.redDotGroup)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:SetTime(sTime)
|
||||
self._mapNode.goTime.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtOpenTime, sTime)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:SetSelect(bSelect)
|
||||
self.bSelect = bSelect
|
||||
self._mapNode.goNormal.gameObject:SetActive(not self.bSelect)
|
||||
self._mapNode.goSelect.gameObject:SetActive(self.bSelect)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:RefreshStatus(bAllReceived)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(bAllReceived and self.bUnlock)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:Awake()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:OnDisable()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:OnRelease()
|
||||
end
|
||||
return PeriodicQuestGroupCtrl
|
||||
@@ -0,0 +1,105 @@
|
||||
local PeriodicQuestItemCtrl = class("PeriodicQuestItemCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
PeriodicQuestItemCtrl._mapNodeConfig = {
|
||||
rtTitle = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtTitle = {sNodeName = "TMPTitle", sComponentName = "TMP_Text"},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtProcess = {sNodeName = "TMPProcess", sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
rtReward = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Jump"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
txtUnComplete = {
|
||||
sNodeName = "TMPUncomplete",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgCompleteMask = {},
|
||||
imgPoint = {}
|
||||
}
|
||||
PeriodicQuestItemCtrl._mapEventConfig = {}
|
||||
local totalLength = 520
|
||||
local totalHeight = 37
|
||||
function PeriodicQuestItemCtrl:SetData(nActId, mapData)
|
||||
self.nActId = nActId
|
||||
self.nQuestId = mapData.Id
|
||||
local nStatus = mapData.nStatus
|
||||
local questCfg = ConfigTable.GetData("PeriodicQuest", self.nQuestId)
|
||||
if nil ~= questCfg then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, questCfg.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProcess, string.format("%s/%s", mapData.nCurProcess, mapData.nTotalProcess))
|
||||
self.nJumpTo = questCfg.JumpTo
|
||||
self.rewardId = questCfg.Reward
|
||||
self._mapNode.rtReward:SetItem(questCfg.Reward, nil, questCfg.RewardQty, nil, nil, nil, nil, true)
|
||||
self._mapNode.txtUnComplete.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.UnComplete and questCfg.JumpTo == 0)
|
||||
self._mapNode.btnJump.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.UnComplete and questCfg.JumpTo ~= 0)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgCompleteMask.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgPoint.gameObject:SetActive(nStatus ~= AllEnum.ActQuestStatus.Received)
|
||||
if nStatus == AllEnum.ActQuestStatus.Received then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProcess, ConfigTable.GetUIText("PerActivity_Quest_Complete"))
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
|
||||
else
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(mapData.nCurProcess / mapData.nTotalProcess * totalLength, totalHeight)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTitle)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestItemCtrl:Awake()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:FadeIn()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:FadeOut()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnEnable()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnDisable()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnRelease()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnBtnClick_Reward(btn)
|
||||
if nil ~= self.rewardId then
|
||||
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnBtnClick_Receive()
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshPeriodicAct", self.nActId)
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, self.nQuestId, callback)
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnBtnClick_Jump()
|
||||
if nil ~= self.nJumpTo and 0 ~= self.nJumpTo then
|
||||
JumpUtil.JumpTo(self.nJumpTo)
|
||||
end
|
||||
end
|
||||
return PeriodicQuestItemCtrl
|
||||
@@ -0,0 +1,178 @@
|
||||
local ActivityTowerDefenseCtrl = class("ActivityTowerDefenseCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local barMinX = -365
|
||||
local barMaxX = 0
|
||||
local panelType = {
|
||||
Default = 1,
|
||||
QuestPanel = 2,
|
||||
StoryPanel = 3,
|
||||
DesPanel = 4
|
||||
}
|
||||
ActivityTowerDefenseCtrl._mapNodeConfig = {
|
||||
item = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 4
|
||||
},
|
||||
ItemBtn = {nCount = 4, sComponentName = "UIButton"},
|
||||
txt_time = {sComponentName = "TMP_Text"},
|
||||
txt_des = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_ActivityDes"
|
||||
},
|
||||
btn_des = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_go = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_EnterActivity"
|
||||
},
|
||||
btn_go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
go_nextLevel = {},
|
||||
txt_nextLevelTime = {sComponentName = "TMP_Text"},
|
||||
txtRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_RewardPre"
|
||||
}
|
||||
}
|
||||
ActivityTowerDefenseCtrl._mapEventConfig = {
|
||||
TowerDefenseQuestUpdate = "InitQuest",
|
||||
TowerDefenseCloseQuestPanel = "OnEvent_CloseQuestPanel"
|
||||
}
|
||||
ActivityTowerDefenseCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_TowerDefense_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function ActivityTowerDefenseCtrl:Awake()
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:RefreshRemainTime()
|
||||
if self.actData.actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.txt_time.transform.parent.gameObject:SetActive(false)
|
||||
else
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
end
|
||||
local sTimeStr = self:GetTimeText(remainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_time, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
|
||||
end
|
||||
local nextLevelTime = self.actData:GetNextLevelUnlockTime()
|
||||
if nextLevelTime == 0 then
|
||||
self._mapNode.go_nextLevel:SetActive(false)
|
||||
else
|
||||
self._mapNode.go_nextLevel:SetActive(true)
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local nextLevelRemainTime = nextLevelTime - curTime
|
||||
local sNextLevelTime = self:GetTimeText(nextLevelRemainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_nextLevelTime, orderedFormat(ConfigTable.GetUIText("TowerDef_LevelPreTime") or "", sNextLevelTime))
|
||||
end
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:GetTimeText(remainTime)
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitItem()
|
||||
for _, item in pairs(self._mapNode.item) do
|
||||
item.gameObject:SetActive(false)
|
||||
end
|
||||
local rewardData = ConfigTable.GetData("TowerDefenseControl", self.nActId)
|
||||
if rewardData == nil then
|
||||
return
|
||||
end
|
||||
local rewardData = rewardData.RewardsShow
|
||||
local tbReward = decodeJson(rewardData)
|
||||
for i = 1, math.min(4, #tbReward) do
|
||||
self._mapNode.item[i]:SetItem(tbReward[i])
|
||||
self._mapNode.item[i].gameObject:SetActive(true)
|
||||
self._mapNode.ItemBtn[i].onClick:RemoveAllListeners()
|
||||
self._mapNode.ItemBtn[i].onClick:AddListener(function()
|
||||
local nRewardId = tbReward[i]
|
||||
if nRewardId ~= nil then
|
||||
UTILS.ClickItemGridWithTips(nRewardId, self._mapNode.ItemBtn[i].transform, true, false, false)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
self:InitItem()
|
||||
self:InitQuest()
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:ClearActivity()
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:OnBtnClick_Detail()
|
||||
local config = ConfigTable.GetData("TowerDefenseControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = config.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
})
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TowerDefenseQuest, self.nActId)
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:OnBtnClick_Go()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TowerDefenseSelectPanel, self.nActId)
|
||||
end
|
||||
return ActivityTowerDefenseCtrl
|
||||
@@ -0,0 +1,314 @@
|
||||
local TrialCtrl = class("TrialCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
TrialCtrl._mapNodeConfig = {
|
||||
rawImgActor2D = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnTrialInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TrialInfo"
|
||||
},
|
||||
txtBtnTrialInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_TrialDetial"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_RewardInfo"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ItemTips"
|
||||
},
|
||||
item = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtChar = {},
|
||||
btnChar = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
imgSelectBg = {nCount = 4},
|
||||
goSelect = {nCount = 4},
|
||||
imgHead = {nCount = 4, sComponentName = "Image"},
|
||||
goCharRoot = {},
|
||||
btnTrial = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Trial"
|
||||
},
|
||||
btnGacha = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Gacha"
|
||||
},
|
||||
txtBtnGacha = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_GotoGacha"
|
||||
},
|
||||
txtBtnTrial = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_GotoTrial"
|
||||
},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
btnCharInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CharInfo"
|
||||
},
|
||||
imgElementIcon = {sComponentName = "Image"},
|
||||
txtElement = {sComponentName = "TMP_Text"},
|
||||
txtCharClass = {sComponentName = "TMP_Text"},
|
||||
imgAttackType = {sComponentName = "Image"}
|
||||
}
|
||||
TrialCtrl._mapEventConfig = {}
|
||||
function TrialCtrl:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function TrialCtrl:Refresh()
|
||||
self:RefreshCharList()
|
||||
self:RefreshCharInfo()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function TrialCtrl:RefreshCharInfo()
|
||||
local nCharId = self.tbCharId[self.nSelectIndex]
|
||||
local mapCfg = ConfigTable.GetData_Character(nCharId)
|
||||
local mapItem = ConfigTable.GetData_Item(nCharId)
|
||||
if not mapCfg or not mapItem then
|
||||
return
|
||||
end
|
||||
local nMaxStar = 6 - mapItem.Rarity
|
||||
self._mapNode.goStar:SetStar(0, nMaxStar)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapCfg.Name)
|
||||
local nEET = mapCfg.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon, "12_rare", AllEnum.ElementIconType.Icon .. nEET)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtElement, ConfigTable.GetUIText("T_Element_Attr_" .. nEET))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharClass, ConfigTable.GetUIText("Char_JobClass_" .. mapCfg.Class))
|
||||
if mapCfg.CharacterAttackType == GameEnum.characterAttackType.MELEE then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType, "10_ico", "zs_list_near")
|
||||
elseif mapCfg.CharacterAttackType == GameEnum.characterAttackType.RANGED then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType, "10_ico", "zs_list_far")
|
||||
end
|
||||
local nCharSkinId = ConfigTable.GetData_Character(nCharId).AdvanceSkinId
|
||||
Actor2DManager.SetActor2D(PanelId.TrialActivity, self._mapNode.rawImgActor2D, nCharId, nCharSkinId)
|
||||
end
|
||||
function TrialCtrl:RefreshReward()
|
||||
self.tbReward = {}
|
||||
local nGroupId = self.tbGroup[self.nSelectIndex]
|
||||
local mapCfg = ConfigTable.GetData("TrialGroup", nGroupId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local bReceived = self.actData:CheckGroupReceived(nGroupId)
|
||||
for i = 1, 3 do
|
||||
local nId = mapCfg["RewardId" .. i]
|
||||
if 0 < nId then
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(true)
|
||||
self._mapNode.item[i]:SetItem(nId, nil, mapCfg["Qty" .. i], nil, bReceived)
|
||||
table.insert(self.tbReward, nId)
|
||||
else
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TrialCtrl:RefreshCharList()
|
||||
local nCount = #self.tbCharId
|
||||
if nCount == 1 then
|
||||
self._mapNode.goCharRoot:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goCharRoot:SetActive(true)
|
||||
self._mapNode.rtChar:SetActive(nCount <= 4)
|
||||
self._mapNode.sv.gameObject:SetActive(4 < nCount)
|
||||
if nCount <= 4 then
|
||||
for i = 1, 4 do
|
||||
self._mapNode.btnChar[i].gameObject:SetActive(i <= nCount)
|
||||
if i <= nCount then
|
||||
local nCharId = self.tbCharId[i]
|
||||
local nCharSkinId = ConfigTable.GetData_Character(nCharId).AdvanceSkinId
|
||||
local sIcon = ConfigTable.GetData_CharacterSkin(nCharSkinId).Icon
|
||||
self:SetPngSprite(self._mapNode.imgHead[i], sIcon .. AllEnum.CharHeadIconSurfix.L)
|
||||
self._mapNode.goSelect[i]:SetActive(self.nSelectIndex == i)
|
||||
self._mapNode.imgSelectBg[i]:SetActive(self.nSelectIndex == i)
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.sv:Init(nCount, self, self.OnGridRefresh, self.OnGridClick)
|
||||
end
|
||||
end
|
||||
function TrialCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nCharId = self.tbCharId[nIndex]
|
||||
local nCharSkinId = ConfigTable.GetData_Character(nCharId).AdvanceSkinId
|
||||
local sIcon = ConfigTable.GetData_CharacterSkin(nCharSkinId).Icon
|
||||
local imgHead = goGrid.transform:Find("btnChar/AnimRoot/imgHead"):GetComponent("Image")
|
||||
local goSelect = goGrid.transform:Find("btnChar/AnimRoot/goSelect").gameObject
|
||||
local imgSelectBg = goGrid.transform:Find("btnChar/AnimRoot/imgSelectBg").gameObject
|
||||
self:SetPngSprite(imgHead, sIcon .. AllEnum.CharHeadIconSurfix.L)
|
||||
goSelect:SetActive(self.nSelectIndex == nIndex)
|
||||
imgSelectBg:SetActive(self.nSelectIndex == nIndex)
|
||||
end
|
||||
function TrialCtrl:OnGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if self.nSelectIndex == nIndex then
|
||||
return
|
||||
end
|
||||
goGrid.transform:Find("btnChar/AnimRoot/imgSelectBg").gameObject:SetActive(true)
|
||||
goGrid.transform:Find("btnChar/AnimRoot/goSelect").gameObject:SetActive(true)
|
||||
local sPathSelectBg = "Viewport/Content/" .. tostring(self.nSelectIndex - 1) .. "/btnChar/AnimRoot/imgSelectBg"
|
||||
local sPathSelect = "Viewport/Content/" .. tostring(self.nSelectIndex - 1) .. "/btnChar/AnimRoot/goSelect"
|
||||
local goSelectBg = self._mapNode.sv.transform:Find(sPathSelectBg)
|
||||
local goSelect = self._mapNode.sv.transform:Find(sPathSelect)
|
||||
if goSelectBg then
|
||||
goSelectBg.gameObject:SetActive(false)
|
||||
end
|
||||
if goSelect then
|
||||
goSelect.gameObject:SetActive(false)
|
||||
end
|
||||
self.nSelectIndex = nIndex
|
||||
self._mapNode.sv:SetScrollGridPos(gridIndex, 0.1, 1)
|
||||
self:RefreshCharInfo()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function TrialCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
PlayerData.Trial:SetTrialAct(self.nActId)
|
||||
self.nSelectIndex = 1
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("TrialControl", self.nActId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self.tbGacha = mapCfg.Gachas
|
||||
self.tbGroup = mapCfg.GroupIds
|
||||
self.tbCharId = {}
|
||||
for _, v in ipairs(self.tbGroup) do
|
||||
local mapGroup = ConfigTable.GetData("TrialGroup", v)
|
||||
if mapGroup then
|
||||
local mapTrial = ConfigTable.GetData("TrialCharacter", mapGroup.TrialChar)
|
||||
if mapTrial then
|
||||
table.insert(self.tbCharId, mapTrial.CharId)
|
||||
end
|
||||
end
|
||||
end
|
||||
self:Refresh()
|
||||
end
|
||||
function TrialCtrl:ClearActivity()
|
||||
Actor2DManager.UnsetActor2D()
|
||||
end
|
||||
function TrialCtrl:Awake()
|
||||
end
|
||||
function TrialCtrl:OnEnable()
|
||||
end
|
||||
function TrialCtrl:OnDisable()
|
||||
Actor2DManager.UnsetActor2D()
|
||||
end
|
||||
function TrialCtrl:OnDestroy()
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_Trial()
|
||||
PlayerData.Trial:SetSelectTrialGroup(self.tbGroup[self.nSelectIndex])
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialLevelSelect)
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_Gacha()
|
||||
local getInfoCallback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GachaSpin, self.tbGacha[self.nSelectIndex])
|
||||
end
|
||||
PlayerData.Gacha:GetGachaInfomation(getInfoCallback)
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_CharInfo()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, self.tbCharId[self.nSelectIndex])
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
if self.nSelectIndex == nIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.goSelect[self.nSelectIndex]:SetActive(false)
|
||||
self._mapNode.imgSelectBg[self.nSelectIndex]:SetActive(false)
|
||||
self._mapNode.goSelect[nIndex]:SetActive(true)
|
||||
self._mapNode.imgSelectBg[nIndex]:SetActive(true)
|
||||
self.nSelectIndex = nIndex
|
||||
self:RefreshCharInfo()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_TrialInfo()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = ConfigTable.GetUIText("Trial_DetailInfo")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_ItemTips(btn, nIndex)
|
||||
if self.tbReward[nIndex] then
|
||||
local mapData = {
|
||||
nTid = self.tbReward[nIndex],
|
||||
bShowDepot = true,
|
||||
bShowJumpto = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
end
|
||||
return TrialCtrl
|
||||
@@ -0,0 +1,429 @@
|
||||
local ActivityListCtrl = class("ActivityListCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
ActivityListCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
loopSv = {
|
||||
sNodeName = "sv",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
trSv = {sNodeName = "sv", sComponentName = "Transform"},
|
||||
rtContent = {
|
||||
sNodeName = "---Content---",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goRewardList = {
|
||||
sCtrlName = "Game.UI.MainlineEx.RewardListCtrl"
|
||||
}
|
||||
}
|
||||
ActivityListCtrl._mapEventConfig = {
|
||||
ShowActRewardList = "OnEvent_ShowActRewardList"
|
||||
}
|
||||
local sEntranceFolder_old = "UI_Activity/%s/%s.prefab"
|
||||
local sEntranceFolder = "UI_Activity/%s.prefab"
|
||||
local sActTypePath = {
|
||||
[GameEnum.activityType.PeriodicQuest] = "PeriodicQuest",
|
||||
[GameEnum.activityType.LoginReward] = "LoginReward",
|
||||
[GameEnum.activityType.Mining] = "Mining",
|
||||
[GameEnum.activityType.Trial] = "Trial",
|
||||
[GameEnum.activityType.Cookie] = "Cookie",
|
||||
[GameEnum.activityType.TowerDefense] = "TowerDefense",
|
||||
[GameEnum.activityType.JointDrill] = "JointDrill",
|
||||
[GameEnum.activityType.Advertise] = "Advertise",
|
||||
[GameEnum.activityType.Task] = "ActivityTask"
|
||||
}
|
||||
function ActivityListCtrl:InitActivityList(nCurActId)
|
||||
local tbActList = PlayerData.Activity:GetSortedActList()
|
||||
local tbActGroupList = PlayerData.Activity:GetSortedActGroupList()
|
||||
self.tbActList = {}
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
for k, v in pairs(tbActList) do
|
||||
table.insert(self.tbActList, {
|
||||
nType = AllEnum.ActivityMainType.Activity,
|
||||
actData = v
|
||||
})
|
||||
end
|
||||
for k, v in pairs(tbActGroupList) do
|
||||
table.insert(self.tbActList, {
|
||||
nType = AllEnum.ActivityMainType.ActivityGroup,
|
||||
actData = v
|
||||
})
|
||||
end
|
||||
if nil ~= self.tbActList then
|
||||
if nil ~= self.nSelectActId and nil ~= self.nSelectActMainType then
|
||||
local actData
|
||||
if self.nSelectActMainType == AllEnum.ActivityMainType.Activity then
|
||||
actData = PlayerData.Activity:GetActivityDataById(self.nSelectActId)
|
||||
elseif self.nSelectActMainType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
actData = PlayerData.Activity:GetActivityGroupDataById(self.nSelectActId)
|
||||
end
|
||||
local bOpen = false
|
||||
if nil ~= actData then
|
||||
if self.nSelectActMainType == AllEnum.ActivityMainType.Activity then
|
||||
bOpen = actData:CheckActivityOpen()
|
||||
elseif self.nSelectActMainType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
bOpen = actData:CheckActGroupShow()
|
||||
end
|
||||
end
|
||||
if nil == actData or not bOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_2")
|
||||
})
|
||||
self.nSelectActId = nil
|
||||
end
|
||||
end
|
||||
self.nSelectIndex = 1
|
||||
if self.nSelectActId ~= nil or nCurActId ~= nil then
|
||||
local nActId = self.nSelectActId == nil and nCurActId or self.nSelectActId
|
||||
for k, actData in ipairs(self.tbActList) do
|
||||
local actId = actData.nType == AllEnum.ActivityMainType.Activity and actData.actData:GetActId() or actData.actData:GetActGroupId()
|
||||
if nil ~= nActId and actId == nActId then
|
||||
self.nSelectIndex = k
|
||||
end
|
||||
end
|
||||
end
|
||||
self.nPageCount = 0
|
||||
self._mapNode.loopSv:Init(#self.tbActList, self, self.OnRefreshGrid, self.OnGridBtnClick, true, self.GetGridPageCount)
|
||||
self._mapNode.loopSv:SetScrollGridPos(self.nSelectIndex - 1, 0.5)
|
||||
self.bPlayAnim = false
|
||||
self:RefreshSelectActivity(false)
|
||||
end
|
||||
end
|
||||
function ActivityListCtrl:GetGridPageCount(nPageCount)
|
||||
self.nPageCount = nPageCount >= #self.tbActList and #self.tbActList or nPageCount
|
||||
end
|
||||
function ActivityListCtrl:OnRefreshGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if self.nPageCount > 0 and self.bPlayAnim then
|
||||
local trans = goGrid.transform:Find("btnGrid")
|
||||
local doTweenTime = 0.25
|
||||
local delayTime = (nIndex - 1) * 0.05
|
||||
trans.anchoredPosition = Vector2(0, -200)
|
||||
local sequence = DOTween.Sequence()
|
||||
sequence:Append(trans:DOAnchorPosY(0, doTweenTime):SetUpdate(true))
|
||||
sequence:SetUpdate(true):SetDelay(delayTime)
|
||||
self.nPageCount = self.nPageCount - 1
|
||||
end
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.ActivityList.ActivityTabCtrl")
|
||||
end
|
||||
goGrid.gameObject:SetActive(true)
|
||||
self.tbGridCtrl[nInstanceId]:Init(self.tbActList[nIndex])
|
||||
self.tbGridCtrl[nInstanceId]:SetSelect(nIndex == self.nSelectIndex)
|
||||
end
|
||||
function ActivityListCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if nIndex == self.nSelectIndex then
|
||||
return
|
||||
end
|
||||
local actData = self.tbActList[nIndex].actData
|
||||
local bOpen = self.tbActList[nIndex].nType == AllEnum.ActivityMainType.Activity and actData:CheckActivityOpen() or actData:CheckActGroupShow()
|
||||
if not bOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1")
|
||||
})
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
return
|
||||
end
|
||||
local goSelect = self._mapNode.trSv:Find("Viewport/Content/" .. self.nSelectIndex - 1)
|
||||
if goSelect then
|
||||
self.tbGridCtrl[goSelect.gameObject:GetInstanceID()]:SetSelect(false)
|
||||
end
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
self.nSelectIndex = nIndex
|
||||
self.tbGridCtrl[nInstanceID]:SetSelect(true)
|
||||
self:RefreshSelectActivity(true)
|
||||
end
|
||||
function ActivityListCtrl:AddPeriodicActivityCtrl(actData, bResetDay)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local perActCfg = actData:GetPerQuestCfg()
|
||||
local sCtrlFolder = sActTypePath[GameEnum.activityType.PeriodicQuest]
|
||||
if sCtrlFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder, perActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sCtrlFolder, perActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData, bResetDay)
|
||||
end
|
||||
function ActivityListCtrl:AddLoginRewardActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local mapActCfg = actData:GetLoginRewardControlCfg()
|
||||
local sCtrlFolder = sActTypePath[GameEnum.activityType.LoginReward]
|
||||
if sCtrlFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder, mapActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sCtrlFolder, mapActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddMiningActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local miningActCfg = actData:GetMiningCfg()
|
||||
local sFolder = sActTypePath[GameEnum.activityType.Mining]
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder_old, sFolder, miningActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, miningActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddTrialActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local mapActCfg = actData:GetTrialControlCfg()
|
||||
local sFolder = mapActCfg.UIAssets
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format("UI_Activity/%s/Entrance.prefab", sFolder)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, mapActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddCookieActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local mapActCfg = actData:GetCookieControlCfg()
|
||||
local sFolder = sActTypePath[GameEnum.activityType.Cookie]
|
||||
local sPrefabPath = string.format(sEntranceFolder_old, sFolder, mapActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, mapActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddTowerDefenseActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local towerDefenseActCfg = actData:GetActConfig()
|
||||
local sFolder = sActTypePath[GameEnum.activityType.TowerDefense]
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder_old, sFolder, towerDefenseActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, towerDefenseActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddJointDrillActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local jointDrillActCfg = actData:GetJointDrillActCfg()
|
||||
local sFolder = sActTypePath[GameEnum.activityType.JointDrill]
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder, jointDrillActCfg.DrillPrefab)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, jointDrillActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddActivityGroupCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActGroupId()]
|
||||
if nil == actCtrl then
|
||||
local actGroupCfg = actData:GetActGroupCfgData()
|
||||
local sFolder = actGroupCfg.UIAssetsPrefab
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format("UI_Activity/%s/Entrance.prefab", sFolder)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.ActivityTheme.%s.%s", sFolder, actGroupCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActGroupId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddAdvertisingActCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local sFolder = sActTypePath[GameEnum.activityType.Advertise]
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local adControlCfg = ConfigTable.GetData("AdControl", actData.nActId)
|
||||
local uiAssetPath = adControlCfg.UIAssets
|
||||
local sPrefabPath = string.format(sEntranceFolder, uiAssetPath)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local ctrlPath = adControlCfg.CtrlName
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sFolder, ctrlPath)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddActivityTaskActCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local sAssetsFolder = "_" .. actData:GetActId()
|
||||
local sCtrlFolder = sActTypePath[GameEnum.activityType.Task]
|
||||
if sCtrlFolder == nil then
|
||||
return
|
||||
end
|
||||
local adControlCfg = CacheTable.GetData("_ActivityTaskControl", actData.nActId)
|
||||
if adControlCfg == nil then
|
||||
return
|
||||
end
|
||||
local uiAssetPath = adControlCfg.UIAssets
|
||||
if uiAssetPath == "" then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder_old, sAssetsFolder, uiAssetPath)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local ctrlPath = adControlCfg.CtrlName
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", sCtrlFolder, ctrlPath)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:AddBdConvertActivityCtrl(actData)
|
||||
local actCtrl = self.tbActCtrlObj[actData:GetActId()]
|
||||
if nil == actCtrl then
|
||||
local BdConvertActCfg = actData:GetActConfig()
|
||||
local sFolder = "_" .. actData:GetActId()
|
||||
if sFolder == nil then
|
||||
return
|
||||
end
|
||||
local sPrefabPath = string.format(sEntranceFolder_old, sFolder, BdConvertActCfg.UIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.%s.%s", "BdConvert", BdConvertActCfg.CtrlName)
|
||||
actCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.tbActCtrlObj[actData:GetActId()] = actCtrl
|
||||
end
|
||||
actCtrl.gameObject:SetActive(true)
|
||||
actCtrl:InitActData(actData)
|
||||
end
|
||||
function ActivityListCtrl:RefreshSelectActivity(bResetDay)
|
||||
for _, v in pairs(self.tbActCtrlObj) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
local actData = self.tbActList[self.nSelectIndex]
|
||||
if nil == actData then
|
||||
return
|
||||
end
|
||||
self.nSelectActMainType = actData.nType
|
||||
if actData.nType == AllEnum.ActivityMainType.Activity then
|
||||
self.nSelectActId = actData.actData:GetActId()
|
||||
local actType = actData.actData:GetActType()
|
||||
if actType == GameEnum.activityType.PeriodicQuest then
|
||||
self:AddPeriodicActivityCtrl(actData.actData, bResetDay)
|
||||
elseif actType == GameEnum.activityType.LoginReward then
|
||||
self:AddLoginRewardActivityCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.Mining then
|
||||
self:AddMiningActivityCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.Trial then
|
||||
self:AddTrialActivityCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.Cookie then
|
||||
self:AddCookieActivityCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.TowerDefense then
|
||||
self:AddTowerDefenseActivityCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.JointDrill then
|
||||
self:AddJointDrillActivityCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.Advertise then
|
||||
self:AddAdvertisingActCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.Task then
|
||||
self:AddActivityTaskActCtrl(actData.actData)
|
||||
elseif actType == GameEnum.activityType.BDConvert then
|
||||
self:AddBdConvertActivityCtrl(actData.actData)
|
||||
end
|
||||
elseif actData.nType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
self.nSelectActId = actData.actData:GetActGroupId()
|
||||
self:AddActivityGroupCtrl(actData.actData)
|
||||
end
|
||||
if self.nSelectActId ~= nil then
|
||||
LocalData.SetPlayerLocalData("Activity_Tab_New_" .. self.nSelectActId, 1)
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_New_Tab, self.nSelectActId, false)
|
||||
end
|
||||
end
|
||||
function ActivityListCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self._mapNode.animRoot:Play("ActivityPanel_in")
|
||||
end
|
||||
function ActivityListCtrl:Awake()
|
||||
self.nSelectIndex = nil
|
||||
self.nSelectActId = nil
|
||||
self.nInitActId = nil
|
||||
self.bPlayAnim = true
|
||||
local tbParams = self:GetPanelParam()
|
||||
if type(tbParams) == "table" then
|
||||
self.nInitActId = tbParams[1]
|
||||
end
|
||||
self._mapNode.goRewardList.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityListCtrl:OnEnable()
|
||||
self.tbActCtrlObj = {}
|
||||
self.tbActList = {}
|
||||
self.tbGridCtrl = {}
|
||||
self:InitActivityList(self.nInitActId)
|
||||
end
|
||||
function ActivityListCtrl:OnDisable()
|
||||
self.tbActList = {}
|
||||
for _, v in pairs(self.tbActCtrlObj) do
|
||||
v:ClearActivity()
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbActCtrlObj = {}
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityListCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityListCtrl:OnEvent_ShowActRewardList(tbReward)
|
||||
self._mapNode.goRewardList:OpenPanel(tbReward)
|
||||
end
|
||||
return ActivityListCtrl
|
||||
@@ -0,0 +1,22 @@
|
||||
local ActivityListPanel = class("ActivityListPanel", BasePanel)
|
||||
ActivityListPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "ActivityList/ActivityListPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityList.ActivityListCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityListPanel:Awake()
|
||||
self.nSelectGroup = nil
|
||||
end
|
||||
function ActivityListPanel:OnEnable()
|
||||
end
|
||||
function ActivityListPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityListPanel:OnDisable()
|
||||
end
|
||||
function ActivityListPanel:OnDestroy()
|
||||
self.nSelectGroup = nil
|
||||
end
|
||||
function ActivityListPanel:OnRelease()
|
||||
end
|
||||
return ActivityListPanel
|
||||
@@ -0,0 +1,128 @@
|
||||
local ActivityPopUpCtrl = class("ActivityPopUpCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
ActivityPopUpCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goContent = {
|
||||
sNodeName = "---Content---"
|
||||
},
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
btnGoto = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGoto = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
PopUpRoot = {
|
||||
sNodeName = "---PopUpRoot---",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
ActivityPopUpCtrl._mapEventConfig = {}
|
||||
function ActivityPopUpCtrl:ShowPopUp()
|
||||
if self.tbPopUpAct == nil or #self.tbPopUpAct <= 0 then
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
self.popUpIndex = self.popUpIndex + 1
|
||||
self.nCurActId = table.remove(self.tbPopUpAct, 1)
|
||||
local popUpCfg = PlayerData.PopUp:GetPopUpConfigData(self.nCurActId)
|
||||
self.curType = popUpCfg.PopUpType
|
||||
if popUpCfg ~= nil then
|
||||
if self.tbPopUpCtrlObj ~= nil then
|
||||
if self.tbPopUpCtrlObj.go ~= nil then
|
||||
destroy(self.tbPopUpCtrlObj.go)
|
||||
end
|
||||
if self.tbPopUpCtrlObj.ctrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.tbPopUpCtrlObj.ctrl)
|
||||
end
|
||||
self.tbPopUpCtrlObj = {}
|
||||
end
|
||||
local popFloderPath = ""
|
||||
local ctrlFloderPath = ""
|
||||
if popUpCfg.PopUpType == GameEnum.PopUpType.ActivityGroup or popUpCfg.PopUpType == GameEnum.PopUpType.Activity then
|
||||
popFloderPath = "UI_Activity"
|
||||
ctrlFloderPath = "ActivityPopUp"
|
||||
elseif popUpCfg.PopUpType == GameEnum.PopUpType.OwnPopUP then
|
||||
popFloderPath = "UI"
|
||||
ctrlFloderPath = "OwnPopUp"
|
||||
end
|
||||
local sPrefabPath = string.format("%s/%s.prefab", popFloderPath, popUpCfg.PopUpRes)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.PopUpRoot)
|
||||
local ctrlName = popUpCfg.ScriptName
|
||||
local sCtrlPath = string.format("Game.UI.%s.%s", ctrlFloderPath, ctrlName)
|
||||
local popupCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
local callback = function()
|
||||
self:OnBtnClick_Close()
|
||||
end
|
||||
popupCtrl:ShowPopUp(self.nCurActId, callback, self.popUpIndex)
|
||||
self.tbPopUpCtrlObj = {go = goObj, ctrl = popupCtrl}
|
||||
local saveTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
if popUpCfg ~= nil then
|
||||
if popUpCfg.PopRefreshType == GameEnum.PopRefreshType.WeeklyFirst then
|
||||
saveTime = GetNextWeekRefreshTime()
|
||||
end
|
||||
LocalData.SetPlayerLocalData("Act_PopUp" .. self.nCurActId, saveTime)
|
||||
self._mapNode.btnGoto.gameObject:SetActive(popUpCfg.PopJumpType ~= GameEnum.PopJumpType.None)
|
||||
PlayerData.PopUp:ReleaseCachedPopUpData(popUpCfg.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityPopUpCtrl:IsPopUpType()
|
||||
return self.curType == GameEnum.PopUpType.ActivityGroup or self.curType == GameEnum.PopUpType.Activity or self.curType == GameEnum.PopUpType.OwnPopUP
|
||||
end
|
||||
function ActivityPopUpCtrl:Awake()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.tbPopUpAct = tbParam[1]
|
||||
self.callback = tbParam[2]
|
||||
end
|
||||
self.popUpIndex = 0
|
||||
end
|
||||
function ActivityPopUpCtrl:OnEnable()
|
||||
self._mapNode.goContent.gameObject:SetActive(false)
|
||||
self._mapNode.PopUpRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(0.1))
|
||||
self._mapNode.PopUpRoot.gameObject:SetActive(self:IsPopUpType())
|
||||
if self.tbPopUpCtrlObj.ctrl ~= nil and self.tbPopUpCtrlObj.ctrl.PlayOpenAnim ~= nil then
|
||||
self.tbPopUpCtrlObj.ctrl:PlayOpenAnim()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:ShowPopUp()
|
||||
end
|
||||
function ActivityPopUpCtrl:OnDisable()
|
||||
end
|
||||
function ActivityPopUpCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityPopUpCtrl:OnRelease()
|
||||
end
|
||||
function ActivityPopUpCtrl:OnBtnClick_Close()
|
||||
self:ShowPopUp()
|
||||
end
|
||||
function ActivityPopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
local popUpCfg = PlayerData.PopUp:GetPopUpConfigData(self.nCurActId)
|
||||
if nil ~= popUpCfg then
|
||||
if popUpCfg.PopJumpType == GameEnum.PopJumpType.ActivityJump then
|
||||
if popUpCfg.PopUpType == GameEnum.PopUpType.Activity then
|
||||
PlayerData.Activity:OpenActivityPanel(self.nCurActId)
|
||||
end
|
||||
elseif popUpCfg.PopJumpType == GameEnum.PopJumpType.NormalJump then
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return ActivityPopUpCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityPopUpPanel = class("ActivityPopUpPanel", BasePanel)
|
||||
ActivityPopUpPanel._bIsMainPanel = false
|
||||
ActivityPopUpPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "ActivityList/ActivityPopUpPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityList.ActivityPopUpCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityPopUpPanel:Awake()
|
||||
end
|
||||
function ActivityPopUpPanel:OnEnable()
|
||||
end
|
||||
function ActivityPopUpPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityPopUpPanel:OnDisable()
|
||||
end
|
||||
function ActivityPopUpPanel:OnDestroy()
|
||||
end
|
||||
function ActivityPopUpPanel:OnRelease()
|
||||
end
|
||||
return ActivityPopUpPanel
|
||||
@@ -0,0 +1,54 @@
|
||||
local ActivityTabCtrl = class("ActivityTabCtrl", BaseCtrl)
|
||||
ActivityTabCtrl._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
imgChoose = {},
|
||||
imgActTime = {},
|
||||
redDotActTab = {},
|
||||
redDotActNew = {}
|
||||
}
|
||||
ActivityTabCtrl._mapEventConfig = {}
|
||||
function ActivityTabCtrl:Init(actData)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(false)
|
||||
self.actData = actData.actData
|
||||
self.nType = actData.nType
|
||||
if actData.nType == AllEnum.ActivityMainType.Activity then
|
||||
self.nActId = self.actData:GetActId()
|
||||
elseif actData.nType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
self.nActId = self.actData:GetActGroupId()
|
||||
end
|
||||
local actCfg = actData.nType == AllEnum.ActivityMainType.Activity and self.actData:GetActCfgData() or self.actData:GetActGroupCfgData()
|
||||
self:SetPngSprite(self._mapNode.imgActivity, actCfg.TabBgRes)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgActivity)
|
||||
local endTime = actData.nType == AllEnum.ActivityMainType.Activity and self.actData:GetActEndTime() or self.actData:GetActGroupEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
self._mapNode.imgActTime.gameObject:SetActive(0 < endTime and remainTime <= 259200)
|
||||
self:RegisterRedDotNode()
|
||||
end
|
||||
function ActivityTabCtrl:SetSelect(bSelect)
|
||||
self._mapNode.imgChoose.gameObject:SetActive(bSelect)
|
||||
end
|
||||
function ActivityTabCtrl:RegisterRedDotNode()
|
||||
if self.nType == AllEnum.ActivityMainType.Activity then
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Tab, self.nActId, self._mapNode.redDotActTab)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_New_Tab, self.nActId, self._mapNode.redDotActNew)
|
||||
elseif self.nType == AllEnum.ActivityMainType.ActivityGroup then
|
||||
if not self.actData:IsUnlock() then
|
||||
self._mapNode.redDotActTab:SetActive(false)
|
||||
self._mapNode.redDotActNew:SetActive(false)
|
||||
else
|
||||
local HasRedDot = RedDotManager.GetValid(RedDotDefine.Activity_Group, {
|
||||
self.nActId
|
||||
})
|
||||
local HasNew = RedDotManager.GetValid(RedDotDefine.Activity_New_Tab, {
|
||||
self.nActId
|
||||
})
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_New_Tab, self.nActId, HasNew and not HasRedDot)
|
||||
self._mapNode.redDotActTab.gameObject:SetActive(HasRedDot)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_New_Tab, self.nActId, self._mapNode.redDotActNew)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTabCtrl:OnDisable()
|
||||
end
|
||||
return ActivityTabCtrl
|
||||
@@ -0,0 +1,156 @@
|
||||
local ActivityDream_10102PopUpCtrl = class("ActivityDream_10102PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityDream_10102PopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivityDream_10102PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityDream_10102PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityDream_10102PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityDream_10102PopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityDream_10102PopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityDream_10102PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityDream_10102PopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityDream_10102PopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivityDream_10102PopUpCtrl
|
||||
@@ -0,0 +1,157 @@
|
||||
local ActivityJointDrillPopUpCtrl = class("ActivityJointDrillPopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityJointDrillPopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto_1"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
},
|
||||
txtBeta = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Beta_Tip"
|
||||
}
|
||||
}
|
||||
ActivityJointDrillPopUpCtrl._mapEventConfig = {}
|
||||
function ActivityJointDrillPopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actCfg = ConfigTable.GetData("Activity", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:ClosePopUp(callback)
|
||||
if self.anim ~= nil then
|
||||
self.anim:Play("close", 0, 0)
|
||||
self:AddTimer(1, 0.1, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:OnBtnClick_Close()
|
||||
self:ClosePopUp(self.callback)
|
||||
end
|
||||
function ActivityJointDrillPopUpCtrl:OnBtnClick_Goto()
|
||||
local callback = function()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, self.nCurActId)
|
||||
end
|
||||
end
|
||||
self:ClosePopUp(callback)
|
||||
end
|
||||
return ActivityJointDrillPopUpCtrl
|
||||
@@ -0,0 +1,156 @@
|
||||
local ActivityOurRegiment_10101PopUpCtrl = class("ActivityOurRegiment_10101PopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityOurRegiment_10101PopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivityOurRegiment_10101PopUpCtrl._mapEventConfig = {}
|
||||
function ActivityOurRegiment_10101PopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityOurRegiment_10101PopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityOurRegiment_10101PopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityOurRegiment_10101PopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityOurRegiment_10101PopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityOurRegiment_10101PopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityOurRegiment_10101PopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivityOurRegiment_10101PopUpCtrl
|
||||
@@ -0,0 +1,156 @@
|
||||
local ActivitySwimPopUpCtrl = class("ActivitySwimPopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivitySwimPopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivitySwimPopUpCtrl._mapEventConfig = {}
|
||||
function ActivitySwimPopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actGroupCfg = ConfigTable.GetData("ActivityGroup", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actGroupCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivitySwimPopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivitySwimPopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivitySwimPopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivitySwimPopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivitySwimPopUpCtrl:OnBtnClick_Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivitySwimPopUpCtrl:OnBtnClick_Goto()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
self.anim:Play("close")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
if self.actGroupCfg.TransitionId ~= nil and 0 < self.actGroupCfg.TransitionId then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, self.actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, self.actGroupCfg.PanelId, self.actGroupCfg.Id)
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
return ActivitySwimPopUpCtrl
|
||||
@@ -0,0 +1,164 @@
|
||||
local ActivityTaskPopUpCtrl_01 = class("ActivityTaskPopUpCtrl_01", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
ActivityTaskPopUpCtrl_01._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
goTaskList = {},
|
||||
goTaskItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.ActivityTask.ActivityTaskItemCtrl_01"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
btnTask = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Task"
|
||||
},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_PopUp_Tip"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtActivityTime = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Energy_Item_Permanent_Time"
|
||||
}
|
||||
}
|
||||
ActivityTaskPopUpCtrl_01._mapEventConfig = {
|
||||
RefreshActivityTask = "OnEvent_RefreshActivityTask"
|
||||
}
|
||||
ActivityTaskPopUpCtrl_01._mapRedDotConfig = {}
|
||||
function ActivityTaskPopUpCtrl_01:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nCurActId)
|
||||
self:RefreshTaskList()
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:RefreshTaskList()
|
||||
self.tbTaskList = {}
|
||||
self.tbRewardList = {}
|
||||
self.nGroupId = 0
|
||||
local tbTaskGroup, tbTaskList = self.actData:GetAllTaskList()
|
||||
for nGroupId, tbTask in pairs(tbTaskGroup) do
|
||||
self.nGroupId = nGroupId
|
||||
for _, nId in ipairs(tbTask) do
|
||||
local mapQuest = tbTaskList[nId]
|
||||
if mapQuest ~= nil then
|
||||
local mapData = {
|
||||
nId = nId,
|
||||
nStatus = mapQuest.nStatus,
|
||||
nExpire = mapQuest.nExpire,
|
||||
nCur = mapQuest.nCur,
|
||||
nMax = mapQuest.nMax
|
||||
}
|
||||
table.insert(self.tbTaskList, mapData)
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("ActivityTask", nId)
|
||||
if mapCfg ~= nil and mapCfg.Tid1 ~= 0 then
|
||||
table.insert(self.tbRewardList, mapCfg.Tid1)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(self.tbTaskList, function(a, b)
|
||||
return a.nId < b.nId
|
||||
end)
|
||||
for k, v in ipairs(self._mapNode.goTaskItem) do
|
||||
local mapQuestData = self.tbTaskList[k]
|
||||
v.gameObject:SetActive(mapQuestData ~= nil)
|
||||
if mapQuestData ~= nil then
|
||||
v:SetTaskItem(mapQuestData)
|
||||
if self._mapNode.btnItem[k] ~= nil then
|
||||
NovaAPI.SetRaycastTarget(self._mapNode.btnItem[k].gameObject, mapQuestData.nStatus ~= AllEnum.ActQuestStatus.Complete)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:PlayOpenAnim()
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"ActivityContent_2_in"
|
||||
})
|
||||
self.animRoot:Play("ActivityContent_2_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:Close()
|
||||
if self.callback ~= nil then
|
||||
if self.anim then
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.anim, {
|
||||
"ActivityTask_01_out"
|
||||
})
|
||||
self.anim:Play("ActivityTask_01_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
self:AddTimer(1, nAnimLength, function()
|
||||
self.callback()
|
||||
end, true, true, true)
|
||||
else
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:Awake()
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnEnable()
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnDisable()
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnDestroy()
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbRewardList[nIndex] ~= nil then
|
||||
UTILS.ClickItemGridWithTips(self.tbRewardList[nIndex], btn.gameObject.transform, true, true, false)
|
||||
end
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnBtnClick_Task(btn, nIndex)
|
||||
if self.tbTaskList ~= nil and self.tbTaskList[nIndex] ~= nil then
|
||||
local mapQuest = self.tbTaskList[nIndex]
|
||||
if mapQuest.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
local mapGroupCfg = ConfigTable.GetData("ActivityTaskGroup", self.nGroupId)
|
||||
if self.actData ~= nil and mapGroupCfg ~= nil then
|
||||
local callback = function()
|
||||
self:RefreshTaskList()
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.nCurActId, false)
|
||||
end
|
||||
self.actData:SendMsg_ActivityTaskRewardReceiveReq(self.nGroupId, mapQuest.nId, mapGroupCfg.TaskTabType, callback)
|
||||
end
|
||||
elseif mapQuest.nStatus == AllEnum.ActQuestStatus.UnComplete then
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnBtnClick_Receive()
|
||||
local bCanReceive = false
|
||||
for _, v in ipairs(self.tbTaskList) do
|
||||
if v.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
bCanReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if bCanReceive then
|
||||
local mapGroupCfg = ConfigTable.GetData("ActivityTaskGroup", self.nGroupId)
|
||||
if self.actData ~= nil and mapGroupCfg ~= nil then
|
||||
local callback = function()
|
||||
self:RefreshTaskList()
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.nCurActId, false)
|
||||
self:Close()
|
||||
end
|
||||
self.actData:SendMsg_ActivityTaskRewardReceiveReq(self.nGroupId, 0, mapGroupCfg.TaskTabType, callback)
|
||||
end
|
||||
else
|
||||
self:Close()
|
||||
end
|
||||
end
|
||||
function ActivityTaskPopUpCtrl_01:OnEvent_RefreshActivityTask()
|
||||
self:RefreshTaskList()
|
||||
end
|
||||
return ActivityTaskPopUpCtrl_01
|
||||
@@ -0,0 +1,153 @@
|
||||
local ActivityTowerDefensePopUpCtrl = class("ActivityTowerDefensePopUpCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityTowerDefensePopUpCtrl._mapNodeConfig = {
|
||||
goContent = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Goto"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_PopUp_Goto_1"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtDate = {sComponentName = "TMP_Text"},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
btnDontShow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DontShowAgain"
|
||||
},
|
||||
imgDontShow1 = {},
|
||||
imgDontShow2 = {},
|
||||
txtDontShow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_DontShow_PopUp_Again"
|
||||
}
|
||||
}
|
||||
ActivityTowerDefensePopUpCtrl._mapEventConfig = {}
|
||||
function ActivityTowerDefensePopUpCtrl:ShowPopUp(actId, callback, index)
|
||||
self.popUpIndex = index
|
||||
self.dontShowAgain = false
|
||||
self.nCurActId = actId
|
||||
self.callback = callback
|
||||
self.actCfg = ConfigTable.GetData("Activity", self.nCurActId)
|
||||
self.nOpenTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.StartTime)
|
||||
self.nEndTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(self.actCfg.EndTime)
|
||||
self:RefreshTimeout()
|
||||
self:RefreshDate()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, true)
|
||||
end
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
self.anim = self.gameObject:GetComponent("Animator")
|
||||
self:PlayOpenAnim()
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:PlayOpenAnim()
|
||||
if self.anim then
|
||||
self.anim:Play("open", 0, 0)
|
||||
end
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:RefreshDate()
|
||||
local nOpenMonth = tonumber(os.date("%m", self.nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", self.nOpenTime))
|
||||
local nEndMonth = tonumber(os.date("%m", self.nEndTime))
|
||||
local nEndDay = tonumber(os.date("%d", self.nEndTime))
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:RefreshTimeout()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
if self.remainTimer ~= nil then
|
||||
self.remainTimer:Cancel()
|
||||
self.remainTimer = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:ClosePopUp(callback)
|
||||
if self.anim ~= nil then
|
||||
self.anim:Play("close", 0, 0)
|
||||
self:AddTimer(1, 0.1, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.1)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:OnBtnClick_DontShowAgain()
|
||||
self.dontShowAgain = not self.dontShowAgain
|
||||
self._mapNode.imgDontShow1:SetActive(not self.dontShowAgain)
|
||||
self._mapNode.imgDontShow2:SetActive(self.dontShowAgain)
|
||||
LocalData.SetPlayerLocalData("Act_PopUp_DontShow" .. self.nCurActId, self.dontShowAgain)
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:OnBtnClick_Close()
|
||||
self:ClosePopUp(self.callback)
|
||||
end
|
||||
function ActivityTowerDefensePopUpCtrl:OnBtnClick_Goto()
|
||||
local callback = function()
|
||||
if nil ~= self.nCurActId then
|
||||
PopUpManager.InterruptPopUp(self.popUpIndex)
|
||||
PlayerData.Activity:SendActivityDetailMsg()
|
||||
local endTime = self.nEndTime
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Invalid_Tip_3"))
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityPopUp)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ActivityList, self.nCurActId)
|
||||
end
|
||||
end
|
||||
self:ClosePopUp(callback)
|
||||
end
|
||||
return ActivityTowerDefensePopUpCtrl
|
||||
@@ -0,0 +1,599 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
tog = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 10,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
togCtrl = {
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
togAniRoot = {sNodeName = "rt_Toggle", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
imgRaidUnlockMask = {},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_Cond"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
levelLockRoot = {},
|
||||
UnlockTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
local tmpCanvasExp = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/goBg/Select/Image"):GetComponent("Canvas")
|
||||
NovaAPI.SetCanvasSortingOrder(tmpCanvasExp, self._nSortingOrder + 5)
|
||||
NovaAPI.SetCanvasSortingName(tmpCanvasExp, AllEnum.SortingLayerName.UI)
|
||||
local tmpCanvasAdv = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/goBg/Select/Image"):GetComponent("Canvas")
|
||||
NovaAPI.SetCanvasSortingOrder(tmpCanvasAdv, self._nSortingOrder + 5)
|
||||
NovaAPI.SetCanvasSortingName(tmpCanvasAdv, AllEnum.SortingLayerName.UI)
|
||||
local tmpEnemyCan = self._mapNode.goEnemyInfo.gameObject:GetComponent("Canvas")
|
||||
NovaAPI.SetCanvasSortingOrder(tmpEnemyCan, self._nSortingOrder + 6)
|
||||
NovaAPI.SetCanvasSortingName(tmpEnemyCan, AllEnum.SortingLayerName.UI)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
for i = 1, #self.tabRewardList do
|
||||
local go = self.tabRewardList[i].gameObject
|
||||
local btnSelect = self.tabRewardList[i].gameObject:GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
self:UnbindCtrlByNode(self.tabRewardList[i])
|
||||
destroy(go)
|
||||
end
|
||||
self.tabRewardList = {}
|
||||
self.SelectTogPreLvLock = nil
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDestroy(...)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Init()
|
||||
self.activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self:RefreshTogTypeCount()
|
||||
self:Refresh()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Refresh()
|
||||
self.nLevelType = self.activityLevelsData:GetDefaultSelectionType()
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
local texExplore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texExplore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local totalExplore, exploreCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Explore)
|
||||
local totalAdventure, adventureCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Adventure)
|
||||
local str = "%s/%s"
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
if isOpenExplore then
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, string.format(str, exploreCount, totalExplore))
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, string.format(str, exploreCount, totalExplore))
|
||||
else
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, "")
|
||||
end
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
if isOpenAdventure then
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
else
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, "")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.13333333333333333, 0.12156862745098039, 0.09411764705882353, 1))
|
||||
end
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
local explore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local explore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
local adventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local adventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
explore_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Explore)
|
||||
explore_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Explore)
|
||||
adventure_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
adventure_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Adventure)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
local tmpImage = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(tmpImage, Color(0.13333333333333333, 0.12156862745098039, 0.09411764705882353, 1))
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
local tmpImage = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(tmpImage, Color(1, 1, 1, 1))
|
||||
end
|
||||
for i = 1, 10 do
|
||||
self._mapNode.tog[i].gameObject:SetActive(i <= #tabLevelInfoDifficulty)
|
||||
end
|
||||
for i = 1, #tabLevelInfoDifficulty do
|
||||
local tmpId = tabLevelInfoDifficulty[i]
|
||||
local tmpData = tabLevelInfo[tmpId]
|
||||
self._mapNode.togCtrl[i]:SetText(tmpData.baseData.Name)
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
local objTog = self._mapNode.tog[i].gameObject
|
||||
local rt_Targets = objTog.transform:Find("AnimRoot/AnimSwitch/rt_Targets").gameObject
|
||||
local rtLockInfo = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockInfo").gameObject
|
||||
local rtLockPreLv = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv").gameObject
|
||||
local rtLockPreLvSelect = rtLockPreLv.transform:Find("rtLockPreLvSelect"):GetComponent("Image")
|
||||
if i == nDifficulty then
|
||||
NovaAPI.SetImageColor(rtLockPreLvSelect, Color(1, 1, 1, 1))
|
||||
self.SelectTogPreLvLock = rtLockPreLvSelect
|
||||
else
|
||||
NovaAPI.SetImageColor(rtLockPreLvSelect, Color(0.13333333333333333, 0.08235294117647059, 0.09411764705882353, 1))
|
||||
end
|
||||
local strTips = ""
|
||||
local redH = objTog.transform:Find("AnimRoot/AnimSwitch/redH").gameObject
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
if tmpData.baseData.Type == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
end
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
rt_Targets:SetActive(true)
|
||||
for j = 1, 3 do
|
||||
local btnStar = rt_Targets.gameObject.transform:Find("btnTarget" .. j):GetComponent("Button")
|
||||
btnStar.interactable = j <= tmpData.Star
|
||||
end
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
rt_Targets:SetActive(false)
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(true)
|
||||
elseif not isOpen then
|
||||
rt_Targets:SetActive(false)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, tmpData.baseData.Id)
|
||||
if day == 0 then
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(false)
|
||||
bgCondition:SetActive(true)
|
||||
local txtLockCondition = rtLockInfo.gameObject.transform:Find("bgCondition/txtLockCondition"):GetComponent("TMP_Text")
|
||||
local timerCount = function()
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, tmpData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_10101"), hour))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_10101"), min))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_10101"), sec))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timeTab[tmpData.baseData.Id] = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
else
|
||||
rt_Targets:SetActive(false)
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(true)
|
||||
bgCondition:SetActive(false)
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
end
|
||||
end
|
||||
local clickCb = function()
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
if i == nDifficulty then
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_Tog(btn)
|
||||
local nHard = table.indexof(self._mapNode.tog, btn:GetComponent("UIButton"))
|
||||
local togIdx = table.indexof(self._mapNode.tog, btn)
|
||||
if nHard == nil then
|
||||
return
|
||||
end
|
||||
if self.curSelectHard ~= nHard then
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.13333333333333333, 0.12156862745098039, 0.09411764705882353, 1))
|
||||
end
|
||||
for idx, value in pairs(mapToggle) do
|
||||
if value == self.curSelectHard then
|
||||
self._mapNode.togCtrl[idx]:SetDefaultAct10101(false)
|
||||
self._mapNode.togCtrl[idx].gameObject.transform:Find("AnimRoot/AnimSwitch/Image_Arrow").gameObject:SetActive(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.togCtrl[togIdx]:SetDefaultAct10101(true)
|
||||
self._mapNode.togCtrl[togIdx].gameObject.transform:Find("AnimRoot/AnimSwitch/Image_Arrow").gameObject:SetActive(true)
|
||||
self.SelectTogPreLvLock = self._mapNode.togCtrl[togIdx].gameObject.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv/rtLockPreLvSelect"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(1, 1, 1, 1))
|
||||
self:RefreshInstanceInfo(self.nLevelType, nHard, nil, false)
|
||||
local levelId = 0
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.nLevelType, levelId)
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, bLocation, bSetTog)
|
||||
if bLocation then
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.UIScrollRectScrollTo(self._mapNode.rtToggles, nHard + 1, true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
if bSetTog then
|
||||
for i = 1, 10 do
|
||||
self._mapNode.togCtrl[i]:SetDefaultAct10101(i == nHard)
|
||||
self._mapNode.togCtrl[i].gameObject.transform:Find("AnimRoot/AnimSwitch/Image_Arrow").gameObject:SetActive(i == nHard)
|
||||
end
|
||||
end
|
||||
if self.tmpLockInfoDay ~= nil then
|
||||
NovaAPI.SetImageColor(self.tmpLockInfoDay, Color(0.13333333333333333, 0.12156862745098039, 0.09411764705882353, 1))
|
||||
self.tmpLockInfoDay = false
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.levelLockRoot:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.txtBtnRaid.gameObject:SetActive(self.curStar == 3)
|
||||
self._mapNode.imgRaidUnlockMask.gameObject:SetActive(self.curStar ~= 3)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(isNeedEnergyConsume)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.levelLockRoot:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.levelLockRoot:SetActive(true)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day))
|
||||
local objTog = self._mapNode.tog[nHard].gameObject
|
||||
local rtLockInfo = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockInfo").gameObject
|
||||
self.tmpLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(self.tmpLockInfoDay, Color(1, 1, 1, 1))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10101/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10101.ActivityLevels.ActivityLevelsSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsSelectPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnRelease()
|
||||
end
|
||||
return ActivityLevelsSelectPanel
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityOurRegimentCtrl = class("ActivityOurRegimentCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityOurRegimentCtrl._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 = "Activity_TowerAllOpen_Go"
|
||||
}
|
||||
}
|
||||
function ActivityOurRegimentCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityOurRegimentCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityOurRegimentCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityOurRegimentCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityOurRegimentCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil and actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.OurRegimentThemePanel, actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.OurRegimentThemePanel, actGroupCfg.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityOurRegimentCtrl: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 ActivityOurRegimentCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityOurRegimentCtrl
|
||||
@@ -0,0 +1,544 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local OurRegimentThemeCtrl = class("OurRegimentThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
OurRegimentThemeCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgActivityTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10101"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10101"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story_10101"
|
||||
},
|
||||
txtStoryDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_StoryChapter_10101"
|
||||
},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
imgStoryIcon = {sComponentName = "Image"},
|
||||
imgStoryEnd = {},
|
||||
goStoryEnd = {},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story_10101"
|
||||
},
|
||||
imgStoryIconEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop_10101"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgLevel = {sComponentName = "Image"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level_10101"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level_10101"
|
||||
},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoyActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {}
|
||||
}
|
||||
OurRegimentThemeCtrl._mapEventConfig = {}
|
||||
OurRegimentThemeCtrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function OurRegimentThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.OurRegimentThemeData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.OurRegimentThemeData ~= nil then
|
||||
self.ActivityGroupCfg = self.OurRegimentThemeData.actGroupConfig
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function OurRegimentThemeCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.OurRegimentThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshPanel()
|
||||
if self.OurRegimentThemeData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshTime()
|
||||
local bOpen = self.OurRegimentThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.OurRegimentThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.OurRegimentThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgActivityTime:SetActive(bOpen)
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.OurRegimentThemeData: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.txtActivityDate, dateStr)
|
||||
end
|
||||
function OurRegimentThemeCtrl: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 OurRegimentThemeCtrl: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 OurRegimentThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.OurRegimentThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
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 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)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.OurRegimentThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.OurRegimentThemeData: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)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, self._mapNode.imgTaskActivityUnlockTime, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskProgressEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtTaskProgress.gameObject:SetActive(state >= ActivityState.Open)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
self:RefreshLevelButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.levelRemainTimer, self._mapNode.txtLevelActivityTime, self._mapNode.imgLevelActivityUnlockTime, refreshFunc)
|
||||
if self.levelRemainTimer == nil then
|
||||
self.levelRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function OurRegimentThemeCtrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function OurRegimentThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function OurRegimentThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local chapterIndex = 3
|
||||
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterIndex)
|
||||
if isUnlock then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterIndex)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
end
|
||||
return
|
||||
end
|
||||
local actData = self.OurRegimentThemeData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local nRandom = math.random(28, 29)
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, nRandom, func)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return OurRegimentThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local OurRegimentThemePanel = class("OurRegimentThemePanel", BasePanel)
|
||||
OurRegimentThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
OurRegimentThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10101/OurRegimentThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10101.OurRegimentThemeCtrl"
|
||||
}
|
||||
}
|
||||
function OurRegimentThemePanel:Awake()
|
||||
end
|
||||
function OurRegimentThemePanel:OnEnable()
|
||||
end
|
||||
function OurRegimentThemePanel:OnDisable()
|
||||
end
|
||||
function OurRegimentThemePanel:OnDestroy()
|
||||
end
|
||||
function OurRegimentThemePanel:OnRelease()
|
||||
end
|
||||
return OurRegimentThemePanel
|
||||
@@ -0,0 +1,259 @@
|
||||
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.10101.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 nTimeNow = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local bFirst = self._panel.actShopData:GetShopFirstIn()
|
||||
local sTimeVoice = ""
|
||||
local nHour = tonumber(os.date("!%H", nTimeNow))
|
||||
if 6 <= nHour and nHour < 12 then
|
||||
sTimeVoice = "greetmorn_npc"
|
||||
elseif 12 <= nHour and nHour < 18 then
|
||||
sTimeVoice = "greetnoon_npc"
|
||||
else
|
||||
sTimeVoice = "greetnight_npc"
|
||||
end
|
||||
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.10101.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_10101, 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,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_chap3activity_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite(self._mapNode.imgRare, "10101", 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 = "10101/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10101.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.10101.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_10101)
|
||||
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 = "10101/Shop/ActivityShopPopupPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10101.Shop.ActivityShopPopupCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPopupPanel:Awake()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPopupPanel
|
||||
@@ -0,0 +1,386 @@
|
||||
local OurRegimentTaskCtrl = class("OurRegimentTaskCtrl", 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"
|
||||
}
|
||||
OurRegimentTaskCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgGroupDone = {},
|
||||
tmpGroupName = {sComponentName = "TMP_Text"},
|
||||
tmpGroupProgress = {sComponentName = "TMP_Text"},
|
||||
tmpGroupUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
btnGroupDone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "onBtn_GroupDone"
|
||||
},
|
||||
tb_tmpReceived = {
|
||||
nCount = 3,
|
||||
sNodeName = "tmpReceived_",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
tmpUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
tmpDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
tmpJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
tmpGroupDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
}
|
||||
}
|
||||
OurRegimentTaskCtrl._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
OurRegimentTaskCtrl._mapRedDotConfig = {}
|
||||
function OurRegimentTaskCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2] or 1
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
self:refresh_Group()
|
||||
end
|
||||
function OurRegimentTaskCtrl: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 OurRegimentTaskCtrl:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function OurRegimentTaskCtrl:onGridRefresh_Tab(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapData = self.tbData[nIndex]
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", mapData.nGroupId)
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nTotal = #mapData.tbTaskData
|
||||
local sProgress = string.format("%s/%s", tostring(nDone), tostring(nTotal))
|
||||
local tr = go.transform
|
||||
self:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
|
||||
local goRedDot = 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 OurRegimentTaskCtrl: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)
|
||||
self:refresh_Group()
|
||||
end
|
||||
end
|
||||
function OurRegimentTaskCtrl: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 OurRegimentTaskCtrl: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 OurRegimentTaskCtrl: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 OurRegimentTaskCtrl: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 OurRegimentTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
local nTaskId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nTaskId ~= nil then
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
self:refresh_Group()
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function OurRegimentTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
end
|
||||
end
|
||||
function OurRegimentTaskCtrl:refresh_Group()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local nGroupId = mapData.nGroupId
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
self.bGot = table.indexof(self.ins_ActivityTaskData.tbActivityTaskGroupIds, nGroupId) > 0
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nOK = mapData.nTaskOKNum
|
||||
local nTotal = #tbTaskData
|
||||
local bDone = nOK == nTotal
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupProgress, string.format("%s/%s", tostring(nDone), tostring(nTotal)))
|
||||
self._mapNode.tmpGroupUndone.transform.localScale = bDone == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.btnGroupDone.transform.localScale = bDone == true and self.bGot == false and Vector3.one or Vector3.zero
|
||||
self._mapNode.imgGroupDone.transform.localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
self.tbCurGroupRewardId = mapData.tbGroupRewardId
|
||||
self.tbCurGroupRewardNum = mapData.tbGroupRewardNum
|
||||
self._mapNode.svList_GroupReward:Init(#self.tbCurGroupRewardId, self, self.onGridRefresh_GroupRewardItem, self.onGridBtnClick_GroupRewardItem)
|
||||
end
|
||||
function OurRegimentTaskCtrl:onGridRefresh_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
|
||||
local tr = go.transform
|
||||
self:SetSprite_FrameColor(tr:Find("scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
|
||||
self:SetPngSprite(tr:Find("scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
|
||||
tr:Find("scale_on_click/goReceived").localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
local nNum = self.tbCurGroupRewardNum[nIndex]
|
||||
local sNum = mapCfgData_Item.Type ~= ItemType.Char and mapCfgData_Item.Type ~= ItemType.Disc and "×" .. tostring(nNum) or ""
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/tmpCount").gameObject:GetComponent("TMP_Text"), sNum)
|
||||
tr:Find("scale_on_click/goTimeLimit").localScale = mapCfgData_Item.ExpireType > 0 and Vector3.one or Vector3.zero
|
||||
end
|
||||
function OurRegimentTaskCtrl:onGridBtnClick_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.transform.parent.name) + 1
|
||||
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
|
||||
end
|
||||
function OurRegimentTaskCtrl:onBtn_GroupDone()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Group()
|
||||
end
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
|
||||
end
|
||||
return OurRegimentTaskCtrl
|
||||
@@ -0,0 +1,9 @@
|
||||
local OurRegimentTaskPanel = class("OurRegimentTaskPanel", BasePanel)
|
||||
OurRegimentTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
OurRegimentTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10101/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10101.Task.OurRegimentTaskCtrl"
|
||||
}
|
||||
}
|
||||
return OurRegimentTaskPanel
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivityDreamCtrl = class("ActivityDreamCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivityDreamCtrl._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"},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
}
|
||||
}
|
||||
function ActivityDreamCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityDreamCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityDreamCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivityDreamCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivityDreamCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivityDreamCtrl: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 ActivityDreamCtrl: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 ActivityDreamCtrl: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 ActivityDreamCtrl: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 ActivityDreamCtrl: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 ActivityDreamCtrl: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 ActivityDreamCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil and actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DreamThemePanel, actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DreamThemePanel, actGroupCfg.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityDreamCtrl: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 ActivityDreamCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityDreamCtrl
|
||||
@@ -0,0 +1,587 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
tog = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 10,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
togCtrl = {
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
togAniRoot = {sNodeName = "rt_Toggle", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
imgRaidUnlockMask = {},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_Cond"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
levelLockRoot = {},
|
||||
UnlockTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
for i = 1, #self.tabRewardList do
|
||||
local go = self.tabRewardList[i].gameObject
|
||||
local btnSelect = self.tabRewardList[i].gameObject:GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
self:UnbindCtrlByNode(self.tabRewardList[i])
|
||||
destroy(go)
|
||||
end
|
||||
self.tabRewardList = {}
|
||||
self.SelectTogPreLvLock = nil
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDestroy(...)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Init()
|
||||
self.activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self:RefreshTogTypeCount()
|
||||
self:Refresh()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Refresh()
|
||||
self.nLevelType = self.activityLevelsData:GetDefaultSelectionType()
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
local texExplore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texExplore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local totalExplore, exploreCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Explore)
|
||||
local totalAdventure, adventureCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Adventure)
|
||||
local str = "%s/%s"
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
if isOpenExplore then
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, string.format(str, exploreCount, totalExplore))
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, string.format(str, exploreCount, totalExplore))
|
||||
else
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, "")
|
||||
end
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
if isOpenAdventure then
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
else
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, "")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(1, 1, 1, 1))
|
||||
end
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
local explore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local explore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
local adventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local adventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
explore_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Explore)
|
||||
explore_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Explore)
|
||||
adventure_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
adventure_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Adventure)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
local tmpImage = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(tmpImage, Color(0.14901960784313725, 0.10196078431372549, 0.47058823529411764, 1))
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
local tmpImage = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(tmpImage, Color(1, 1, 1, 1))
|
||||
end
|
||||
for i = 1, 10 do
|
||||
self._mapNode.tog[i].gameObject:SetActive(i <= #tabLevelInfoDifficulty)
|
||||
end
|
||||
for i = 1, #tabLevelInfoDifficulty do
|
||||
local tmpId = tabLevelInfoDifficulty[i]
|
||||
local tmpData = tabLevelInfo[tmpId]
|
||||
self._mapNode.togCtrl[i]:SetText(tmpData.baseData.Name)
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
local objTog = self._mapNode.tog[i].gameObject
|
||||
local rt_Targets = objTog.transform:Find("AnimRoot/AnimSwitch/rt_Targets").gameObject
|
||||
local rtLockInfo = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockInfo").gameObject
|
||||
local rtLockPreLv = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv").gameObject
|
||||
local rtLockPreLvSelect = rtLockPreLv.transform:Find("rtLockPreLvSelect"):GetComponent("Image")
|
||||
if i == nDifficulty then
|
||||
NovaAPI.SetImageColor(rtLockPreLvSelect, Color(1, 1, 1, 1))
|
||||
self.SelectTogPreLvLock = rtLockPreLvSelect
|
||||
else
|
||||
NovaAPI.SetImageColor(rtLockPreLvSelect, Color(0.14901960784313725, 0.10196078431372549, 0.47058823529411764, 1))
|
||||
end
|
||||
local strTips = ""
|
||||
local redH = objTog.transform:Find("AnimRoot/AnimSwitch/redH").gameObject
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
if tmpData.baseData.Type == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
end
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
rt_Targets:SetActive(true)
|
||||
for j = 1, 3 do
|
||||
local btnStar = rt_Targets.gameObject.transform:Find("btnTarget" .. j):GetComponent("Button")
|
||||
btnStar.interactable = j <= tmpData.Star
|
||||
end
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
rt_Targets:SetActive(false)
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(true)
|
||||
elseif not isOpen then
|
||||
rt_Targets:SetActive(false)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, tmpData.baseData.Id)
|
||||
if day == 0 then
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(false)
|
||||
bgCondition:SetActive(true)
|
||||
local txtLockCondition = rtLockInfo.gameObject.transform:Find("bgCondition/txtLockCondition"):GetComponent("TMP_Text")
|
||||
local timerCount = function()
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, tmpData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color"), hour))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color"), min))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color"), sec))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timeTab[tmpData.baseData.Id] = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
else
|
||||
rt_Targets:SetActive(false)
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(true)
|
||||
bgCondition:SetActive(false)
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
end
|
||||
end
|
||||
local clickCb = function()
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
if i == nDifficulty then
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_Tog(btn)
|
||||
local nHard = table.indexof(self._mapNode.tog, btn:GetComponent("UIButton"))
|
||||
local togIdx = table.indexof(self._mapNode.tog, btn)
|
||||
if nHard == nil then
|
||||
return
|
||||
end
|
||||
if self.curSelectHard ~= nHard then
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.14901960784313725, 0.10196078431372549, 0.47058823529411764, 1))
|
||||
end
|
||||
for idx, value in pairs(mapToggle) do
|
||||
if value == self.curSelectHard then
|
||||
self._mapNode.togCtrl[idx]:SetDefault(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.togCtrl[togIdx]:SetDefault(true)
|
||||
self.SelectTogPreLvLock = self._mapNode.togCtrl[togIdx].gameObject.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv/rtLockPreLvSelect"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(1, 1, 1, 1))
|
||||
self:RefreshInstanceInfo(self.nLevelType, nHard, nil, false)
|
||||
local levelId = 0
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.nLevelType, levelId)
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, bLocation, bSetTog)
|
||||
if bLocation then
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.UIScrollRectScrollTo(self._mapNode.rtToggles, nHard + 1, true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
if bSetTog then
|
||||
for i = 1, 10 do
|
||||
self._mapNode.togCtrl[i]:SetDefault(i == nHard)
|
||||
end
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
if self.tmpLockInfoDay ~= nil then
|
||||
NovaAPI.SetImageColor(self.tmpLockInfoDay, Color(0.14901960784313725, 0.10196078431372549, 0.47058823529411764, 1))
|
||||
self.tmpLockInfoDay = false
|
||||
end
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.levelLockRoot:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.txtBtnRaid.gameObject:SetActive(self.curStar == 3)
|
||||
self._mapNode.imgRaidUnlockMask.gameObject:SetActive(self.curStar ~= 3)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(isNeedEnergyConsume)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.levelLockRoot:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.levelLockRoot:SetActive(true)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day))
|
||||
local objTog = self._mapNode.tog[nHard].gameObject
|
||||
local rtLockInfo = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockInfo").gameObject
|
||||
self.tmpLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(self.tmpLockInfoDay, Color(1, 1, 1, 1))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10102/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10102.ActivityLevels.ActivityLevelsSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsSelectPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnRelease()
|
||||
end
|
||||
return ActivityLevelsSelectPanel
|
||||
@@ -0,0 +1,545 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local DreamThemeCtrl = class("DreamThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
DreamThemeCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgRemaineTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10102"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game_10102"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg"
|
||||
},
|
||||
txtStoryDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_StoryChapter_10102"
|
||||
},
|
||||
goStoryEnd = {},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg"
|
||||
},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgLevel = {sComponentName = "Image"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoyActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {}
|
||||
}
|
||||
DreamThemeCtrl._mapEventConfig = {}
|
||||
DreamThemeCtrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function DreamThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.DreamThemeData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.DreamThemeData ~= nil then
|
||||
self.ActivityGroupCfg = self.DreamThemeData.actGroupConfig
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function DreamThemeCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.DreamThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:RefreshPanel()
|
||||
if self.DreamThemeData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function DreamThemeCtrl:RefreshTime()
|
||||
local bOpen = self.DreamThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.DreamThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.DreamThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgRemaineTime:SetActive(bOpen)
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.DreamThemeData: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.txtActivityDate, dateStr)
|
||||
end
|
||||
function DreamThemeCtrl: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 DreamThemeCtrl: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 DreamThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.DreamThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
|
||||
local countDowmTimer
|
||||
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 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)
|
||||
countDowmTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
refreshFunc(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
do
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.DreamThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = true
|
||||
elseif endTime < self.DreamThemeData: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)
|
||||
countDowmTimer = nil
|
||||
refreshFunc(actData)
|
||||
end
|
||||
end
|
||||
fcTimer()
|
||||
countDowmTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return state, bShowCountDown, countDowmTimer
|
||||
end
|
||||
function DreamThemeCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
|
||||
if self.minigameRemainTimer == nil then
|
||||
self.minigameRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.taskRemainTimer, self._mapNode.txtTaskActivityTime, self._mapNode.imgTaskActivityUnlockTime, refreshFunc)
|
||||
if self.taskRemainTimer == nil then
|
||||
self.taskRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed and actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskProgressEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtTaskProgress.gameObject:SetActive(state >= ActivityState.Open)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
self:RefreshLevelButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.levelRemainTimer, self._mapNode.txtLevelActivityTime, self._mapNode.imgLevelActivityUnlockTime, refreshFunc)
|
||||
if self.levelRemainTimer == nil then
|
||||
self.levelRemainTimer = countDowmTimer
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local refreshFunc = function(actData)
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.shopRemainTimer, self._mapNode.txtShopActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
|
||||
if self.shopRemainTimer == nil then
|
||||
self.shopRemainTimer = countDowmTimer
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function DreamThemeCtrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function()
|
||||
self.bRequireSucc = true
|
||||
self:RefreshPanel()
|
||||
end
|
||||
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
|
||||
self.bRequiredActData = true
|
||||
self:AddTimer(1, 1, function()
|
||||
self.bRequiredActData = false
|
||||
end, true, true, true)
|
||||
end
|
||||
function DreamThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function DreamThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local chapterIndex = 4
|
||||
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterIndex)
|
||||
if isUnlock then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MainlineEx, chapterIndex)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.StoryChapter)
|
||||
end
|
||||
return
|
||||
end
|
||||
local actData = self.DreamThemeData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
local miniGameData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if miniGameData ~= nil then
|
||||
miniGameData:RequestLevelData(0, callback)
|
||||
end
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return DreamThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local DreamThemePanel = class("DreamThemePanel", BasePanel)
|
||||
DreamThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
DreamThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10102/DreamThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10102.DreamThemeCtrl"
|
||||
}
|
||||
}
|
||||
function DreamThemePanel:Awake()
|
||||
end
|
||||
function DreamThemePanel:OnEnable()
|
||||
end
|
||||
function DreamThemePanel:OnDisable()
|
||||
end
|
||||
function DreamThemePanel:OnDestroy()
|
||||
end
|
||||
function DreamThemePanel:OnRelease()
|
||||
end
|
||||
return DreamThemePanel
|
||||
@@ -0,0 +1,259 @@
|
||||
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.10102.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 nTimeNow = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local bFirst = self._panel.actShopData:GetShopFirstIn()
|
||||
local sTimeVoice = ""
|
||||
local nHour = tonumber(os.date("!%H", nTimeNow))
|
||||
if 6 <= nHour and nHour < 12 then
|
||||
sTimeVoice = "greetmorn_npc"
|
||||
elseif 12 <= nHour and nHour < 18 then
|
||||
sTimeVoice = "greetnoon_npc"
|
||||
else
|
||||
sTimeVoice = "greetnight_npc"
|
||||
end
|
||||
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.10102.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_10102, 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,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_dream_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite(self._mapNode.imgRare, "10102", 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 = "10102/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10102.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.10102.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_10102)
|
||||
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 = "10102/Shop/ActivityShopPopupPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10102.Shop.ActivityShopPopupCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPopupPanel:Awake()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPopupPanel
|
||||
@@ -0,0 +1,388 @@
|
||||
local DreamTaskCtrl = class("DreamTaskCtrl", 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"
|
||||
}
|
||||
DreamTaskCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgGroupDone = {},
|
||||
tmpGroupName = {sComponentName = "TMP_Text"},
|
||||
tmpGroupProgress = {sComponentName = "TMP_Text"},
|
||||
tmpGroupUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
btnGroupDone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "onBtn_GroupDone"
|
||||
},
|
||||
tb_tmpReceived = {
|
||||
nCount = 3,
|
||||
sNodeName = "tmpReceived_",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
tmpUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
tmpDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
tmpJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
tmpGroupDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
}
|
||||
}
|
||||
DreamTaskCtrl._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
DreamTaskCtrl._mapRedDotConfig = {}
|
||||
function DreamTaskCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2] or 1
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
self:refresh_Group()
|
||||
end
|
||||
function DreamTaskCtrl: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 DreamTaskCtrl:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function DreamTaskCtrl: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 DreamTaskCtrl: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)
|
||||
self:refresh_Group()
|
||||
end
|
||||
end
|
||||
function DreamTaskCtrl: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 DreamTaskCtrl: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 DreamTaskCtrl: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 DreamTaskCtrl: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 DreamTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
local nTaskId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nTaskId ~= nil then
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
self:refresh_Group()
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function DreamTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
end
|
||||
end
|
||||
function DreamTaskCtrl:refresh_Group()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local nGroupId = mapData.nGroupId
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
self.bGot = table.indexof(self.ins_ActivityTaskData.tbActivityTaskGroupIds, nGroupId) > 0
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nOK = mapData.nTaskOKNum
|
||||
local nTotal = #tbTaskData
|
||||
local bDone = nOK == nTotal
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupProgress, string.format("%s/%s", tostring(nDone), tostring(nTotal)))
|
||||
self._mapNode.tmpGroupUndone.transform.localScale = bDone == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.btnGroupDone.transform.localScale = bDone == true and self.bGot == false and Vector3.one or Vector3.zero
|
||||
self._mapNode.imgGroupDone.transform.localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
self.tbCurGroupRewardId = mapData.tbGroupRewardId
|
||||
self.tbCurGroupRewardNum = mapData.tbGroupRewardNum
|
||||
self._mapNode.svList_GroupReward:Init(#self.tbCurGroupRewardId, self, self.onGridRefresh_GroupRewardItem, self.onGridBtnClick_GroupRewardItem)
|
||||
end
|
||||
function DreamTaskCtrl:onGridRefresh_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
|
||||
local tr = go.transform
|
||||
self:SetSprite_FrameColor(tr:Find("scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
|
||||
self:SetPngSprite(tr:Find("scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
|
||||
tr:Find("scale_on_click/goReceived").localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
local nNum = self.tbCurGroupRewardNum[nIndex]
|
||||
local sNum = mapCfgData_Item.Type ~= ItemType.Char and mapCfgData_Item.Type ~= ItemType.Disc and "×" .. tostring(nNum) or ""
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/tmpCount").gameObject:GetComponent("TMP_Text"), sNum)
|
||||
tr:Find("scale_on_click/goTimeLimit").localScale = mapCfgData_Item.ExpireType > 0 and Vector3.one or Vector3.zero
|
||||
end
|
||||
function DreamTaskCtrl:onGridBtnClick_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.transform.parent.name) + 1
|
||||
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
|
||||
end
|
||||
function DreamTaskCtrl:onBtn_GroupDone()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Group()
|
||||
end
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
|
||||
end
|
||||
return DreamTaskCtrl
|
||||
@@ -0,0 +1,9 @@
|
||||
local DreamTaskPanel = class("DreamTaskPanel", BasePanel)
|
||||
DreamTaskPanel._sUIResRootPath = "UI_Activity/"
|
||||
DreamTaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "10102/Task.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.10102.Task.DreamTaskCtrl"
|
||||
}
|
||||
}
|
||||
return DreamTaskPanel
|
||||
@@ -0,0 +1,108 @@
|
||||
local ActivityAvgInfoExCtrl = class("ActivityAvgInfoExCtrl", BaseCtrl)
|
||||
local AvgData = PlayerData.ActivityAvg
|
||||
ActivityAvgInfoExCtrl._mapNodeConfig = {
|
||||
mainLineAvgLvName = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvNum = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvDes = {sComponentName = "TMP_Text"},
|
||||
mainLineBattleLvName = {sComponentName = "TMP_Text"},
|
||||
mainLineBattleLvNum = {sComponentName = "TMP_Text"},
|
||||
txtBattleStoryDesc = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgBtnTex = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldMap_MainLine_Avg_Btn"
|
||||
},
|
||||
mainLineAvgBtn = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_OpenAvg"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
animator = {sNodeName = "rtWindow", sComponentName = "Animator"},
|
||||
btnEnemy = {
|
||||
sNodeName = "btnEnemy",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MonsterInfo"
|
||||
},
|
||||
imgBattleIcon = {},
|
||||
txtClueNotice = {},
|
||||
imgClueNotice = {},
|
||||
goBattleRoot = {},
|
||||
goAvgRoot = {},
|
||||
goRewardInfo = {},
|
||||
imgReward = {sComponentName = "Image"},
|
||||
txtRewardCount = {sComponentName = "TMP_Text"},
|
||||
txtAvgRewardTitle = {sComponentName = "TMP_Text", sLanguageId = "Level_Info"},
|
||||
txtCancelBtn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainLine_Select_Btn_Cancel"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "STRanking_Reward_Btn"
|
||||
},
|
||||
txtBtnEnemy = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Rank_Enemy_Info"
|
||||
}
|
||||
}
|
||||
ActivityAvgInfoExCtrl._mapEventConfig = {}
|
||||
function ActivityAvgInfoExCtrl:Awake()
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:FadeOut(callback)
|
||||
if type(callback) == "function" then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnEnable()
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnDisable()
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnRelease()
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OpenLevelInfo(avgId, actId)
|
||||
self.avgId = avgId
|
||||
self.actId = actId
|
||||
local mapActivityAvg = ConfigTable.GetData("ActivityAvgLevel", avgId)
|
||||
if mapActivityAvg == nil then
|
||||
printError("nil mainlineData" .. avgId)
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvNum, mapActivityAvg.Index)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvName, mapActivityAvg.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvDes, mapActivityAvg.Desc)
|
||||
self._mapNode.goAvgRoot:SetActive(true)
|
||||
self._mapNode.goBattleRoot:SetActive(false)
|
||||
self._mapNode.txtClueNotice:SetActive(false)
|
||||
self._mapNode.imgClueNotice:SetActive(false)
|
||||
self._mapNode.goRewardInfo:SetActive(false)
|
||||
if not AvgData:IsActivityAvgReaded(self.actId, mapActivityAvg.Id) then
|
||||
local tbReward = decodeJson(mapActivityAvg.FirstCompleteRewardPreview)
|
||||
if 0 < #tbReward then
|
||||
self._mapNode.goRewardInfo:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgReward, ConfigTable.GetData_Item(tbReward[1][1]).Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardCount, "×" .. tbReward[1][2])
|
||||
end
|
||||
end
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnBtnClick_Close()
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
EventManager.Hit("CloseActivityAvgInfo", false)
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnBtnClick_MonsterInfo(btn)
|
||||
end
|
||||
function ActivityAvgInfoExCtrl:OnBtnClick_OpenAvg(btn)
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Hit("SelectMainlineBattle", false)
|
||||
AvgData:EnterAvg(self.avgId, self.actId)
|
||||
end
|
||||
return ActivityAvgInfoExCtrl
|
||||
@@ -0,0 +1,243 @@
|
||||
local ActivityLevelsInstancePauseCtrl = class("ActivityLevelsInstancePauseCtrl", BaseCtrl)
|
||||
local GameCameraStackManager = CS.GameCameraStackManager.Instance
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ActivityLevelsInstancePauseCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
imgBlocker = {},
|
||||
btnBgClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
aniWindow = {
|
||||
sNodeName = "PauseWindow",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Pause"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnGiveUp = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_GiveUp",
|
||||
sAction = "Giveup"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close",
|
||||
sAction = "Back"
|
||||
},
|
||||
btnSettings = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Settings"
|
||||
},
|
||||
btnPopSkill = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
txtGiveUp = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_EndBattle"
|
||||
},
|
||||
txtBack = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_ContinueBattle"
|
||||
},
|
||||
txtBtnSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
txtBtnSettings = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Settings"
|
||||
},
|
||||
btnChar = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
goChar = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnChar",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharCtrl"
|
||||
},
|
||||
txtSubTitle1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Time"
|
||||
},
|
||||
txtSubTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Task"
|
||||
},
|
||||
txtAim = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
goAim = {nCount = 3},
|
||||
imgOff = {nCount = 3},
|
||||
imgOn = {nCount = 3},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
txtLeader = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSub = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
}
|
||||
}
|
||||
ActivityLevelsInstancePauseCtrl._mapEventConfig = {
|
||||
ActivityLevels_Instance_Gameplay_Time = "OnEvent_Time",
|
||||
OpenActivityLevelsInstancePause = "Pause",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
function ActivityLevelsInstancePauseCtrl:Refresh()
|
||||
local mapCfg = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActivityId)
|
||||
local curStar = activityLevelsData:GetLevelStar(self.nLevelId)
|
||||
local tbCond = {
|
||||
mapCfg.OneStarDesc,
|
||||
mapCfg.TwoStarDesc,
|
||||
mapCfg.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgOn[i]:SetActive(i <= curStar)
|
||||
self._mapNode.imgOff[i]:SetActive(i > curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == "" then
|
||||
self._mapNode.goAim[i]:SetActive(false)
|
||||
break
|
||||
else
|
||||
self._mapNode.goAim[i]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAim[i], cond)
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:PlayInAni()
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:PlayCloseAni(bGiveUp)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, bGiveUp)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnPanelClose(_, bGiveUp)
|
||||
PanelManager.InputEnable()
|
||||
GamepadUIManager.DisableGamepadUI("ActivityLevelsInstancePauseCtrl")
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
self._mapNode.imgBlocker:SetActive(false)
|
||||
if bGiveUp then
|
||||
EventManager.Hit(EventId.AbandonBattle)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:Awake()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", 0, 0))
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Skill",
|
||||
sLang = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
{
|
||||
sAction = "Settings",
|
||||
sLang = "StarTowerMap_Btn_Settings"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnEnable()
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnDisable()
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:Pause(nActivityId, nLevelId, tbCharId)
|
||||
self.tbChar = tbCharId
|
||||
self.nLevelId = nLevelId
|
||||
self.nActivityId = nActivityId
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
PanelManager.InputDisable()
|
||||
self:PlayInAni()
|
||||
self:Refresh()
|
||||
GamepadUIManager.EnableGamepadUI("ActivityLevelsInstancePauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnEvent_Time(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_GiveUp(btn)
|
||||
local sTip = ""
|
||||
local mapCfg = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId)
|
||||
if mapCfg == nil then
|
||||
printError("没有当前关卡信息")
|
||||
sTip = "Level None"
|
||||
else
|
||||
local sAlert = orderedFormat(ConfigTable.GetUIText("RogueBoss_Pause_GiveUpTips_Simple") or "", mapCfg.Name)
|
||||
sTip = sAlert
|
||||
end
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(true)
|
||||
self._mapNode.imgBlocker:SetActive(true)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = confirmCallback,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Close(btn)
|
||||
self:PlayCloseAni(false)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Settings(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "ActivityLevelsInstancePauseCtrl" then
|
||||
return
|
||||
end
|
||||
self._mapNode.ActionBar.gameObject:SetActive(true)
|
||||
end
|
||||
return ActivityLevelsInstancePauseCtrl
|
||||
@@ -0,0 +1,347 @@
|
||||
local ActivityLevelsInstanceResultCtrl = class("ActivityLevelsInstanceResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ActivityLevelsInstanceResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
goWorldLevel = {},
|
||||
imgExp = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgExp1 = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtRankEn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtWorldExp = {sComponentName = "TMP_Text"},
|
||||
imgExpBg = {},
|
||||
txtGetWorldExp = {sComponentName = "TMP_Text"},
|
||||
goRankArrow = {},
|
||||
goRank = {},
|
||||
goStarList = {},
|
||||
getStar = {nCount = 3, sComponentName = "Transform"},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtExp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_ExpTips"
|
||||
},
|
||||
txtMaxLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Max_Level"
|
||||
},
|
||||
goGacha = {},
|
||||
animGacha = {
|
||||
sNodeName = "goGachaItem",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgFull = {sComponentName = "Image"},
|
||||
imgSplitB = {sComponentName = "Image"},
|
||||
imgSplitC = {sComponentName = "Image"},
|
||||
imgSplitD = {sComponentName = "Image"},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult"
|
||||
},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
},
|
||||
imgExpFillBg = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
ActivityLevelsInstanceResultCtrl._mapEventConfig = {}
|
||||
local starGachaCfg = {
|
||||
[1] = {
|
||||
iconPath = "icon_roguegacha_03%s",
|
||||
animName = "BattleResultgoGacha_r"
|
||||
},
|
||||
[2] = {
|
||||
iconPath = "icon_roguegacha_02%s",
|
||||
animName = "BattleResultgoGacha_sr"
|
||||
},
|
||||
[3] = {
|
||||
iconPath = "icon_roguegacha_01%s",
|
||||
animName = "BattleResultgoGacha_ssr"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsInstanceResultCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnable(self.canvas, false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
nResultState = 3
|
||||
elseif tbParam[1] then
|
||||
nResultState = 1
|
||||
elseif #tbParam == 3 and tbParam[1] == false then
|
||||
nResultState = 2
|
||||
end
|
||||
local starCount = tbParam[2]
|
||||
local GenerRewardItems = tbParam[3]
|
||||
local FirstRewardItems = tbParam[4]
|
||||
local ChestRewardItems = tbParam[5]
|
||||
local nExp = tbParam[6] or 0
|
||||
local bPureAvg = tbParam[7]
|
||||
local sLarge = tbParam[8]
|
||||
local sSmall = tbParam[9]
|
||||
local nLevelInstanceId = tbParam[10]
|
||||
local tbChar = tbParam[11]
|
||||
self.mapChangeInfo = tbParam[12]
|
||||
self.tbCharDamage = tbParam[13] or {}
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
self.mapLevelsInstance = ConfigTable.GetData("ActivityLevelsLevel", nLevelInstanceId)
|
||||
local sDailyInstanceName = ""
|
||||
if self.mapLevelsInstance ~= nil then
|
||||
sDailyInstanceName = self.mapLevelsInstance.Name
|
||||
end
|
||||
local nStar = starCount
|
||||
self.nLevelStar = nStar
|
||||
self.bSuccess = 0 < nStar
|
||||
self.mapReward = {}
|
||||
for _, v in pairs(GenerRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(FirstRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.First
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(ChestRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
NovaAPI.SetTMPText(v, sDailyInstanceName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
self:RefreshTarget(starCount)
|
||||
local nCurTeam = 5
|
||||
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
|
||||
nCurTeam = PlayerData.Mainline.nCurTeamIndex
|
||||
end
|
||||
local tbTeamMemberId, nCaptain
|
||||
if tbChar == nil then
|
||||
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
|
||||
else
|
||||
tbTeamMemberId = tbChar
|
||||
end
|
||||
local tbRoleId = {}
|
||||
for i = 1, #tbTeamMemberId do
|
||||
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
|
||||
table.insert(tbRoleId, tbTeamMemberId[i])
|
||||
end
|
||||
end
|
||||
if #tbRoleId == 0 then
|
||||
table.insert(tbRoleId, 112)
|
||||
end
|
||||
if bPureAvg then
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
else
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
local nAnimTime
|
||||
if nResultState == 1 then
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
CS.WwiseAudioManager.Instance:PlaySound("ui_roguelike_victory")
|
||||
WwiseManger:SetState("system", "victory")
|
||||
nAnimTime = 4
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
nAnimTime = 3
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnable(self.canvas, true)
|
||||
if bPureAvg then
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, nResultState == 1)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OnDisable()
|
||||
PlayerData.DailyInstance:SetSettlementState(false)
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:RefreshWorldClass(nExp)
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
local bMax = nFullExp == 0
|
||||
self._mapNode.txtWorldExp.gameObject:SetActive(not bMax)
|
||||
self._mapNode.txtMaxLevel.gameObject:SetActive(bMax)
|
||||
self._mapNode.goRank:SetActive(not bMax)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat") or "", nWorldClass))
|
||||
local nMaxWidth = 443
|
||||
local v2Size = self._mapNode.imgExpFillBg.sizeDelta
|
||||
v2Size.y = self._mapNode.imgExp.sizeDelta.y
|
||||
if bMax then
|
||||
v2Size.x = nMaxWidth
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
else
|
||||
local nfillAmount = (nCurExp - nExp) / nFullExp
|
||||
local nAddAmount = nCurExp / nFullExp
|
||||
if nCurExp - nExp <= 0 then
|
||||
nfillAmount = 0
|
||||
nAddAmount = nCurExp / nFullExp
|
||||
end
|
||||
nfillAmount = 1 < nfillAmount and 1 or nfillAmount
|
||||
v2Size.x = nMaxWidth * nfillAmount
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
nAddAmount = 1 < nAddAmount and 1 or nAddAmount
|
||||
v2Size.x = nMaxWidth * nAddAmount
|
||||
self._mapNode.imgExp1.sizeDelta = v2Size
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:RefreshTarget(starCount)
|
||||
for i = 1, 3 do
|
||||
local tr = self._mapNode.getStar[i]
|
||||
local star = tr:Find("star"):GetComponent("Transform")
|
||||
local starPass = star:Find("starPass")
|
||||
local txtCondition = tr:Find("texCondition"):GetComponent("TMP_Text")
|
||||
if i == 1 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapLevelsInstance.OneStarDesc)
|
||||
elseif i == 2 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapLevelsInstance.TwoStarDesc)
|
||||
elseif i == 3 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapLevelsInstance.ThreeStarDesc)
|
||||
end
|
||||
if nil ~= starPass then
|
||||
starPass.gameObject:SetActive(i <= starCount)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:ClosePanel()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.6)
|
||||
CS.AdventureModuleHelper.ResumeLogic()
|
||||
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
PlayerData.Base:OnBackToMainMenuModule()
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Mask, 0)
|
||||
self._mapNode.Mask.gameObject:SetActive(true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
local sequence = DOTween.Sequence()
|
||||
sequence:Append(self._mapNode.Mask:DOFade(1, 0.5):SetUpdate(true))
|
||||
sequence:AppendCallback(function()
|
||||
if self.bSuccess then
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
self._mapNode.imgBlurredBg:SetActive(false)
|
||||
else
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
self._mapNode.imgBlurredBg:SetActive(false)
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
|
||||
end
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:RefreshGacha()
|
||||
local sIconPath = "UI/big_sprites/"
|
||||
local gachaCfg = starGachaCfg[self.nLevelStar]
|
||||
if nil ~= gachaCfg then
|
||||
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
|
||||
self._mapNode.animGacha:Play(gachaCfg.animName)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OnBtnClick_Close(btn)
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OpenReward()
|
||||
if #self.mapReward > 0 then
|
||||
local nAnimTime = 2
|
||||
self._mapNode.goGacha.gameObject:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_gacha_specialOpen")
|
||||
self:RefreshGacha()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(nAnimTime))
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
self:ClosePanel()
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return ActivityLevelsInstanceResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local ActivityLevelsInstanceResultPanel = class("ActivityLevelsInstanceResultPanel", BasePanel)
|
||||
ActivityLevelsInstanceResultPanel._bAddToBackHistory = false
|
||||
ActivityLevelsInstanceResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.LevelCommon.ActivityLevelsInstanceResultCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsInstanceResultPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsInstanceResultPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsInstanceResultPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsInstanceResultPanel:OnDestroy()
|
||||
end
|
||||
return ActivityLevelsInstanceResultPanel
|
||||
@@ -0,0 +1,175 @@
|
||||
local ActivityLevelsInstanceRoomInfo = class("ActivityLevelsInstanceRoomInfo", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
ActivityLevelsInstanceRoomInfo._mapNodeConfig = {
|
||||
BossChallenge = {
|
||||
sCtrlName = "Game.UI.DailyInstanceRoomInfo.DailyInstanceExp.DailyInstanceExp"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
rtnfo = {},
|
||||
TMPTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DailyInstanceExp_SubTitle"
|
||||
},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
btnStar = {sComponentName = "Button", nCount = 3},
|
||||
rtChallengeTime = {},
|
||||
animatorTime = {
|
||||
sNodeName = "rtChallengeTime",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
AnimatorInfo = {sNodeName = "rtnfo", sComponentName = "Animator"},
|
||||
AnimatorRoot = {
|
||||
sNodeName = "BossChallenge",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
ActivityLevelsInstanceRoomInfo._mapEventConfig = {
|
||||
OpenActivityLevelsInstanceRoomInfo = "OnEvent_OpenUI",
|
||||
ActivityLevelsInstanceLevelEnd = "OnEvent_CloseUI",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
ActivityLevelsInstanceBattleEnd = "OnEvent_BattleEnd",
|
||||
ActivityLevels_Instance_Gameplay_Time = "OnEvent_SpecialMode_Count"
|
||||
}
|
||||
function ActivityLevelsInstanceRoomInfo:Awake()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:FadeIn()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:FadeOut()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEnable()
|
||||
self.bBattleEnd = false
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnDisable()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnRelease()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_OpenUI(nLevelId)
|
||||
self._mapNode.BossChallenge.gameObject:SetActive(true)
|
||||
self:StartEvent(1, nLevelId)
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_CloseUI()
|
||||
self:LevelEnd()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_InputEnable(bEnable)
|
||||
if self.bBattleEnd == true then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bEnable == true)
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_BattleEnd()
|
||||
self.bBattleEnd = true
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:StartEvent(nWaitTime, nLevelId)
|
||||
self.mapLevelCfgData = ConfigTable.GetData("ActivityLevelsLevel", nLevelId)
|
||||
self.tbTime = {
|
||||
self.mapLevelCfgData.ThreeStarCondition[1],
|
||||
self.mapLevelCfgData.TwoStarCondition[1],
|
||||
self.mapLevelCfgData.OneStarCondition[1]
|
||||
}
|
||||
self.totalTime = self.mapLevelCfgData.OneStarCondition[1]
|
||||
self.nState = 1
|
||||
self.bEnd = false
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self:SetTime(self.totalTime)
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
local nStateDesc = 3 - #self.tbTime > 0 and 3 - #self.tbTime or 1
|
||||
if nStateDesc < 3 then
|
||||
local nextStateTime = self.totalTime - self.tbTime[nStateDesc]
|
||||
if 0 < nextStateTime then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, orderedFormat(ConfigTable.GetUIText("DailyInstanceExp_SubTips"), nextStateTime, tostring(4 - nStateDesc)))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnStar[i].interactable = true
|
||||
end
|
||||
local waitCallback = function()
|
||||
self._mapNode.rtnfo:SetActive(true)
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
end
|
||||
self:AddTimer(1, nWaitTime, waitCallback, true, true, false)
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_SpecialMode_Count(nTime)
|
||||
if self.tbTime[self.nState] ~= nil then
|
||||
if self.tbTime[self.nState] - nTime <= 5 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
self._mapNode.animatorTime:Play("BossChallengeTime_show")
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
if self.tbTime[self.nState] - nTime == 5 then
|
||||
self._mapNode.AnimatorRoot:Play("BossChallenge_" .. 4 - self.nState)
|
||||
end
|
||||
if nTime >= self.tbTime[self.nState] then
|
||||
self:StageChange()
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
local RemainingT = self.totalTime - nTime
|
||||
if 0 <= RemainingT then
|
||||
self:SetTime(RemainingT)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:StageChange()
|
||||
if self.bEnd then
|
||||
return
|
||||
end
|
||||
self.nState = self.nState + 1
|
||||
local failedCallback = function()
|
||||
if self.bEnd then
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local nStateDesc = 3 - #self.tbTime + self.nState > 0 and 3 - #self.tbTime + self.nState or 1
|
||||
if nStateDesc < 3 then
|
||||
local nextStateTime = self.totalTime - self.tbTime[nStateDesc]
|
||||
if 0 < nextStateTime then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, orderedFormat(ConfigTable.GetUIText("DailyInstanceExp_SubTips"), nextStateTime, tostring(4 - nStateDesc)))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
end
|
||||
for i = 1, 3 do
|
||||
if i <= 4 - nStateDesc then
|
||||
self._mapNode.btnStar[i].interactable = true
|
||||
else
|
||||
self._mapNode.btnStar[i].interactable = false
|
||||
end
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
self._mapNode.btnStar[1].interactable = true
|
||||
self._mapNode.btnStar[2].interactable = false
|
||||
self._mapNode.btnStar[3].interactable = false
|
||||
end
|
||||
end
|
||||
failedCallback()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:SetTime(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:LevelEnd()
|
||||
self._mapNode.AnimatorInfo:Play("FRRoomInfo_rtnfo_out")
|
||||
local close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.35, close, true, true, true)
|
||||
end
|
||||
return ActivityLevelsInstanceRoomInfo
|
||||
@@ -0,0 +1,576 @@
|
||||
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
|
||||
local mapToggle = {
|
||||
[1] = GameEnum.diffculty.Diffculty_1,
|
||||
[2] = GameEnum.diffculty.Diffculty_2,
|
||||
[3] = GameEnum.diffculty.Diffculty_3,
|
||||
[4] = GameEnum.diffculty.Diffculty_4,
|
||||
[5] = GameEnum.diffculty.Diffculty_5,
|
||||
[6] = GameEnum.diffculty.Diffculty_6,
|
||||
[7] = GameEnum.diffculty.Diffculty_7,
|
||||
[8] = GameEnum.diffculty.Diffculty_8,
|
||||
[9] = GameEnum.diffculty.Diffculty_9,
|
||||
[10] = GameEnum.diffculty.Diffculty_10
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goEnemyInfo = {
|
||||
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
|
||||
},
|
||||
togTypeExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeExplore"
|
||||
},
|
||||
togTypeExploreCtrl = {
|
||||
sNodeName = "togTypeExplore",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockExplore = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockExplore"
|
||||
},
|
||||
redExplore = {},
|
||||
togTypeAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TogTypeAdventure"
|
||||
},
|
||||
togTypeAdventureCtrl = {
|
||||
sNodeName = "togTypeAdventure",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl"
|
||||
},
|
||||
lockAdventure = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClick_BtnLockAdventure"
|
||||
},
|
||||
redAdventure = {},
|
||||
rtToggles = {
|
||||
sNodeName = "srToggle",
|
||||
sComponentName = "UIScrollRect"
|
||||
},
|
||||
tog = {
|
||||
sComponentName = "UIButton",
|
||||
nCount = 10,
|
||||
callback = "OnBtnClick_Tog"
|
||||
},
|
||||
togCtrl = {
|
||||
sNodeName = "tog",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateToggleCtrl",
|
||||
nCount = 10
|
||||
},
|
||||
togAniRoot = {sNodeName = "rt_Toggle", sComponentName = "Animator"},
|
||||
txtRecommendLevel = {
|
||||
sNodeName = "txtSuggestLevel",
|
||||
sComponentName = "TMP_Text"
|
||||
},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgBuild = {sComponentName = "Image"},
|
||||
TMPName = {sComponentName = "TMP_Text"},
|
||||
detailDesc = {sComponentName = "TMP_Text"},
|
||||
btnEnemyInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_EnemyInfo"
|
||||
},
|
||||
tex_EnemyInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Equipment_Instance_EnemyInfo"
|
||||
},
|
||||
txtTitleTarget = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RogueBoss_Pause_Target"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Level_Award"
|
||||
},
|
||||
Task = {sComponentName = "Transform", nCount = 3},
|
||||
rewardRoot = {sComponentName = "Transform"},
|
||||
btn_itemTemp = {},
|
||||
btnListRoot = {},
|
||||
btnRaid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnRaid"
|
||||
},
|
||||
imgRaidUnlockMask = {},
|
||||
txtBtnRaid = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
TMPRaidUnlockHint = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_Cond"
|
||||
},
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnClickBtnGo"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Maninline_Btn_Go"
|
||||
},
|
||||
goCoin = {},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
levelLockRoot = {},
|
||||
UnlockTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapEventConfig = {
|
||||
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy"
|
||||
}
|
||||
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
|
||||
function ActivityLevelsSelectCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self.tabRewardList = {}
|
||||
self.AniRoot = self.gameObject:GetComponent("Animator")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore, {nActGroupId}, self._mapNode.redExplore)
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure, {nActGroupId}, self._mapNode.redAdventure)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEnable()
|
||||
self.timeTab = {}
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
self.SelectTogPreLvLock = nil
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in")
|
||||
self:Init()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDisable()
|
||||
self.timeTab = {}
|
||||
for i = 1, #self.tabRewardList do
|
||||
local go = self.tabRewardList[i].gameObject
|
||||
local btnSelect = self.tabRewardList[i].gameObject:GetComponent("UIButton")
|
||||
btnSelect.onClick:RemoveAllListeners()
|
||||
self:UnbindCtrlByNode(self.tabRewardList[i])
|
||||
destroy(go)
|
||||
end
|
||||
self.tabRewardList = {}
|
||||
self.SelectTogPreLvLock = nil
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnDestroy(...)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Init()
|
||||
self.activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self:RefreshTogTypeCount()
|
||||
self:Refresh()
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:Refresh()
|
||||
self.nLevelType = self.activityLevelsData:GetDefaultSelectionType()
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogTypeCount()
|
||||
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
|
||||
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
|
||||
local texExplore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texExplore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount"):GetComponent("TMP_Text")
|
||||
local texAdventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount"):GetComponent("TMP_Text")
|
||||
local totalExplore, exploreCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Explore)
|
||||
local totalAdventure, adventureCount = self.activityLevelsData:GetLevelStarMsg(GameEnum.ActivityLevelType.Adventure)
|
||||
local str = "%s/%s"
|
||||
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
|
||||
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
|
||||
if isOpenExplore then
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, string.format(str, exploreCount, totalExplore))
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, string.format(str, exploreCount, totalExplore))
|
||||
else
|
||||
NovaAPI.SetTMPText(texExplore_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texExplore_UnSelectCount, "")
|
||||
end
|
||||
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
|
||||
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
|
||||
if isOpenAdventure then
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, string.format(str, adventureCount, totalAdventure))
|
||||
else
|
||||
NovaAPI.SetTMPText(texAdventure_SelectCount, "")
|
||||
NovaAPI.SetTMPText(texAdventure_UnSelectCount, "")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockExplore()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClick_BtnLockAdventure()
|
||||
self:FirstLevelLockTips(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:FirstLevelLockTips(nType, nLevel)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, nLevel)
|
||||
local strTips = ""
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, nLevel)
|
||||
if 0 < hour then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
else
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeExplore()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Explore
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeAdventure()
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Adventure then
|
||||
return
|
||||
end
|
||||
self:CloseAllTimer()
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
self._mapNode.togAniRoot:Play("ActivityLevelsSelect_Toggle_in")
|
||||
self.nLevelType = GameEnum.ActivityLevelType.Adventure
|
||||
self:RefreshTogType(self.nLevelType)
|
||||
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
|
||||
self:RefreshTogList(self.nLevelType, nDifficulty)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:CloseAllTimer()
|
||||
for i, v in pairs(self.timeTab) do
|
||||
v:Pause(true)
|
||||
end
|
||||
self.timeTab = {}
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogType(nType)
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1))
|
||||
end
|
||||
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
|
||||
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
local explore_SelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local explore_UnSelectCount = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
local adventure_SelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_SelectCount").gameObject
|
||||
local adventure_UnSelectCount = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelectCount").gameObject
|
||||
explore_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Explore)
|
||||
explore_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Explore)
|
||||
adventure_SelectCount:SetActive(nType == GameEnum.ActivityLevelType.Adventure)
|
||||
adventure_UnSelectCount:SetActive(nType ~= GameEnum.ActivityLevelType.Adventure)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
|
||||
local tabLevelInfo, tabLevelInfoDifficulty
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
tabLevelInfo = self.activityLevelsData.levelTabExplore
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
|
||||
else
|
||||
tabLevelInfo = self.activityLevelsData.levelTabAdventure
|
||||
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
|
||||
end
|
||||
for i = 1, 10 do
|
||||
self._mapNode.tog[i].gameObject:SetActive(i <= #tabLevelInfoDifficulty)
|
||||
end
|
||||
for i = 1, #tabLevelInfoDifficulty do
|
||||
local tmpId = tabLevelInfoDifficulty[i]
|
||||
local tmpData = tabLevelInfo[tmpId]
|
||||
self._mapNode.togCtrl[i]:SetText(tmpData.baseData.Name)
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
|
||||
local objTog = self._mapNode.tog[i].gameObject
|
||||
local rt_Targets = objTog.transform:Find("AnimRoot/AnimSwitch/rt_Targets").gameObject
|
||||
local rtLockInfo = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockInfo").gameObject
|
||||
local rtLockPreLv = objTog.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv").gameObject
|
||||
local rtLockPreLvSelect = rtLockPreLv.transform:Find("rtLockPreLvSelect"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(rtLockPreLvSelect, Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1))
|
||||
local strTips = ""
|
||||
local redH = objTog.transform:Find("AnimRoot/AnimSwitch/redH").gameObject
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
if bInActGroup then
|
||||
if tmpData.baseData.Type == GameEnum.ActivityLevelType.Explore then
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
|
||||
nActGroupId,
|
||||
tmpData.baseData.Id
|
||||
}, redH)
|
||||
end
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
rt_Targets:SetActive(true)
|
||||
for j = 1, 3 do
|
||||
local btnStar = rt_Targets.gameObject.transform:Find("btnTarget" .. j):GetComponent("Button")
|
||||
btnStar.interactable = j <= tmpData.Star
|
||||
end
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(false)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
rt_Targets:SetActive(false)
|
||||
rtLockInfo:SetActive(false)
|
||||
rtLockPreLv:SetActive(true)
|
||||
elseif not isOpen then
|
||||
for i = 1, 5 do
|
||||
local objDeco = objTog.transform:Find("AnimRoot/AnimSwitch/goBg/Select/imgFlowWave1/imgDeco" .. i).gameObject
|
||||
if objDeco ~= nil then
|
||||
objDeco:SetActive(false)
|
||||
end
|
||||
end
|
||||
rt_Targets:SetActive(false)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, tmpData.baseData.Id)
|
||||
if day == 0 then
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(false)
|
||||
bgCondition:SetActive(true)
|
||||
local txtLockCondition = rtLockInfo.gameObject.transform:Find("bgCondition/txtLockCondition"):GetComponent("TMP_Text")
|
||||
local timerCount = function()
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, tmpData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color"), hour))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour)
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color"), min))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min)
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(txtLockCondition, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color"), sec))
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec)
|
||||
end
|
||||
end
|
||||
timerCount()
|
||||
self.timeTab[tmpData.baseData.Id] = self:AddTimer(0, 1, function()
|
||||
timerCount()
|
||||
end, true, true, false)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
else
|
||||
rt_Targets:SetActive(false)
|
||||
local rtLockInfoDay = rtLockInfo.gameObject.transform:Find("rtLockInfoDay").gameObject
|
||||
local bgCondition = rtLockInfo.gameObject.transform:Find("bgCondition").gameObject
|
||||
rtLockInfoDay:SetActive(true)
|
||||
bgCondition:SetActive(false)
|
||||
strTips = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day"), day)
|
||||
rtLockInfo:SetActive(true)
|
||||
rtLockPreLv:SetActive(false)
|
||||
end
|
||||
end
|
||||
local clickCb = function()
|
||||
EventManager.Hit(EventId.OpenMessageBox, strTips)
|
||||
end
|
||||
if i == nDifficulty then
|
||||
self:RefreshInstanceInfo(nType, nDifficulty, true, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_Tog(btn)
|
||||
local nHard = table.indexof(self._mapNode.tog, btn:GetComponent("UIButton"))
|
||||
local togIdx = table.indexof(self._mapNode.tog, btn)
|
||||
if nHard == nil then
|
||||
return
|
||||
end
|
||||
if self.curSelectHard ~= nHard then
|
||||
if self.SelectTogPreLvLock ~= nil then
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764, 1))
|
||||
end
|
||||
for idx, value in pairs(mapToggle) do
|
||||
if value == self.curSelectHard then
|
||||
self._mapNode.togCtrl[idx]:SetDefault(false)
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.togCtrl[togIdx]:SetDefault(true)
|
||||
self.SelectTogPreLvLock = self._mapNode.togCtrl[togIdx].gameObject.transform:Find("AnimRoot/AnimSwitch/rtLockPreLv/rtLockPreLvSelect"):GetComponent("Image")
|
||||
NovaAPI.SetImageColor(self.SelectTogPreLvLock, Color(1, 1, 1, 1))
|
||||
self:RefreshInstanceInfo(self.nLevelType, nHard, nil, false)
|
||||
local levelId = 0
|
||||
if self.nLevelType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.nLevelType, levelId)
|
||||
self.AniRoot:Play("ActivityLevelsSelect_in1")
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, bLocation, bSetTog)
|
||||
if bLocation then
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.UIScrollRectScrollTo(self._mapNode.rtToggles, nHard + 1, true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
if bSetTog then
|
||||
for i = 1, 10 do
|
||||
self._mapNode.togCtrl[i]:SetDefault(i == nHard)
|
||||
end
|
||||
end
|
||||
self.curSelectHard = nHard
|
||||
local levelId = 0
|
||||
self.selectLevelData = nil
|
||||
if nType == GameEnum.ActivityLevelType.Explore then
|
||||
levelId = self.activityLevelsData.levelTabExploreDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabExplore[levelId]
|
||||
else
|
||||
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
|
||||
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecommendLevel, self.selectLevelData.baseData.SuggestedPower)
|
||||
local sRank = "Icon/BuildRank/BuildRank_" .. self.selectLevelData.baseData.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgBuild, sRank)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPName, self.selectLevelData.baseData.Name)
|
||||
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
|
||||
self.curStar = self.selectLevelData.Star
|
||||
local tbCond = {
|
||||
self.selectLevelData.baseData.OneStarDesc,
|
||||
self.selectLevelData.baseData.TwoStarDesc,
|
||||
self.selectLevelData.baseData.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
local rtTask = self._mapNode.Task[i]
|
||||
local goDone = rtTask:Find("imgDone").gameObject
|
||||
local imgUnDone = rtTask:Find("imgUnDone").gameObject
|
||||
local Text = rtTask:Find("Text"):GetComponent("TMP_Text")
|
||||
goDone:SetActive(i <= self.curStar)
|
||||
imgUnDone:SetActive(i > self.curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
rtTask.gameObject:SetActive(false)
|
||||
return
|
||||
else
|
||||
rtTask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(Text, cond)
|
||||
end
|
||||
end
|
||||
self.PreviewMonsterGroupId = self.selectLevelData.baseData.PreviewMonsterGroupId
|
||||
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, self.selectLevelData.baseData.Id)
|
||||
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, self.selectLevelData.baseData.Id)
|
||||
local isNeedEnergyConsume = true
|
||||
if not self.selectLevelData.baseData.EnergyConsumeOnRetry and 0 < self.selectLevelData.Star then
|
||||
isNeedEnergyConsume = false
|
||||
end
|
||||
if isOpen and isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(true)
|
||||
self._mapNode.levelLockRoot:SetActive(false)
|
||||
if self.selectLevelData.baseData.ThreeStarSweep then
|
||||
self._mapNode.btnRaid.gameObject:SetActive(true)
|
||||
self._mapNode.txtBtnRaid.gameObject:SetActive(self.curStar == 3)
|
||||
self._mapNode.imgRaidUnlockMask.gameObject:SetActive(self.curStar ~= 3)
|
||||
else
|
||||
self._mapNode.btnRaid.gameObject:SetActive(false)
|
||||
end
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
local nRequire = self.selectLevelData.baseData.EnergyConsume
|
||||
if not isNeedEnergyConsume then
|
||||
nRequire = 0
|
||||
end
|
||||
self.curRequireEnergy = nRequire
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, nRequire)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
|
||||
self._mapNode.goCoin:SetActive(isNeedEnergyConsume)
|
||||
elseif isOpen and not isLevelUnLock then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.levelLockRoot:SetActive(true)
|
||||
local preLevelId = self.selectLevelData.baseData.PreLevelId
|
||||
if preLevelId ~= 0 then
|
||||
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
|
||||
end
|
||||
elseif not isOpen then
|
||||
self._mapNode.btnListRoot:SetActive(false)
|
||||
self._mapNode.levelLockRoot:SetActive(true)
|
||||
local day = self.activityLevelsData:GetUnLockDay(nType, self.selectLevelData.baseData.Id)
|
||||
if day == 0 then
|
||||
local hour, min, sec = self.activityLevelsData:GetUnLockHour(nType, self.selectLevelData.baseData.Id)
|
||||
if 0 < hour then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
|
||||
elseif 0 < min then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
|
||||
elseif 0 < sec then
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec"), sec))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.UnlockTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayOpen"), day))
|
||||
end
|
||||
end
|
||||
for i = 1, #self.tabRewardList do
|
||||
self.tabRewardList[i].gameObject:SetActive(false)
|
||||
end
|
||||
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
|
||||
for i = 1, #tbReward do
|
||||
if i > #self.tabRewardList then
|
||||
local obj = instantiate(self._mapNode.btn_itemTemp, self._mapNode.rewardRoot)
|
||||
self.tabRewardList[i] = self:BindCtrlByNode(obj, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
do
|
||||
local itemCtrl = self.tabRewardList[i]
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
if tbReward[i] ~= nil then
|
||||
local bReceived = 0 < self.selectLevelData.Star and tbReward[i][3] == 1
|
||||
local bFirstPass = tbReward[i][3] == 1
|
||||
itemCtrl:SetItem(tbReward[i][1], nil, UTILS.ParseRewardItemCount(tbReward[i]), nil, bReceived, bFirstPass, false, true)
|
||||
local btnItem = itemCtrl.gameObject:GetComponent("UIButton")
|
||||
btnItem.onClick:RemoveAllListeners()
|
||||
local clickCb = function()
|
||||
self:OnBtnClick_RewardItem(tbReward[i][1], btnItem.gameObject)
|
||||
end
|
||||
btnItem.onClick:AddListener(clickCb)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_RewardItem(nTid, btn)
|
||||
local rtBtn = btn.transform
|
||||
UTILS.ClickItemGridWithTips(nTid, rtBtn, false, true, false)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnGo()
|
||||
local nEnergy = PlayerData.Base:GetCurEnergy().nEnergy
|
||||
if nEnergy < self.curRequireEnergy then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.EnergyBuy)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.EnergyBuy, AllEnum.EnergyPanelType.Main, {}, true, callback)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("MainlineData_Energy"))
|
||||
return
|
||||
end
|
||||
self.activityLevelsData:ChangeRedDot(self.selectLevelData.baseData.Type, self.selectLevelData.baseData.Id)
|
||||
PlayerData.Activity:SetActivityLevelActId(self.nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityLevels, self.selectLevelData.baseData.Id, {
|
||||
self.nActId
|
||||
})
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
|
||||
if self.curStar ~= 3 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
|
||||
return
|
||||
end
|
||||
local nNeedEnergy = self.curRequireEnergy
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 5, self.nActId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnBtnClick_EnemyInfo()
|
||||
EventManager.Hit("OpenActivityLevelsMonsterInfo", self.PreviewMonsterGroupId)
|
||||
end
|
||||
function ActivityLevelsSelectCtrl:OnEvent_UpdateEnergy()
|
||||
local nHas = PlayerData.Base:GetCurEnergy()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCount, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
|
||||
end
|
||||
return ActivityLevelsSelectCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
|
||||
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
|
||||
ActivityLevelsSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Swim/ActivityLevels/ActivityLevelsSelect.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.Swim.ActivityLevels.ActivityLevelsSelectCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsSelectPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsSelectPanel:OnRelease()
|
||||
end
|
||||
return ActivityLevelsSelectPanel
|
||||
@@ -0,0 +1,173 @@
|
||||
local ActivitySwimCtrl = class("ActivitySwimCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
ActivitySwimCtrl._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 = "TowerDef_EnterActivity"
|
||||
}
|
||||
}
|
||||
function ActivitySwimCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivitySwimCtrl:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivitySwimCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshLockState()
|
||||
self:RefreshDate()
|
||||
self:RefreshTimeout()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function ActivitySwimCtrl:UnInit()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function ActivitySwimCtrl:UnbindCtrl()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function ActivitySwimCtrl: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 ActivitySwimCtrl: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 ActivitySwimCtrl: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 ActivitySwimCtrl: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 ActivitySwimCtrl: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 ActivitySwimCtrl: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 ActivitySwimCtrl:OnBtnClick_Go()
|
||||
local actGroupCfg = self.actData:GetActGroupCfgData()
|
||||
if actGroupCfg ~= nil then
|
||||
if actGroupCfg.TransitionId ~= nil and actGroupCfg.TransitionId > 0 then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SwimTheme, actGroupCfg.Id)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SwimTheme, actGroupCfg.Id)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivitySwimCtrl: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 ActivitySwimCtrl:ClearActivity()
|
||||
end
|
||||
return ActivitySwimCtrl
|
||||
@@ -0,0 +1,259 @@
|
||||
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.Swim.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(self:GetPanelId(), self._mapNode.rawImgActor2D, self.nNpcId)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, self:GetPanelId(), self.nNpcId)
|
||||
end
|
||||
end
|
||||
function ActivityShopCtrl:PlayEnterVoice()
|
||||
local nTimeNow = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local bFirst = self._panel.actShopData:GetShopFirstIn()
|
||||
local sTimeVoice = ""
|
||||
local nHour = tonumber(os.date("!%H", nTimeNow))
|
||||
if 6 <= nHour and nHour < 12 then
|
||||
sTimeVoice = "greetmorn_npc"
|
||||
elseif 12 <= nHour and nHour < 18 then
|
||||
sTimeVoice = "greetnoon_npc"
|
||||
else
|
||||
sTimeVoice = "greetnight_npc"
|
||||
end
|
||||
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.Swim.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.SwimShopPopup, 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,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_swimsuit_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
|
||||
self:SetActivityAtlasSprite(self._mapNode.imgRare, "Swim", 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 = "Swim/Shop/ActivityShopPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.Swim.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.Swim.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.SwimShopPopup)
|
||||
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 = "Swim/Shop/ActivityShopPopupPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.Swim.Shop.ActivityShopPopupCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityShopPopupPanel:Awake()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnEnable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDisable()
|
||||
end
|
||||
function ActivityShopPopupPanel:OnDestroy()
|
||||
end
|
||||
return ActivityShopPopupPanel
|
||||
@@ -0,0 +1,260 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local SwimThemeStoryCtrl = class("SwimThemeStoryCtrl", BaseCtrl)
|
||||
local ActivityAvgData = PlayerData.ActivityAvg
|
||||
SwimThemeStoryCtrl._mapNodeConfig = {
|
||||
goActTime = {},
|
||||
txtYear = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
svStory = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
txtPersonality = {sComponentName = "TMP_Text"},
|
||||
ctlAvgRoot = {
|
||||
sNodeName = "goAvgInfoRoot",
|
||||
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
|
||||
},
|
||||
t_fullscreen_blur_black = {},
|
||||
btnsnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickCloseLevelInfoPanel"
|
||||
},
|
||||
goPersonalityRoot = {
|
||||
sNodeName = "---Personality---"
|
||||
},
|
||||
goPersonality = {
|
||||
sNodeName = "goPersonality",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goChapterComplete = {}
|
||||
}
|
||||
SwimThemeStoryCtrl._mapEventConfig = {
|
||||
CloseActivityAvgInfo = "OnEvent_CloseAvgInfoRoot",
|
||||
Activity_Story_Done = "OnEvent_Activity_Story_Done",
|
||||
ActivityStory_All_Complate = "OnEvent_ActivityStory_All_Complate",
|
||||
Activity_Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed"
|
||||
}
|
||||
function SwimThemeStoryCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.tbAllStory = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
|
||||
self.storyNodePos = {27, -30}
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnEnable()
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnDisable()
|
||||
end
|
||||
function SwimThemeStoryCtrl:RefreshPanel()
|
||||
self:RefreshDate()
|
||||
self:RefreshStoryList()
|
||||
self:RefreshPersonality()
|
||||
end
|
||||
function SwimThemeStoryCtrl:RefreshDate()
|
||||
local nOpenTime, nEndTime = PlayerData.ActivityAvg:GetActivityOpenTime(self.nActId)
|
||||
local nYear = tonumber(os.date("%Y", nOpenTime))
|
||||
local nOpenMonth = tonumber(os.date("%m", nOpenTime))
|
||||
local nOpenDay = tonumber(os.date("%d", nOpenTime))
|
||||
local nEndDay = tonumber(os.date("%d", nEndTime))
|
||||
local nEndMonth = tonumber(os.date("%m", nEndTime))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtYear, nYear)
|
||||
local strOpenDay = string.format("%02d", nOpenDay)
|
||||
local strEndDay = string.format("%02d", nEndDay)
|
||||
local dateStr = string.format("%s/%s ~ %s/%s", nOpenMonth, strOpenDay, nEndMonth, strEndDay)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
|
||||
end
|
||||
function SwimThemeStoryCtrl:RefreshPersonality()
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
local cfg = ConfigTable.GetData("ActivityAvgLevel", self.tbAllStory[1])
|
||||
local personalityId = cfg.PersonalityId
|
||||
self._mapNode.goPersonalityRoot:SetActive(0 < personalityId)
|
||||
if personalityId <= 0 then
|
||||
return
|
||||
end
|
||||
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId)
|
||||
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPersonality, sTitle)
|
||||
local sIcon = "Icon/PlayerHead/" .. sHead
|
||||
self:SetPngSprite(self._mapNode.imgHead, sIcon)
|
||||
end
|
||||
function SwimThemeStoryCtrl:RefreshStoryList()
|
||||
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
|
||||
return
|
||||
end
|
||||
self._mapNode.svStory:SetAnim(0.07)
|
||||
self._mapNode.svStory:Init(#self.tbAllStory, self, self.OnRefreshGrid, self.OnClickGrid)
|
||||
local recentIndex = PlayerData.ActivityAvg:GetRecentAcvitityIndex(self.nActId)
|
||||
if 2 < recentIndex then
|
||||
recentIndex = recentIndex - 3
|
||||
else
|
||||
recentIndex = 0
|
||||
end
|
||||
self._mapNode.svStory:SetScrollGridPos(recentIndex, 1)
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnRefreshGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local avgCfg = ConfigTable.GetData("ActivityAvgLevel", storyId)
|
||||
local RootNode = grid.transform:Find("btnGrid/AnimRoot/RootNode"):GetComponent("RectTransform")
|
||||
local pos = RootNode.anchoredPosition
|
||||
pos.y = gridIndex % 2 == 0 and self.storyNodePos[1] or self.storyNodePos[2]
|
||||
RootNode.anchoredPosition = pos
|
||||
local goUnlock = RootNode:Find("goUnlock")
|
||||
local goComplete = RootNode:Find("goComplete")
|
||||
local goLock = RootNode:Find("goLock")
|
||||
local reddot = RootNode:Find("RedDot")
|
||||
local isTimeUnlock, isPreReaded, nOpenTime = PlayerData.ActivityAvg:IsActivityAvgUnlock(self.nActId, storyId)
|
||||
local isReaded = PlayerData.ActivityAvg:IsActivityAvgReaded(self.nActId, storyId)
|
||||
local isNew = PlayerData.ActivityAvg:IsNew(self.nActId, storyId)
|
||||
local isUnlock = isTimeUnlock and isPreReaded
|
||||
goUnlock.gameObject:SetActive(isUnlock)
|
||||
goComplete.gameObject:SetActive(isReaded)
|
||||
goLock.gameObject:SetActive(not isUnlock)
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
|
||||
nActGroupId,
|
||||
self.nActId,
|
||||
storyId
|
||||
}, reddot, nil, nil, true)
|
||||
local imgStory = RootNode:Find("imgStory"):GetComponent("Image")
|
||||
local txtIndex = goUnlock:Find("txtIndex"):GetComponent("TMP_Text")
|
||||
local txtTitle = goUnlock:Find("txtTitle"):GetComponent("TMP_Text")
|
||||
local txtComplete = goComplete:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
|
||||
local sFullPath = Settings.AB_ROOT_PATH .. avgCfg.IconRes .. ".png"
|
||||
NovaAPI.SetImageSprite(imgStory, sFullPath)
|
||||
NovaAPI.SetTMPText(txtIndex, avgCfg.Index)
|
||||
NovaAPI.SetTMPText(txtTitle, avgCfg.Name)
|
||||
if isReaded then
|
||||
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
|
||||
end
|
||||
if not isUnlock then
|
||||
local goLockBg = goLock:Find("goLockBg")
|
||||
local goTime = goLock:Find("imgTime")
|
||||
local txtTime = goLock:Find("imgTime/txtTime"):GetComponent("TMP_Text")
|
||||
local goLockState = goLock:Find("goLockState")
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = curTime - (nOpenTime + avgCfg.DayOpen * 86400)
|
||||
local blueMask = goLockState:Find("blueMask")
|
||||
if remainTime < 0 then
|
||||
goLockBg.gameObject:SetActive(true)
|
||||
goTime.gameObject:SetActive(true)
|
||||
local bPreTimeUnlock = true
|
||||
if avgCfg.PreLevelId ~= 0 then
|
||||
bPreTimeUnlock = PlayerData.ActivityAvg:IsActivityAvgUnlock(self.nActId, avgCfg.PreLevelId)
|
||||
end
|
||||
if not bPreTimeUnlock then
|
||||
goTime.gameObject:SetActive(false)
|
||||
goLockState.gameObject:SetActive(true)
|
||||
blueMask.gameObject:SetActive(false)
|
||||
else
|
||||
goLockState.gameObject:SetActive(false)
|
||||
local strTime = self:GetRemainTimeStr(nOpenTime, avgCfg.DayOpen)
|
||||
self:AddTimer(0, 1, function()
|
||||
local strTime, bLock = self:GetRemainTimeStr(nOpenTime, avgCfg.DayOpen)
|
||||
if bLock then
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
else
|
||||
self:RefreshStoryList()
|
||||
end
|
||||
end, true, true, true)
|
||||
NovaAPI.SetTMPText(txtTime, strTime)
|
||||
end
|
||||
else
|
||||
goLockBg.gameObject:SetActive(false)
|
||||
goTime.gameObject:SetActive(false)
|
||||
goLockState.gameObject:SetActive(true)
|
||||
blueMask.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnClickGrid(grid, index)
|
||||
local gridIndex = index + 1
|
||||
local storyId = self.tbAllStory[gridIndex]
|
||||
local isTimeUnlock, isPreReaded, nOpenTime = PlayerData.ActivityAvg:IsActivityAvgUnlock(self.nActId, storyId)
|
||||
local isUnlock = isTimeUnlock and isPreReaded
|
||||
local avgcfg = ConfigTable.GetData("ActivityAvgLevel", storyId)
|
||||
if not isUnlock then
|
||||
if isTimeUnlock and not isPreReaded then
|
||||
local cfg = ConfigTable.GetData("ActivityAvgLevel", avgcfg.PreLevelId)
|
||||
local lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", cfg.Name)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = lockTxt
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
elseif not isTimeUnlock then
|
||||
local remainTimeStr = self:GetRemainTimeStr(nOpenTime, avgcfg.DayOpen)
|
||||
EventManager.Hit(EventId.OpenMessageBox, remainTimeStr)
|
||||
end
|
||||
return
|
||||
end
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ctlAvgRoot:OpenLevelInfo(storyId, self.nActId)
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(true)
|
||||
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. storyId, true)
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
function SwimThemeStoryCtrl:GetRemainTimeStr(nOpenTime, openDay)
|
||||
local timeStr = ""
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local openTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
|
||||
local nRemainTime = openTime + openDay * 86400 - curTime
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
local sec = nRemainTime - hour * 3600 - min * 60
|
||||
if 0 < day then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color"), day)
|
||||
elseif 0 < hour then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color"), hour)
|
||||
elseif 0 < min then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color"), min)
|
||||
elseif 0 < sec then
|
||||
timeStr = orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color"), sec)
|
||||
end
|
||||
return timeStr, 0 < nRemainTime
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnBtn_ClickBack()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.SwimThemeStory)
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnBtn_ClickHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnEvent_CloseAvgInfoRoot()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnEvent_Activity_Story_Done()
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(false)
|
||||
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goChapterComplete:SetActive(false)
|
||||
self:RefreshPanel()
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnEvent_ActivityStory_All_Complate()
|
||||
self.bAllComplate = true
|
||||
end
|
||||
function SwimThemeStoryCtrl:OnEvent_Activity_Story_RewardClosed()
|
||||
if self.bAllComplate then
|
||||
self._mapNode.t_fullscreen_blur_black:SetActive(true)
|
||||
self._mapNode.goChapterComplete:SetActive(true)
|
||||
self.bAllComplate = false
|
||||
end
|
||||
end
|
||||
return SwimThemeStoryCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local SwimThemeStoryPanel = class("SwimThemeStoryPanel", BasePanel)
|
||||
SwimThemeStoryPanel._sUIResRootPath = "UI_Activity/"
|
||||
SwimThemeStoryPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Swim/Story/SwimThemeStoryPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.Swim.Story.SwimThemeStoryCtrl"
|
||||
}
|
||||
}
|
||||
function SwimThemeStoryPanel:Awake()
|
||||
end
|
||||
function SwimThemeStoryPanel:OnEnable()
|
||||
end
|
||||
function SwimThemeStoryPanel:OnDisable()
|
||||
end
|
||||
function SwimThemeStoryPanel:OnDestroy()
|
||||
end
|
||||
function SwimThemeStoryPanel:OnRelease()
|
||||
end
|
||||
return SwimThemeStoryPanel
|
||||
@@ -0,0 +1,761 @@
|
||||
local BaseCtrl = require("GameCore.UI.BaseCtrl")
|
||||
local SwimThemeCtrl = class("SwimThemeCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
SwimThemeCtrl._mapNodeConfig = {
|
||||
btnEntrance_ = {
|
||||
nCount = 5,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickActivityEntrance"
|
||||
},
|
||||
imgActivityTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtActivityDate = {sComponentName = "TMP_Text"},
|
||||
imgEnd = {},
|
||||
txtActivityEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgMiniGame = {sComponentName = "Image"},
|
||||
txtMiniGame = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game"
|
||||
},
|
||||
imgMiniGameEnd = {},
|
||||
txtMiniGameEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Mini_Game"
|
||||
},
|
||||
txtMiniGame_End = {},
|
||||
txtTask = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress = {sComponentName = "TMP_Text"},
|
||||
imgTaskActivityTime = {},
|
||||
txtTaskActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtStory = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
imgStory = {sComponentName = "Image"},
|
||||
imgStoryIcon = {sComponentName = "Image"},
|
||||
imgStoryEnd = {},
|
||||
goStoryEnd = {},
|
||||
txtStory_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Story"
|
||||
},
|
||||
imgStoryIconEnd = {},
|
||||
txtStoryEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtMiniGameEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtTaskEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShopEndState = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
txtShop = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Shop"
|
||||
},
|
||||
imgShopActivityTime = {},
|
||||
txtShopActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgLevel = {sComponentName = "Image"},
|
||||
txtLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
goLevelEnd = {},
|
||||
txtLevelEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_End"
|
||||
},
|
||||
imgLevelActivityUnlockTime = {},
|
||||
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
txtLevel_End = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Level"
|
||||
},
|
||||
imgLevelEnd = {},
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
imgMiniGameActivityUnlockTime = {},
|
||||
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgTaskBgEnd = {},
|
||||
imgTaskEnd = {},
|
||||
txtTaskEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Task"
|
||||
},
|
||||
txtTaskProgress_End = {},
|
||||
imgTaskActivityUnlockTime = {},
|
||||
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityTime = {},
|
||||
txtStoryActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgStoryActivityUnlockTime = {},
|
||||
txtStoyActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgShopActivityUnlockTime = {},
|
||||
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
|
||||
imgLevelActivityTime = {},
|
||||
txtLevelActivityTime = {sComponentName = "TMP_Text"},
|
||||
imgMiniGameActivityTime = {},
|
||||
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
|
||||
txtShopEnd = {},
|
||||
imgShopEnd = {},
|
||||
txtShop_End = {},
|
||||
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
|
||||
redDotEntrance2 = {},
|
||||
storyRedDot = {},
|
||||
reddotLevel = {}
|
||||
}
|
||||
SwimThemeCtrl._mapEventConfig = {}
|
||||
SwimThemeCtrl._mapRedDotConfig = {}
|
||||
local ActivityState = {
|
||||
NotOpen = 1,
|
||||
Open = 2,
|
||||
Closed = 3
|
||||
}
|
||||
function SwimThemeCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.SwimThemeData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
|
||||
if self.SwimThemeData ~= nil then
|
||||
self.ActivityGroupCfg = self.SwimThemeData.actGroupConfig
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:FadeIn()
|
||||
EventManager.Hit(EventId.SetTransition)
|
||||
end
|
||||
function SwimThemeCtrl:OnEnable()
|
||||
self:RefreshPanel()
|
||||
for i = 1, 5 do
|
||||
local actData = self.SwimThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.redDotEntrance2)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.storyRedDot)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
local nActId = actData.ActivityId
|
||||
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
|
||||
self.nActId,
|
||||
nActId
|
||||
}, self._mapNode.reddotLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:OnDisable()
|
||||
if nil ~= self.minigameRemainTimer then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.remainTimer then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
if nil ~= self.shopRemainTimer then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.levelRemainTimer then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.avgRemainTimer then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
end
|
||||
if nil ~= self.taskRemainTimer then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RefreshPanel()
|
||||
if self.SwimThemeData == nil or self.ActivityGroupCfg == nil then
|
||||
return
|
||||
end
|
||||
self:RefreshTime()
|
||||
self:RefreshButtonState()
|
||||
end
|
||||
function SwimThemeCtrl:RefreshTime()
|
||||
local bOpen = self.SwimThemeData:CheckActivityGroupOpen()
|
||||
if bOpen then
|
||||
self:RefreshRemainTime(self.SwimThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(self.SwimThemeData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgActivityTime:SetActive(bOpen)
|
||||
self._mapNode.imgEnd:SetActive(not bOpen)
|
||||
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.SwimThemeData: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.txtActivityDate, dateStr)
|
||||
end
|
||||
function SwimThemeCtrl: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 SwimThemeCtrl: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 SwimThemeCtrl:RefreshButtonState()
|
||||
self.tbActState = {}
|
||||
for i = 1, 5 do
|
||||
local actData = self.SwimThemeData:GetActivityDataByIndex(i)
|
||||
if i == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Task then
|
||||
self:RefreshTaskButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
self:RefreshStoryButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
|
||||
self:RefreshLevelButtonState(actData)
|
||||
elseif i == AllEnum.ActivityThemeFuncIndex.Shop then
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RefreshMiniGameButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local state = ActivityState.NotOpen
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local bShowCountDown = false
|
||||
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 == self.minigameRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMiniGameActivityUnlockTime, sTimeStr)
|
||||
self.minigameRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtMiniGameActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
end
|
||||
if nil == self.minigameRemainTimer and bShowCountDown then
|
||||
self:RefreshRemainTime(endTime, self._mapNode.txtMiniGameActivityTime)
|
||||
self.minigameRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, self._mapNode.txtMiniGameActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.minigameRemainTimer)
|
||||
self.minigameRemainTimer = nil
|
||||
self:RefreshMiniGameButtonState(actData)
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgMiniGameActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgMiniGameActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgMiniGameEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RefreshTaskButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local actInsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
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
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
end
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
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 == self.taskRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskActivityUnlockTime, sTimeStr)
|
||||
self.taskRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshTaskButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and nil == self.taskRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
self:RefreshRemainTime(endTime, self._mapNode.txtTaskActivityTime)
|
||||
self.taskRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, self._mapNode.txtTaskActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.taskRemainTimer)
|
||||
self.taskRemainTimer = nil
|
||||
if actInsData ~= nil then
|
||||
actInsData:RefreshTaskRedDot()
|
||||
end
|
||||
self:RefreshTaskButtonState(actData)
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
self._mapNode.imgTaskActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.txtTaskProgress_End:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskProgressEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskBgEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtTaskProgress.gameObject:SetActive(state >= ActivityState.Open)
|
||||
self.tbActState[activityId] = state
|
||||
local ActivityTaskData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
local nDone, nTotal = 0, 0
|
||||
if ActivityTaskData ~= nil then
|
||||
nDone, nTotal = ActivityTaskData:CalcTotalProgress()
|
||||
end
|
||||
local progress = string.format("%d/%d", nDone, nTotal)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgress, progress)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTaskProgressEnd, progress)
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RefreshStoryButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
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
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
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 == self.avgRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStoyActivityUnlockTime, sTimeStr)
|
||||
self.avgRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtStoyActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshStoryButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open then
|
||||
if nil == self.avgRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
self:RefreshRemainTime(endTime, self._mapNode.txtStoryActivityTime)
|
||||
self.avgRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, self._mapNode.txtStoryActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.avgRemainTimer)
|
||||
self.avgRemainTimer = nil
|
||||
self:RefreshStoryButtonState(actData)
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Closed then
|
||||
PlayerData.ActivityAvg:RefreshAvgRedDot()
|
||||
end
|
||||
self._mapNode.imgStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryIconEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtStory_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goStoryEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgStoryActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgStoryActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RefreshLevelButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
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
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
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 == self.levelRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelActivityUnlockTime, sTimeStr)
|
||||
self.levelRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshLevelButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if nil ~= activityLevelsData then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open then
|
||||
if nil == self.levelRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
self:RefreshRemainTime(endTime, self._mapNode.txtLevelActivityTime)
|
||||
self.levelRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, self._mapNode.txtLevelActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.levelRemainTimer)
|
||||
self.levelRemainTimer = nil
|
||||
self:RefreshLevelButtonState(actData)
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if activityLevelsData ~= nil then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Closed then
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(activityId)
|
||||
if activityLevelsData ~= nil then
|
||||
activityLevelsData:ChangeAllRedHot()
|
||||
end
|
||||
end
|
||||
self._mapNode.imgLevelActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgLevelActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.imgLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RefreshShopButtonState(actData)
|
||||
local activityId = actData.ActivityId
|
||||
local activityData = ConfigTable.GetData("Activity", activityId)
|
||||
if activityData ~= nil then
|
||||
local bShowCountDown = false
|
||||
local state = ActivityState.NotOpen
|
||||
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)
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
if openTime > curTime then
|
||||
state = ActivityState.NotOpen
|
||||
elseif openTime <= curTime and endTime >= curTime then
|
||||
state = ActivityState.Open
|
||||
else
|
||||
state = ActivityState.Closed
|
||||
end
|
||||
if endTime > self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = curTime >= self.SwimThemeData:GetActGroupEndTime()
|
||||
elseif endTime < self.SwimThemeData:GetActGroupEndTime() then
|
||||
bShowCountDown = endTime - curTime <= 259200
|
||||
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 == self.shopRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" then
|
||||
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.StartTime)
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtShopActivityUnlockTime, sTimeStr)
|
||||
self.shopRemainTimer = self:AddTimer(0, 1, function()
|
||||
curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = openTime - curTime
|
||||
if 0 < remainTime then
|
||||
local sTimeStr = self:RefreshRemainOpenTime(openTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtShopActivityUnlockTime, sTimeStr)
|
||||
else
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(false)
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
self.tbActState[activityId] = ActivityState.Open
|
||||
self:RefreshShopButtonState(actData)
|
||||
self:RefreshActivityData()
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
elseif state == ActivityState.Open and nil == self.shopRemainTimer and activityData.StartTime ~= "" and activityData.EndTime ~= "" and bShowCountDown then
|
||||
local endTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(activityData.EndTime)
|
||||
self:RefreshRemainTime(endTime, self._mapNode.txtShopActivityTime)
|
||||
self.shopRemainTimer = self:AddTimer(0, 1, function()
|
||||
local remainTime = self:RefreshRemainTime(endTime, self._mapNode.txtShopActivityTime)
|
||||
if remainTime <= 0 then
|
||||
TimerManager.Remove(self.shopRemainTimer)
|
||||
self.shopRemainTimer = nil
|
||||
self:RefreshShopButtonState(actData)
|
||||
end
|
||||
end, true, true, false)
|
||||
end
|
||||
self._mapNode.imgShopActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
|
||||
self._mapNode.imgShopActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
|
||||
self._mapNode.txtShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.imgShopEnd:SetActive(state == ActivityState.Closed)
|
||||
self._mapNode.txtShop_End:SetActive(state == ActivityState.Closed)
|
||||
self.tbActState[activityId] = state
|
||||
end
|
||||
end
|
||||
function SwimThemeCtrl:RequireActiviyData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
local callFunc = function(mapMsgData)
|
||||
self.bRequireSucc = true
|
||||
PlayerData.Activity:CacheAllActivityData(mapMsgData)
|
||||
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 SwimThemeCtrl:RefreshActivityData()
|
||||
if self.bRequiredActData then
|
||||
return
|
||||
end
|
||||
self:AddTimer(1, 3, self.RequireActiviyData, true, true, true)
|
||||
end
|
||||
function SwimThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
|
||||
local actData = self.SwimThemeData:GetActivityDataByIndex(nIndex)
|
||||
local state = self.tbActState[actData.ActivityId]
|
||||
if nil == state then
|
||||
return
|
||||
end
|
||||
if state == ActivityState.Closed then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
return
|
||||
elseif state == ActivityState.NotOpen then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
return
|
||||
elseif state == ActivityState.Open then
|
||||
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if activityData == nil then
|
||||
local bHint = true
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
|
||||
bHint = not PlayerData.ActivityAvg:HasActivityData(actData.ActivityId)
|
||||
end
|
||||
if self.bRequiredActData and bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Data_Refreshing"))
|
||||
return
|
||||
end
|
||||
if bHint then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
|
||||
self:RequireActiviyData()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if actData.PanelId ~= nil and ActivityState.Open == state then
|
||||
if nIndex == AllEnum.ActivityThemeFuncIndex.MiniGame then
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
local miniGameData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
|
||||
if miniGameData ~= nil then
|
||||
miniGameData:RequestLevelData(0, callback)
|
||||
end
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
|
||||
end
|
||||
end
|
||||
end
|
||||
return SwimThemeCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local BasePanel = require("GameCore.UI.BasePanel")
|
||||
local SwimThemePanel = class("SwimThemePanel", BasePanel)
|
||||
SwimThemePanel._sUIResRootPath = "UI_Activity/"
|
||||
SwimThemePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Swim/SwimThemePanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.Swim.SwimThemeCtrl"
|
||||
}
|
||||
}
|
||||
function SwimThemePanel:Awake()
|
||||
end
|
||||
function SwimThemePanel:OnEnable()
|
||||
end
|
||||
function SwimThemePanel:OnDisable()
|
||||
end
|
||||
function SwimThemePanel:OnDestroy()
|
||||
end
|
||||
function SwimThemePanel:OnRelease()
|
||||
end
|
||||
return SwimThemePanel
|
||||
@@ -0,0 +1,364 @@
|
||||
local SwimTaskCtrl = class("SwimTaskCtrl", 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"
|
||||
}
|
||||
SwimTaskCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
svList_Tab = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_Task = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svList_GroupReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgGroupDone = {},
|
||||
tmpGroupName = {sComponentName = "TMP_Text"},
|
||||
tmpGroupProgress = {sComponentName = "TMP_Text"},
|
||||
tmpGroupUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
btnGroupDone = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "onBtn_GroupDone"
|
||||
},
|
||||
tb_tmpReceived = {
|
||||
nCount = 3,
|
||||
sNodeName = "tmpReceived_",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
tmpUndone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
tmpDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
tmpJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
tmpGroupDone = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
}
|
||||
}
|
||||
SwimTaskCtrl._mapEventConfig = {
|
||||
onClick_RewardItem = "onEvent_ClickRewardItem",
|
||||
onClick_TaskDone = "onEvent_ClickTaskDone",
|
||||
onClick_TaskJump = "onEvent_ClickTaskJump"
|
||||
}
|
||||
SwimTaskCtrl._mapRedDotConfig = {}
|
||||
function SwimTaskCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
|
||||
self.nCurGroupIndex = tbParam[2] or 1
|
||||
if type(self.nActivityId) ~= "number" then
|
||||
self.nActivityId = nil
|
||||
end
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task()
|
||||
self:refresh_Group()
|
||||
end
|
||||
function SwimTaskCtrl: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 SwimTaskCtrl:refresh_Tab()
|
||||
self._mapNode.svList_Tab:Init(#self.tbData, self, self.onGridRefresh_Tab, self.onGridBtnClick_Tab)
|
||||
end
|
||||
function SwimTaskCtrl: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
|
||||
tr:Find("scale_on_click/imgDb_on").localScale = self.nCurGroupIndex == nIndex and Vector3.one or Vector3.zero
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/tmpTabName"):GetComponent("TMP_Text"), ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_off/tmpTabProgress_off"):GetComponent("TMP_Text"), sProgress)
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/imgDb_on/tmpTabProgress_on"):GetComponent("TMP_Text"), sProgress)
|
||||
local goRedDot = tr:Find("scale_on_click/redDotTab")
|
||||
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
nActGroupId,
|
||||
self.nActivityId,
|
||||
mapData.nGroupId
|
||||
}, goRedDot, nil, nil, true)
|
||||
end
|
||||
function SwimTaskCtrl:onGridBtnClick_Tab(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
if self.nCurGroupIndex ~= nIndex then
|
||||
go.transform.parent:GetChild(self.nCurGroupIndex - 1):Find("scale_on_click/imgDb_on").localScale = Vector3.zero
|
||||
self.nCurGroupIndex = nIndex
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
self:refresh_Group()
|
||||
end
|
||||
end
|
||||
function SwimTaskCtrl: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 SwimTaskCtrl: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 SwimTaskCtrl: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 SwimTaskCtrl:onEvent_ClickTaskDone(goBtn)
|
||||
local nTaskId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if nTaskId ~= nil then
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Task(true)
|
||||
self:refresh_Group()
|
||||
end
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskRewardReceiveReq(mapData.nGroupId, 0, mapData.nTabType, cb)
|
||||
end
|
||||
end
|
||||
function SwimTaskCtrl:onEvent_ClickTaskJump(goBtn)
|
||||
local nJumpId = tonumber(goBtn.transform:GetChild(0).name)
|
||||
if 0 < nJumpId then
|
||||
JumpUtil.JumpTo(nJumpId)
|
||||
end
|
||||
end
|
||||
function SwimTaskCtrl:refresh_Group()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local nGroupId = mapData.nGroupId
|
||||
local tbTaskData = mapData.tbTaskData
|
||||
self.bGot = table.indexof(self.ins_ActivityTaskData.tbActivityTaskGroupIds, nGroupId) > 0
|
||||
local nDone = mapData.nTaskDoneNum
|
||||
local nOK = mapData.nTaskOKNum
|
||||
local nTotal = #tbTaskData
|
||||
local bDone = nOK == nTotal
|
||||
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, ConfigTable.GetUIText(tbTabNameUITextId[mapCfgData_ActivityTaskGroup.TaskTabType]))
|
||||
NovaAPI.SetTMPText(self._mapNode.tmpGroupProgress, string.format("%s/%s", tostring(nDone), tostring(nTotal)))
|
||||
self._mapNode.tmpGroupUndone.transform.localScale = bDone == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.btnGroupDone.transform.localScale = bDone == true and self.bGot == false and Vector3.one or Vector3.zero
|
||||
self._mapNode.imgGroupDone.transform.localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
self.tbCurGroupRewardId = mapData.tbGroupRewardId
|
||||
self.tbCurGroupRewardNum = mapData.tbGroupRewardNum
|
||||
self._mapNode.svList_GroupReward:Init(#self.tbCurGroupRewardId, self, self.onGridRefresh_GroupRewardItem, self.onGridBtnClick_GroupRewardItem)
|
||||
end
|
||||
function SwimTaskCtrl:onGridRefresh_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
|
||||
local tr = go.transform
|
||||
self:SetSprite_FrameColor(tr:Find("scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
|
||||
self:SetPngSprite(tr:Find("scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
|
||||
tr:Find("scale_on_click/goReceived").localScale = self.bGot == true and Vector3.one or Vector3.zero
|
||||
local nNum = self.tbCurGroupRewardNum[nIndex]
|
||||
local sNum = mapCfgData_Item.Type ~= ItemType.Char and mapCfgData_Item.Type ~= ItemType.Disc and "×" .. tostring(nNum) or ""
|
||||
NovaAPI.SetTMPText(tr:Find("scale_on_click/tmpCount").gameObject:GetComponent("TMP_Text"), sNum)
|
||||
tr:Find("scale_on_click/goTimeLimit").localScale = mapCfgData_Item.ExpireType > 0 and Vector3.one or Vector3.zero
|
||||
end
|
||||
function SwimTaskCtrl:onGridBtnClick_GroupRewardItem(go)
|
||||
local nIndex = tonumber(go.name) + 1
|
||||
UTILS.ClickItemGridWithTips(self.tbCurGroupRewardId[nIndex], go.transform, true, true, true)
|
||||
end
|
||||
function SwimTaskCtrl:onBtn_GroupDone()
|
||||
local mapData = self.tbData[self.nCurGroupIndex]
|
||||
local cb = function()
|
||||
self:BuildData(self.nActivityId)
|
||||
self:refresh_Tab()
|
||||
self:refresh_Group()
|
||||
end
|
||||
self.ins_ActivityTaskData:SendMsg_ActivityTaskGroupRewardReceiveReq(mapData.nGroupId, cb)
|
||||
end
|
||||
return SwimTaskCtrl
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user