Update - 1.13.0.124
EN: 1.13.0.124 CN: 1.13.0.124 JP: 1.13.0.128 KR: 1.13.0.130
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
local TraceHuntFriendGridCtrl = class("TraceHuntFriendGridCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
local _, Blue = ColorUtility.TryParseHtmlString("#08D3D4")
|
||||
TraceHuntFriendGridCtrl._mapNodeConfig = {
|
||||
imgFriendBoss = {sComponentName = "Image"},
|
||||
txtLeftTime = {sComponentName = "TMP_Text"},
|
||||
imgLeftTime = {sComponentName = "Image"},
|
||||
btnDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Detail"
|
||||
},
|
||||
goHonorTitle_ = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.FriendEx.HonorTitleCtrl"
|
||||
},
|
||||
goSelect = {},
|
||||
goStranger = {},
|
||||
txtStranger = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Help_Stranger"
|
||||
},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
txtWorldClass = {sComponentName = "TMP_Text"},
|
||||
txtRankCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtName = {sComponentName = "TMP_Text"},
|
||||
txtTitle = {sComponentName = "TMP_Text"},
|
||||
txtTitleName = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Friend_TitleTag"
|
||||
},
|
||||
imgStarFriend = {}
|
||||
}
|
||||
TraceHuntFriendGridCtrl._mapEventConfig = {}
|
||||
function TraceHuntFriendGridCtrl:Refresh(mapData)
|
||||
self.mapData = mapData
|
||||
self.mapFriend = mapData.mapFriend
|
||||
self:SetTimer()
|
||||
self:RefreshInfo()
|
||||
self:RefreshHonorTitle()
|
||||
self:SetSelect(false)
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:SetTimer()
|
||||
local nLeft = self.mapData.nBossCreateTime + ConfigTable.GetConfigNumber("TraceHuntBossHuntLimitTime") - ClientManager.serverTimeStamp
|
||||
if nLeft < 0 then
|
||||
nLeft = 0
|
||||
end
|
||||
self.nHuntLeftTime = nLeft
|
||||
if self.timerCountDownHunt == nil then
|
||||
self.timerCountDownHunt = self:AddTimer(0, 1, "RefreshHuntTime", false, true, false)
|
||||
end
|
||||
self:RefreshHuntTime()
|
||||
if 0 < self.nHuntLeftTime then
|
||||
self.timerCountDownHunt:Pause(false)
|
||||
end
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:RefreshHuntTime()
|
||||
self.nHuntLeftTime = self.nHuntLeftTime - 1
|
||||
if self.nHuntLeftTime > 0 then
|
||||
local sTime = ""
|
||||
if self.nHuntLeftTime <= 60 then
|
||||
local sec = math.floor(self.nHuntLeftTime)
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("TraceHunt_FriendHuntRefresh_Sec"), sec)
|
||||
elseif self.nHuntLeftTime > 60 and self.nHuntLeftTime <= 3600 then
|
||||
local min = math.floor(self.nHuntLeftTime / 60)
|
||||
local sec = math.floor(self.nHuntLeftTime - min * 60)
|
||||
if sec == 0 then
|
||||
min = min - 1
|
||||
sec = 60
|
||||
end
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("TraceHunt_FriendHuntRefresh_Min"), min, sec)
|
||||
elseif self.nHuntLeftTime > 3600 and self.nHuntLeftTime <= 86400 then
|
||||
local hour = math.floor(self.nHuntLeftTime / 3600)
|
||||
local min = math.floor((self.nHuntLeftTime - hour * 3600) / 60)
|
||||
if min == 0 then
|
||||
hour = hour - 1
|
||||
min = 60
|
||||
end
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("TraceHunt_FriendHuntRefresh_Hour"), hour, min)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTime, sTime)
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLeftTime, ConfigTable.GetUIText("TraceHunt_HuntEnd"))
|
||||
self.timerCountDownHunt:Pause(true)
|
||||
end
|
||||
local bNormal = self.nHuntLeftTime > self.nEmergencyTime
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtLeftTime, bNormal and White_Normal or Blue)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgLeftTime, bNormal and White_Normal or Blue)
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:RefreshInfo()
|
||||
local mapCfg = ConfigTable.GetData("PlayerHead", self.mapFriend.nHeadIconId)
|
||||
if mapCfg then
|
||||
self:SetPngSprite(self._mapNode.imgHead, mapCfg.Icon)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldClass, self.mapFriend.nWorldClass)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtName, self.mapFriend.sName)
|
||||
local sTitle = orderedFormat(ConfigTable.GetUIText("FriendPanel_PlayerTitle") or "", ConfigTable.GetData("Title", self.mapFriend.nTitlePrefix).Desc, ConfigTable.GetData("Title", self.mapFriend.nTitleSuffix).Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTitle, self.mapFriend.nTitlePrefix == 0 and "" or sTitle)
|
||||
self._mapNode.imgStarFriend:SetActive(self.mapData.bStar)
|
||||
self._mapNode.goStranger:SetActive(not self.mapData.bFriend)
|
||||
local mapBossCfg = ConfigTable.GetData("TraceHuntBoss", self.mapData.nBossId)
|
||||
if mapBossCfg then
|
||||
self:SetPngSprite(self._mapNode.imgFriendBoss, mapBossCfg.HeadIcon)
|
||||
end
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:RefreshHonorTitle()
|
||||
for i = 1, 3 do
|
||||
local tbHonorTitle = self.mapFriend.tbHonorTitle or {}
|
||||
if tbHonorTitle[i] ~= nil and tbHonorTitle[i].Id > 0 then
|
||||
local honorData = ConfigTable.GetData("Honor", tbHonorTitle[i].Id)
|
||||
self._mapNode.goHonorTitle_[i]:SetHonotTitle(honorData.Id, i == 1, tbHonorTitle[i].AffinityLV)
|
||||
end
|
||||
self._mapNode.goHonorTitle_[i].gameObject:SetActive(tbHonorTitle[i] ~= nil and tbHonorTitle[i].Id > 0)
|
||||
end
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:SetSelect(bSelect)
|
||||
self._mapNode.goSelect:SetActive(bSelect)
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:Awake()
|
||||
self.nEmergencyTime = ConfigTable.GetConfigNumber("TraceHuntHelpEmergencyTime")
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:OnEnable()
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:OnDisable()
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:OnDestroy()
|
||||
end
|
||||
function TraceHuntFriendGridCtrl:OnBtnClick_Detail(btn)
|
||||
if self.mapData.bFriend == false then
|
||||
local bDone = false
|
||||
for _, v in pairs(self._panel.tbAddCache) do
|
||||
if v == self.mapFriend.nUId then
|
||||
bDone = true
|
||||
break
|
||||
end
|
||||
end
|
||||
local callback = function()
|
||||
table.insert(self._panel.tbAddCache, self.mapFriend.nUId)
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.FriendCarte, self.mapFriend, self.nType, bDone, callback)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.FriendCarte, self.mapFriend, self.nType)
|
||||
end
|
||||
end
|
||||
return TraceHuntFriendGridCtrl
|
||||
@@ -0,0 +1,103 @@
|
||||
local TraceHuntHandBookCtrl = class("TraceHuntHandBookCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
TraceHuntHandBookCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
TraceHuntHandBookCtrl._mapEventConfig = {}
|
||||
function TraceHuntHandBookCtrl:RefreshContent()
|
||||
self:RefreshData()
|
||||
self:RefreshList()
|
||||
end
|
||||
function TraceHuntHandBookCtrl:RefreshData()
|
||||
local tbCollection, tbBossList = PlayerData.TraceHunt:GetBossCollection()
|
||||
self.nBossCount = #tbBossList
|
||||
if self.nBossCount == 0 then
|
||||
return
|
||||
end
|
||||
self.tbBoss = {}
|
||||
for i = 1, self.nBossCount do
|
||||
local nBossId = tbBossList[i]
|
||||
local mapBossData = tbCollection[nBossId]
|
||||
local mapBossCfg = ConfigTable.GetData("TraceHuntBoss", nBossId)
|
||||
self.tbBoss[i] = {
|
||||
nId = tbBossList[i],
|
||||
bFind = false,
|
||||
bSp = false,
|
||||
nCompleteHuntCount = 0,
|
||||
nAssistHuntCount = 0
|
||||
}
|
||||
if mapBossData then
|
||||
self.tbBoss[i].bFind = true
|
||||
self.tbBoss[i].nCompleteHuntCount = mapBossData.nCompleteHuntCount
|
||||
self.tbBoss[i].nAssistHuntCount = mapBossData.nAssistHuntCount
|
||||
end
|
||||
if mapBossCfg then
|
||||
self.tbBoss[i].bSp = mapBossCfg.IsSpecial
|
||||
end
|
||||
end
|
||||
end
|
||||
function TraceHuntHandBookCtrl:RefreshList()
|
||||
self._mapNode.sv.gameObject:SetActive(self.nBossCount > 0)
|
||||
if self.nBossCount > 0 then
|
||||
self._mapNode.sv:SetAnim(0.04)
|
||||
self._mapNode.sv:Init(self.nBossCount, self, self.OnGridRefresh)
|
||||
end
|
||||
end
|
||||
function TraceHuntHandBookCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbBoss[nIndex]
|
||||
local txtName = goGrid.transform:Find("btnGrid/AnimRoot/txtName"):GetComponent("TMP_Text")
|
||||
local imgIcon = goGrid.transform:Find("btnGrid/AnimRoot/imgIcon"):GetComponent("Image")
|
||||
local imgIconGray = goGrid.transform:Find("btnGrid/AnimRoot/imgIconGray"):GetComponent("Image")
|
||||
local goActivity = goGrid.transform:Find("btnGrid/AnimRoot/goActivity").gameObject
|
||||
local txtActivity = goGrid.transform:Find("btnGrid/AnimRoot/goActivity/txtActivity"):GetComponent("TMP_Text")
|
||||
local goOn = goGrid.transform:Find("btnGrid/AnimRoot/goOn").gameObject
|
||||
local goOff = goGrid.transform:Find("btnGrid/AnimRoot/goOff").gameObject
|
||||
local txtCompleteTitle = goGrid.transform:Find("btnGrid/AnimRoot/goOn/txtCompleteTitle"):GetComponent("TMP_Text")
|
||||
local txtHelpTitle = goGrid.transform:Find("btnGrid/AnimRoot/goOn/txtHelpTitle"):GetComponent("TMP_Text")
|
||||
local txtCompleteCount = goGrid.transform:Find("btnGrid/AnimRoot/goOn/txtCompleteCount"):GetComponent("TMP_Text")
|
||||
local txtHelpCount = goGrid.transform:Find("btnGrid/AnimRoot/goOn/txtHelpCount"):GetComponent("TMP_Text")
|
||||
local mapBossCfg = ConfigTable.GetData("TraceHuntBoss", mapData.nId)
|
||||
if mapData.bFind and mapBossCfg then
|
||||
local mData = ConfigTable.GetData("Monster", mapBossCfg.MonsterId)
|
||||
local mSkin = ConfigTable.GetData("MonsterSkin", mData.FAId)
|
||||
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
|
||||
NovaAPI.SetTMPText(txtName, mManual.Name)
|
||||
else
|
||||
NovaAPI.SetTMPText(txtName, ConfigTable.GetUIText("TraceHunt_HandBook_DefaultName"))
|
||||
end
|
||||
if mapBossCfg then
|
||||
self:SetPngSprite(imgIcon, mapBossCfg.ProfileIcon)
|
||||
self:SetPngSprite(imgIconGray, mapBossCfg.ProfileIcon)
|
||||
end
|
||||
goActivity:SetActive(mapData.bSp)
|
||||
NovaAPI.SetTMPText(txtActivity, ConfigTable.GetUIText("TraceHunt_HandBook_Activity"))
|
||||
NovaAPI.SetTMPText(txtCompleteTitle, ConfigTable.GetUIText("TraceHunt_HandBook_CompleteTitle"))
|
||||
NovaAPI.SetTMPText(txtCompleteCount, mapData.nCompleteHuntCount)
|
||||
NovaAPI.SetTMPText(txtHelpTitle, ConfigTable.GetUIText("TraceHunt_HandBook_HelpTitle"))
|
||||
NovaAPI.SetTMPText(txtHelpCount, mapData.nAssistHuntCount)
|
||||
imgIcon.gameObject:SetActive(mapData.bFind)
|
||||
imgIconGray.gameObject:SetActive(not mapData.bFind)
|
||||
goOn:SetActive(mapData.bFind)
|
||||
goOff:SetActive(not mapData.bFind)
|
||||
end
|
||||
function TraceHuntHandBookCtrl:FadeIn()
|
||||
end
|
||||
function TraceHuntHandBookCtrl:Awake()
|
||||
end
|
||||
function TraceHuntHandBookCtrl:OnEnable()
|
||||
self:RefreshContent()
|
||||
end
|
||||
function TraceHuntHandBookCtrl:OnDisable()
|
||||
end
|
||||
function TraceHuntHandBookCtrl:OnDestroy()
|
||||
end
|
||||
function TraceHuntHandBookCtrl:OnEvent_Select()
|
||||
end
|
||||
return TraceHuntHandBookCtrl
|
||||
@@ -0,0 +1,16 @@
|
||||
local TraceHuntHandBookPanel = class("TraceHuntHandBookPanel", BasePanel)
|
||||
TraceHuntHandBookPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TraceHuntLevelSelect/TraceHuntHandBookPanel.prefab",
|
||||
sCtrlName = "Game.UI.TraceHunt.TraceHuntHandBookCtrl"
|
||||
}
|
||||
}
|
||||
function TraceHuntHandBookPanel:Awake()
|
||||
end
|
||||
function TraceHuntHandBookPanel:OnEnable()
|
||||
end
|
||||
function TraceHuntHandBookPanel:OnDisable()
|
||||
end
|
||||
function TraceHuntHandBookPanel:OnDestroy()
|
||||
end
|
||||
return TraceHuntHandBookPanel
|
||||
@@ -0,0 +1,340 @@
|
||||
local TraceHuntHelpCtrl = class("TraceHuntHelpCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
TraceHuntHelpCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
Info = {sNodeName = "---Info---"},
|
||||
List = {sNodeName = "---List---"},
|
||||
goBoss = {},
|
||||
imgBossIcon = {sComponentName = "Image"},
|
||||
txtBossName = {sComponentName = "TMP_Text"},
|
||||
btnHunt = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Hunt"
|
||||
},
|
||||
txtBtnHunt = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Btn_HelpHunt"
|
||||
},
|
||||
imgReqHuntIcon = {sComponentName = "Image"},
|
||||
txtReqHuntCount = {sComponentName = "TMP_Text"},
|
||||
txtGetReview = {sComponentName = "TMP_Text"},
|
||||
txtBossEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Help_BossEmpty"
|
||||
},
|
||||
srFriendList = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
trSv = {
|
||||
sNodeName = "srFriendList",
|
||||
sComponentName = "Transform"
|
||||
},
|
||||
btnAddFriend = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
txtBtnAdd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Btn_FriendAdd"
|
||||
},
|
||||
btnRecommend = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Recommend"
|
||||
},
|
||||
txtBtnRecommend = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Btn_FriendRecommend"
|
||||
},
|
||||
imgEmptyBg = {},
|
||||
txtEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Help_ListEmpty"
|
||||
},
|
||||
blur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnBlur = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_ClosePop"
|
||||
},
|
||||
Recommend = {
|
||||
sNodeName = "---Recommend---",
|
||||
sCtrlName = "Game.UI.FriendEx.FriendRecommendCtrl"
|
||||
},
|
||||
goResCoin2 = {},
|
||||
btnResCoin = {
|
||||
nCount = 2,
|
||||
sNodeName = "goResCoin",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CoinTips"
|
||||
},
|
||||
imgResCoin = {nCount = 2, sComponentName = "Image"},
|
||||
txtResCount = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
goTip = {sNodeName = "--Tips--"},
|
||||
btnTipsBg = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_TipsBg"
|
||||
},
|
||||
txtTipsName = {sComponentName = "TMP_Text"},
|
||||
txtTipsContent = {sComponentName = "TMP_Text"},
|
||||
txtDailyCount = {sComponentName = "TMP_Text"},
|
||||
txtDailyTime = {sComponentName = "TMP_Text"},
|
||||
redDotAdd = {},
|
||||
redDotResBar = {}
|
||||
}
|
||||
TraceHuntHelpCtrl._mapEventConfig = {
|
||||
FriendClosePop = "OnBtnClick_ClosePop",
|
||||
[EventId.CoinResChange] = "RefreshRes",
|
||||
TraceHuntItemChange = "RefreshRes"
|
||||
}
|
||||
TraceHuntHelpCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.Friend_Apply] = {sNodeName = "redDotAdd"},
|
||||
[RedDotDefine.TraceHunt_HuntItem] = {
|
||||
sNodeName = "redDotResBar"
|
||||
}
|
||||
}
|
||||
function TraceHuntHelpCtrl:RefreshContent()
|
||||
self:RefreshData()
|
||||
self:RefreshList()
|
||||
self:RefreshBoss()
|
||||
self:RefreshRes()
|
||||
self:StartTicketsRefreshTimer()
|
||||
end
|
||||
function TraceHuntHelpCtrl:RefreshData()
|
||||
self.tbRecommend = PlayerData.TraceHunt:GetHuntRecommend()
|
||||
self.nSelectIndex = 0
|
||||
if next(self.tbRecommend) ~= nil then
|
||||
self.nSelectIndex = 1
|
||||
end
|
||||
end
|
||||
function TraceHuntHelpCtrl:RefreshBoss()
|
||||
if self.nSelectIndex == 0 or next(self.tbRecommend) == nil then
|
||||
self._mapNode.goBoss:SetActive(false)
|
||||
self._mapNode.txtBossEmpty.gameObject:SetActive(true)
|
||||
return
|
||||
end
|
||||
self._mapNode.goBoss:SetActive(true)
|
||||
self._mapNode.txtBossEmpty.gameObject:SetActive(false)
|
||||
local mapData = self.tbRecommend[self.nSelectIndex]
|
||||
local mapBossCfg = ConfigTable.GetData("TraceHuntBoss", mapData.nBossId)
|
||||
if not mapBossCfg then
|
||||
return
|
||||
end
|
||||
self:SetPngSprite(self._mapNode.imgBossIcon, mapBossCfg.Image)
|
||||
local mData = ConfigTable.GetData("Monster", mapBossCfg.MonsterId)
|
||||
local mSkin = ConfigTable.GetData("MonsterSkin", mData.FAId)
|
||||
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossName, mManual.Name)
|
||||
self:RefreshHuntBtn()
|
||||
end
|
||||
function TraceHuntHelpCtrl:RefreshRes()
|
||||
local nCount = PlayerData.Item:GetItemCountByID(AllEnum.CoinItemId.TraceHunt)
|
||||
self:SetSprite_Coin(self._mapNode.imgResCoin[1], AllEnum.CoinItemId.TraceHunt)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtResCount[1], self:ThousandsNumber(nCount))
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
self:SetSprite_Coin(self._mapNode.imgResCoin[2], nId)
|
||||
local tbMax = ConfigTable.GetConfigArray("TraceHuntPermitItem")
|
||||
local nHasCoin = PlayerData.TraceHunt:GetHuntTokenCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtResCount[2], self:ThousandsNumber(nHasCoin) .. "/" .. tbMax[3])
|
||||
end
|
||||
function TraceHuntHelpCtrl:RefreshHuntBtn()
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
local nCost = PlayerData.TraceHunt:GetHuntCostCount()
|
||||
local nHasCoin = PlayerData.TraceHunt:GetHuntTokenCount()
|
||||
self:SetSprite_Coin(self._mapNode.imgReqHuntIcon, nId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtReqHuntCount, math.ceil(nCost))
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtReqHuntCount, nCost <= nHasCoin and Blue_Normal or Red_Unable)
|
||||
local nMin, nMax = PlayerData.TraceHunt:GetHuntRewardRange()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetReview, orderedFormat(ConfigTable.GetUIText("TraceHunt_Help_HuntRewardRange"), nMin, nMax))
|
||||
end
|
||||
function TraceHuntHelpCtrl:RefreshList()
|
||||
for nInstanceId, objCtrl in pairs(self.tbGridCtrl) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[nInstanceId] = nil
|
||||
end
|
||||
local nCount = #self.tbRecommend
|
||||
self._mapNode.srFriendList.gameObject:SetActive(0 < nCount)
|
||||
self._mapNode.imgEmptyBg:SetActive(nCount == 0)
|
||||
if 0 < nCount then
|
||||
self._mapNode.srFriendList:SetAnim(0.04)
|
||||
self._mapNode.srFriendList:Init(nCount, self, self.OnGridRefresh, self.OnGridBtnClick)
|
||||
end
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapData = self.tbRecommend[nIndex]
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if not self.tbGridCtrl[nInstanceID] then
|
||||
self.tbGridCtrl[nInstanceID] = self:BindCtrlByNode(goGrid, "Game.UI.TraceHunt.TraceHuntFriendGridCtrl")
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:Refresh(mapData)
|
||||
self.tbGridCtrl[nInstanceID]:SetSelect(self.nSelectIndex == nIndex)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnGridBtnClick(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local nInstanceID = goGrid:GetInstanceID()
|
||||
if self.nSelectIndex then
|
||||
local goSelect = self._mapNode.trSv:Find("Viewport/Content/" .. self.nSelectIndex - 1)
|
||||
if goSelect then
|
||||
self.tbGridCtrl[goSelect.gameObject:GetInstanceID()]:SetSelect(false)
|
||||
end
|
||||
end
|
||||
self.tbGridCtrl[nInstanceID]:SetSelect(true)
|
||||
self.nSelectIndex = nIndex
|
||||
self:RefreshBoss()
|
||||
end
|
||||
function TraceHuntHelpCtrl:StartTicketsRefreshTimer()
|
||||
if self.ticketRefreshTimer ~= nil then
|
||||
self.ticketRefreshTimer:Cancel()
|
||||
self.ticketRefreshTimer = nil
|
||||
end
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local nNextRefreshTime = CS.ClientManager.Instance:GetNextRefreshTime(nCurTime)
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nId)
|
||||
local refreshTime = function()
|
||||
nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = nNextRefreshTime - nCurTime
|
||||
local sTime = timeFormat_HMS(nRemainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDailyTime, orderedFormat(ConfigTable.GetUIText("TraceHunt_Coin_Time"), mapItemCfg.Title, sTime))
|
||||
end
|
||||
refreshTime()
|
||||
self.ticketRefreshTimer = self:AddTimer(0, 1, function()
|
||||
refreshTime()
|
||||
end, true, true, true)
|
||||
end
|
||||
function TraceHuntHelpCtrl:PlayInAni()
|
||||
if self._panel._nFadeInType == 1 then
|
||||
if #self.tbRecommend > 0 then
|
||||
self.animator:Play("TraceHuntHelpPanel_in1", 0, 0)
|
||||
else
|
||||
self.animator:Play("TraceHuntHelpPanel_in2", 0, 0)
|
||||
end
|
||||
elseif #self.tbRecommend > 0 then
|
||||
self.animator:Play("TraceHuntHelpPanel_in1", 0, 1)
|
||||
else
|
||||
self.animator:Play("TraceHuntHelpPanel_in2", 0, 1)
|
||||
end
|
||||
end
|
||||
function TraceHuntHelpCtrl:FadeIn()
|
||||
end
|
||||
function TraceHuntHelpCtrl:Awake()
|
||||
self.tbGridCtrl = {}
|
||||
self._mapNode.Info:SetActive(false)
|
||||
self._mapNode.List:SetActive(false)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnEnable()
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
self._mapNode.Info:SetActive(false)
|
||||
self._mapNode.List:SetActive(false)
|
||||
local callback = function()
|
||||
self._mapNode.Info:SetActive(true)
|
||||
self._mapNode.List:SetActive(true)
|
||||
self:RefreshContent()
|
||||
self:PlayInAni()
|
||||
PlayerData.Friend:TryOpenFriendAddStranger()
|
||||
end
|
||||
PlayerData.TraceHunt:SendTraceHuntRecommendReq(callback)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnDisable()
|
||||
if self.tbGridCtrl then
|
||||
for k, objCtrl in pairs(self.tbGridCtrl) do
|
||||
local obj = objCtrl.gameObject
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.tbGridCtrl[k] = nil
|
||||
destroyImmediate(obj)
|
||||
end
|
||||
self.tbGridCtrl = {}
|
||||
end
|
||||
self._panel._nFadeInType = 2
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnDestroy()
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnBtnClick_Hunt(btn)
|
||||
if self.nSelectIndex == 0 or next(self.tbRecommend) == nil then
|
||||
return
|
||||
end
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
local nCost = PlayerData.TraceHunt:GetHuntCostCount()
|
||||
local nHasCoin = PlayerData.TraceHunt:GetHuntTokenCount()
|
||||
if nCost > nHasCoin then
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nId)
|
||||
EventManager.Hit(EventId.OpenMessageBox, orderedFormat(ConfigTable.GetUIText("TraceHunt_Tips_HuntItemNotEnough"), mapItemCfg.Title))
|
||||
return
|
||||
end
|
||||
if 0 >= PlayerData.TraceHunt:GetControlLeftTime() then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TraceHunt_Tips_ControlInterrupt"))
|
||||
return
|
||||
end
|
||||
local nBossCreateTime = self.tbRecommend[self.nSelectIndex].nBossCreateTime
|
||||
local nLeft = nBossCreateTime + ConfigTable.GetConfigNumber("TraceHuntBossHuntLimitTime") - ClientManager.serverTimeStamp
|
||||
if nLeft <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("TraceHunt_Tips_HuntInterrupt"))
|
||||
return
|
||||
end
|
||||
local OpenPanel = function()
|
||||
local nBossId = self.tbRecommend[self.nSelectIndex].nBossId
|
||||
local nUID = self.tbRecommend[self.nSelectIndex].nUID
|
||||
if self.tbRecommend[self.nSelectIndex].bFriend == false then
|
||||
local mapFriend = self.tbRecommend[self.nSelectIndex].mapFriend
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.TraceHunt, nBossId, {
|
||||
nUID,
|
||||
nBossCreateTime,
|
||||
mapFriend
|
||||
})
|
||||
else
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RegionBossFormation, AllEnum.RegionBossFormationType.TraceHunt, nBossId, {nUID, nBossCreateTime})
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.SetTransition, 2, OpenPanel)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnBtnClick_Add(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.Friend, 3)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnBtnClick_Recommend(btn)
|
||||
local callback = function(mapData)
|
||||
self._mapNode.Recommend:Open(mapData)
|
||||
self._mapNode.blur:SetActive(true)
|
||||
end
|
||||
PlayerData.Friend:SendFriendRecommendationGetReq(callback)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnBtnClick_ClosePop(btn)
|
||||
self._mapNode.Recommend:PlayOutAni()
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
self:AddTimer(1, 0.2, function()
|
||||
self._mapNode.blur:SetActive(false)
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnBtnClick_CoinTips(btn, nIndex)
|
||||
if nIndex == 1 then
|
||||
UTILS.ClickItemGridWithTips(AllEnum.CoinItemId.TraceHunt, self._mapNode.btnResCoin[1].transform, true, true, false)
|
||||
else
|
||||
self._mapNode.goTip.gameObject:SetActive(true)
|
||||
local sortingOrder = NovaAPI.GetCanvasSortingOrder(self.gameObject:GetComponent("Canvas"))
|
||||
NovaAPI.SetButtonInteractable(self._mapNode.btnResCoin[2], false)
|
||||
NovaAPI.SetComponentEnableByName(self._mapNode.goResCoin2, "TopGridCanvas", true)
|
||||
NovaAPI.SetTopGridCanvasSorting(self._mapNode.goResCoin2, sortingOrder + 1)
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTipsName, mapItemCfg.Title)
|
||||
local tbMax = ConfigTable.GetConfigArray("TraceHuntPermitItem")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTipsContent, orderedFormat(ConfigTable.GetUIText("TraceHunt_Coin_Rule"), tbMax[1], mapItemCfg.Title))
|
||||
local nDaily = PlayerData.TraceHunt:GetHuntTokenDailyCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDailyCount, orderedFormat(ConfigTable.GetUIText("TraceHunt_Coin_Daily"), nDaily, tbMax[2]))
|
||||
end
|
||||
end
|
||||
function TraceHuntHelpCtrl:OnBtnClick_TipsBg()
|
||||
NovaAPI.SetButtonInteractable(self._mapNode.btnResCoin[2], true)
|
||||
NovaAPI.SetComponentEnableByName(self._mapNode.goResCoin2, "TopGridCanvas", false)
|
||||
self._mapNode.goTip.gameObject:SetActive(false)
|
||||
end
|
||||
return TraceHuntHelpCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local TraceHuntHelpPanel = class("TraceHuntHelpPanel", BasePanel)
|
||||
TraceHuntHelpPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TraceHuntLevelSelect/TraceHuntHelpPanel.prefab",
|
||||
sCtrlName = "Game.UI.TraceHunt.TraceHuntHelpCtrl"
|
||||
}
|
||||
}
|
||||
function TraceHuntHelpPanel:Awake()
|
||||
self.tbAddCache = {}
|
||||
end
|
||||
function TraceHuntHelpPanel:OnEnable()
|
||||
end
|
||||
function TraceHuntHelpPanel:OnDisable()
|
||||
end
|
||||
function TraceHuntHelpPanel:OnDestroy()
|
||||
end
|
||||
return TraceHuntHelpPanel
|
||||
@@ -0,0 +1,255 @@
|
||||
local TraceHuntLevelCtrl = class("TraceHuntLevelCtrl", BaseCtrl)
|
||||
local GridNormalHeight = 77
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
TraceHuntLevelCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Level_Title"
|
||||
},
|
||||
txtLevelTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Level_CurLevel"
|
||||
},
|
||||
btnSnapshot = {
|
||||
sNodeName = "snapshot",
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
aniRoot = {sNodeName = "goWindow", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sNodeName = "btnClose",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtn_ClickClose"
|
||||
},
|
||||
goCountRewardInfo_ = {nCount = 5},
|
||||
txtRewardInfoCount = {nCount = 5, sComponentName = "TMP_Text"},
|
||||
goCountLine_ = {nCount = 4},
|
||||
goCountHeight = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
svReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtLevelCount = {sComponentName = "TMP_Text"},
|
||||
txtLevelProgress = {sComponentName = "TMP_Text"},
|
||||
txtLevelReset = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Level_Reset"
|
||||
},
|
||||
imgLevelProgress = {sComponentName = "Image"}
|
||||
}
|
||||
TraceHuntLevelCtrl._mapEventConfig = {}
|
||||
function TraceHuntLevelCtrl:RefreshContent()
|
||||
self:RefreshData()
|
||||
self:RefreshList()
|
||||
self:RefreshInfo()
|
||||
end
|
||||
function TraceHuntLevelCtrl:RefreshData()
|
||||
self.tbHeight = {}
|
||||
self.tbLevel = {}
|
||||
local nMaxLevel = PlayerData.TraceHunt:GetTraceHuntMaxLevel()
|
||||
for i = 1, nMaxLevel do
|
||||
local mapLevel = PlayerData.TraceHunt:GetTraceHuntLevelData(i)
|
||||
local bHasMaxStar = mapLevel.DisplayMaxStar > 0
|
||||
local bHasTokenRate = 0 < mapLevel.DisplayTokenRate
|
||||
local bHasFreeRate = 0 < mapLevel.DisplayFreeRate
|
||||
local bHasAddRate = 0 < mapLevel.DisplayAddRate
|
||||
local bHasLuckyRate = 0 < mapLevel.DisplayLuckyRate
|
||||
local nCount = 0
|
||||
self._mapNode.goCountRewardInfo_[1]:SetActive(bHasMaxStar)
|
||||
if bHasMaxStar then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardInfoCount[1], orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_MaxStar"), mapLevel.DisplayMaxStar))
|
||||
nCount = nCount + 1
|
||||
end
|
||||
self._mapNode.goCountRewardInfo_[2]:SetActive(bHasTokenRate)
|
||||
if bHasTokenRate then
|
||||
local sTitle = ConfigTable.GetData_Item(AllEnum.CoinItemId.TraceHunt).Title
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardInfoCount[2], orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_TokenRate"), sTitle, mapLevel.DisplayTokenRate))
|
||||
nCount = nCount + 1
|
||||
end
|
||||
self._mapNode.goCountRewardInfo_[3]:SetActive(bHasFreeRate)
|
||||
if bHasFreeRate then
|
||||
local sTitle = ConfigTable.GetData_Item(ConfigTable.GetConfigNumber("TraceHuntRequestItemTid")).Title
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardInfoCount[3], orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_FreeRate"), sTitle, mapLevel.DisplayFreeRate))
|
||||
nCount = nCount + 1
|
||||
end
|
||||
self._mapNode.goCountRewardInfo_[4]:SetActive(bHasAddRate)
|
||||
if bHasAddRate then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardInfoCount[4], orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_AddRate"), mapLevel.DisplayAddRate))
|
||||
nCount = nCount + 1
|
||||
end
|
||||
self._mapNode.goCountRewardInfo_[5]:SetActive(bHasLuckyRate)
|
||||
if bHasLuckyRate then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRewardInfoCount[5], orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_LuckyRate"), mapLevel.DisplayLuckyRate))
|
||||
nCount = nCount + 1
|
||||
end
|
||||
for j = 1, 4 do
|
||||
self._mapNode.goCountLine_[j]:SetActive(j < nCount)
|
||||
end
|
||||
if 0 < nCount then
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(self._mapNode.goCountHeight)
|
||||
local nH = self._mapNode.goCountHeight.rect.height + GridNormalHeight
|
||||
table.insert(self.tbHeight, nH)
|
||||
table.insert(self.tbLevel, mapLevel)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TraceHuntLevelCtrl:RefreshList()
|
||||
local nLevel, _ = PlayerData.TraceHunt:GetTraceHuntLevel()
|
||||
local nMax = #self.tbLevel
|
||||
local nSelect
|
||||
for k, v in ipairs(self.tbLevel) do
|
||||
if v.Level == nLevel then
|
||||
nSelect = k
|
||||
break
|
||||
elseif nLevel < v.Level then
|
||||
nSelect = k - 1
|
||||
break
|
||||
end
|
||||
end
|
||||
if nSelect == nil then
|
||||
nSelect = nMax
|
||||
end
|
||||
nSelect = nSelect == 0 and 1 or nSelect
|
||||
self._mapNode.svReward.gameObject:SetActive(0 < nMax)
|
||||
if 0 < nMax then
|
||||
self._mapNode.svReward:SetAnim(0.07)
|
||||
self._mapNode.svReward:InitEx(self.tbHeight, self, self.OnGridRefresh)
|
||||
self._mapNode.svReward:SetScrollGridPosEx(self.tbHeight, nSelect, 0.1, 0)
|
||||
end
|
||||
end
|
||||
function TraceHuntLevelCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local index = gridIndex + 1
|
||||
local nCurLevel, _ = PlayerData.TraceHunt:GetTraceHuntLevel()
|
||||
local nLevel = self.tbLevel[index].Level
|
||||
local mapLevel = PlayerData.TraceHunt:GetTraceHuntLevelData(nLevel)
|
||||
local trans = goGrid.transform:Find("AnimRoot")
|
||||
local goTitle = trans:Find("goTitle")
|
||||
local goUnlock = goTitle:Find("goUnlock")
|
||||
local goLock = goTitle:Find("goLock")
|
||||
local txtLevel = goUnlock:Find("txtLevel"):GetComponent("TMP_Text")
|
||||
local txtLevelName1 = goUnlock:Find("txtLevelName"):GetComponent("TMP_Text")
|
||||
local txtLevel_Lock = goLock:Find("txtLevelName/txtLevel_Lock"):GetComponent("TMP_Text")
|
||||
local txtLevelName2 = goLock:Find("txtLevelName"):GetComponent("TMP_Text")
|
||||
local txtLevelLimit = goLock:Find("txtLevelLimit"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtLevelName1, ConfigTable.GetUIText("TraceHunt_Level_LevelName"))
|
||||
NovaAPI.SetTMPText(txtLevelName2, ConfigTable.GetUIText("TraceHunt_Level_LevelName"))
|
||||
NovaAPI.SetTMPText(txtLevel, nLevel)
|
||||
NovaAPI.SetTMPText(txtLevel_Lock, nLevel)
|
||||
txtLevelLimit.gameObject:SetActive(mapLevel.DisplayWorldClass > 0)
|
||||
if mapLevel.DisplayWorldClass > 0 then
|
||||
NovaAPI.SetTMPText(txtLevelLimit, orderedFormat(ConfigTable.GetUIText("TraceHunt_Level_NeedWorldClass"), mapLevel.DisplayWorldClass))
|
||||
end
|
||||
goLock.gameObject:SetActive(nCurLevel < nLevel)
|
||||
goUnlock.gameObject:SetActive(nCurLevel >= nLevel)
|
||||
local goRewardRoot = trans:Find("goRewardInfoList")
|
||||
local bHasMaxStar = 0 < mapLevel.DisplayMaxStar
|
||||
local bHasTokenRate = 0 < mapLevel.DisplayTokenRate
|
||||
local bHasFreeRate = 0 < mapLevel.DisplayFreeRate
|
||||
local bHasAddRate = 0 < mapLevel.DisplayAddRate
|
||||
local bHasLuckyRate = 0 < mapLevel.DisplayLuckyRate
|
||||
local nCount = 0
|
||||
local goReward_1 = goRewardRoot:Find("goRewardInfo_" .. 1)
|
||||
goReward_1.gameObject:SetActive(bHasMaxStar)
|
||||
if bHasMaxStar then
|
||||
local cgGoReward = goReward_1:GetComponent("CanvasGroup")
|
||||
local txtRewardInfo = goReward_1:Find("txtRewardInfo"):GetComponent("TMP_Text")
|
||||
local imgRewardIcon1 = goReward_1:Find("goReward/imgRewardIcon1").gameObject
|
||||
local imgRewardIcon2 = goReward_1:Find("goReward/imgRewardIcon2").gameObject
|
||||
NovaAPI.SetTMPText(txtRewardInfo, orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_MaxStar"), mapLevel.DisplayMaxStar))
|
||||
imgRewardIcon1:SetActive(false)
|
||||
imgRewardIcon2:SetActive(true)
|
||||
NovaAPI.SetCanvasGroupAlpha(cgGoReward, nCurLevel < nLevel and 0.4 or 1)
|
||||
nCount = nCount + 1
|
||||
end
|
||||
local goReward_2 = goRewardRoot:Find("goRewardInfo_" .. 2)
|
||||
goReward_2.gameObject:SetActive(bHasTokenRate)
|
||||
if bHasTokenRate then
|
||||
local cgGoReward = goReward_2:GetComponent("CanvasGroup")
|
||||
local txtRewardInfo = goReward_2:Find("txtRewardInfo"):GetComponent("TMP_Text")
|
||||
local imgRewardIcon1 = goReward_2:Find("goReward/imgRewardIcon1").gameObject
|
||||
local imgRewardIcon2 = goReward_2:Find("goReward/imgRewardIcon2").gameObject
|
||||
local sTitle = ConfigTable.GetData_Item(AllEnum.CoinItemId.TraceHunt).Title
|
||||
NovaAPI.SetTMPText(txtRewardInfo, orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_TokenRate"), sTitle, mapLevel.DisplayTokenRate))
|
||||
imgRewardIcon1:SetActive(false)
|
||||
imgRewardIcon2:SetActive(true)
|
||||
NovaAPI.SetCanvasGroupAlpha(cgGoReward, nCurLevel < nLevel and 0.4 or 1)
|
||||
nCount = nCount + 1
|
||||
end
|
||||
local goReward_3 = goRewardRoot:Find("goRewardInfo_" .. 3)
|
||||
goReward_3.gameObject:SetActive(bHasFreeRate)
|
||||
if bHasFreeRate then
|
||||
local cgGoReward = goReward_3:GetComponent("CanvasGroup")
|
||||
local txtRewardInfo = goReward_3:Find("txtRewardInfo"):GetComponent("TMP_Text")
|
||||
local imgRewardIcon1 = goReward_3:Find("goReward/imgRewardIcon1").gameObject
|
||||
local imgRewardIcon2 = goReward_3:Find("goReward/imgRewardIcon2").gameObject
|
||||
local sTitle = ConfigTable.GetData_Item(ConfigTable.GetConfigNumber("TraceHuntRequestItemTid")).Title
|
||||
NovaAPI.SetTMPText(txtRewardInfo, orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_FreeRate"), sTitle, mapLevel.DisplayFreeRate))
|
||||
imgRewardIcon1:SetActive(false)
|
||||
imgRewardIcon2:SetActive(true)
|
||||
NovaAPI.SetCanvasGroupAlpha(cgGoReward, nCurLevel < nLevel and 0.4 or 1)
|
||||
nCount = nCount + 1
|
||||
end
|
||||
local goReward_4 = goRewardRoot:Find("goRewardInfo_" .. 4)
|
||||
goReward_4.gameObject:SetActive(bHasAddRate)
|
||||
if bHasAddRate then
|
||||
local cgGoReward = goReward_4:GetComponent("CanvasGroup")
|
||||
local txtRewardInfo = goReward_4:Find("txtRewardInfo"):GetComponent("TMP_Text")
|
||||
local imgRewardIcon1 = goReward_4:Find("goReward/imgRewardIcon1").gameObject
|
||||
local imgRewardIcon2 = goReward_4:Find("goReward/imgRewardIcon2").gameObject
|
||||
NovaAPI.SetTMPText(txtRewardInfo, orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_AddRate"), mapLevel.DisplayAddRate))
|
||||
imgRewardIcon1:SetActive(true)
|
||||
imgRewardIcon2:SetActive(false)
|
||||
NovaAPI.SetCanvasGroupAlpha(cgGoReward, nCurLevel < nLevel and 0.4 or 1)
|
||||
nCount = nCount + 1
|
||||
end
|
||||
local goReward_5 = goRewardRoot:Find("goRewardInfo_" .. 5)
|
||||
goReward_5.gameObject:SetActive(bHasLuckyRate)
|
||||
if bHasLuckyRate then
|
||||
local cgGoReward = goReward_5:GetComponent("CanvasGroup")
|
||||
local txtRewardInfo = goReward_5:Find("txtRewardInfo"):GetComponent("TMP_Text")
|
||||
local imgRewardIcon1 = goReward_5:Find("goReward/imgRewardIcon1").gameObject
|
||||
local imgRewardIcon2 = goReward_5:Find("goReward/imgRewardIcon2").gameObject
|
||||
NovaAPI.SetTMPText(txtRewardInfo, orderedFormat(ConfigTable.GetUIText("TraceHunt_LevelEffect_LuckyRate"), mapLevel.DisplayLuckyRate))
|
||||
imgRewardIcon1:SetActive(true)
|
||||
imgRewardIcon2:SetActive(false)
|
||||
NovaAPI.SetCanvasGroupAlpha(cgGoReward, nCurLevel < nLevel and 0.4 or 1)
|
||||
nCount = nCount + 1
|
||||
end
|
||||
for j = 1, 4 do
|
||||
goRewardRoot:Find("goLine_" .. j).gameObject:SetActive(j < nCount)
|
||||
end
|
||||
end
|
||||
function TraceHuntLevelCtrl:RefreshInfo()
|
||||
local nLevel, nExp = PlayerData.TraceHunt:GetTraceHuntLevel()
|
||||
local mapLevel = PlayerData.TraceHunt:GetTraceHuntLevelData(nLevel)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelCount, nLevel)
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgLevelProgress, nExp / mapLevel.Exp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLevelProgress, orderedFormat(ConfigTable.GetUIText("TraceHunt_Level_Progress"), nExp, mapLevel.Exp))
|
||||
end
|
||||
function TraceHuntLevelCtrl:FadeIn()
|
||||
end
|
||||
function TraceHuntLevelCtrl:Awake()
|
||||
end
|
||||
function TraceHuntLevelCtrl:OnEnable()
|
||||
self._mapNode.aniRoot:Play("t_window_04_t_in")
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
self:RefreshContent()
|
||||
end
|
||||
function TraceHuntLevelCtrl:OnDisable()
|
||||
end
|
||||
function TraceHuntLevelCtrl:OnDestroy()
|
||||
end
|
||||
function TraceHuntLevelCtrl:OnBtn_ClickClose()
|
||||
self._mapNode.aniRoot:Play("t_window_04_t_out")
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
self:AddTimer(1, 0.3, "OnCloseAnimFinish", true, true, true)
|
||||
end
|
||||
function TraceHuntLevelCtrl:OnCloseAnimFinish()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.TraceHuntLevel)
|
||||
end
|
||||
return TraceHuntLevelCtrl
|
||||
@@ -0,0 +1,81 @@
|
||||
local TraceHuntLevelInfoCtrl = class("TraceHuntLevelInfoCtrl", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
local texCurScoreText = "{0}/<size=28>{1}</size>"
|
||||
TraceHuntLevelInfoCtrl._mapNodeConfig = {
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
texStarCount = {sComponentName = "TMP_Text"},
|
||||
curScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Cur_Score"
|
||||
},
|
||||
texCurScore = {sComponentName = "TMP_Text"},
|
||||
cgRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
animatorTime = {
|
||||
sNodeName = "rtChallengeTime",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
goTips = {},
|
||||
animatorTips = {sNodeName = "goTips", sComponentName = "Animator"},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_MaxStarWin"
|
||||
}
|
||||
}
|
||||
TraceHuntLevelInfoCtrl._mapEventConfig = {
|
||||
TraceHunt_Gameplay_Time = "OnEvent_Time",
|
||||
TraceHunt_Score_Change = "OnEvent_ScoreChange",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
TraceHunt_Restart_Again = "InitMsg",
|
||||
TraceHunt_MaxStar = "OnEvent_MaxStar"
|
||||
}
|
||||
function TraceHuntLevelInfoCtrl:Awake()
|
||||
self:InitMsg()
|
||||
end
|
||||
function TraceHuntLevelInfoCtrl:InitMsg()
|
||||
self.curTotal = 0
|
||||
self.maxStarCount = PlayerData.TraceHunt:GetMaxStar()
|
||||
NovaAPI.SetTMPText(self._mapNode.texStarCount, self.curTotal)
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
local nTime = ConfigTable.GetConfigNumber("TraceHuntBossTimeLimit")
|
||||
self:OnEvent_Time(nTime)
|
||||
local need = PlayerData.TraceHunt:GetStarScore(1)
|
||||
NovaAPI.SetTMPText(self._mapNode.texCurScore, orderedFormat(texCurScoreText, 0, need))
|
||||
self._mapNode.goTips:SetActive(false)
|
||||
end
|
||||
function TraceHuntLevelInfoCtrl:OnEvent_Time(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
if nTime <= 15 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
self._mapNode.animatorTime:Play("BossChallengeTime_show")
|
||||
end
|
||||
end
|
||||
function TraceHuntLevelInfoCtrl:OnEvent_ScoreChange()
|
||||
local totalStar = PlayerData.TraceHunt:ScoreToStar()
|
||||
local totalScore = PlayerData.TraceHunt:GetTotalScore()
|
||||
local tmpLv = totalStar == self.maxStarCount and self.maxStarCount or totalStar + 1
|
||||
local need = PlayerData.TraceHunt:GetStarScore(tmpLv)
|
||||
NovaAPI.SetTMPText(self._mapNode.texCurScore, orderedFormat(texCurScoreText, totalScore, need))
|
||||
if totalStar > self.curTotal then
|
||||
self.curTotal = totalStar
|
||||
NovaAPI.SetTMPText(self._mapNode.texStarCount, self.curTotal)
|
||||
end
|
||||
end
|
||||
function TraceHuntLevelInfoCtrl:OnEvent_MaxStar()
|
||||
self._mapNode.goTips:SetActive(true)
|
||||
self._mapNode.animatorTips:Play("FRRoomInfo_rtnfo_in", 0, 0)
|
||||
self:AddTimer(1, 1.5, function()
|
||||
self._mapNode.animatorTips:Play("FRRoomInfo_rtnfo_out", 0, 0)
|
||||
end, true, true, true)
|
||||
end
|
||||
function TraceHuntLevelInfoCtrl:OnEvent_InputEnable(bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgRoot, bEnable == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgRoot, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.cgRoot, bEnable == true)
|
||||
end
|
||||
return TraceHuntLevelInfoCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local TraceHuntLevelPanel = class("TraceHuntLevelPanel", BasePanel)
|
||||
TraceHuntLevelPanel._bIsMainPanel = false
|
||||
TraceHuntLevelPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TraceHuntLevelSelect/TraceHuntLevelPanel.prefab",
|
||||
sCtrlName = "Game.UI.TraceHunt.TraceHuntLevelCtrl"
|
||||
}
|
||||
}
|
||||
function TraceHuntLevelPanel:Awake()
|
||||
end
|
||||
function TraceHuntLevelPanel:OnEnable()
|
||||
end
|
||||
function TraceHuntLevelPanel:OnDisable()
|
||||
end
|
||||
function TraceHuntLevelPanel:OnDestroy()
|
||||
end
|
||||
return TraceHuntLevelPanel
|
||||
@@ -0,0 +1,125 @@
|
||||
local TraceHuntLogCtrl = class("TraceHuntLogCtrl", BaseCtrl)
|
||||
local LayoutRebuilder = CS.UnityEngine.UI.LayoutRebuilder
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local TypeToAni = {
|
||||
[1] = 1,
|
||||
[2] = 5,
|
||||
[3] = 2,
|
||||
[4] = 2,
|
||||
[5] = 3,
|
||||
[6] = 3,
|
||||
[7] = 1,
|
||||
[8] = 1,
|
||||
[9] = 4
|
||||
}
|
||||
TraceHuntLogCtrl._mapNodeConfig = {
|
||||
txtLog = {sComponentName = "TMP_Text"},
|
||||
goLogParam = {nCount = 2},
|
||||
txtLogParam = {nCount = 2, sComponentName = "TMP_Text"}
|
||||
}
|
||||
TraceHuntLogCtrl._mapEventConfig = {}
|
||||
function TraceHuntLogCtrl:Refresh(mapLog)
|
||||
local mapCfg = ConfigTable.GetData("TraceHuntLogEntryTemplate", mapLog.nId)
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
self.nType = mapCfg.Type
|
||||
self.nAniIndex = TypeToAni[mapCfg.Template]
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLog, mapCfg.Desc)
|
||||
if next(mapLog.tbArgs) ~= nil then
|
||||
local nCount = #mapLog.tbArgs
|
||||
for i = 1, 2 do
|
||||
self._mapNode.goLogParam[i]:SetActive(i <= nCount)
|
||||
end
|
||||
if mapCfg.Type == GameEnum.TraceHuntLogType.HuntPlayer then
|
||||
local nMaxHuntProgress = ConfigTable.GetConfigNumber("TraceHuntMaxHuntProgress")
|
||||
local sP = string.format("%.1f", tonumber(mapLog.tbArgs[2]) / nMaxHuntProgress * 100)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLogParam[1], orderedFormat(ConfigTable.GetUIText("TraceHunt_Log_Percent"), sP))
|
||||
elseif mapCfg.Type == GameEnum.TraceHuntLogType.HuntNPC then
|
||||
local nMaxHuntProgress = ConfigTable.GetConfigNumber("TraceHuntMaxHuntProgress")
|
||||
local sP = string.format("%.1f", tonumber(mapLog.tbArgs[1]) / nMaxHuntProgress * 100)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLogParam[1], orderedFormat(ConfigTable.GetUIText("TraceHunt_Log_Percent"), sP))
|
||||
elseif mapCfg.Type == GameEnum.TraceHuntLogType.Tracing then
|
||||
local nMaxTraceProgress = ConfigTable.GetConfigNumber("TraceHuntMaxTraceProgress")
|
||||
local sP = string.format("%.1f", tonumber(mapLog.tbArgs[1]) / nMaxTraceProgress * 100)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLogParam[1], orderedFormat(ConfigTable.GetUIText("TraceHunt_Log_Percent"), sP))
|
||||
if nCount == 3 then
|
||||
local icon = self._mapNode.goLogParam[2].gameObject.transform:Find("icon2"):GetComponent("Image")
|
||||
self:SetSprite_Coin(icon, tonumber(mapLog.tbArgs[2]))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLogParam[2], orderedFormat(ConfigTable.GetUIText("TraceHunt_Log_Count"), mapLog.tbArgs[3]))
|
||||
end
|
||||
self.gameObject.transform:Find("SearchRoot").gameObject:SetActive(false)
|
||||
local txtTracing = self.gameObject.transform:Find("SearchRoot/txtTracing"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtTracing, ConfigTable.GetUIText("TraceHunt_Log_Tracing"))
|
||||
elseif mapCfg.Type == GameEnum.TraceHuntLogType.Settlement then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLogParam[1], orderedFormat(ConfigTable.GetUIText("TraceHunt_Log_Count"), mapLog.tbArgs[1]))
|
||||
end
|
||||
end
|
||||
local nBossId = PlayerData.TraceHunt:GetBossId()
|
||||
local mapBossCfg = ConfigTable.GetData("TraceHuntBoss", nBossId)
|
||||
if not mapBossCfg then
|
||||
return
|
||||
end
|
||||
local mData = ConfigTable.GetData("Monster", mapBossCfg.MonsterId)
|
||||
local mSkin = ConfigTable.GetData("MonsterSkin", mData.FAId)
|
||||
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
|
||||
if mapCfg.Type == GameEnum.TraceHuntLogType.HuntPlayer then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLog, orderedFormat(mapCfg.Desc, mapLog.tbArgs[1]))
|
||||
elseif mapCfg.Type == GameEnum.TraceHuntLogType.HuntPlayerFatal then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLog, orderedFormat(mapCfg.Desc, mapLog.tbArgs[1], mManual.Name))
|
||||
elseif mapCfg.Type == GameEnum.TraceHuntLogType.HuntNPCFatal or mapCfg.Type == GameEnum.TraceHuntLogType.HuntInterrupt then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtLog, orderedFormat(mapCfg.Desc, mManual.Name))
|
||||
end
|
||||
end
|
||||
function TraceHuntLogCtrl:ForceRebuild()
|
||||
local rt = self.gameObject.transform:GetComponent("RectTransform")
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(rt)
|
||||
return rt.rect.height
|
||||
end
|
||||
function TraceHuntLogCtrl:CheckLogPlaying()
|
||||
local bPlayed = self.animator:GetCurrentAnimatorStateInfo(0):IsName("TraceHuntLogTemplate" .. self.nAniIndex)
|
||||
return bPlayed
|
||||
end
|
||||
function TraceHuntLogCtrl:PlayLogAni(bSkip, nWaitTime)
|
||||
if self.nType == GameEnum.TraceHuntLogType.Tracing then
|
||||
self:PlayLogAni_Trace(bSkip, nWaitTime)
|
||||
else
|
||||
self:PlayLogAni_Other(bSkip)
|
||||
end
|
||||
end
|
||||
function TraceHuntLogCtrl:PlayLogAni_Trace(bSkip, nWaitTime)
|
||||
if bSkip then
|
||||
self.animator:Play("TraceHuntLogTemplate" .. self.nAniIndex .. "_1", 0, 0)
|
||||
WwiseManger:PostEvent("mode_gongdou_findone")
|
||||
if self.timer then
|
||||
self.timer:Cancel()
|
||||
self.timer = nil
|
||||
end
|
||||
else
|
||||
self.animator:Play("TraceHuntLogTemplate" .. self.nAniIndex, 0, 0)
|
||||
self.gameObject.transform:Find("SearchRoot").gameObject:SetActive(true)
|
||||
nWaitTime = nWaitTime or 0.5
|
||||
self.timer = self:AddTimer(1, nWaitTime, function()
|
||||
self.animator:SetTrigger("tOut")
|
||||
WwiseManger:PostEvent("mode_gongdou_findone")
|
||||
end, true, true, true, nil)
|
||||
end
|
||||
end
|
||||
function TraceHuntLogCtrl:PlayLogAni_Other(bSkip)
|
||||
if bSkip then
|
||||
return
|
||||
end
|
||||
self.animator:Play("TraceHuntLogTemplate" .. self.nAniIndex, 0, 0)
|
||||
if self.nType == GameEnum.TraceHuntLogType.TraceStart or self.nType == GameEnum.TraceHuntLogType.HuntStart then
|
||||
WwiseManger:PostEvent("mode_gongdou_findstart")
|
||||
elseif self.nType == GameEnum.TraceHuntLogType.TraceEnd or self.nType == GameEnum.TraceHuntLogType.HuntEnd then
|
||||
WwiseManger:PostEvent("mode_gongdou_findover")
|
||||
else
|
||||
WwiseManger:PostEvent("mode_gongdou_findone")
|
||||
end
|
||||
end
|
||||
function TraceHuntLogCtrl:Awake()
|
||||
self.nAniIndex = 1
|
||||
self.animator = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
return TraceHuntLogCtrl
|
||||
@@ -0,0 +1,16 @@
|
||||
local TraceHuntPanel = class("TraceHuntPanel", BasePanel)
|
||||
TraceHuntPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TraceHuntLevelSelect/TraceHuntSelectPanel.prefab",
|
||||
sCtrlName = "Game.UI.TraceHunt.TraceHuntCtrl"
|
||||
}
|
||||
}
|
||||
function TraceHuntPanel:Awake()
|
||||
end
|
||||
function TraceHuntPanel:OnEnable()
|
||||
end
|
||||
function TraceHuntPanel:OnDisable()
|
||||
end
|
||||
function TraceHuntPanel:OnDestroy()
|
||||
end
|
||||
return TraceHuntPanel
|
||||
@@ -0,0 +1,257 @@
|
||||
local TraceHuntPauseCtrl = class("TraceHuntPauseCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
TraceHuntPauseCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
imgBlocker = {},
|
||||
btnBgClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
aniWindow = {
|
||||
sNodeName = "PauseWindow",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Pause"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnGiveUp = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_GiveUp"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close",
|
||||
sAction = "Back",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btnAgain = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Restart",
|
||||
sAction = "ScoreBossRetry",
|
||||
sActionIconType = "Dark"
|
||||
},
|
||||
btnSettings = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Settings"
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
txtGiveUp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_GiveUp"
|
||||
},
|
||||
txtBack = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_ContinueBattle"
|
||||
},
|
||||
txtAgain = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ScoreBoss_RestartBattle"
|
||||
},
|
||||
txtBtnSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
txtBtnSettings = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Settings"
|
||||
},
|
||||
txtSubTitle1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "ScoreBoss_ReminTime"
|
||||
},
|
||||
txtSubTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Task"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
txtPreview = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Pause_RewardPreview"
|
||||
},
|
||||
ScoreStar = {nCount = 7, sComponentName = "Button"},
|
||||
sv = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
svGamepad = {
|
||||
sNodeName = "sv",
|
||||
sComponentName = "GamepadScroll",
|
||||
sAction = "Scroll"
|
||||
}
|
||||
}
|
||||
TraceHuntPauseCtrl._mapEventConfig = {
|
||||
TraceHunt_Gameplay_Time = "OnEvent_Time",
|
||||
OpenTraceHuntPause = "Pause",
|
||||
GamepadUIReopen = "OnEvent_Reopen",
|
||||
TraceHunt_Settlement_Ready = "SettlementReady"
|
||||
}
|
||||
function TraceHuntPauseCtrl:Awake()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
local nTime = ConfigTable.GetConfigNumber("TraceHuntBossTimeLimit")
|
||||
self:OnEvent_Time(nTime)
|
||||
self.isSettlementReady = false
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Giveup",
|
||||
sLang = "StarTowerMap_Btn_GiveUp"
|
||||
},
|
||||
{
|
||||
sAction = "Settings",
|
||||
sLang = "StarTowerMap_Btn_Settings"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnDisable()
|
||||
end
|
||||
function TraceHuntPauseCtrl:Pause(nLevelId, tbCharId, bSelfBoss)
|
||||
self.tbChar = tbCharId
|
||||
self.nLevelId = nLevelId
|
||||
self.bSelfBoss = bSelfBoss
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
PanelManager.InputDisable()
|
||||
self:PlayInAni()
|
||||
GamepadUIManager.EnableGamepadUI("TraceHuntPauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnEvent_Time(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function TraceHuntPauseCtrl:Refresh()
|
||||
local totalStar = PlayerData.TraceHunt:ScoreToStar()
|
||||
local nMaxStar = PlayerData.TraceHunt:GetMaxStar()
|
||||
for i = 1, 7 do
|
||||
self._mapNode.ScoreStar[i].gameObject:SetActive(i <= nMaxStar)
|
||||
if i <= nMaxStar then
|
||||
self._mapNode.ScoreStar[i].interactable = i <= totalStar
|
||||
end
|
||||
end
|
||||
self.tbDrop = PlayerData.TraceHunt:GetStarDropCount()
|
||||
self.nStar = totalStar
|
||||
self._mapNode.sv:SetAnim(0.04)
|
||||
self._mapNode.sv:Init(7, self, self.OnGridRefresh)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local txtAimStarCount = goGrid.transform:Find("btnGrid/AnimRoot/txtAimStarCount"):GetComponent("TMP_Text")
|
||||
local txtRewardCount = goGrid.transform:Find("btnGrid/AnimRoot/txtRewardCount"):GetComponent("TMP_Text")
|
||||
local txtCurStar = goGrid.transform:Find("btnGrid/AnimRoot/imgCurStar/txtCurStar"):GetComponent("TMP_Text")
|
||||
local imgCurStar = goGrid.transform:Find("btnGrid/AnimRoot/imgCurStar").gameObject
|
||||
local imgRewardIcon = goGrid.transform:Find("btnGrid/AnimRoot/imgRewardIcon"):GetComponent("Image")
|
||||
NovaAPI.SetTMPText(txtAimStarCount, "×" .. nIndex)
|
||||
self:SetSprite(imgRewardIcon, ConfigTable.GetData_Item(AllEnum.CoinItemId.TraceHunt).Icon)
|
||||
NovaAPI.SetTMPText(txtRewardCount, "×" .. self.tbDrop[nIndex])
|
||||
imgCurStar:SetActive(self.nStar == nIndex)
|
||||
NovaAPI.SetTMPText(txtCurStar, ConfigTable.GetUIText("TraceHunt_Pause_CurStar"))
|
||||
end
|
||||
function TraceHuntPauseCtrl:PlayInAni()
|
||||
self._mapNode.goBlur:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot:SetActive(true)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_in")
|
||||
self:Refresh()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnBtnClick_GiveUp(btn)
|
||||
local bossLevelData = ConfigTable.GetData("TraceHuntBoss", self.nLevelId)
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nId)
|
||||
local mData = ConfigTable.GetData("Monster", bossLevelData.MonsterId)
|
||||
local mSkin = ConfigTable.GetData("MonsterSkin", mData.FAId)
|
||||
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(true)
|
||||
self._mapNode.imgBlocker:SetActive(true)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = orderedFormat(ConfigTable.GetUIText("TraceHunt_GiveUpTips_Main"), mManual.Name),
|
||||
sContentSub = orderedFormat(ConfigTable.GetUIText("TraceHunt_GiveUpTips_Sub"), mapItemCfg.Title),
|
||||
callbackConfirm = confirmCallback,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnBtnClick_Restart(btn)
|
||||
if self.isSettlementReady then
|
||||
local sTip = ConfigTable.GetUIText("TraceHunt_Settlement_Ready")
|
||||
EventManager.Hit(EventId.OpenMessageBox, sTip)
|
||||
return
|
||||
end
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(false)
|
||||
self._mapNode.imgBlocker:SetActive(true)
|
||||
PlayerData.TraceHunt:SendEnterLvAgain()
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = ConfigTable.GetUIText("TraceHunt_RestartBattle_Tips"),
|
||||
callbackConfirm = confirmCallback,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnBtnClick_Close(btn)
|
||||
self:PlayCloseAni(false)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnBtnClick_Settings(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "TraceHuntPauseCtrl" then
|
||||
return
|
||||
end
|
||||
local nUIType = GamepadUIManager.GetCurUIType()
|
||||
if nUIType == AllEnum.GamepadUIType.Other then
|
||||
return
|
||||
end
|
||||
self._mapNode.ActionBar.gameObject:SetActive(true)
|
||||
end
|
||||
function TraceHuntPauseCtrl:PlayCloseAni(bGiveUp)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, bGiveUp)
|
||||
end
|
||||
function TraceHuntPauseCtrl:OnPanelClose(_, bGiveUp)
|
||||
PanelManager.InputEnable()
|
||||
GamepadUIManager.DisableGamepadUI("TraceHuntPauseCtrl")
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
self._mapNode.imgBlocker:SetActive(false)
|
||||
if bGiveUp then
|
||||
EventManager.Hit(EventId.AbandonBattle)
|
||||
end
|
||||
end
|
||||
function TraceHuntPauseCtrl:SettlementReady()
|
||||
self.isSettlementReady = true
|
||||
end
|
||||
return TraceHuntPauseCtrl
|
||||
@@ -0,0 +1,183 @@
|
||||
local TraceHuntResultCtrl = class("TraceHuntResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
TraceHuntResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
bgComplete = {},
|
||||
goComplete = {},
|
||||
txtCompleteTipsPrev1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Result_Star"
|
||||
},
|
||||
txtCompleteTipsPrev2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Result_Exp"
|
||||
},
|
||||
ScoreStar = {nCount = 7, sComponentName = "Button"},
|
||||
txtCompleteTipsSuf = {sComponentName = "TMP_Text"},
|
||||
txtBossName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DamageResult"
|
||||
},
|
||||
bgFail = {},
|
||||
goFail = {},
|
||||
goFailTips = {},
|
||||
imgHuntCoin = {sComponentName = "Image"},
|
||||
txtFailTipsPrev = {sComponentName = "TMP_Text"},
|
||||
txtFailTipsSuf = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "TraceHunt_Result_Return"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
}
|
||||
}
|
||||
TraceHuntResultCtrl._mapEventConfig = {}
|
||||
function TraceHuntResultCtrl:Awake()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.btnClose.gameObject:SetActive(false)
|
||||
end
|
||||
function TraceHuntResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nLevelId = tbParam[1]
|
||||
self.totalStar = tbParam[2]
|
||||
self.nExp = tbParam[3]
|
||||
self.bSelfBoss = tbParam[4]
|
||||
self.mapChangeInfo = tbParam[5]
|
||||
self.bUpgrade = tbParam[6]
|
||||
self.nBeforeMaxStar = tbParam[7]
|
||||
self.tbCharDamage = tbParam[8]
|
||||
self.callback = tbParam[9]
|
||||
self.bSuccess = self.totalStar > 0
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.imgBlurredBg:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot:SetActive(true)
|
||||
self:Refresh()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function TraceHuntResultCtrl:Refresh()
|
||||
local bossLevelData = ConfigTable.GetData("TraceHuntBoss", self.nLevelId)
|
||||
local mData = ConfigTable.GetData("Monster", bossLevelData.MonsterId)
|
||||
local mSkin = ConfigTable.GetData("MonsterSkin", mData.FAId)
|
||||
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
|
||||
for i = 1, 2 do
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossName[i], mManual.Name)
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
self._mapNode.bgComplete:SetActive(self.bSuccess)
|
||||
self._mapNode.goComplete:SetActive(self.bSuccess)
|
||||
self._mapNode.bgFail:SetActive(not self.bSuccess)
|
||||
self._mapNode.goFail:SetActive(not self.bSuccess)
|
||||
local nAnimTime
|
||||
if self.bSuccess then
|
||||
self:RefreshSuc()
|
||||
nAnimTime = 0.7
|
||||
self._mapNode.animRoot:Play("TraceHuntBattleResult_Complete")
|
||||
else
|
||||
self:RefreshFail()
|
||||
nAnimTime = 0.4
|
||||
self._mapNode.animRoot:Play("TraceHuntBattleResult_Fail")
|
||||
end
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self._mapNode.btnClose.gameObject:SetActive(true)
|
||||
NovaAPI.SetButtonInteractable(self._mapNode.btnClose, true)
|
||||
end, true, true, true)
|
||||
end
|
||||
function TraceHuntResultCtrl:RefreshSuc()
|
||||
WwiseManger:PlaySound("ui_infinity_victory")
|
||||
self._mapNode.btnDamageResult[1].gameObject:SetActive(self.tbCharDamage ~= nil and #self.tbCharDamage > 0)
|
||||
local nMaxStar = self.nBeforeMaxStar
|
||||
for i = 1, 7 do
|
||||
self._mapNode.ScoreStar[i].gameObject:SetActive(i <= nMaxStar)
|
||||
if i <= nMaxStar then
|
||||
self._mapNode.ScoreStar[i].interactable = i <= self.totalStar
|
||||
end
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtCompleteTipsSuf, self.nExp)
|
||||
end
|
||||
function TraceHuntResultCtrl:RefreshFail()
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
self._mapNode.btnDamageResult[2].gameObject:SetActive(self.tbCharDamage ~= nil and #self.tbCharDamage > 0)
|
||||
local nCost = PlayerData.TraceHunt:GetHuntCostCount(self.bSelfBoss)
|
||||
self._mapNode.goFailTips:SetActive(0 < nCost)
|
||||
if 0 < nCost then
|
||||
local nId = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
|
||||
local mapItemCfg = ConfigTable.GetData_Item(nId)
|
||||
self:SetSprite_Coin(self._mapNode.imgHuntCoin, nId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFailTipsPrev, orderedFormat(ConfigTable.GetUIText("TraceHunt_Result_Cost"), mapItemCfg.Title, nCost))
|
||||
end
|
||||
end
|
||||
function TraceHuntResultCtrl:OnBtnClick_Close()
|
||||
NovaAPI.SetButtonInteractable(self._mapNode.btnClose, false)
|
||||
local close = function()
|
||||
CS.AdventureModuleHelper.ResumeLogic()
|
||||
if NovaAPI.GetCurrentModuleName() == "MainMenuModuleScene" then
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
PlayerData.Base:OnBackToMainMenuModule()
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Mask, 0)
|
||||
self._mapNode.Mask.gameObject:SetActive(true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
local sequence = DOTween.Sequence()
|
||||
sequence:Append(self._mapNode.Mask:DOFade(1, 0.5):SetUpdate(true))
|
||||
sequence:AppendCallback(function()
|
||||
local function levelEndCallback()
|
||||
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
self._mapNode.imgBlurredBg:SetActive(false)
|
||||
end
|
||||
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
|
||||
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
end
|
||||
local up = function()
|
||||
local nLevel = PlayerData.TraceHunt:GetTraceHuntLevel()
|
||||
local mapLevel = PlayerData.TraceHunt:GetTraceHuntLevelData(nLevel)
|
||||
local mapData = {nLevel = nLevel, mapLevel = mapLevel}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TraceHuntSucBar, mapData, close)
|
||||
end
|
||||
if self.mapChangeInfo and next(self.mapChangeInfo) ~= nil then
|
||||
if self.bUpgrade then
|
||||
UTILS.OpenReceiveByChangeInfo(self.mapChangeInfo, up)
|
||||
else
|
||||
UTILS.OpenReceiveByChangeInfo(self.mapChangeInfo, close)
|
||||
end
|
||||
elseif self.bUpgrade then
|
||||
up()
|
||||
else
|
||||
close()
|
||||
end
|
||||
end
|
||||
function TraceHuntResultCtrl:OnBtnClick_DamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
function TraceHuntResultCtrl:OnDestroy()
|
||||
end
|
||||
return TraceHuntResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local TraceHuntResultPanel = class("TraceHuntResultPanel", BasePanel)
|
||||
TraceHuntResultPanel._bAddToBackHistory = false
|
||||
TraceHuntResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_TraceHuntBattle/TraceHuntBattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.TraceHunt.TraceHuntResultCtrl"
|
||||
}
|
||||
}
|
||||
function TraceHuntResultPanel:Awake()
|
||||
end
|
||||
function TraceHuntResultPanel:OnEnable()
|
||||
end
|
||||
function TraceHuntResultPanel:OnDisable()
|
||||
end
|
||||
function TraceHuntResultPanel:OnDestroy()
|
||||
end
|
||||
return TraceHuntResultPanel
|
||||
Reference in New Issue
Block a user