Initial version - 1.2.0.60

EN: 1.2.0.60
CN: 1.2.0.61
JP: 1.2.0.63
KR: 1.2.0.67
This commit is contained in:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -0,0 +1,215 @@
local DailyQuestCtrl = class("DailyQuestCtrl", BaseCtrl)
DailyQuestCtrl._mapNodeConfig = {
txtActValue = {sComponentName = "TMP_Text"},
imgActive = {sComponentName = "Image"},
rtImgActProgress = {
sNodeName = "imgActProgress",
sComponentName = "RectTransform"
},
rtActProgressFill = {
sComponentName = "RectTransform"
},
btnNodeItem = {
nCount = 5,
sComponentName = "UIButton",
callback = "OnBtnClick_NodeItem"
},
btnActReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_ActReceive"
},
txtBtnActReceive = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive_Btn_Text"
},
btnActReceiveGray = {sComponentName = "UIButton"},
txtBtnActReceiveGray = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive_Btn_Text"
},
txtActComplete = {
sComponentName = "TMP_Text",
sLanguageId = "Daily_Quest_All_Received"
},
dailyQuestLSV = {
sComponentName = "LoopScrollView"
},
btnFastReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_FastReceive"
},
txtBtnFastReceive = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Fast_Receive_Btn_Text"
},
btnFastReceiveGray = {
sComponentName = "UIButton",
callback = "OnBtnClick_FastReceiveGray"
},
txtBtnFastReceiveGray = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Fast_Receive_Btn_Text"
}
}
DailyQuestCtrl._mapEventConfig = {
ChooseDailyGridByQuestId = "OnEvent_ChooseDailyGridByQuestId"
}
DailyQuestCtrl._mapRedDotConfig = {}
local totalLength = 617
local totalNodeLength = 610
local totalHeight = 37
local actNodeItemHeight = -22.3
function DailyQuestCtrl:RefreshActivityNode()
NovaAPI.SetTMPText(self._mapNode.txtActValue, self.nActiveCount)
local bAllComplete = self.nActiveCount >= self.nTotalActiveCount
self.tbQuestActive = {}
local ForeachActivity = function(mapData)
table.insert(self.tbQuestActive, mapData)
end
ForEachTableLine(ConfigTable.Get("DailyQuestActive"), ForeachActivity)
table.sort(self.tbQuestActive, function(a, b)
return a.Active < b.Active
end)
local nMaxAct = self.tbQuestActive[#self.tbQuestActive].Active
self.tbCanReceiveAct = {}
for k, v in ipairs(self.tbQuestActive) do
if self._mapNode.btnNodeItem[k] ~= nil then
local node = self._mapNode.btnNodeItem[k]
local nPosX = math.min(k / #self.tbQuestActive * totalNodeLength, totalNodeLength)
node.transform:GetComponent("RectTransform").anchoredPosition = Vector2(nPosX, actNodeItemHeight)
node.gameObject:SetActive(true)
local txtNodeAct = node.transform:Find("AnimRoot/goNodeItem/txtNodeAct"):GetComponent("TMP_Text")
NovaAPI.SetTMPText(txtNodeAct, v.Active)
local anim = node.transform:Find("AnimRoot"):GetComponent("Animator")
local imgGift = node.transform:Find("AnimRoot/goNodeItem/imgGift")
local imgComplete = node.transform:Find("AnimRoot/goNodeItem/imgComplete")
local goParticle1 = node.transform:Find("AnimRoot/goNodeItem/UIParticle1")
local goParticle2 = node.transform:Find("AnimRoot/goNodeItem/UIParticle2")
local bReceived = PlayerData.Quest:CheckDailyActiveReceive(v.Id)
local bComplete = v.Active <= self.nActiveCount
imgGift.gameObject:SetActive(not bReceived)
imgComplete.gameObject:SetActive(bReceived)
goParticle1.gameObject:SetActive(not bReceived and bComplete)
goParticle2.gameObject:SetActive(not bReceived and bComplete)
if bComplete and not bReceived then
table.insert(self.tbCanReceiveAct, k)
end
if not bReceived and bComplete then
anim:Play("Quest_btnNodeComplete_loop", 0, 0)
else
anim:Play("Empty")
end
end
end
self._mapNode.btnActReceive.gameObject:SetActive(#self.tbCanReceiveAct > 0)
self._mapNode.txtActComplete.gameObject:SetActive(bAllComplete and not (#self.tbCanReceiveAct > 0))
self._mapNode.btnActReceiveGray.gameObject:SetActive(not bAllComplete and not (#self.tbCanReceiveAct > 0))
local nWidth = math.min(self.nActiveCount / nMaxAct * totalLength, totalLength)
self._mapNode.rtActProgressFill.sizeDelta = Vector2(nWidth, totalHeight)
end
function DailyQuestCtrl:Refresh(tbDailyQuest)
self.tbDailyQuest = tbDailyQuest
self.nActiveCount = 0
self.nTotalActiveCount = 0
for _, mapDailyQuest in ipairs(tbDailyQuest) do
local mapQuestData = ConfigTable.GetData("DailyQuest", mapDailyQuest.nTid)
if mapQuestData ~= nil then
if mapDailyQuest.nStatus == 2 then
self.nActiveCount = self.nActiveCount + mapQuestData.Active
end
self.nTotalActiveCount = self.nTotalActiveCount + mapQuestData.Active
end
end
local mapItemCfg = ConfigTable.GetData_Item(AllEnum.CoinItemId.DailyQuestActive)
if mapItemCfg ~= nil then
self:SetPngSprite(self._mapNode.imgActive, mapItemCfg.Icon)
end
self:RefreshActivityNode()
local bFastReceive = false
for _, mapData in ipairs(self.tbDailyQuest) do
if mapData.nStatus == 1 then
bFastReceive = true
break
end
end
self._mapNode.dailyQuestLSV.gameObject:SetActive(true)
self._mapNode.btnFastReceive.gameObject:SetActive(bFastReceive)
self._mapNode.btnFastReceiveGray.gameObject:SetActive(not bFastReceive)
self._mapNode.dailyQuestLSV:SetAnim(0.08)
self._mapNode.dailyQuestLSV:Init(#self.tbDailyQuest, self, self.OnGridQuestRefresh, nil, false)
end
function DailyQuestCtrl:OnGridQuestRefresh(goGrid, gridIndex)
if self.mapDailyGrid[goGrid] == nil then
self.mapDailyGrid[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.Quest.DailyQuest.DailyQuestGridCtrl")
end
local nIdx = gridIndex + 1
local mapQuest = self.tbDailyQuest[nIdx]
self.mapDailyGrid[goGrid]:Refresh(mapQuest.nTid, mapQuest.nStatus, mapQuest.nCurProgress, mapQuest.nGoal)
end
function DailyQuestCtrl:Awake()
self.mapDailyGrid = {}
end
function DailyQuestCtrl:OnEnable()
end
function DailyQuestCtrl:OnDisable()
for go, mapCtrl in ipairs(self.mapDailyGrid) do
self:UnbindCtrlByNode(mapCtrl)
end
self.mapDailyGrid = {}
end
function DailyQuestCtrl:OnDestroy()
end
function DailyQuestCtrl:OnBtnClick_ActReceive()
PlayerData.Quest:ReceiveDailyActiveReward()
end
function DailyQuestCtrl:OnBtnClick_FastReceive()
PlayerData.Quest:ReceiveDailyReward(0)
local tab = {}
table.insert(tab, {
"role_id",
tostring(PlayerData.Base._nPlayerId)
})
NovaAPI.UserEventUpload("daily_mission_complete", tab)
end
function DailyQuestCtrl:OnBtnClick_FastReceiveGray()
end
function DailyQuestCtrl:OnBtnClick_NodeItem(btn, nIndex)
local bCanReceive = false
for _, v in ipairs(self.tbCanReceiveAct) do
if v == nIndex then
bCanReceive = true
break
end
end
if #self.tbCanReceiveAct > 0 and bCanReceive then
PlayerData.Quest:ReceiveDailyActiveReward()
elseif self.tbQuestActive[nIndex] ~= nil then
local sTip = orderedFormat(ConfigTable.GetUIText("Daily_Quest_Reward_Tip"), self.tbQuestActive[nIndex].Active)
local tbItem = {}
for i = 1, 2 do
if self.tbQuestActive[nIndex]["ItemTid" .. i] ~= 0 then
table.insert(tbItem, {
nTid = self.tbQuestActive[nIndex]["ItemTid" .. i],
nCount = self.tbQuestActive[nIndex]["Number" .. i],
bFullShow = true
})
end
end
local msg = {
nType = AllEnum.MessageBox.Item,
sTitle = ConfigTable.GetUIText("Daily_Quest_Reward_Tip_Title"),
sContent = sTip,
tbItem = tbItem
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
end
function DailyQuestCtrl:OnEvent_ChooseDailyGridByQuestId(questId)
for i, v in pairs(self.mapDailyGrid) do
if v.nQuestId == questId then
EventManager.Hit("Guide_ChooseDailyGridObj", i.gameObject.name)
break
end
end
end
return DailyQuestCtrl
@@ -0,0 +1,100 @@
local DailyQuestGridCtrl = class("DailyQuestGridCtrl", BaseCtrl)
local totalLength = 517
local totalHeight = 37
local JumpUtil = require("Game.Common.Utils.JumpUtil")
DailyQuestGridCtrl._mapNodeConfig = {
imgDb = {nCount = 2},
btnGrid = {},
txtQuestDesc = {sComponentName = "TMP_Text"},
txtProgress = {sComponentName = "TMP_Text"},
rtProgressFill = {
sComponentName = "RectTransform"
},
btnReceive = {
sComponentName = "UIButton",
callback = "OnBtnClick_Receive"
},
txtBtnReceive = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_Receive"
},
btnJump = {
sComponentName = "UIButton",
callback = "OnBtnClick_JumpTo"
},
txtBtnJump = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_JumpTo_Text"
},
txtUnComplete = {
sComponentName = "TMP_Text",
sLanguageId = "Quest_undone"
},
imgReceived = {},
imgCompleteMask = {},
btnRewardItem = {
nCount = 2,
sComponentName = "UIButton",
callback = "OnBtnClick_RewardItem"
},
goRewardItem = {
nCount = 2,
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
}
}
DailyQuestGridCtrl._mapEventConfig = {}
function DailyQuestGridCtrl:OnEnable()
self._mapNode.btnGrid:SetActive(false)
local waitOpen = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.btnGrid:SetActive(true)
end
cs_coroutine.start(waitOpen)
end
function DailyQuestGridCtrl:Refresh(nQuestId, nState, nCur, nTotal, bAllComplete)
self.nQuestId = nQuestId
local mapQuest = ConfigTable.GetData("DailyQuest", nQuestId)
if mapQuest == nil then
return
end
NovaAPI.SetTMPText(self._mapNode.txtQuestDesc, mapQuest.Title)
if nState ~= 2 then
NovaAPI.SetTMPText(self._mapNode.txtProgress, string.format("%d/%d", nCur, nTotal))
else
NovaAPI.SetTMPText(self._mapNode.txtProgress, ConfigTable.GetUIText("Quest_Complete"))
end
self.mapQuest = mapQuest
self._mapNode.rtProgressFill.sizeDelta = Vector2(nCur / nTotal * totalLength, totalHeight)
self._mapNode.btnReceive.gameObject:SetActive(nState == 1 and not bAllComplete)
self._mapNode.btnJump.gameObject:SetActive(nState == 0 and 0 < mapQuest.JumpTo)
self._mapNode.txtUnComplete.gameObject:SetActive(nState == 0 and mapQuest.JumpTo == 0)
self._mapNode.imgReceived:SetActive(nState == 2)
self._mapNode.imgCompleteMask:SetActive(nState == 2)
local bApear = mapQuest.Apear
self._mapNode.imgDb[1].gameObject:SetActive(bApear)
self._mapNode.imgDb[2].gameObject:SetActive(not bApear)
self.tbRewardId = {
AllEnum.CoinItemId.DailyQuestActive,
mapQuest.ItemTid
}
self._mapNode.goRewardItem[1]:SetItem(AllEnum.CoinItemId.DailyQuestActive, nil, mapQuest.Active, nil, nil, nil, nil, true)
self._mapNode.goRewardItem[2]:SetItem(mapQuest.ItemTid, nil, mapQuest.ItemQty, nil, nil, nil, nil, true)
end
function DailyQuestGridCtrl:OnBtnClick_Receive()
PlayerData.Quest:ReceiveDailyReward(self.nQuestId)
end
function DailyQuestGridCtrl:OnBtnClick_JumpTo()
local nJumptoId = self.mapQuest.JumpTo
JumpUtil.JumpTo(nJumptoId)
end
function DailyQuestGridCtrl:OnBtnClick_RewardItem(btn, nIndex)
local nRewardId = self.tbRewardId[nIndex]
if nRewardId ~= nil then
local bShowDepot = true
if nRewardId == AllEnum.CoinItemId.DailyQuestActive then
bShowDepot = false
end
UTILS.ClickItemGridWithTips(nRewardId, btn.transform, true, bShowDepot, false)
end
end
return DailyQuestGridCtrl