Major Update - 2.0.0.143

EN: 2.0.0.143
CN: 2.0.0.142
JP: 2.0.0.145
KR: 2.0.0.150
This commit is contained in:
SL1900
2026-10-20 13:00:00 +09:00
parent 4bcada6061
commit 08b515afd9
1773 changed files with 1095195 additions and 65670 deletions
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SpringFestivalStoryCtrl = class("SpringFestivalStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
SpringFestivalStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -48,7 +47,9 @@ function SpringFestivalStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {27, -30}
self.tbGridTimer = {}
self.nScrollTime = 0.5
@@ -63,13 +64,13 @@ function SpringFestivalStoryCtrl:RefreshPanel()
self:RefreshStoryList()
end
function SpringFestivalStoryCtrl:RefreshStoryList()
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
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)
local recentStoryId = PlayerData.ActivityAvg:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -106,9 +107,9 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
local goLockState = btnGridText.transform:Find("scale_on_click/goLockState").gameObject
local goComplete = btnGridText.transform:Find("scale_on_click/goComplete").gameObject
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local isUnlock, tbResult = PlayerData.ActivityAvg:IsUnlock(avgcfg.ConditionId)
local isReaded = PlayerData.ActivityAvg:IsStoryReaded(storyId)
local bOpen, nOpenTime = PlayerData.ActivityAvg:IsOpen(avgcfg.StoryId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId)
self:SetPngSprite(imgStory, string.format("Icon/ActivityStory/ep_event03_%02d", gridIndex))
imgStory.gameObject:SetActive(bOpen and isUnlock)
NovaAPI.SetTMPText(txtTitle, avgcfg.Index)
@@ -138,12 +139,16 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -152,10 +157,10 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -180,7 +185,7 @@ function SpringFestivalStoryCtrl:OnRefreshGrid(grid, index)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -272,6 +277,7 @@ function SpringFestivalStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SpringFestivalStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -281,7 +287,7 @@ function SpringFestivalStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function SpringFestivalStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -291,9 +297,11 @@ function SpringFestivalStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function SpringFestivalStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return SpringFestivalStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SpringFestivalStoryPanel = class("SpringFestivalStoryPanel", BasePanel)
SpringFestivalStoryPanel._sUIResRootPath = "UI_Activity/"
SpringFestivalStoryPanel._tbDefine = {
{
sPrefabPath = "10104/Story/SpringThemeStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10104/SpringThemeStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10104.Story.SpringFestivalStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SpringFestivalStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SpringFestivalStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local WinterNightStoryCtrl = class("WinterNightStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
WinterNightStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -48,7 +47,9 @@ function WinterNightStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.nScrollTime = 0.5
@@ -63,11 +64,11 @@ function WinterNightStoryCtrl:RefreshPanel()
self:RefreshStoryList()
end
function WinterNightStoryCtrl:RefreshStoryList()
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = PlayerData.ActivityAvg:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -114,9 +115,9 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
local child = grpRock:GetChild(i - 1)
child.gameObject:SetActive(i == rocketIndex)
end
local isUnlock, tbResult = PlayerData.ActivityAvg:IsUnlock(avgcfg.ConditionId)
local isReaded = PlayerData.ActivityAvg:IsStoryReaded(storyId)
local bOpen, nOpenTime = PlayerData.ActivityAvg:IsOpen(avgcfg.StoryId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId)
local nIndex = 0
if isUnlock then
nIndex = avgcfg.IsBattle and 2 or 1
@@ -156,12 +157,16 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -170,10 +175,10 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -198,7 +203,7 @@ function WinterNightStoryCtrl:OnRefreshGrid(grid, index)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -288,6 +293,7 @@ function WinterNightStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function WinterNightStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -297,7 +303,7 @@ function WinterNightStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function WinterNightStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -307,9 +313,11 @@ function WinterNightStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function WinterNightStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return WinterNightStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local WinterNightStoryPanel = class("WinterNightStoryPanel", BasePanel)
WinterNightStoryPanel._sUIResRootPath = "UI_Activity/"
WinterNightStoryPanel._tbDefine = {
{
sPrefabPath = "10105/Story/WinterNightStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10105/WinterNightStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10105.Story.WinterNightStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function WinterNightStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function WinterNightStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local PostalStoryCtrl = class("PostalStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
PostalStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -50,7 +49,9 @@ function PostalStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -70,11 +71,11 @@ function PostalStoryCtrl:RefreshPanel()
end
function PostalStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -119,9 +120,9 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local btnGridText = grid.transform:Find("btnGridText").gameObject
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -174,12 +175,16 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -188,10 +193,10 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -216,7 +221,7 @@ function PostalStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIndex)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -355,6 +360,7 @@ function PostalStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function PostalStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -364,7 +370,7 @@ function PostalStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function PostalStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -374,9 +380,11 @@ function PostalStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function PostalStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return PostalStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local PostalStoryPanel = class("PostalStoryPanel", BasePanel)
PostalStoryPanel._sUIResRootPath = "UI_Activity/"
PostalStoryPanel._tbDefine = {
{
sPrefabPath = "10106/Story/PostalStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10106/PostalStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10106.Story.PostalStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function PostalStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function PostalStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local ViewfinderStoryCtrl = class("ViewfinderStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
ViewfinderStoryCtrl._mapNodeConfig = {
svStory = {
@@ -52,7 +51,9 @@ function ViewfinderStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {-187.2, -270.5}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -72,11 +73,11 @@ function ViewfinderStoryCtrl:RefreshPanel()
end
function ViewfinderStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -123,9 +124,9 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
local txtTitle = RootNode:Find("tmpGroupDone"):GetComponent("TMP_Text")
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -177,12 +178,16 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -191,10 +196,10 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -219,7 +224,7 @@ function ViewfinderStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchIn
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -355,6 +360,7 @@ function ViewfinderStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function ViewfinderStoryCtrl:OnEvent_StoryDialog_DialogEnd()
WwiseAudioMgr:SetState("menuTransition", "open")
@@ -367,7 +373,7 @@ function ViewfinderStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function ViewfinderStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -377,9 +383,11 @@ function ViewfinderStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function ViewfinderStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return ViewfinderStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local ViewfinderStoryPanel = class("ViewfinderStoryPanel", BasePanel)
ViewfinderStoryPanel._sUIResRootPath = "UI_Activity/"
ViewfinderStoryPanel._tbDefine = {
{
sPrefabPath = "10107/Story/ViewfinderStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10107/ViewfinderStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10107.Story.ViewfinderStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function ViewfinderStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function ViewfinderStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local TechStoryCtrl = class("TechStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
TechStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -74,7 +73,9 @@ function TechStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {-23.7, -107}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -100,7 +101,7 @@ function TechStoryCtrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
@@ -111,11 +112,11 @@ function TechStoryCtrl:RefreshPersonality()
end
function TechStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -165,9 +166,9 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
local txtTitle = RootNode:Find("tmpGroupDone"):GetComponent("TMP_Text")
local txtComplete = goComplete.transform:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
NovaAPI.CtrlDotweenAnimation(dotweenGear, isUnlock and bOpen and 1 or 0)
imgStory.gameObject:SetActive(true)
if bOpen and isUnlock then
@@ -208,12 +209,16 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -222,10 +227,10 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
ActivityAvgData:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -250,7 +255,7 @@ function TechStoryCtrl:RefreshGridInfo(grid, gridIndex)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -366,6 +371,7 @@ function TechStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function TechStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -375,7 +381,7 @@ function TechStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function TechStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -385,9 +391,11 @@ function TechStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function TechStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return TechStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local TechStoryPanel = class("TechStoryPanel", BasePanel)
TechStoryPanel._sUIResRootPath = "UI_Activity/"
TechStoryPanel._tbDefine = {
{
sPrefabPath = "10108/Story/TechStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10108/TechStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10108.Story.TechStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function TechStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function TechStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local GunStormStoryCtrl = class("GunStormStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
GunStormStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -56,7 +55,9 @@ function GunStormStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -113,11 +114,11 @@ function GunStormStoryCtrl:RefreshPanel()
end
function GunStormStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -165,9 +166,9 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
local btnGridText = grid.transform:Find("btnGridText")
local imgDb = btnGridText:Find("scale_on_click/grpTitle/imgDb")
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -212,12 +213,16 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -226,10 +231,10 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -254,7 +259,7 @@ function GunStormStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInde
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -371,6 +376,7 @@ function GunStormStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function GunStormStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -380,7 +386,7 @@ function GunStormStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function GunStormStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -390,9 +396,11 @@ function GunStormStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function GunStormStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return GunStormStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local GunStormStoryPanel = class("GunStormStoryPanel", BasePanel)
GunStormStoryPanel._sUIResRootPath = "UI_Activity/"
GunStormStoryPanel._tbDefine = {
{
sPrefabPath = "10109/Story/GunStormStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10109/GunStormStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10109.Story.GunStormStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function GunStormStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function GunStormStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SummerAdvStoryCtrl = class("SummerAdvStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResType = GameResourceLoader.ResType
local typeof = typeof
@@ -94,7 +93,9 @@ function SummerAdvStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -149,6 +150,7 @@ end
function SummerAdvStoryCtrl:RefreshPanel()
self:RefreshStoryList()
self:RefreshPersonality()
self._mapNode.btnReview.gameObject:SetActive(not self.bReview)
end
function SummerAdvStoryCtrl:RefreshPersonality()
local cfg = ConfigTable.GetData("ActivityStoryChapter", self.nActId)
@@ -157,7 +159,7 @@ function SummerAdvStoryCtrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
@@ -168,11 +170,11 @@ function SummerAdvStoryCtrl:RefreshPersonality()
end
function SummerAdvStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -224,9 +226,9 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
local goLockState = grid.transform:Find("btnGridText/scale_on_click/goLockState").gameObject
local imgDb = grid.transform:Find("btnGridText/scale_on_click/grpTitle/imgDb")
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -243,7 +245,7 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
NovaAPI.SetTMPText(txtStoryTitle, ConfigTable.GetUIText("Story_StoryTitle"))
end
local bgIndex = string.sub(avgcfg.Icon, -1)
local sFullPath = Settings.AB_ROOT_PATH .. "UI_Activity/10110/FX/Textures/fx_ui_SummerAdv_Dissolve" .. bgIndex .. ".png"
local sFullPath = Settings.AB_ROOT_PATH .. "UI/ActivityStoryReview/10110/FX/Textures/fx_ui_SummerAdv_Dissolve" .. bgIndex .. ".png"
local tex = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(Texture), "UI", self._panel._nPanelId)
NovaAPIHotfix.ChangeUIDissolveTarget(imgStory.gameObject, tex)
self:SetPngSprite(imgStory, avgcfg.Icon)
@@ -275,12 +277,16 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -289,10 +295,10 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -317,7 +323,7 @@ function SummerAdvStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranchInd
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -434,6 +440,7 @@ function SummerAdvStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SummerAdvStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -443,7 +450,7 @@ function SummerAdvStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function SummerAdvStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -453,10 +460,12 @@ function SummerAdvStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function SummerAdvStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SummerAdvStoryCtrl:OnBtn_ClickReview()
EventManager.Hit(EventId.OpenPanel, PanelId.SummerCheckinStory_20103, REVIEW_ACTIVITY_ID)
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerAdvStoryPanel = class("SummerAdvStoryPanel", BasePanel)
SummerAdvStoryPanel._sUIResRootPath = "UI_Activity/"
SummerAdvStoryPanel._tbDefine = {
{
sPrefabPath = "10110/Story/SummerAdvStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10110/SummerAdvStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10110.Story.SummerAdvStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SummerAdvStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SummerAdvStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local CultivationManualStoryCtrl = class("CultivationManualStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
CultivationManualStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -50,7 +49,9 @@ function CultivationManualStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -70,11 +71,11 @@ function CultivationManualStoryCtrl:RefreshPanel()
end
function CultivationManualStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -130,9 +131,9 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
else
NovaAPI.SetTMPText(txtStoryTitle, ConfigTable.GetUIText("Story_StoryTitle"))
end
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -178,12 +179,16 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
end
local clickFuc = function()
if not bOpen or self.bCantClick then
return
@@ -192,10 +197,10 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
ActivityAvgData:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -220,7 +225,7 @@ function CultivationManualStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nB
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -350,6 +355,7 @@ function CultivationManualStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function CultivationManualStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -359,7 +365,7 @@ function CultivationManualStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function CultivationManualStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -369,9 +375,11 @@ function CultivationManualStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function CultivationManualStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return CultivationManualStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local CultivationManualStoryPanel = class("CultivationManualStoryPanel", BasePanel)
CultivationManualStoryPanel._sUIResRootPath = "UI_Activity/"
CultivationManualStoryPanel._tbDefine = {
{
sPrefabPath = "10111/Story/CultivationManualStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/10111/CultivationManualStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10111.Story.CultivationManualStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function CultivationManualStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function CultivationManualStoryPanel:OnEnable()
end
@@ -0,0 +1,154 @@
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
local lvIndexTitle = "{0}-{1}"
local colorLockSelectImage = Color(0.9764705882352941, 0.9215686274509803, 0.8588235294117647, 1)
local colorLockUnSelectImage = Color(0.9764705882352941, 0.9215686274509803, 0.8588235294117647, 1)
ActivityLevelsLvCtrl._mapNodeConfig = {
tog = {sComponentName = "UIButton"},
Select = {},
SelectAni = {sNodeName = "Select", sComponentName = "Animator"},
unSelect = {},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
rt_Targets = {},
btnTarget = {sComponentName = "Button", nCount = 3},
rtLockInfo = {},
rtLockInfoDay = {sComponentName = "Image"},
imgLockMask = {},
bgCondition = {},
rtLockPreLv = {},
rtLockPreLvSelect = {sComponentName = "Image"},
redH = {}
}
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock)
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
if self.timerRun ~= nil then
self.timerRun:Pause(true)
self.timerRun = nil
end
self._mapNode.Select:SetActive(false)
self.lvLock = false
self._mapNode.rtLockInfoDay.gameObject:SetActive(false)
self.isShowTexLv = false
self.isOpen = isOpen
if isOpen and isLevelUnLock then
self.isShowTexLv = true
self._mapNode.rt_Targets:SetActive(true)
for i = 1, 3 do
self._mapNode.btnTarget[i].interactable = i <= data.Star
end
self._mapNode.rtLockInfo:SetActive(false)
self._mapNode.rtLockPreLv:SetActive(false)
self._mapNode.bgCondition:SetActive(false)
elseif isOpen and not isLevelUnLock then
self._mapNode.rt_Targets:SetActive(false)
self._mapNode.rtLockInfo:SetActive(true)
self._mapNode.imgLockMask:SetActive(false)
self._mapNode.rtLockPreLv:SetActive(true)
self._mapNode.bgCondition:SetActive(false)
elseif not isOpen then
self._mapNode.rt_Targets:SetActive(false)
self._mapNode.rtLockInfo:SetActive(true)
self._mapNode.imgLockMask:SetActive(true)
self._mapNode.rtLockInfoDay.gameObject:SetActive(true)
self._mapNode.rtLockPreLv:SetActive(false)
self._mapNode.bgCondition:SetActive(true)
local day = activityData:GetUnLockDay(nType, data.baseData.Id)
if day == 0 then
local timerCount = function()
local hour, min, sec = parent.activityLevelsData:GetUnLockHour(nType, data.baseData.Id)
if 0 < hour then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "ea7869", hour))
elseif 0 < min then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "ea7869", min))
elseif 0 < sec then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "ea7869", sec))
end
end
timerCount()
self.timerRun = self:AddTimer(0, 1, function()
timerCount()
end, true, true, false)
else
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "ea7869", day))
end
self.lvLock = true
end
local strTitle = ""
if nType == GameEnum.ActivityLevelType.Explore then
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.Adventure then
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.HARD then
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
end
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
self._mapNode.tog.onClick:RemoveAllListeners()
local clickCb = function()
if self._mapNode.Select.activeSelf == true then
return
end
self:SetDefault(true)
parent:SetSelectObj(self)
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
self._mapNode.tog.onClick:AddListener(clickCb)
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
if bInActGroup then
if nType == GameEnum.ActivityLevelType.Explore then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
nActGroupId,
data.baseData.Id
}, self._mapNode.redH)
elseif nType == GameEnum.ActivityLevelType.Adventure then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
nActGroupId,
data.baseData.Id
}, self._mapNode.redH)
elseif nType == GameEnum.ActivityLevelType.HARD then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
nActGroupId,
data.baseData.Id
}, self._mapNode.redH)
end
end
end
function ActivityLevelsLvCtrl:SetDefault(isOn)
if not isOn then
self:ShowArrowAni(false)
end
self._mapNode.Select:SetActive(isOn)
self._mapNode.unSelect:SetActive(not isOn)
self._mapNode.txt_Select.gameObject:SetActive(isOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
if isOn then
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockSelectImage)
else
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockUnSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockUnSelectImage)
end
if not self.isOpen then
self._mapNode.imgLockMask:SetActive(not isOn)
end
if isOn then
self._mapNode.SelectAni:Play("Select_idle")
else
self._mapNode.SelectAni.enabled = false
self._mapNode.SelectAni.enabled = true
end
end
function ActivityLevelsLvCtrl:ShowArrowAni(isShow)
end
function ActivityLevelsLvCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function ActivityLevelsLvCtrl:OnDisable()
if self.timerRun ~= nil then
self.timerRun:Pause(true)
self.timerRun = nil
end
end
return ActivityLevelsLvCtrl
@@ -0,0 +1,790 @@
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
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
}
local colorSelect = Color(1.0, 0.9882352941176471, 0.9568627450980393, 1)
local colorUnSelect = Color(0.4, 0.13333333333333333, 0.15294117647058825, 1)
local colorSelectLock = Color(0.11764705882352941, 0.12549019607843137, 0.17254901960784313, 1)
local colorUnSelectLock = Color(0.4823529411764706, 0.5333333333333333, 0.6509803921568628, 1)
local timeUnLockColor = "fff7ca"
local colorLockSelectImage = Color(0.984313725490196, 0.9333333333333333, 0.8784313725490196, 1)
local colorLockUnSelectImage = Color(0.24705882352941178, 0.19215686274509805, 0.19215686274509805, 1)
local colorConditionsUnLock = Color(0.6509803921568628, 0.5647058823529412, 0.5647058823529412, 1)
local colorConditionsLock = Color(0.6509803921568628, 0.5647058823529412, 0.5647058823529412, 1)
local lvIndexTitle = "{0}-{1}"
local twelveLvGroupPadding = {
44,
150,
50,
0
}
local twelveLvGroupPaddingOpen = {
44,
818,
50,
0
}
local fourLvGroupPadding = {
300,
88,
50,
0
}
local fourLvGroupPaddingOpen = {
86,
818,
50,
0
}
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.ActivityTheme.10113.ActivityLevels.TemplateToggleCtrl10113"
},
lockExplore = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockExplore"
},
redExplore = {},
togTypeAdventure = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeAdventure"
},
togTypeAdventureCtrl = {
sNodeName = "togTypeAdventure",
sCtrlName = "Game.UI.ActivityTheme.10113.ActivityLevels.TemplateToggleCtrl10113"
},
lockAdventure = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockAdventure"
},
redAdventure = {},
togTypeHard = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeHard"
},
togTypeHardCtrl = {
sNodeName = "togTypeHard",
sCtrlName = "Game.UI.ActivityTheme.10113.ActivityLevels.TemplateToggleCtrl10113"
},
lockHard = {
sComponentName = "UIButton",
callback = "OnClick_BtnLockHard"
},
redHard = {},
rtToggles = {
sNodeName = "srToggle",
sComponentName = "UIScrollRect"
},
rtTogglesTmp = {
sNodeName = "rt_ToggleTmp",
sComponentName = "Transform"
},
togRoot = {
nCount = 12,
sCtrlName = "Game.UI.ActivityTheme.10113.ActivityLevels.ActivityLevelsLvCtrl"
},
rt_Toggle = {},
rt_ToggleTrans = {sNodeName = "rt_Toggle", sComponentName = "Transform"},
btnCloseBg = {
sComponentName = "UIButton",
callback = "OnBtnClick_CloseBossInfo"
},
rtBoss = {},
rtBossAni = {sNodeName = "rtBoss", 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"},
TMPLevel = {sComponentName = "TMP_Text"},
detailDescSc = {sComponentName = "Transform"},
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"
},
txtBtnRaid = {
sComponentName = "TMP_Text",
sLanguageId = "Raid_Title_Raid"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnClickBtnGo"
},
txtBtnGoRaidUnlock = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
},
goCoin = {},
txtTicketsCount = {sComponentName = "TMP_Text"},
btnRaidUnlock = {
sComponentName = "UIButton",
callback = "OnClickBtnGo"
},
goCoinRaidUnlock = {},
txtTicketsCountRaidUnlock = {sComponentName = "TMP_Text"},
grpRaidUnlock = {},
TMPRaidUnlockHint = {
sComponentName = "TMP_Text",
sLanguageId = "Raid_Btn_CondStar"
},
ListConditions = {},
ListConditionsObj = {
sNodeName = "Conditions_",
nCount = 2
}
}
ActivityLevelsSelectCtrl._mapEventConfig = {
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy",
[EventId.ClosePanel] = "OnEvent_ClosePanel"
}
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
function ActivityLevelsSelectCtrl:Awake()
self.detailDescContent = self._mapNode.detailDescSc:Find("Viewport/Content").transform
self.curRequireEnergy = 0
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)
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
end
end
function ActivityLevelsSelectCtrl:OnEnable()
self.isOpenLvMsg = false
self:ShowBossInfo(false, true)
self.timeTab = {}
EventManager.Hit(EventId.SetTransition)
self.SelectTogPreLvLock = nil
self.AniRoot:Play("ActivityLevelsSelect_in")
self:Init()
function self.onScrollValueChanged(value)
self._mapNode.rtTogglesTmp.localPosition = self._mapNode.rt_ToggleTrans.localPosition * 0.7
end
self._mapNode.rtToggles.onValueChanged:AddListener(self.onScrollValueChanged)
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
self.SelectObj = nil
if self.onScrollValueChanged ~= nil then
self._mapNode.rtToggles.onValueChanged:RemoveListener(self.onScrollValueChanged)
self.onScrollValueChanged = nil
end
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.togTypeHardCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Hard"))
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore)
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure)
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD)
local objExploreCert = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
local objAdventureCert = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
local objHardCert = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
self.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
local isOpenExplore = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Explore, self.firstExploreLevel)
self._mapNode.lockExplore.gameObject:SetActive(not isOpenExplore)
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
self._mapNode.lockAdventure.gameObject:SetActive(not isOpenAdventure)
local txt_SelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
local txt_unSelectAdventure = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
txt_SelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
txt_unSelectAdventure.transform.localScale = isOpenAdventure == true and Vector3.one or Vector3.zero
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
self._mapNode.lockHard.gameObject:SetActive(not isOpenHard)
local txt_SelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_Select").gameObject
local txt_unSelectHard = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/txt_unSelect").gameObject
txt_SelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
txt_unSelectHard.transform.localScale = isOpenHard == true and Vector3.one or Vector3.zero
objExploreCert:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
if v.Star < 3 then
objExploreCert:SetActive(false)
break
end
end
objAdventureCert:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
if v.Star < 3 then
objAdventureCert:SetActive(false)
break
end
end
objHardCert:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabHard) do
if v.Star < 3 then
objHardCert:SetActive(false)
break
end
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:OnClick_BtnLockHard()
self:FirstLevelLockTips(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
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_DayOpen"), 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.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.nLevelType = GameEnum.ActivityLevelType.Adventure
self:RefreshTogType(self.nLevelType)
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
self:RefreshTogList(self.nLevelType, nDifficulty)
end
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeHard()
if self.nLevelType == GameEnum.ActivityLevelType.HARD then
return
end
self:CloseAllTimer()
self.AniRoot:Play("ActivityLevelsSelect_in1")
self.nLevelType = GameEnum.ActivityLevelType.HARD
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)
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
self._mapNode.togTypeHardCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.HARD)
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore)
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure)
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD)
end
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
self.SelectObj = nil
local tabLevelInfo, tabLevelInfoDifficulty
self.currentTypeLvCount = 0
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
local tmpImageAdventure = self._mapNode.lockAdventure.gameObject.transform:Find("Image"):GetComponent("Image")
local tmpImageHard = self._mapNode.lockHard.gameObject.transform:Find("Image"):GetComponent("Image")
if nType == GameEnum.ActivityLevelType.Explore then
tabLevelInfo = self.activityLevelsData.levelTabExplore
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
elseif nType == GameEnum.ActivityLevelType.Adventure then
tabLevelInfo = self.activityLevelsData.levelTabAdventure
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
if isOpenAdventure then
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
else
NovaAPI.SetImageColor(tmpImageAdventure, colorLockSelectImage)
end
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
else
tabLevelInfo = self.activityLevelsData.levelTabHard
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
NovaAPI.SetImageColor(tmpImageAdventure, colorLockUnSelectImage)
if isOpenHard then
NovaAPI.SetImageColor(tmpImageHard, colorLockUnSelectImage)
else
NovaAPI.SetImageColor(tmpImageHard, colorLockSelectImage)
end
end
self.currentTypeLvCount = #tabLevelInfoDifficulty
self._mapNode.rtToggles.gameObject:SetActive(true)
local isFour = self.currentTypeLvCount == 4
if self.isOpenLvMsg == false then
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
else
local tmpPadding = isFour and fourLvGroupPaddingOpen or twelveLvGroupPaddingOpen
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
end
for i = 1, 12 do
self._mapNode.togRoot[i].gameObject:SetActive(i <= self.currentTypeLvCount)
end
for i = 1, self.currentTypeLvCount do
do
local tmpId = tabLevelInfoDifficulty[i]
local tmpData = tabLevelInfo[tmpId]
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
self._mapNode.togRoot[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isLevelUnLock, self._nSortingOrder)
if nDifficulty == i then
if self.isOpenLvMsg then
self.SelectObj = self._mapNode.togRoot[i]
self._mapNode.togRoot[i]:SetDefault(true)
self:RefreshInstanceInfo(nType, nDifficulty, true)
else
self._mapNode.togRoot[i]:SetDefault(false)
local wait = function()
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rt_ToggleTrans.gameObject:GetComponent("RectTransform"))
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if i < 3 then
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
elseif 10 < i then
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-3400, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
else
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-400 * (i - 2), self._mapNode.rt_ToggleTrans.localPosition.y, 0)
end
end
cs_coroutine.start(wait)
end
else
self._mapNode.togRoot[i]:SetDefault(false)
end
end
end
end
function ActivityLevelsSelectCtrl:SetSelectObj(tmpSelectObj)
if self.SelectObj ~= nil then
self.SelectObj:SetDefault(false)
end
self.SelectObj = tmpSelectObj
end
function ActivityLevelsSelectCtrl:OnBtnClick_CloseBossInfo()
self._mapNode.rtBossAni:Play("rtBoss_out")
self:AddTimer(1, 0.2, function()
self:ShowBossInfo(false, false)
end, true, true, true)
end
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow, isOnEnable)
self.isOpenLvMsg = isShow
self._mapNode.rtBoss:SetActive(isShow)
self._mapNode.btnCloseBg.gameObject:SetActive(isShow)
if not isShow and self.SelectObj ~= nil then
self.SelectObj:SetDefault(false)
self.SelectObj = nil
end
if not isShow and not isOnEnable then
local isFour = self.currentTypeLvCount == 4
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
if isFour then
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
local moveTime = 0.2
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or tmpPadding[1]
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
CS.DG.Tweening.DOVirtual.Float(startLeft, tmpPadding[1], moveTime, function(v)
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), tmpPadding[2], tmpPadding[3], tmpPadding[4])
end)
else
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
end
end
end
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, isInit)
if self.currentTypeLvCount == 12 then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = isInit and 0.4 or 0.2
if nHard < 3 then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
elseif 10 < nHard then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-3400, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-400 * (nHard - 2), moveTime)
end
end
cs_coroutine.start(wait)
elseif self.currentTypeLvCount == 8 then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = isInit and 0.4 or 0.2
if nHard < 3 then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
elseif 6 < nHard then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-1800, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-400 * (nHard - 2), moveTime)
end
end
cs_coroutine.start(wait)
else
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = isInit and 0.4 or 0.2
EventManager.Hit(EventId.TemporaryBlockInput, moveTime)
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or fourLvGroupPadding[1]
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
CS.DG.Tweening.DOVirtual.Float(startLeft, fourLvGroupPaddingOpen[1], moveTime, function(v)
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
end)
if nHard < 2 then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
elseif 3 <= nHard then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-250, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-75 * (nHard - 1), moveTime)
end
end
cs_coroutine.start(wait)
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]
elseif nType == GameEnum.ActivityLevelType.Adventure then
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
else
levelId = self.activityLevelsData.levelTabHardDifficulty[nHard]
self.selectLevelData = self.activityLevelsData.levelTabHard[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)
local strTitle = ""
if nType == GameEnum.ActivityLevelType.Explore then
strTitle = orderedFormat(lvIndexTitle, 1, self.selectLevelData.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.Adventure then
strTitle = orderedFormat(lvIndexTitle, 2, self.selectLevelData.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.HARD then
strTitle = orderedFormat(lvIndexTitle, 3, self.selectLevelData.baseData.Difficulty)
end
NovaAPI.SetTMPText(self._mapNode.TMPLevel, strTitle)
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
self.detailDescContent:DOLocalMoveY(0, 0)
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.ListConditions:SetActive(false)
if self.selectLevelData.baseData.ThreeStarSweep then
if self.selectLevelData.Star == 3 then
self._mapNode.btnRaid.gameObject:SetActive(true)
self._mapNode.btnGo.gameObject:SetActive(true)
self._mapNode.btnRaidUnlock.gameObject:SetActive(false)
else
self._mapNode.btnRaid.gameObject:SetActive(false)
self._mapNode.btnGo.gameObject:SetActive(false)
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
self._mapNode.grpRaidUnlock:SetActive(true)
end
else
self._mapNode.btnRaid.gameObject:SetActive(false)
self._mapNode.btnGo.gameObject:SetActive(false)
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
self._mapNode.grpRaidUnlock: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(true)
NovaAPI.SetTMPText(self._mapNode.txtTicketsCountRaidUnlock, nRequire)
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
self._mapNode.goCoinRaidUnlock:SetActive(true)
elseif isOpen and not isLevelUnLock then
self._mapNode.btnListRoot:SetActive(false)
self._mapNode.ListConditions:SetActive(true)
local preLevelId = self.selectLevelData.baseData.PreLevelId
if preLevelId ~= 0 then
local lvPreNeedStar = self.selectLevelData.baseData.PreLevelStar
local lvPreStar = self.activityLevelsData:GetPreLevelStar(nType, self.selectLevelData.baseData.Id)
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
imgConditions_Lock_1:SetActive(lvPreNeedStar > lvPreStar)
imgConditions_UnLock_1:SetActive(lvPreNeedStar <= lvPreStar)
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
NovaAPI.SetTMPColor(txt, lvPreNeedStar <= lvPreStar and colorConditionsUnLock or colorConditionsLock)
else
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
imgConditions_Lock_1:SetActive(true)
imgConditions_UnLock_1:SetActive(false)
NovaAPI.SetTMPText(txt, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
end
local preActivityStory = self.selectLevelData.baseData.PreActivityStory
if preActivityStory ~= nil and preActivityStory[1] ~= nil then
local isRead = PlayerData.ActivityAvg:IsStoryReaded(preActivityStory[2])
local imgConditions_Lock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_UnLock").gameObject
local txt = self._mapNode.ListConditionsObj[2].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
imgConditions_Lock_2:SetActive(not isRead)
imgConditions_UnLock_2:SetActive(isRead)
local cfgdata = ConfigTable.GetData("ActivityStory", preActivityStory[2])
if cfgdata ~= nil then
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Avg"), cfgdata.Title))
self._mapNode.ListConditionsObj[2]:SetActive(true)
NovaAPI.SetTMPColor(txt, isRead and colorConditionsUnLock or colorConditionsLock)
else
self._mapNode.ListConditionsObj[2]:SetActive(false)
end
else
self._mapNode.ListConditionsObj[2]:SetActive(false)
end
elseif not isOpen then
self._mapNode.btnListRoot:SetActive(false)
self._mapNode.ListConditions:SetActive(true)
self._mapNode.ListConditionsObj[2]:SetActive(false)
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
imgConditions_Lock_1:SetActive(true)
imgConditions_UnLock_1:SetActive(false)
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
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(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
elseif 0 < min then
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
elseif 0 < sec then
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
end
else
local _day, _hour = self.activityLevelsData:GetUnLockDayHour(nType, self.selectLevelData.baseData.Id)
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayHourOpen"), _day, _hour))
end
end
for i = 1, #self.tabRewardList do
self.tabRewardList[i].gameObject:SetActive(false)
end
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
self._mapNode.btn_itemTemp.gameObject:SetActive(false)
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
if self._mapNode.rtBoss.activeSelf == false then
self:ShowBossInfo(true, false)
self:AddTimer(1, 0.2, function()
self._mapNode.rtBossAni:Play("rtBoss_in")
end, true, true, true)
else
self._mapNode.rtBossAni:Play("rtBoss_Empty")
self:AddTimer(1, 0.1, function()
self._mapNode.rtBossAni:Play("rtBoss_in")
end, true, true, true)
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
if self.SelectObj ~= nil then
self.SelectObj:ShowArrowAni(true)
end
self:AddTimer(1, 0.2, function()
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, true, true, true)
end
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
if self.curStar ~= 3 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
return
end
if self.SelectObj ~= nil then
self.SelectObj:ShowArrowAni(true)
end
self:AddTimer(1, 0.2, function()
local nNeedEnergy = self.curRequireEnergy
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
end, true, true, true)
end
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
if type(nPanelId) == "number" and nPanelId == PanelId.Raid and self.SelectObj ~= nil then
self.SelectObj:ShowArrowAni(false)
end
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)
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, 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 = "10113/ActivityLevels/ActivityLevelsSelect.prefab",
sCtrlName = "Game.UI.ActivityTheme.10113.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,61 @@
local TemplateToggleCtrl10113 = class("TemplateToggleCtrl10113", BaseCtrl)
TemplateToggleCtrl10113._mapNodeConfig = {
AnimSwitch = {sComponentName = "Animator"},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
Select = {},
unSelect = {}
}
TemplateToggleCtrl10113._mapEventConfig = {}
function TemplateToggleCtrl10113:SetText(sText)
NovaAPI.SetTMPText(self._mapNode.txt_Select, sText)
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, sText)
end
function TemplateToggleCtrl10113:SetDefault(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
NovaAPI.SetTMPColor(self._mapNode.txt_Select, White_Normal)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Blue_Normal)
end
function TemplateToggleCtrl10113:SetDefaultAct10101(bOn)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
NovaAPI.SetTMPColor(self._mapNode.txt_Select, Color(1, 1, 1, 1))
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, Color(0.2196078431372549, 0.1803921568627451, 0.1450980392156863, 1))
end
function TemplateToggleCtrl10113:SetDefaultActivity(bOn, colorSelect, colorUnSelect)
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
self._mapNode.unSelect.transform:Find("SelectAni").gameObject:SetActive(false)
if bOn then
self._mapNode.AnimSwitch:Play("togType_in")
else
self._mapNode.AnimSwitch.enabled = false
self._mapNode.AnimSwitch.enabled = true
end
if colorSelect ~= nil then
NovaAPI.SetTMPColor(self._mapNode.txt_Select, colorSelect)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, colorUnSelect)
end
end
function TemplateToggleCtrl10113:SetTrigger(bOn)
end
function TemplateToggleCtrl10113:ResetTrigger()
if self._mapNode.AnimSwitch.enabled == false then
self._mapNode.AnimSwitch.enabled = true
end
self._mapNode.AnimSwitch:ResetTrigger("tOff")
end
return TemplateToggleCtrl10113
@@ -0,0 +1,173 @@
local ActivityUnchartedMapCtrl = class("ActivityUnchartedMapCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
ActivityUnchartedMapCtrl._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"},
imgEnd = {},
txtActivityEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgRemaineTime = {},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "TowerDef_EnterActivity"
},
txtBtnActDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnActDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
}
}
function ActivityUnchartedMapCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivityUnchartedMapCtrl:OnDisable()
self:UnbindCtrl()
end
function ActivityUnchartedMapCtrl:InitActData(actData)
self.actData = actData
self:RefreshLockState()
self:RefreshDate()
self:RefreshTimeout()
self:RefreshReward()
end
function ActivityUnchartedMapCtrl:UnInit()
self:UnbindCtrl()
end
function ActivityUnchartedMapCtrl:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 and self.remainTimer ~= nil 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 ActivityUnchartedMapCtrl:RefreshDate()
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
local strOpenDay = string.format("%d", nOpenDay)
local strEndDay = string.format("%d", nEndDay)
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl:OnBtnClick_Go()
local actGroupCfg = self.actData:GetActGroupCfgData()
if actGroupCfg ~= nil and actGroupCfg ~= nil and actGroupCfg.PanelId ~= nil and actGroupCfg.PanelId > 0 then
if actGroupCfg.TransitionId ~= nil and 0 < actGroupCfg.TransitionId then
local callback = function()
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
end
end
function ActivityUnchartedMapCtrl: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 ActivityUnchartedMapCtrl:ClearActivity()
end
return ActivityUnchartedMapCtrl
@@ -0,0 +1,134 @@
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"},
goStar = {
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
},
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)
self._mapNode.goStar.gameObject:SetActive(true)
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
if mapDiscCfgData then
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
end
local nStar = 6 - mapItemCfg.Rarity
self._mapNode.goStar:SetStar(nStar, nStar)
else
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
self._mapNode.imgElement.gameObject:SetActive(false)
self._mapNode.goStar.gameObject:SetActive(false)
end
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
local sPath = "db_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "10113/SpriteAtlas/10113" .. "04", 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 = "10113/Shop/ActivityShopPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
}
}
function ActivityShopPanel:Awake()
self.nDefaultId = nil
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.nActId = tbParam[1]
self.nDefaultId = tbParam[2]
end
self.actShopData = PlayerData.Activity:GetActivityDataById(self.nActId)
end
function ActivityShopPanel:OnEnable()
end
function ActivityShopPanel:OnDisable()
end
function ActivityShopPanel:OnDestroy()
end
return ActivityShopPanel
@@ -0,0 +1,317 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local UnchartedMapStoryCtrl = class("UnchartedMapStoryCtrl", BaseCtrl)
UnchartedMapStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
},
ctlAvgRoot = {
sNodeName = "goAvgInfoRoot",
sCtrlName = "Game.UI.ActivityTheme.ActivityAvgInfoExCtrl"
},
t_fullscreen_blur_black = {},
btnsnapshot = {
sNodeName = "snapshot",
sComponentName = "Button",
callback = "OnBtn_ClickCloseLevelInfoPanel"
},
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
goChapterComplete = {},
snapshot_complete = {
sComponentName = "UIButton",
callback = "OnBtn_ClickCloseComplete"
},
ctlgoEnemyInfo = {
sNodeName = "goEnemyInfo",
sCtrlName = "Game.UI.MainlineEx.MainlineMonsterInfoCtrl"
}
}
UnchartedMapStoryCtrl._mapEventConfig = {
Story_Done = "OnEvent_Story_Done",
SelectMainlineBattle = "OnEvent_SelectMainlineBattle",
Story_RewardClosed = "OnEvent_Activity_Story_RewardClosed"
}
function UnchartedMapStoryCtrl:Awake()
local tbParam = self:GetPanelParam()
self._nActId = tbParam[1]
self._bReview = tbParam[2] == true
self._objStoryData = self._bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self._tbAllStory = {}
self._mapGridTimer = {}
self._bInit = false
self._bCantClick = false
end
function UnchartedMapStoryCtrl:OnEnable()
self._bCantClick = false
self:OnBtn_ClickCloseLevelInfoPanel()
self:RefreshPanel()
end
function UnchartedMapStoryCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function UnchartedMapStoryCtrl:OnPreExit()
self._mapGridTimer = {}
self._objScrollTimer = nil
end
function UnchartedMapStoryCtrl:RefreshPanel()
self:RefreshStoryList()
end
function UnchartedMapStoryCtrl:RefreshStoryList()
for _, objTimer in pairs(self._mapGridTimer) do
objTimer:Cancel()
end
self._mapGridTimer = {}
if self._objScrollTimer then
self._objScrollTimer:Cancel()
self._objScrollTimer = nil
end
self._tbAllStory, self._nChapterId = self._objStoryData:GetStoryIdListByActivityId(self._nActId)
self._tbAllStory = self._tbAllStory or {}
self._mapNode.svStory:SetAnim(0.07)
self._mapNode.svStory:Init(#self._tbAllStory, self, self.OnRefreshGrid)
if #self._tbAllStory == 0 then
return
end
local nRecentStoryId = self._objStoryData:GetRecentStoryId(self._nChapterId)
local nRecentIndex = 1
for nIndex, nStoryId in ipairs(self._tbAllStory) do
if nStoryId == nRecentStoryId then
nRecentIndex = nIndex
break
end
end
local nScrollTime = self._bInit and 0 or 0.5
self._objScrollTimer = self:AddTimer(1, 0.1, function()
self._objScrollTimer = nil
self._mapNode.svStory:SetScrollGridPos(nRecentIndex, nScrollTime, 0)
self._bInit = true
end, true, true, true)
end
function UnchartedMapStoryCtrl:OnRefreshGrid(goGrid, nIndex)
local trNormal = goGrid.transform:Find("Normal")
trNormal.gameObject:SetActive(true)
goGrid.transform:Find("Branch").gameObject:SetActive(false)
self:RefreshGridInfo(trNormal.gameObject, nIndex + 1)
end
function UnchartedMapStoryCtrl:RefreshGridInfo(goGrid, nIndex)
local nStoryId = self._tbAllStory[nIndex]
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
local nInstanceId = goGrid:GetInstanceID()
if self._mapGridTimer[nInstanceId] then
self._mapGridTimer[nInstanceId]:Cancel()
self._mapGridTimer[nInstanceId] = nil
end
local btnGrid = goGrid.transform:Find("btnGrid"):GetComponent("UIButton")
local trRoot = goGrid.transform:Find("btnGrid/AnimRoot/RootNode")
local trTextRoot = goGrid.transform:Find("btnGridText/scale_on_click")
local imgStory = trRoot:Find("rtBg/imgStory"):GetComponent("Image")
local txtIndex = trRoot:Find("txtIndex"):GetComponent("TMP_Text")
local trStoryTitle = trRoot:Find("imgStoryTitle")
local trBattleTitle = trRoot:Find("imgBattleTitle")
local trTitle = trTextRoot:Find("grpTitle")
local txtTitle = trTitle:Find("tmpGroupDone"):GetComponent("TMP_Text")
local trComplete = trTextRoot:Find("goComplete")
local txtComplete = trComplete:Find("imgBg/txtComplete"):GetComponent("TMP_Text")
local trTime = trTextRoot:Find("imgTime")
local txtTime = trTime:Find("txtTime"):GetComponent("TMP_Text")
local animNormal = goGrid:GetComponent("Animator")
local goRedDot = trRoot:Find("RedDot").gameObject
local bUnlock = self._objStoryData:IsUnlock(mapStoryCfg.ConditionId)
local bRead = self._objStoryData:IsStoryReaded(nStoryId)
local bOpen, nOpenTime = self._objStoryData:IsOpen(mapStoryCfg.StoryId, self._nActId)
local bAvailable = bOpen and bUnlock
self:SetPngSprite(imgStory, bAvailable and mapStoryCfg.Icon or "Icon/ActivityStory/ep_event_13_00")
NovaAPI.SetTMPText(txtIndex, mapStoryCfg.Index)
NovaAPI.SetTMPText(txtTitle, mapStoryCfg.Title)
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
NovaAPI.SetTMPText(trStoryTitle:Find("txtPlot"):GetComponent("TMP_Text"), ConfigTable.GetUIText("Story_StoryTitle"))
NovaAPI.SetTMPText(trBattleTitle:Find("txtPlot"):GetComponent("TMP_Text"), ConfigTable.GetUIText("Story_BattleTitle"))
trStoryTitle.gameObject:SetActive(bAvailable and not mapStoryCfg.IsBattle)
trBattleTitle.gameObject:SetActive(bAvailable and mapStoryCfg.IsBattle)
trRoot:Find("goNotOpen").gameObject:SetActive(not bOpen)
trRoot:Find("goLockState").gameObject:SetActive(bOpen and not bUnlock)
trTextRoot:Find("goLocktxtState").gameObject:SetActive(bOpen and not bUnlock)
trTitle.gameObject:SetActive(bAvailable)
trComplete.gameObject:SetActive(bAvailable and bRead)
trTime.gameObject:SetActive(not bOpen)
if bRead then
animNormal:Play("svStory_idle", 0, 0)
end
if not bOpen then
NovaAPI.SetTMPText(txtTime, self:GetRemainTimeStr(nOpenTime, mapStoryCfg.DayOpen))
self._mapGridTimer[nInstanceId] = self:AddTimer(0, 1, function()
if self._objStoryData:IsOpen(mapStoryCfg.StoryId, self._nActId) then
self:RefreshStoryList()
else
NovaAPI.SetTMPText(txtTime, self:GetRemainTimeStr(nOpenTime, mapStoryCfg.DayOpen))
end
end, true, true, true)
end
if self._bReview then
goRedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self._nActId)
if bInActGroup then
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self._nActId,
nStoryId
}, goRedDot, nil, nil, true)
else
goRedDot:SetActive(false)
end
end
btnGrid.onClick:RemoveAllListeners()
btnGrid.onClick:AddListener(function()
self:OnClickStory(nStoryId)
end)
local objAnimator = goGrid:GetComponent("Animator")
if objAnimator ~= nil then
objAnimator:Play(bAvailable and "svStory_in" or "svStoryNotOpen_in")
end
end
function UnchartedMapStoryCtrl:OnClickStory(nStoryId)
if self._bCantClick then
return
end
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
if not self._objStoryData:IsOpen(mapStoryCfg.StoryId, self._nActId) then
return
end
local bUnlock, tbResult = self._objStoryData:IsUnlock(mapStoryCfg.ConditionId)
if not bUnlock then
local sLockText = self:GetUnlockTip(tbResult)
if sLockText ~= "" then
EventManager.Hit(EventId.OpenMessageBox, {
nType = AllEnum.MessageBox.Alert,
sContent = sLockText
})
end
return
end
self._nSelectedStoryId = nStoryId
self._sAvgId = mapStoryCfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(self._sAvgId, self._nActId, not self._objStoryData:IsStoryReaded(nStoryId), self._bReview)
LocalData.SetPlayerLocalData(self._objStoryData:_GetLocalReadKey(self._nActId, nStoryId), true)
self._objStoryData:RefreshAvgRedDot()
end
function UnchartedMapStoryCtrl:GetUnlockTip(tbResult)
for nConditionIndex, tbCondition in ipairs(tbResult or {}) do
if tbCondition[1] == false then
local conditionValue = tbCondition[2]
if nConditionIndex == 1 or nConditionIndex == 2 then
do
local mapFallbackCfg
for nStoryId, bRead in pairs(conditionValue) do
if not bRead then
local mapStoryCfg = ConfigTable.GetData("ActivityStory", nStoryId)
mapFallbackCfg = mapFallbackCfg or mapStoryCfg
if nConditionIndex == 1 or self._objStoryData:IsUnlock(mapStoryCfg.ConditionId) then
return orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", mapStoryCfg.Title)
end
end
end
if mapFallbackCfg then
return orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", mapFallbackCfg.Title)
end
end
break
end
if nConditionIndex == 3 or nConditionIndex == 4 then
do return ConfigTable.GetUIText("Story_UnlockClueCondition") end
break
end
if nConditionIndex == 5 then
do return orderedFormat(ConfigTable.GetUIText("Story_UnlockWorldLv") or "", conditionValue) end
break
end
if nConditionIndex == 6 then
for nAchievementId, bComplete in pairs(conditionValue) do
if not bComplete then
local mapAchievementCfg = ConfigTable.GetData("Achievement", nAchievementId)
return orderedFormat(ConfigTable.GetUIText("Story_UnlockAchievement") or "", mapAchievementCfg.Title) .. [[
(]] .. mapAchievementCfg.Desc .. ")"
end
end
break
end
if nConditionIndex == 7 and 0 < conditionValue then
local mapLevelCfg = ConfigTable.GetData("ActivityLevelsLevel", conditionValue)
if mapLevelCfg then
return orderedFormat(ConfigTable.GetUIText("ActivityStory_UnlockActivityLevel"), mapLevelCfg.Name)
end
end
break
end
end
return ""
end
function UnchartedMapStoryCtrl:GetRemainTimeStr(nOpenTime, nOpenDay)
local nRefreshTime = CS.ClientManager.Instance:GetNextRefreshTime(nOpenTime) - 86400
local nRemainTime = nRefreshTime + nOpenDay * 86400 - CS.ClientManager.Instance.serverTimeStamp
local tbUnits = {
{
86400,
"ActivityLevels_Lock_Day_Color_Common"
},
{
3600,
"ActivityLevels_Lock_Hour_Color_Common"
},
{
60,
"ActivityLevels_Lock_Min_Color_Common"
},
{
1,
"ActivityLevels_Lock_Sec_Color_Common"
}
}
for _, tbUnit in ipairs(tbUnits) do
local nCount = math.floor(nRemainTime / tbUnit[1])
if 0 < nCount then
return orderedFormat(ConfigTable.GetUIText(tbUnit[2]), "FFF0DB", nCount)
end
end
return ""
end
function UnchartedMapStoryCtrl:OnBtn_ClickBack()
EventManager.Hit(EventId.ClosePanel, PanelId.UnchartedMapStory_10113)
end
function UnchartedMapStoryCtrl:OnBtn_ClickHome()
PanelManager.Home()
end
function UnchartedMapStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function UnchartedMapStoryCtrl:OnEvent_Story_Done(bHasReward)
self._bCantClick = bHasReward == true
self:RefreshPanel()
end
function UnchartedMapStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
if bConfirm and self._sAvgId then
EventManager.Hit(EventId.SetTransition, 2, function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self._sAvgId, self._nActId, self._bReview)
end)
end
end
function UnchartedMapStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self._bCantClick = false
if self._nSelectedStoryId and self._nSelectedStoryId == self._tbAllStory[#self._tbAllStory] and self._objStoryData:IsStoryReaded(self._nSelectedStoryId) then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function UnchartedMapStoryCtrl:OnBtn_ClickCloseComplete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return UnchartedMapStoryCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local UnchartedMapStoryPanel = class("UnchartedMapStoryPanel", BasePanel)
UnchartedMapStoryPanel._tbDefine = {
{
sPrefabPath = "ActivityStoryReview/10113/UnchartedMapStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10113.Story.UnchartedMapStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function UnchartedMapStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
return UnchartedMapStoryPanel
@@ -0,0 +1,16 @@
local UnchartedMapTaskPanel = class("UnchartedMapTaskPanel", BasePanel)
UnchartedMapTaskPanel._sUIResRootPath = "UI_Activity/"
UnchartedMapTaskPanel._tbDefine = {
{
sPrefabPath = "10113/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
}
}
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
function UnchartedMapTaskPanel:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" and tbParam[3] == nil then
tbParam[3] = tbImgDbType.FillAmount
end
end
return UnchartedMapTaskPanel
@@ -0,0 +1,622 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local UnchartedMapCtrl = class("UnchartedMapCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
UnchartedMapCtrl._mapNodeConfig = {
goBg = {sNodeName = "---Bg---"},
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
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"
},
txtMiniGame = {
sComponentName = "TMP_Text",
sLanguageId = "IceCreamTruck_PlayTitle"
},
imgMiniGameEnd = {},
dbMiniGameEnd = {},
txtMiniGameEnd = {
sComponentName = "TMP_Text",
sLanguageId = "IceCreamTruck_PlayTitle"
},
txtMiniGame_End = {},
txtMiniGameEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgMiniGameActivityUnlockTime = {},
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
imgMiniGameActivityTime = {},
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
goMiniGameEnd = {},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Task"
},
txtTaskProgress = {sComponentName = "TMP_Text"},
imgTaskActivityTime = {},
txtTaskActivityTime = {sComponentName = "TMP_Text"},
dbTaskEnd = {},
txtTaskEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgTaskEnd = {},
txtTaskEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Task"
},
txtTaskProgress_End = {},
imgTaskActivityUnlockTime = {},
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
txtStory = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Story"
},
txtStory_End = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Story"
},
goStoryEnd = {},
txtStoryEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgStoryActivityTime = {},
txtStoryActivityTime = {sComponentName = "TMP_Text"},
imgStoryActivityUnlockTime = {},
txtStoryActivityUnlockTime = {sComponentName = "TMP_Text"},
imgStoryEnd = {},
txtShopEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
txtShop = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Shop"
},
imgShopActivityTime = {},
txtShopActivityTime = {sComponentName = "TMP_Text"},
imgShopActivityUnlockTime = {},
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
txtShopEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Shop"
},
imgShopEnd = {},
txtShop_End = {},
dbShopEnd = {},
txtLevel = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Level"
},
txtLevel_End = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Level"
},
goLevelEnd = {},
txtLevelEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgLevelActivityUnlockTime = {},
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
imgLevelEnd = {},
imgLevelActivityTime = {},
txtLevelActivityTime = {sComponentName = "TMP_Text"},
miniGameRedDot = {},
redDotEntrance2 = {},
storyRedDot = {},
reddotLevel = {}
}
UnchartedMapCtrl._mapEventConfig = {}
local ActivityState = {
NotOpen = 1,
Open = 2,
Closed = 3
}
function UnchartedMapCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.ActData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
if self.ActData ~= nil then
self.ActivityGroupCfg = self.ActData.actGroupConfig
end
end
function UnchartedMapCtrl:OnEnable()
self:RefreshPanel()
self:RegisterReddot()
end
function UnchartedMapCtrl:SetEnterState()
local sAnimName = "LongestDayPanel_Full"
local sAudioName = "Mode_10112_activity"
if self.bFirstEnter then
sAnimName = "LongestDayPanel_Pullback"
sAudioName = "Mode_10112_activity_01"
end
self.bFirstEnter = true
self.animRoot = self.gameObject:GetComponent("Animator")
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
self.animRoot:Play(sAnimName, 0, 0)
WwiseAudioMgr:PostEvent(sAudioName)
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
end
function UnchartedMapCtrl:RegisterReddot()
for i = 1, 5 do
local actData = self.ActData:GetActivityDataByIndex(i)
local nActId = actData ~= nil and actData.ActivityId or 0
local state = self.tbActState[nActId]
if nActId ~= nil and 0 < nActId and state ~= nil then
if i == AllEnum.ActivityThemeFuncIndex.Task then
if state == ActivityState.Closed then
self._mapNode.redDotEntrance2:SetActive(false)
else
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
self.nActId,
nActId
}, self._mapNode.redDotEntrance2)
end
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
self.nActId,
nActId
}, self._mapNode.reddotLevel)
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
self.nActId,
nActId
}, self._mapNode.storyRedDot)
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
if state == ActivityState.Closed then
self._mapNode.miniGameRedDot:SetActive(false)
else
local nActId = actData.ActivityId
RedDotManager.RegisterNode(RedDotDefine.Activity_IceCreamTruck_New, {nActId}, self._mapNode.miniGameRedDot)
end
end
end
end
end
function UnchartedMapCtrl: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 UnchartedMapCtrl:RefreshPanel()
if self.ActData == nil or self.ActivityGroupCfg == nil then
return
end
self:RefreshTime()
self:RefreshButtonState()
end
function UnchartedMapCtrl:RefreshTime()
local bOpen = self.ActData:CheckActivityGroupOpen()
if bOpen then
self:RefreshRemainTime(self.ActData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, function()
local remainTime = self:RefreshRemainTime(self.ActData: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.ActData:GetActGroupDate()
local strOpenDay = string.format("%d", nOpenDay)
local strEndDay = string.format("%d", nEndDay)
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
end
function UnchartedMapCtrl: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 UnchartedMapCtrl: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 UnchartedMapCtrl:RefreshButtonState()
self.tbActState = {}
for i = 1, 5 do
local actData = self.ActData: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)
elseif i == AllEnum.ActivityThemeFuncIndex.Story then
self:RefreshStoryButtonState(actData)
end
end
end
function UnchartedMapCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
local countDowmTimer
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
local sEndTime = ""
if activityData ~= nil then
sEndTime = activityData.EndTime
end
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(countDowmTimer)
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.ActData:GetActGroupEndTime() then
bShowCountDown = true
elseif endTime < self.ActData: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(countDowmTimer)
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 UnchartedMapCtrl: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.dbMiniGameEnd:SetActive(state == ActivityState.Closed)
self._mapNode.txtMiniGame_End:SetActive(state == ActivityState.Closed)
self._mapNode.txtMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
if state ~= ActivityState.Open then
RedDotManager.SetValid(RedDotDefine.Activity_ThrowGift_New, {
actData.ActivityId
}, false)
end
self.tbActState[activityId] = state
end
end
function UnchartedMapCtrl: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.imgTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.dbTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
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 UnchartedMapCtrl:RefreshStoryButtonState(actData)
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
if activityData ~= nil then
local refreshFunc = function(actData)
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
if nil ~= avgData then
avgData:RefreshAvgRedDot()
end
self:RefreshStoryButtonState(actData)
end
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.avgRemainTimer, self._mapNode.txtStoryActivityTime, self._mapNode.imgShopActivityUnlockTime, refreshFunc)
if self.avgRemainTimer == nil then
self.avgRemainTimer = countDowmTimer
end
if state == ActivityState.Closed then
local avgData = PlayerData.Activity:GetActivityDataById(activityId)
if nil ~= avgData then
avgData:RefreshAvgRedDot()
end
end
self._mapNode.imgStoryActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
self._mapNode.imgStoryActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
self._mapNode.goStoryEnd:SetActive(state == ActivityState.Closed)
self._mapNode.imgStoryEnd:SetActive(state == ActivityState.Closed)
self._mapNode.txtStory_End.gameObject:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
end
end
function UnchartedMapCtrl: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.goLevelEnd:SetActive(state == ActivityState.Closed)
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
local anim = self._mapNode.btnEntrance_[AllEnum.ActivityThemeFuncIndex.Level].transform:GetChild(0):GetComponent("Animator")
if state == ActivityState.Open then
anim:Play("btnEntrance_5_idle")
end
end
end
function UnchartedMapCtrl: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.dbShopEnd: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 UnchartedMapCtrl: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 UnchartedMapCtrl:RefreshActivityData()
if self.bRequiredActData then
return
end
self:AddTimer(1, 3, function()
self:RequireActiviyData()
end, true, true, true)
end
function UnchartedMapCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
local actData = self.ActData:GetActivityDataByIndex(nIndex)
if actData == nil then
return
end
local state = self.tbActState[actData.ActivityId]
if nil == state then
return
end
if state == ActivityState.Closed then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
return
elseif state == ActivityState.NotOpen then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_Not_Open"))
return
elseif state == ActivityState.Open then
local activityData = PlayerData.Activity:GetActivityDataById(actData.ActivityId)
if activityData == nil then
local bHint = true
if 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
LocalData.SetPlayerLocalData("Activity_ThrowGift_New", true)
RedDotManager.SetValid(RedDotDefine.Activity_ThrowGift_New, {
actData.ActivityId
}, false)
local func = function()
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId, self.nActId)
end
EventManager.Hit(EventId.SetTransition, 52, func)
elseif self.ActivityGroupCfg.TransitionId ~= nil and self.ActivityGroupCfg.TransitionId > 0 then
EventManager.Hit(EventId.SetTransition, self.ActivityGroupCfg.TransitionId, function()
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
end)
else
EventManager.Hit(EventId.OpenPanel, actData.PanelId, actData.ActivityId)
end
end
end
return UnchartedMapCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local UnchartedMapPanel = class("UnchartedMapPanel", BasePanel)
UnchartedMapPanel._sUIResRootPath = "UI_Activity/"
UnchartedMapPanel._tbDefine = {
{
sPrefabPath = "10113/UnchartedMapPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.10113.UnchartedMapCtrl"
}
}
function UnchartedMapPanel:Awake()
end
function UnchartedMapPanel:OnEnable()
end
function UnchartedMapPanel:OnDisable()
end
function UnchartedMapPanel:OnDestroy()
end
function UnchartedMapPanel:OnRelease()
end
return UnchartedMapPanel
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SwimThemeStory_11100Ctrl = class("SwimThemeStory_11100Ctrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
SwimThemeStory_11100Ctrl._mapNodeConfig = {
goActTime = {},
@@ -54,7 +53,9 @@ function SwimThemeStory_11100Ctrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {27, -30}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -73,7 +74,7 @@ function SwimThemeStory_11100Ctrl:RefreshPanel()
self:RefreshPersonality()
end
function SwimThemeStory_11100Ctrl:RefreshDate()
local nOpenTime, nEndTime = PlayerData.ActivityAvg:GetActivityOpenTime(self.nActId)
local nOpenTime, nEndTime = self.storyData:GetActivityOpenTime(self.nActId)
local nYear = tonumber(os.date("%Y", nOpenTime))
local nOpenMonth = tonumber(os.date("%m", nOpenTime))
local nOpenDay = tonumber(os.date("%d", nOpenTime))
@@ -92,7 +93,7 @@ function SwimThemeStory_11100Ctrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtPersonality, sTitle)
local sIcon = "Icon/PlayerHead/" .. sHead
@@ -100,11 +101,11 @@ function SwimThemeStory_11100Ctrl:RefreshPersonality()
end
function SwimThemeStory_11100Ctrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -133,19 +134,23 @@ function SwimThemeStory_11100Ctrl:OnRefreshGrid(grid, index)
local goComplete = RootNode:Find("goComplete")
local goLock = RootNode:Find("goLock")
local reddot = RootNode:Find("RedDot")
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local isFullUnlock = isUnlock and bOpen
goUnlock.gameObject:SetActive(isFullUnlock)
goComplete.gameObject:SetActive(isReaded and bOpen)
goLock.gameObject:SetActive(not isFullUnlock)
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, reddot, nil, nil, true)
if self.bReview then
reddot.gameObject:SetActive(false)
else
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, reddot, nil, nil, true)
end
local imgStory = RootNode:Find("imgStory"):GetComponent("Image")
local txtIndex = goUnlock:Find("txtIndex"):GetComponent("TMP_Text")
local txtTitle = goUnlock:Find("txtTitle"):GetComponent("TMP_Text")
@@ -199,10 +204,10 @@ function SwimThemeStory_11100Ctrl:OnRefreshGrid(grid, index)
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
ActivityAvgData:RefreshAvgRedDot()
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -227,7 +232,7 @@ function SwimThemeStory_11100Ctrl:OnRefreshGrid(grid, index)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -327,6 +332,7 @@ function SwimThemeStory_11100Ctrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SwimThemeStory_11100Ctrl:OnEvent_StoryDialog_DialogEnd()
WwiseAudioMgr:SetState("menuTransition", "open")
@@ -339,7 +345,7 @@ function SwimThemeStory_11100Ctrl:OnEvent_Story_Done(bHasReward)
end
function SwimThemeStory_11100Ctrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -349,6 +355,7 @@ function SwimThemeStory_11100Ctrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
return SwimThemeStory_11100Ctrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SwimThemeStory_11100Panel = class("SwimThemeStory_11100Panel", BasePanel)
SwimThemeStory_11100Panel._sUIResRootPath = "UI_Activity/"
SwimThemeStory_11100Panel._tbDefine = {
{
sPrefabPath = "11100/Story/SwimThemeStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/11100/SwimThemeStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.11100.Story.SwimThemeStory_11100Ctrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SwimThemeStory_11100Panel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SwimThemeStory_11100Panel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local ChristmasStoryCtrl = class("ChristmasThemeCtrl", BaseCtrl)
local actAvgData = PlayerData.ActivityAvg
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
ChristmasStoryCtrl._mapNodeConfig = {
tranContent = {
@@ -70,8 +69,10 @@ local BranchRefreshIndex = {
function ChristmasStoryCtrl:Awake()
local tbParam = self:GetPanelParam()
self.nActId = tbParam[1]
self.nChapterId = actAvgData:GetChapterIdByActivityId(self.nActId)
self.tbAvgIds = actAvgData:GetChapterStoryNumIds(self.nChapterId)
self.bReview = tbParam[2] == true
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.nChapterId = self.storyData:GetChapterIdByActivityId(self.nActId)
self.tbAvgIds = self.storyData:GetChapterStoryNumIds(self.nChapterId)
self.nRefreshIndex = 1
self.OpenStoryNodeIndex = 1
self.parallaxSpeed = {
@@ -143,16 +144,16 @@ function ChristmasStoryCtrl:CacheStoryNode()
refreshIndex = BranchRefreshIndex[j],
animName = BranchAnimName[j]
}
local cfg = actAvgData:GetStoryCfgData(goSubChild.name)
local isRead = actAvgData:IsStoryReaded(cfg.Id)
local cfg = self.storyData:GetStoryCfgData(goSubChild.name)
local isRead = self.storyData:IsStoryReaded(cfg.Id)
if isRead then
self.curReadedId = cfg.Id
end
end
else
table.insert(self.tbStoryNode, {node = goChild, index = index})
local cfg = actAvgData:GetStoryCfgData(goChild.name)
local isRead = actAvgData:IsStoryReaded(cfg.Id)
local cfg = self.storyData:GetStoryCfgData(goChild.name)
local isRead = self.storyData:IsStoryReaded(cfg.Id)
if isRead then
self.curReadedId = cfg.Id
end
@@ -195,13 +196,13 @@ function ChristmasStoryCtrl:RefreshStoryNode(goNode, index, isBranch, callback)
return
end
local avgId = goNode.name
local avgCfg = actAvgData:GetStoryCfgData(avgId)
local avgCfg = self.storyData:GetStoryCfgData(avgId)
local btnStoryNode = goNode.transform:Find("btnStoryNode"):GetComponent("UIButton")
local animRoot = goNode.transform:Find("btnStoryNode/AnimRoot")
local animator = animRoot:GetComponent("Animator")
local goOpen = animRoot.transform:Find("goOpen")
local goUnOpen = isBranch == false and goNode.transform:Find("goUnOpen") or goNode.transform.parent:Find("goUnOpen")
local bOpen, nOpenTime = actAvgData:IsOpen(avgId, self.nActId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgId, self.nActId)
btnStoryNode.gameObject:SetActive(true)
goOpen.gameObject:SetActive(bOpen)
goUnOpen.gameObject:SetActive(not bOpen)
@@ -221,7 +222,7 @@ function ChristmasStoryCtrl:RefreshStoryNode(goNode, index, isBranch, callback)
else
self.OpenStoryNodeIndex = index
end
local isUnlock, tbResult = actAvgData:IsUnlock(avgCfg.ConditionId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgCfg.ConditionId)
local goUnLock = goOpen.transform:Find("goUnlock")
local goLock = goOpen.transform:Find("goLock")
local isBattle = avgCfg.IsBattle
@@ -232,7 +233,7 @@ function ChristmasStoryCtrl:RefreshStoryNode(goNode, index, isBranch, callback)
local txtBattle = goUnLock.transform:Find("imgStoryTitleBg/txtBattle"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtBattle, ConfigTable.GetUIText("SelectTeam_StartBattle"))
end
local isReaded = actAvgData:IsStoryReaded(avgCfg.Id)
local isReaded = self.storyData:IsStoryReaded(avgCfg.Id)
goLock.gameObject:SetActive(not isUnlock)
goUnLock.gameObject:SetActive(isUnlock)
local txtTitle = goUnLock.transform:Find("txtTitle"):GetComponent("TMP_Text")
@@ -242,12 +243,16 @@ function ChristmasStoryCtrl:RefreshStoryNode(goNode, index, isBranch, callback)
NovaAPI.SetTMPText(txtTitle, avgCfg.Title)
NovaAPI.SetTMPText(txtLocked, ConfigTable.GetUIText("Story_Unkown_Chapter"))
local goRedDot = goOpen.transform:Find("redDot").gameObject
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgCfg.Id
}, goRedDot, nil, nil, true)
if self.bReview then
goRedDot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgCfg.Id
}, goRedDot, nil, nil, true)
end
btnStoryNode.onClick:RemoveAllListeners()
btnStoryNode.onClick:AddListener(function()
if not bOpen then
@@ -257,12 +262,12 @@ function ChristmasStoryCtrl:RefreshStoryNode(goNode, index, isBranch, callback)
local bNew = not isReaded
self.avgId = avgId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgId, self.nActId, bNew, self.bReview)
if bNew then
self.curIndex = index
end
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgCfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgCfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -282,7 +287,7 @@ function ChristmasStoryCtrl:RefreshStoryNode(goNode, index, isBranch, callback)
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if actAvgData:IsUnlock(storyData.Id) then
if self.storyData:IsUnlock(storyData.Id) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -367,9 +372,9 @@ function ChristmasStoryCtrl:RefreshNeedHideNode()
for i = 1, #self.tbStoryNode do
local goNode = self.tbStoryNode[i]
local avgId = goNode.node.name
local bOpen = actAvgData:IsOpen(avgId, self.nActId)
local avgCfg = actAvgData:GetStoryCfgData(avgId)
local isUnlock = actAvgData:IsUnlock(avgCfg.ConditionId)
local bOpen = self.storyData:IsOpen(avgId, self.nActId)
local avgCfg = self.storyData:GetStoryCfgData(avgId)
local isUnlock = self.storyData:IsUnlock(avgCfg.ConditionId)
local bShowTimelock = false
if not bOpen and not bSetNotOpenIndex then
self.NotOpenStoryNodeIndex = goNode.index
@@ -483,7 +488,7 @@ function ChristmasStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function ChristmasStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -493,10 +498,12 @@ function ChristmasStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self:RefreshPanel()
if self.maxIndex == self.curIndex then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function ChristmasStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function ChristmasStoryCtrl:ScrollToRecentStory()
if self._mapNode.scrollRect == nil then
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local ChristmasStoryPanel = class("ChristmasStoryPanel", BasePanel)
ChristmasStoryPanel._sUIResRootPath = "UI_Activity/"
ChristmasStoryPanel._tbDefine = {
{
sPrefabPath = "20101/Story/ChristmasStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/20101/ChristmasStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.20101.Story.ChristmasStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function ChristmasStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function ChristmasStoryPanel:OnEnable()
end
@@ -1,7 +1,6 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local LocalData = require("GameCore.Data.LocalData")
local SummerCheckinStoryCtrl = class("SummerCheckinStoryCtrl", BaseCtrl)
local ActivityAvgData = PlayerData.ActivityAvg
SummerCheckinStoryCtrl._mapNodeConfig = {
svStory = {
sComponentName = "LoopScrollView"
@@ -79,7 +78,9 @@ function SummerCheckinStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.storyNodePos = {0, -66.1}
self.tbGridTimer = {}
self.tbPlayedAnim = {}
@@ -117,7 +118,7 @@ function SummerCheckinStoryCtrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId, self.nChapterId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId, self.nChapterId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtCharName, sTitle)
NovaAPI.SetTMPText(self._mapNode.txtPersonalityPercent[1], math.floor(tbRetPercent[1] * 100) .. "%")
@@ -128,11 +129,11 @@ function SummerCheckinStoryCtrl:RefreshPersonality()
end
function SummerCheckinStoryCtrl:RefreshStoryList()
self.tbPlayedAnim = {}
self.tbAllStory, self.nChapterId = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
if self.tbAllStory == nil or #self.tbAllStory <= 0 then
return
end
local recentStoryId = ActivityAvgData:GetRecentStoryId(self.nChapterId)
local recentStoryId = self.storyData:GetRecentStoryId(self.nChapterId)
local recentIndex = 1
for i = 1, #self.tbAllStory do
if self.tbAllStory[i] == recentStoryId then
@@ -184,9 +185,9 @@ function SummerCheckinStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranc
local goLockBg = RootNode:Find("goNotOpen/goLockBg")
local goimgCheck = avgcfg.IsBattle and RootNode:Find("imgBattleTitle/imgCheck").gameObject or RootNode:Find("imgStoryTitle/imgCheck").gameObject
NovaAPI.SetTMPText(txtComplete, ConfigTable.GetUIText("RoguelikeBuild_Manage_FilterPass"))
local isUnlock, tbResult = ActivityAvgData:IsUnlock(avgcfg.ConditionId)
local isReaded = ActivityAvgData:IsStoryReaded(storyId)
local bOpen, nOpenTime = ActivityAvgData:IsOpen(avgcfg.StoryId, self.nActId)
local isUnlock, tbResult = self.storyData:IsUnlock(avgcfg.ConditionId)
local isReaded = self.storyData:IsStoryReaded(storyId)
local bOpen, nOpenTime = self.storyData:IsOpen(avgcfg.StoryId, self.nActId)
local nIndex = 0
if isUnlock then
nIndex = bBranch and BRANCH_GRID_INDEX or gridIndex
@@ -230,15 +231,19 @@ function SummerCheckinStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranc
end, true, true, true)
NovaAPI.SetTMPText(txtTime, strTime)
end
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if _bInActGroup then
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
if self.bReview then
RedDot:SetActive(false)
else
RedDot.gameObject:SetActive(false)
local _bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
if _bInActGroup then
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
avgcfg.Id
}, RedDot, nil, nil, true)
else
RedDot.gameObject:SetActive(false)
end
end
local clickFuc = function()
if not bOpen or self.bCantClick then
@@ -248,10 +253,10 @@ function SummerCheckinStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranc
local bNew = not isReaded
self.avgId = avgcfg.StoryId
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew)
self._mapNode.ctlAvgRoot:OpenLevelInfo(avgcfg.StoryId, self.nActId, bNew, self.bReview)
self.curIndex = gridIndex
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. avgcfg.Id, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, avgcfg.Id), true)
self.storyData:RefreshAvgRedDot()
elseif tbResult ~= nil then
local lockTxt = ""
for i = 1, #tbResult do
@@ -276,7 +281,7 @@ function SummerCheckinStoryCtrl:RefreshGridInfo(grid, gridIndex, bBranch, nBranc
for k, v in pairs(tbStoryIds) do
if v == false then
local storyData = ConfigTable.GetData("ActivityStory", k)
if ActivityAvgData:IsUnlock(storyData.ConditionId) then
if self.storyData:IsUnlock(storyData.ConditionId) then
lockTxt = orderedFormat(ConfigTable.GetUIText("Story_UnlockPreId") or "", storyData.Title)
break
end
@@ -395,6 +400,7 @@ function SummerCheckinStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SummerCheckinStoryCtrl:OnEvent_Story_Done(bHasReward)
self:RefreshPanel()
@@ -404,7 +410,7 @@ function SummerCheckinStoryCtrl:OnEvent_Story_Done(bHasReward)
end
function SummerCheckinStoryCtrl:OnEvent_SelectMainlineBattle(bConfirm)
local OpenPanel = function()
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId)
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.ActivityStory, 0, self.avgId, self.nActId, self.bReview)
end
if bConfirm then
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
@@ -414,9 +420,11 @@ function SummerCheckinStoryCtrl:OnEvent_Activity_Story_RewardClosed()
self.bCantClick = false
if self.curIndex == #self.tbAllStory then
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
end
end
function SummerCheckinStoryCtrl:OnBtn_ClickCloseCompete()
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
return SummerCheckinStoryCtrl
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SummerCheckinStoryPanel = class("SummerCheckinStoryPanel", BasePanel)
SummerCheckinStoryPanel._sUIResRootPath = "UI_Activity/"
SummerCheckinStoryPanel._tbDefine = {
{
sPrefabPath = "20103/Story/SummerCheckinStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/20103/SummerCheckinStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.20103.Story.SummerCheckinStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SummerCheckinStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SummerCheckinStoryPanel:OnEnable()
end
@@ -0,0 +1,173 @@
local ActivityDustDawnCtrl = class("ActivityDustDawnCtrl", BaseCtrl)
local TimerManager = require("GameCore.Timer.TimerManager")
local ClientManager = CS.ClientManager.Instance
ActivityDustDawnCtrl._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"},
imgEnd = {},
txtActivityEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgRemaineTime = {},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_TowerAllOpen_Go"
},
txtBtnActDetail = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Btn_Detail"
},
btnActDetail = {
sComponentName = "UIButton",
callback = "OnBtnClick_Detail"
}
}
function ActivityDustDawnCtrl:Awake()
self.tbGridCtrl = {}
end
function ActivityDustDawnCtrl:OnDisable()
self:UnbindCtrl()
end
function ActivityDustDawnCtrl:InitActData(actData)
self.actData = actData
self:RefreshLockState()
self:RefreshDate()
self:RefreshTimeout()
self:RefreshReward()
end
function ActivityDustDawnCtrl:UnInit()
self:UnbindCtrl()
end
function ActivityDustDawnCtrl:UnbindCtrl()
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
self:UnbindCtrlByNode(objCtrl)
self.tbGridCtrl[nInstanceId] = nil
end
self.tbGridCtrl = {}
end
function ActivityDustDawnCtrl: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 ActivityDustDawnCtrl: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 and self.remainTimer ~= nil 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 ActivityDustDawnCtrl:RefreshDate()
local nOpenMonth, nOpenDay, nEndMonth, nEndDay, nOpenYear, nEndYear = self.actData:GetActGroupDate()
local strOpenDay = string.format("%d", nOpenDay)
local strEndDay = string.format("%d", nEndDay)
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtDate, dateStr)
end
function ActivityDustDawnCtrl: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 ActivityDustDawnCtrl: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 ActivityDustDawnCtrl: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 ActivityDustDawnCtrl:OnBtnClick_Go()
local actGroupCfg = self.actData:GetActGroupCfgData()
if actGroupCfg ~= nil and actGroupCfg ~= nil and actGroupCfg.PanelId ~= nil and actGroupCfg.PanelId > 0 then
if actGroupCfg.TransitionId ~= nil and 0 < actGroupCfg.TransitionId then
local callback = function()
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
EventManager.Hit(EventId.SetTransition, actGroupCfg.TransitionId, callback)
else
EventManager.Hit(EventId.OpenPanel, actGroupCfg.PanelId, actGroupCfg.Id, true)
end
end
end
function ActivityDustDawnCtrl: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 ActivityDustDawnCtrl:ClearActivity()
end
return ActivityDustDawnCtrl
@@ -0,0 +1,179 @@
local ActivityLevelsLvCtrl = class("ActivityLevelsLvCtrl", BaseCtrl)
local lvIndexTitle = "{0}-{1}"
local colorLockSelectImage = Color(0.047058823529411764, 0.1803921568627451, 0.23529411764705882, 1)
local colorLockUnSelectImage = Color(0.047058823529411764, 0.1803921568627451, 0.23529411764705882, 1)
ActivityLevelsLvCtrl._mapNodeConfig = {
tog = {sComponentName = "UIButton"},
Select = {},
unSelect = {},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
rt_Targets = {},
btnTarget = {sComponentName = "Button", nCount = 3},
rtLockInfo = {},
rtLockInfoDay = {sComponentName = "Image"},
imgLockMask = {},
bgCondition = {},
rtLockPreLv = {},
rtLockPreLvSelect = {sComponentName = "Image"},
redH = {},
AnimRoot = {sComponentName = "Animator"},
AnimSwitch = {sComponentName = "Animator"}
}
function ActivityLevelsLvCtrl:InitData(parent, nType, activityData, data, isOpen, isLevelUnLock, isPreLevelOpen)
local txtLockConditionTime = self._mapNode.bgCondition.transform:Find("txtLockCondition"):GetComponent("TMP_Text")
if self.timerRun ~= nil then
self.timerRun:Pause(true)
self.timerRun = nil
end
self.circleAni = self._mapNode.unSelect.transform:Find("imgdb/imgdb/circle").gameObject
self.imgdb_glowAni = self._mapNode.unSelect.transform:Find("imgdb/imgdb/imgdb_glow/imgdb_glow").gameObject
self._mapNode.Select:SetActive(false)
self.lvLock = false
self._mapNode.rtLockInfoDay.gameObject:SetActive(false)
self.isShowTexLv = false
self.isOpen = isOpen
if isOpen and isLevelUnLock then
self.isShowTexLv = true
self._mapNode.rt_Targets:SetActive(true)
for i = 1, 3 do
self._mapNode.btnTarget[i].interactable = i <= data.Star
end
self._mapNode.rtLockInfo:SetActive(false)
self._mapNode.rtLockPreLv:SetActive(false)
self._mapNode.bgCondition:SetActive(false)
self._mapNode.AnimRoot:Play("ActivityToggle_in_ready")
self:AddTimer(1, data.baseData.Difficulty * 0.1, function()
self._mapNode.AnimRoot:Play("ActivityToggle_in")
end, true, true, true)
elseif isOpen and not isLevelUnLock then
self._mapNode.rt_Targets:SetActive(false)
self._mapNode.rtLockInfo:SetActive(true)
self._mapNode.imgLockMask:SetActive(false)
self._mapNode.rtLockPreLv:SetActive(true)
self._mapNode.bgCondition:SetActive(false)
self._mapNode.AnimRoot:Play("ActivityToggle_in_ready")
self:AddTimer(1, data.baseData.Difficulty * 0.1, function()
self._mapNode.AnimRoot:Play("ActivityToggle_in")
end, true, true, true)
elseif not isOpen then
self._mapNode.rt_Targets:SetActive(false)
self._mapNode.rtLockInfo:SetActive(true)
self._mapNode.imgLockMask:SetActive(true)
self._mapNode.rtLockInfoDay.gameObject:SetActive(false)
self._mapNode.rtLockPreLv:SetActive(false)
if data.baseData.Difficulty ~= 1 then
self._mapNode.bgCondition:SetActive(isPreLevelOpen)
else
self._mapNode.bgCondition:SetActive(true)
end
self._mapNode.AnimRoot:Play("ActivityToggle_in_lockready")
self:AddTimer(1, data.baseData.Difficulty * 0.1, function()
self._mapNode.AnimRoot:Play("ActivityToggle_in_lock")
end, true, true, true)
local day = activityData:GetUnLockDay(nType, data.baseData.Id)
if day == 0 then
local timerCount = function()
local hour, min, sec = parent.activityLevelsData:GetUnLockHour(nType, data.baseData.Id)
if 0 < hour then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour_Color_Common"), "f0e1c0", hour))
elseif 0 < min then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min_Color_Common"), "f0e1c0", min))
elseif 0 < sec then
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Sec_Color_Common"), "f0e1c0", sec))
end
end
timerCount()
self.timerRun = self:AddTimer(0, 1, function()
timerCount()
end, true, true, false)
else
NovaAPI.SetTMPText(txtLockConditionTime, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Day_Color_Common"), "f0e1c0", day))
end
self.lvLock = true
end
local strTitle = ""
if nType == GameEnum.ActivityLevelType.Explore then
strTitle = orderedFormat(lvIndexTitle, 1, data.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.Adventure then
strTitle = orderedFormat(lvIndexTitle, 2, data.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.HARD then
strTitle = orderedFormat(lvIndexTitle, 3, data.baseData.Difficulty)
end
NovaAPI.SetTMPText(self._mapNode.txt_Select, strTitle)
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, strTitle)
self._mapNode.tog.onClick:RemoveAllListeners()
local clickCb = function()
if self._mapNode.Select.activeSelf == true then
return
end
self:SetDefault(true)
parent:SetSelectObj(self)
parent:RefreshInstanceInfo(nType, data.baseData.Difficulty, false)
parent.activityLevelsData:ChangeRedDot(nType, data.baseData.Id)
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
end
self._mapNode.tog.onClick:AddListener(clickCb)
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(parent.nActId)
if bInActGroup then
if nType == GameEnum.ActivityLevelType.Explore then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Explore_Level, {
nActGroupId,
data.baseData.Id
}, self._mapNode.redH)
elseif nType == GameEnum.ActivityLevelType.Adventure then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Adventure_Level, {
nActGroupId,
data.baseData.Id
}, self._mapNode.redH)
elseif nType == GameEnum.ActivityLevelType.HARD then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard_Level, {
nActGroupId,
data.baseData.Id
}, self._mapNode.redH)
end
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
NovaAPI.CtrlDotweenAnimation(self.circleAni, 2)
NovaAPI.CtrlDotweenAnimation(self.imgdb_glowAni, 2)
end
cs_coroutine.start(wait)
end
function ActivityLevelsLvCtrl:SetDefault(isOn)
if not isOn then
self:ShowArrowAni(false)
end
self._mapNode.Select:SetActive(isOn)
self._mapNode.unSelect:SetActive(true)
self._mapNode.txt_Select.gameObject:SetActive(isOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not isOn)
if isOn then
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockSelectImage)
self._mapNode.AnimSwitch.enabled = true
self._mapNode.AnimSwitch:Play("DecoRoot_in")
NovaAPI.CtrlDotweenAnimation(self.circleAni, 1)
NovaAPI.CtrlDotweenAnimation(self.imgdb_glowAni, 1)
else
NovaAPI.SetImageColor(self._mapNode.rtLockInfoDay, colorLockUnSelectImage)
NovaAPI.SetImageColor(self._mapNode.rtLockPreLvSelect, colorLockUnSelectImage)
NovaAPI.CtrlDotweenAnimation(self.circleAni, 2)
NovaAPI.CtrlDotweenAnimation(self.imgdb_glowAni, 2)
end
if not self.isOpen then
self._mapNode.imgLockMask:SetActive(not isOn)
end
end
function ActivityLevelsLvCtrl:ShowArrowAni(isShow)
end
function ActivityLevelsLvCtrl:FadeIn()
EventManager.Hit(EventId.SetTransition)
end
function ActivityLevelsLvCtrl:OnDisable()
if self.timerRun ~= nil then
self.timerRun:Pause(true)
self.timerRun = nil
end
end
return ActivityLevelsLvCtrl
@@ -0,0 +1,761 @@
local ActivityLevelsSelectCtrl = class("ActivityLevelsSelectCtrl", BaseCtrl)
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
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
}
local colorLockSelectImage = Color(0.054901960784313725, 0.054901960784313725, 0.054901960784313725, 1)
local colorLockUnSelectImage = Color(0.9803921568627451, 0.9803921568627451, 0.9803921568627451, 1)
local colorConditionsUnLock = Color(0.1607843137254902, 0.3568627450980392, 0.4392156862745098, 1)
local colorConditionsLock = Color(0.1607843137254902, 0.3568627450980392, 0.4392156862745098, 1)
local lvIndexTitle = "{0}-{1}"
local twelveLvGroupPadding = {
86,
50,
50,
0
}
local twelveLvGroupPaddingOpen = {
86,
818,
50,
0
}
local fourLvGroupPadding = {
620,
88,
50,
0
}
local fourLvGroupPaddingOpen = {
86,
818,
50,
0
}
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.ActivityTheme.20104.ActivityLevels.TemplateToggleTypeCtrl"
},
redExplore = {},
togTypeAdventure = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeAdventure"
},
togTypeAdventureCtrl = {
sNodeName = "togTypeAdventure",
sCtrlName = "Game.UI.ActivityTheme.20104.ActivityLevels.TemplateToggleTypeCtrl"
},
redAdventure = {},
togTypeHard = {
sComponentName = "UIButton",
callback = "OnBtnClick_TogTypeHard"
},
togTypeHardCtrl = {
sNodeName = "togTypeHard",
sCtrlName = "Game.UI.ActivityTheme.20104.ActivityLevels.TemplateToggleTypeCtrl"
},
redHard = {},
rtToggles = {
sNodeName = "srToggle",
sComponentName = "UIScrollRect"
},
rtTogglesTmp = {
sNodeName = "rt_ToggleTmp",
sComponentName = "Transform"
},
togRoot = {
nCount = 12,
sCtrlName = "Game.UI.ActivityTheme.20104.ActivityLevels.ActivityLevelsLvCtrl"
},
rt_Toggle = {},
rt_ToggleTrans = {sNodeName = "rt_Toggle", sComponentName = "Transform"},
btnCloseBg = {
sComponentName = "UIButton",
callback = "OnBtnClick_CloseBossInfo"
},
rtBoss = {},
rtBossAni = {sNodeName = "rtBoss", 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"},
TMPLevel = {sComponentName = "TMP_Text"},
detailDescSc = {sComponentName = "Transform"},
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"
},
txtBtnRaid = {
sComponentName = "TMP_Text",
sLanguageId = "Raid_Title_Raid"
},
btnGo = {
sComponentName = "UIButton",
callback = "OnClickBtnGo"
},
txtBtnGoRaidUnlock = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
},
txtBtnGo = {
sComponentName = "TMP_Text",
sLanguageId = "Maninline_Btn_Go"
},
goCoin = {},
txtTicketsCount = {sComponentName = "TMP_Text"},
btnRaidUnlock = {
sComponentName = "UIButton",
callback = "OnClickBtnGo"
},
goCoinRaidUnlock = {},
txtTicketsCountRaidUnlock = {sComponentName = "TMP_Text"},
grpRaidUnlock = {},
TMPRaidUnlockHint = {
sComponentName = "TMP_Text",
sLanguageId = "Raid_Btn_CondStar"
},
ListConditions = {},
ListConditionsObj = {
sNodeName = "Conditions_",
nCount = 2
}
}
ActivityLevelsSelectCtrl._mapEventConfig = {
[EventId.UpdateEnergy] = "OnEvent_UpdateEnergy",
[EventId.ClosePanel] = "OnEvent_ClosePanel",
[EventId.UIBackConfirm] = "OnEvent_Back",
[EventId.UIHomeConfirm] = "OnEvent_BackHome"
}
ActivityLevelsSelectCtrl._mapRedDotConfig = {}
function ActivityLevelsSelectCtrl:Awake()
self.detailDescContent = self._mapNode.detailDescSc:Find("Viewport/Content").transform
self.curRequireEnergy = 0
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)
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel_Hard, {nActGroupId}, self._mapNode.redHard)
end
end
function ActivityLevelsSelectCtrl:OnEnable()
self.isOpenLvMsg = false
self:ShowBossInfo(false, true)
self.timeTab = {}
EventManager.Hit(EventId.SetTransition)
self.SelectTogPreLvLock = nil
self.AniRoot:Play("ActivityLevelsSelect_in")
self:Init()
function self.onScrollValueChanged(value)
self._mapNode.rtTogglesTmp.localPosition = self._mapNode.rt_ToggleTrans.localPosition
end
self._mapNode.rtToggles.onValueChanged:AddListener(self.onScrollValueChanged)
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
self.SelectObj = nil
if self.onScrollValueChanged ~= nil then
self._mapNode.rtToggles.onValueChanged:RemoveListener(self.onScrollValueChanged)
self.onScrollValueChanged = nil
end
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.firstExploreLevel = self.activityLevelsData.levelTabExploreDifficulty[1]
self.firstAdventureLevel = self.activityLevelsData.levelTabAdventureDifficulty[1]
self.firstHardLevel = self.activityLevelsData.levelTabHardDifficulty[1]
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
self._mapNode.togTypeExploreCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Explore"))
self._mapNode.togTypeAdventureCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Adventure"))
self._mapNode.togTypeHardCtrl:SetText(ConfigTable.GetUIText("ActivityLevels_Hard"))
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Explore, nil, nil, true, 1)
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.Adventure, nil, nil, isOpenAdventure, 2)
self._mapNode.togTypeHardCtrl:SetDefaultActivity(self.nLevelType == GameEnum.ActivityLevelType.HARD, nil, nil, isOpenHard, 3)
local objExploreCert = self._mapNode.togTypeExplore.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
local objAdventureCert = self._mapNode.togTypeAdventure.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
local objHardCert = self._mapNode.togTypeHard.gameObject.transform:Find("AnimRoot/AnimSwitch/iconCert").gameObject
objExploreCert:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabExplore) do
if 3 > v.Star then
objExploreCert:SetActive(false)
break
end
end
objAdventureCert:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabAdventure) do
if 3 > v.Star then
objAdventureCert:SetActive(false)
break
end
end
objHardCert:SetActive(true)
for i, v in pairs(self.activityLevelsData.levelTabHard) do
if 3 > v.Star then
objHardCert:SetActive(false)
break
end
end
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_DayOpen"), 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_Switch")
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_Switch")
self.nLevelType = GameEnum.ActivityLevelType.Adventure
self:RefreshTogType(self.nLevelType)
local nDifficulty = self.activityLevelsData:GetDefaultSelectionDifficulty(self.nLevelType)
self:RefreshTogList(self.nLevelType, nDifficulty)
end
function ActivityLevelsSelectCtrl:OnBtnClick_TogTypeHard()
if self.nLevelType == GameEnum.ActivityLevelType.HARD then
return
end
self:CloseAllTimer()
self.AniRoot:Play("ActivityLevelsSelect_Switch")
self.nLevelType = GameEnum.ActivityLevelType.HARD
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)
self._mapNode.togTypeExploreCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Explore)
self._mapNode.togTypeAdventureCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.Adventure)
self._mapNode.togTypeHardCtrl:SetTrigger(nType == GameEnum.ActivityLevelType.HARD)
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
self._mapNode.togTypeExploreCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Explore, nil, nil, true)
self._mapNode.togTypeAdventureCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.Adventure, nil, nil, isOpenAdventure)
self._mapNode.togTypeHardCtrl:SetDefaultActivity(nType == GameEnum.ActivityLevelType.HARD, nil, nil, isOpenHard)
end
function ActivityLevelsSelectCtrl:RefreshTogList(nType, nDifficulty)
self.SelectObj = nil
local tabLevelInfo, tabLevelInfoDifficulty
self.currentTypeLvCount = 0
local isOpenAdventure = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.Adventure, self.firstAdventureLevel)
local isOpenHard = self.activityLevelsData:GetLevelDayOpen(GameEnum.ActivityLevelType.HARD, self.firstHardLevel)
if nType == GameEnum.ActivityLevelType.Explore then
tabLevelInfo = self.activityLevelsData.levelTabExplore
tabLevelInfoDifficulty = self.activityLevelsData.levelTabExploreDifficulty
elseif nType == GameEnum.ActivityLevelType.Adventure then
tabLevelInfo = self.activityLevelsData.levelTabAdventure
tabLevelInfoDifficulty = self.activityLevelsData.levelTabAdventureDifficulty
else
tabLevelInfo = self.activityLevelsData.levelTabHard
tabLevelInfoDifficulty = self.activityLevelsData.levelTabHardDifficulty
end
self.currentTypeLvCount = #tabLevelInfoDifficulty
self._mapNode.rtToggles.gameObject:SetActive(true)
local isFour = self.currentTypeLvCount == 4
if self.isOpenLvMsg == false then
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
else
local tmpPadding = isFour and fourLvGroupPaddingOpen or twelveLvGroupPaddingOpen
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
end
for i = 1, 12 do
self._mapNode.togRoot[i].gameObject:SetActive(i <= self.currentTypeLvCount)
end
for i = 1, self.currentTypeLvCount do
do
local tmpId = tabLevelInfoDifficulty[i]
local tmpData = tabLevelInfo[tmpId]
local isOpen = self.activityLevelsData:GetLevelDayOpen(nType, tmpData.baseData.Id)
local preLevelId = tmpData.baseData.PreLevelId
local isPreLevelOpen = true
if preLevelId ~= 0 then
local tmpDataPre = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
isPreLevelOpen = self.activityLevelsData:GetLevelDayOpen(tmpDataPre.Type, tmpDataPre.Id)
end
local isLevelUnLock = self.activityLevelsData:GetLevelUnLock(nType, tmpData.baseData.Id)
self._mapNode.togRoot[i]:InitData(self, nType, self.activityLevelsData, tmpData, isOpen, isLevelUnLock, isPreLevelOpen)
if nDifficulty == i then
if self.isOpenLvMsg then
self.SelectObj = self._mapNode.togRoot[i]
self._mapNode.togRoot[i]:SetDefault(true)
self:RefreshInstanceInfo(nType, nDifficulty, true)
else
self._mapNode.togRoot[i]:SetDefault(false)
local wait = function()
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rt_ToggleTrans.gameObject:GetComponent("RectTransform"))
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
if i < 3 then
self._mapNode.rt_ToggleTrans.localPosition = Vector3(0, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
elseif 10 <= i then
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-2125, self._mapNode.rt_ToggleTrans.localPosition.y, 0)
else
self._mapNode.rt_ToggleTrans.localPosition = Vector3(-300 * (i - 2), self._mapNode.rt_ToggleTrans.localPosition.y, 0)
end
end
cs_coroutine.start(wait)
end
else
self._mapNode.togRoot[i]:SetDefault(false)
end
end
end
end
function ActivityLevelsSelectCtrl:SetSelectObj(tmpSelectObj)
if self.SelectObj ~= nil then
self.SelectObj:SetDefault(false)
end
self.SelectObj = tmpSelectObj
end
function ActivityLevelsSelectCtrl:OnBtnClick_CloseBossInfo()
self._mapNode.rtBossAni:Play("rtBoss_out")
self:AddTimer(1, 0.2, function()
self:ShowBossInfo(false, false)
end, true, true, true)
end
function ActivityLevelsSelectCtrl:ShowBossInfo(isShow, isOnEnable)
self.isOpenLvMsg = isShow
self._mapNode.rtBoss:SetActive(isShow)
self._mapNode.btnCloseBg.gameObject:SetActive(isShow)
if not isShow and self.SelectObj ~= nil then
self.SelectObj:SetDefault(false)
self.SelectObj = nil
end
if not isShow and not isOnEnable then
local isFour = self.currentTypeLvCount == 4
local tmpPadding = isFour and fourLvGroupPadding or twelveLvGroupPadding
if isFour then
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
local moveTime = 0.2
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or tmpPadding[1]
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
CS.DG.Tweening.DOVirtual.Float(startLeft, tmpPadding[1], moveTime, function(v)
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), tmpPadding[2], tmpPadding[3], tmpPadding[4])
end)
else
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, tmpPadding[1], tmpPadding[2], tmpPadding[3], tmpPadding[4])
end
end
end
function ActivityLevelsSelectCtrl:RefreshInstanceInfo(nType, nHard, isInit)
if self.currentTypeLvCount == 12 then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = isInit and 0.4 or 0.2
if nHard < 3 then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
elseif 10 <= nHard then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-2125, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-300 * (nHard - 2), moveTime)
end
end
cs_coroutine.start(wait)
elseif self.currentTypeLvCount == 8 then
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, twelveLvGroupPaddingOpen[1], twelveLvGroupPaddingOpen[2], twelveLvGroupPaddingOpen[3], twelveLvGroupPaddingOpen[4])
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = isInit and 0.4 or 0.2
if nHard < 3 then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
elseif 6 <= nHard then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-958, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(-300 * (nHard - 2), moveTime)
end
end
cs_coroutine.start(wait)
else
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local moveTime = isInit and 0.4 or 0.2
EventManager.Hit(EventId.TemporaryBlockInput, moveTime)
local layoutGroup = self._mapNode.rt_Toggle:GetComponent("HorizontalLayoutGroup")
local startLeft = layoutGroup ~= nil and layoutGroup.padding.left or fourLvGroupPadding[1]
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, startLeft, fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
CS.DG.Tweening.DOVirtual.Float(startLeft, fourLvGroupPaddingOpen[1], moveTime, function(v)
NovaAPI.SetLayoutGroupPadding(self._mapNode.rt_Toggle, math.floor(v), fourLvGroupPaddingOpen[2], fourLvGroupPaddingOpen[3], fourLvGroupPaddingOpen[4])
end)
if nHard < 2 then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
elseif 3 <= nHard then
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
else
self._mapNode.rt_ToggleTrans:DOLocalMoveX(0, moveTime)
end
end
cs_coroutine.start(wait)
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]
elseif nType == GameEnum.ActivityLevelType.Adventure then
levelId = self.activityLevelsData.levelTabAdventureDifficulty[nHard]
self.selectLevelData = self.activityLevelsData.levelTabAdventure[levelId]
else
levelId = self.activityLevelsData.levelTabHardDifficulty[nHard]
self.selectLevelData = self.activityLevelsData.levelTabHard[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)
local strTitle = ""
if nType == GameEnum.ActivityLevelType.Explore then
strTitle = orderedFormat(lvIndexTitle, 1, self.selectLevelData.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.Adventure then
strTitle = orderedFormat(lvIndexTitle, 2, self.selectLevelData.baseData.Difficulty)
elseif nType == GameEnum.ActivityLevelType.HARD then
strTitle = orderedFormat(lvIndexTitle, 3, self.selectLevelData.baseData.Difficulty)
end
NovaAPI.SetTMPText(self._mapNode.TMPLevel, strTitle)
NovaAPI.SetTMPText(self._mapNode.detailDesc, self.selectLevelData.baseData.Desc)
self.detailDescContent:DOLocalMoveY(0, 0)
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.ListConditions:SetActive(false)
if self.selectLevelData.baseData.ThreeStarSweep then
if self.selectLevelData.Star == 3 then
self._mapNode.btnRaid.gameObject:SetActive(true)
self._mapNode.btnGo.gameObject:SetActive(true)
self._mapNode.btnRaidUnlock.gameObject:SetActive(false)
else
self._mapNode.btnRaid.gameObject:SetActive(false)
self._mapNode.btnGo.gameObject:SetActive(false)
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
self._mapNode.grpRaidUnlock:SetActive(true)
end
else
self._mapNode.btnRaid.gameObject:SetActive(false)
self._mapNode.btnGo.gameObject:SetActive(false)
self._mapNode.btnRaidUnlock.gameObject:SetActive(true)
self._mapNode.grpRaidUnlock: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(true)
NovaAPI.SetTMPText(self._mapNode.txtTicketsCountRaidUnlock, nRequire)
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nRequire > nHas.nEnergy and Red_Unable or Blue_Normal)
self._mapNode.goCoinRaidUnlock:SetActive(true)
elseif isOpen and not isLevelUnLock then
self._mapNode.btnListRoot:SetActive(false)
self._mapNode.ListConditions:SetActive(true)
local preLevelId = self.selectLevelData.baseData.PreLevelId
if preLevelId ~= 0 then
local lvPreNeedStar = self.selectLevelData.baseData.PreLevelStar
local lvPreStar = self.activityLevelsData:GetPreLevelStar(nType, self.selectLevelData.baseData.Id)
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
local tmpData = ConfigTable.GetData("ActivityLevelsLevel", preLevelId)
imgConditions_Lock_1:SetActive(lvPreNeedStar > lvPreStar)
imgConditions_UnLock_1:SetActive(lvPreNeedStar <= lvPreStar)
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_PreLevel"), tmpData.Name))
NovaAPI.SetTMPColor(txt, lvPreNeedStar <= lvPreStar and colorConditionsUnLock or colorConditionsLock)
else
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
imgConditions_Lock_1:SetActive(true)
imgConditions_UnLock_1:SetActive(false)
NovaAPI.SetTMPText(txt, ConfigTable.GetUIText("Unlocked_By_PreLevel"))
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
end
local preActivityStory = self.selectLevelData.baseData.PreActivityStory
if preActivityStory ~= nil and preActivityStory[1] ~= nil then
local isRead = PlayerData.ActivityAvg:IsStoryReaded(preActivityStory[2])
local imgConditions_Lock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_2 = self._mapNode.ListConditionsObj[2].transform:Find("imgConditions_UnLock").gameObject
local txt = self._mapNode.ListConditionsObj[2].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
imgConditions_Lock_2:SetActive(not isRead)
imgConditions_UnLock_2:SetActive(isRead)
local cfgdata = ConfigTable.GetData("ActivityStory", preActivityStory[2])
if cfgdata ~= nil then
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Avg"), cfgdata.Title))
self._mapNode.ListConditionsObj[2]:SetActive(true)
NovaAPI.SetTMPColor(txt, isRead and colorConditionsUnLock or colorConditionsLock)
else
self._mapNode.ListConditionsObj[2]:SetActive(false)
end
else
self._mapNode.ListConditionsObj[2]:SetActive(false)
end
elseif not isOpen then
self._mapNode.btnListRoot:SetActive(false)
self._mapNode.ListConditions:SetActive(true)
self._mapNode.ListConditionsObj[2]:SetActive(false)
local imgConditions_Lock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_Lock").gameObject
local imgConditions_UnLock_1 = self._mapNode.ListConditionsObj[1].transform:Find("imgConditions_UnLock").gameObject
imgConditions_Lock_1:SetActive(true)
imgConditions_UnLock_1:SetActive(false)
local txt = self._mapNode.ListConditionsObj[1].transform:Find("tex_ConditionsTips"):GetComponent("TMP_Text")
NovaAPI.SetTMPColor(txt, colorConditionsUnLock)
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(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Hour"), hour))
elseif 0 < min then
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
elseif 0 < sec then
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_Min"), min))
end
else
local _day, _hour = self.activityLevelsData:GetUnLockDayHour(nType, self.selectLevelData.baseData.Id)
NovaAPI.SetTMPText(txt, orderedFormat(ConfigTable.GetUIText("ActivityLevels_Lock_DayHourOpen"), _day, _hour))
end
end
for i = 1, #self.tabRewardList do
self.tabRewardList[i].gameObject:SetActive(false)
end
local tbReward = decodeJson(self.selectLevelData.baseData.CompleteRewardPreview)
self._mapNode.btn_itemTemp.gameObject:SetActive(false)
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
if self._mapNode.rtBoss.activeSelf == false then
self:ShowBossInfo(true, false)
self:AddTimer(1, 0.2, function()
self._mapNode.rtBossAni:Play("rtBoss_in")
end, true, true, true)
else
self._mapNode.rtBossAni:Play("rtBoss_Empty")
self:AddTimer(1, 0.1, function()
self._mapNode.rtBossAni:Play("rtBoss_in")
end, true, true, true)
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
if self.SelectObj ~= nil then
self.SelectObj:ShowArrowAni(true)
end
self:AddTimer(1, 0.2, function()
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, true, true, true)
end
function ActivityLevelsSelectCtrl:OnClickBtnRaid()
if self.curStar ~= 3 then
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Raid_Lock"))
return
end
if self.SelectObj ~= nil then
self.SelectObj:ShowArrowAni(true)
end
self:AddTimer(1, 0.2, function()
local nNeedEnergy = self.curRequireEnergy
EventManager.Hit(EventId.OpenPanel, PanelId.Raid, self.selectLevelData.baseData.Id, nNeedEnergy, 0, self.nActId)
end, true, true, true)
end
function ActivityLevelsSelectCtrl:OnEvent_ClosePanel(nPanelId)
if type(nPanelId) == "number" and nPanelId == PanelId.Raid and self.SelectObj ~= nil then
self.SelectObj:ShowArrowAni(false)
end
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)
NovaAPI.SetTMPColor(self._mapNode.txtTicketsCountRaidUnlock, nHas.nEnergy < self.curRequireEnergy and Red_Unable or Blue_Normal)
end
function ActivityLevelsSelectCtrl:OnEvent_Back(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
self.AniRoot:Play("ActivityLevelsSelect_out")
self:AddTimer(1, 0.3, function()
EventManager.Hit(EventId.CloesCurPanel)
end, true, true, true)
end
function ActivityLevelsSelectCtrl:OnEvent_BackHome(nPanelId)
if self._panel._nPanelId ~= nPanelId then
return
end
PanelManager.Home()
end
return ActivityLevelsSelectCtrl
@@ -0,0 +1,21 @@
local ActivityLevelsSelectPanel = class("ActivityLevelsSelectPanel", BasePanel)
ActivityLevelsSelectPanel._sUIResRootPath = "UI_Activity/"
ActivityLevelsSelectPanel._tbDefine = {
{
sPrefabPath = "20104/ActivityLevels/ActivityLevelsSelect.prefab",
sCtrlName = "Game.UI.ActivityTheme.20104.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,49 @@
local TemplateToggleTypeCtrl = class("TemplateToggleTypeCtrl", BaseCtrl)
TemplateToggleTypeCtrl._mapNodeConfig = {
AnimSwitch = {sComponentName = "Animator"},
txt_Select = {sComponentName = "TMP_Text"},
txt_unSelect = {sComponentName = "TMP_Text"},
Select = {},
unSelect = {},
lockSel = {},
lockUnSel = {}
}
TemplateToggleTypeCtrl._mapEventConfig = {}
function TemplateToggleTypeCtrl:SetText(sText)
NovaAPI.SetTMPText(self._mapNode.txt_Select, sText)
NovaAPI.SetTMPText(self._mapNode.txt_unSelect, sText)
end
function TemplateToggleTypeCtrl:SetDefaultActivity(bOn, colorSelect, colorUnSelect, isOpen)
if self._mapNode.AnimSwitch.enabled == true then
self._mapNode.AnimSwitch.enabled = false
end
self._mapNode.Select:SetActive(bOn)
self._mapNode.unSelect:SetActive(not bOn)
self._mapNode.txt_Select.gameObject:SetActive(bOn)
self._mapNode.txt_unSelect.gameObject:SetActive(not bOn)
if colorSelect ~= nil then
NovaAPI.SetTMPColor(self._mapNode.txt_Select, colorSelect)
NovaAPI.SetTMPColor(self._mapNode.txt_unSelect, colorUnSelect)
end
self._mapNode.txt_Select.gameObject.transform.localScale = isOpen == true and Vector3.one or Vector3.zero
self._mapNode.txt_unSelect.gameObject.transform.localScale = isOpen == true and Vector3.one or Vector3.zero
local imgTxtSelect = self._mapNode.Select.transform:Find("imgTxt").gameObject
local imgTxtUnSelect = self._mapNode.unSelect.transform:Find("imgTxt").gameObject
imgTxtSelect:SetActive(isOpen)
imgTxtUnSelect:SetActive(isOpen)
self._mapNode.lockSel:SetActive(not isOpen)
self._mapNode.lockUnSel:SetActive(not isOpen)
self._mapNode.Select:GetComponent("Image").enabled = isOpen
self._mapNode.unSelect:GetComponent("Image").enabled = isOpen
end
function TemplateToggleTypeCtrl:SetTrigger(bOn)
if self._mapNode.AnimSwitch.enabled == false then
self._mapNode.AnimSwitch.enabled = true
end
if bOn then
self._mapNode.AnimSwitch:SetTrigger("tOn")
else
self._mapNode.AnimSwitch:SetTrigger("tOff")
end
end
return TemplateToggleTypeCtrl
@@ -0,0 +1,744 @@
local BaseCtrl = require("GameCore.UI.BaseCtrl")
local DustDawnThemeCtrl = class("DustDawnThemeCtrl", BaseCtrl)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
DustDawnThemeCtrl._mapNodeConfig = {
goBg = {sNodeName = "---Bg---"},
TopBar = {
sNodeName = "TopBarPanel",
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
},
btnEntrance_ = {
nCount = 7,
sComponentName = "UIButton",
callback = "OnBtn_ClickActivityEntrance"
},
imgRemaineTime = {},
txtActivityTime = {sComponentName = "TMP_Text"},
txtActivityDate = {sComponentName = "TMP_Text"},
imgEnd = {},
txtActivityEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgMiniGame = {},
txtMiniGame = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_PlayTitle"
},
imgMiniGameEnd = {},
txtMiniGameEnd = {
sComponentName = "TMP_Text",
sLanguageId = "MathParkour_PlayTitle"
},
txtMiniGame_End = {},
txtMiniGameEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
txtMiniGameActivityUnlockTime = {sComponentName = "TMP_Text"},
imgMiniGameActivityTime = {},
txtMiniGameActivityTime = {sComponentName = "TMP_Text"},
imgMiniGameActivityUnlockTime = {},
goMiniGameEnd = {
sNodeName = "goMiniGameTxtEnd"
},
txtTask = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Task"
},
txtTaskProgress = {sComponentName = "TMP_Text"},
imgTaskActivityTime = {},
txtTaskActivityTime = {sComponentName = "TMP_Text"},
TaskEndState = {
sNodeName = "txtTaskProgress_End"
},
txtTaskEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgTaskEnd = {},
bgTaskTxtEnd = {},
txtTaskEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Task"
},
txtTaskProgress_End = {
sNodeName = "txtTaskProgressEnd"
},
imgTaskActivityUnlockTime = {},
txtTaskActivityUnlockTime = {sComponentName = "TMP_Text"},
txtTaskProgressEnd = {sComponentName = "TMP_Text"},
imgStory = {sComponentName = "Image"},
txtStory = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_StoryName_20104"
},
txtStory2 = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_StoryNameTips_20104"
},
txtShopEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
txtShop = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Shop"
},
imgShopActivityTime = {},
txtShopActivityTime = {sComponentName = "TMP_Text"},
imgShopActivityUnlockTime = {},
txtShopActivityUnlockTime = {sComponentName = "TMP_Text"},
txtShopEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Shop"
},
imgShopEnd = {},
txtShop_End = {},
bgShopTxtEnd = {},
txtLevel = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Level"
},
txtLevel_End = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Level"
},
bgLevelTxtEnd = {},
goLevelEnd = {},
txtLevelEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgLevelActivityUnlockTime = {},
txtLevelActivityUnlockTime = {sComponentName = "TMP_Text"},
imgLevelEnd = {},
imgLevelActivityTime = {},
txtLevelActivityTime = {sComponentName = "TMP_Text"},
txtShow = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_ChallengeTitle"
},
imgShowEnd = {},
imgShowActivityTime = {},
txtShowActivityTime = {sComponentName = "TMP_Text"},
goShowEnd = {},
bgShowTxt_End = {},
txtShow_End = {
sComponentName = "TMP_Text",
sLanguageId = "TravelerDuel_ChallengeTitle"
},
txtShowEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgShowActivityUnlockTime = {},
txtShowActivityUnlockTime = {sComponentName = "TMP_Text"},
imgShowLock = {},
txtLock = {sComponentName = "TMP_Text"},
imgFateCard = {sComponentName = "Image"},
txtFateCard = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Fate_Card_20104"
},
imgFateCardEnd = {},
txtFateCardEnd = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_Fate_Card_20104"
},
txtFateCard_End = {},
goFateCardEnd = {},
txtFateCardEndState = {
sComponentName = "TMP_Text",
sLanguageId = "Activity_End"
},
imgFateCardActivityUnlockTime = {},
txtFateCardActivityUnlockTime = {sComponentName = "TMP_Text"},
imgFateCardActivityTime = {},
txtFateCardActivityTime = {sComponentName = "TMP_Text"},
dbFateCardEnd = {},
miniGameRedDot = {},
redDotEntrance2 = {},
storyRedDot = {},
reddotLevel = {},
reddotShow = {},
reddotFatecard = {}
}
DustDawnThemeCtrl._mapEventConfig = {}
local ActivityState = {
NotOpen = 1,
Open = 2,
Closed = 3
}
function DustDawnThemeCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
end
self.ActData = PlayerData.Activity:GetActivityGroupDataById(self.nActId)
if self.ActData ~= nil then
self.ActivityGroupCfg = self.ActData.actGroupConfig
end
self.tbBtnAnimator = {}
end
function DustDawnThemeCtrl:OnEnable()
if #self.tbBtnAnimator == 0 then
for k, v in pairs(self._mapNode.btnEntrance_) do
local anim = v.transform:GetChild(0):GetComponent("Animator")
if anim ~= nil and anim:IsNull() == false then
table.insert(self.tbBtnAnimator, anim)
end
end
end
self:RefreshPanel()
self:RegisterReddot()
self:SetEnterState()
end
function DustDawnThemeCtrl: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.taskRemainTimer then
TimerManager.Remove(self.taskRemainTimer)
self.taskRemainTimer = nil
end
if nil ~= self.showRemainTimer then
TimerManager.Remove(self.showRemainTimer)
self.showRemainTimer = nil
end
if nil ~= self.fateCardRemainTimer then
TimerManager.Remove(self.fateCardRemainTimer)
self.fateCardRemainTimer = nil
end
for i = 1, #self.tbBtnAnimator do
self.tbBtnAnimator[i] = nil
end
end
function DustDawnThemeCtrl:RegisterReddot()
for i = 1, 7 do
local actData = self.ActData:GetActivityDataByIndex(i)
local nActId = actData ~= nil and actData.ActivityId or 0
local state = self.tbActState[nActId]
if nActId ~= nil and 0 < nActId and state ~= nil then
if i == AllEnum.ActivityThemeFuncIndex.Task then
if state == ActivityState.Closed then
self._mapNode.redDotEntrance2:SetActive(false)
else
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_Task, {
self.nActId,
nActId
}, self._mapNode.redDotEntrance2)
end
elseif i == AllEnum.ActivityThemeFuncIndex.Level then
RedDotManager.RegisterNode(RedDotDefine.ActivityLevel, {
self.nActId,
nActId
}, self._mapNode.reddotLevel)
elseif i == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
local activityData = ConfigTable.GetData("Activity", actData.ActivityId)
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
if nNeedWorldLevel > PlayerData.Base:GetWorldClass() then
self._mapNode.reddotShow:SetActive(false)
else
RedDotManager.RegisterNode(RedDotDefine.TrekkerVersus, {
self.nActId,
nActId
}, self._mapNode.reddotShow)
end
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
if state == ActivityState.Closed then
self._mapNode.reddotFatecard:SetActive(false)
else
RedDotManager.RegisterNode(RedDotDefine.Activity_Group_PenguinCard_Level, {
self.nActId
}, self._mapNode.reddotFatecard)
end
elseif i == AllEnum.ActivityThemeFuncIndex.MiniGame then
if state == ActivityState.Closed then
self._mapNode.miniGameRedDot:SetActive(false)
else
RedDotManager.RegisterNode(RedDotDefine.Activity_MathParkour_New, {
actData.ActivityId
}, self._mapNode.miniGameRedDot)
end
end
end
end
end
function DustDawnThemeCtrl:SetEnterState()
local sAnimName = "DustDawnPanel_Pullback"
local sAnimName_Bt = "btnEntrance_Full_in"
local sAudioName = "Mode_20104_activity"
local nAnimLength = 0.1
if self.bFirstEnter then
sAnimName = ""
if self.nEnterType ~= nil then
if self.nEnterType == AllEnum.ActivityThemeFuncIndex.Level or self.nEnterType == AllEnum.ActivityThemeFuncIndex.TrekkerVersus or self.nEnterType == AllEnum.ActivityThemeFuncIndex.Task then
sAnimName = "DustDawnPanel_Full_Right"
elseif self.nEnterType == AllEnum.ActivityThemeFuncIndex.Story or self.nEnterType == AllEnum.ActivityThemeFuncIndex.MiniGame or self.nEnterType == AllEnum.ActivityThemeFuncIndex.FateCard or self.nEnterType == AllEnum.ActivityThemeFuncIndex.Shop then
sAnimName = "DustDawnPanel_Full_Left"
end
end
sAnimName_Bt = "btnEntrance_in"
sAudioName = "Mode_20104_activity_01"
end
self.bFirstEnter = true
self.animRoot = self.gameObject:GetComponent("Animator")
if sAnimName ~= "" then
self.animRoot:Play(sAnimName, 0, 0)
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {sAnimName})
end
WwiseAudioMgr:PostEvent(sAudioName)
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
for k, v in pairs(self.tbBtnAnimator) do
v.enabled = true
if k ~= AllEnum.ActivityThemeFuncIndex.Story then
local actData = self.ActData:GetActivityDataByIndex(k)
if actData == nil then
v:Play(sAnimName_Bt)
else
local state = self.ActData:GetActivityEntranceState(actData.ActivityId)
if state == ActivityState.Closed then
v:Play(sAnimName_Bt .. "_lock")
else
v:Play(sAnimName_Bt)
end
end
else
v:Play(sAnimName_Bt)
end
end
end
function DustDawnThemeCtrl:RefreshPanel()
if self.ActData == nil or self.ActivityGroupCfg == nil then
return
end
self:RefreshTime()
self:RefreshButtonState()
end
function DustDawnThemeCtrl:RefreshTime()
local bOpen = self.ActData:CheckActivityGroupOpen()
if bOpen then
self:RefreshRemainTime(self.ActData:GetActGroupEndTime(), self._mapNode.txtActivityTime)
if nil == self.remainTimer then
self.remainTimer = self:AddTimer(0, 1, function()
local remainTime = self:RefreshRemainTime(self.ActData: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.ActData:GetActGroupDate()
local strOpenDay = string.format("%d", nOpenDay)
local strEndDay = string.format("%d", nEndDay)
local dateStr = string.format("%s/%s/%s ~ %s/%s/%s", nOpenYear, nOpenMonth, strOpenDay, nEndYear, nEndMonth, strEndDay)
NovaAPI.SetTMPText(self._mapNode.txtActivityDate, dateStr)
end
function DustDawnThemeCtrl: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 DustDawnThemeCtrl: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 DustDawnThemeCtrl:RefreshButtonState()
self.tbActState = {}
for i = 1, 7 do
local actData = self.ActData: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)
elseif i == AllEnum.ActivityThemeFuncIndex.TrekkerVersus then
self:RefreshOtherButtonState(actData)
elseif i == AllEnum.ActivityThemeFuncIndex.FateCard then
self:RefreshFateCardButtonState(actData)
end
end
self:RefreshStoryButtonState_special()
end
function DustDawnThemeCtrl:RefreshButtonTimer(actData, timer, txtTrans, imgTrans, refreshFunc)
local countDownTimer
local activityId = actData.ActivityId
local state, bShowCountDown, openTime, endTime = self.ActData:GetActivityEntranceTimerData(activityId)
if state == ActivityState.NotOpen then
if nil == timer and openTime ~= nil then
local fcTimer = function()
local 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(countDownTimer)
countDownTimer = nil
self.tbActState[activityId] = ActivityState.Open
refreshFunc(actData)
self:RefreshActivityData()
end
end
fcTimer()
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
end
elseif state == ActivityState.Open and endTime ~= nil and timer == nil and bShowCountDown then
self:RefreshRemainTime(endTime, txtTrans)
local fcTimer = function()
local remainTime = self:RefreshRemainTime(endTime, txtTrans)
if remainTime <= 0 then
TimerManager.Remove(countDownTimer)
countDownTimer = nil
refreshFunc(actData)
end
end
fcTimer()
countDownTimer = self:AddTimer(0, 1, fcTimer, true, true, false)
end
return state, bShowCountDown, countDownTimer
end
function DustDawnThemeCtrl: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, countDownTimer = self:RefreshButtonTimer(actData, self.minigameRemainTimer, self._mapNode.txtMiniGameActivityTime, self._mapNode.imgMiniGameActivityUnlockTime, refreshFunc)
if self.minigameRemainTimer == nil then
self.minigameRemainTimer = countDownTimer
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._mapNode.goMiniGameEnd.gameObject:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
end
end
function DustDawnThemeCtrl: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.imgTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.bgTaskTxtEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.TaskEndState.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.txtTaskEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.imgTaskActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
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 DustDawnThemeCtrl:RefreshStoryButtonState_special()
if self:IsStoryRefresh() then
self:CheckStoryRedNode()
self._mapNode.txtStory2.gameObject:SetActive(false)
else
self._mapNode.storyRedDot.gameObject:SetActive(false)
self._mapNode.txtStory2.gameObject:SetActive(true)
end
end
function DustDawnThemeCtrl:IsStoryRefresh()
local curTime = CS.ClientManager.Instance.serverTimeStamp
local time = ConfigTable.GetConfigValue("StoryUnlockTime", "")
local openTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(time)
return curTime > openTime
end
function DustDawnThemeCtrl: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.bgLevelTxtEnd:SetActive(state == ActivityState.Closed)
self._mapNode.goLevelEnd:SetActive(state == ActivityState.Closed)
self._mapNode.txtLevel_End.gameObject:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
end
end
function DustDawnThemeCtrl: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._mapNode.bgShopTxtEnd:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
end
end
function DustDawnThemeCtrl:RefreshOtherButtonState(actData)
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
if activityData ~= nil then
local nNeedWorldLevel = tonumber(activityData.LimitParam) or 0
local bNeedLv = nNeedWorldLevel <= PlayerData.Base:GetWorldClass()
local refreshFunc = function(actData)
self:RefreshOtherButtonState(actData)
end
local state, bShowCountDown, countDowmTimer
if bNeedLv then
state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.showRemainTimer, self._mapNode.txtShowActivityTime, self._mapNode.imgShowActivityUnlockTime, refreshFunc)
if self.showRemainTimer == nil then
self.showRemainTimer = countDowmTimer
end
else
state = ActivityState.NotOpen
end
self._mapNode.imgShowActivityTime:SetActive(state == ActivityState.Open and bShowCountDown)
self._mapNode.imgShowActivityUnlockTime:SetActive(state == ActivityState.NotOpen and bNeedLv)
self._mapNode.imgShowEnd:SetActive(state == ActivityState.Closed or not bNeedLv)
self._mapNode.txtShow.gameObject:SetActive(state ~= ActivityState.Closed and bNeedLv)
self._mapNode.bgShowTxt_End.gameObject:SetActive(state == ActivityState.Closed or not bNeedLv)
self._mapNode.txtShowEnd.gameObject:SetActive(state == ActivityState.Closed or not bNeedLv)
self._mapNode.goShowEnd:SetActive(state == ActivityState.Closed)
self._mapNode.imgShowLock:SetActive(state == ActivityState.NotOpen and not bNeedLv)
local txtLock = orderedFormat(ConfigTable.GetUIText("ActivityEnter_Lock"), nNeedWorldLevel)
NovaAPI.SetTMPText(self._mapNode.txtLock, txtLock)
self.tbActState[activityId] = state
end
end
function DustDawnThemeCtrl:RefreshFateCardButtonState(actData)
local activityId = actData.ActivityId
local activityData = ConfigTable.GetData("Activity", activityId)
if activityData ~= nil then
local refreshFunc = function(actData)
self:RefreshFateCardButtonState(actData)
end
local state, bShowCountDown, countDowmTimer = self:RefreshButtonTimer(actData, self.fateCardRemainTimer, self._mapNode.txtFateCardActivityTime, self._mapNode.imgFateCardActivityUnlockTime, refreshFunc)
if self.fateCardRemainTimer == nil then
self.fateCardRemainTimer = countDowmTimer
end
self._mapNode.imgFateCardActivityUnlockTime:SetActive(state == ActivityState.NotOpen)
self._mapNode.imgFateCardActivityTime.gameObject:SetActive(state == ActivityState.Open and bShowCountDown)
self._mapNode.imgFateCardEnd:SetActive(state == ActivityState.Closed)
self._mapNode.txtFateCard_End:SetActive(state == ActivityState.Closed)
self._mapNode.txtFateCardEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.goFateCardEnd.gameObject:SetActive(state == ActivityState.Closed)
self._mapNode.dbFateCardEnd:SetActive(state == ActivityState.Closed)
self.tbActState[activityId] = state
end
end
function DustDawnThemeCtrl:RequireActivityData()
if self.bRequiredActData then
return
end
local callFunc = function()
self.bRequireSucc = true
self:RefreshPanel()
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
self.bRequiredActData = true
self:AddTimer(1, 1, function()
self.bRequiredActData = false
end, true, true, true)
end
function DustDawnThemeCtrl:RefreshActivityData()
if self.bRequiredActData then
return
end
self:AddTimer(1, 3, function()
self:RequireActivityData()
end, true, true, true)
end
function DustDawnThemeCtrl:OnBtn_ClickActivityEntrance(btn, nIndex)
self.nEnterType = nIndex
if nIndex == AllEnum.ActivityThemeFuncIndex.Story then
if self:IsStoryRefresh() then
local sKey = "20104_StoryNewRedNode"
LocalData.SetPlayerLocalData(sKey, false)
self:CheckStoryRedNode()
end
local chapterId = 11
local isUnlock = PlayerData.Avg:IsStoryChapterUnlock(chapterId)
if isUnlock then
WwiseAudioMgr:PostEvent("Mode_20104_story_01")
self.animRoot:Play("DustDawnPanel_Out_Left", 0, 0)
local OutAnimFinish = function()
EventManager.Hit(EventId.OpenPanel, PanelId.DustDawnStory, chapterId)
end
self:SetAnimationCallback(self.animRoot, OutAnimFinish)
else
local sLockReadTipsKey = "Mainline_Preview_Lock_Read_" .. chapterId
if LocalData.GetPlayerLocalData(sLockReadTipsKey) then
self.animRoot:Play("DustDawnPanel_Out_Left", 0, 0)
WwiseAudioMgr:PostEvent("Mode_20104_story_01")
local OutAnimFinish = function()
EventManager.Hit(EventId.OpenPanel, PanelId.DustDawnStory, chapterId)
end
self:SetAnimationCallback(self.animRoot, OutAnimFinish)
return
end
local sTip = ConfigTable.GetUIText("Mainline_Preview_Lock_Read")
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = sTip,
callbackConfirm = function()
self.animRoot:Play("DustDawnPanel_Out_Left", 0, 0)
WwiseAudioMgr:PostEvent("Mode_20104_story_01")
local OutAnimFinish = function()
LocalData.SetPlayerLocalData(sLockReadTipsKey, true)
EventManager.Hit(EventId.OpenPanel, PanelId.DustDawnStory, chapterId)
end
self:SetAnimationCallback(self.animRoot, OutAnimFinish)
end
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
return
end
local actData = self.ActData:GetActivityDataByIndex(nIndex)
if actData == nil then
return
end
local bOpen, _state, _sTips, bNeedRefreshData = self.ActData:CheckActivityEntranceOpen(actData.ActivityId, actData.PanelId, true, self.bRequiredActData)
if not bOpen then
if bNeedRefreshData then
self:RequireActivityData()
end
return
end
if nIndex == AllEnum.ActivityThemeFuncIndex.Level then
self.animRoot:Play("DustDawnPanel_Out_Right", 0, 0)
local OutAnimFinish = function()
self.ActData:OpenActivityEntrance(actData.ActivityId, actData.PanelId)
end
self:SetAnimationCallback(self.animRoot, OutAnimFinish)
end
self.ActData:OpenActivityEntrance(actData.ActivityId, actData.PanelId)
end
function DustDawnThemeCtrl:CheckStoryRedNode()
local sKey = "20104_StoryNewRedNode"
local bIsFirst = LocalData.GetPlayerLocalData(sKey)
if bIsFirst == nil then
bIsFirst = true
else
bIsFirst = false
end
self._mapNode.storyRedDot.gameObject:SetActive(bIsFirst)
end
return DustDawnThemeCtrl
@@ -0,0 +1,20 @@
local BasePanel = require("GameCore.UI.BasePanel")
local DustDawnThemePanel = class("DustDawnThemePanel", BasePanel)
DustDawnThemePanel._sUIResRootPath = "UI_Activity/"
DustDawnThemePanel._tbDefine = {
{
sPrefabPath = "20104/DustDawnPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.20104.DustDawnThemeCtrl"
}
}
function DustDawnThemePanel:Awake()
end
function DustDawnThemePanel:OnEnable()
end
function DustDawnThemePanel:OnDisable()
end
function DustDawnThemePanel:OnDestroy()
end
function DustDawnThemePanel:OnRelease()
end
return DustDawnThemePanel
@@ -0,0 +1,134 @@
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"},
goStar = {
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
},
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)
self._mapNode.goStar.gameObject:SetActive(true)
local mapDiscCfgData = ConfigTable.GetData("Disc", self.mapGoodsCfg.ItemId)
if mapDiscCfgData then
self:SetAtlasSprite(self._mapNode.imgElement, "12_rare", AllEnum.Star_Element[mapDiscCfgData.EET].icon)
end
local nStar = 6 - mapItemCfg.Rarity
self._mapNode.goStar:SetStar(nStar, nStar)
else
self:SetPngSprite(self._mapNode.imgIcon, mapItemCfg.Icon)
self._mapNode.imgElement.gameObject:SetActive(false)
self._mapNode.goStar.gameObject:SetActive(false)
end
self._mapNode.imgExpire.gameObject:SetActive(mapItemCfg.ExpireType > 0)
local sPath = "db_shop_" .. AllEnum.FrameColor_New[mapItemCfg.Rarity]
self:SetActivityAtlasSprite_New(self._mapNode.imgRare, "20104/SpriteAtlas/2010404", 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 = "20104/Shop/ActivityShopPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.ShopCommon.ActivityShopCtrl"
}
}
function ActivityShopPanel:Awake()
self.nDefaultId = nil
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" then
self.nActId = tbParam[1]
self.nDefaultId = tbParam[2]
end
self.actShopData = PlayerData.Activity:GetActivityDataById(self.nActId)
end
function ActivityShopPanel:OnEnable()
end
function ActivityShopPanel:OnDisable()
end
function ActivityShopPanel:OnDestroy()
end
return ActivityShopPanel
@@ -0,0 +1,16 @@
local DustDawnTaskPanel = class("DustDawnTaskPanel", BasePanel)
DustDawnTaskPanel._sUIResRootPath = "UI_Activity/"
DustDawnTaskPanel._tbDefine = {
{
sPrefabPath = "20104/Task.prefab",
sCtrlName = "Game.UI.ActivityTheme.TaskCommon.TaskCommonCtrl_01"
}
}
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
function DustDawnTaskPanel:Awake()
local tbParam = self:GetPanelParam()
if type(tbParam) == "table" and tbParam[3] == nil then
tbParam[3] = tbImgDbType.FillAmount
end
end
return DustDawnTaskPanel
@@ -1,5 +1,4 @@
local ActivityAvgInfoExCtrl = class("ActivityAvgInfoExCtrl", BaseCtrl)
local AvgData = PlayerData.ActivityAvg
ActivityAvgInfoExCtrl._mapNodeConfig = {
mainLineAvgLvName = {sComponentName = "TMP_Text"},
mainLineAvgLvNum = {sComponentName = "TMP_Text"},
@@ -67,11 +66,14 @@ function ActivityAvgInfoExCtrl:OnDestroy()
end
function ActivityAvgInfoExCtrl:OnRelease()
end
function ActivityAvgInfoExCtrl:OpenLevelInfo(avgId, actId, bNewestStory)
function ActivityAvgInfoExCtrl:OpenLevelInfo(avgId, actId, bNewestStory, bReview)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
self.avgId = avgId
self.actId = actId
self.bNewestStory = bNewestStory
local mapActivityAvg = AvgData:GetStoryCfgData(avgId)
self.bReview = bReview == true
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
local mapActivityAvg = self.storyData:GetStoryCfgData(avgId)
if mapActivityAvg == nil then
printError("nil mainlineData" .. avgId)
return
@@ -91,7 +93,7 @@ function ActivityAvgInfoExCtrl:OpenLevelInfo(avgId, actId, bNewestStory)
self._mapNode.txtClueNotice:SetActive(mapActivityAvg.HasEvidence)
self._mapNode.imgClueNotice:SetActive(mapActivityAvg.HasEvidence)
self._mapNode.goRewardInfo:SetActive(false)
if not AvgData:IsStoryReaded(mapActivityAvg.Id) then
if not self.storyData:IsStoryReaded(mapActivityAvg.Id) then
local tbReward = decodeJson(mapActivityAvg.FirstCompleteReward)
if tbReward ~= nil then
self._mapNode.goRewardInfo:SetActive(true)
@@ -105,6 +107,7 @@ function ActivityAvgInfoExCtrl:OpenLevelInfo(avgId, actId, bNewestStory)
end
function ActivityAvgInfoExCtrl:OnBtnClick_Close()
self.gameObject:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
EventManager.Hit("SelectMainlineBattle", false)
EventManager.Hit("CloseActivityAvgInfo", false)
end
@@ -113,9 +116,10 @@ function ActivityAvgInfoExCtrl:OnBtnClick_MonsterInfo(btn)
end
function ActivityAvgInfoExCtrl:OnBtnClick_OpenAvg(btn)
self.gameObject:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
if not self.IsBattle then
EventManager.Hit("SelectMainlineBattle", false)
AvgData:SendMsg_STORY_ENTER(self.actId, self.avgId, 0, self.bNewestStory)
self.storyData:SendMsg_STORY_ENTER(self.actId, self.avgId, 0, self.bNewestStory)
else
EventManager.Hit("SelectMainlineBattle", true)
end
@@ -134,7 +134,10 @@ function ActivityLevelsInstancePauseCtrl:Refresh()
end
end
for i = 1, 3 do
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
local nCharId = self.tbChar[i]
local nTrialId = self._mapCharTrialId and self._mapCharTrialId[nCharId]
self._mapNode.btnChar[i].interactable = not nTrialId or not (0 < nTrialId)
self._mapNode.goChar[i]:SetChar(nCharId, false, false, nTrialId)
end
end
function ActivityLevelsInstancePauseCtrl:PlayInAni()
@@ -186,8 +189,9 @@ function ActivityLevelsInstancePauseCtrl:OnDisable()
end
function ActivityLevelsInstancePauseCtrl:OnDestroy()
end
function ActivityLevelsInstancePauseCtrl:Pause(nActivityId, nLevelId, tbCharId)
function ActivityLevelsInstancePauseCtrl:Pause(nActivityId, nLevelId, tbCharId, mapCharTrialId)
self.tbChar = tbCharId
self._mapCharTrialId = mapCharTrialId
self.nLevelId = nLevelId
self.nActivityId = nActivityId
EventManager.Hit(EventId.BattleDashboardVisible, false)
@@ -80,7 +80,7 @@ function ActivityShopGoodsDetailCtrl:RefreshInfo()
local nStar = 6 - mapCfg.Rarity
self._mapNode.goDiscStar:SetStar(nStar, nStar)
end
if mapCfg.Type == GameEnum.itemType.Disc or mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin then
if mapCfg.Type == GameEnum.itemType.Disc or mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin or mapCfg.Stype == GameEnum.itemStype.DormFurniture then
self._mapNode.txtHas.gameObject:SetActive(false)
else
self._mapNode.txtHas.gameObject:SetActive(true)
@@ -1,7 +1,6 @@
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"},
@@ -44,8 +43,10 @@ function SwimThemeStoryCtrl:Awake()
local param = self:GetPanelParam()
if type(param) == "table" then
self.nActId = param[1]
self.bReview = param[2] == true
end
self.tbAllStory = ActivityAvgData:GetStoryIdListByActivityId(self.nActId)
self.storyData = self.bReview and PlayerData.StoryReview or PlayerData.ActivityAvg
self.tbAllStory, self.nChapterId = self.storyData:GetStoryIdListByActivityId(self.nActId)
self.storyNodePos = {27, -30}
end
function SwimThemeStoryCtrl:OnEnable()
@@ -60,7 +61,7 @@ function SwimThemeStoryCtrl:RefreshPanel()
self:RefreshPersonality()
end
function SwimThemeStoryCtrl:RefreshDate()
local nOpenTime, nEndTime = PlayerData.ActivityAvg:GetActivityOpenTime(self.nActId)
local nOpenTime, nEndTime = self.storyData:GetActivityOpenTime(self.nActId)
local nYear = tonumber(os.date("%Y", nOpenTime))
local nOpenMonth = tonumber(os.date("%m", nOpenTime))
local nOpenDay = tonumber(os.date("%d", nOpenTime))
@@ -82,7 +83,7 @@ function SwimThemeStoryCtrl:RefreshPersonality()
if personalityId <= 0 then
return
end
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = PlayerData.ActivityAvg:CalcPersonality(personalityId)
local tbRetPercent, sTitle, sFace, tbPData, nTotalCount, sHead = self.storyData:CalcPersonality(personalityId)
NovaAPI.SetPersonalityRing(self._mapNode.goPersonality, tbRetPercent)
NovaAPI.SetTMPText(self._mapNode.txtPersonality, sTitle)
local sIcon = "Icon/PlayerHead/" .. sHead
@@ -94,7 +95,7 @@ function SwimThemeStoryCtrl:RefreshStoryList()
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)
local recentIndex = self.storyData:GetRecentAcvitityIndex(self.nActId)
if 2 < recentIndex then
recentIndex = recentIndex - 3
else
@@ -114,19 +115,23 @@ function SwimThemeStoryCtrl:OnRefreshGrid(grid, index)
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 isTimeUnlock, isPreReaded, nOpenTime = self.storyData:IsActivityAvgUnlock(self.nActId, storyId)
local isReaded = self.storyData:IsActivityAvgReaded(self.nActId, storyId)
local isNew = self.storyData: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)
if self.bReview then
reddot:SetActive(false)
else
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActId)
RedDotManager.RegisterNode(RedDotDefine.Activity_GroupNew_Avg_Group, {
nActGroupId,
self.nActId,
storyId
}, reddot, nil, nil, true)
end
local imgStory = RootNode:Find("imgStory"):GetComponent("Image")
local txtIndex = goUnlock:Find("txtIndex"):GetComponent("TMP_Text")
local txtTitle = goUnlock:Find("txtTitle"):GetComponent("TMP_Text")
@@ -151,7 +156,7 @@ function SwimThemeStoryCtrl:OnRefreshGrid(grid, index)
goTime.gameObject:SetActive(true)
local bPreTimeUnlock = true
if avgCfg.PreLevelId ~= 0 then
bPreTimeUnlock = PlayerData.ActivityAvg:IsActivityAvgUnlock(self.nActId, avgCfg.PreLevelId)
bPreTimeUnlock = self.storyData:IsActivityAvgUnlock(self.nActId, avgCfg.PreLevelId)
end
if not bPreTimeUnlock then
goTime.gameObject:SetActive(false)
@@ -181,7 +186,7 @@ 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 isTimeUnlock, isPreReaded, nOpenTime = self.storyData:IsActivityAvgUnlock(self.nActId, storyId)
local isUnlock = isTimeUnlock and isPreReaded
local avgcfg = ConfigTable.GetData("ActivityAvgLevel", storyId)
if not isUnlock then
@@ -200,10 +205,10 @@ function SwimThemeStoryCtrl:OnClickGrid(grid, index)
return
end
self._mapNode.ctlAvgRoot.gameObject:SetActive(true)
self._mapNode.ctlAvgRoot:OpenLevelInfo(storyId, self.nActId)
self._mapNode.ctlAvgRoot:OpenLevelInfo(storyId, self.nActId, nil, self.bReview)
self._mapNode.t_fullscreen_blur_black:SetActive(true)
LocalData.SetPlayerLocalData("Act_Story_New" .. self.nActId .. storyId, true)
PlayerData.ActivityAvg:RefreshAvgRedDot()
LocalData.SetPlayerLocalData(self.storyData:_GetLocalReadKey(self.nActId, storyId), true)
self.storyData:RefreshAvgRedDot()
end
function SwimThemeStoryCtrl:GetRemainTimeStr(nOpenTime, openDay)
local timeStr = ""
@@ -235,16 +240,19 @@ function SwimThemeStoryCtrl:OnBtn_ClickCloseLevelInfoPanel()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
end
function SwimThemeStoryCtrl:OnEvent_CloseAvgInfoRoot()
self._mapNode.t_fullscreen_blur_black:SetActive(false)
self._mapNode.ctlAvgRoot.gameObject:SetActive(false)
self._mapNode.goChapterComplete:SetActive(false)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
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)
EventManager.Hit("ActivityStoryReceive_SetVisible", true)
self:RefreshPanel()
end
function SwimThemeStoryCtrl:OnEvent_ActivityStory_All_Complate()
@@ -254,6 +262,7 @@ function SwimThemeStoryCtrl:OnEvent_Activity_Story_RewardClosed()
if self.bAllComplate then
self._mapNode.t_fullscreen_blur_black:SetActive(true)
self._mapNode.goChapterComplete:SetActive(true)
EventManager.Hit("ActivityStoryReceive_SetVisible", false)
self.bAllComplate = false
end
end
@@ -1,13 +1,21 @@
local BasePanel = require("GameCore.UI.BasePanel")
local SwimThemeStoryPanel = class("SwimThemeStoryPanel", BasePanel)
SwimThemeStoryPanel._sUIResRootPath = "UI_Activity/"
SwimThemeStoryPanel._tbDefine = {
{
sPrefabPath = "Swim/Story/SwimThemeStoryPanel.prefab",
sPrefabPath = "ActivityStoryReview/Swim/SwimThemeStoryPanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.Swim.Story.SwimThemeStoryCtrl"
},
{
sPrefabPath = "ActivityStoryReview/ActivityStoryReceivePanel.prefab",
sCtrlName = "Game.UI.ActivityStoryReview.ActivityStoryReceiveCtrl"
}
}
function SwimThemeStoryPanel:Awake()
if self._tbParam[2] ~= true then
self._tbDefine = {
self._tbDefine[1]
}
end
end
function SwimThemeStoryPanel:OnEnable()
end
@@ -1,6 +1,5 @@
local TaskCommonCtrl_01 = class("TaskCommonCtrl_01", BaseCtrl)
local JumpUtil = require("Game.Common.Utils.JumpUtil")
local PlayerActivityData = PlayerData.Activity
local TabType = GameEnum.ActivityTaskTabType
local ItemType = GameEnum.itemType
local tbImgDbType = {SizeDelta = 1, FillAmount = 2}
@@ -60,13 +59,23 @@ TaskCommonCtrl_01._mapEventConfig = {
TaskCommonCtrl_01._mapRedDotConfig = {}
function TaskCommonCtrl_01:OnEnable()
local tbParam = self:GetPanelParam()
self.nActivityId = type(tbParam) == "table" and tbParam[1] or nil
self.nCurGroupIndex = tbParam[2]
self.imgDbType = tbParam[3] or tbImgDbType.SizeDelta
if type(tbParam) == "table" then
self.nActivityId = tbParam[1]
self.nCurGroupIndex = tbParam[2]
self.imgDbType = tbParam[3]
end
self.imgDbType = self.imgDbType or tbImgDbType.SizeDelta
if type(self.nActivityId) ~= "number" then
self.nActivityId = nil
end
self:BuildData(self.nActivityId)
if #self.tbData == 0 then
self:refresh_Tab()
return
end
if type(self.nCurGroupIndex) ~= "number" or 1 > self.nCurGroupIndex or self.nCurGroupIndex > #self.tbData then
self.nCurGroupIndex = 1
end
self:refresh_Tab()
self:refresh_Task()
self:refresh_Group()
@@ -87,7 +96,7 @@ function TaskCommonCtrl_01:BuildData(nActivityId)
if type(nActivityId) ~= "number" then
return
end
self.ins_ActivityTaskData = PlayerActivityData:GetActivityDataById(nActivityId)
self.ins_ActivityTaskData = PlayerData.Activity:GetActivityDataById(nActivityId)
if self.ins_ActivityTaskData == nil then
return
end
@@ -110,7 +119,7 @@ function TaskCommonCtrl_01:BuildData(nActivityId)
for i = 1, 6 do
local nRewardId = mapData["Reward" .. tostring(i)]
local nRewardNum = mapData["RewardQty" .. tostring(i)]
if 0 < nRewardId and 0 < nRewardNum then
if 0 < (nRewardId or 0) and 0 < (nRewardNum or 0) then
table.insert(_mapData.tbGroupRewardId, nRewardId)
table.insert(_mapData.tbGroupRewardNum, nRewardNum)
end
@@ -133,6 +142,9 @@ function TaskCommonCtrl_01:BuildData(nActivityId)
local _tbTaskData = _mapData.tbTaskData
local _nTaskId = mapData.Id
local taskData = self.ins_ActivityTaskData.mapActivityTaskDatas[_nTaskId]
if taskData == nil then
return
end
local nIndex = table.indexof(_tbTaskId, _nTaskId)
if nIndex <= 0 then
local _mapTaskData = {
@@ -155,7 +167,7 @@ function TaskCommonCtrl_01:BuildData(nActivityId)
for i = 1, 2 do
local nRewardId = mapData["Tid" .. tostring(i)]
local nRewardNum = mapData["Qty" .. tostring(i)]
if 0 < nRewardId and 0 < nRewardNum then
if 0 < (nRewardId or 0) and 0 < (nRewardNum or 0) then
table.insert(_mapTaskData.tbTaskRewardId, nRewardId)
table.insert(_mapTaskData.tbTaskRewardNum, nRewardNum)
end
@@ -232,7 +244,9 @@ function TaskCommonCtrl_01:onGridRefresh_Tab(go)
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)
if mapCfgData_ActivityTaskGroup ~= nil then
self:RefreshScaleOnClick_State(tr, nIndex, mapCfgData_ActivityTaskGroup, sProgress)
end
local goRedDot = tr:Find("scale_on_click/redDotTab")
local bInActGroup, nActGroupId = PlayerData.Activity:IsActivityInActivityGroup(self.nActivityId)
if bInActGroup == false then
@@ -303,6 +317,9 @@ function TaskCommonCtrl_01:onGridRefresh_Task(go)
_tr.localScale = Vector3.one
local nId = mapTask.tbTaskRewardId[i]
local mapCfgData_Item = ConfigTable.GetData("Item", nId)
if mapCfgData_Item == nil then
return
end
self:SetSprite_FrameColor(_tr:Find("Size/scale_on_click/imgRare").gameObject:GetComponent("Image"), mapCfgData_Item.Rarity, AllEnum.FrameType_New.Item, false)
self:SetPngSprite(_tr:Find("Size/scale_on_click/imgIcon").gameObject:GetComponent("Image"), mapCfgData_Item.Icon)
_tr:Find("Size/scale_on_click/goReceived").localScale = mapTask.nStatus == AllEnum.ActQuestStatus.Received and Vector3.one or Vector3.zero
@@ -346,7 +363,7 @@ function TaskCommonCtrl_01:onEvent_ClickTaskJump(goBtn)
local mapData = self.tbData[self.nCurGroupIndex]
local mapTask = mapData.tbTaskData[nIndex]
local JumpToData = mapTask.tbJumpTo
if JumpToData ~= nil and 0 < #JumpToData then
if JumpToData ~= nil and type(JumpToData) == "table" and 0 < #JumpToData then
JumpUtil.JumpToActivity(JumpToData)
end
end
@@ -360,7 +377,9 @@ function TaskCommonCtrl_01:refresh_Group()
local nTotal = #tbTaskData
local bDone = nOK == nTotal
local mapCfgData_ActivityTaskGroup = ConfigTable.GetData("ActivityTaskGroup", nGroupId)
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, mapCfgData_ActivityTaskGroup.TabText)
if mapCfgData_ActivityTaskGroup ~= nil then
NovaAPI.SetTMPText(self._mapNode.tmpGroupName, mapCfgData_ActivityTaskGroup.TabText)
end
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
@@ -372,6 +391,9 @@ end
function TaskCommonCtrl_01:onGridRefresh_GroupRewardItem(go)
local nIndex = tonumber(go.name) + 1
local mapCfgData_Item = ConfigTable.GetData("Item", self.tbCurGroupRewardId[nIndex])
if mapCfgData_Item == nil then
return
end
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)