Update - 1.13.0.124
EN: 1.13.0.124 CN: 1.13.0.124 JP: 1.13.0.128 KR: 1.13.0.130
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
local MiningGameGuidePanel = class("MiningGameGuidePanel", BasePanel)
|
||||
MiningGameGuidePanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGameGuidePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400014/MiningGameGuidePanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.MiningGameGuideCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGameGuidePanel:Awake()
|
||||
end
|
||||
function MiningGameGuidePanel:OnEnable()
|
||||
end
|
||||
function MiningGameGuidePanel:OnAfterEnter()
|
||||
end
|
||||
function MiningGameGuidePanel:OnDisable()
|
||||
end
|
||||
function MiningGameGuidePanel:OnDestroy()
|
||||
end
|
||||
function MiningGameGuidePanel:OnRelease()
|
||||
end
|
||||
return MiningGameGuidePanel
|
||||
@@ -0,0 +1,24 @@
|
||||
local MiningGamePanel = class("MiningGamePanel", BasePanel)
|
||||
MiningGamePanel._bIsMainPanel = true
|
||||
MiningGamePanel._bAddToBackHistory = true
|
||||
MiningGamePanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGamePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400014/MiningGamePanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.MiningGameCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGamePanel:Awake()
|
||||
self.nGuidePanelId = PanelId.MiningGameGuidePanel_400014
|
||||
end
|
||||
function MiningGamePanel:OnEnable()
|
||||
end
|
||||
function MiningGamePanel:OnAfterEnter()
|
||||
end
|
||||
function MiningGamePanel:OnDisable()
|
||||
end
|
||||
function MiningGamePanel:OnDestroy()
|
||||
end
|
||||
function MiningGamePanel:OnRelease()
|
||||
end
|
||||
return MiningGamePanel
|
||||
@@ -0,0 +1,22 @@
|
||||
local MiningGameQuestPanel = class("MiningGamePanel", BasePanel)
|
||||
MiningGameQuestPanel._bIsMainPanel = false
|
||||
MiningGameQuestPanel._sUIResRootPath = "UI_Activity/"
|
||||
MiningGameQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_400014/MiningGameQuest.prefab",
|
||||
sCtrlName = "Game.UI.Activity.Mining.MiningGameQuestCtrl"
|
||||
}
|
||||
}
|
||||
function MiningGameQuestPanel:Awake()
|
||||
end
|
||||
function MiningGameQuestPanel:OnEnable()
|
||||
end
|
||||
function MiningGameQuestPanel:OnAfterEnter()
|
||||
end
|
||||
function MiningGameQuestPanel:OnDisable()
|
||||
end
|
||||
function MiningGameQuestPanel:OnDestroy()
|
||||
end
|
||||
function MiningGameQuestPanel:OnRelease()
|
||||
end
|
||||
return MiningGameQuestPanel
|
||||
@@ -2,22 +2,100 @@ local ActivityMiningCtrl = class("ActivityMiningCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local axeItemId = 0
|
||||
local barMinX = -365
|
||||
local barMaxX = 0
|
||||
ActivityMiningCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtBtnGo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_Go"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_ActDetail"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
txtAdvanceMat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_RewardPre"
|
||||
},
|
||||
svItem = {
|
||||
sNodeName = "PreviewUpgradeMaterial",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
ActivityMiningCtrl._mapEventConfig = {
|
||||
MiningQuestUpdate = "InitQuest",
|
||||
MiningCloseQuestPanel = "OnEvent_CloseQuestPanel"
|
||||
}
|
||||
ActivityMiningCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_Mining_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function ActivityMiningCtrl:OnDestroy(...)
|
||||
self:UnInit()
|
||||
end
|
||||
function ActivityMiningCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = self.actData:GetActId()
|
||||
self:ShowAddAxeCount()
|
||||
self:RefreshTimeout()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshTimeout", true, true, false)
|
||||
end
|
||||
self:InitItem()
|
||||
self:InitQuest()
|
||||
end
|
||||
function ActivityMiningCtrl:UnInit(...)
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Mining_Quest_Group, nil, self._mapNode.reddot_Task)
|
||||
function ActivityMiningCtrl:InitItem()
|
||||
local config = ConfigTable.GetData("MiningControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
local rewardData = config.RewardsShow
|
||||
self.tbReward = decodeJson(rewardData)
|
||||
self.tbItemIns = {}
|
||||
self._mapNode.svItem:Init(#self.tbReward, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
end
|
||||
function ActivityMiningCtrl:OnGridRefresh(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
local goItem = go.transform:Find("AnimRoot/item").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbItemIns[instanceId]:SetItem(itemId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnGridBtnClick(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("AnimRoot/item"), true, true, false)
|
||||
end
|
||||
function ActivityMiningCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function ActivityMiningCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
@@ -38,33 +116,21 @@ function ActivityMiningCtrl:RefreshTimeout()
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
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 = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
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 = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
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 = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTimeout, sTimeStr)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, sTimeStr)
|
||||
end
|
||||
function ActivityMiningCtrl:ShowAddAxeCount()
|
||||
local nActId = self.actData:GetActId()
|
||||
@@ -80,59 +146,40 @@ function ActivityMiningCtrl:ShowAddAxeCount()
|
||||
data:ResetAddAxeCount()
|
||||
end
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Go(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
local tbStoryConfig = self.actData:GetStoryConfigIdList()
|
||||
local nCurLevel = self.actData:GetLevel()
|
||||
local sNeedPlayAvgyId = 0
|
||||
local nStoryId = 0
|
||||
local tbAllData = self.actData:GetGroupStoryData()
|
||||
for _, v in pairs(tbStoryConfig) do
|
||||
if nCurLevel >= v.config.UnlockLayer then
|
||||
local temp = v.config.Id
|
||||
if not tbAllData[temp].bIsRead then
|
||||
sNeedPlayAvgyId = v.config.AvgId
|
||||
nStoryId = v.config.Id
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local bAvgReadState = true
|
||||
if tbAllData[nStoryId] ~= nil then
|
||||
bAvgReadState = false
|
||||
end
|
||||
if sNeedPlayAvgyId ~= 0 and not bAvgReadState then
|
||||
local callback = function(...)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
|
||||
self.actData:RequestFinishAvg(nStoryId)
|
||||
end
|
||||
local mapData = {
|
||||
nType = AllEnum.StoryAvgType.Plot,
|
||||
sAvgId = sNeedPlayAvgyId,
|
||||
nNodeId = nil,
|
||||
callback = callback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
|
||||
function ActivityMiningCtrl:OnBtnClick_Go()
|
||||
local config = ConfigTable.GetData("MiningControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGame, nActId)
|
||||
EventManager.Hit(EventId.OpenPanel, config.GamePanelId, self.nActId)
|
||||
end
|
||||
self.actData:RequestLevelData(0, callback)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Story(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameStory, nActId)
|
||||
function ActivityMiningCtrl:OnBtnClick_Quest()
|
||||
local config = ConfigTable.GetData("MiningControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, config.QuestPanelId, self.nActId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Task(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameQuest, nActId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Shop(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
local tbConfig = ConfigTable.GetData("MiningControl", nActId)
|
||||
local nShopId = tbConfig.ShopId
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, nShopId)
|
||||
function ActivityMiningCtrl:OnBtnClick_Detail()
|
||||
local config = ConfigTable.GetData("MiningControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = config.Desc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
})
|
||||
end
|
||||
function ActivityMiningCtrl:ClearActivity()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
return ActivityMiningCtrl
|
||||
|
||||
@@ -130,6 +130,8 @@ function MiningGameCtrl:OnEnable()
|
||||
}, self._mapNode.reward_reddot)
|
||||
return
|
||||
end
|
||||
else
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Mining_AllQuest, nil, self._mapNode.reward_reddot)
|
||||
end
|
||||
end
|
||||
function MiningGameCtrl:OnDisable(...)
|
||||
@@ -153,6 +155,8 @@ function MiningGameCtrl:OnDestroy()
|
||||
}, self._mapNode.reward_reddot)
|
||||
return
|
||||
end
|
||||
else
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Mining_AllQuest, nil, self._mapNode.reward_reddot)
|
||||
end
|
||||
end
|
||||
function MiningGameCtrl:InitData()
|
||||
@@ -286,23 +290,31 @@ function MiningGameCtrl:OnBtnClick_OpenGuidePanel()
|
||||
EventManager.Hit(EventId.OpenPanel, self._panel.nGuidePanelId, self.nActId)
|
||||
end
|
||||
function MiningGameCtrl:OnBtnClick_OpenTask()
|
||||
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
|
||||
local actGroupId = mapActivityData.MidGroupId
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
|
||||
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
|
||||
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
|
||||
if taskActData ~= nil and taskActData:CheckActivityOpen() then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_11100, taskActId, GameEnum.ActivityTaskTabType.Tab4)
|
||||
return
|
||||
local controllConfig = ConfigTable.GetData("MiningControl", self.nActId)
|
||||
if controllConfig == nil then
|
||||
return
|
||||
end
|
||||
if controllConfig.UseType == GameEnum.ActivityUseType.Group then
|
||||
if PlayerData.Activity:IsActivityInActivityGroup(self.nActId) then
|
||||
local mapActivityData = ConfigTable.GetData("Activity", self.nActId)
|
||||
local actGroupId = mapActivityData.MidGroupId
|
||||
local actGroupData = PlayerData.Activity:GetActivityGroupDataById(actGroupId)
|
||||
local taskActId = actGroupData:GetActivityDataByIndex(AllEnum.ActivityThemeFuncIndex.Task).ActivityId
|
||||
local taskActData = PlayerData.Activity:GetActivityDataById(taskActId)
|
||||
if taskActData ~= nil and taskActData:CheckActivityOpen() then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Task_11100, taskActId, GameEnum.ActivityTaskTabType.Tab4)
|
||||
return
|
||||
end
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
actGroupId,
|
||||
taskActId,
|
||||
mapActivityData.MiniGameRedDot
|
||||
}, self._mapNode.reward_reddot)
|
||||
self._mapNode.reward_reddot:SetActive(false)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
end
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Group_Task_Group, {
|
||||
actGroupId,
|
||||
taskActId,
|
||||
mapActivityData.MiniGameRedDot
|
||||
}, self._mapNode.reward_reddot)
|
||||
self._mapNode.reward_reddot:SetActive(false)
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Activity_End_Notice"))
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, controllConfig.QuestPanelId, self.nActId)
|
||||
end
|
||||
end
|
||||
function MiningGameCtrl:OnBtnClick_OpenAxeTips()
|
||||
|
||||
@@ -1,73 +1,192 @@
|
||||
local MiningGameQuestCtrl = class("MiningGameQuestCtrl", BaseCtrl)
|
||||
local totalLength = 520
|
||||
local totalHeight = 37
|
||||
local barMinX = -622
|
||||
local barMaxX = 0
|
||||
MiningGameQuestCtrl._mapNodeConfig = {
|
||||
loopSv = {
|
||||
sNodeName = "questList",
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_QuestPanelTitle"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnAllClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btn_GetReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetAllReward"
|
||||
},
|
||||
btn_GetReward_None = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetAllReward_None"
|
||||
},
|
||||
txt_getAllReward = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_Quest_GetAllReward"
|
||||
},
|
||||
Group_loop_sv = {
|
||||
sNodeName = "sv_group",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtBarFill = {
|
||||
Quest_loop_sv = {
|
||||
sNodeName = "sv_quest",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
title_process = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MiningGame_QuestPanel_CurProcess"
|
||||
},
|
||||
txt_GroupProcess = {sComponentName = "TMP_Text"},
|
||||
imgGroupProcessBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btn_AllReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_AllReceive"
|
||||
},
|
||||
txt_AllReceive = {
|
||||
ComponentName = "TMP_Text",
|
||||
"Mining_Quest_AllReceive"
|
||||
}
|
||||
animator = {sNodeName = "Quest", sComponentName = "Animator"}
|
||||
}
|
||||
MiningGameQuestCtrl._mapEventConfig = {
|
||||
MiningQuestUpdate = "InitQuestData"
|
||||
MiningQuestUpdate = "OnEvent_QuestUpdate"
|
||||
}
|
||||
function MiningGameQuestCtrl:Awake(...)
|
||||
MiningGameQuestCtrl._mapRedDotConfig = {}
|
||||
function MiningGameQuestCtrl:Awake()
|
||||
self.tbQuestGridCtrl = {}
|
||||
local param = self:GetPanelParam()
|
||||
local actId
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
actId = param[1]
|
||||
end
|
||||
self:InitData()
|
||||
self:SetData(actId)
|
||||
end
|
||||
function MiningGameQuestCtrl:OnEnable()
|
||||
self._mapNode.blur:SetActive(true)
|
||||
self:PlayAnim_In()
|
||||
end
|
||||
function MiningGameQuestCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function MiningGameQuestCtrl:InitData()
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.tbQuestList = {}
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function MiningGameQuestCtrl:InitQuestData()
|
||||
self.tbQuestList = self.actData:GetAllQuestData()
|
||||
table.sort(self.tbQuestList, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.Id < b.Id
|
||||
if self.tbQuestGridCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbQuestGridCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
return a.nStatus < b.nStatus
|
||||
end
|
||||
self.tbQuestGridCtrl = {}
|
||||
end
|
||||
function MiningGameQuestCtrl:OnDestroy()
|
||||
end
|
||||
function MiningGameQuestCtrl:PlayAnim_In()
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function MiningGameQuestCtrl:SetData(nActId)
|
||||
self.nActId = nActId
|
||||
self.MiningGameData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.nSelectedGroupId = 0
|
||||
self.tbGroup = self.MiningGameData:GetAllGroupId()
|
||||
table.sort(self.tbGroup, function(a, b)
|
||||
return a < b
|
||||
end)
|
||||
if nil ~= self.tbQuestList then
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
local nSelectIndex = 1
|
||||
for i, v in ipairs(self.tbGroup) do
|
||||
local bRed = RedDotManager.GetValid(RedDotDefine.Activity_Mining_QuestGroup, {v})
|
||||
if bRed then
|
||||
nSelectIndex = i
|
||||
break
|
||||
end
|
||||
self._mapNode.loopSv:SetAnim(0.1)
|
||||
self._mapNode.loopSv:Init(#self.tbQuestList, self, self.OnGridRefresh)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
end
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(self.actData:GetCompleteCount() / #self.tbQuestList * totalLength, totalHeight)
|
||||
self.nSelectedGroupId = self.tbGroup[nSelectIndex]
|
||||
self._mapNode.Group_loop_sv:Init(#self.tbGroup, self, self.OnRefreshGroupGrid)
|
||||
self:UpdateQuestList(self.nSelectedGroupId)
|
||||
end
|
||||
function MiningGameQuestCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
function MiningGameQuestCtrl:UpdateQuestList(nGroupId)
|
||||
self.questList = self.MiningGameData:GetQuestbyGroupId(nGroupId)
|
||||
if self.questList == nil then
|
||||
return
|
||||
end
|
||||
local sortFunc = function(a, b)
|
||||
if a.nStatus ~= b.nStatus then
|
||||
return a.nStatus < b.nStatus
|
||||
end
|
||||
return a.nId < b.nId
|
||||
end
|
||||
table.sort(self.questList, sortFunc)
|
||||
local nFinishCount = self.MiningGameData:GetGroupQuestReceiveCount(nGroupId)
|
||||
self._mapNode.Quest_loop_sv:Init(#self.questList, self, self.OnRefreshQuestGrid)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_GroupProcess, string.format("%d/%d", nFinishCount, #self.questList))
|
||||
self._mapNode.imgGroupProcessBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (nFinishCount / #self.questList), self._mapNode.imgGroupProcessBarFill.anchoredPosition.y)
|
||||
local bHasFinish = false
|
||||
for _, questData in ipairs(self.questList) do
|
||||
if questData.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
bHasFinish = true
|
||||
break
|
||||
end
|
||||
end
|
||||
self._mapNode.btn_GetReward.gameObject:SetActive(bHasFinish)
|
||||
self._mapNode.btn_GetReward_None.gameObject:SetActive(not bHasFinish)
|
||||
end
|
||||
function MiningGameQuestCtrl:OnRefreshGroupGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local txtName = goGrid.transform:Find("btnGrid/AnimRoot/txt_Name")
|
||||
local config = ConfigTable.GetData("MiningQuestGroup", self.tbGroup[nIndex])
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(txtName:GetComponent("TMP_Text"), config.GroupName)
|
||||
local nFinishCount = self.MiningGameData:GetGroupQuestReceiveCount(self.tbGroup[nIndex])
|
||||
local nAllCount = 0
|
||||
for _, value in pairs(self.MiningGameData:GetQuestbyGroupId(self.tbGroup[nIndex])) do
|
||||
nAllCount = nAllCount + 1
|
||||
end
|
||||
local txtCount = goGrid.transform:Find("btnGrid/AnimRoot/txt_Process")
|
||||
NovaAPI.SetTMPText(txtCount:GetComponent("TMP_Text"), string.format("%d/%d", nFinishCount, nAllCount))
|
||||
local goSelected = goGrid.transform:Find("btnGrid/AnimRoot/img_selected")
|
||||
goSelected.gameObject:SetActive(self.tbGroup[nIndex] == self.nSelectedGroupId)
|
||||
if self.tbGroup[nIndex] == self.nSelectedGroupId then
|
||||
self.selectedGrid = goGrid
|
||||
end
|
||||
local reddot = goGrid.transform:Find("btnGrid/AnimRoot/reddot")
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Mining_QuestGroup, {
|
||||
self.tbGroup[nIndex]
|
||||
}, reddot, nil, nil, true)
|
||||
local go_Button = goGrid.transform:Find("btnGrid")
|
||||
local btn_Select = go_Button:GetComponent("UIButton")
|
||||
btn_Select.onClick:RemoveAllListeners()
|
||||
local nGroupId = self.tbGroup[nIndex]
|
||||
btn_Select.onClick:AddListener(function()
|
||||
if self.selectedGrid ~= nil then
|
||||
local oldGoSelected = self.selectedGrid.transform:Find("btnGrid/AnimRoot/img_selected")
|
||||
oldGoSelected.gameObject:SetActive(false)
|
||||
end
|
||||
self.nSelectedGroupId = nGroupId
|
||||
self.selectedGrid = goGrid
|
||||
goSelected.gameObject:SetActive(true)
|
||||
self:UpdateQuestList(self.nSelectedGroupId)
|
||||
end)
|
||||
end
|
||||
function MiningGameQuestCtrl:OnRefreshQuestGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.MiningQuestCellCtrl")
|
||||
if not self.tbQuestGridCtrl[nInstanceId] then
|
||||
self.tbQuestGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.Mining.MiningQuestCellCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
|
||||
self.tbQuestGridCtrl[nInstanceId]:SetData(self.nActId, self.questList[nIndex])
|
||||
end
|
||||
function MiningGameQuestCtrl:OnBtnClick_AllReceive()
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, nil)
|
||||
function MiningGameQuestCtrl:OnBtnClick_GetAllReward()
|
||||
self.MiningGameData:SendQuestReceive(0, self.nSelectedGroupId)
|
||||
end
|
||||
function MiningGameQuestCtrl:OnBtnClick_GetAllReward_None()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TowerDefense_Quest_ReceiveNone"))
|
||||
end
|
||||
function MiningGameQuestCtrl:OnBtnClick_Close()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self._mapNode.animator:Play("t_window_04_t_out")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
EventManager.Hit(EventId.ClosePanel, self._panel._nPanelId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function MiningGameQuestCtrl:OnEvent_QuestUpdate()
|
||||
self._mapNode.Group_loop_sv:Init(#self.tbGroup, self, self.OnRefreshGroupGrid)
|
||||
self:UpdateQuestList(self.nSelectedGroupId)
|
||||
end
|
||||
return MiningGameQuestCtrl
|
||||
|
||||
@@ -1,83 +1,75 @@
|
||||
local MiningQuestCellCtrl = class("MiningQuestCellCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local totalLength = 520
|
||||
local totalHeight = 37
|
||||
local barMinX = -505
|
||||
local barMaxX = 0
|
||||
MiningQuestCellCtrl._mapNodeConfig = {
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
btn_Receive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txt_Receive = {
|
||||
sComponentName = "TMP_Text",
|
||||
"Mining_Quest_Receive"
|
||||
},
|
||||
btn_JumpTo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
txt_JumoTo = {
|
||||
sComponentName = "TMP_Text",
|
||||
"Mining_Quest_Jump"
|
||||
},
|
||||
go_UnComplete = {},
|
||||
go_Received = {},
|
||||
go_ReceivedMask = {},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
rtReward = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
rtReward = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
TMPTitle = {sComponentName = "TMP_Text"},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetReward"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_Quest_Receive"
|
||||
},
|
||||
go_UnComplete = {
|
||||
sNodeName = "TMPUncomplete"
|
||||
},
|
||||
TMPUncomplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_Quest_UnComplete"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgCompleteMask = {},
|
||||
txt_process = {sComponentName = "TMP_Text"},
|
||||
imgBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
function MiningQuestCellCtrl:Init()
|
||||
end
|
||||
function MiningQuestCellCtrl:Awake(...)
|
||||
end
|
||||
function MiningQuestCellCtrl:OnDisable()
|
||||
end
|
||||
MiningQuestCellCtrl._mapEventConfig = {}
|
||||
MiningQuestCellCtrl._mapRedDotConfig = {}
|
||||
function MiningQuestCellCtrl:SetData(nActId, questData)
|
||||
self.nActId = nActId
|
||||
self.questData = questData
|
||||
self.tbConfig = ConfigTable.GetData("MiningQuestConfig", self.questData.nId)
|
||||
NovaAPI.SetText(self._mapNode.txtTitle, ConfigTable.GetUIText(self.tbConfig.QuestDes))
|
||||
end
|
||||
function MiningQuestCellCtrl:UpdateCellStatus()
|
||||
self._mapNode.btn_Receive:SetActive(false)
|
||||
self._mapNode.btn_JumpTo:SetActive(false)
|
||||
self._mapNode.go_UnComplete:SetActive(false)
|
||||
self._mapNode.go_Received:SetActive(false)
|
||||
self._mapNode.go_ReceivedMask:SetActive(false)
|
||||
if self.questData.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
self._mapNode.btn_Receive:SetActive(true)
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
|
||||
elseif self.questData.nStatus == AllEnum.ActQuestStatus.UnComplete then
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(self.questData.progress.Cur / self.questData.progress.Max * totalLength, totalHeight)
|
||||
if self.tbConfig.JumpTo ~= nil or next(self.tbConfig.JumpTo) ~= nil then
|
||||
self._mapNode.btn_JumpTo:SetActive(true)
|
||||
else
|
||||
self._mapNode.go_UnComplete:SetActive(true)
|
||||
end
|
||||
self.MiningGameData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
local config = ConfigTable.GetData("MiningQuest", self.questData.nId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTitle, config.QuestDes)
|
||||
if self.questData.nStatus == AllEnum.ActQuestStatus.Received then
|
||||
self._mapNode.imgBarFill.anchoredPosition = Vector2(barMaxX, self._mapNode.imgBarFill.anchoredPosition.y)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_process, questData.progress[1].Max .. "/" .. questData.progress[1].Max)
|
||||
else
|
||||
self._mapNode.go_Received:SetActive(true)
|
||||
self._mapNode.go_ReceivedMask:SetActive(true)
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
|
||||
self._mapNode.imgBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (math.min(questData.progress[1].Cur, questData.progress[1].Max) / questData.progress[1].Max), self._mapNode.imgBarFill.anchoredPosition.y)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_process, questData.progress[1].Cur .. "/" .. questData.progress[1].Max)
|
||||
end
|
||||
self._mapNode.imgComplete:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgCompleteMask:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.go_UnComplete:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.UnComplete)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(self.questData.nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.btnReward.gameObject:SetActive(true)
|
||||
self._mapNode.rtReward:SetItem(config.RewardId, nil, config.RewardQty, nil, self.questData.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
end
|
||||
function MiningQuestCellCtrl:OnBtnClick_Receive()
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, self.nQuestId, nil)
|
||||
end
|
||||
function MiningQuestCellCtrl:OnBtnClick_JumpTo()
|
||||
if nil ~= self.nJumpTo and 0 ~= self.nJumpTo then
|
||||
JumpUtil.JumpTo(self.nJumpTo)
|
||||
function MiningQuestCellCtrl:OnBtnClick_GetReward()
|
||||
if self.questData == nil then
|
||||
return
|
||||
end
|
||||
self.MiningGameData:SendQuestReceive(self.questData.nId, 0)
|
||||
end
|
||||
function MiningQuestCellCtrl:OnBtnClick_Reward(btn)
|
||||
if nil ~= self.rewardId then
|
||||
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
|
||||
function MiningQuestCellCtrl:OnBtnClick_Reward()
|
||||
local config = ConfigTable.GetData("MiningQuest", self.questData.nId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
if config.RewardId > 0 then
|
||||
UTILS.ClickItemGridWithTips(config.RewardId, self._mapNode.btnReward.transform, true, true, false)
|
||||
end
|
||||
end
|
||||
return MiningQuestCellCtrl
|
||||
|
||||
Reference in New Issue
Block a user