Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
local ActivityTaskCtrl_01 = class("ActivityTaskCtrl_01", BaseCtrl)
|
||||
ActivityTaskCtrl_01._mapNodeConfig = {
|
||||
goTaskItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.ActivityTask.ActivityTaskItemCtrl_01"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
btnTask = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Task"
|
||||
},
|
||||
txtActivityTime = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Energy_Item_Permanent_Time"
|
||||
}
|
||||
}
|
||||
ActivityTaskCtrl_01._mapEventConfig = {}
|
||||
function ActivityTaskCtrl_01:RefreshTaskList()
|
||||
self.tbTaskList = {}
|
||||
self.tbRewardList = {}
|
||||
self.nGroupId = 0
|
||||
local tbTaskGroup, tbTaskList = self.actData:GetAllTaskList()
|
||||
for nGroupId, tbTask in pairs(tbTaskGroup) do
|
||||
self.nGroupId = nGroupId
|
||||
for _, nId in ipairs(tbTask) do
|
||||
local mapQuest = tbTaskList[nId]
|
||||
if mapQuest ~= nil then
|
||||
local mapData = {
|
||||
nId = nId,
|
||||
nStatus = mapQuest.nStatus,
|
||||
nExpire = mapQuest.nExpire,
|
||||
nCur = mapQuest.nCur,
|
||||
nMax = mapQuest.nMax
|
||||
}
|
||||
table.insert(self.tbTaskList, mapData)
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("ActivityTask", nId)
|
||||
if mapCfg ~= nil and mapCfg.Tid1 ~= 0 then
|
||||
table.insert(self.tbRewardList, mapCfg.Tid1)
|
||||
end
|
||||
end
|
||||
end
|
||||
table.sort(self.tbTaskList, function(a, b)
|
||||
return a.nId < b.nId
|
||||
end)
|
||||
for k, v in ipairs(self._mapNode.goTaskItem) do
|
||||
local mapQuestData = self.tbTaskList[k]
|
||||
v.gameObject:SetActive(mapQuestData ~= nil)
|
||||
if mapQuestData ~= nil then
|
||||
v:SetTaskItem(mapQuestData)
|
||||
if self._mapNode.btnItem[k] ~= nil then
|
||||
NovaAPI.SetRaycastTarget(self._mapNode.btnItem[k].gameObject, mapQuestData.nStatus ~= AllEnum.ActQuestStatus.Complete)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskCtrl_01:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshTaskList()
|
||||
end
|
||||
function ActivityTaskCtrl_01:ClearActivity()
|
||||
end
|
||||
function ActivityTaskCtrl_01:Awake()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnEnable()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnDisable()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnDestroy()
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnBtnClick_Detail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbRewardList[nIndex] ~= nil then
|
||||
UTILS.ClickItemGridWithTips(self.tbRewardList[nIndex], btn.gameObject.transform, true, true, false)
|
||||
end
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnBtnClick_Task(btn, nIndex)
|
||||
if self.tbTaskList ~= nil and self.tbTaskList[nIndex] ~= nil then
|
||||
local mapQuest = self.tbTaskList[nIndex]
|
||||
if mapQuest.nStatus == AllEnum.ActQuestStatus.Complete then
|
||||
local mapGroupCfg = ConfigTable.GetData("ActivityTaskGroup", self.nGroupId)
|
||||
if self.actData ~= nil and mapGroupCfg ~= nil then
|
||||
local callback = function()
|
||||
self:RefreshTaskList()
|
||||
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.actData:GetActId(), false)
|
||||
end
|
||||
self.actData:SendMsg_ActivityTaskRewardReceiveReq(self.nGroupId, mapQuest.nId, mapGroupCfg.TaskTabType, callback)
|
||||
end
|
||||
elseif mapQuest.nStatus == AllEnum.ActQuestStatus.UnComplete then
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityTaskCtrl_01:OnEvent_RefreshActivityTask()
|
||||
self:RefreshTaskList()
|
||||
end
|
||||
return ActivityTaskCtrl_01
|
||||
@@ -0,0 +1,45 @@
|
||||
local ActivityTaskItemCtrl_01 = class("ActivityTaskItemCtrl_01", BaseCtrl)
|
||||
ActivityTaskItemCtrl_01._mapNodeConfig = {
|
||||
imgCanReceiveBg = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtItemCount = {sComponentName = "TMP_Text"},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
goReceived = {},
|
||||
txtReceived = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Received"
|
||||
},
|
||||
imgReceived = {},
|
||||
imgCanReceive = {},
|
||||
txtCanReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Can_Receive"
|
||||
}
|
||||
}
|
||||
ActivityTaskItemCtrl_01._mapEventConfig = {}
|
||||
ActivityTaskItemCtrl_01._mapRedDotConfig = {}
|
||||
function ActivityTaskItemCtrl_01:SetTaskItem(mapQuest)
|
||||
local mapCfg = ConfigTable.GetData("ActivityTask", mapQuest.nId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
self.mapQuest = mapQuest
|
||||
local nTid = mapCfg.Tid1
|
||||
local nCount = mapCfg.Qty1
|
||||
if nTid ~= 0 then
|
||||
local itemCfg = ConfigTable.GetData_Item(nTid)
|
||||
if itemCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgIcon, itemCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, itemCfg.Title)
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemCount, orderedFormat(ConfigTable.GetUIText("LoginReward_Reward_Count"), nCount))
|
||||
local sDesc = orderedFormat(mapCfg.Desc, mapCfg.AimNumShow)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, sDesc)
|
||||
self._mapNode.imgCanReceiveBg.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.imgCanReceive.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.goReceived.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgReceived.gameObject:SetActive(mapQuest.nStatus == AllEnum.ActQuestStatus.Received)
|
||||
end
|
||||
return ActivityTaskItemCtrl_01
|
||||
@@ -0,0 +1,168 @@
|
||||
local InfinityTowerActCtrl = class("InfinityTowerActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local rabbitRightId = 917302
|
||||
local rabbitLeftId = 917402
|
||||
InfinityTowerActCtrl._mapNodeConfig = {
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
txtActDesc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Des"
|
||||
},
|
||||
txtActTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Tip"
|
||||
},
|
||||
btn_Go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtBtn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_TowerAllOpen_Go"
|
||||
},
|
||||
imgActTimeBg = {},
|
||||
trRoot_L = {
|
||||
sNodeName = "----Actor2DLeft302----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
trRoot_R = {
|
||||
sNodeName = "----Actor2DRight402----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
Actor2DLeft = {
|
||||
sNodeName = "rawImg_L_302",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
Actor2DPngL = {sNodeName = "png_L_302", sComponentName = "Transform"},
|
||||
Actor2DRight = {
|
||||
sNodeName = "rawImg_R_402",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
Actor2DPngR = {sNodeName = "png_R_402", sComponentName = "Transform"}
|
||||
}
|
||||
InfinityTowerActCtrl._mapEventConfig = {}
|
||||
function InfinityTowerActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self:StartActTimer()
|
||||
self.UseLive2D = LocalSettingData.mapData.UseLive2D
|
||||
self:LoadRabbit()
|
||||
end
|
||||
function InfinityTowerActCtrl:ClearActivity()
|
||||
end
|
||||
function InfinityTowerActCtrl:OnDisable()
|
||||
self:UnLoadRabbit()
|
||||
end
|
||||
function InfinityTowerActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function InfinityTowerActCtrl:StartActTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
local nStartTime = self.actData:GetActOpenTime()
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
self.isTimeVisible = self._mapNode.imgActTimeBg.gameObject.activeSelf
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local sTime = ""
|
||||
local IsTimeVisible = true
|
||||
local nRemainTime = 0
|
||||
if nCurTime >= nStartTime and nCurTime < nEndTime then
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
else
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
end
|
||||
if nRemainTime <= 0 then
|
||||
IsTimeVisible = false
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
end
|
||||
if self.isTimeVisible ~= IsTimeVisible then
|
||||
self._mapNode.imgActTimeBg.gameObject:SetActive(IsTimeVisible)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function InfinityTowerActCtrl:OnBtnClick_Detail()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCfg.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function InfinityTowerActCtrl:OnBtnClick_Go()
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nEndTime < nCurTime then
|
||||
return
|
||||
end
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.InfinityTowerSelectTower)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 8, func)
|
||||
end
|
||||
function InfinityTowerActCtrl:LoadRabbit()
|
||||
self._mapNode.Actor2DLeft.transform.localScale = self.UseLive2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.Actor2DRight.transform.localScale = self.UseLive2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.Actor2DPngL.localScale = self.UseLive2D == true and Vector3.zero or Vector3.one
|
||||
self._mapNode.Actor2DPngR.localScale = self.UseLive2D == true and Vector3.zero or Vector3.one
|
||||
if self.UseLive2D == true then
|
||||
Actor2DManager.SetBoardNPC2D(PanelId.ActivityInfinity, self._mapNode.Actor2DLeft, rabbitLeftId, nil, nil, 1)
|
||||
Actor2DManager.SetBoardNPC2D(PanelId.ActivityInfinity, self._mapNode.Actor2DRight, rabbitRightId, nil, nil, 2)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.Actor2DPngL, PanelId.ActivityInfinity, rabbitLeftId)
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.Actor2DPngR, PanelId.ActivityInfinity, rabbitRightId)
|
||||
end
|
||||
end
|
||||
function InfinityTowerActCtrl:UnLoadRabbit()
|
||||
Actor2DManager.UnsetBoardNPC2D(1)
|
||||
Actor2DManager.UnsetBoardNPC2D(2)
|
||||
end
|
||||
return InfinityTowerActCtrl
|
||||
@@ -0,0 +1,85 @@
|
||||
NewTutorialsActCtrl = class("NewTutorialsActCtrl", BaseCtrl)
|
||||
NewTutorialsActCtrl._mapNodeConfig = {
|
||||
btn_GoGuideQusetPanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoGuideQusetPanel"
|
||||
},
|
||||
txt_Title1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "QuestPanel_Tab_1"
|
||||
},
|
||||
txt_Plan1 = {sNodeName = "txt_Plan1", sComponentName = "TMP_Text"},
|
||||
txt_Complete1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Complete"
|
||||
},
|
||||
txtBtnGo1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
},
|
||||
btn_GoTutorialPanel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoTutorialPanel"
|
||||
},
|
||||
txt_Title2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "QuestPanel_Tab_4"
|
||||
},
|
||||
txt_Plan2 = {sNodeName = "txt_Plan2", sComponentName = "TMP_Text"},
|
||||
txt_Complete2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_Complete"
|
||||
},
|
||||
txtBtnGo2 = {
|
||||
sNodeName = "txtBtnGo2",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Quest_JumpTo"
|
||||
}
|
||||
}
|
||||
NewTutorialsActCtrl._mapEventConfig = {}
|
||||
function NewTutorialsActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.AdConfig = ConfigTable.GetData("AdControl", self.nActId)
|
||||
self:Init()
|
||||
end
|
||||
function NewTutorialsActCtrl:Init()
|
||||
self:RefreshGuideQuset()
|
||||
self:RefreshTutorial()
|
||||
end
|
||||
function NewTutorialsActCtrl:RefreshGuideQuset()
|
||||
local nReceivedCount = 0
|
||||
local nTotalCount = PlayerData.Quest:GetMaxTourGroupOrderIndex()
|
||||
local nCurTourGroupOrder = PlayerData.Quest:GetCurTourGroupOrder()
|
||||
if PlayerData.Quest:CheckTourGroupReward(nTotalCount) then
|
||||
self._mapNode.btn_GoGuideQusetPanel.gameObject:SetActive(false)
|
||||
self._mapNode.txt_Complete1.gameObject:SetActive(true)
|
||||
nReceivedCount = nTotalCount
|
||||
else
|
||||
nReceivedCount = nCurTourGroupOrder - 1
|
||||
end
|
||||
local sPanel = orderedFormat(ConfigTable.GetUIText("NewTutorialsAct_Complete") or "", nReceivedCount, nTotalCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Plan1, sPanel)
|
||||
end
|
||||
function NewTutorialsActCtrl:RefreshTutorial()
|
||||
local nTotalCount, nReceivedCount = PlayerData.TutorialData:GetProgress()
|
||||
local sPanel = orderedFormat(ConfigTable.GetUIText("NewTutorialsAct_Complete") or "", nReceivedCount, nTotalCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Plan2, sPanel)
|
||||
if nTotalCount == nReceivedCount then
|
||||
self._mapNode.btn_GoTutorialPanel.gameObject:SetActive(false)
|
||||
self._mapNode.txt_Complete2.gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
function NewTutorialsActCtrl:OnBtnClick_GoGuideQusetPanel()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Quest, AllEnum.QuestPanelTab.GuideQuest)
|
||||
end
|
||||
function NewTutorialsActCtrl:OnBtnClick_GoTutorialPanel()
|
||||
local bPlayCond = PlayerData.Base:CheckFunctionUnlock(GameEnum.OpenFuncType.TutorialLevel, true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Quest, AllEnum.QuestPanelTab.Tutorial)
|
||||
end
|
||||
function NewTutorialsActCtrl:ClearActivity()
|
||||
end
|
||||
return NewTutorialsActCtrl
|
||||
@@ -0,0 +1,119 @@
|
||||
local StoryCollectionActCtrl = class("StoryCollectionActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
StoryCollectionActCtrl._mapNodeConfig = {
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
btn_Go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
btn_Wait = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Wait"
|
||||
},
|
||||
txtBtn_GoRead = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ActivityAdv_StoryRead_Go"
|
||||
},
|
||||
txtBtn_Wait = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ActivityAdv_StoryRead_Wait"
|
||||
}
|
||||
}
|
||||
StoryCollectionActCtrl._mapEventConfig = {}
|
||||
function StoryCollectionActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.AdConfig = ConfigTable.GetData("AdControl", self.nActId)
|
||||
self:StartActTimer()
|
||||
end
|
||||
function StoryCollectionActCtrl:ClearActivity()
|
||||
end
|
||||
function StoryCollectionActCtrl:OnDisable()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
end
|
||||
self.timer = nil
|
||||
end
|
||||
function StoryCollectionActCtrl:StartActTimer()
|
||||
local startTime = self.AdConfig.StartTime
|
||||
local nStartTime = CS.ClientManager.Instance:ISO8601StrToTimeStamp(startTime)
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = 0
|
||||
local isOpen = false
|
||||
local sTime = ""
|
||||
if nCurTime < nStartTime then
|
||||
isOpen = false
|
||||
nRemainTime = math.max(nStartTime - nCurTime, 0)
|
||||
sTime = self:GetTimeStr(nRemainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, ConfigTable.GetUIText("ActivityAdv_StoryCountDown") .. sTime)
|
||||
elseif nCurTime >= nStartTime then
|
||||
isOpen = true
|
||||
local sStartTime = os.date("%Y/%m/%d", nStartTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sStartTime .. ConfigTable.GetUIText("ActivityAdv_StoryUpdate"))
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
end
|
||||
self._mapNode.btn_Go.gameObject:SetActive(isOpen)
|
||||
self._mapNode.btn_Wait.gameObject:SetActive(not isOpen)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function StoryCollectionActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function StoryCollectionActCtrl:OnBtnClick_Go()
|
||||
local nEndTime = self.actData:GetActCloseTime()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nEndTime < nCurTime then
|
||||
return
|
||||
end
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
local jumpToId = self.AdConfig.JumpTo[1]
|
||||
JumpUtil.JumpTo(jumpToId)
|
||||
end
|
||||
function StoryCollectionActCtrl:OnBtnClick_Wait()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("ActivityAdv_StoryWait_Tip"))
|
||||
end
|
||||
return StoryCollectionActCtrl
|
||||
@@ -0,0 +1,438 @@
|
||||
local BdConvertBuildCtrl = class("BdConvertBuildCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local newDayTime = UTILS.GetDayRefreshTimeOffset()
|
||||
BdConvertBuildCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
BuildListContent = {},
|
||||
BuildListContent_Empty = {},
|
||||
txt_empty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_BuildEmpty"
|
||||
},
|
||||
BuildList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btn_sort_time = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SortTime"
|
||||
},
|
||||
btn_sort_score = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SortScore"
|
||||
},
|
||||
img_icon = {
|
||||
sNodeName = "img_icon_detail",
|
||||
sComponentName = "Image"
|
||||
},
|
||||
txt_title = {sComponentName = "TMP_Text"},
|
||||
txt_reward = {sComponentName = "TMP_Text"},
|
||||
sv = {},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txt_SubmitTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_BuildTips"
|
||||
},
|
||||
txt_srot_timeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SortTime"
|
||||
},
|
||||
txt_srot_ScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "RoguelikeBuild_Manage_SortScore"
|
||||
},
|
||||
txt_Allselect = {sComponentName = "TMP_Text"},
|
||||
btn_submit = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Submit"
|
||||
},
|
||||
txt_submit = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Submit"
|
||||
},
|
||||
btn_submit_none = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Submit"
|
||||
},
|
||||
BdConvertFinishPanel = {
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertFinishCtrl"
|
||||
},
|
||||
bg_anim = {sNodeName = "----BG----", sComponentName = "Animator"},
|
||||
anim = {
|
||||
sNodeName = "SafeAreaRoot",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txt_detailTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_DesTips"
|
||||
}
|
||||
}
|
||||
BdConvertBuildCtrl._mapEventConfig = {
|
||||
BdConvert_ShowReward = "OnEvent_ShowReward",
|
||||
BdConvert_FinishPanelClose = "OnEvent_CloseReward",
|
||||
[EventId.UIBackConfirm] = "OnEvent_BackHome",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home"
|
||||
}
|
||||
BdConvertBuildCtrl._mapRedDotConfig = {}
|
||||
local SortType = {Time = 1, Score = 2}
|
||||
local SortOrder = {Descending = true, Ascending = false}
|
||||
local BtnTextColor = {
|
||||
[true] = Color(0.3288888888888889, 0.43555555555555553, 0.5422222222222223, 1),
|
||||
[false] = Color(0.7288888888888889, 0.8, 0.8711111111111111, 1)
|
||||
}
|
||||
function BdConvertBuildCtrl:Awake()
|
||||
self._mapNode.BdConvertFinishPanel.gameObject:SetActive(false)
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
self.nOptionId = param[2]
|
||||
end
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.nSortype = SortType.Score
|
||||
self.nSortOrder = SortOrder.Ascending
|
||||
self.tbSelected = {}
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEnable()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.6)
|
||||
self.tbItemIns = {}
|
||||
self.mapListItemCtrl = {}
|
||||
self:InitSort()
|
||||
self:InitData()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnDisable()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
if self.mapListItemCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.mapListItemCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildCtrl:InitData()
|
||||
self._tbAllBuild = self.actData:GetAllBuildByOpId(self.nOptionId)
|
||||
self.bdCfg = self.actData:GetBdConvertConfig()
|
||||
self.contentCfg = ConfigTable.GetData("BdConvertContent", self.nOptionId)
|
||||
self.data = self.actData:GetBdDataBy(self.nOptionId)
|
||||
if self.data == nil then
|
||||
return
|
||||
end
|
||||
if self.contentCfg.Icon ~= "" then
|
||||
self:SetPngSprite(self._mapNode.img_icon, self.contentCfg.Icon)
|
||||
end
|
||||
self.tbItem = {}
|
||||
local tbReward = decodeJson(self.contentCfg.BasicReward)
|
||||
local tbTemp = {}
|
||||
for key, value in pairs(tbReward) do
|
||||
tbTemp[tonumber(key)] = tonumber(value)
|
||||
end
|
||||
for _, rewardId in ipairs(self.contentCfg.BasicRewardPreview) do
|
||||
table.insert(self.tbItem, {
|
||||
itemId = rewardId,
|
||||
itemCount = tbTemp[rewardId]
|
||||
})
|
||||
end
|
||||
self._mapNode.svItem:Init(#self.tbItem, self, self.OnRewardItemGridRefresh, self.OnGridBtnClick)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_title, self.contentCfg.Des)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_reward, ConfigTable.GetUIText("BdConvert_RewardTitle") .. " " .. self.data.nCurSub .. "/" .. self.data.nMaxSub)
|
||||
local tbTarget = {}
|
||||
for i = 1, 5 do
|
||||
local target = self._mapNode.sv.transform:Find("Viewport/Content/target" .. i)
|
||||
target.gameObject:SetActive(false)
|
||||
table.insert(tbTarget, target)
|
||||
end
|
||||
for index, optionId in ipairs(self.contentCfg.ConvertConditionList) do
|
||||
local txt_target = tbTarget[index]:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local targetCfg = ConfigTable.GetData("BdConvertCondition", optionId)
|
||||
if targetCfg ~= nil then
|
||||
NovaAPI.SetTMPText(txt_target, targetCfg.RequestDes)
|
||||
tbTarget[index].gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.sv.transform:Find("Viewport/Content"):GetComponent("RectTransform"))
|
||||
self:RefreshList()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnTargetGridRefresh(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local txt_target = goGrid.transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local targetId = self.contentCfg.ConvertConditionList[nDataIndex]
|
||||
local targetCfg = ConfigTable.GetData("BdConvertCondition", targetId)
|
||||
if targetCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(txt_target, targetCfg.RequestDes)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnRewardItemGridRefresh(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
local goItem = goGrid.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local bGet = self.data.nCurSub == self.data.nMaxSub
|
||||
self.tbItemIns[instanceId]:SetItem(itemId, nil, self.tbItem[nDataIndex].itemCount, nil, bGet)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnGridBtnClick(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
UTILS.ClickItemGridWithTips(itemId, goGrid.transform:Find("btnGrid"), true, false, false)
|
||||
end
|
||||
function BdConvertBuildCtrl:InitSort()
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Score and self.nSortOrder == SortOrder.Descending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortype == SortType.Time and self.nSortOrder == SortOrder.Descending
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_AAA()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_AAA()
|
||||
end
|
||||
function BdConvertBuildCtrl:RefreshList()
|
||||
self._tbAllBuild = self.actData:GetAllBuildByOpId(self.nOptionId)
|
||||
if #self._tbAllBuild == 0 then
|
||||
self._mapNode.BuildListContent:SetActive(false)
|
||||
self._mapNode.BuildListContent_Empty:SetActive(true)
|
||||
self._mapNode.btn_submit_none.gameObject:SetActive(true)
|
||||
self._mapNode.btn_submit.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Empty, ConfigTable.GetUIText("RoguelikeBuild_Manage_EmptyList"))
|
||||
self:RerfeshSelected()
|
||||
return
|
||||
else
|
||||
self._mapNode.BuildListContent:SetActive(true)
|
||||
self._mapNode.btn_submit_none.gameObject:SetActive(false)
|
||||
self._mapNode.btn_submit.gameObject:SetActive(true)
|
||||
end
|
||||
self:SortBuildData()
|
||||
self._mapNode.BuildList:Init(#self._tbAllBuild, self, self.RefreshBuildGrid, self.OnBtnCal)
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
function BdConvertBuildCtrl:RefreshBuildGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self._tbAllBuild[nIndex]
|
||||
if self.mapListItemCtrl[goGrid] == nil then
|
||||
self.mapListItemCtrl[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.BdConvert._500001.BdConvertBuildItemCtrl")
|
||||
self.mapListItemCtrl[goGrid]:Init(self)
|
||||
end
|
||||
self.mapListItemCtrl[goGrid]:RefreshGrid(mapData)
|
||||
local index = table.indexof(self.tbSelected, mapData)
|
||||
if 0 < index then
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:RerfeshSelected()
|
||||
EventManager.Hit("BdConvert_BuildCancleSelect")
|
||||
for index, data in ipairs(self.tbSelected) do
|
||||
EventManager.Hit("BdConvert_BuildRefreshIndex", data, index)
|
||||
end
|
||||
local str = string.format("<color=#0abec5>%s</color>/%s", #self.tbSelected, self.data.nMaxSub - self.data.nCurSub)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_Allselect, ConfigTable.GetUIText("BdConvert_Selected") .. " " .. str)
|
||||
end
|
||||
function BdConvertBuildCtrl:ClearSelectedData()
|
||||
self.tbSelected = {}
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
function BdConvertBuildCtrl:SortBuildData()
|
||||
if self.nSortype == SortType.Time then
|
||||
local sortByTime = function(a, b)
|
||||
if self.nSortOrder == SortOrder.Descending then
|
||||
return a.nBuildId > b.nBuildId
|
||||
else
|
||||
return a.nBuildId < b.nBuildId
|
||||
end
|
||||
end
|
||||
table.sort(self._tbAllBuild, sortByTime)
|
||||
else
|
||||
local sortByScore = function(a, b)
|
||||
if self.nSortOrder == SortOrder.Descending then
|
||||
if a.nScore ~= b.nScore then
|
||||
return a.nScore > b.nScore
|
||||
else
|
||||
return a.nBuildId > b.nBuildId
|
||||
end
|
||||
elseif a.nScore ~= b.nScore then
|
||||
return a.nScore < b.nScore
|
||||
else
|
||||
return a.nBuildId > b.nBuildId
|
||||
end
|
||||
end
|
||||
table.sort(self._tbAllBuild, sortByScore)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_SortTime(btn)
|
||||
if self.nSortype == SortType.Time then
|
||||
self.nSortOrder = not self.nSortOrder
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
|
||||
else
|
||||
self.nSortype = SortType.Time
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_SortScore(btn)
|
||||
if self.nSortype == SortType.Score then
|
||||
self.nSortOrder = not self.nSortOrder
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Ascending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = self.nSortOrder == SortOrder.Descending
|
||||
else
|
||||
self.nSortype = SortType.Score
|
||||
self.nSortOrder = SortOrder.Descending
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_score.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = true
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_AsceIcon"):GetComponent("Button").interactable = false
|
||||
self._mapNode.btn_sort_time.transform:Find("AnimRoot/btn_DescIcon"):GetComponent("Button").interactable = false
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_timeTitle, BtnTextColor[self.nSortype == SortType.Time])
|
||||
NovaAPI.SetTMPColor(self._mapNode.txt_srot_ScoreTitle, BtnTextColor[self.nSortype == SortType.Score])
|
||||
end
|
||||
self:RefreshList()
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClickGrid(nIdx, itemCtrl)
|
||||
local mapBuild = self._tbAllBuild[nIdx]
|
||||
if mapBuild.bLock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BdConvert_LockTips"))
|
||||
return
|
||||
end
|
||||
local index = table.indexof(self.tbSelected, itemCtrl._mapData)
|
||||
if index ~= nil and 0 < index then
|
||||
table.remove(self.tbSelected, index)
|
||||
self:RerfeshSelected()
|
||||
return
|
||||
end
|
||||
if #self.tbSelected >= self.data.nMaxSub - self.data.nCurSub then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BdConvert_SelectedMaxTips"))
|
||||
return
|
||||
end
|
||||
table.insert(self.tbSelected, mapBuild)
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
function BdConvertBuildCtrl:OpenBuildDes(nIdx, itemCtrl)
|
||||
local mapBuild = self._tbAllBuild[nIdx]
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertBuildDetail, mapBuild, self.actData)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBuildGridLock(nIdx, itemCtrl)
|
||||
local mapBuild = self._tbAllBuild[nIdx]
|
||||
local callback = function()
|
||||
itemCtrl:SetLockState(mapBuild.bLock)
|
||||
self:RerfeshSelected()
|
||||
end
|
||||
self.actData:ChangeBuildLock(mapBuild.nBuildId, not mapBuild.bLock, callback)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnBtnClick_Submit()
|
||||
if #self.tbSelected == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("BdConvert_SubmitNoneTips"))
|
||||
return
|
||||
end
|
||||
local bHasHighLevelBuild = false
|
||||
for _, mapBuild in ipairs(self.tbSelected) do
|
||||
if mapBuild.mapRank.Level >= self.contentCfg.DoubleCheckMinLevel then
|
||||
bHasHighLevelBuild = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local tbBuildId = {}
|
||||
for _, buildData in ipairs(self.tbSelected) do
|
||||
table.insert(tbBuildId, buildData.nBuildId)
|
||||
end
|
||||
if bHasHighLevelBuild then
|
||||
local TipsTime = LocalData.GetPlayerLocalData("BdConvert_BuildTips_Time")
|
||||
local _tipDay = 0
|
||||
if TipsTime ~= nil then
|
||||
_tipDay = tonumber(TipsTime)
|
||||
end
|
||||
local curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local fixedTimeStamp = curTimeStamp + newDayTime * 3600
|
||||
local nYear = tonumber(os.date("!%Y", fixedTimeStamp))
|
||||
local nMonth = tonumber(os.date("!%m", fixedTimeStamp))
|
||||
local nDay = tonumber(os.date("!%d", fixedTimeStamp))
|
||||
local nowD = nYear * 366 + nMonth * 31 + nDay
|
||||
if nowD == _tipDay then
|
||||
self.actData:RequestSubmitBuild(self.nOptionId, tbBuildId)
|
||||
self:ClearSelectedData()
|
||||
else
|
||||
local isSelectAgain = false
|
||||
local confirmCallback = function()
|
||||
if isSelectAgain then
|
||||
local _curTimeStamp = CS.ClientManager.Instance.serverTimeStampWithTimeZone
|
||||
local _fixedTimeStamp = _curTimeStamp + newDayTime * 3600
|
||||
local _nYear = tonumber(os.date("!%Y", _fixedTimeStamp))
|
||||
local _nMonth = tonumber(os.date("!%m", _fixedTimeStamp))
|
||||
local _nDay = tonumber(os.date("!%d", _fixedTimeStamp))
|
||||
local _nowD = _nYear * 366 + _nMonth * 31 + _nDay
|
||||
LocalData.SetPlayerLocalData("BdConvert_BuildTips_Time", tostring(_nowD))
|
||||
end
|
||||
self:ClearSelectedData()
|
||||
self.actData:RequestSubmitBuild(self.nOptionId, tbBuildId)
|
||||
end
|
||||
local againCallback = function(isSelect)
|
||||
isSelectAgain = isSelect
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("BdConvert_CheckTips"),
|
||||
callbackConfirmAfterClose = confirmCallback,
|
||||
callbackAgain = againCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
else
|
||||
self.actData:RequestSubmitBuild(self.nOptionId, tbBuildId)
|
||||
self:ClearSelectedData()
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_ShowReward(tbItem, icon)
|
||||
if tbItem == nil or #tbItem == 0 then
|
||||
return
|
||||
end
|
||||
local tbItemData = {}
|
||||
for _, itemData in ipairs(tbItem) do
|
||||
table.insert(tbItemData, {
|
||||
id = itemData.Tid,
|
||||
count = itemData.Qty
|
||||
})
|
||||
end
|
||||
local callback = function()
|
||||
self:InitData()
|
||||
if self.data.nCurSub == self.data.nMaxSub then
|
||||
self:OnEvent_BackHome(PanelId.BdConvertBuildPanel)
|
||||
end
|
||||
end
|
||||
self._mapNode.BdConvertFinishPanel.gameObject:SetActive(true)
|
||||
self._mapNode.BdConvertFinishPanel:ShowReward(tbItemData, icon, callback)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_CloseReward()
|
||||
self._mapNode.BdConvertFinishPanel.gameObject:SetActive(false)
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_BackHome(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertBuildPanel then
|
||||
self._mapNode.anim:Play("BdConvertBuildPanel_out")
|
||||
self._mapNode.bg_anim:Play("BdConvertBuildPanel_Bg_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BdConvertBuildPanel)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildCtrl:OnEvent_Home(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertBuildPanel then
|
||||
PanelManager.Home()
|
||||
end
|
||||
end
|
||||
return BdConvertBuildCtrl
|
||||
@@ -0,0 +1,98 @@
|
||||
local BdConvertBuildDetailCtrl = class("BdConvertBuildDetailCtrl", BaseCtrl)
|
||||
BdConvertBuildDetailCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
TMPBuildSaveTime = {sComponentName = "TMP_Text"},
|
||||
btnRename = {},
|
||||
btn_Preference = {},
|
||||
txtBuildLock = {sComponentName = "TMP_Text"},
|
||||
btn_Lock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
btn_LockIcon = {sComponentName = "Button"},
|
||||
btnDelete = {},
|
||||
ani_root = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
BuildDetail = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildDetailItemCtrl"
|
||||
},
|
||||
ContentList = {
|
||||
sCtrlName = "Game.UI.StarTower.Build.StarTowerBuildContentCtrl"
|
||||
}
|
||||
}
|
||||
BdConvertBuildDetailCtrl._mapEventConfig = {}
|
||||
function BdConvertBuildDetailCtrl:InitPanel()
|
||||
self._mapNode.btnRename:SetActive(false)
|
||||
self._mapNode.btn_Preference:SetActive(false)
|
||||
self._mapNode.btnDelete:SetActive(false)
|
||||
if not self.mapBuild.bDetail then
|
||||
print("build数据错误 无详细数据")
|
||||
return
|
||||
end
|
||||
self._mapNode.BuildDetail:Refresh(self.mapBuild)
|
||||
self._mapNode.ContentList:Refresh(self.mapBuild)
|
||||
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPBuildSaveTime, string.format("<color=#5e89b4>保存时间:</color>%s", os.date("%Y/%m/%d %H:%M", math.floor(self.mapBuild.nBuildId / 1.0E9))))
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OpenConfirmHint()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:Awake()
|
||||
self.tbCoinRate = ConfigTable.GetConfigArray("StarTowerBuildTransformParas")
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.mapBuild = tbParam[1]
|
||||
self.actData = tbParam[2]
|
||||
end
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnEnable()
|
||||
self:InitPanel()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnDisable()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnRelease()
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_Preference(btn)
|
||||
local tbPreferenceCheckIn = {}
|
||||
local tbPreferenceCheckOut = {}
|
||||
local callback = function()
|
||||
self._mapNode.btn_PreferenceIcon.interactable = self.mapBuild.bPreference
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLike, self.mapBuild.bPreference and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
if self.mapBuild.bPreference then
|
||||
table.insert(tbPreferenceCheckOut, self.mapBuild.nBuildId)
|
||||
else
|
||||
table.insert(tbPreferenceCheckIn, self.mapBuild.nBuildId)
|
||||
end
|
||||
PlayerData.Build:SetBuildPreference(tbPreferenceCheckIn, tbPreferenceCheckOut, callback)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_Lock(btn)
|
||||
local callback = function()
|
||||
self._mapNode.btn_LockIcon.interactable = self.mapBuild.bLock
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildLock, self.mapBuild.bLock and ConfigTable.GetUIText("RoguelikeBuild_Save_Lock") or ConfigTable.GetUIText("RoguelikeBuild_Save_Unlock"))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtBuildLock, self.mapBuild.bLock and Color(0.14901960784313725, 0.25882352941176473, 0.47058823529411764) or Color(0.5803921568627451, 0.6666666666666666, 0.7529411764705882))
|
||||
end
|
||||
self.actData:ChangeBuildLock(self.mapBuild.nBuildId, not self.mapBuild.bLock, callback)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_DeleteBuild(btn)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_Rename(btn)
|
||||
end
|
||||
function BdConvertBuildDetailCtrl:OnBtnClick_CharInfo(btn, nIndex)
|
||||
local nCharTid = self.mapBuild.tbChar[nIndex].nTid
|
||||
local tbChar = {
|
||||
self.mapBuild.tbChar[1].nTid,
|
||||
self.mapBuild.tbChar[2].nTid,
|
||||
self.mapBuild.tbChar[3].nTid
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgPanel, PanelId.CharInfo, nCharTid, tbChar)
|
||||
end
|
||||
return BdConvertBuildDetailCtrl
|
||||
@@ -0,0 +1,19 @@
|
||||
local BdConvertBuildDetailPanel = class("BdConvertBuildDetailPanel", BasePanel)
|
||||
BdConvertBuildDetailPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertBuildDetailPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertBuildDetailPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertBuildDetailCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertBuildDetailPanel:Awake()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnEnable()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnDisable()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildDetailPanel:OnRelease()
|
||||
end
|
||||
return BdConvertBuildDetailPanel
|
||||
@@ -0,0 +1,165 @@
|
||||
local BdConvertBuildItemCtrl = class("BdConvertBuildItemCtrl", BaseCtrl)
|
||||
local PanelState = {
|
||||
Normal = 1,
|
||||
Delete = 2,
|
||||
Preference = 3
|
||||
}
|
||||
BdConvertBuildItemCtrl._mapNodeConfig = {
|
||||
img_SelectPreference = {},
|
||||
btn_LockIcon = {sComponentName = "Button"},
|
||||
btn_grid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Grid"
|
||||
},
|
||||
btn_Lock = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Lock"
|
||||
},
|
||||
imgRareFrame = {sComponentName = "Image"},
|
||||
imgRareScore = {sComponentName = "Image"},
|
||||
txtBuildName = {sComponentName = "TMP_Text"},
|
||||
imgLike = {},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Sub"
|
||||
},
|
||||
imgCharIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgCharFrame = {nCount = 3, sComponentName = "Image"},
|
||||
txtPotentialCount = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgCharElement = {nCount = 3, sComponentName = "Image"},
|
||||
txtChar = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_Char_Title"
|
||||
},
|
||||
txtDisc = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Build_MainDisc_Title"
|
||||
},
|
||||
goDiscItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.StarTower.Build.BuildSimpleDiscItem"
|
||||
},
|
||||
objUnavailable = {},
|
||||
objUnavailableIcon = {sComponentName = "Image"},
|
||||
imgRareScoreMask = {sComponentName = "Image"},
|
||||
texUnavailable = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Build_NotAvailable"
|
||||
},
|
||||
imgUnavailable = {},
|
||||
imgBuildUsed = {},
|
||||
txtBuildUsed = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Used"
|
||||
},
|
||||
imgCharUsed = {},
|
||||
txtCharUsed = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Char_Used"
|
||||
},
|
||||
selectedIndex = {},
|
||||
txt_select_index = {sComponentName = "TMP_Text"},
|
||||
txt_select = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Selected"
|
||||
}
|
||||
}
|
||||
BdConvertBuildItemCtrl._mapEventConfig = {
|
||||
BdConvert_BuildRefreshIndex = "RefreshIndex",
|
||||
BdConvert_BuildCancleSelect = "CancleSelected"
|
||||
}
|
||||
function BdConvertBuildItemCtrl:RefreshGrid(mapData)
|
||||
self._mapData = mapData
|
||||
self:RefreshInfo()
|
||||
self:RefreshChar()
|
||||
self:RefreshDisc()
|
||||
self:CancleSelected()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshInfo()
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. self._mapData.mapRank.Id
|
||||
local sFrame = AllEnum.FrameType_New.BuildRankDB .. AllEnum.FrameColor_New[self._mapData.mapRank.Rarity]
|
||||
self:SetPngSprite(self._mapNode.imgRareScore, sScore)
|
||||
self:SetAtlasSprite(self._mapNode.imgRareFrame, "12_rare", sFrame)
|
||||
if self._mapData.sName == "" or self._mapData.sName == nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, ConfigTable.GetUIText("RoguelikeBuild_EmptyBuildName"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildName, self._mapData.sName)
|
||||
end
|
||||
self._mapNode.imgLike:SetActive(self._mapData.bPreference)
|
||||
self._mapNode.btn_LockIcon.interactable = self._mapData.bLock
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshChar()
|
||||
for i = 1, 3 do
|
||||
local nCharTid = self._mapData.tbChar[i].nTid
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(nCharTid)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(nCharTid)
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgCharIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharFrame[i], "12_rare", sFrame)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPotentialCount[i], self._mapData.tbChar[i].nPotentialCount)
|
||||
self:SetAtlasSprite(self._mapNode.imgCharElement[i], "12_rare", AllEnum.Char_Element[mapCharCfg.EET].icon)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshDisc()
|
||||
local tbDisc = self._mapData.tbDisc
|
||||
local nIndex = 1
|
||||
for _, nId in ipairs(tbDisc) do
|
||||
if nil ~= self._mapNode.goDiscItem[nIndex] and nIndex <= 3 then
|
||||
self._mapNode.goDiscItem[nIndex]:Init(nId)
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
function BdConvertBuildItemCtrl:RefreshIndex(mapData, nIndex)
|
||||
if mapData ~= self._mapData then
|
||||
return
|
||||
end
|
||||
self:Selected(nIndex)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:Init(parentCtrl)
|
||||
self._parentCtrl = parentCtrl
|
||||
end
|
||||
function BdConvertBuildItemCtrl:SetLockState(bLock)
|
||||
self._mapNode.btn_LockIcon.interactable = bLock
|
||||
end
|
||||
function BdConvertBuildItemCtrl:CancleSelected()
|
||||
self._mapNode.img_SelectPreference:SetActive(false)
|
||||
self._mapNode.selectedIndex:SetActive(false)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:Selected(nIndex)
|
||||
self._mapNode.img_SelectPreference:SetActive(true)
|
||||
self._mapNode.selectedIndex:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_select_index, nIndex)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:Awake()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnEnable()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnDisable()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnRelease()
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnBtnClick_Grid(btn)
|
||||
if btn.Operate_Type == 0 then
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBtnClickGrid(nIndex, self)
|
||||
elseif btn.Operate_Type == 2 then
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OpenBuildDes(nIndex, self)
|
||||
end
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnBtnClick_Lock(btn)
|
||||
local nIndex = tonumber(self.gameObject.name) + 1
|
||||
self._parentCtrl:OnBuildGridLock(nIndex, self)
|
||||
end
|
||||
function BdConvertBuildItemCtrl:OnBtnClick_Preference(btn)
|
||||
end
|
||||
return BdConvertBuildItemCtrl
|
||||
@@ -0,0 +1,24 @@
|
||||
local BdConvertBuildPanel = class("BdConvertBuildPanel", BasePanel)
|
||||
BdConvertBuildPanel._bIsMainPanel = true
|
||||
BdConvertBuildPanel._bAddToBackHistory = true
|
||||
BdConvertBuildPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
BdConvertBuildPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertBuildPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertBuildPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertBuildCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertBuildPanel:Awake()
|
||||
end
|
||||
function BdConvertBuildPanel:OnEnable()
|
||||
end
|
||||
function BdConvertBuildPanel:OnAfterEnter()
|
||||
end
|
||||
function BdConvertBuildPanel:OnDisable()
|
||||
end
|
||||
function BdConvertBuildPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertBuildPanel:OnRelease()
|
||||
end
|
||||
return BdConvertBuildPanel
|
||||
@@ -0,0 +1,167 @@
|
||||
local BdConvertCellCtrl = class("BdConvertCellCtrl", BaseCtrl)
|
||||
local minHeight = 85.26
|
||||
BdConvertCellCtrl._mapNodeConfig = {
|
||||
bg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
img_unOpen = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_unOpenTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_UnopenTips"
|
||||
},
|
||||
txt_unOpen = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Unopen"
|
||||
},
|
||||
txt_finishTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Finish"
|
||||
},
|
||||
icon = {sComponentName = "Image"},
|
||||
txt_title = {sComponentName = "TMP_Text"},
|
||||
bg_reward = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_reward = {sComponentName = "TMP_Text"},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
icon_com = {},
|
||||
img_finish = {},
|
||||
btnGrid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
btnGrid_None = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_JumpTo"
|
||||
},
|
||||
txt_btn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_ToBuild"
|
||||
},
|
||||
txt_tip = {sComponentName = "TMP_Text"},
|
||||
icon_star = {},
|
||||
Content = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
target = {nCount = 3}
|
||||
}
|
||||
function BdConvertCellCtrl:Awake()
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
function BdConvertCellCtrl:OnDisable()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
function BdConvertCellCtrl:SetData(actId, optionId)
|
||||
self.nActId = actId
|
||||
self.nOptionId = optionId
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.contentData = self.actData:GetBdDataBy(self.nOptionId)
|
||||
local contentCfg = ConfigTable.GetData("BdConvertContent", self.nOptionId)
|
||||
if contentCfg == nil then
|
||||
return
|
||||
end
|
||||
local data = self.actData:GetBdDataBy(optionId)
|
||||
if data == nil then
|
||||
return
|
||||
end
|
||||
self._mapNode.img_unOpen.gameObject:SetActive(data.bIsOpen == false)
|
||||
if contentCfg.Icon ~= "" then
|
||||
self:SetPngSprite(self._mapNode.icon, contentCfg.Icon)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_title, contentCfg.Des)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_reward, ConfigTable.GetUIText("BdConvert_RewardTitle") .. " " .. data.nCurSub .. "/" .. data.nMaxSub)
|
||||
self.tbItem = {}
|
||||
local tbReward = decodeJson(contentCfg.BasicReward)
|
||||
local tbTemp = {}
|
||||
for key, value in pairs(tbReward) do
|
||||
tbTemp[tonumber(key)] = tonumber(value)
|
||||
end
|
||||
for _, rewardId in ipairs(contentCfg.BasicRewardPreview) do
|
||||
table.insert(self.tbItem, {
|
||||
itemId = rewardId,
|
||||
itemCount = tbTemp[rewardId]
|
||||
})
|
||||
end
|
||||
self._mapNode.svItem:Init(#self.tbItem, self, self.OnRewardItemGridRefresh, self.OnGridBtnClick)
|
||||
self._mapNode.icon_com:SetActive(data.nCurSub == data.nMaxSub)
|
||||
self._mapNode.img_finish:SetActive(data.nCurSub == data.nMaxSub)
|
||||
self._mapNode.icon_star:SetActive(data.nCurSub ~= data.nMaxSub)
|
||||
self._mapNode.txt_unOpen.gameObject:SetActive(data.bIsOpen == false)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.target[i].gameObject:SetActive(false)
|
||||
end
|
||||
for index, optionId in ipairs(contentCfg.ConvertConditionList) do
|
||||
if index <= 3 then
|
||||
local txt_target = self._mapNode.target[index].transform:Find("txt_target"):GetComponent("TMP_Text")
|
||||
local targetCfg = ConfigTable.GetData("BdConvertCondition", optionId)
|
||||
if targetCfg ~= nil then
|
||||
NovaAPI.SetTMPText(txt_target, targetCfg.RequestDes)
|
||||
self._mapNode.target[index].gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
local nCount = 0
|
||||
local tbAllbuild = self.actData:GetAllBuildByOpId(self.nOptionId)
|
||||
if tbAllbuild ~= nil then
|
||||
nCount = #tbAllbuild
|
||||
end
|
||||
self._mapNode.btnGrid_None.gameObject:SetActive(nCount == 0)
|
||||
self._mapNode.btnGrid.gameObject:SetActive(nCount ~= 0)
|
||||
if nCount == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_tip, ConfigTable.GetUIText("BdConvert_BuildCountTips1"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_tip, orderedFormat(ConfigTable.GetUIText("BdConvert_BuildCountTips2"), nCount))
|
||||
end
|
||||
local bGet = self.contentData.nCurSub == self.contentData.nMaxSub
|
||||
if bGet then
|
||||
self._mapNode.btnGrid_None.gameObject:SetActive(false)
|
||||
self._mapNode.btnGrid.gameObject:SetActive(false)
|
||||
self._mapNode.txt_tip.gameObject:SetActive(false)
|
||||
self._mapNode.txt_finishTips.gameObject:SetActive(true)
|
||||
else
|
||||
self._mapNode.txt_finishTips.gameObject:SetActive(false)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.bg_reward)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.Content)
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
local curHeight = self._mapNode.Content.sizeDelta.y
|
||||
local rectTransform = self.gameObject:GetComponent("RectTransform")
|
||||
rectTransform.sizeDelta = Vector2(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y + curHeight - minHeight)
|
||||
self._mapNode.bg.sizeDelta = Vector2(self._mapNode.bg.sizeDelta.x, self._mapNode.bg.sizeDelta.y + curHeight - minHeight)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.bg)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function BdConvertCellCtrl:OnRewardItemGridRefresh(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
local goItem = goGrid.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local bGet = self.contentData.nCurSub == self.contentData.nMaxSub
|
||||
self.tbItemIns[instanceId]:SetItem(itemId, nil, self.tbItem[nDataIndex].itemCount, nil, bGet)
|
||||
end
|
||||
function BdConvertCellCtrl:OnGridBtnClick(goGrid, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbItem[nDataIndex].itemId
|
||||
UTILS.ClickItemGridWithTips(itemId, goGrid.transform:Find("btnGrid").transform, true, true, false)
|
||||
end
|
||||
function BdConvertCellCtrl:OnBtnClick_JumpTo()
|
||||
EventManager.Hit("BdConvert_JumpToBuildPanel", self.nOptionId)
|
||||
end
|
||||
return BdConvertCellCtrl
|
||||
@@ -0,0 +1,223 @@
|
||||
local BdConvertCtrl = class("BdConvertCtrl", BaseCtrl)
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local barMinX = -378
|
||||
local barMaxX = 0
|
||||
BdConvertCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
Actor2D = {
|
||||
sNodeName = "----Actor2D----"
|
||||
},
|
||||
btn_starTower = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GoStarTower"
|
||||
},
|
||||
anim = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
bg_anim = {sNodeName = "----BG----", sComponentName = "Animator"},
|
||||
imgBgLevelSelect = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
cell = {},
|
||||
ListContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
ListCanvasGroup = {
|
||||
sNodeName = "ListContent",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txt_starTower = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_GoToStarTower"
|
||||
}
|
||||
}
|
||||
BdConvertCtrl._mapEventConfig = {
|
||||
BdConvertQuestUpdate = "InitQuest",
|
||||
BdConvert_JumpToBuildPanel = "OnEvent_JumpTo",
|
||||
[EventId.UIBackConfirm] = "OnEvent_BackHome",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_Home"
|
||||
}
|
||||
BdConvertCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_BdConvert_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function BdConvertCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.bInAnim_In = false
|
||||
end
|
||||
function BdConvertCtrl:OnEnable()
|
||||
if self._panel.bPlayedAnim_In then
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.anim:Play("BdConVertPanel_in_02")
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_out_02")
|
||||
self.bInAnim_In = true
|
||||
self:AddTimer(1, 0.7, function()
|
||||
self.bInAnim_In = false
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end, true, true, true)
|
||||
else
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self._mapNode.anim:Play("BdConVertPanel_in_01")
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_in_01")
|
||||
self.bInAnim_In = true
|
||||
self:AddTimer(1, 0.67, function()
|
||||
self.bInAnim_In = false
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end, true, true, true)
|
||||
end
|
||||
self._panel.bPlayedAnim_In = true
|
||||
local bUseL2D = LocalSettingData.mapData.UseLive2D
|
||||
self._mapNode.imgBgLevelSelect.transform.localScale = bUseL2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.trActor2D_PNG.localScale = bUseL2D == true and Vector3.zero or Vector3.one
|
||||
if bUseL2D == true then
|
||||
Actor2DManager.SetBoardNPC2D(self:GetPanelId(), self._mapNode.imgBgLevelSelect, 9102)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, self:GetPanelId(), 9102)
|
||||
end
|
||||
local bResult = self.actData:CheckBuildsData()
|
||||
if bResult then
|
||||
self:UpdateOptionList()
|
||||
else
|
||||
EventManager.Hit(EventId.BlockInput, true)
|
||||
self.actData:RequestAllBuildData(function()
|
||||
if not self.bInAnim_In then
|
||||
EventManager.Hit(EventId.BlockInput, false)
|
||||
end
|
||||
self:UpdateOptionList()
|
||||
end)
|
||||
end
|
||||
self:InitQuest()
|
||||
end
|
||||
function BdConvertCtrl:OnDisable()
|
||||
Actor2DManager.UnsetBoardNPC2D()
|
||||
if self.GridIns ~= nil then
|
||||
for _, ctrl in pairs(self.GridIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.GridIns = {}
|
||||
if self.tbListCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbListCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbListCtrl = {}
|
||||
end
|
||||
function BdConvertCtrl:UpdateOptionList()
|
||||
self.bdConfig = self.actData:GetBdConvertConfig()
|
||||
self.optionList = self.bdConfig.OptionList
|
||||
local sort = function(a, b)
|
||||
local contentA_Data = self.actData:GetBdDataBy(a)
|
||||
local contentB_Data = self.actData:GetBdDataBy(b)
|
||||
local bFinish_A = contentA_Data.nCurSub == contentA_Data.nMaxSub
|
||||
local bFinish_B = contentB_Data.nCurSub == contentB_Data.nMaxSub
|
||||
if bFinish_A and not bFinish_B then
|
||||
return false
|
||||
elseif not bFinish_A and bFinish_B then
|
||||
return true
|
||||
end
|
||||
return a < b
|
||||
end
|
||||
table.sort(self.optionList, sort)
|
||||
self.tbGridSize = {}
|
||||
for _, optionId in ipairs(self.optionList) do
|
||||
local contentCfg = ConfigTable.GetData("BdConvertContent", optionId)
|
||||
if contentCfg ~= nil then
|
||||
local height = 0
|
||||
if #contentCfg.ConvertConditionList >= 3 then
|
||||
height = 360
|
||||
else
|
||||
height = 310
|
||||
end
|
||||
table.insert(self.tbGridSize, height)
|
||||
end
|
||||
end
|
||||
delChildren(self._mapNode.ListContent.gameObject)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.ListCanvasGroup, 0)
|
||||
if self.tbListCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbListCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbListCtrl = {}
|
||||
self.GridIns = {}
|
||||
for _, opId in ipairs(self.optionList) do
|
||||
local go = instantiate(self._mapNode.cell, self._mapNode.ListContent)
|
||||
local ctrl = self:BindCtrlByNode(go, "Game.UI.Activity.BdConvert._500001.BdConvertCellCtrl")
|
||||
ctrl:SetData(self.nActId, opId)
|
||||
table.insert(self.tbListCtrl, ctrl)
|
||||
go:SetActive(true)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.ListCanvasGroup, 1)
|
||||
CS.UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.ListContent)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function BdConvertCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function BdConvertCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertQuestPanel, self.nActId)
|
||||
end
|
||||
function BdConvertCtrl:OnBtnClick_GoStarTower()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.LevelMenu, 2)
|
||||
end
|
||||
function BdConvertCtrl:OnEvent_JumpTo(nOptionId)
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_in_02")
|
||||
self._mapNode.anim:Play("BdConVertPanel_out_01")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.17)
|
||||
self:AddTimer(1, 0.17, function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertBuildPanel, self.nActId, nOptionId)
|
||||
end, true, true, true)
|
||||
end
|
||||
function BdConvertCtrl:OnEvent_BackHome(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertPanel then
|
||||
self._mapNode.anim:Play("BdConVertPanel_out_02")
|
||||
self._mapNode.bg_anim:Play("BdConvertPanel_Bg_out_01")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.23)
|
||||
self:AddTimer(1, 0.23, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BdConvertPanel)
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function BdConvertCtrl:OnEvent_Home(nPanelId)
|
||||
if nPanelId == PanelId.BdConvertPanel then
|
||||
PanelManager.Home()
|
||||
end
|
||||
end
|
||||
return BdConvertCtrl
|
||||
@@ -0,0 +1,144 @@
|
||||
local BdConvertFinishCtrl = class("BdConvertFinishCtrl", BaseCtrl)
|
||||
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
BdConvertFinishCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_black"
|
||||
},
|
||||
btn_close = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
HideRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
aniRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnSkip = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Skip"
|
||||
},
|
||||
btnGrid = {},
|
||||
img_icon = {sComponentName = "Image"},
|
||||
txt_tips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_RewardTips"
|
||||
},
|
||||
goItemList1 = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
BdConvertFinishCtrl._mapEventConfig = {}
|
||||
BdConvertFinishCtrl._mapRedDotConfig = {}
|
||||
function BdConvertFinishCtrl:RefreshNormal()
|
||||
for _, v in ipairs(self.tbReward) do
|
||||
local nItemId = v.id
|
||||
local goItem = instantiate(self._mapNode.btnGrid, self._mapNode.goItemList1)
|
||||
local ctrlObj = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
local mapCfg = ConfigTable.GetData_Item(nItemId)
|
||||
if mapCfg then
|
||||
if mapCfg.Type == GameEnum.itemType.Char or mapCfg.Type == GameEnum.itemType.CharacterSkin then
|
||||
ctrlObj:SetChar(nItemId, v.count, nil, v.rewardType)
|
||||
else
|
||||
ctrlObj:SetItem(nItemId, mapCfg.Rarity, v.count, nil, nil, v.rewardType and v.rewardType == AllEnum.RewardType.First, v.rewardType and v.rewardType == AllEnum.RewardType.Three, true, false, false, v.rewardType and v.rewardType == AllEnum.RewardType.Extra)
|
||||
end
|
||||
end
|
||||
local btnGrid = goItem:GetComponent("UIButton")
|
||||
btnGrid.onClick:RemoveAllListeners()
|
||||
local cbSelect = function()
|
||||
self:OnSelectItem(nItemId, btnGrid, v.nHasCount)
|
||||
EventManager.Hit("Stop_InfinityTowerAutoNextLv")
|
||||
end
|
||||
btnGrid.onClick:AddListener(cbSelect)
|
||||
goItem.gameObject:SetActive(true)
|
||||
NovaAPI.SetCanvasGroupAlpha(goItem:GetComponent("CanvasGroup"), 0)
|
||||
end
|
||||
self:PlayNormalAni()
|
||||
end
|
||||
function BdConvertFinishCtrl:OnSelectItem(itemId, btn, nHasCount)
|
||||
UTILS.ClickItemGridWithTips(itemId, btn.transform, false, true, false, nHasCount)
|
||||
end
|
||||
function BdConvertFinishCtrl:PlayNormalAni()
|
||||
self.sequence = DOTween.Sequence()
|
||||
self.sequence:AppendInterval(0.18)
|
||||
for i = 1, self.nRewardCount do
|
||||
self.sequence:AppendCallback(function()
|
||||
local goGrid = self._mapNode.goItemList1:GetChild(i - 1)
|
||||
if goGrid then
|
||||
NovaAPI.SetCanvasGroupAlpha(goGrid:GetComponent("CanvasGroup"), 1)
|
||||
local ani = goGrid.transform:Find("AnimRoot/aniGrid"):GetComponent("Animator")
|
||||
ani:Play("receiveprops_icon_t_in")
|
||||
end
|
||||
end)
|
||||
self.sequence:AppendInterval(0.14)
|
||||
end
|
||||
self.sequence.onComplete = dotween_callback_handler(self, function()
|
||||
self:CloseSkip()
|
||||
end)
|
||||
self.sequence:SetUpdate(true)
|
||||
end
|
||||
function BdConvertFinishCtrl:ShowReward(tbReward, sIconPath, callback)
|
||||
self.tbReward = tbReward
|
||||
self.nRewardCount = #tbReward
|
||||
self.callback = callback
|
||||
local sort = function(a, b)
|
||||
local cfgA = ConfigTable.GetData_Item(a.id)
|
||||
local cfgB = ConfigTable.GetData_Item(b.id)
|
||||
local rarityA = cfgA.Rarity
|
||||
local rarityB = cfgB.Rarity
|
||||
local typeA = cfgA.Type
|
||||
local typeB = cfgB.Type
|
||||
if a.rewardType ~= nil ~= (b.rewardType ~= nil) then
|
||||
return a.rewardType ~= nil and b.rewardType == nil
|
||||
elseif a.rewardType and b.rewardType and a.rewardType ~= b.rewardType then
|
||||
return a.rewardType < b.rewardType
|
||||
elseif rarityA ~= rarityB then
|
||||
return rarityA < rarityB
|
||||
elseif typeA ~= typeB then
|
||||
return typeA < typeB
|
||||
elseif a.count ~= b.count then
|
||||
return a.count > b.count
|
||||
else
|
||||
return a.id < b.id
|
||||
end
|
||||
end
|
||||
table.sort(self.tbReward, sort)
|
||||
self:RefreshNormal()
|
||||
self:SetPngSprite(self._mapNode.img_icon:GetComponent("Image"), sIconPath)
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.HideRoot:SetActive(true)
|
||||
self._mapNode.aniRoot:Play("receiveprops_t_in")
|
||||
WwiseAudioMgr:PlaySound("ui_roguelike_gacha_reward")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
end
|
||||
function BdConvertFinishCtrl:CloseSkip()
|
||||
self._mapNode.btnSkip.gameObject:SetActive(false)
|
||||
self._mapNode.btn_close.interactable = true
|
||||
end
|
||||
function BdConvertFinishCtrl:OnBtnClick_Close()
|
||||
delChildren(self._mapNode.goItemList1)
|
||||
EventManager.Hit("BdConvert_FinishPanelClose")
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
function BdConvertFinishCtrl:OnBtnClick_Skip(btn)
|
||||
if self.sequence then
|
||||
self.sequence:Kill()
|
||||
self.sequence = nil
|
||||
end
|
||||
for i = 1, self.nRewardCount do
|
||||
local goGrid = self._mapNode.goItemList1:GetChild(i - 1)
|
||||
if goGrid then
|
||||
NovaAPI.SetCanvasGroupAlpha(goGrid:GetComponent("CanvasGroup"), 1)
|
||||
end
|
||||
end
|
||||
self:CloseSkip()
|
||||
end
|
||||
return BdConvertFinishCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local BdConvertPanel = class("BdConvertPanel", BasePanel)
|
||||
BdConvertPanel._bIsMainPanel = true
|
||||
BdConvertPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
BdConvertPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertPanel:Awake()
|
||||
end
|
||||
function BdConvertPanel:OnEnable()
|
||||
end
|
||||
function BdConvertPanel:OnAfterEnter()
|
||||
end
|
||||
function BdConvertPanel:OnDisable()
|
||||
end
|
||||
function BdConvertPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertPanel:OnRelease()
|
||||
end
|
||||
return BdConvertPanel
|
||||
@@ -0,0 +1,143 @@
|
||||
local BdConvertQuestCtrl = class("BdConvertQuestCtrl", BaseCtrl)
|
||||
local barMinX = -750
|
||||
local barMaxX = 0
|
||||
BdConvertQuestCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
animator = {sNodeName = "quest", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_QuestTitle"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnFullClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txt_socreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_Score"
|
||||
},
|
||||
txt_score = {sComponentName = "TMP_Text"},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btn_GetAllReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetAllReward"
|
||||
},
|
||||
btn_GetAllReward_None = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GetAllReward"
|
||||
},
|
||||
txt_GetAll = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_GetQuestReward"
|
||||
}
|
||||
}
|
||||
BdConvertQuestCtrl._mapEventConfig = {}
|
||||
BdConvertQuestCtrl._mapRedDotConfig = {}
|
||||
function BdConvertQuestCtrl:Awake()
|
||||
local param = self:GetPanelParam()
|
||||
if type(param) == "table" then
|
||||
self.nActId = param[1]
|
||||
end
|
||||
self:InitData()
|
||||
end
|
||||
function BdConvertQuestCtrl:OnEnable()
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
self._mapNode.animator:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnDestory()
|
||||
if self.tbItemCtrl ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemCtrl) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BdConvertQuestCtrl:InitData()
|
||||
self.tbItemCtrl = {}
|
||||
self.actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
self.bdConfig = self.actData:GetBdConvertConfig()
|
||||
self:InitQuest()
|
||||
self:UpdateScore()
|
||||
local bHasComQuest = self.actData:CheckHasComQuest()
|
||||
self._mapNode.btn_GetAllReward.gameObject:SetActive(bHasComQuest)
|
||||
self._mapNode.btn_GetAllReward_None.gameObject:SetActive(not bHasComQuest)
|
||||
end
|
||||
function BdConvertQuestCtrl:InitQuest()
|
||||
self.questIdList = self.actData:GetQuestIdList()
|
||||
self._mapNode.sv:Init(#self.questIdList, self, self.OnGridRefresh)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local instanceId = goGrid:GetInstanceID()
|
||||
local nId = self.questIdList[nIndex]
|
||||
local questData = self.actData:GetQuestDataById(nId)
|
||||
local img_Received = goGrid.transform:Find("GameObject/AnimRoot/Root/img_Received")
|
||||
local btn_item = goGrid.transform:Find("GameObject/AnimRoot/Root/btn_item"):GetComponent("UIButton")
|
||||
local item = goGrid.transform:Find("GameObject/AnimRoot/Root/btn_item/AnimRoot/item")
|
||||
if self.tbItemCtrl[instanceId] == nil then
|
||||
self.tbItemCtrl[instanceId] = self:BindCtrlByNode(item, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
local txtTarget = goGrid.transform:Find("GameObject/AnimRoot/Root/txt_target"):GetComponent("TMP_Text")
|
||||
local txt_com1 = goGrid.transform:Find("GameObject/AnimRoot/txt_com1"):GetComponent("TMP_Text")
|
||||
local txt_com2 = goGrid.transform:Find("GameObject/AnimRoot/txt_com2"):GetComponent("TMP_Text")
|
||||
local bar = goGrid.transform:Find("GameObject/AnimRoot/Root/imgBarBg/rtBarFill/imgMainBarFill"):GetComponent("RectTransform")
|
||||
local img_state1 = goGrid.transform:Find("GameObject/AnimRoot/Root/img_state1").gameObject
|
||||
local img_state2 = goGrid.transform:Find("GameObject/AnimRoot/Root/img_state2").gameObject
|
||||
local img_state3 = goGrid.transform:Find("GameObject/AnimRoot/Root/img_state3").gameObject
|
||||
img_state1:SetActive(questData.nState == AllEnum.ActQuestStatus.Complete)
|
||||
img_state2:SetActive(questData.nState == AllEnum.ActQuestStatus.Received)
|
||||
img_state3:SetActive(questData.nState == AllEnum.ActQuestStatus.UnComplete)
|
||||
img_Received.gameObject:SetActive(questData.nState == AllEnum.ActQuestStatus.Received)
|
||||
btn_item.onClick:RemoveAllListeners()
|
||||
local questConfig = ConfigTable.GetData("BdConvertRewardGroup", questData.nId)
|
||||
local tbReward = decodeJson(questConfig.Rewards)
|
||||
local itemId = 0
|
||||
local itemCount = 0
|
||||
for k, v in pairs(tbReward) do
|
||||
itemId = tonumber(k)
|
||||
itemCount = tonumber(v)
|
||||
end
|
||||
btn_item.onClick:AddListener(function()
|
||||
UTILS.ClickItemGridWithTips(itemId, btn_item.transform, true, false, false)
|
||||
end)
|
||||
self.tbItemCtrl[instanceId]:SetItem(itemId, nil, itemCount, false, questData.nState == AllEnum.ActQuestStatus.Received, false, false)
|
||||
NovaAPI.SetTMPText(txtTarget, questConfig.Des)
|
||||
if questData.nState == AllEnum.ActQuestStatus.UnComplete then
|
||||
NovaAPI.SetTMPText(txt_com1, tostring(questData.nCur) .. "/" .. tostring(questData.nMax))
|
||||
NovaAPI.SetTMPText(txt_com2, tostring(questData.nCur) .. "/" .. tostring(questData.nMax))
|
||||
else
|
||||
NovaAPI.SetTMPText(txt_com1, ConfigTable.GetUIText("BdConvert_QuestFinish"))
|
||||
NovaAPI.SetTMPText(txt_com2, ConfigTable.GetUIText("BdConvert_QuestFinish"))
|
||||
end
|
||||
txt_com1.gameObject:SetActive(questData.nState ~= AllEnum.ActQuestStatus.Received)
|
||||
txt_com2.gameObject:SetActive(questData.nState == AllEnum.ActQuestStatus.Received)
|
||||
bar.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (questData.nCur / questData.nMax), bar.anchoredPosition.y)
|
||||
end
|
||||
function BdConvertQuestCtrl:UpdateScore()
|
||||
local nCurScore = self.actData:GetScore()
|
||||
local nMaxScore = self.bdConfig.ScoreItemLimit
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_score, string.format("<color=#D19C62>%s</color>/%s", nCurScore, nMaxScore))
|
||||
end
|
||||
function BdConvertQuestCtrl:OnBtnClick_Close()
|
||||
self._mapNode.animator:Play("t_window_04_t_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
self:AddTimer(1, 0.3, function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BdConvertQuestPanel)
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
function BdConvertQuestCtrl:OnBtnClick_GetAllReward()
|
||||
local callback = function()
|
||||
self:InitData()
|
||||
end
|
||||
self.actData:RequestReceiveQuest(callback)
|
||||
end
|
||||
return BdConvertQuestCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local BdConvertQuestPanel = class("BdConvertQuestPanel", BasePanel)
|
||||
BdConvertQuestPanel._bIsMainPanel = false
|
||||
BdConvertQuestPanel._sSortingLayerName = AllEnum.SortingLayerName.UI
|
||||
BdConvertQuestPanel._sUIResRootPath = "UI_Activity/"
|
||||
BdConvertQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "_500001/BdConvertQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.BdConvert._500001.BdConvertQuestCtrl"
|
||||
}
|
||||
}
|
||||
function BdConvertQuestPanel:Awake()
|
||||
end
|
||||
function BdConvertQuestPanel:OnEnable()
|
||||
end
|
||||
function BdConvertQuestPanel:OnAfterEnter()
|
||||
end
|
||||
function BdConvertQuestPanel:OnDisable()
|
||||
end
|
||||
function BdConvertQuestPanel:OnDestroy()
|
||||
end
|
||||
function BdConvertQuestPanel:OnRelease()
|
||||
end
|
||||
return BdConvertQuestPanel
|
||||
@@ -0,0 +1,182 @@
|
||||
local BdConvertActCtrl = class("BdConvertActCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local LocalSettingData = require("GameCore.Data.LocalSettingData")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local barMinX = -378
|
||||
local barMaxX = 0
|
||||
BdConvertActCtrl._mapNodeConfig = {
|
||||
txt_time = {sComponentName = "TMP_Text"},
|
||||
txt_des = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_DesTitle"
|
||||
},
|
||||
btn_des = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_go = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_EnterActivity"
|
||||
},
|
||||
btn_go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
txtRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "BdConvert_RewardPre"
|
||||
},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
imgBgLevelSelect = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
trActor2D_PNG = {
|
||||
sNodeName = "----Actor2D_PNG----",
|
||||
sComponentName = "Transform"
|
||||
}
|
||||
}
|
||||
BdConvertActCtrl._mapEventConfig = {BdConvertQuestUpdate = "InitQuest"}
|
||||
BdConvertActCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_BdConvert_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function BdConvertActCtrl:RefreshRemainTime()
|
||||
if self.actData.actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.txt_time.transform.parent.gameObject:SetActive(false)
|
||||
else
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
end
|
||||
local sTimeStr = self:GetTimeText(remainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_time, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
|
||||
end
|
||||
end
|
||||
function BdConvertActCtrl:GetTimeText(remainTime)
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function BdConvertActCtrl:InitItem()
|
||||
local rewardData = ConfigTable.GetData("BdConvertControl", self.nActId)
|
||||
if rewardData == nil then
|
||||
return
|
||||
end
|
||||
self.tbReward = rewardData.RewardsShow
|
||||
self.tbItemIns = {}
|
||||
self._mapNode.svItem:Init(#self.tbReward, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
end
|
||||
function BdConvertActCtrl:OnGridRefresh(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
local goItem = go.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
local instanceId = goItem:GetInstanceID()
|
||||
if self.tbItemIns[instanceId] == nil then
|
||||
self.tbItemIns[instanceId] = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
end
|
||||
self.tbItemIns[instanceId]:SetItem(itemId)
|
||||
end
|
||||
function BdConvertActCtrl:OnGridBtnClick(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemId = self.tbReward[nDataIndex]
|
||||
UTILS.ClickItemGridWithTips(itemId, go.transform:Find("btnGrid"), true, false, false)
|
||||
end
|
||||
function BdConvertActCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function BdConvertActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
self:InitItem()
|
||||
self:InitQuest()
|
||||
local bUseL2D = LocalSettingData.mapData.UseLive2D
|
||||
self._mapNode.imgBgLevelSelect.transform.localScale = bUseL2D == true and Vector3.one or Vector3.zero
|
||||
self._mapNode.trActor2D_PNG.localScale = bUseL2D == true and Vector3.zero or Vector3.one
|
||||
if bUseL2D == true then
|
||||
Actor2DManager.SetBoardNPC2D(PanelId.BdConvertActPanel, self._mapNode.imgBgLevelSelect, 9102)
|
||||
else
|
||||
Actor2DManager.SetBoardNPC2D_PNG(self._mapNode.trActor2D_PNG, PanelId.BdConvertActPanel, 9102)
|
||||
end
|
||||
end
|
||||
function BdConvertActCtrl:ClearActivity()
|
||||
Actor2DManager.UnsetBoardNPC2D()
|
||||
if self.tbItemIns ~= nil then
|
||||
for _, ctrl in pairs(self.tbItemIns) do
|
||||
self:UnbindCtrlByNode(ctrl)
|
||||
end
|
||||
end
|
||||
self.tbItemIns = {}
|
||||
end
|
||||
function BdConvertActCtrl:OnBtnClick_Detail()
|
||||
local config = ConfigTable.GetData("BdConvertControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = config.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
})
|
||||
end
|
||||
function BdConvertActCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertQuestPanel, self.nActId)
|
||||
end
|
||||
function BdConvertActCtrl:OnBtnClick_Go()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
self.actData:RequestAllBuildData(function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BdConvertPanel, self.nActId)
|
||||
end)
|
||||
end
|
||||
return BdConvertActCtrl
|
||||
@@ -0,0 +1,140 @@
|
||||
local CookieActCtrl = class("CookieActCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
CookieActCtrl._mapNodeConfig = {
|
||||
btnEnter = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Enter"
|
||||
},
|
||||
txtBtnEnter = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Settings_Btn_Go"
|
||||
},
|
||||
btnActDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ActDetail"
|
||||
},
|
||||
txtBtnActDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
txtLabelPreview = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Daily_Quest_Reward_Tip_Title"
|
||||
},
|
||||
txtRemainTime = {sComponentName = "TMP_Text"},
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
svItem = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
function CookieActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshTimeout()
|
||||
self.mapActCtrl = ConfigTable.GetData("CookieControl", self.actData:GetActId())
|
||||
if self.mapActCtrl ~= nil then
|
||||
local rewardData = self.mapActCtrl.RewardsShow
|
||||
local tbReward = decodeJson(rewardData)
|
||||
self.tbPreviewItem = tbReward
|
||||
end
|
||||
self._mapNode.svItem:Init(#self.tbPreviewItem, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
local nStartTime = self.actData:GetActOpenTime() or 0
|
||||
local nEndTime = self.actData:GetActEndTime() or 0
|
||||
local sStartTime = os.date("%m.%d", nStartTime)
|
||||
local sEndTime = os.date("%m.%d", nEndTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sStartTime .. " - " .. sEndTime)
|
||||
end
|
||||
function CookieActCtrl:OnGridRefresh(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemData = self.tbPreviewItem[nDataIndex]
|
||||
if itemData == nil then
|
||||
return
|
||||
end
|
||||
local goItem = go.transform:Find("btnGrid/AnimRoot/tcItem").gameObject
|
||||
if goItem == nil then
|
||||
return
|
||||
end
|
||||
local itemCtrl = self:BindCtrlByNode(goItem, "Game.UI.TemplateEx.TemplateItemCtrl")
|
||||
if itemCtrl ~= nil then
|
||||
itemCtrl:SetItem(itemData)
|
||||
end
|
||||
end
|
||||
function CookieActCtrl:OnGridBtnClick(go, nIndex)
|
||||
local nDataIndex = nIndex + 1
|
||||
local itemData = self.tbPreviewItem[nDataIndex]
|
||||
if itemData == nil then
|
||||
return
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(itemData[1], go.transform, true, false, false)
|
||||
end
|
||||
function CookieActCtrl:UnInit()
|
||||
end
|
||||
function CookieActCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRemainTime, sTimeStr)
|
||||
end
|
||||
function CookieActCtrl:OnBtnClick_Enter(...)
|
||||
local nRandom = math.random(28, 29)
|
||||
local nActId = self.actData:GetActId()
|
||||
local func = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CookieGamePanel, nActId)
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, nRandom, func)
|
||||
end
|
||||
function CookieActCtrl:OnBtnClick_ActDetail(...)
|
||||
if self.mapActCtrl == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCtrl.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function CookieActCtrl:ClearActivity()
|
||||
end
|
||||
return CookieActCtrl
|
||||
@@ -0,0 +1,46 @@
|
||||
local JointDrillActCtrl_01 = class("JointDrillActCtrl_01", BaseCtrl)
|
||||
JointDrillActCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
JointDrillActCtrl_01._mapEventConfig = {
|
||||
PlayJointDrillActAnim = "OnEvent_PlayAnim"
|
||||
}
|
||||
function JointDrillActCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl_01:InitActData(actData)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.JointDrill.JointDrillActCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData)
|
||||
end
|
||||
function JointDrillActCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function JointDrillActCtrl_01:OnEvent_PlayAnim(sAnim, callback)
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {sAnim})
|
||||
self.animRoot:Play(sAnim, 0, 0)
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end, true, true, true)
|
||||
elseif callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl_01:OnEnable()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function JointDrillActCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
return JointDrillActCtrl_01
|
||||
@@ -0,0 +1,149 @@
|
||||
local JointDrillActCtrl = class("JointDrillActCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillActCtrl._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnWaitStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnEvent_WaitStart"
|
||||
},
|
||||
txtBtnWaitStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Act_Wait_Start"
|
||||
},
|
||||
imgBtnMask = {},
|
||||
btnStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtBtnStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Act_Goto"
|
||||
},
|
||||
txtActDesc = {sComponentName = "TMP_Text"},
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
txtFuncLock = {sComponentName = "TMP_Text"},
|
||||
txtBeta = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Beta_Tip"
|
||||
}
|
||||
}
|
||||
JointDrillActCtrl._mapEventConfig = {}
|
||||
function JointDrillActCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.mapActCfg = self.actData:GetJointDrillActCfg()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActDesc, self.mapActCfg.DescText)
|
||||
self:StartActTimer()
|
||||
local bPlayCond, sTips = self.actData:CheckActJumpCond()
|
||||
self._mapNode.txtFuncLock.gameObject:SetActive(not bPlayCond)
|
||||
if not bPlayCond then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFuncLock, sTips)
|
||||
end
|
||||
end
|
||||
function JointDrillActCtrl:GetTimeStr(nRemainTime)
|
||||
local sTimeStr = ""
|
||||
if nRemainTime <= 60 then
|
||||
local sec = math.floor(nRemainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < nRemainTime and nRemainTime <= 3600 then
|
||||
local min = math.floor(nRemainTime / 60)
|
||||
local sec = math.floor(nRemainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < nRemainTime and nRemainTime <= 86400 then
|
||||
local hour = math.floor(nRemainTime / 3600)
|
||||
local min = math.floor((nRemainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < nRemainTime then
|
||||
local day = math.floor(nRemainTime / 86400)
|
||||
local hour = math.floor((nRemainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function JointDrillActCtrl:StartActTimer()
|
||||
if self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
local nOpenTime = self.actData:GetActOpenTime()
|
||||
local nCloseTime = self.actData:GetActCloseTime()
|
||||
local nStartTime = nOpenTime + self.mapActCfg.DrillStartTime
|
||||
local nEndTime = nStartTime + self.mapActCfg.DrillDurationTime
|
||||
local nStatus = 0
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local sTime = ""
|
||||
local nRemainTime = 0
|
||||
if nCurTime < nStartTime then
|
||||
nStatus = AllEnum.JointDrillActStatus.WaitStart
|
||||
nRemainTime = math.max(nStartTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Time"), self:GetTimeStr(nRemainTime))
|
||||
elseif nCurTime >= nStartTime and nCurTime < nEndTime then
|
||||
nStatus = AllEnum.JointDrillActStatus.Start
|
||||
nRemainTime = math.max(nEndTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Start_Time"), self:GetTimeStr(nRemainTime))
|
||||
else
|
||||
nStatus = AllEnum.JointDrillActStatus.WaitClose
|
||||
nRemainTime = math.max(nCloseTime - nCurTime, 0)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Act_Wait_Close_Time"), self:GetTimeStr(nRemainTime))
|
||||
end
|
||||
if nRemainTime <= 0 and self.timer ~= nil then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
self._mapNode.btnStart.gameObject:SetActive(nStatus ~= AllEnum.JointDrillActStatus.WaitStart)
|
||||
self._mapNode.btnWaitStart.gameObject:SetActive(nStatus == AllEnum.JointDrillActStatus.WaitStart)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
self.timer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
function JointDrillActCtrl:OnEvent_WaitStart()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Act_Wait_Start_Tip"))
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Start()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit("PlayJointDrillActAnim", "JointDrill_Act_01_out", function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillLevelSelect, self.actData.nActId)
|
||||
end)
|
||||
end
|
||||
function JointDrillActCtrl:OnBtnClick_Detail()
|
||||
if self.mapActCfg == nil then
|
||||
return
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = self.mapActCfg.DetailDesc,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
return JointDrillActCtrl
|
||||
@@ -0,0 +1,28 @@
|
||||
local LoginRewardCtrl_01 = class("LoginRewardCtrl_01", BaseCtrl)
|
||||
LoginRewardCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
LoginRewardCtrl_01._mapEventConfig = {}
|
||||
function LoginRewardCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl_01:InitActData(actData)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.LoginReward.LoginRewardCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData)
|
||||
end
|
||||
function LoginRewardCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function LoginRewardCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
return LoginRewardCtrl_01
|
||||
@@ -0,0 +1,134 @@
|
||||
local LoginRewardPopUpCtrl_01 = class("LoginRewardPopUpCtrl_01", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
LoginRewardPopUpCtrl_01._mapNodeConfig = {
|
||||
imgActivity = {sComponentName = "Image"},
|
||||
goRewardList = {},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnActivity = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Activity"
|
||||
},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_PopUp_Tip"
|
||||
}
|
||||
}
|
||||
LoginRewardPopUpCtrl_01._mapEventConfig = {}
|
||||
LoginRewardPopUpCtrl_01._mapRedDotConfig = {}
|
||||
function LoginRewardPopUpCtrl_01:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshActData()
|
||||
self.nActId = self._panel.nActId
|
||||
self.actData = self._panel.actData
|
||||
self.remainTimer = nil
|
||||
self:RefreshRewardList()
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:RefreshRewardList()
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nMaxDay = #self._mapNode.goRewardItem
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
v.gameObject:SetActive(tbRewardList[k] ~= nil)
|
||||
if tbRewardList[k] ~= nil then
|
||||
v:SetRewardItem(k, tbRewardList[k], k == nMaxDay)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:PlayOutAnim()
|
||||
local nAnimLength = 0
|
||||
if self.animRoot ~= nil then
|
||||
nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_out"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
return nAnimLength
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnEnable()
|
||||
if self.animRoot ~= nil then
|
||||
local nAnimLength = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"LoginReward_01_in"
|
||||
})
|
||||
self.animRoot:Play("LoginReward_01_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimLength)
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpCtrl_01:OnBtnClick_Activity()
|
||||
local bOpen = self.actData:CheckActivityOpen()
|
||||
if not bOpen then
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_PopUp_Time_Out"),
|
||||
callbackConfirm = callback
|
||||
})
|
||||
return
|
||||
end
|
||||
local canReceive = self.actData:CheckCanReceive()
|
||||
if not canReceive then
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshLoginRewardPanel")
|
||||
end
|
||||
PlayerData.Activity:SendReceiveLoginRewardMsg(self.nActId, callback)
|
||||
end
|
||||
return LoginRewardPopUpCtrl_01
|
||||
@@ -0,0 +1,146 @@
|
||||
local LoginRewardCtrl = class("LoginRewardCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
LoginRewardCtrl._mapNodeConfig = {
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
goRewardItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardItemCtrl"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
}
|
||||
}
|
||||
LoginRewardCtrl._mapEventConfig = {}
|
||||
function LoginRewardCtrl:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function LoginRewardCtrl:RefreshRewardList()
|
||||
self.tbRewardList = {}
|
||||
local tbRewardList = self.actData:GetActLoginRewardList()
|
||||
if nil ~= tbRewardList then
|
||||
local nMaxDay = #self._mapNode.goRewardItem
|
||||
local nReceiveDay = self.actData:GetCanReceive()
|
||||
local nActual = self.actData:GetReceived()
|
||||
for k, v in ipairs(self._mapNode.goRewardItem) do
|
||||
self.tbRewardList[k] = {}
|
||||
local mapReward = tbRewardList[k]
|
||||
v.gameObject:SetActive(mapReward ~= nil)
|
||||
if mapReward ~= nil then
|
||||
v:SetRewardItem(k, mapReward, k == nMaxDay, nReceiveDay == nActual and k == nActual + 1)
|
||||
for i = 1, 3 do
|
||||
local nTid = mapReward["RewardId" .. i]
|
||||
local nCount = mapReward["Qty" .. i]
|
||||
if nTid ~= 0 then
|
||||
table.insert(self.tbRewardList[k], {nTid = nTid, nCount = nCount})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:RefreshRewardList()
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function LoginRewardCtrl:Awake()
|
||||
end
|
||||
function LoginRewardCtrl:OnEnable()
|
||||
end
|
||||
function LoginRewardCtrl:OnDisable()
|
||||
end
|
||||
function LoginRewardCtrl:OnDestroy()
|
||||
end
|
||||
function LoginRewardCtrl:OnBtnClick_Detail()
|
||||
local mapActCfg = self.actData:GetLoginRewardControlCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = mapActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function LoginRewardCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbRewardList[nIndex] ~= nil then
|
||||
if #self.tbRewardList[nIndex] == 1 then
|
||||
local nTid = self.tbRewardList[nIndex][1].nTid
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.gameObject.transform, true, true, false)
|
||||
else
|
||||
local tbReward = {}
|
||||
for _, v in ipairs(self.tbRewardList[nIndex]) do
|
||||
local rewardData = {
|
||||
[1] = v.nTid,
|
||||
[5] = v.nCount
|
||||
}
|
||||
table.insert(tbReward, rewardData)
|
||||
end
|
||||
EventManager.Hit("ShowActRewardList", tbReward)
|
||||
end
|
||||
end
|
||||
end
|
||||
return LoginRewardCtrl
|
||||
@@ -0,0 +1,52 @@
|
||||
local LoginRewardItemCtrl = class("LoginRewardItemCtrl", BaseCtrl)
|
||||
LoginRewardItemCtrl._mapNodeConfig = {
|
||||
imgCanReceiveBg = {},
|
||||
imgBg = {},
|
||||
imgPlusBg = {},
|
||||
imgIcon = {sComponentName = "Image"},
|
||||
txtItemCount = {sComponentName = "TMP_Text"},
|
||||
imgDay = {nCount = 2, sComponentName = "Image"},
|
||||
txtItemName = {sComponentName = "TMP_Text"},
|
||||
goReceived = {},
|
||||
txtReceived = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Received"
|
||||
},
|
||||
imgCanReceive = {},
|
||||
txtCanReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Can_Receive"
|
||||
},
|
||||
imgNextReceive = {},
|
||||
txtNextReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "LoginReward_Next_Receive"
|
||||
},
|
||||
goParticle = {sNodeName = "UIParticle"}
|
||||
}
|
||||
LoginRewardItemCtrl._mapEventConfig = {}
|
||||
LoginRewardItemCtrl._mapRedDotConfig = {}
|
||||
function LoginRewardItemCtrl:SetRewardItem(nDay, mapReward, bFinalDay, bNextDay)
|
||||
for _, v in ipairs(self._mapNode.imgDay) do
|
||||
self:SetAtlasSprite(v, "05_number", "zs_activity_02_num_" .. nDay)
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgIcon, mapReward.RewardIcon or "")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemCount, orderedFormat(ConfigTable.GetUIText("LoginReward_Reward_Count"), mapReward.RewardCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtItemName, mapReward.RewardDesc)
|
||||
self._mapNode.imgCanReceive.gameObject:SetActive(mapReward.Status == 1)
|
||||
self._mapNode.imgCanReceiveBg.gameObject:SetActive(mapReward.Status == 1)
|
||||
self._mapNode.goReceived.gameObject:SetActive(mapReward.Status == 2)
|
||||
self._mapNode.imgNextReceive.gameObject:SetActive(bNextDay)
|
||||
self._mapNode.imgPlusBg.gameObject:SetActive(mapReward.DisRare)
|
||||
self._mapNode.goParticle.gameObject:SetActive(mapReward.DisRare and mapReward.Status ~= 2)
|
||||
self._mapNode.imgBg.gameObject:SetActive(not mapReward.DisRare)
|
||||
self.tbRewardList = {}
|
||||
for i = 1, 3 do
|
||||
local nTid = mapReward["RewardId" .. i]
|
||||
local nCount = mapReward["Qty" .. i]
|
||||
if nTid ~= 0 then
|
||||
table.insert(self.tbRewardList, {nTid = nTid, nCount = nCount})
|
||||
end
|
||||
end
|
||||
end
|
||||
return LoginRewardItemCtrl
|
||||
@@ -0,0 +1,85 @@
|
||||
local LoginRewardPopUpCtrl = class("LoginRewardPopUpCtrl", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ResTypeAny = GameResourceLoader.ResType.Any
|
||||
LoginRewardPopUpCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
imgBlurMask = {},
|
||||
rtContent = {
|
||||
sNodeName = "---Content---",
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
LoginRewardPopUpCtrl._mapEventConfig = {
|
||||
RefreshLoginRewardPanel = "OnEvent_RefreshLoginRewardPanel"
|
||||
}
|
||||
LoginRewardPopUpCtrl._mapRedDotConfig = {}
|
||||
local sPrefabFolder = "UI_Activity/%s.prefab"
|
||||
function LoginRewardPopUpCtrl:ShowLoginReward()
|
||||
if self.tbActivityList == nil or #self.tbActivityList == 0 then
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.LoginRewardPopUp)
|
||||
if nil ~= self.callback then
|
||||
self.callback()
|
||||
end
|
||||
return
|
||||
end
|
||||
local actData = table.remove(self.tbActivityList, 1)
|
||||
self._panel.nActId = actData:GetActId()
|
||||
self._panel.actData = PlayerData.Activity:GetActivityDataById(self._panel.nActId)
|
||||
if nil ~= self._panel.actData then
|
||||
self:RefreshActContent()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl:RefreshActContent()
|
||||
self:ResetActContent()
|
||||
local mapActCfg = ConfigTable.GetData("LoginRewardControl", self._panel.nActId)
|
||||
if mapActCfg ~= nil then
|
||||
local sPrefabPath = string.format(sPrefabFolder, mapActCfg.PopUpUIAssets)
|
||||
local goObj = self:CreatePrefabInstance(sPrefabPath, self._mapNode.rtContent)
|
||||
local sCtrlPath = string.format("Game.UI.Activity.LoginReward.%s.LoginRewardPopUpCtrl_01", "_" .. self._panel.nActId)
|
||||
self.curPopUpCtrl = self:BindCtrlByNode(goObj, sCtrlPath)
|
||||
self.curPopUpCtrl:RefreshActData()
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl:ResetActContent()
|
||||
if nil ~= self.curPopUpCtrl then
|
||||
destroy(self.curPopUpCtrl.gameObject)
|
||||
self:UnbindCtrlByNode(self.curPopUpCtrl)
|
||||
end
|
||||
self.curPopUpCtrl = nil
|
||||
end
|
||||
function LoginRewardPopUpCtrl:Awake()
|
||||
self:ResetActContent()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if type(tbParam) == "table" then
|
||||
self.tbActivityList = tbParam[1]
|
||||
self.callback = tbParam[2]
|
||||
end
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnEnable()
|
||||
self._mapNode.rtContent.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurMask.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.imgBlurMask.gameObject:SetActive(true)
|
||||
self._mapNode.rtContent.gameObject:SetActive(true)
|
||||
self:ShowLoginReward()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpCtrl:OnEvent_RefreshLoginRewardPanel()
|
||||
if self.curPopUpCtrl == nil then
|
||||
self:ShowLoginReward()
|
||||
else
|
||||
self._panel.actData = PlayerData.Activity:GetActivityDataById(self._panel.nActId)
|
||||
self.curPopUpCtrl:RefreshActData()
|
||||
local nAnimTime = self.curPopUpCtrl:PlayOutAnim()
|
||||
self:AddTimer(1, nAnimTime, "ShowLoginReward", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
end
|
||||
end
|
||||
return LoginRewardPopUpCtrl
|
||||
@@ -0,0 +1,23 @@
|
||||
local LoginRewardPopUpPanel = class("LoginRewardPopUpPanel", BasePanel)
|
||||
LoginRewardPopUpPanel._bIsMainPanel = false
|
||||
LoginRewardPopUpPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "LoginRewardPopUp/LoginRewardPopUpPanel.prefab",
|
||||
sCtrlName = "Game.UI.Activity.LoginReward.LoginRewardPopUpCtrl"
|
||||
}
|
||||
}
|
||||
function LoginRewardPopUpPanel:Awake()
|
||||
self.nActId = nil
|
||||
self.actData = nil
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnEnable()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnAfterEnter()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnDisable()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnDestroy()
|
||||
end
|
||||
function LoginRewardPopUpPanel:OnRelease()
|
||||
end
|
||||
return LoginRewardPopUpPanel
|
||||
@@ -0,0 +1,138 @@
|
||||
local ActivityMiningCtrl = class("ActivityMiningCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local axeItemId = 0
|
||||
ActivityMiningCtrl._mapNodeConfig = {
|
||||
btnGo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
}
|
||||
}
|
||||
function ActivityMiningCtrl:OnDestory(...)
|
||||
self:UnInit()
|
||||
end
|
||||
function ActivityMiningCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self:ShowAddAxeCount()
|
||||
self:RefreshTimeout()
|
||||
end
|
||||
function ActivityMiningCtrl:UnInit(...)
|
||||
RedDotManager.UnRegisterNode(RedDotDefine.Activity_Mining_Quest_Group, nil, self._mapNode.reddot_Task)
|
||||
end
|
||||
function ActivityMiningCtrl:RefreshTimeout()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = ClientManager.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = string.format(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTimeout, sTimeStr)
|
||||
end
|
||||
function ActivityMiningCtrl:ShowAddAxeCount()
|
||||
local nActId = self.actData:GetActId()
|
||||
local data = PlayerData.Activity:GetActivityDataById(nActId)
|
||||
local nAddAxeCount = data:GetAddAxeCount()
|
||||
if 0 < nAddAxeCount then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Item,
|
||||
tbItem = {
|
||||
[1] = {nTid = axeItemId, nCount = nAddAxeCount}
|
||||
}
|
||||
})
|
||||
data:ResetAddAxeCount()
|
||||
end
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Go(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
local tbStoryConfig = self.actData:GetStoryConfigIdList()
|
||||
local nCurLevel = self.actData:GetLevel()
|
||||
local sNeedPlayAvgyId = 0
|
||||
local nStoryId = 0
|
||||
local tbAllData = self.actData:GetGroupStoryData()
|
||||
for _, v in pairs(tbStoryConfig) do
|
||||
if nCurLevel >= v.config.UnlockLayer then
|
||||
local temp = v.config.Id
|
||||
if not tbAllData[temp].bIsRead then
|
||||
sNeedPlayAvgyId = v.config.AvgId
|
||||
nStoryId = v.config.Id
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
local bAvgReadState = true
|
||||
if tbAllData[nStoryId] ~= nil then
|
||||
bAvgReadState = false
|
||||
end
|
||||
if sNeedPlayAvgyId ~= 0 and not bAvgReadState then
|
||||
local callback = function(...)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.PureAvgStory)
|
||||
self.actData:RequestFinishAvg(nStoryId)
|
||||
end
|
||||
local mapData = {
|
||||
nType = AllEnum.StoryAvgType.Plot,
|
||||
sAvgId = sNeedPlayAvgyId,
|
||||
nNodeId = nil,
|
||||
callback = callback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGame, nActId)
|
||||
end
|
||||
self.actData:RequestLevelData(0, callback)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Story(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameStory, nActId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Task(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.MiningGameQuest, nActId)
|
||||
end
|
||||
function ActivityMiningCtrl:OnBtnClick_Shop(...)
|
||||
local nActId = self.actData:GetActId()
|
||||
local tbConfig = ConfigTable.GetData("MiningControl", nActId)
|
||||
local nShopId = tbConfig.ShopId
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ShopPanel, nShopId)
|
||||
end
|
||||
function ActivityMiningCtrl:ClearActivity()
|
||||
end
|
||||
return ActivityMiningCtrl
|
||||
@@ -0,0 +1,172 @@
|
||||
local PeriodicQuestCtrl_01 = class("PeriodicQuestCtrl_01", BaseCtrl)
|
||||
PeriodicQuestCtrl_01._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
},
|
||||
goQuestProcess = {},
|
||||
txtProcess = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Process"
|
||||
},
|
||||
txtQuestProcess = {sComponentName = "TMP_Text"},
|
||||
btnReceiveFinal = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceiveFinal = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
imgCompleteFinal = {},
|
||||
txtComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Received"
|
||||
},
|
||||
btnUnComplete = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_UnComplete"
|
||||
},
|
||||
txtBtnUnComplete = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
btnRewardPreview = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RewardPreview"
|
||||
},
|
||||
txtRewardName = {sComponentName = "TMP_Text"},
|
||||
btnCharDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CharPreview"
|
||||
}
|
||||
}
|
||||
PeriodicQuestCtrl_01._mapEventConfig = {
|
||||
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
|
||||
}
|
||||
function PeriodicQuestCtrl_01:RefreshActInfo()
|
||||
if self.activityCtrl ~= nil then
|
||||
self.activityCtrl:RefreshQuestList()
|
||||
end
|
||||
self:RefreshQuestProgress()
|
||||
self:RefreshQuestReward()
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
self.nShowType = perQuestActCfg.PreviewType
|
||||
self.nRewardId = 0
|
||||
if self.nShowType == GameEnum.itemType.Char then
|
||||
self.nRewardId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= self.nRewardId then
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(true)
|
||||
local charConfig = ConfigTable.GetData_Character(self.nRewardId)
|
||||
if charConfig ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardName, charConfig.Name)
|
||||
end
|
||||
end
|
||||
elseif self.nShowType == GameEnum.itemType.Disc then
|
||||
self.nRewardId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= self.nRewardId then
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(true)
|
||||
local itemCfg = ConfigTable.GetData_Item(self.nRewardId)
|
||||
if itemCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardName, itemCfg.Title)
|
||||
end
|
||||
end
|
||||
elseif self.nShowType == GameEnum.itemType.Item then
|
||||
self.nRewardId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= self.nRewardId then
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(true)
|
||||
local itemCfg = ConfigTable.GetData_Item(self.nRewardId)
|
||||
if itemCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardName, itemCfg.Title)
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.btnCharDetail.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:RefreshQuestProgress()
|
||||
local curProgress, allProgress, canReceive = self.actData:GetQuestProgress()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtQuestProcess, string.format("%s/%s", curProgress, allProgress))
|
||||
self.bAllReceive = curProgress == allProgress
|
||||
end
|
||||
function PeriodicQuestCtrl_01:RefreshQuestReward()
|
||||
self._mapNode.btnReceiveFinal.gameObject:SetActive(not self.actData:CheckFinalReward() and self.bAllReceive)
|
||||
self._mapNode.btnUnComplete.gameObject:SetActive(not self.bAllReceive)
|
||||
self._mapNode.imgCompleteFinal.gameObject:SetActive(self.actData:CheckFinalReward())
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:InitActData(actData, bResetGroup)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.PeriodicQuest.PeriodicQuestCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData, bResetGroup)
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:Awake()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:FadeIn()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:FadeOut()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnEnable()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnRelease()
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_Receive()
|
||||
local callback = function()
|
||||
self:RefreshQuestReward()
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceiveFinalReward(self.nActId, callback)
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_UnComplete()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_UnComplete"))
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_RewardPreview()
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
local nShowType = perQuestActCfg.PreviewType
|
||||
if nShowType == GameEnum.itemType.Char then
|
||||
local nCharId = perQuestActCfg.FinalReward1
|
||||
if 0 ~= nCharId then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GachaPreview, nCharId)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnEvent_RefreshPeriodicAct(nActId)
|
||||
if nActId == self.nActId then
|
||||
self.bQuestAnim = false
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_01:OnBtnClick_CharPreview()
|
||||
if self.nRewardId == nil then
|
||||
return
|
||||
end
|
||||
if self.nShowType == GameEnum.itemType.Char then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, self.nRewardId)
|
||||
elseif self.nShowType == GameEnum.itemType.Item then
|
||||
local itemCfg = ConfigTable.GetData_Item(self.nRewardId)
|
||||
if itemCfg ~= nil then
|
||||
local sType = itemCfg.Stype
|
||||
if sType == GameEnum.itemStype.OutfitCYO then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.DiscPreview, self.nRewardId, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return PeriodicQuestCtrl_01
|
||||
@@ -0,0 +1,259 @@
|
||||
local PeriodicQuestCtrl = class("PeriodicQuestCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
PeriodicQuestCtrl._mapNodeConfig = {
|
||||
loopSv = {
|
||||
sNodeName = "srGuideQuest",
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtDays = {},
|
||||
PerActGroupItem = {
|
||||
nCount = 7,
|
||||
sCtrlName = "Game.UI.Activity.PeriodicQuest.PeriodicQuestGroupCtrl"
|
||||
},
|
||||
btnGroup = {
|
||||
sNodeName = "PerActGroupItem",
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Group"
|
||||
},
|
||||
btnGroupLock = {
|
||||
sNodeName = "btnGroupLock",
|
||||
nCount = 7,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_GroupLock"
|
||||
},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txtBtnDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Detail"
|
||||
},
|
||||
btnQuickRec = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_QuickRec"
|
||||
},
|
||||
txtBtnQuickRec = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Activity_Btn_Quick_Receive"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
PeriodicQuestCtrl._mapEventConfig = {}
|
||||
function PeriodicQuestCtrl:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
|
||||
end
|
||||
function PeriodicQuestCtrl:RefreshQuestList()
|
||||
self.tbAllQuestList = self.actData:GetQuestListByGroup()
|
||||
if nil == self.tbAllQuestList[self._panel.nSelectGroup] then
|
||||
printLog(string.format("任务列表为空!!!actId = %s, group = %s", self.nActId, self._panel.nSelectGroup))
|
||||
return
|
||||
end
|
||||
self.tbQuestList = self.tbAllQuestList[self._panel.nSelectGroup]
|
||||
table.sort(self.tbQuestList, function(a, b)
|
||||
if a.nStatus == b.nStatus then
|
||||
return a.Id < b.Id
|
||||
end
|
||||
return a.nStatus < b.nStatus
|
||||
end)
|
||||
for k, v in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
self.tbGridCtrl[k] = nil
|
||||
end
|
||||
if nil ~= self.tbQuestList then
|
||||
self.nPageCount = 0
|
||||
self._mapNode.loopSv:SetAnim(0.06)
|
||||
self._mapNode.loopSv:Init(#self.tbQuestList, self, self.OnGridRefresh, nil, false, self.GetGridPageCount)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
local _, _, canReceive = self.actData:GetQuestProgress()
|
||||
self._mapNode.btnQuickRec.gameObject:SetActive(0 < canReceive)
|
||||
for k, v in ipairs(self._mapNode.PerActGroupItem) do
|
||||
local nAllQuest, nReceivedQuest = self.actData:GetDayQuestStatus(k)
|
||||
v:RefreshStatus(nAllQuest <= nReceivedQuest and 0 < nReceivedQuest)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl:GetGridPageCount(pageCount)
|
||||
self.nPageCount = pageCount > #self.tbQuestList and #self.tbQuestList or pageCount
|
||||
end
|
||||
function PeriodicQuestCtrl:InitGroupList()
|
||||
local nCurDay = self.actData:GetCurOpenDay()
|
||||
self.nMaxOpenGroup = 0
|
||||
local tbNextOpenGroupList = {}
|
||||
if nil ~= CacheTable.GetData("_PeriodicQuestGroup", self.nActId) then
|
||||
local tbGroup = CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay]
|
||||
if nil ~= tbGroup then
|
||||
for _, v in ipairs(tbGroup) do
|
||||
if v > self.nMaxOpenGroup then
|
||||
self.nMaxOpenGroup = v
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil ~= CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay + 1] then
|
||||
for _, v in ipairs(CacheTable.GetData("_PeriodicQuestGroup", self.nActId)[nCurDay + 1]) do
|
||||
tbNextOpenGroupList[v] = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
local nSelectGroup = self.actData:GetCanReceiveRewardGroup()
|
||||
if 0 == nSelectGroup then
|
||||
nSelectGroup = self.nMaxOpenGroup
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.PerActGroupItem) do
|
||||
v:Init(self.nActId, k, self.nMaxOpenGroup)
|
||||
if nil ~= tbNextOpenGroupList[k] then
|
||||
local nHour = self.actData:GetNextDayOpenTime()
|
||||
if nHour < 1 then
|
||||
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_2") or "", 1))
|
||||
else
|
||||
v:SetTime(orderedFormat(ConfigTable.GetUIText("PerActivity_Quest_Open_Time_1") or "", nHour))
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil == self._panel.nSelectGroup then
|
||||
self._panel.nSelectGroup = nSelectGroup
|
||||
end
|
||||
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(true)
|
||||
end
|
||||
function PeriodicQuestCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceId = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceId] then
|
||||
self.tbGridCtrl[nInstanceId] = self:BindCtrlByNode(goGrid, "Game.UI.Activity.PeriodicQuest.PeriodicQuestItemCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceId]:SetData(self.nActId, self.tbQuestList[nIndex])
|
||||
end
|
||||
function PeriodicQuestCtrl:InitActData(actData, bResetGroup)
|
||||
self.actData = actData
|
||||
if bResetGroup then
|
||||
self._panel.nSelectGroup = nil
|
||||
end
|
||||
self.nActId = actData:GetActId()
|
||||
self.bQuestAnim = false
|
||||
self:InitGroupList()
|
||||
local tbAllQuestList = self.actData:GetQuestListByGroup()
|
||||
if nil == tbAllQuestList[self._panel.nSelectGroup] then
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Tips,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1")
|
||||
})
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
return
|
||||
end
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
self.tbSequences = {}
|
||||
end
|
||||
function PeriodicQuestCtrl:FadeIn()
|
||||
end
|
||||
function PeriodicQuestCtrl:FadeOut()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnEnable()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnDisable()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
function PeriodicQuestCtrl:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnRelease()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_Group(_, nIndex)
|
||||
if self._panel.nSelectGroup == nIndex then
|
||||
return
|
||||
end
|
||||
if nIndex > self.nMaxOpenGroup then
|
||||
return
|
||||
end
|
||||
if nil == self.tbAllQuestList[nIndex] or nil == next(self.tbAllQuestList[nIndex]) then
|
||||
printError(string.format("当前任务组下没有任务!!! 活动id = %d, 任务组 = %s", self.nActId, nIndex))
|
||||
return
|
||||
end
|
||||
self._mapNode.PerActGroupItem[self._panel.nSelectGroup]:SetSelect(false)
|
||||
if nil ~= self._mapNode.PerActGroupItem[nIndex] then
|
||||
self._mapNode.PerActGroupItem[nIndex]:SetSelect(true)
|
||||
end
|
||||
self._panel.nSelectGroup = nIndex
|
||||
self.bQuestAnim = true
|
||||
self:RefreshQuestList()
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_GroupLock()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("PerActivity_Not_Open"))
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_Detail()
|
||||
local perQuestActCfg = self.actData:GetPerQuestCfg()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = perQuestActCfg.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function PeriodicQuestCtrl:OnBtnClick_QuickRec()
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshPeriodicAct", self.nActId)
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, 0, callback)
|
||||
end
|
||||
return PeriodicQuestCtrl
|
||||
@@ -0,0 +1,54 @@
|
||||
local PeriodicQuestCtrl_02 = class("PeriodicQuestCtrl_02", BaseCtrl)
|
||||
PeriodicQuestCtrl_02._mapNodeConfig = {
|
||||
goCommon = {
|
||||
sNodeName = "---Common---"
|
||||
}
|
||||
}
|
||||
PeriodicQuestCtrl_02._mapEventConfig = {
|
||||
RefreshPeriodicAct = "OnEvent_RefreshPeriodicAct"
|
||||
}
|
||||
function PeriodicQuestCtrl_02:RefreshActInfo()
|
||||
if self.activityCtrl ~= nil then
|
||||
self.activityCtrl:RefreshQuestList()
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_02:UnbindCtrl()
|
||||
if self.activityCtrl ~= nil then
|
||||
self:UnbindCtrlByNode(self.activityCtrl)
|
||||
self.activityCtrl = nil
|
||||
end
|
||||
end
|
||||
function PeriodicQuestCtrl_02:InitActData(actData, bResetGroup)
|
||||
if self.activityCtrl == nil then
|
||||
self.activityCtrl = self:BindCtrlByNode(self._mapNode.goCommon, "Game.UI.Activity.PeriodicQuest.PeriodicQuestCtrl")
|
||||
end
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self.activityCtrl:InitActData(actData, bResetGroup)
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:ClearActivity()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:Awake()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:FadeIn()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:FadeOut()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnEnable()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnDisable()
|
||||
self:UnbindCtrl()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnRelease()
|
||||
end
|
||||
function PeriodicQuestCtrl_02:OnEvent_RefreshPeriodicAct(nActId)
|
||||
if nActId == self.nActId then
|
||||
self.bQuestAnim = false
|
||||
self:RefreshActInfo()
|
||||
end
|
||||
end
|
||||
return PeriodicQuestCtrl_02
|
||||
@@ -0,0 +1,56 @@
|
||||
local PeriodicQuestGroupCtrl = class("PeriodicQuestGroupCtrl", BaseCtrl)
|
||||
PeriodicQuestGroupCtrl._mapNodeConfig = {
|
||||
goNormal = {},
|
||||
goSelect = {},
|
||||
goLock = {},
|
||||
txt_Group = {sComponentName = "TMP_Text", nCount = 3},
|
||||
goTime = {},
|
||||
txtOpenTime = {sComponentName = "TMP_Text"},
|
||||
redDotGroup = {},
|
||||
imgComplete = {}
|
||||
}
|
||||
PeriodicQuestGroupCtrl._mapEventConfig = {}
|
||||
function PeriodicQuestGroupCtrl:Init(nActId, nGroup, nCurGroup)
|
||||
self.nActId = nActId
|
||||
self.nGroup = nGroup
|
||||
for _, v in ipairs(self._mapNode.txt_Group) do
|
||||
NovaAPI.SetTMPText(v, self.nGroup)
|
||||
end
|
||||
self._mapNode.goNormal.gameObject:SetActive(true)
|
||||
self._mapNode.goSelect.gameObject:SetActive(false)
|
||||
self._mapNode.goLock.gameObject:SetActive(false)
|
||||
self._mapNode.goTime.gameObject:SetActive(false)
|
||||
self._mapNode.redDotGroup.gameObject:SetActive(false)
|
||||
self.bUnlock = nGroup <= nCurGroup
|
||||
self:SetSelect(false)
|
||||
self._mapNode.goNormal.gameObject:SetActive(nGroup <= nCurGroup)
|
||||
self._mapNode.goLock.gameObject:SetActive(nCurGroup < nGroup)
|
||||
self:RegisterRedDot()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:RegisterRedDot()
|
||||
RedDotManager.RegisterNode(RedDotDefine.Activity_Periodic_Quest_Group, {
|
||||
self.nActId,
|
||||
self.nGroup
|
||||
}, self._mapNode.redDotGroup)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:SetTime(sTime)
|
||||
self._mapNode.goTime.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtOpenTime, sTime)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:SetSelect(bSelect)
|
||||
self.bSelect = bSelect
|
||||
self._mapNode.goNormal.gameObject:SetActive(not self.bSelect)
|
||||
self._mapNode.goSelect.gameObject:SetActive(self.bSelect)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:RefreshStatus(bAllReceived)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(bAllReceived and self.bUnlock)
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:Awake()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:OnDisable()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestGroupCtrl:OnRelease()
|
||||
end
|
||||
return PeriodicQuestGroupCtrl
|
||||
@@ -0,0 +1,105 @@
|
||||
local PeriodicQuestItemCtrl = class("PeriodicQuestItemCtrl", BaseCtrl)
|
||||
local JumpUtil = require("Game.Common.Utils.JumpUtil")
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
PeriodicQuestItemCtrl._mapNodeConfig = {
|
||||
rtTitle = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtTitle = {sNodeName = "TMPTitle", sComponentName = "TMP_Text"},
|
||||
rtBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtProcess = {sNodeName = "TMPProcess", sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
rtReward = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Receive"
|
||||
},
|
||||
btnJump = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Jump"
|
||||
},
|
||||
txtBtnJump = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_Jump"
|
||||
},
|
||||
txtUnComplete = {
|
||||
sNodeName = "TMPUncomplete",
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "PerActivity_Quest_UnComplete"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgCompleteMask = {},
|
||||
imgPoint = {}
|
||||
}
|
||||
PeriodicQuestItemCtrl._mapEventConfig = {}
|
||||
local totalLength = 520
|
||||
local totalHeight = 37
|
||||
function PeriodicQuestItemCtrl:SetData(nActId, mapData)
|
||||
self.nActId = nActId
|
||||
self.nQuestId = mapData.Id
|
||||
local nStatus = mapData.nStatus
|
||||
local questCfg = ConfigTable.GetData("PeriodicQuest", self.nQuestId)
|
||||
if nil ~= questCfg then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, questCfg.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProcess, string.format("%s/%s", mapData.nCurProcess, mapData.nTotalProcess))
|
||||
self.nJumpTo = questCfg.JumpTo
|
||||
self.rewardId = questCfg.Reward
|
||||
self._mapNode.rtReward:SetItem(questCfg.Reward, nil, questCfg.RewardQty, nil, nil, nil, nil, true)
|
||||
self._mapNode.txtUnComplete.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.UnComplete and questCfg.JumpTo == 0)
|
||||
self._mapNode.btnJump.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.UnComplete and questCfg.JumpTo ~= 0)
|
||||
self._mapNode.btnReceive.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Complete)
|
||||
self._mapNode.imgComplete.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgCompleteMask.gameObject:SetActive(nStatus == AllEnum.ActQuestStatus.Received)
|
||||
self._mapNode.imgPoint.gameObject:SetActive(nStatus ~= AllEnum.ActQuestStatus.Received)
|
||||
if nStatus == AllEnum.ActQuestStatus.Received then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtProcess, ConfigTable.GetUIText("PerActivity_Quest_Complete"))
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(totalLength, totalHeight)
|
||||
else
|
||||
self._mapNode.rtBarFill.sizeDelta = Vector2(mapData.nCurProcess / mapData.nTotalProcess * totalLength, totalHeight)
|
||||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.rtTitle)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestItemCtrl:Awake()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:FadeIn()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:FadeOut()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnEnable()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnDisable()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnDestroy()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnRelease()
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnBtnClick_Reward(btn)
|
||||
if nil ~= self.rewardId then
|
||||
UTILS.ClickItemGridWithTips(self.rewardId, btn.transform, true, true, true)
|
||||
end
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnBtnClick_Receive()
|
||||
local callback = function()
|
||||
EventManager.Hit("RefreshPeriodicAct", self.nActId)
|
||||
PlayerData.Base:TryOpenWorldClassUpgrade()
|
||||
end
|
||||
PlayerData.Activity:SendReceivePerQuest(self.nActId, self.nQuestId, callback)
|
||||
end
|
||||
function PeriodicQuestItemCtrl:OnBtnClick_Jump()
|
||||
if nil ~= self.nJumpTo and 0 ~= self.nJumpTo then
|
||||
JumpUtil.JumpTo(self.nJumpTo)
|
||||
end
|
||||
end
|
||||
return PeriodicQuestItemCtrl
|
||||
@@ -0,0 +1,178 @@
|
||||
local ActivityTowerDefenseCtrl = class("ActivityTowerDefenseCtrl", BaseCtrl)
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local barMinX = -365
|
||||
local barMaxX = 0
|
||||
local panelType = {
|
||||
Default = 1,
|
||||
QuestPanel = 2,
|
||||
StoryPanel = 3,
|
||||
DesPanel = 4
|
||||
}
|
||||
ActivityTowerDefenseCtrl._mapNodeConfig = {
|
||||
item = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl",
|
||||
nCount = 4
|
||||
},
|
||||
ItemBtn = {nCount = 4, sComponentName = "UIButton"},
|
||||
txt_time = {sComponentName = "TMP_Text"},
|
||||
txt_des = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_ActivityDes"
|
||||
},
|
||||
btn_des = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
txt_quest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_QuestTitle"
|
||||
},
|
||||
redDotQuest = {},
|
||||
btn_quest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txt_mainProcess = {sComponentName = "TMP_Text"},
|
||||
imgMainBarFill = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txt_go = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_EnterActivity"
|
||||
},
|
||||
btn_go = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Go"
|
||||
},
|
||||
go_nextLevel = {},
|
||||
txt_nextLevelTime = {sComponentName = "TMP_Text"},
|
||||
txtRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TowerDef_RewardPre"
|
||||
}
|
||||
}
|
||||
ActivityTowerDefenseCtrl._mapEventConfig = {
|
||||
TowerDefenseQuestUpdate = "InitQuest",
|
||||
TowerDefenseCloseQuestPanel = "OnEvent_CloseQuestPanel"
|
||||
}
|
||||
ActivityTowerDefenseCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Activity_TowerDefense_AllQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
function ActivityTowerDefenseCtrl:Awake()
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:RefreshRemainTime()
|
||||
if self.actData.actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.txt_time.transform.parent.gameObject:SetActive(false)
|
||||
else
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
end
|
||||
local sTimeStr = self:GetTimeText(remainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_time, orderedFormat(ConfigTable.GetUIText("PerActivity_Remain_Time") or "", sTimeStr))
|
||||
end
|
||||
local nextLevelTime = self.actData:GetNextLevelUnlockTime()
|
||||
if nextLevelTime == 0 then
|
||||
self._mapNode.go_nextLevel:SetActive(false)
|
||||
else
|
||||
self._mapNode.go_nextLevel:SetActive(true)
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local nextLevelRemainTime = nextLevelTime - curTime
|
||||
local sNextLevelTime = self:GetTimeText(nextLevelRemainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_nextLevelTime, orderedFormat(ConfigTable.GetUIText("TowerDef_LevelPreTime") or "", sNextLevelTime))
|
||||
end
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:GetTimeText(remainTime)
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
return sTimeStr
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitItem()
|
||||
for _, item in pairs(self._mapNode.item) do
|
||||
item.gameObject:SetActive(false)
|
||||
end
|
||||
local rewardData = ConfigTable.GetData("TowerDefenseControl", self.nActId)
|
||||
if rewardData == nil then
|
||||
return
|
||||
end
|
||||
local rewardData = rewardData.RewardsShow
|
||||
local tbReward = decodeJson(rewardData)
|
||||
for i = 1, math.min(4, #tbReward) do
|
||||
self._mapNode.item[i]:SetItem(tbReward[i])
|
||||
self._mapNode.item[i].gameObject:SetActive(true)
|
||||
self._mapNode.ItemBtn[i].onClick:RemoveAllListeners()
|
||||
self._mapNode.ItemBtn[i].onClick:AddListener(function()
|
||||
local nRewardId = tbReward[i]
|
||||
if nRewardId ~= nil then
|
||||
UTILS.ClickItemGridWithTips(nRewardId, self._mapNode.ItemBtn[i].transform, true, false, false)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitQuest()
|
||||
local allCount = self.actData:GetAllQuestCount()
|
||||
local receivedCount = self.actData:GetAllReceivedCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txt_mainProcess, receivedCount .. "/" .. allCount)
|
||||
self._mapNode.imgMainBarFill.anchoredPosition = Vector2(barMinX + (barMaxX - barMinX) * (receivedCount / allCount), self._mapNode.imgMainBarFill.anchoredPosition.y)
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
self:InitItem()
|
||||
self:InitQuest()
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:ClearActivity()
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:OnBtnClick_Detail()
|
||||
local config = ConfigTable.GetData("TowerDefenseControl", self.nActId)
|
||||
if config == nil then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = config.DesText,
|
||||
sTitle = ConfigTable.GetUIText("Activity_Btn_Detail")
|
||||
})
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TowerDefenseQuest, self.nActId)
|
||||
end
|
||||
function ActivityTowerDefenseCtrl:OnBtnClick_Go()
|
||||
local bPlayCond = self.actData:CheckActJumpCond(true)
|
||||
if not bPlayCond then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TowerDefenseSelectPanel, self.nActId)
|
||||
end
|
||||
return ActivityTowerDefenseCtrl
|
||||
@@ -0,0 +1,314 @@
|
||||
local TrialCtrl = class("TrialCtrl", BaseCtrl)
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
TrialCtrl._mapNodeConfig = {
|
||||
rawImgActor2D = {
|
||||
sNodeName = "----Actor2D----",
|
||||
sComponentName = "RawImage"
|
||||
},
|
||||
goActTime = {},
|
||||
txtActivityTime = {sComponentName = "TMP_Text"},
|
||||
btnTrialInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TrialInfo"
|
||||
},
|
||||
txtBtnTrialInfo = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_TrialDetial"
|
||||
},
|
||||
txtReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_RewardInfo"
|
||||
},
|
||||
btnItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ItemTips"
|
||||
},
|
||||
item = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
rtChar = {},
|
||||
btnChar = {
|
||||
nCount = 4,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
imgSelectBg = {nCount = 4},
|
||||
goSelect = {nCount = 4},
|
||||
imgHead = {nCount = 4, sComponentName = "Image"},
|
||||
goCharRoot = {},
|
||||
btnTrial = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Trial"
|
||||
},
|
||||
btnGacha = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Gacha"
|
||||
},
|
||||
txtBtnGacha = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_GotoGacha"
|
||||
},
|
||||
txtBtnTrial = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Trial_Btn_GotoTrial"
|
||||
},
|
||||
goStar = {
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateStarCtrl"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
btnCharInfo = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CharInfo"
|
||||
},
|
||||
imgElementIcon = {sComponentName = "Image"},
|
||||
txtElement = {sComponentName = "TMP_Text"},
|
||||
txtCharClass = {sComponentName = "TMP_Text"},
|
||||
imgAttackType = {sComponentName = "Image"}
|
||||
}
|
||||
TrialCtrl._mapEventConfig = {}
|
||||
function TrialCtrl:RefreshRemainTime()
|
||||
local endTime = self.actData:GetActEndTime()
|
||||
local curTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local remainTime = endTime - curTime
|
||||
if remainTime < 0 then
|
||||
TimerManager.Remove(self.remainTimer)
|
||||
self.remainTimer = nil
|
||||
EventManager.Hit(EventId.OpenMessageBox, {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("Activity_Invalid_Tip_1"),
|
||||
callbackConfirm = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.ActivityList)
|
||||
end
|
||||
})
|
||||
return
|
||||
end
|
||||
local sTimeStr = ""
|
||||
if remainTime <= 60 then
|
||||
local sec = math.floor(remainTime)
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Sec") or "", sec)
|
||||
elseif 60 < remainTime and remainTime <= 3600 then
|
||||
local min = math.floor(remainTime / 60)
|
||||
local sec = math.floor(remainTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Min") or "", min, sec)
|
||||
elseif 3600 < remainTime and remainTime <= 86400 then
|
||||
local hour = math.floor(remainTime / 3600)
|
||||
local min = math.floor((remainTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Hour") or "", hour, min)
|
||||
elseif 86400 < remainTime then
|
||||
local day = math.floor(remainTime / 86400)
|
||||
local hour = math.floor((remainTime - day * 86400) / 3600)
|
||||
if hour == 0 then
|
||||
day = day - 1
|
||||
hour = 24
|
||||
end
|
||||
sTimeStr = orderedFormat(ConfigTable.GetUIText("Activity_Remain_Time_Day") or "", day, hour)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActivityTime, sTimeStr)
|
||||
end
|
||||
function TrialCtrl:Refresh()
|
||||
self:RefreshCharList()
|
||||
self:RefreshCharInfo()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function TrialCtrl:RefreshCharInfo()
|
||||
local nCharId = self.tbCharId[self.nSelectIndex]
|
||||
local mapCfg = ConfigTable.GetData_Character(nCharId)
|
||||
local mapItem = ConfigTable.GetData_Item(nCharId)
|
||||
if not mapCfg or not mapItem then
|
||||
return
|
||||
end
|
||||
local nMaxStar = 6 - mapItem.Rarity
|
||||
self._mapNode.goStar:SetStar(0, nMaxStar)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, mapCfg.Name)
|
||||
local nEET = mapCfg.EET
|
||||
self:SetAtlasSprite(self._mapNode.imgElementIcon, "12_rare", AllEnum.ElementIconType.Icon .. nEET)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtElement, ConfigTable.GetUIText("T_Element_Attr_" .. nEET))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCharClass, ConfigTable.GetUIText("Char_JobClass_" .. mapCfg.Class))
|
||||
if mapCfg.CharacterAttackType == GameEnum.characterAttackType.MELEE then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType, "10_ico", "zs_list_near")
|
||||
elseif mapCfg.CharacterAttackType == GameEnum.characterAttackType.RANGED then
|
||||
self:SetAtlasSprite(self._mapNode.imgAttackType, "10_ico", "zs_list_far")
|
||||
end
|
||||
local nCharSkinId = ConfigTable.GetData_Character(nCharId).AdvanceSkinId
|
||||
Actor2DManager.SetActor2D(PanelId.TrialActivity, self._mapNode.rawImgActor2D, nCharId, nCharSkinId)
|
||||
end
|
||||
function TrialCtrl:RefreshReward()
|
||||
self.tbReward = {}
|
||||
local nGroupId = self.tbGroup[self.nSelectIndex]
|
||||
local mapCfg = ConfigTable.GetData("TrialGroup", nGroupId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
local bReceived = self.actData:CheckGroupReceived(nGroupId)
|
||||
for i = 1, 3 do
|
||||
local nId = mapCfg["RewardId" .. i]
|
||||
if 0 < nId then
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(true)
|
||||
self._mapNode.item[i]:SetItem(nId, nil, mapCfg["Qty" .. i], nil, bReceived)
|
||||
table.insert(self.tbReward, nId)
|
||||
else
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TrialCtrl:RefreshCharList()
|
||||
local nCount = #self.tbCharId
|
||||
if nCount == 1 then
|
||||
self._mapNode.goCharRoot:SetActive(false)
|
||||
return
|
||||
end
|
||||
self._mapNode.goCharRoot:SetActive(true)
|
||||
self._mapNode.rtChar:SetActive(nCount <= 4)
|
||||
self._mapNode.sv.gameObject:SetActive(4 < nCount)
|
||||
if nCount <= 4 then
|
||||
for i = 1, 4 do
|
||||
self._mapNode.btnChar[i].gameObject:SetActive(i <= nCount)
|
||||
if i <= nCount then
|
||||
local nCharId = self.tbCharId[i]
|
||||
local nCharSkinId = ConfigTable.GetData_Character(nCharId).AdvanceSkinId
|
||||
local sIcon = ConfigTable.GetData_CharacterSkin(nCharSkinId).Icon
|
||||
self:SetPngSprite(self._mapNode.imgHead[i], sIcon .. AllEnum.CharHeadIconSurfix.L)
|
||||
self._mapNode.goSelect[i]:SetActive(self.nSelectIndex == i)
|
||||
self._mapNode.imgSelectBg[i]:SetActive(self.nSelectIndex == i)
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.sv:Init(nCount, self, self.OnGridRefresh, self.OnGridClick)
|
||||
end
|
||||
end
|
||||
function TrialCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nCharId = self.tbCharId[nIndex]
|
||||
local nCharSkinId = ConfigTable.GetData_Character(nCharId).AdvanceSkinId
|
||||
local sIcon = ConfigTable.GetData_CharacterSkin(nCharSkinId).Icon
|
||||
local imgHead = goGrid.transform:Find("btnChar/AnimRoot/imgHead"):GetComponent("Image")
|
||||
local goSelect = goGrid.transform:Find("btnChar/AnimRoot/goSelect").gameObject
|
||||
local imgSelectBg = goGrid.transform:Find("btnChar/AnimRoot/imgSelectBg").gameObject
|
||||
self:SetPngSprite(imgHead, sIcon .. AllEnum.CharHeadIconSurfix.L)
|
||||
goSelect:SetActive(self.nSelectIndex == nIndex)
|
||||
imgSelectBg:SetActive(self.nSelectIndex == nIndex)
|
||||
end
|
||||
function TrialCtrl:OnGridClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if self.nSelectIndex == nIndex then
|
||||
return
|
||||
end
|
||||
goGrid.transform:Find("btnChar/AnimRoot/imgSelectBg").gameObject:SetActive(true)
|
||||
goGrid.transform:Find("btnChar/AnimRoot/goSelect").gameObject:SetActive(true)
|
||||
local sPathSelectBg = "Viewport/Content/" .. tostring(self.nSelectIndex - 1) .. "/btnChar/AnimRoot/imgSelectBg"
|
||||
local sPathSelect = "Viewport/Content/" .. tostring(self.nSelectIndex - 1) .. "/btnChar/AnimRoot/goSelect"
|
||||
local goSelectBg = self._mapNode.sv.transform:Find(sPathSelectBg)
|
||||
local goSelect = self._mapNode.sv.transform:Find(sPathSelect)
|
||||
if goSelectBg then
|
||||
goSelectBg.gameObject:SetActive(false)
|
||||
end
|
||||
if goSelect then
|
||||
goSelect.gameObject:SetActive(false)
|
||||
end
|
||||
self.nSelectIndex = nIndex
|
||||
self._mapNode.sv:SetScrollGridPos(gridIndex, 0.1, 1)
|
||||
self:RefreshCharInfo()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function TrialCtrl:InitActData(actData)
|
||||
self.actData = actData
|
||||
self.nActId = actData:GetActId()
|
||||
PlayerData.Trial:SetTrialAct(self.nActId)
|
||||
self.nSelectIndex = 1
|
||||
local actCfg = self.actData:GetActCfgData()
|
||||
if actCfg.EndType == GameEnum.activityEndType.NoLimit then
|
||||
self._mapNode.goActTime.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goActTime.gameObject:SetActive(true)
|
||||
self:RefreshRemainTime()
|
||||
if nil == self.remainTimer then
|
||||
self.remainTimer = self:AddTimer(0, 1, "RefreshRemainTime", true, true, false)
|
||||
end
|
||||
end
|
||||
local mapCfg = ConfigTable.GetData("TrialControl", self.nActId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self.tbGacha = mapCfg.Gachas
|
||||
self.tbGroup = mapCfg.GroupIds
|
||||
self.tbCharId = {}
|
||||
for _, v in ipairs(self.tbGroup) do
|
||||
local mapGroup = ConfigTable.GetData("TrialGroup", v)
|
||||
if mapGroup then
|
||||
local mapTrial = ConfigTable.GetData("TrialCharacter", mapGroup.TrialChar)
|
||||
if mapTrial then
|
||||
table.insert(self.tbCharId, mapTrial.CharId)
|
||||
end
|
||||
end
|
||||
end
|
||||
self:Refresh()
|
||||
end
|
||||
function TrialCtrl:ClearActivity()
|
||||
Actor2DManager.UnsetActor2D()
|
||||
end
|
||||
function TrialCtrl:Awake()
|
||||
end
|
||||
function TrialCtrl:OnEnable()
|
||||
end
|
||||
function TrialCtrl:OnDisable()
|
||||
Actor2DManager.UnsetActor2D()
|
||||
end
|
||||
function TrialCtrl:OnDestroy()
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_Trial()
|
||||
PlayerData.Trial:SetSelectTrialGroup(self.tbGroup[self.nSelectIndex])
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TrialLevelSelect)
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_Gacha()
|
||||
local getInfoCallback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.GachaSpin, self.tbGacha[self.nSelectIndex])
|
||||
end
|
||||
PlayerData.Gacha:GetGachaInfomation(getInfoCallback)
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_CharInfo()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.CharBgTrialPanel, PanelId.CharInfoTrial, self.tbCharId[self.nSelectIndex])
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
if self.nSelectIndex == nIndex then
|
||||
return
|
||||
end
|
||||
self._mapNode.goSelect[self.nSelectIndex]:SetActive(false)
|
||||
self._mapNode.imgSelectBg[self.nSelectIndex]:SetActive(false)
|
||||
self._mapNode.goSelect[nIndex]:SetActive(true)
|
||||
self._mapNode.imgSelectBg[nIndex]:SetActive(true)
|
||||
self.nSelectIndex = nIndex
|
||||
self:RefreshCharInfo()
|
||||
self:RefreshReward()
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_TrialInfo()
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Desc,
|
||||
sContent = ConfigTable.GetUIText("Trial_DetailInfo")
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function TrialCtrl:OnBtnClick_ItemTips(btn, nIndex)
|
||||
if self.tbReward[nIndex] then
|
||||
local mapData = {
|
||||
nTid = self.tbReward[nIndex],
|
||||
bShowDepot = true,
|
||||
bShowJumpto = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
end
|
||||
return TrialCtrl
|
||||
Reference in New Issue
Block a user