35c8d87e86
EN: 1.4.0.73 CN: 1.4.0.74 JP: 1.4.0.77 KR: 1.4.0.80
106 lines
3.9 KiB
Lua
106 lines
3.9 KiB
Lua
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)
|
|
local bNew = self.nNew < self.nOld or self.nOld == 0 and self.nNew > 0
|
|
self._mapNode.imgRankUp.gameObject:SetActive(bNew)
|
|
self._mapNode.txtRankAfter.gameObject:SetActive(not bNew)
|
|
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
|