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,87 @@
|
||||
local JointDrillTimeCtrl = class("JointDrillTimeCtrl", BaseCtrl)
|
||||
JointDrillTimeCtrl._mapNodeConfig = {
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
rtnfo = {},
|
||||
rtChallengeTime = {},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
animatorTime = {
|
||||
sNodeName = "rtChallengeTime",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
JointDrillTimeCtrl._mapEventConfig = {
|
||||
RefreshJointDrillGameTime = "SetTime",
|
||||
JointDrill_StartTiming = "OnEvent_BattleStart",
|
||||
JointDrill_BattleLvsToggle = "OnEvent_ChangeBattleLevel",
|
||||
RestartJointDrill = "OnEvent_Restart",
|
||||
VampireInstanceEnd = "OnEvent_LevelEnd",
|
||||
InputEnable = "OnEvent_InputEnable"
|
||||
}
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
function JointDrillTimeCtrl:Awake()
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
self.nTotalTime = 0
|
||||
self.nLastTime = 0
|
||||
self:ResetTimer()
|
||||
local nLevelId = PlayerData.JointDrill:GetJointDrillLevelId()
|
||||
local mapCfg = ConfigTable.GetData("JointDrillLevel", nLevelId)
|
||||
if mapCfg ~= nil then
|
||||
self.nTotalTime = mapCfg.BattleTime
|
||||
end
|
||||
end
|
||||
function JointDrillTimeCtrl:ResetTimer()
|
||||
self.nLastTime = 0
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d:%03d", 0, 0, 0))
|
||||
end
|
||||
function JointDrillTimeCtrl:SetTime(nTime)
|
||||
if not self.bStart then
|
||||
return
|
||||
end
|
||||
nTime = self.nTotalTime * 1000 - nTime
|
||||
local nMin = math.floor(nTime / 60000)
|
||||
local nRemain = nTime % 60000
|
||||
local nSec = math.floor(nRemain / 1000)
|
||||
local nMs = nTime % 1000
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d:%03d", nMin, nSec, nMs))
|
||||
if self.nLastTime == 0 then
|
||||
self.nLastTime = nTime
|
||||
elseif nTime <= 15000 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
if 1000 <= self.nLastTime - nTime then
|
||||
self._mapNode.animatorTime:Play("BossChallengeTime_show")
|
||||
self.nLastTime = nTime
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
end
|
||||
function JointDrillTimeCtrl:OnEvent_BattleStart()
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
self.bStart = true
|
||||
end
|
||||
function JointDrillTimeCtrl:OnEvent_Restart()
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
self:ResetTimer()
|
||||
end
|
||||
function JointDrillTimeCtrl:OnEvent_ChangeBattleLevel()
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
self:ResetTimer()
|
||||
end
|
||||
function JointDrillTimeCtrl:OnEvent_LevelEnd()
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self.bStart = false
|
||||
end
|
||||
function JointDrillTimeCtrl:OnEvent_InputEnable(bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvasGroup, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvasGroup, bEnable == true)
|
||||
end
|
||||
return JointDrillTimeCtrl
|
||||
@@ -0,0 +1,100 @@
|
||||
local JointDrillBuildItemCtrl = class("JointDrillBuildItemCtrl", BaseCtrl)
|
||||
JointDrillBuildItemCtrl._mapNodeConfig = {
|
||||
goBuildItem = {},
|
||||
txtBuildTitle = {sComponentName = "TMP_Text"},
|
||||
txtBattleTime = {sComponentName = "TMP_Text"},
|
||||
txtScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Score_Text"
|
||||
},
|
||||
imgBuildScore = {sComponentName = "Image"},
|
||||
charItem = {nCount = 3},
|
||||
imgItemIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgItemRare = {nCount = 3, sComponentName = "Image"},
|
||||
txtRank = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtDamage = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Damage_Text"
|
||||
},
|
||||
txtDamageValue = {sComponentName = "TMP_Text"},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
},
|
||||
imgEmpty = {}
|
||||
}
|
||||
JointDrillBuildItemCtrl._mapEventConfig = {}
|
||||
JointDrillBuildItemCtrl._mapRedDotConfig = {}
|
||||
function JointDrillBuildItemCtrl:GetBuildRank(nScore)
|
||||
local curIdx = -1
|
||||
local forEachReward = function(mapData)
|
||||
if nScore >= mapData.MinGrade and curIdx < mapData.Id then
|
||||
curIdx = mapData.Id
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.StarTowerBuildRank, forEachReward)
|
||||
if curIdx < 0 then
|
||||
curIdx = 1
|
||||
end
|
||||
return curIdx
|
||||
end
|
||||
function JointDrillBuildItemCtrl:SetItem(nIndex, mapBuild, nLevelId)
|
||||
self._mapNode.goBuildItem.gameObject:SetActive(mapBuild ~= nil)
|
||||
self._mapNode.imgEmpty.gameObject:SetActive(mapBuild == nil)
|
||||
if mapBuild == nil then
|
||||
return
|
||||
end
|
||||
self.nLevelId = nLevelId
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildTitle, orderedFormat(ConfigTable.GetUIText("JointDrill_Build_Index"), nIndex))
|
||||
local setBuildData = function(mapData)
|
||||
local tbChar = {}
|
||||
local nScore = 0
|
||||
if mapData == nil then
|
||||
for _, v in ipairs(mapBuild.Chars) do
|
||||
table.insert(tbChar, v.CharId)
|
||||
end
|
||||
nScore = self:GetBuildRank(mapBuild.BuildScore)
|
||||
else
|
||||
for _, mapChar in ipairs(mapData.tbChar) do
|
||||
table.insert(tbChar, mapChar.nTid)
|
||||
end
|
||||
nScore = mapData.mapRank.Id
|
||||
end
|
||||
for i = 1, 3 do
|
||||
local mapCharCfg = ConfigTable.GetData_Character(tbChar[i])
|
||||
local nCharSkinId = PlayerData.Char:GetCharSkinId(tbChar[i])
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
if mapCharCfg ~= nil and mapCharSkin ~= nil then
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(self._mapNode.imgItemRare[i], "12_rare", sFrame)
|
||||
local nLevel = PlayerData.Char:GetCharLv(tbChar[i])
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank[i], nLevel)
|
||||
end
|
||||
end
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. nScore
|
||||
self:SetPngSprite(self._mapNode.imgBuildScore, sScore)
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(setBuildData, mapBuild.BuildId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDamageValue, mapBuild.Damage)
|
||||
local nMin = math.floor(mapBuild.Time / 60000)
|
||||
local nRemain = mapBuild.Time % 60000
|
||||
local nSec = math.floor(nRemain / 1000)
|
||||
local nMs = mapBuild.Time % 1000
|
||||
local sTime = string.format("%02d:%02d:%03d", nMin, nSec, nMs)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleTime, orderedFormat(ConfigTable.GetUIText("JointDrill_Build_Time_Text"), sTime))
|
||||
end
|
||||
function JointDrillBuildItemCtrl:Awake()
|
||||
end
|
||||
function JointDrillBuildItemCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillBuildItemCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillBuildItemCtrl:OnDestroy()
|
||||
end
|
||||
return JointDrillBuildItemCtrl
|
||||
@@ -0,0 +1,215 @@
|
||||
local JointDrillBuildListCtrl = class("JointDrillBuildListCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillBuildListCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtBuildList = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Selected_Build"
|
||||
},
|
||||
buildList = {},
|
||||
buildLSV = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
goSelectBuildItem = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtBuildTitle = {sComponentName = "TMP_Text"},
|
||||
goBuild = {},
|
||||
btnSelectBuild = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_SelectBuild"
|
||||
},
|
||||
btnDelBuild = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_DelBuild"
|
||||
},
|
||||
txtScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Score_Text"
|
||||
},
|
||||
imgBuildScore = {sComponentName = "Image"},
|
||||
charItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharCtrl"
|
||||
},
|
||||
btnStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtBtnStart = {sComponentName = "TMP_Text"},
|
||||
txtChallengeCount = {sComponentName = "TMP_Text"},
|
||||
txtTips = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Select_Tip"
|
||||
},
|
||||
goChallengeTime = {},
|
||||
txtChallengeTime = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
JointDrillBuildListCtrl._mapEventConfig = {
|
||||
RefreshChallengeTime = "OnEvent_RefreshChallengeTime",
|
||||
RefreshJointDrillActTime = "OnEvent_RefreshJointDrillActTime"
|
||||
}
|
||||
JointDrillBuildListCtrl._mapRedDotConfig = {}
|
||||
function JointDrillBuildListCtrl:RefreshBuildList()
|
||||
self.tbBuildItemCtrl = {}
|
||||
local nAllChallengeCount = PlayerData.JointDrill:GetMaxChallengeCount(self.nLevelId)
|
||||
nAllChallengeCount = math.max(4, nAllChallengeCount)
|
||||
self._mapNode.buildLSV:Init(nAllChallengeCount, self, self.OnGridRefresh)
|
||||
end
|
||||
function JointDrillBuildListCtrl:SetSelectBuildItem()
|
||||
local nCurSelectBuildId = PlayerData.JointDrill:GetCachedBuild()
|
||||
if nCurSelectBuildId == 0 then
|
||||
self._mapNode.btnSelectBuild.gameObject:SetActive(true)
|
||||
self._mapNode.goBuild.gameObject:SetActive(false)
|
||||
else
|
||||
local callback = function(mapBuildData)
|
||||
self._mapNode.btnSelectBuild.gameObject:SetActive(mapBuildData == nil)
|
||||
self._mapNode.goBuild.gameObject:SetActive(mapBuildData ~= nil)
|
||||
if mapBuildData ~= nil then
|
||||
for k, mapChar in ipairs(mapBuildData.tbChar) do
|
||||
self._mapNode.charItem[k]:SetChar(mapChar.nTid)
|
||||
end
|
||||
local sScore = "Icon/BuildRank/BuildRank_" .. mapBuildData.mapRank.Id
|
||||
self:SetPngSprite(self._mapNode.imgBuildScore, sScore)
|
||||
end
|
||||
end
|
||||
PlayerData.Build:GetBuildDetailData(callback, nCurSelectBuildId)
|
||||
end
|
||||
local nIndex = #self.tbBuildList + 1
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBuildTitle, orderedFormat(ConfigTable.GetUIText("JointDrill_Build_Index"), nIndex))
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnGridRefresh(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
local mapBuild = self.tbBuildList[nIndex]
|
||||
if self.tbBuildItemCtrl[goGrid] == nil then
|
||||
local itemCtrl = self:BindCtrlByNode(goGrid, "Game.UI.JointDrill.JointDrillBuildItemCtrl")
|
||||
self.tbBuildItemCtrl[goGrid] = itemCtrl
|
||||
end
|
||||
self.tbBuildItemCtrl[goGrid]:SetItem(nIndex, mapBuild, self.nLevelId)
|
||||
end
|
||||
function JointDrillBuildListCtrl:SetChallengeTime(nRemainTime)
|
||||
local tbTime = timeFormat_Table(nRemainTime)
|
||||
local sTime = ""
|
||||
if tbTime.min > 0 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_3"), tbTime.min, tbTime.sec)
|
||||
else
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_4"), tbTime.sec)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeTime, orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_Left"), sTime))
|
||||
end
|
||||
function JointDrillBuildListCtrl:RefreshChallengeTime()
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCloseTime = math.floor(nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max"))
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = nCloseTime - nCurTime
|
||||
self:SetChallengeTime(nRemainTime)
|
||||
end
|
||||
function JointDrillBuildListCtrl:Awake()
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnEnable()
|
||||
self.tbBuildItemCtrl = {}
|
||||
local tbParam = self:GetPanelParam()
|
||||
if nil ~= tbParam and nil ~= tbParam[1] then
|
||||
self.nLevelId = tbParam[1]
|
||||
self.bSimulation = tbParam[2]
|
||||
end
|
||||
self.bInBattle = PlayerData.JointDrill:CheckJointDrillInBattle()
|
||||
self.tbBuildList = PlayerData.JointDrill:GetJointDrillBuildList()
|
||||
if not self.bInBattle then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnStart, ConfigTable.GetUIText("JointDrill_Btn_Start_Challenge"))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBtnStart, ConfigTable.GetUIText("JointDrill_Btn_Continue_Challenge"))
|
||||
self:RefreshChallengeTime()
|
||||
end
|
||||
if not self.bInBattle then
|
||||
self._mapNode.animRoot:Play("JointDrillBuildList_Single_in", 0, 0)
|
||||
self._mapNode.buildList.gameObject:SetActive(false)
|
||||
self._mapNode.goSelectBuildItem.anchoredPosition = Vector2(0, 0)
|
||||
else
|
||||
self._mapNode.animRoot:Play("JointDrillBuildList_List_in", 0, 0)
|
||||
self._mapNode.buildList.gameObject:SetActive(true)
|
||||
self._mapNode.goSelectBuildItem.anchoredPosition = Vector2(310, 0)
|
||||
self:RefreshBuildList()
|
||||
end
|
||||
self:SetSelectBuildItem()
|
||||
local nChallengeCount = #self.tbBuildList
|
||||
self.nAllChallengeCount = PlayerData.JointDrill:GetMaxChallengeCount(self.nLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeCount, orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Count"), self.nAllChallengeCount - nChallengeCount))
|
||||
self._mapNode.goChallengeTime.gameObject:SetActive(self.bInBattle)
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnDisable()
|
||||
for _, v in ipairs(self.tbBuildItemCtrl) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbBuildItemCtrl = {}
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnBtnClick_SelectBuild()
|
||||
if not PlayerData.JointDrill:CheckChallengeCount() then
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.RogueBossBuildBrief, AllEnum.RegionBossFormationType.JointDrill)
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnBtnClick_DelBuild()
|
||||
PlayerData.JointDrill:SetSelBuildId(0)
|
||||
self:SetSelectBuildItem()
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnBtnClick_Start()
|
||||
local bInChallengeTime = PlayerData.JointDrill:CheckActChallengeTime()
|
||||
if not bInChallengeTime then
|
||||
local gameOverCallback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList)
|
||||
end
|
||||
if self.bInBattle then
|
||||
PlayerData.JointDrill:JointDrillGameOver(gameOverCallback, true)
|
||||
else
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Challenge_End_Tip"))
|
||||
gameOverCallback()
|
||||
end
|
||||
return
|
||||
end
|
||||
if not PlayerData.JointDrill:CheckChallengeCount() then
|
||||
return
|
||||
end
|
||||
local nBuildId = PlayerData.JointDrill:GetCachedBuild()
|
||||
if nBuildId == 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_SelectBuild_Tip"))
|
||||
return
|
||||
end
|
||||
if self.bInBattle then
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCloseTime = math.floor(nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max"))
|
||||
if nCloseTime <= ClientManager.serverTimeStamp then
|
||||
PlayerData.JointDrill:JointDrillGameOver(nil, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
PlayerData.JointDrill:EnterJointDrill(self.nLevelId, nBuildId, self.bSimulation)
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnEvent_RefreshChallengeTime(nRemainTime)
|
||||
self:SetChallengeTime(nRemainTime)
|
||||
end
|
||||
function JointDrillBuildListCtrl:OnEvent_RefreshJointDrillActTime(nStatus, nRemainTime)
|
||||
if nStatus == AllEnum.JointDrillActStatus.Closed then
|
||||
local confirmCallback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillBuildList)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillLevelSelect)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("JointDrill_Act_End_Tip"),
|
||||
callbackConfirm = confirmCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
end
|
||||
return JointDrillBuildListCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local JointDrillBuildListPanel = class("JointDrillBuildListPanel", BasePanel)
|
||||
JointDrillBuildListPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillBuildList.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillBuildListCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillBuildListPanel:Awake()
|
||||
end
|
||||
function JointDrillBuildListPanel:OnEnable()
|
||||
end
|
||||
function JointDrillBuildListPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillBuildListPanel:OnDisable()
|
||||
end
|
||||
function JointDrillBuildListPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillBuildListPanel:OnRelease()
|
||||
end
|
||||
return JointDrillBuildListPanel
|
||||
@@ -0,0 +1,137 @@
|
||||
local JointDrillLevelItemCtrl = class("JointDrillLevelItemCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillLevelItemCtrl._mapNodeConfig = {
|
||||
btnGrid = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
imgLevelBg = {sComponentName = "Image"},
|
||||
txtDifficulty = {sComponentName = "TMP_Text"},
|
||||
imgSimulate = {},
|
||||
txtSimulate = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Start_Challenge_Simulate"
|
||||
},
|
||||
imgChallengeTime = {},
|
||||
txtChallengeTime = {sComponentName = "TMP_Text"},
|
||||
goBossInfo = {},
|
||||
imgBossHpBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgBossHp = {sComponentName = "Image"},
|
||||
txtBossHp = {sComponentName = "TMP_Text"},
|
||||
imgTimeout = {},
|
||||
txtTimeout = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Challenge_TimeOut"
|
||||
},
|
||||
imgMaskInBattle = {},
|
||||
txtInBattle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Challenge_OnGoing"
|
||||
},
|
||||
imgMaskLock = {},
|
||||
txtLock = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Level_Lock"
|
||||
},
|
||||
imgTagBg = {},
|
||||
txtTag = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
JointDrillLevelItemCtrl._mapEventConfig = {}
|
||||
JointDrillLevelItemCtrl._mapRedDotConfig = {}
|
||||
function JointDrillLevelItemCtrl:SetItem(mapLevelCfg)
|
||||
self.nLevelId = mapLevelCfg.Id
|
||||
self.nCurLevelId = PlayerData.JointDrill:GetJointDrillLevelId()
|
||||
self.bInBattle = PlayerData.JointDrill:CheckJointDrillInBattle()
|
||||
self.bCurBattle = self.nCurLevelId == mapLevelCfg.Id
|
||||
if self.bCurBattle and self.bInBattle then
|
||||
self:SetPngSprite(self._mapNode.imgLevelBg, mapLevelCfg.LevelImageGoing)
|
||||
local mapBossInfo = PlayerData.JointDrill:GetJointDrillBossInfo(mapLevelCfg.BossId, mapLevelCfg.Difficulty)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossHp, string.format("%s/%s", mapBossInfo.nHp, mapBossInfo.nHpMax))
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBossHp, mapBossInfo.nHp / mapBossInfo.nHpMax)
|
||||
local bSimulate = PlayerData.JointDrill:GetBattleSimulate()
|
||||
self._mapNode.imgSimulate.gameObject:SetActive(bSimulate)
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nEndTime = nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max")
|
||||
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
self._mapNode.imgTimeout.gameObject:SetActive(nEndTime <= nCurTime)
|
||||
if nEndTime > nCurTime then
|
||||
self:RefreshChallengeTime()
|
||||
end
|
||||
else
|
||||
self:SetPngSprite(self._mapNode.imgLevelBg, mapLevelCfg.LevelImage)
|
||||
end
|
||||
local nDiff = mapLevelCfg.Difficulty
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDifficulty, ConfigTable.GetUIText("JointDrill_Difficulty_Name_" .. nDiff))
|
||||
self.bUnlock = PlayerData.JointDrill:IsJointDrillUnlock(self.nLevelId)
|
||||
self._mapNode.imgMaskLock.gameObject:SetActive(not self.bUnlock)
|
||||
self._mapNode.imgMaskInBattle.gameObject:SetActive(self.bUnlock and self.bInBattle and not self.bCurBattle)
|
||||
self._mapNode.imgTagBg.gameObject:SetActive(mapLevelCfg.SubName ~= "")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTag, mapLevelCfg.SubName)
|
||||
end
|
||||
function JointDrillLevelItemCtrl:RefreshChallengeTime()
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCloseTime = math.floor(nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max"))
|
||||
local refreshTime = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = nCloseTime - nCurTime
|
||||
if nRemainTime <= 0 then
|
||||
nRemainTime = 0
|
||||
if self.timeTimer ~= nil then
|
||||
self.timeTimer:Cancel()
|
||||
self.timeTimer = nil
|
||||
end
|
||||
self._mapNode.imgChallengeTime.gameObject:SetActive(false)
|
||||
self._mapNode.imgTimeout.gameObject:SetActive(true)
|
||||
end
|
||||
local tbTime = timeFormat_Table(nRemainTime)
|
||||
local sTime = ""
|
||||
if 0 < tbTime.min then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_3"), tbTime.min, tbTime.sec)
|
||||
else
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_4"), tbTime.sec)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeTime, sTime)
|
||||
end
|
||||
refreshTime()
|
||||
if self.timeTimer == nil then
|
||||
self.timeTimer = self:AddTimer(0, 1, refreshTime, true, true, true)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelItemCtrl:Awake()
|
||||
end
|
||||
function JointDrillLevelItemCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillLevelItemCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillLevelItemCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillLevelItemCtrl:OnBtnClick_Item()
|
||||
if not self.bUnlock then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Lock_Tip"))
|
||||
return
|
||||
end
|
||||
if not self.bCurBattle and self.bInBattle then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_InBattle_Tip"))
|
||||
return
|
||||
end
|
||||
if self.bInBattle and self.bCurBattle then
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCloseTime = math.floor(nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max"))
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nCloseTime <= nCurTime then
|
||||
local callback = function()
|
||||
if PlayerData.JointDrill:CheckJointDrillInBattle() then
|
||||
PlayerData.JointDrill:JointDrillGameOver(nil, true)
|
||||
else
|
||||
EventManager.Hit("RefreshJointDrillLevel")
|
||||
end
|
||||
end
|
||||
PlayerData.Activity:SendActivityDetailMsg(callback, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
EventManager.Hit("SelectJointDrillLevel", self.nLevelId)
|
||||
end
|
||||
return JointDrillLevelItemCtrl
|
||||
@@ -0,0 +1,873 @@
|
||||
local JointDrillLevelSelectCtrl = class("JointDrillLevelSelectCtrl", BaseCtrl)
|
||||
local LocalData = require("GameCore.Data.LocalData")
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillLevelSelectCtrl._mapNodeConfig = {
|
||||
TopBarPanel = {
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgBg = {sComponentName = "Image"},
|
||||
goMain = {sNodeName = "---Main---"},
|
||||
btnAvg = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Avg"
|
||||
},
|
||||
txtBtnAvg = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Story"
|
||||
},
|
||||
btnQuest = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Quest"
|
||||
},
|
||||
txtBtnQuest = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Reward"
|
||||
},
|
||||
redDotQuest = {},
|
||||
goActTime = {},
|
||||
txtActTimeCn = {sComponentName = "TMP_Text"},
|
||||
txtActTime = {sComponentName = "TMP_Text"},
|
||||
goLevelList = {},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Difficulty_Select"
|
||||
},
|
||||
levelListContent = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goLevelItem = {},
|
||||
goLevelBattleItem = {},
|
||||
goTickets = {},
|
||||
btnTicketTip = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Tickets"
|
||||
},
|
||||
txtTicketCount = {sComponentName = "TMP_Text"},
|
||||
goTip = {sNodeName = "--Tips--"},
|
||||
btnTipsBg = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_TipsBg"
|
||||
},
|
||||
txtTipsName = {sComponentName = "TMP_Text"},
|
||||
txtTipsContent = {sComponentName = "TMP_Text"},
|
||||
txtRefreshTime = {sComponentName = "TMP_Text"},
|
||||
goChallengeEnd = {},
|
||||
txtChallengeEnd = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Challenge_End"
|
||||
},
|
||||
goRank = {},
|
||||
goRankNormal = {},
|
||||
txtRankCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Cur_Rank"
|
||||
},
|
||||
txtRankValue = {sComponentName = "TMP_Text"},
|
||||
txtScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Highest_Score"
|
||||
},
|
||||
txtScoreValue = {sComponentName = "TMP_Text"},
|
||||
goRankEmpty = {},
|
||||
txtRankEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Self_Rank_Empty_1"
|
||||
},
|
||||
btnRankDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_RankDetail"
|
||||
},
|
||||
txtBtnRankDetail = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Title_Detail"
|
||||
},
|
||||
goLevelInfo = {
|
||||
sNodeName = "---LevelInfo---"
|
||||
},
|
||||
goInBattle = {},
|
||||
goNormal = {},
|
||||
btnStart = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Start"
|
||||
},
|
||||
txtBtnStart = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Start_Challenge"
|
||||
},
|
||||
animatorStart = {
|
||||
sNodeName = "AnimRootStart",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnContinue = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Continue"
|
||||
},
|
||||
txtBtnContinue = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Continue_Challenge"
|
||||
},
|
||||
animatorContinue = {
|
||||
sNodeName = "AnimRootContinue",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnSimulation = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Simulation"
|
||||
},
|
||||
txtBtnSimulation = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Start_Challenge_Simulate"
|
||||
},
|
||||
animatorSimulation = {
|
||||
sNodeName = "AnimRootSimulation",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Cancel"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Stop_Challenge"
|
||||
},
|
||||
animatorCancel = {
|
||||
sNodeName = "AnimRootCancel",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
btnFastBattle = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_FastBattle"
|
||||
},
|
||||
animatorFastBattle = {
|
||||
sNodeName = "AnimRootFastBattle",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtBtnFastBattle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Fast_Battle"
|
||||
},
|
||||
imgFastBattleLock = {},
|
||||
txtChallengeCount = {sComponentName = "TMP_Text"},
|
||||
txtRecLevel = {sComponentName = "TMP_Text"},
|
||||
txtRecommend = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Build_Recommend"
|
||||
},
|
||||
txtRecommendLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Lv"
|
||||
},
|
||||
imgRecommendBuild = {sComponentName = "Image"},
|
||||
txtRecommendBuild = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "InfinityTower_Recommend_Construct"
|
||||
},
|
||||
imgProperty = {nCount = 6, sComponentName = "Image"},
|
||||
txtBossSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Boss_Info"
|
||||
},
|
||||
btnBossSkill = {
|
||||
nCount = 6,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
imgBossSkill = {nCount = 6, sComponentName = "Image"},
|
||||
txtRewardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Challenge_Reward"
|
||||
},
|
||||
btnReward = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
goRewardItem = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
imgTickets = {sComponentName = "Image"},
|
||||
txtTicketsCount = {sComponentName = "TMP_Text"},
|
||||
goChallengeTime = {},
|
||||
txtChallengeTime = {sComponentName = "TMP_Text"},
|
||||
goBossInfo = {},
|
||||
imgBossHpBarBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgBossHpBar = {sComponentName = "Image"},
|
||||
txtBossHp = {sComponentName = "TMP_Text"},
|
||||
imgSimulation = {},
|
||||
txtSimulation = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Start_Challenge_Simulate"
|
||||
},
|
||||
txtBossName = {sComponentName = "TMP_Text"},
|
||||
goAvgWindow = {
|
||||
sNodeName = "---AVGWindow---"
|
||||
},
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
goAvgRoot = {
|
||||
sNodeName = "goMainLineAvgRoot"
|
||||
},
|
||||
animWindow = {sNodeName = "rtWindow", sComponentName = "Animator"},
|
||||
txtAvgTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_AVG_Title"
|
||||
},
|
||||
btnCloseWindow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseAvgWindow"
|
||||
},
|
||||
mainLineAvgLvName = {sComponentName = "TMP_Text"},
|
||||
mainLineAvgLvDes = {sComponentName = "TMP_Text"},
|
||||
btnCancelWindow = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CancelAvgWindow"
|
||||
},
|
||||
txtBtnCancelWindow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Cancel"
|
||||
},
|
||||
btnStartAvg = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_StartAvg"
|
||||
},
|
||||
txtBtnStartAvg = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Enter_AVG"
|
||||
},
|
||||
goSmoke = {}
|
||||
}
|
||||
JointDrillLevelSelectCtrl._mapEventConfig = {
|
||||
RefreshJointDrillLevel = "OnEvent_RefreshJointDrillLevel",
|
||||
SelectJointDrillLevel = "OnEvent_SelectJointDrillLevel",
|
||||
GetJointDrillRankSuc = "OnEvent_GetJointDrillRankSuc",
|
||||
JointDrillRaidSuccess = "OnEvent_JointDrillRaidSuccess",
|
||||
RefreshChallengeTime = "OnEvent_RefreshChallengeTime",
|
||||
RefreshJointDrillActTime = "OnEvent_RefreshJointDrillActTime",
|
||||
[EventId.UIBackConfirm] = "OnEvent_Back",
|
||||
[EventId.UIHomeConfirm] = "OnEvent_BackHome"
|
||||
}
|
||||
JointDrillLevelSelectCtrl._mapRedDotConfig = {
|
||||
[RedDotDefine.JointDrillQuest] = {
|
||||
sNodeName = "redDotQuest"
|
||||
}
|
||||
}
|
||||
local panelType_main = 1
|
||||
local panelType_levelInfo = 2
|
||||
function JointDrillLevelSelectCtrl:PlayAvg(callback)
|
||||
local function avgEndCallback()
|
||||
EventManager.Remove("StoryDialog_DialogEnd", self, avgEndCallback)
|
||||
LocalData.SetPlayerLocalData("JointDrillAvgId", self.nActId)
|
||||
if callback ~= nil then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
EventManager.Add("StoryDialog_DialogEnd", self, avgEndCallback)
|
||||
local mapCfg = ConfigTable.GetData("JointDrillControl", self.nActId)
|
||||
if mapCfg ~= nil then
|
||||
EventManager.Hit("StoryDialog_DialogStart", mapCfg.DrillPlotId)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:RefreshAvgInfo()
|
||||
local mapCfg = ConfigTable.GetData("JointDrillControl", self.nActId)
|
||||
if mapCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvName, mapCfg.PlotTitle)
|
||||
NovaAPI.SetTMPText(self._mapNode.mainLineAvgLvDes, mapCfg.PlotDesc)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:Refresh()
|
||||
self.bInBattle = PlayerData.JointDrill:CheckJointDrillInBattle()
|
||||
self.nCurLevelId = PlayerData.JointDrill:GetJointDrillLevelId()
|
||||
if self.nPanelType == panelType_main then
|
||||
self:RefreshLevelList()
|
||||
elseif self.nPanelType == panelType_levelInfo then
|
||||
self:RefreshLevelInfo()
|
||||
end
|
||||
self:StartRankTimer()
|
||||
self:RefreshRankData()
|
||||
local nAvgId = LocalData.GetPlayerLocalData("JointDrillAvgId")
|
||||
self._mapNode.btnAvg.gameObject:SetActive(false)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:RefreshLevelList()
|
||||
self._mapNode.goMain.gameObject:SetActive(true)
|
||||
self._mapNode.goLevelInfo.gameObject:SetActive(false)
|
||||
self._mapNode.animRoot:Play("JointDrill_Main_in", 0, 0)
|
||||
if self.bInBattle or self.nActStatus == AllEnum.JointDrillActStatus.Start then
|
||||
self._mapNode.goLevelList.gameObject:SetActive(true)
|
||||
self._mapNode.goChallengeEnd.gameObject:SetActive(false)
|
||||
local mapLevelList = CacheTable.GetData("_JointDrillLevel", self.nGroupId)
|
||||
if self.nCurLevelId == 0 and self.battleItemCtrl ~= nil then
|
||||
destroy(self.battleItemCtrl.gameObject)
|
||||
self:UnbindCtrlByNode(self.battleItemCtrl)
|
||||
self.battleItemCtrl = nil
|
||||
end
|
||||
if mapLevelList ~= nil then
|
||||
for _, v in ipairs(self.tbLevelItemCtrl) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
local nIndex = 1
|
||||
for k, v in ipairs(mapLevelList) do
|
||||
local itemCtrl
|
||||
local nLevelId = v.Id
|
||||
if self.nCurLevelId == nLevelId then
|
||||
if self.battleItemCtrl == nil then
|
||||
local itemObj = instantiate(self._mapNode.goLevelBattleItem, self._mapNode.levelListContent)
|
||||
self.battleItemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.JointDrill.JointDrillLevelItemCtrl")
|
||||
end
|
||||
self.battleItemCtrl.gameObject:SetActive(true)
|
||||
self.battleItemCtrl:SetItem(v, self.nCurLevelId)
|
||||
else
|
||||
if self.tbLevelItemCtrl[nIndex] == nil then
|
||||
local itemObj = instantiate(self._mapNode.goLevelItem, self._mapNode.levelListContent)
|
||||
itemCtrl = self:BindCtrlByNode(itemObj, "Game.UI.JointDrill.JointDrillLevelItemCtrl")
|
||||
table.insert(self.tbLevelItemCtrl, itemCtrl)
|
||||
else
|
||||
itemCtrl = self.tbLevelItemCtrl[nIndex]
|
||||
end
|
||||
if itemCtrl ~= nil then
|
||||
itemCtrl.gameObject:SetActive(true)
|
||||
itemCtrl:SetItem(v)
|
||||
end
|
||||
nIndex = nIndex + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
self._mapNode.goLevelList.gameObject:SetActive(false)
|
||||
self._mapNode.goChallengeEnd.gameObject:SetActive(true)
|
||||
end
|
||||
local nCurCount = PlayerData.Item:GetItemCountByID(self.nTicketId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketCount, orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Ticket"), nCurCount, self.nMaxTicketCount))
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:RefreshLevelInfo()
|
||||
self._mapNode.goMain.gameObject:SetActive(false)
|
||||
self._mapNode.goLevelInfo.gameObject:SetActive(true)
|
||||
self._mapNode.goInBattle.gameObject:SetActive(self.bInBattle)
|
||||
self._mapNode.goNormal.gameObject:SetActive(not self.bInBattle)
|
||||
self._mapNode.animRoot:Play("JointDrill_LevelInfo_in", 0, 0)
|
||||
if self.bInBattle then
|
||||
self._mapNode.animatorContinue:Play("JointDrill_Btn_Continue", 0, 0)
|
||||
self._mapNode.animatorCancel:Play("JointDrill_Btn_Cancel", 0, 0)
|
||||
else
|
||||
self._mapNode.animatorStart:Play("JointDrill_Btn_Start", 0, 0)
|
||||
self._mapNode.animatorSimulation:Play("JointDrill_Btn_Small", 0, 0)
|
||||
self._mapNode.animatorFastBattle:Play("JointDrill_Btn_Small", 0, 0)
|
||||
end
|
||||
local mapLevelCfg = ConfigTable.GetData("JointDrillLevel", self.nSelectLevelId)
|
||||
if mapLevelCfg == nil then
|
||||
return
|
||||
end
|
||||
local nBossHp, nBossHpMax = 0, 0
|
||||
local bSimulate = PlayerData.JointDrill:GetBattleSimulate()
|
||||
if self.bInBattle then
|
||||
local mapBossInfo = PlayerData.JointDrill:GetJointDrillBossInfo()
|
||||
nBossHp = mapBossInfo.nHp
|
||||
nBossHpMax = mapBossInfo.nHpMax
|
||||
local tbTeams = PlayerData.JointDrill:GetJointDrillBuildList()
|
||||
local nChallengeCount = #tbTeams
|
||||
self.nAllChallengeCount = PlayerData.JointDrill:GetMaxChallengeCount(self.nSelectLevelId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeCount, orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Count"), self.nAllChallengeCount - nChallengeCount))
|
||||
self:RefreshChallengeTime()
|
||||
else
|
||||
local nCurCount = PlayerData.Item:GetItemCountByID(self.nTicketId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTicketsCount, "-1")
|
||||
local bPassed = PlayerData.JointDrill:CheckPassedId(self.nSelectLevelId)
|
||||
self._mapNode.imgFastBattleLock.gameObject:SetActive(not bPassed)
|
||||
nBossHpMax = PlayerData.JointDrill:GetMonsterMaxHp(mapLevelCfg.BossId, mapLevelCfg.Difficulty)
|
||||
nBossHp = nBossHpMax
|
||||
end
|
||||
local nMonsterId = mapLevelCfg.BossId
|
||||
local nDiff = mapLevelCfg.Difficulty
|
||||
local sMonsterName = PlayerData.JointDrill:GetMonsterName(nMonsterId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossName, string.format("%s/%s", sMonsterName, ConfigTable.GetUIText("JointDrill_Difficulty_Name_" .. nDiff)))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossHp, string.format("%s/%s", nBossHp, nBossHpMax))
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBossHpBar, nBossHp / nBossHpMax)
|
||||
self._mapNode.imgSimulation.gameObject:SetActive(bSimulate)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRecLevel, mapLevelCfg.RecommendLv)
|
||||
local sScoreIcon = "Icon/BuildRank/BuildRank_" .. mapLevelCfg.RecommendBuildRank
|
||||
self:SetPngSprite(self._mapNode.imgRecommendBuild, sScoreIcon)
|
||||
local tbEET = {}
|
||||
local nMonsterId = mapLevelCfg.BossId
|
||||
local mapMonsterCfgData = ConfigTable.GetData("Monster", nMonsterId)
|
||||
if mapMonsterCfgData ~= nil then
|
||||
local nTempleteId = mapMonsterCfgData.Templete
|
||||
local mapTemplete = ConfigTable.GetData("MonsterValueTempleteAdjust", nTempleteId)
|
||||
if mapTemplete ~= nil then
|
||||
tbEET = clone(mapTemplete.WeakEET)
|
||||
end
|
||||
end
|
||||
for k, v in ipairs(self._mapNode.imgProperty) do
|
||||
v.gameObject:SetActive(tbEET[k] ~= nil)
|
||||
if tbEET[k] ~= nil then
|
||||
local sName = AllEnum.ElementIconType.Icon .. tbEET[k]
|
||||
self:SetAtlasSprite(v, "12_rare", sName)
|
||||
end
|
||||
end
|
||||
self.tbBossSkill = mapLevelCfg.BossAffix
|
||||
for k, v in ipairs(self._mapNode.imgBossSkill) do
|
||||
v.gameObject:SetActive(mapLevelCfg.BossAffix[k] ~= nil)
|
||||
if mapLevelCfg.BossAffix[k] ~= nil then
|
||||
local mapSkillCfg = ConfigTable.GetData("JointDrillAffix", mapLevelCfg.BossAffix[k])
|
||||
if mapSkillCfg ~= nil then
|
||||
self:SetPngSprite(v, mapSkillCfg.Icon)
|
||||
end
|
||||
end
|
||||
end
|
||||
local rewardData = mapLevelCfg.RewardPreview
|
||||
self.tbReward = decodeJson(rewardData)
|
||||
for i = 1, 3 do
|
||||
local bReceived = false
|
||||
if self.tbReward[i] ~= nil then
|
||||
if self.tbReward[i][3] == 1 then
|
||||
bReceived = PlayerData.JointDrill:CheckPassedId(self.nSelectLevelId)
|
||||
end
|
||||
self._mapNode.goRewardItem[i]:SetItem(self.tbReward[i][1], nil, self.tbReward[i][2], nil, bReceived, self.tbReward[i][3] == 1)
|
||||
else
|
||||
self._mapNode.goRewardItem[i]:SetItem(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:ActEnd()
|
||||
local confirmCallback = function()
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Alert,
|
||||
sContent = ConfigTable.GetUIText("JointDrill_Act_End_Tip"),
|
||||
callbackConfirm = confirmCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:SetChallengeTime(nRemainTime)
|
||||
local tbTime = timeFormat_Table(nRemainTime)
|
||||
local sTime = ""
|
||||
if tbTime.min > 0 then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_3"), tbTime.min, tbTime.sec)
|
||||
else
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_4"), tbTime.sec)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeTime, orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_Left"), sTime))
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:RefreshChallengeTime()
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCloseTime = math.floor(nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max"))
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = nCloseTime - nCurTime
|
||||
self:SetChallengeTime(nRemainTime)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:RefreshActTime()
|
||||
local actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
if actData == nil then
|
||||
return
|
||||
end
|
||||
local nRemainTime = 0
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if self.nActStatus == AllEnum.JointDrillActStatus.Start then
|
||||
local nChallengeEndTime = actData:GetChallengeEndTime()
|
||||
nRemainTime = nChallengeEndTime - nCurTime
|
||||
elseif self.nActStatus == AllEnum.JointDrillActStatus.WaitClose then
|
||||
local nActEndTime = actData:GetActCloseTime()
|
||||
nRemainTime = nActEndTime - nCurTime
|
||||
end
|
||||
self:SetActTime(nRemainTime)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:SetActTime(nRemainTime)
|
||||
if self.nActStatus == AllEnum.JointDrillActStatus.Start then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTimeCn, ConfigTable.GetUIText("JointDrill_Challenge_Time_Text"))
|
||||
elseif self.nActStatus == AllEnum.JointDrillActStatus.WaitClose then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTimeCn, ConfigTable.GetUIText("JointDrill_Act_Time_Text"))
|
||||
end
|
||||
if nRemainTime <= 0 then
|
||||
if self.nPanelType == panelType_main then
|
||||
self:RefreshLevelList()
|
||||
end
|
||||
if self.nActStatus == AllEnum.JointDrillActStatus.Closed then
|
||||
self:ActEnd()
|
||||
end
|
||||
end
|
||||
local tbTime = timeFormat_Table(nRemainTime)
|
||||
local sTime = ""
|
||||
if 0 < tbTime.day then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_1"), tbTime.day, tbTime.hour)
|
||||
elseif 0 < tbTime.hour then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_2"), tbTime.hour, tbTime.min)
|
||||
elseif 0 < tbTime.min then
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_3"), tbTime.min, tbTime.sec)
|
||||
else
|
||||
sTime = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Time_4"), tbTime.sec)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtActTime, sTime)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:RefreshRankData()
|
||||
local mapSelfRank = PlayerData.JointDrill:GetSelfRankData()
|
||||
local bRank = mapSelfRank ~= nil and mapSelfRank.Rank > 0
|
||||
self._mapNode.goRankNormal:SetActive(bRank)
|
||||
self._mapNode.goRankEmpty:SetActive(not bRank)
|
||||
if bRank then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRankValue, orderedFormat(ConfigTable.GetUIText("JointDrill_Self_Rank"), mapSelfRank.Rank))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScoreValue, mapSelfRank.Score)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:StartRankTimer()
|
||||
local nLastRankTime, nTime = PlayerData.JointDrill:GetLastRankRefreshTime()
|
||||
local nNextTime = nLastRankTime + nTime
|
||||
local checkSend = function()
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nLastRankTime == 0 or nCurTime >= nNextTime and self.nActStatus ~= AllEnum.JointDrillActStatus.Closed then
|
||||
PlayerData.JointDrill:SendJointDrillRankMsg()
|
||||
end
|
||||
end
|
||||
checkSend()
|
||||
if self.rankTimer ~= nil then
|
||||
self.rankTimer:Cancel()
|
||||
self.rankTimer = nil
|
||||
end
|
||||
self.rankTimer = self:AddTimer(0, 10, checkSend, true, true, true)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl: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 refreshTime = function()
|
||||
nCurTime = ClientManager.serverTimeStamp
|
||||
local nRemainTime = nNextRefreshTime - nCurTime
|
||||
local sTime = timeFormat_HMS(nRemainTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRefreshTime, orderedFormat(ConfigTable.GetUIText("JointDrill_Tickets_Refresh_Time"), sTime))
|
||||
end
|
||||
refreshTime()
|
||||
self.ticketRefreshTimer = self:AddTimer(0, 1, function()
|
||||
refreshTime()
|
||||
end, true, true, true)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:Awake()
|
||||
self.nPanelType = panelType_main
|
||||
self.nSelectLevelId = 0
|
||||
self.nTicketId = ConfigTable.GetConfigNumber("JointDrill_Challenge_Tickets_Id")
|
||||
self.nMaxTicketCount = ConfigTable.GetConfigNumber("JointDrill_Challenge_Tickets_Max")
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.nTicketId)
|
||||
if mapItemCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgTickets, mapItemCfg.Icon)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTipsName, mapItemCfg.Title)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTipsContent, ConfigTable.GetUIText("JointDrill_Tickets_Desc"))
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEnable()
|
||||
self._mapNode.goAvgWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goSmoke.gameObject:SetActive(false)
|
||||
self._mapNode.goLevelItem.gameObject:SetActive(false)
|
||||
self._mapNode.goLevelBattleItem.gameObject:SetActive(false)
|
||||
self._mapNode.goTip.gameObject:SetActive(false)
|
||||
self.tbLevelItemCtrl = {}
|
||||
self.nRankReqCount = 0
|
||||
self.nActStatus = 0
|
||||
local tbParam = self:GetPanelParam()
|
||||
if 0 < #tbParam then
|
||||
self.nActId = tbParam[1]
|
||||
local mapCfg = ConfigTable.GetData("JointDrillControl", self.nActId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
self.nGroupId = mapCfg.DrillLevelGroupId
|
||||
self:SetPngSprite(self._mapNode.imgBg, "UI/Play_JointDrill/SpriteAtlas/Sprite/" .. mapCfg.BG)
|
||||
end
|
||||
local callback = function()
|
||||
end
|
||||
PlayerData.Build:GetAllBuildBriefData(callback)
|
||||
self.nActStatus = PlayerData.JointDrill:GetActStatus()
|
||||
self._mapNode.goSmoke.gameObject:SetActive(false)
|
||||
self._mapNode.goSmoke.gameObject:SetActive(true)
|
||||
self:RefreshActTime()
|
||||
self:Refresh()
|
||||
self:StartTicketsRefreshTimer()
|
||||
self:RefreshAvgInfo()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnDisable()
|
||||
if self.ticketRefreshTimer ~= nil then
|
||||
self.ticketRefreshTimer:Cancel()
|
||||
self.ticketRefreshTimer = nil
|
||||
end
|
||||
if self.rankTimer ~= nil then
|
||||
self.rankTimer:Cancel()
|
||||
self.rankTimer = nil
|
||||
end
|
||||
if self.battleItemCtrl ~= nil then
|
||||
destroy(self.battleItemCtrl.gameObject)
|
||||
self:UnbindCtrlByNode(self.battleItemCtrl)
|
||||
end
|
||||
self.battleItemCtrl = nil
|
||||
for _, v in ipairs(self.tbLevelItemCtrl) do
|
||||
destroy(v.gameObject)
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbLevelItemCtrl = {}
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Avg()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Quest()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillQuest)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Tickets()
|
||||
if self.nTicketId ~= nil then
|
||||
self._mapNode.goTip.gameObject:SetActive(true)
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.nTicketId)
|
||||
if mapItemCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTipsContent, mapItemCfg.Desc)
|
||||
end
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_TipsBg()
|
||||
self._mapNode.goTip.gameObject:SetActive(false)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_RankDetail()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillRanking, self.nActId)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_LevelBack()
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_LevelHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Start()
|
||||
local bInChallengeTime = PlayerData.JointDrill:CheckActChallengeTime()
|
||||
if not bInChallengeTime then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Challenge_End_Tip"))
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
return
|
||||
end
|
||||
local nCurCount = PlayerData.Item:GetItemCountByID(self.nTicketId)
|
||||
if nCurCount <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Tickets_NotEnough"))
|
||||
return
|
||||
end
|
||||
if self.nSelectLevelId == 0 then
|
||||
printError("LevelId 错误")
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillBuildList, self.nSelectLevelId, false)
|
||||
end
|
||||
callback()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Continue()
|
||||
local callback = function()
|
||||
self.bInBattle = PlayerData.JointDrill:CheckJointDrillInBattle()
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
end
|
||||
local nStartTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCloseTime = math.floor(nStartTime + ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max"))
|
||||
if nCloseTime <= ClientManager.serverTimeStamp then
|
||||
PlayerData.JointDrill:JointDrillGameOver(callback, true)
|
||||
return
|
||||
end
|
||||
local bInChallengeTime = PlayerData.JointDrill:CheckActChallengeTime()
|
||||
if not bInChallengeTime then
|
||||
PlayerData.JointDrill:JointDrillGameOver(callback, true)
|
||||
return
|
||||
end
|
||||
local bSimulate = PlayerData.JointDrill:GetBattleSimulate()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillBuildList, self.nSelectLevelId, bSimulate)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Simulation()
|
||||
local bInChallengeTime = PlayerData.JointDrill:CheckActChallengeTime()
|
||||
if not bInChallengeTime then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Challenge_End_Tip"))
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
return
|
||||
end
|
||||
if self.nSelectLevelId == 0 then
|
||||
printError("LevelId 错误")
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillBuildList, self.nSelectLevelId, true)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Cancel()
|
||||
local sTip = ConfigTable.GetUIText("JointDrill_Give_Up_Tip")
|
||||
local callback = function()
|
||||
local gameOverCallback = function()
|
||||
self.bInBattle = PlayerData.JointDrill:CheckJointDrillInBattle()
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
end
|
||||
PlayerData.JointDrill:JointDrillGameOver(gameOverCallback, true)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = callback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_FastBattle()
|
||||
local bInChallengeTime = PlayerData.JointDrill:CheckActChallengeTime()
|
||||
if not bInChallengeTime then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Challenge_End_Tip"))
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
return
|
||||
end
|
||||
if not PlayerData.JointDrill:CheckPassedId(self.nSelectLevelId) then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Fast_Battle_Tip"))
|
||||
return
|
||||
end
|
||||
local nCurTicketCount = PlayerData.Item:GetItemCountByID(self.nTicketId)
|
||||
if nCurTicketCount <= 0 then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Tickets_NotEnough"))
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillRaid, self.nSelectLevelId)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_RefreshJointDrillLevel()
|
||||
self:Refresh()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_SelectJointDrillLevel(nLevelId)
|
||||
if self.nPanelType == panelType_main then
|
||||
local bInChallengeTime = PlayerData.JointDrill:CheckActChallengeTime()
|
||||
if not bInChallengeTime then
|
||||
local gameOverCallback = function()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Challenge_End_Tip"))
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
end
|
||||
if self.bInBattle then
|
||||
PlayerData.JointDrill:JointDrillGameOver(gameOverCallback, true)
|
||||
else
|
||||
gameOverCallback()
|
||||
end
|
||||
return
|
||||
end
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
||||
"JointDrill_Main_out"
|
||||
})
|
||||
self._mapNode.animRoot:Play("JointDrill_Main_out")
|
||||
self._mapNode.goSmoke.gameObject:SetActive(false)
|
||||
self._mapNode.goSmoke.gameObject:SetActive(true)
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self.nPanelType = panelType_levelInfo
|
||||
self.nSelectLevelId = nLevelId
|
||||
self:RefreshLevelInfo()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_GetJointDrillRankSuc()
|
||||
local nLastRankTime, nTime = PlayerData.JointDrill:GetLastRankRefreshTime()
|
||||
local nNextTime = nLastRankTime + nTime
|
||||
local nCurTime = ClientManager.serverTimeStamp
|
||||
if nLastRankTime == 0 or nNextTime <= nCurTime then
|
||||
self:RefreshRankData()
|
||||
return
|
||||
end
|
||||
self:StartRankTimer()
|
||||
self:RefreshRankData()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_JointDrillRaidSuccess(netMsg)
|
||||
local mapSelfRank = PlayerData.JointDrill:GetSelfRankData()
|
||||
local nRank = 0
|
||||
local nScoreOld = 0
|
||||
if mapSelfRank ~= nil then
|
||||
nRank = mapSelfRank.Rank
|
||||
nScoreOld = mapSelfRank.Score
|
||||
end
|
||||
local nTotalScoreOld = PlayerData.JointDrill:GetTotalRankScore()
|
||||
local nScore = math.max(netMsg.Score - nTotalScoreOld, 0)
|
||||
local mapScore = {
|
||||
nScore = nScore,
|
||||
nTotalScore = netMsg.Score,
|
||||
nScoreOld = nScoreOld
|
||||
}
|
||||
local callback = function()
|
||||
if netMsg.Rewards ~= nil then
|
||||
local tabItem = {}
|
||||
for k, v in ipairs(netMsg.Rewards) do
|
||||
for _, item in ipairs(v.Items) do
|
||||
if tabItem[item.Tid] == nil then
|
||||
tabItem[item.Tid] = 0
|
||||
end
|
||||
tabItem[item.Tid] = tabItem[item.Tid] + item.Qty
|
||||
end
|
||||
end
|
||||
local tbShowItem = {}
|
||||
for nId, nCount in pairs(tabItem) do
|
||||
table.insert(tbShowItem, {Tid = nId, Qty = nCount})
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(tbShowItem, netMsg.Change)
|
||||
end
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillRankUp, nRank, nRank, mapScore, AllEnum.JointDrillResultType.ChallengeEnd, callback)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_RefreshChallengeTime(nRemainTime)
|
||||
self:SetChallengeTime(nRemainTime)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_RefreshJointDrillActTime(nStatus, nRemainTime)
|
||||
self.nActStatus = nStatus
|
||||
self:SetActTime(nRemainTime)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Skill(btn, nIndex)
|
||||
if self.tbBossSkill[nIndex] ~= nil then
|
||||
local nSkillId = self.tbBossSkill[nIndex]
|
||||
if nSkillId ~= 0 then
|
||||
local mapData = {nSkillId = nSkillId, bJointDrill = true}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.SkillTips, btn.transform, mapData)
|
||||
end
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_Reward(btn, nIndex)
|
||||
if self.tbReward[nIndex] ~= nil then
|
||||
local nTid = self.tbReward[nIndex][1]
|
||||
UTILS.ClickItemGridWithTips(nTid, btn.transform, true, true, false)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_CloseAvgWindow()
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
local closeWindow = function()
|
||||
self._mapNode.goAvgWindow.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.3, closeWindow, true, true, true, false)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_CancelAvgWindow()
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
local closeWindow = function()
|
||||
self._mapNode.goAvgWindow.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.3, closeWindow, true, true, true, false)
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnBtnClick_StartAvg()
|
||||
self:PlayAvg()
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_Back()
|
||||
if self.nPanelType == panelType_levelInfo then
|
||||
local nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animRoot, {
|
||||
"JointDrill_LevelInfo_out"
|
||||
})
|
||||
self._mapNode.animRoot:Play("JointDrill_LevelInfo_out")
|
||||
self._mapNode.goSmoke.gameObject:SetActive(false)
|
||||
self._mapNode.goSmoke.gameObject:SetActive(true)
|
||||
self:AddTimer(1, nAnimTime, function()
|
||||
self.nPanelType = panelType_main
|
||||
self:RefreshLevelList()
|
||||
end, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
else
|
||||
EventManager.Hit(EventId.CloesCurPanel)
|
||||
end
|
||||
end
|
||||
function JointDrillLevelSelectCtrl:OnEvent_BackHome()
|
||||
PanelManager.Home()
|
||||
end
|
||||
return JointDrillLevelSelectCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local JointDrillLevelSelectPanel = class("JointDrillLevelSelectPanel", BasePanel)
|
||||
JointDrillLevelSelectPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillLevelSelect.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillLevelSelectCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillLevelSelectPanel:Awake()
|
||||
end
|
||||
function JointDrillLevelSelectPanel:OnEnable()
|
||||
end
|
||||
function JointDrillLevelSelectPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillLevelSelectPanel:OnDisable()
|
||||
end
|
||||
function JointDrillLevelSelectPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillLevelSelectPanel:OnRelease()
|
||||
end
|
||||
return JointDrillLevelSelectPanel
|
||||
@@ -0,0 +1,40 @@
|
||||
local JointDrillBattleMenuCtrl = class("JointDrillBattleMenuCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
JointDrillBattleMenuCtrl._mapNodeConfig = {
|
||||
canvas_group = {
|
||||
sComponentName = "CanvasGroup",
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
btnPause = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtn_Pause"
|
||||
},
|
||||
BtnBg = {}
|
||||
}
|
||||
JointDrillBattleMenuCtrl._mapEventConfig = {
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
|
||||
JointDrill_StopTime = "OnEvent_JointDrill_StopTime"
|
||||
}
|
||||
function JointDrillBattleMenuCtrl:OnEnable()
|
||||
self._mapNode.btnPause.gameObject:SetActive(false)
|
||||
GamepadUIManager.AddGamepadUINode("BattleMenu", self:GetGamepadUINode())
|
||||
end
|
||||
function JointDrillBattleMenuCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillBattleMenuCtrl:OnBtn_Pause()
|
||||
EventManager.Hit("BattlePause")
|
||||
end
|
||||
function JointDrillBattleMenuCtrl:OnEvent_InputEnable(bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvas_group, bEnable == true and 1 or 0)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvas_group, bEnable == true)
|
||||
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvas_group, bEnable == true)
|
||||
self._mapNode.btnPause.interactable = bEnable == true
|
||||
end
|
||||
function JointDrillBattleMenuCtrl:OnEvent_LoadLevelRefresh()
|
||||
self._mapNode.btnPause.gameObject:SetActive(true)
|
||||
end
|
||||
function JointDrillBattleMenuCtrl:OnEvent_JointDrill_StopTime()
|
||||
self._mapNode.BtnBg.gameObject:SetActive(false)
|
||||
end
|
||||
return JointDrillBattleMenuCtrl
|
||||
@@ -0,0 +1,286 @@
|
||||
local JointDrillPauseCtrl = class("JointDrillPauseCtrl", BaseCtrl)
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
JointDrillPauseCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
aniWindow = {
|
||||
sNodeName = "PauseWindow",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Pause"
|
||||
},
|
||||
txtChallengeTimeCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Challenge_Time_Left_Text"
|
||||
},
|
||||
txtChallengeTime = {sComponentName = "TMP_Text"},
|
||||
txtBattleTimeCn = {sComponentName = "TMP_Text"},
|
||||
txtBattleTime = {sComponentName = "TMP_Text"},
|
||||
btnChar = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
goChar = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnChar",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharCtrl"
|
||||
},
|
||||
btnGiveUp = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_GiveUp"
|
||||
},
|
||||
txtBtnGiveUp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_GiveUp"
|
||||
},
|
||||
btnRestart = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Restart",
|
||||
sAction = "Retry"
|
||||
},
|
||||
txtBtnRestart = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Restart"
|
||||
},
|
||||
btnRetreat = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Retreat"
|
||||
},
|
||||
txtBtnRetreat = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Retreat"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Back",
|
||||
sAction = "Back"
|
||||
},
|
||||
txtBtnBack = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Continue"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Back"
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
}
|
||||
}
|
||||
JointDrillPauseCtrl._mapEventConfig = {
|
||||
OpenJointDrillPause = "OnEvent_OpenJointDrillPause",
|
||||
RefreshChallengeTime = "OnEvent_RefreshChallengeTime"
|
||||
}
|
||||
JointDrillPauseCtrl._mapRedDotConfig = {}
|
||||
function JointDrillPauseCtrl: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")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function JointDrillPauseCtrl:RefreshChallengeTime()
|
||||
local nOpenTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local refreshTime = function()
|
||||
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local nTime = self.nAllChallengeTime - (nCurTime - nOpenTime)
|
||||
nTime = math.max(nTime, 0)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
return nTime
|
||||
end
|
||||
local nTime = refreshTime()
|
||||
if 0 < nTime then
|
||||
self.challengeTimer = self:AddTimer(0, 1, function()
|
||||
local nTime = refreshTime()
|
||||
if nTime <= 0 then
|
||||
self.challengeTimer:Cancel()
|
||||
self.challengeTimer = nil
|
||||
end
|
||||
end, true, true, true)
|
||||
end
|
||||
end
|
||||
function JointDrillPauseCtrl:Refresh(nTime)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i].gameObject:SetActive(self.tbChar[i])
|
||||
if self.tbChar[i] then
|
||||
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
|
||||
end
|
||||
end
|
||||
if self.challengeTimer == nil then
|
||||
self:RefreshChallengeTime()
|
||||
end
|
||||
nTime = nTime or 0
|
||||
nTime = self.nTotalTime * 1000 - nTime
|
||||
local nMin = math.floor(nTime / 60000)
|
||||
local nRemain = nTime % 60000
|
||||
local nSec = math.floor(nRemain / 1000)
|
||||
local nMs = nTime % 1000
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleTime, string.format("%02d:%02d:%03d", nMin, nSec, nMs))
|
||||
end
|
||||
function JointDrillPauseCtrl:PlayCloseAni(callback)
|
||||
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, callback)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnPanelClose(_, callback)
|
||||
PanelManager.InputEnable()
|
||||
GamepadUIManager.DisableGamepadUI("JointDrillPauseCtrl")
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
self.bShow = false
|
||||
end
|
||||
function JointDrillPauseCtrl:Awake()
|
||||
self.nAllChallengeTime = ConfigTable.GetConfigNumber("JointDrill_Challenge_Time_Max")
|
||||
self.nTotalTime = 0
|
||||
local nLevelId = PlayerData.JointDrill:GetJointDrillLevelId()
|
||||
local mapCfg = ConfigTable.GetData("JointDrillLevel", nLevelId)
|
||||
if mapCfg ~= nil then
|
||||
self.nTotalTime = mapCfg.BattleTime
|
||||
end
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Giveup",
|
||||
sLang = "JointDrill_Battle_GiveUp"
|
||||
},
|
||||
{
|
||||
sAction = "Leave",
|
||||
sLang = "JointDrill_Battle_Retreat"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillPauseCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillPauseCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillPauseCtrl:OnBtnClick_Char(btn, index)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnBtnClick_GiveUp()
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(function()
|
||||
NovaAPI.DispatchEventWithData("JointDrill_Level_GiveUp")
|
||||
EventManager.Hit("GiveUpJointDrill")
|
||||
end)
|
||||
end
|
||||
local nOpenTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local nTime = self.nAllChallengeTime - (nCurTime - nOpenTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("JointDrill_Battle_GiveUp_Tip"), string.format("%02d:%02d", nMin, nSec))
|
||||
local sContentSub = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Count"), self.nAllBattleCount - self.nCurBattleCount)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
sContentSub = sContentSub,
|
||||
callbackConfirm = confirmCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnBtnClick_Restart()
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(function()
|
||||
EventManager.Hit("RestartJointDrill")
|
||||
end)
|
||||
end
|
||||
local nOpenTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local nTime = self.nAllChallengeTime - (nCurTime - nOpenTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("JointDrill_Battle_Restart_Tip"), string.format("%02d:%02d", nMin, nSec))
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = confirmCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnBtnClick_Retreat()
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(function()
|
||||
EventManager.Hit("RetreatJointDrill")
|
||||
end)
|
||||
end
|
||||
local nOpenTime = PlayerData.JointDrill:GetJointDrillStartTime()
|
||||
local nCurTime = CS.ClientManager.Instance.serverTimeStamp
|
||||
local nTime = self.nAllChallengeTime - (nCurTime - nOpenTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
local sTip = orderedFormat(ConfigTable.GetUIText("JointDrill_Battle_Retreat_Tip"), string.format("%02d:%02d", nMin, nSec))
|
||||
local sContentSub = orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Count"), self.nAllBattleCount - self.nCurBattleCount + 1)
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
sContentSub = sContentSub,
|
||||
callbackConfirm = confirmCallback
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnBtnClick_Back()
|
||||
self:PlayCloseAni()
|
||||
end
|
||||
function JointDrillPauseCtrl:OnEvent_OpenJointDrillPause(nLevelId, tbCharId, nBattleTime)
|
||||
self.bShow = true
|
||||
self.tbChar = tbCharId
|
||||
self.nLevelId = nLevelId
|
||||
local tbTeam = PlayerData.JointDrill:GetJointDrillBuildList()
|
||||
self.nCurBattleCount = #tbTeam
|
||||
self.nAllBattleCount = 0
|
||||
local mapLevelCfg = ConfigTable.GetData("JointDrillLevel", self.nLevelId)
|
||||
if mapLevelCfg ~= nil then
|
||||
self.nAllBattleCount = mapLevelCfg.MaxBattleNum
|
||||
end
|
||||
local sCount = ConfigTable.GetUIText("JointDrill_Battle_Time_" .. self.nCurBattleCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleTimeCn, ConfigTable.GetUIText("JointDrill_Battle_Time_Text"))
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
PanelManager.InputDisable()
|
||||
self:PlayInAni()
|
||||
self:Refresh(nBattleTime)
|
||||
GamepadUIManager.EnableGamepadUI("JointDrillPauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function JointDrillPauseCtrl:OnEvent_RefreshChallengeTime(nTime)
|
||||
if not self.bShow then
|
||||
return
|
||||
end
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
return JointDrillPauseCtrl
|
||||
@@ -0,0 +1,118 @@
|
||||
local JointDrillQuestCtrl = class("JointDrillQuestCtrl", BaseCtrl)
|
||||
JointDrillQuestCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
btnBgClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
animWindow = {sNodeName = "goWindow", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Score_Reward"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Week_Score_All"
|
||||
},
|
||||
txtWeekScore = {sComponentName = "TMP_Text"},
|
||||
questLSV = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
btnReceive = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Receive"
|
||||
},
|
||||
txtBtnReceive = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Quest_Receive_All"
|
||||
}
|
||||
}
|
||||
JointDrillQuestCtrl._mapEventConfig = {}
|
||||
JointDrillQuestCtrl._mapRedDotConfig = {}
|
||||
function JointDrillQuestCtrl:Refresh()
|
||||
for goGrid, objCtrl in pairs(self.mapQuestGrid) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestGrid[goGrid] = nil
|
||||
end
|
||||
self.tbQuests = PlayerData.JointDrill:GetRewardQuestList()
|
||||
self._mapNode.questLSV:Init(#self.tbQuests, self, self.RefreshGrid)
|
||||
local nTotalScore = PlayerData.JointDrill:GetTotalRankScore()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWeekScore, FormatWithCommas(nTotalScore))
|
||||
end
|
||||
function JointDrillQuestCtrl:RefreshGrid(goGrid, gridIndex)
|
||||
local nIndex = gridIndex + 1
|
||||
if self.mapQuestGrid[goGrid] == nil then
|
||||
self.mapQuestGrid[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.JointDrill.JointDrillQuestItemCtrl")
|
||||
end
|
||||
local mapQuest = self.tbQuests[nIndex]
|
||||
self.mapQuestGrid[goGrid]:SetItem(mapQuest)
|
||||
end
|
||||
function JointDrillQuestCtrl:PlayCloseAni(callback)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, callback)
|
||||
end
|
||||
function JointDrillQuestCtrl:OnPanelClose(_, callback)
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillQuest)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function JointDrillQuestCtrl:Awake()
|
||||
self.nActId = 0
|
||||
self.mapQuestGrid = {}
|
||||
end
|
||||
function JointDrillQuestCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if tbParam ~= nil then
|
||||
self.nActId = tbParam[1]
|
||||
end
|
||||
self._mapNode.safeAreaRoot.gameObject:SetActive(false)
|
||||
self._mapNode.goBlur.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot.gameObject:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:Refresh()
|
||||
end
|
||||
function JointDrillQuestCtrl:OnDisable()
|
||||
for goGrid, objCtrl in pairs(self.mapQuestGrid) do
|
||||
self:UnbindCtrlByNode(objCtrl)
|
||||
self.mapQuestGrid[goGrid] = nil
|
||||
end
|
||||
self.mapQuestGrid = {}
|
||||
end
|
||||
function JointDrillQuestCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillQuestCtrl:OnBtnClick_Close()
|
||||
self:PlayCloseAni()
|
||||
end
|
||||
function JointDrillQuestCtrl:OnBtnClick_Receive()
|
||||
local bReceive = false
|
||||
for _, v in ipairs(self.tbQuests) do
|
||||
if v.Status == 1 then
|
||||
bReceive = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not bReceive then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Receive_Quest_Reward_Tip"))
|
||||
return
|
||||
end
|
||||
local callback = function()
|
||||
self:Refresh()
|
||||
end
|
||||
PlayerData.JointDrill:SendReceiveQuestReward(callback)
|
||||
end
|
||||
return JointDrillQuestCtrl
|
||||
@@ -0,0 +1,62 @@
|
||||
local JointDrillQuestItemCtrl = class("JointDrillQuestItemCtrl", BaseCtrl)
|
||||
JointDrillQuestItemCtrl._mapNodeConfig = {
|
||||
itemCanvasGroup = {
|
||||
sNodeName = "goItem",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtDesc = {sComponentName = "TMP_Text"},
|
||||
btnReward = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
goReward = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
},
|
||||
imgComplete = {},
|
||||
imgUnComplete = {}
|
||||
}
|
||||
JointDrillQuestItemCtrl._mapEventConfig = {}
|
||||
JointDrillQuestItemCtrl._mapRedDotConfig = {}
|
||||
function JointDrillQuestItemCtrl:SetItem(mapQuestData)
|
||||
local mapQuestCfg = ConfigTable.GetData("JointDrillQuest", mapQuestData.Id)
|
||||
if mapQuestCfg ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDesc, mapQuestCfg.Title)
|
||||
self.tbReward = {}
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnReward[i].gameObject:SetActive(mapQuestCfg["AwardItemTid" .. i] ~= 0)
|
||||
if mapQuestCfg["AwardItemTid" .. i] ~= 0 then
|
||||
local nTid = mapQuestCfg["AwardItemTid" .. i]
|
||||
local nCount = mapQuestCfg["AwardItemNum" .. i]
|
||||
table.insert(self.tbReward, {nTid = nTid, nCount = nCount})
|
||||
local bReceived = mapQuestData.Status == 2
|
||||
self._mapNode.goReward[i]:SetItem(nTid, nil, nCount, nil, bReceived)
|
||||
end
|
||||
end
|
||||
self._mapNode.imgComplete.gameObject:SetActive(mapQuestData.Status ~= 0)
|
||||
self._mapNode.imgUnComplete.gameObject:SetActive(mapQuestData.Status == 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.itemCanvasGroup, mapQuestData.Status == 2 and 0.6 or 1)
|
||||
end
|
||||
end
|
||||
function JointDrillQuestItemCtrl:Awake()
|
||||
end
|
||||
function JointDrillQuestItemCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillQuestItemCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillQuestItemCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillQuestItemCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
if self.tbReward[nIndex] == nil then
|
||||
return
|
||||
end
|
||||
local nTid = self.tbReward[nIndex].nTid
|
||||
local mapData = {
|
||||
nTid = nTid,
|
||||
bShowDepot = true,
|
||||
bShowJumpto = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.ItemTips, btn.transform, mapData)
|
||||
end
|
||||
return JointDrillQuestItemCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local JointDrillQuestPanel = class("JointDrillQuestPanel", BasePanel)
|
||||
JointDrillQuestPanel._bIsMainPanel = false
|
||||
JointDrillQuestPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillQuestPanel.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillQuestCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillQuestPanel:Awake()
|
||||
end
|
||||
function JointDrillQuestPanel:OnEnable()
|
||||
end
|
||||
function JointDrillQuestPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillQuestPanel:OnDisable()
|
||||
end
|
||||
function JointDrillQuestPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillQuestPanel:OnRelease()
|
||||
end
|
||||
return JointDrillQuestPanel
|
||||
@@ -0,0 +1,205 @@
|
||||
local JointDrillRaidCtrl = class("JointDrillRaidCtrl", BaseCtrl)
|
||||
JointDrillRaidCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
btnBgClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
animWindow = {
|
||||
sNodeName = "---RaidCount---",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Title_Raid"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtRaidCountCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_RaidCount"
|
||||
},
|
||||
txtRaidCount = {sComponentName = "TMP_Text"},
|
||||
txtRaidTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Fast_Battle_Tip_Text"
|
||||
},
|
||||
imgEnergy = {sComponentName = "Image"},
|
||||
txtEnergyCount = {sComponentName = "TMP_Text"},
|
||||
Slider = {
|
||||
sComponentName = "Slider",
|
||||
callback = "OnValueChange_Slider"
|
||||
},
|
||||
btnReduce = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reduce"
|
||||
},
|
||||
btnAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Add"
|
||||
},
|
||||
btnGrayAdd = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MaxGray"
|
||||
},
|
||||
btnGrayReduce = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_MinGray"
|
||||
},
|
||||
btnConfirm1 = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Confirm"
|
||||
},
|
||||
txtBtnConfirm = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Raid_Btn_Raid"
|
||||
},
|
||||
btnCancel = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Cancel"
|
||||
},
|
||||
txtBtnCancel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MessageBox_Cancel"
|
||||
}
|
||||
}
|
||||
JointDrillRaidCtrl._mapEventConfig = {
|
||||
JointDrillRaidSuccess = "OnEvent_JointDrillRaidSuccess"
|
||||
}
|
||||
JointDrillRaidCtrl._mapRedDotConfig = {}
|
||||
function JointDrillRaidCtrl:Refresh()
|
||||
local mapItemCfg = ConfigTable.GetData_Item(self.nTicketsId)
|
||||
if mapItemCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgEnergy, mapItemCfg.Icon)
|
||||
end
|
||||
self:RefreshData()
|
||||
self:RefreshCount()
|
||||
self:RefreshBar()
|
||||
end
|
||||
function JointDrillRaidCtrl:RefreshData()
|
||||
self.nTicketsCount = PlayerData.Item:GetItemCountByID(self.nTicketsId)
|
||||
self.nMaxCount = self.nTicketsCount
|
||||
NovaAPI.SetSliderMinValue(self._mapNode.Slider, 1)
|
||||
NovaAPI.SetSliderMaxValue(self._mapNode.Slider, self.nMaxCount)
|
||||
NovaAPI.SetSliderInteractable(self._mapNode.Slider, self.nMaxCount > 1)
|
||||
end
|
||||
function JointDrillRaidCtrl:RefreshCount()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRaidCount, self.nSelectCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtEnergyCount, self.nSelectCount)
|
||||
NovaAPI.SetTMPColor(self._mapNode.txtEnergyCount, self.nTicketsCount < self.nSelectCount and Red_Unable or Blue_Normal)
|
||||
self:RefreshAddButton(self.nSelectCount < self.nMaxCount)
|
||||
self:RefreshReduceButton(self.nSelectCount > 1)
|
||||
end
|
||||
function JointDrillRaidCtrl:RefreshAddButton(bAble)
|
||||
self._mapNode.btnGrayAdd.gameObject:SetActive(not bAble)
|
||||
self._mapNode.btnAdd.gameObject:SetActive(bAble)
|
||||
end
|
||||
function JointDrillRaidCtrl:RefreshReduceButton(bAble)
|
||||
self._mapNode.btnGrayReduce.gameObject:SetActive(not bAble)
|
||||
self._mapNode.btnReduce.gameObject:SetActive(bAble)
|
||||
end
|
||||
function JointDrillRaidCtrl:RefreshBar()
|
||||
NovaAPI.SetSliderValue(self._mapNode.Slider, self.nSelectCount)
|
||||
end
|
||||
function JointDrillRaidCtrl:PlayOutAni()
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
local closeCall = function()
|
||||
self:Close()
|
||||
end
|
||||
self:AddTimer(1, 0.2, closeCall, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function JointDrillRaidCtrl:Close()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillRaid)
|
||||
end
|
||||
function JointDrillRaidCtrl:Awake()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if tbParam ~= nil then
|
||||
self.nSelectLevelId = tbParam[1]
|
||||
end
|
||||
self.nSelectCount = 1
|
||||
self._mapNode.animWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goBlur.gameObject:SetActive(true)
|
||||
self._mapNode.btnBgClose.gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.animWindow.gameObject:SetActive(true)
|
||||
self._mapNode.btnBgClose.gameObject:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
self.nTicketsId = ConfigTable.GetConfigNumber("JointDrill_Challenge_Tickets_Id")
|
||||
self:Refresh()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function JointDrillRaidCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnRelease()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_Cancel(btn)
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnValueChange_Slider(_, value)
|
||||
self.nSelectCount = math.ceil(value)
|
||||
self:RefreshCount()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_Add(btn)
|
||||
local nRemain = self.nMaxCount - self.nSelectCount
|
||||
if nRemain <= 0 then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nSelectCount = self.nSelectCount + 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
local nAdd = 2 ^ btn.CurrentGear
|
||||
local nAfterRemain = nRemain - nAdd
|
||||
if nAfterRemain < 0 then
|
||||
nAdd = nRemain
|
||||
end
|
||||
self.nSelectCount = math.floor(self.nSelectCount + nAdd)
|
||||
end
|
||||
self:RefreshCount()
|
||||
self:RefreshBar()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_Reduce(btn)
|
||||
if self.nSelectCount <= 1 then
|
||||
return
|
||||
end
|
||||
if btn.Operate_Type == 0 then
|
||||
self.nSelectCount = self.nSelectCount - 1
|
||||
elseif btn.Operate_Type == 3 then
|
||||
self.nSelectCount = math.floor(self.nSelectCount - 2 ^ btn.CurrentGear)
|
||||
end
|
||||
if self.nSelectCount < 1 then
|
||||
self.nSelectCount = 1
|
||||
end
|
||||
self:RefreshCount()
|
||||
self:RefreshBar()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_Confirm(btn)
|
||||
if self.nTicketsCount < self.nSelectCount then
|
||||
return
|
||||
end
|
||||
PlayerData.JointDrill:SendJointDrillSweepMsg(self.nSelectLevelId, self.nSelectCount)
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_MinGray()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Crafting_Count_Min"))
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_MaxGray()
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("Crafting_Count_Max"))
|
||||
end
|
||||
function JointDrillRaidCtrl:OnBtnClick_Close()
|
||||
self:PlayOutAni()
|
||||
end
|
||||
function JointDrillRaidCtrl:OnEvent_JointDrillRaidSuccess()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillRaid)
|
||||
end
|
||||
return JointDrillRaidCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local JointDrillRaidPanel = class("JointDrillRaidPanel", BasePanel)
|
||||
JointDrillRaidPanel._bIsMainPanel = false
|
||||
JointDrillRaidPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillRaidPanel.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillRaidCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillRaidPanel:Awake()
|
||||
end
|
||||
function JointDrillRaidPanel:OnEnable()
|
||||
end
|
||||
function JointDrillRaidPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillRaidPanel:OnDisable()
|
||||
end
|
||||
function JointDrillRaidPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillRaidPanel:OnRelease()
|
||||
end
|
||||
return JointDrillRaidPanel
|
||||
@@ -0,0 +1,110 @@
|
||||
local JointDrillRankDetailCtrl = class("JointDrillRankDetailCtrl", BaseCtrl)
|
||||
JointDrillRankDetailCtrl._mapNodeConfig = {
|
||||
goBlurBg = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
btnCloseBg = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
animWindow = {sNodeName = "t_window", sComponentName = "Animator"},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Detail_Title"
|
||||
},
|
||||
txtDiffCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Difficulty"
|
||||
},
|
||||
txtDiff = {sComponentName = "TMP_Text"},
|
||||
txtBattleCountCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Battle_Count"
|
||||
},
|
||||
txtBattleCount = {sComponentName = "TMP_Text"},
|
||||
txtTimeCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Battle_Time"
|
||||
},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
teamLSV = {
|
||||
sComponentName = "LoopScrollView"
|
||||
}
|
||||
}
|
||||
JointDrillRankDetailCtrl._mapEventConfig = {}
|
||||
JointDrillRankDetailCtrl._mapRedDotConfig = {}
|
||||
function JointDrillRankDetailCtrl:RefreshRankData(mapRank)
|
||||
local nBattleCount = #mapRank.Teams
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleCount, nBattleCount)
|
||||
local nTotalTime = 0
|
||||
self.tbTeams = mapRank.Teams
|
||||
for _, v in ipairs(mapRank.Teams) do
|
||||
nTotalTime = nTotalTime + v.Time
|
||||
end
|
||||
local nMin = math.floor(nTotalTime / 60000)
|
||||
local nRemain = nTotalTime % 60000
|
||||
local nSec = math.floor(nRemain / 1000)
|
||||
local nMs = nTotalTime % 1000
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d:%03d", nMin, nSec, nMs))
|
||||
self:RefreshTeamList()
|
||||
end
|
||||
function JointDrillRankDetailCtrl:RefreshTeamList()
|
||||
for _, v in ipairs(self.tbTeamGridCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbTeamGridCtrl = {}
|
||||
self._mapNode.teamLSV:Init(#self.tbTeams, self, self.RefreshGrid)
|
||||
end
|
||||
function JointDrillRankDetailCtrl:RefreshGrid(goGrid, goGridIndex)
|
||||
local nIndex = goGridIndex + 1
|
||||
local itemCtrl = self:BindCtrlByNode(goGrid, "Game.UI.JointDrill.JointDrillTeamItemCtrl")
|
||||
local mapTeam = self.tbTeams[nIndex]
|
||||
itemCtrl:RefreshItem(mapTeam, nIndex)
|
||||
self.tbTeamGridCtrl[nIndex] = itemCtrl
|
||||
end
|
||||
function JointDrillRankDetailCtrl:Awake()
|
||||
end
|
||||
function JointDrillRankDetailCtrl:OnEnable()
|
||||
self.tbTeamGridCtrl = {}
|
||||
self._mapNode.animWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goBlurBg:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.animWindow.gameObject:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
local tbParam = self:GetPanelParam()
|
||||
if 0 < #tbParam then
|
||||
local mapRank = tbParam[1]
|
||||
self:RefreshRankData(mapRank)
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function JointDrillRankDetailCtrl:OnDisable()
|
||||
for _, v in ipairs(self.tbTeamGridCtrl) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbTeamGridCtrl = {}
|
||||
end
|
||||
function JointDrillRankDetailCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillRankDetailCtrl:OnRelease()
|
||||
end
|
||||
function JointDrillRankDetailCtrl:OnBtnClick_Close()
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.goBlurBg:SetActive(false)
|
||||
local callback = function()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillRankDetail)
|
||||
end
|
||||
self:AddTimer(1, 0.3, callback, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
return JointDrillRankDetailCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local JointDrilRankDetailPanel = class("JointDrilRankDetailPanel", BasePanel)
|
||||
JointDrilRankDetailPanel._bIsMainPanel = false
|
||||
JointDrilRankDetailPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillRankDetailPanel.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillRankDetailCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrilRankDetailPanel:Awake()
|
||||
end
|
||||
function JointDrilRankDetailPanel:OnEnable()
|
||||
end
|
||||
function JointDrilRankDetailPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrilRankDetailPanel:OnDisable()
|
||||
end
|
||||
function JointDrilRankDetailPanel:OnDestroy()
|
||||
end
|
||||
function JointDrilRankDetailPanel:OnRelease()
|
||||
end
|
||||
return JointDrilRankDetailPanel
|
||||
@@ -0,0 +1,203 @@
|
||||
local JointDrillRankingCtrl = class("JointDrillRankingCtrl", BaseCtrl)
|
||||
local ClientManager = CS.ClientManager.Instance
|
||||
JointDrillRankingCtrl._mapNodeConfig = {
|
||||
TopBar = {
|
||||
sNodeName = "TopBarPanel",
|
||||
sCtrlName = "Game.UI.TopBarEx.TopBarCtrl"
|
||||
},
|
||||
goLoading = {},
|
||||
txtLoading = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Loading"
|
||||
},
|
||||
goMainContent = {},
|
||||
txtRankEndTime = {sComponentName = "TMP_Text"},
|
||||
txtRewardTime = {sComponentName = "TMP_Text"},
|
||||
txtRefreshTime = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Refresh_Tip"
|
||||
},
|
||||
svRankingInfo = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtRankingListRankTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Title_Ranking"
|
||||
},
|
||||
txtRankingListPlayerTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Title_Name"
|
||||
},
|
||||
txtRankingListScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Title_Score"
|
||||
},
|
||||
txtRankingListDetailTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Title_Detail"
|
||||
},
|
||||
txtRankingListBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Title_Build"
|
||||
},
|
||||
rtSelfRank = {
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillRankItemCtrl"
|
||||
},
|
||||
btnReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Reward"
|
||||
},
|
||||
txtBtnReward = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Reward_Btn"
|
||||
},
|
||||
goRewardView = {},
|
||||
goBlurBg = {
|
||||
sNodeName = "t_fullscreen_blur_blue"
|
||||
},
|
||||
btnRewardClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseReward"
|
||||
},
|
||||
animWindow = {
|
||||
sNodeName = "t_window_04",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txt_Reward_Title = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Ranking_Reward"
|
||||
},
|
||||
svRankingReward = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
txtRankTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Refresh_Tip"
|
||||
},
|
||||
btnCloseReward = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_CloseReward"
|
||||
}
|
||||
}
|
||||
JointDrillRankingCtrl._mapEventConfig = {}
|
||||
JointDrillRankingCtrl._mapRedDotConfig = {}
|
||||
function JointDrillRankingCtrl:SetEndTime()
|
||||
local actData = PlayerData.Activity:GetActivityDataById(self.nActId)
|
||||
if actData ~= nil then
|
||||
local nEndTime = actData:GetActEndTime()
|
||||
local nThresholdTime = ConfigTable.GetConfigValue("SeasonEndThreshold")
|
||||
nEndTime = nEndTime - nThresholdTime
|
||||
local sTime = os.date("%m/%d %H:%M", nEndTime)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRankEndTime, orderedFormat(ConfigTable.GetUIText("JointDrill_Rank_Refresh_Time"), sTime))
|
||||
end
|
||||
end
|
||||
function JointDrillRankingCtrl:InitRankReward()
|
||||
for _, v in pairs(self.tbRankRewardGridCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbRankRewardGridCtrl = {}
|
||||
local nRankCount = PlayerData.JointDrill:GetRankRewardCount()
|
||||
local nTotalRankCount = PlayerData.JointDrill:GetTotalRankCount()
|
||||
local mapSelfRank = PlayerData.JointDrill:GetSelfRankData()
|
||||
local nSelfRank = 0
|
||||
if mapSelfRank ~= nil and 0 < mapSelfRank.Rank then
|
||||
nSelfRank = mapSelfRank.Rank
|
||||
end
|
||||
self.nRankSection = 0
|
||||
if nTotalRankCount ~= 0 then
|
||||
nTotalRankCount = math.max(nTotalRankCount, 100)
|
||||
self.nRankSection = nSelfRank / nTotalRankCount
|
||||
end
|
||||
self._mapNode.svRankingReward:Init(nRankCount, self, self.RefreshRankRewardGrid)
|
||||
end
|
||||
function JointDrillRankingCtrl:RefreshRankRewardGrid(goGrid, goGridIndex)
|
||||
local nIndex = goGridIndex + 1
|
||||
if self.tbRankRewardGridCtrl[goGrid] == nil then
|
||||
self.tbRankRewardGridCtrl[goGrid] = self:BindCtrlByNode(goGrid, "Game.UI.JointDrill.JointDrillRankRewardItemCtrl")
|
||||
end
|
||||
self.tbRankRewardGridCtrl[goGrid]:RefreshItem(nIndex, self.nRankSection)
|
||||
end
|
||||
function JointDrillRankingCtrl:RefreshRankList()
|
||||
self.mapRankList = PlayerData.JointDrill:GetRankList()
|
||||
for _, v in ipairs(self.tbRankGridCtrl) do
|
||||
self:UnbindCtrlByNode(v)
|
||||
end
|
||||
self.tbRankGridCtrl = {}
|
||||
if self.mapRankList == nil or #self.mapRankList == 0 then
|
||||
self._mapNode.goLoading.gameObject:SetActive(true)
|
||||
self._mapNode.goMainContent.gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goLoading.gameObject:SetActive(false)
|
||||
self._mapNode.goMainContent.gameObject:SetActive(true)
|
||||
self._mapNode.svRankingInfo:SetAnim(0.1)
|
||||
self._mapNode.svRankingInfo:Init(#self.mapRankList, self, self.RefreshRankGrid)
|
||||
end
|
||||
end
|
||||
function JointDrillRankingCtrl:RefreshSelfRank()
|
||||
local mapSelfRank = PlayerData.JointDrill:GetSelfRankData()
|
||||
self._mapNode.rtSelfRank:RefreshSelfRank(mapSelfRank)
|
||||
end
|
||||
function JointDrillRankingCtrl:RefreshRankGrid(goGrid, goGridIndex)
|
||||
local nIndex = goGridIndex + 1
|
||||
if self.tbRankGridCtrl[goGrid] == nil then
|
||||
local itemCtrl = self:BindCtrlByNode(goGrid, "Game.UI.JointDrill.JointDrillRankItemCtrl")
|
||||
self.tbRankGridCtrl[goGrid] = itemCtrl
|
||||
end
|
||||
local mapRank = self.mapRankList[nIndex]
|
||||
self.tbRankGridCtrl[goGrid]:RefreshRankItem(mapRank)
|
||||
end
|
||||
function JointDrillRankingCtrl:Awake()
|
||||
end
|
||||
function JointDrillRankingCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if tbParam ~= nil then
|
||||
self.nActId = tbParam[1]
|
||||
end
|
||||
self.tbRankGridCtrl = {}
|
||||
self.tbRankRewardGridCtrl = {}
|
||||
self._mapNode.goRewardView.gameObject:SetActive(false)
|
||||
self._mapNode.goMainContent.gameObject:SetActive(true)
|
||||
self:RefreshRankList()
|
||||
self:RefreshSelfRank()
|
||||
self:SetEndTime()
|
||||
self:InitRankReward()
|
||||
end
|
||||
function JointDrillRankingCtrl:OnDisable()
|
||||
for _, v in pairs(self.tbRankGridCtrl) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbRankGridCtrl = {}
|
||||
for _, v in pairs(self.tbRankRewardGridCtrl) do
|
||||
local obj = v.gameObject
|
||||
self:UnbindCtrlByNode(v)
|
||||
destroy(obj)
|
||||
end
|
||||
self.tbRankRewardGridCtrl = {}
|
||||
end
|
||||
function JointDrillRankingCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillRankingCtrl:OnRelease()
|
||||
end
|
||||
function JointDrillRankingCtrl:OnBtnClick_Reward()
|
||||
self._mapNode.animWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goBlurBg.gameObject:SetActive(true)
|
||||
self._mapNode.goRewardView.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.animWindow.gameObject:SetActive(true)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_in")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function JointDrillRankingCtrl:OnBtnClick_CloseReward()
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
local close = function()
|
||||
self._mapNode.animWindow.gameObject:SetActive(false)
|
||||
self._mapNode.goRewardView.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.2, close, true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
end
|
||||
return JointDrillRankingCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local JointDrillRankingPanel = class("JointDrillRankingPanel", BasePanel)
|
||||
JointDrillRankingPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillRankingPanel.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillRankingCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillRankingPanel:Awake()
|
||||
end
|
||||
function JointDrillRankingPanel:OnEnable()
|
||||
end
|
||||
function JointDrillRankingPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillRankingPanel:OnDisable()
|
||||
end
|
||||
function JointDrillRankingPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillRankingPanel:OnRelease()
|
||||
end
|
||||
return JointDrillRankingPanel
|
||||
@@ -0,0 +1,188 @@
|
||||
local JointDrillRankItemCtrl = class("JointDrillRankItemCtrl", BaseCtrl)
|
||||
JointDrillRankItemCtrl._mapNodeConfig = {
|
||||
btnTeamDetail = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_TeamDetail"
|
||||
},
|
||||
imgBtnMask = {},
|
||||
imgHead = {sComponentName = "Image"},
|
||||
txtPlayerName = {sComponentName = "TMP_Text"},
|
||||
txtTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Player_Title"
|
||||
},
|
||||
txtPlayerTitle = {sComponentName = "TMP_Text"},
|
||||
goHonorTitle = {
|
||||
nCount = 3,
|
||||
sCtrlName = "Game.UI.FriendEx.HonorTitleCtrl"
|
||||
},
|
||||
goNormal = {},
|
||||
imgScoreBg = {},
|
||||
txtScore = {sComponentName = "TMP_Text"},
|
||||
imgRankWheat = {},
|
||||
imgRankIcon = {nCount = 3},
|
||||
imgRankValue = {},
|
||||
txtRankValue = {sComponentName = "TMP_Text"},
|
||||
goBuild = {},
|
||||
txtBuildScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Build_Score"
|
||||
},
|
||||
imgBuildScore = {sComponentName = "Image"},
|
||||
goCharItem = {nCount = 3},
|
||||
imgItemIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgItemRare = {nCount = 3, sComponentName = "Image"},
|
||||
txtRank = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
},
|
||||
goEmpty = {},
|
||||
imgScoreBgEmpty = {},
|
||||
txtScoreEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Empty"
|
||||
},
|
||||
imgRankEmpty = {},
|
||||
txtRankEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Self_Rank_Empty"
|
||||
},
|
||||
imgBuildEmptyBg = {},
|
||||
txtBuildEmpty = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Empty"
|
||||
}
|
||||
}
|
||||
JointDrillRankItemCtrl._mapEventConfig = {}
|
||||
JointDrillRankItemCtrl._mapRedDotConfig = {}
|
||||
function JointDrillRankItemCtrl:RefreshRankItem(mapRankData)
|
||||
self.mapRankData = mapRankData
|
||||
self._mapNode.goNormal.gameObject:SetActive(true)
|
||||
self._mapNode.goEmpty.gameObject:SetActive(false)
|
||||
self._mapNode.imgBtnMask.gameObject:SetActive(false)
|
||||
self:RefreshBuild(mapRankData.Teams)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScore, mapRankData.Score)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPlayerName, mapRankData.NickName)
|
||||
local mapCfg = ConfigTable.GetData("PlayerHead", mapRankData.HeadIcon)
|
||||
if mapCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgHead, mapCfg.Icon)
|
||||
end
|
||||
self:RefreshHonorTitle(mapRankData.Honors)
|
||||
if mapRankData.TitlePrefix == 0 or mapRankData.TitleSuffix == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPlayerTitle, "")
|
||||
else
|
||||
local mapCfgTitle1 = ConfigTable.GetData("Title", mapRankData.TitlePrefix)
|
||||
local mapCfgTitle2 = ConfigTable.GetData("Title", mapRankData.TitleSuffix)
|
||||
if mapCfgTitle1 ~= nil and mapCfgTitle2 ~= nil then
|
||||
local sTitle = orderedFormat(ConfigTable.GetUIText("FriendPanel_PlayerTitle") or "", mapCfgTitle1.Desc, mapCfgTitle2.Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPlayerTitle, sTitle)
|
||||
end
|
||||
end
|
||||
if mapRankData.Rank <= 3 then
|
||||
self._mapNode.imgRankWheat.gameObject:SetActive(true)
|
||||
self._mapNode.imgRankValue.gameObject:SetActive(false)
|
||||
for k, v in ipairs(self._mapNode.imgRankIcon) do
|
||||
v.gameObject:SetActive(k == mapRankData.Rank)
|
||||
end
|
||||
else
|
||||
self._mapNode.imgRankWheat.gameObject:SetActive(false)
|
||||
self._mapNode.imgRankValue.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRankValue, mapRankData.Rank)
|
||||
end
|
||||
end
|
||||
function JointDrillRankItemCtrl:RefreshHonorTitle(tbHonors)
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goHonorTitle[i].gameObject:SetActive(false)
|
||||
end
|
||||
for k, v in pairs(tbHonors) do
|
||||
if v ~= nil and v.Id > 0 then
|
||||
local honorData = ConfigTable.GetData("Honor", v.Id)
|
||||
self._mapNode.goHonorTitle[k]:SetHonotTitle(honorData.Id, k == 1, v.AffinityLV)
|
||||
self._mapNode.goHonorTitle[k].gameObject:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function JointDrillRankItemCtrl:GetBuildRank(nScore)
|
||||
local curIdx = -1
|
||||
local forEachReward = function(mapData)
|
||||
if nScore >= mapData.MinGrade and curIdx < mapData.Id then
|
||||
curIdx = mapData.Id
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.StarTowerBuildRank, forEachReward)
|
||||
if curIdx < 0 then
|
||||
curIdx = 1
|
||||
end
|
||||
return curIdx
|
||||
end
|
||||
function JointDrillRankItemCtrl:RefreshBuild(mapBuildList)
|
||||
if mapBuildList == nil or next(mapBuildList) == nil then
|
||||
return
|
||||
end
|
||||
local mapBuild = mapBuildList[1]
|
||||
for i = 1, 3 do
|
||||
local nCharId = mapBuild.Chars[i].Id
|
||||
local mapChar = ConfigTable.GetData_Character(nCharId)
|
||||
if mapChar ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank[i], mapBuild.Chars[i].Level)
|
||||
local nCharSkinId = mapChar.DefaultSkinId
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
local nRarity = mapChar.Grade
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[nRarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgItemRare[i], "12_rare", sFrame, true)
|
||||
end
|
||||
end
|
||||
local nScore = self:GetBuildRank(mapBuild.BuildScore)
|
||||
self:SetPngSprite(self._mapNode.imgBuildScore, "Icon/BuildRank/BuildRank_" .. nScore)
|
||||
end
|
||||
function JointDrillRankItemCtrl:RefreshSelfRank(mapSelfRank)
|
||||
if mapSelfRank ~= nil and mapSelfRank.Rank > 0 then
|
||||
self:RefreshRankItem(mapSelfRank)
|
||||
else
|
||||
self._mapNode.goNormal.gameObject:SetActive(false)
|
||||
self._mapNode.goEmpty.gameObject:SetActive(true)
|
||||
self._mapNode.imgBtnMask.gameObject:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPlayerName, PlayerData.Base:GetPlayerNickName())
|
||||
local nHeadId = PlayerData.Base:GetPlayerHeadId()
|
||||
local mapCfg = ConfigTable.GetData("PlayerHead", nHeadId)
|
||||
if mapCfg ~= nil then
|
||||
self:SetPngSprite(self._mapNode.imgHead, mapCfg.Icon)
|
||||
end
|
||||
local tbCurHonorTitle = PlayerData.Base:GetPlayerHonorTitle()
|
||||
self:RefreshHonorTitle(tbCurHonorTitle)
|
||||
local nTitlePrefix, nTitleSuffix = PlayerData.Base:GetPlayerTitle()
|
||||
if nTitlePrefix == 0 or nTitleSuffix == 0 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPlayerTitle, "")
|
||||
else
|
||||
local mapCfgTitle1 = ConfigTable.GetData("Title", nTitlePrefix)
|
||||
local mapCfgTitle2 = ConfigTable.GetData("Title", nTitleSuffix)
|
||||
if mapCfgTitle1 ~= nil and mapCfgTitle2 ~= nil then
|
||||
local sTitle = orderedFormat(ConfigTable.GetUIText("FriendPanel_PlayerTitle") or "", mapCfgTitle1.Desc, mapCfgTitle2.Desc)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtPlayerTitle, sTitle)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function JointDrillRankItemCtrl:Awake()
|
||||
end
|
||||
function JointDrillRankItemCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillRankItemCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillRankItemCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillRankItemCtrl:OnBtnClick_TeamDetail()
|
||||
if self.mapRankData == nil then
|
||||
EventManager.Hit(EventId.OpenMessageBox, ConfigTable.GetUIText("JointDrill_Rank_Detail_Empty"))
|
||||
return
|
||||
end
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillRankDetail, self.mapRankData)
|
||||
end
|
||||
return JointDrillRankItemCtrl
|
||||
@@ -0,0 +1,68 @@
|
||||
local JointDrillRankRewardItemCtrl = class("JointDrillRankRewardItemCtrl", BaseCtrl)
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
JointDrillRankRewardItemCtrl._mapNodeConfig = {
|
||||
imgBg1 = {},
|
||||
imgBg2 = {},
|
||||
txtRanking = {sComponentName = "TMP_Text"},
|
||||
btnItem = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Item"
|
||||
},
|
||||
goItem = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnItem",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateItemCtrl"
|
||||
}
|
||||
}
|
||||
JointDrillRankRewardItemCtrl._mapEventConfig = {}
|
||||
JointDrillRankRewardItemCtrl._mapRedDotConfig = {}
|
||||
function JointDrillRankRewardItemCtrl:RefreshItem(nIndex, nSelfRankSection)
|
||||
local nMaxRankCount = PlayerData.JointDrill:GetRankRewardCount()
|
||||
local mapCfg = ConfigTable.GetData("JointDrillRank", nIndex)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local nRankingHigher = mapCfg.RankLower
|
||||
local nRankLower = 0
|
||||
if nIndex ~= 1 and ConfigTable.GetData("JointDrillRank", nIndex - 1) ~= nil then
|
||||
nRankLower = ConfigTable.GetData("JointDrillRank", nIndex - 1).RankLower
|
||||
end
|
||||
if nIndex == 1 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRanking, orderedFormat(ConfigTable.GetUIText("JointDrill_Rank_Cur"), math.floor(nRankingHigher / 100)))
|
||||
elseif nIndex == nMaxRankCount then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRanking, orderedFormat(ConfigTable.GetUIText("JointDrill_Rank_Lv_1"), math.floor(nRankLower / 100)))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRanking, orderedFormat(ConfigTable.GetUIText("JointDrill_Rank_Lv"), math.floor(nRankLower / 100), math.floor(nRankingHigher / 100)))
|
||||
end
|
||||
local bSelf = nSelfRankSection > nRankLower * ConfigData.IntFloatPrecision and nSelfRankSection <= nRankingHigher * ConfigData.IntFloatPrecision and nSelfRankSection ~= 0
|
||||
self._mapNode.imgBg1:SetActive(not bSelf)
|
||||
self._mapNode.imgBg2:SetActive(bSelf)
|
||||
self.tbReward = {}
|
||||
for i = 1, 3 do
|
||||
if mapCfg["AwardItemTid" .. i] ~= nil and mapCfg["AwardItemTid" .. i] ~= 0 then
|
||||
local nTid = mapCfg["AwardItemTid" .. i]
|
||||
local nCount = mapCfg["AwardItemNum" .. i]
|
||||
table.insert(self.tbReward, {nTid = nTid, nCount = nCount})
|
||||
self._mapNode.goItem[i]:SetItem(nTid, nil, nCount, nil, false, false, false, true, false, false)
|
||||
else
|
||||
self._mapNode.btnItem[i].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
function JointDrillRankRewardItemCtrl:Awake()
|
||||
end
|
||||
function JointDrillRankRewardItemCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillRankRewardItemCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillRankRewardItemCtrl:OnDestroy()
|
||||
end
|
||||
function JointDrillRankRewardItemCtrl:OnBtnClick_Item(btn, nIndex)
|
||||
local mapItem = self.tbReward[nIndex]
|
||||
if mapItem == nil then
|
||||
return
|
||||
end
|
||||
UTILS.ClickItemGridWithTips(mapItem.nTid, btn.transform, true, true, false)
|
||||
end
|
||||
return JointDrillRankRewardItemCtrl
|
||||
@@ -0,0 +1,103 @@
|
||||
local JointDrillRankUpCtrl = class("JointDrillRankUpCtrl", BaseCtrl)
|
||||
JointDrillRankUpCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "GameObject"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
imgTag = {},
|
||||
imgRank = {},
|
||||
txtRank = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Text"
|
||||
},
|
||||
txtRankBefore = {sComponentName = "TMP_Text"},
|
||||
txtRankAfter = {sComponentName = "TMP_Text"},
|
||||
imgRankUp = {},
|
||||
txtRankAfterUp = {sComponentName = "TMP_Text"},
|
||||
imgScore = {},
|
||||
txtRankScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Score"
|
||||
},
|
||||
txtScoreBefore = {sComponentName = "TMP_Text"},
|
||||
txtScoreAfter = {sComponentName = "TMP_Text"},
|
||||
imgScoreUp = {},
|
||||
txtAllRankScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Score_All"
|
||||
},
|
||||
txtScoreAfterUp = {sComponentName = "TMP_Text"},
|
||||
imgAllScore = {},
|
||||
txtAllScoreBefore = {sComponentName = "TMP_Text"},
|
||||
txtAllScoreAfter = {sComponentName = "TMP_Text"},
|
||||
imgAllScoreUp = {},
|
||||
txtAllScoreAfterUp = {sComponentName = "TMP_Text"}
|
||||
}
|
||||
JointDrillRankUpCtrl._mapEventConfig = {}
|
||||
JointDrillRankUpCtrl._mapRedDotConfig = {}
|
||||
function JointDrillRankUpCtrl:Refresh()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRankBefore, self.nOld)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRankAfter, self.nNew)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRankAfterUp, self.nNew)
|
||||
self._mapNode.imgRankUp.gameObject:SetActive(self.nNew < self.nOld or self.nOld == 0 and self.nNew > 0)
|
||||
if self.mapScore ~= nil then
|
||||
local nScoreNew = self.mapScore.nScore
|
||||
local nScoreOld = self.mapScore.nScoreOld
|
||||
self._mapNode.txtScoreAfter.gameObject:SetActive(nScoreNew <= nScoreOld or self.nResultType ~= AllEnum.JointDrillResultType.Success)
|
||||
self._mapNode.imgScoreUp.gameObject:SetActive(nScoreNew > nScoreOld and self.nResultType == AllEnum.JointDrillResultType.Success)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScoreBefore, nScoreOld)
|
||||
if self.nResultType == AllEnum.JointDrillResultType.Success then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScoreAfter, math.max(nScoreOld, nScoreNew))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScoreAfter, nScoreOld)
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScoreAfterUp, nScoreNew)
|
||||
self._mapNode.imgTag.gameObject:SetActive(nScoreNew > nScoreOld and self.nResultType == AllEnum.JointDrillResultType.Success)
|
||||
local nTotalScoreNew = self.mapScore.nTotalScore or 0
|
||||
local nTotalScoreOld = nTotalScoreNew - nScoreNew
|
||||
self._mapNode.txtAllScoreAfter.gameObject:SetActive(nTotalScoreOld == nTotalScoreNew)
|
||||
self._mapNode.imgAllScoreUp.gameObject:SetActive(nTotalScoreNew > nTotalScoreOld)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAllScoreBefore, nTotalScoreOld)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAllScoreAfter, nTotalScoreNew)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAllScoreAfterUp, nTotalScoreNew)
|
||||
end
|
||||
end
|
||||
function JointDrillRankUpCtrl:Awake()
|
||||
end
|
||||
function JointDrillRankUpCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
if tbParam ~= nil then
|
||||
self.nOld = tbParam[1]
|
||||
self.nNew = tbParam[2]
|
||||
self.mapScore = tbParam[3]
|
||||
self.nResultType = tbParam[4]
|
||||
self.callback = tbParam[5]
|
||||
end
|
||||
self._mapNode.safeAreaRoot.gameObject:SetActive(false)
|
||||
self._mapNode.btnClose.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.safeAreaRoot.gameObject:SetActive(true)
|
||||
self._mapNode.btnClose.gameObject:SetActive(true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self:Refresh()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.5)
|
||||
end
|
||||
function JointDrillRankUpCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillRankUpCtrl:OnDestroy()
|
||||
if self.callback ~= nil then
|
||||
self.callback()
|
||||
end
|
||||
end
|
||||
function JointDrillRankUpCtrl:OnBtnClick_Close()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.JointDrillRankUp)
|
||||
end
|
||||
return JointDrillRankUpCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local JointDrillRankUpPanel = class("JointDrillRankUpPanel", BasePanel)
|
||||
JointDrillRankUpPanel._bIsMainPanel = false
|
||||
JointDrillRankUpPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillRankUpPanel.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillRankUpCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillRankUpPanel:Awake()
|
||||
end
|
||||
function JointDrillRankUpPanel:OnEnable()
|
||||
end
|
||||
function JointDrillRankUpPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillRankUpPanel:OnDisable()
|
||||
end
|
||||
function JointDrillRankUpPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillRankUpPanel:OnRelease()
|
||||
end
|
||||
return JointDrillRankUpPanel
|
||||
@@ -0,0 +1,271 @@
|
||||
local JointDrillResultCtrl = class("JointDrillResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local ModuleManager = require("GameCore.Module.ModuleManager")
|
||||
JointDrillResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goBg = {},
|
||||
imgUIBg = {},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
goResult = {},
|
||||
animComplete = {sNodeName = "goResult", sComponentName = "Animator"},
|
||||
goComplete = {
|
||||
sNodeName = "goComplete1"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
txtTimeScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Time_Score"
|
||||
},
|
||||
txtTimeScoreValue = {sComponentName = "TMP_Text"},
|
||||
txtDamageScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Hp_Score"
|
||||
},
|
||||
txtDamageScoreValue = {sComponentName = "TMP_Text"},
|
||||
txtDiffScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Difficulty_Score"
|
||||
},
|
||||
txtDiffScoreValue = {sComponentName = "TMP_Text"},
|
||||
txtFinalScoreCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Result_Score"
|
||||
},
|
||||
txtFinalScoreValue = {sComponentName = "TMP_Text"},
|
||||
imgNewScore = {},
|
||||
txtNewScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_New_Record"
|
||||
},
|
||||
goFail = {},
|
||||
txtFinalScore = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Battle_Result_Score"
|
||||
},
|
||||
txtScoreValue = {sComponentName = "TMP_Text"},
|
||||
imgSimulate = {nCount = 2},
|
||||
txtSimulate = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Btn_Start_Challenge_Simulate"
|
||||
},
|
||||
imgTag = {},
|
||||
goBattleEnd = {},
|
||||
imgBattleEnd = {},
|
||||
imgRetreat = {},
|
||||
imgBattleLevel = {},
|
||||
txtBattleLevel = {sComponentName = "TMP_Text"},
|
||||
txtBossName = {sComponentName = "TMP_Text"},
|
||||
imgBossHpBarBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgBossHpBar = {sComponentName = "Image"},
|
||||
txtBossHp = {sComponentName = "TMP_Text"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
ButtonClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goTip = {},
|
||||
txtTip = {sComponentName = "TMP_Text"},
|
||||
btnDamage = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnDamageResult",
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Damage"
|
||||
}
|
||||
}
|
||||
JointDrillResultCtrl._mapEventConfig = {}
|
||||
function JointDrillResultCtrl:Refresh()
|
||||
for _, v in ipairs(self._mapNode.btnDamage) do
|
||||
v.gameObject:SetActive(self.tbCharDamage ~= nil)
|
||||
end
|
||||
local bInAdventure = ModuleManager.GetIsAdventure()
|
||||
self._mapNode.goBg:SetActive(self.nResultType ~= AllEnum.JointDrillResultType.Success)
|
||||
self._mapNode.imgUIBg.gameObject:SetActive(not bInAdventure)
|
||||
if self.nResultType ~= AllEnum.JointDrillResultType.Success and bInAdventure then
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
end
|
||||
local nMaxBattleCount = 0
|
||||
local mapLevelCfg = ConfigTable.GetData("JointDrillLevel", self.nLevelId)
|
||||
if mapLevelCfg == nil then
|
||||
return
|
||||
end
|
||||
nMaxBattleCount = mapLevelCfg.MaxBattleNum
|
||||
local nAnimTime = 0
|
||||
if self.nResultType == AllEnum.JointDrillResultType.Success or self.nResultType == AllEnum.JointDrillResultType.ChallengeEnd then
|
||||
self._mapNode.goResult:SetActive(true)
|
||||
self._mapNode.goBattleEnd:SetActive(false)
|
||||
self._mapNode.goTip.gameObject:SetActive(false)
|
||||
self._mapNode.goComplete.gameObject:SetActive(self.nResultType == AllEnum.JointDrillResultType.Success)
|
||||
self._mapNode.goFail.gameObject:SetActive(self.nResultType == AllEnum.JointDrillResultType.ChallengeEnd)
|
||||
if self.nResultType == AllEnum.JointDrillResultType.ChallengeEnd then
|
||||
nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"JointDrillResult_Result"
|
||||
})
|
||||
self.animRoot:Play("JointDrillResult_Result", 0, 0)
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
else
|
||||
nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animComplete, {
|
||||
"BattleResultPanel_victory_out"
|
||||
})
|
||||
self._mapNode.animComplete:Play("BattleResultPanel_victory_out", 0, 0)
|
||||
WwiseManger:SetState("system", "victory2")
|
||||
end
|
||||
local nMonsterId = mapLevelCfg.BossId
|
||||
local nDiff = mapLevelCfg.Difficulty
|
||||
local sMonsterName = PlayerData.JointDrill:GetMonsterName(nMonsterId)
|
||||
local sLevelName = string.format("%s/%s", sMonsterName, ConfigTable.GetUIText("JointDrill_Difficulty_Name_" .. nDiff))
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
NovaAPI.SetTMPText(v, sLevelName)
|
||||
end
|
||||
local bNew = false
|
||||
if self.mapScore ~= nil then
|
||||
local nFinalScore = self.mapScore.nScore or 0
|
||||
NovaAPI.SetTMPText(self._mapNode.txtScoreValue, FormatWithCommas(nFinalScore))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtFinalScoreValue, FormatWithCommas(nFinalScore))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTimeScoreValue, FormatWithCommas(self.mapScore.FightScore or 0))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDamageScoreValue, FormatWithCommas(self.mapScore.HpScore or 0))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtDiffScoreValue, FormatWithCommas(self.mapScore.DifficultyScore or 0))
|
||||
local nScoreOld = self.mapScore.nScoreOld or 0
|
||||
bNew = nFinalScore > nScoreOld
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.imgSimulate) do
|
||||
v.gameObject:SetActive(self.bSimulate)
|
||||
end
|
||||
self._mapNode.imgTag.gameObject:SetActive(bNew and not self.bSimulate and self.nResultType == AllEnum.JointDrillResultType.Success)
|
||||
self._mapNode.imgNewScore.gameObject:SetActive(bNew and not self.bSimulate and self.nResultType == AllEnum.JointDrillResultType.Success)
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
nAnimTime = NovaAPI.GetAnimClipLength(self.animRoot, {
|
||||
"JointDrillResult_BattleEnd"
|
||||
})
|
||||
self.animRoot:Play("JointDrillResult_BattleEnd", 0, 0)
|
||||
self._mapNode.goResult:SetActive(false)
|
||||
self._mapNode.goBattleEnd:SetActive(true)
|
||||
self._mapNode.goTip.gameObject:SetActive(true)
|
||||
self._mapNode.imgBattleEnd.gameObject:SetActive(self.nResultType == AllEnum.JointDrillResultType.BattleEnd)
|
||||
self._mapNode.imgRetreat.gameObject:SetActive(self.nResultType == AllEnum.JointDrillResultType.Retreat)
|
||||
self._mapNode.imgBattleLevel.gameObject:SetActive(false)
|
||||
local sBattleCount = ConfigTable.GetUIText("JointDrill_Battle_Time_" .. self.nBattleCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBattleLevel, orderedFormat(ConfigTable.GetUIText("JointDrill_Battle_Level"), sBattleCount))
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTip, orderedFormat(ConfigTable.GetUIText("JointDrill_Challenge_Count"), nMaxBattleCount - self.nBattleCount))
|
||||
local mapLevelCfg = ConfigTable.GetData("JointDrillLevel", self.nLevelId)
|
||||
if mapLevelCfg ~= nil then
|
||||
local nMonsterId = mapLevelCfg.BossId
|
||||
local nDiff = mapLevelCfg.Difficulty
|
||||
local sMonsterName = PlayerData.JointDrill:GetMonsterName(nMonsterId)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossName, string.format("%s/%s", sMonsterName, ConfigTable.GetUIText("JointDrill_Difficulty_Name_" .. nDiff)))
|
||||
end
|
||||
local nBossHp = self.mapBossInfo.nHp
|
||||
local nBossHpMax = self.mapBossInfo.nHpMax
|
||||
NovaAPI.SetTMPText(self._mapNode.txtBossHp, string.format("%s/%s", nBossHp, nBossHpMax))
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgBossHpBar, nBossHp / nBossHpMax)
|
||||
end
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
end
|
||||
function JointDrillResultCtrl:OpenReward()
|
||||
local closeCallback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
local callback = function()
|
||||
if self.nResultType == AllEnum.JointDrillResultType.Success or self.nResultType == AllEnum.JointDrillResultType.ChallengeEnd and self.mapScore ~= nil and next(self.mapScore) ~= nil then
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.JointDrillRankUp, self.nOld, self.nNew, self.mapScore, self.nResultType, closeCallback)
|
||||
else
|
||||
closeCallback()
|
||||
end
|
||||
end
|
||||
if self.mapReward ~= nil and next(self.mapReward) ~= nil then
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
else
|
||||
callback()
|
||||
end
|
||||
end
|
||||
function JointDrillResultCtrl:Awake()
|
||||
self.animRoot = self.gameObject:GetComponent("Animator")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnableByName(self.gameObject, "Canvas", false)
|
||||
end
|
||||
function JointDrillResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nResultType = tbParam[1]
|
||||
self.nBattleLevel = tbParam[2]
|
||||
local nBattleTime = tbParam[3]
|
||||
self.nLevelId = tbParam[4]
|
||||
self.mapBossInfo = tbParam[5]
|
||||
self.mapScore = tbParam[6]
|
||||
self.mapReward = tbParam[7]
|
||||
self.mapChangeInfo = tbParam[8]
|
||||
self.nOld = tbParam[9]
|
||||
self.nNew = tbParam[10]
|
||||
self.bSimulate = tbParam[11]
|
||||
self.nBattleCount = tbParam[12]
|
||||
self.tbCharDamage = tbParam[13]
|
||||
self.mapSelfRank = PlayerData.JointDrill:GetSelfRankData()
|
||||
if self.nOld == 0 and self.nNew == 0 and self.mapSelfRank ~= nil then
|
||||
self.nOld = self.mapSelfRank.Rank
|
||||
self.nNew = self.mapSelfRank.Rank
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose.gameObject:SetActive(false)
|
||||
if self.nResultType ~= AllEnum.JointDrillResultType.Success then
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose.gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnableByName(self.gameObject, "Canvas", true)
|
||||
self:Refresh()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function JointDrillResultCtrl:OnDisable()
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function JointDrillResultCtrl:ClosePanel()
|
||||
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()
|
||||
if self.nResultType == AllEnum.JointDrillResultType.Success then
|
||||
NovaAPI.EnterModule("MainMenuModuleScene", true, 17)
|
||||
self._mapNode.imgBlurredBg:SetActive(false)
|
||||
else
|
||||
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
|
||||
end)
|
||||
sequence:SetUpdate(true)
|
||||
end
|
||||
end
|
||||
function JointDrillResultCtrl:OnBtnClick_Close(btn)
|
||||
if not self.bSimulate then
|
||||
self:OpenReward()
|
||||
else
|
||||
self:ClosePanel()
|
||||
end
|
||||
end
|
||||
function JointDrillResultCtrl:OnBtnClick_Damage()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return JointDrillResultCtrl
|
||||
@@ -0,0 +1,20 @@
|
||||
local JointDrillResultPanel = class("JointDrillResultPanel", BasePanel)
|
||||
JointDrillResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "Play_JointDrill/JointDrillResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.JointDrill.JointDrillResultCtrl"
|
||||
}
|
||||
}
|
||||
function JointDrillResultPanel:Awake()
|
||||
end
|
||||
function JointDrillResultPanel:OnEnable()
|
||||
end
|
||||
function JointDrillResultPanel:OnAfterEnter()
|
||||
end
|
||||
function JointDrillResultPanel:OnDisable()
|
||||
end
|
||||
function JointDrillResultPanel:OnDestroy()
|
||||
end
|
||||
function JointDrillResultPanel:OnRelease()
|
||||
end
|
||||
return JointDrillResultPanel
|
||||
@@ -0,0 +1,20 @@
|
||||
local JointDrillRoomInfo = class("JointDrillRoomInfo", BaseCtrl)
|
||||
JointDrillRoomInfo._mapNodeConfig = {
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
JointDrillRoomInfo._mapEventConfig = {
|
||||
InputEnable = "OnEvent_InputEnable"
|
||||
}
|
||||
function JointDrillRoomInfo:Awake()
|
||||
end
|
||||
function JointDrillRoomInfo:OnEnable()
|
||||
end
|
||||
function JointDrillRoomInfo:OnDisable()
|
||||
end
|
||||
function JointDrillRoomInfo:OnEvent_InputEnable(bEnable)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvasGroup, bEnable and 1 or 0)
|
||||
end
|
||||
return JointDrillRoomInfo
|
||||
@@ -0,0 +1,65 @@
|
||||
local JointDrillTeamItemCtrl = class("JointDrillTeamItemCtrl", BaseCtrl)
|
||||
JointDrillTeamItemCtrl._mapNodeConfig = {
|
||||
goCharItem = {nCount = 3},
|
||||
imgItemIcon = {nCount = 3, sComponentName = "Image"},
|
||||
imgItemRare = {nCount = 3, sComponentName = "Image"},
|
||||
txtRank = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
imgScoreIcon = {sComponentName = "Image"},
|
||||
txtBuildTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "JointDrill_Rank_Build_Score"
|
||||
},
|
||||
txtTeam = {sComponentName = "TMP_Text"},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
}
|
||||
}
|
||||
JointDrillTeamItemCtrl._mapEventConfig = {}
|
||||
JointDrillTeamItemCtrl._mapRedDotConfig = {}
|
||||
function JointDrillTeamItemCtrl:GetBuildRank(nScore)
|
||||
local curIdx = -1
|
||||
local forEachReward = function(mapData)
|
||||
if nScore >= mapData.MinGrade and curIdx < mapData.Id then
|
||||
curIdx = mapData.Id
|
||||
end
|
||||
end
|
||||
ForEachTableLine(DataTable.StarTowerBuildRank, forEachReward)
|
||||
if curIdx < 0 then
|
||||
curIdx = 1
|
||||
end
|
||||
return curIdx
|
||||
end
|
||||
function JointDrillTeamItemCtrl:RefreshItem(mapTeam, nIndex)
|
||||
local sIndex = ConfigTable.GetUIText("JointDrill_Battle_Time_" .. nIndex)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTeam, orderedFormat(ConfigTable.GetUIText("JointDrill_Rank_Build_Count"), sIndex))
|
||||
for i = 1, 3 do
|
||||
local nCharId = mapTeam.Chars[i].Id
|
||||
local mapChar = ConfigTable.GetData_Character(nCharId)
|
||||
if mapChar ~= nil then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank[i], mapTeam.Chars[i].Level)
|
||||
local nCharSkinId = mapChar.DefaultSkinId
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
self:SetPngSprite(self._mapNode.imgItemIcon[i], mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
local nRarity = mapChar.Grade
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[nRarity]
|
||||
self:SetAtlasSprite(self._mapNode.imgItemRare[i], "12_rare", sFrame, true)
|
||||
end
|
||||
end
|
||||
local nScore = self:GetBuildRank(mapTeam.BuildScore)
|
||||
self:SetPngSprite(self._mapNode.imgScoreIcon, "Icon/BuildRank/BuildRank_" .. nScore)
|
||||
end
|
||||
function JointDrillTeamItemCtrl:Awake()
|
||||
end
|
||||
function JointDrillTeamItemCtrl:OnEnable()
|
||||
end
|
||||
function JointDrillTeamItemCtrl:OnDisable()
|
||||
end
|
||||
function JointDrillTeamItemCtrl:OnDestroy()
|
||||
end
|
||||
return JointDrillTeamItemCtrl
|
||||
Reference in New Issue
Block a user