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,125 @@
|
||||
local BattleDamageCtrl = class("BattleDamageCtrl", BaseCtrl)
|
||||
BattleDamageCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
animWindow = {sNodeName = "t_window", sComponentName = "Animator"},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Damage_Window_Title"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnCloseScreen = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
txtAllDamage = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Damage_All_Damage"
|
||||
},
|
||||
txtAllDamageValue = {sComponentName = "TMP_Text"},
|
||||
txtChar = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Damage_Char"
|
||||
},
|
||||
txtDamage = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Damage_Damage"
|
||||
},
|
||||
txtPercent = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Damage_Percent"
|
||||
},
|
||||
goCharDamage = {nCount = 3},
|
||||
txtLeaderCn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSubCn = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
}
|
||||
}
|
||||
BattleDamageCtrl._mapEventConfig = {}
|
||||
BattleDamageCtrl._mapRedDotConfig = {}
|
||||
function BattleDamageCtrl:RefreshDamageList()
|
||||
for k, v in ipairs(self._mapNode.goCharDamage) do
|
||||
v.gameObject:SetActive(self.tbCharDamage[k] ~= nil)
|
||||
if self.tbCharDamage[k] ~= nil then
|
||||
local imgItemIcon = v.transform:Find("goCharItem/imgIconBg/imgItemIcon"):GetComponent("Image")
|
||||
local imgItemRare = v.transform:Find("goCharItem/imgItemRare"):GetComponent("Image")
|
||||
local txtCharName = v.transform:Find("txtCharName"):GetComponent("TMP_Text")
|
||||
local txtDamageValue = v.transform:Find("imgBg/txtDamageValue"):GetComponent("TMP_Text")
|
||||
local rtBarBg = v.transform:Find("imgDamageBarBg"):GetComponent("RectTransform")
|
||||
local rtBar = v.transform:Find("imgDamageBarBg/imgDamageBar"):GetComponent("RectTransform")
|
||||
local txtDamagePercent = v.transform:Find("imgDamageBarBg/txtDamagePercent"):GetComponent("TMP_Text")
|
||||
local mapDamage = self.tbCharDamage[k]
|
||||
local nCharSkinId = mapDamage.nSkinId or PlayerData.Char:GetCharSkinId(mapDamage.nCharId)
|
||||
local mapCharSkin = ConfigTable.GetData_CharacterSkin(nCharSkinId)
|
||||
local mapCharCfg = ConfigTable.GetData_Character(mapDamage.nCharId)
|
||||
if mapCharSkin ~= nil and mapCharSkin ~= nil then
|
||||
local sFrame = AllEnum.FrameType_New.BoardFrame .. AllEnum.BoardFrameColor[mapCharCfg.Grade]
|
||||
self:SetPngSprite(imgItemIcon, mapCharSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
|
||||
self:SetAtlasSprite(imgItemRare, "12_rare", sFrame)
|
||||
NovaAPI.SetTMPText(txtCharName, mapCharCfg.Name)
|
||||
end
|
||||
NovaAPI.SetTMPText(txtDamageValue, mapDamage.nDamage)
|
||||
local nPercent = self.nTotalDamage > 0 and mapDamage.nDamage / self.nTotalDamage or 0
|
||||
nPercent = math.floor(nPercent * 10000 + 0.5) / 10000
|
||||
local nWidth = rtBarBg.sizeDelta.x
|
||||
local nHeight = rtBarBg.sizeDelta.y
|
||||
local v2Target = Vector2(nWidth * nPercent, nHeight)
|
||||
local tweener = rtBar:DOSizeDelta(v2Target, 0.5):SetUpdate(true)
|
||||
local twTxt = DOTween.To(function()
|
||||
return 0
|
||||
end, function(value)
|
||||
NovaAPI.SetTMPText(txtDamagePercent, string.format("%.1f%%", value))
|
||||
end, nPercent * 100, 0.5):SetUpdate(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BattleDamageCtrl:PlayCloseAnim()
|
||||
self._mapNode.imgBlurredBg:SetActive(false)
|
||||
self._mapNode.animWindow:Play("t_window_04_t_out")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "Close", true, true, true)
|
||||
end
|
||||
function BattleDamageCtrl:Close()
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BattleDamage)
|
||||
end
|
||||
function BattleDamageCtrl:Awake()
|
||||
end
|
||||
function BattleDamageCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nTotalDamage = 0
|
||||
self.tbCharDamage = {}
|
||||
if tbParam ~= nil and tbParam[1] ~= nil then
|
||||
self.tbCharDamage = tbParam[1]
|
||||
for _, v in pairs(self.tbCharDamage) do
|
||||
self.nTotalDamage = self.nTotalDamage + v.nDamage
|
||||
end
|
||||
end
|
||||
self._mapNode.animWindow.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.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")
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAllDamageValue, self.nTotalDamage)
|
||||
self:RefreshDamageList()
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.3)
|
||||
end
|
||||
function BattleDamageCtrl:OnDisable()
|
||||
end
|
||||
function BattleDamageCtrl:OnDestroy()
|
||||
end
|
||||
function BattleDamageCtrl:OnBtnClick_Close()
|
||||
self:PlayCloseAnim()
|
||||
end
|
||||
function BattleDamageCtrl:OnEvent_AAA()
|
||||
end
|
||||
return BattleDamageCtrl
|
||||
@@ -0,0 +1,21 @@
|
||||
local BattleDamagePanel = class("BattleDamagePanel", BasePanel)
|
||||
BattleDamagePanel._bIsMainPanel = false
|
||||
BattleDamagePanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleDamagePanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.BattleDamageCtrl"
|
||||
}
|
||||
}
|
||||
function BattleDamagePanel:Awake()
|
||||
end
|
||||
function BattleDamagePanel:OnEnable()
|
||||
end
|
||||
function BattleDamagePanel:OnAfterEnter()
|
||||
end
|
||||
function BattleDamagePanel:OnDisable()
|
||||
end
|
||||
function BattleDamagePanel:OnDestroy()
|
||||
end
|
||||
function BattleDamagePanel:OnRelease()
|
||||
end
|
||||
return BattleDamagePanel
|
||||
@@ -0,0 +1,300 @@
|
||||
local BattleResultCtrl = class("BattleResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
BattleResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
goWorldLevel = {},
|
||||
imgExp = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgExp1 = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtRankEn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtWorldExp = {sComponentName = "TMP_Text"},
|
||||
imgExpBg = {},
|
||||
txtGetWorldExp = {sComponentName = "TMP_Text"},
|
||||
goRankArrow = {},
|
||||
goRank = {},
|
||||
goStarList = {},
|
||||
getStar = {nCount = 3, sComponentName = "Transform"},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtExp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_ExpTips"
|
||||
},
|
||||
animComplete = {sNodeName = "goComplete", sComponentName = "Animator"},
|
||||
animFailed = {sNodeName = "goFailed", sComponentName = "Animator"},
|
||||
txtMaxLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Max_Level"
|
||||
},
|
||||
imgExpFillBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
goGacha = {},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
}
|
||||
}
|
||||
BattleResultCtrl._mapEventConfig = {}
|
||||
function BattleResultCtrl:Awake()
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnableByName(self.gameObject, "Canvas", false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
self._mapNode.goStarList:SetActive(false)
|
||||
end
|
||||
function BattleResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
nResultState = 3
|
||||
elseif tbParam[1] then
|
||||
nResultState = 1
|
||||
elseif #tbParam == 3 and tbParam[1] == false then
|
||||
nResultState = 2
|
||||
end
|
||||
local nStar = tbParam[2]
|
||||
local GenerRewardItems = tbParam[3]
|
||||
local FirstRewardItems = tbParam[4]
|
||||
local ChestRewardItems = tbParam[5]
|
||||
local nExp = tbParam[6] or 0
|
||||
local bPureAvg = tbParam[7]
|
||||
local sLarge = tbParam[8]
|
||||
local sSmall = tbParam[9]
|
||||
local nMainlineId = tbParam[10]
|
||||
local tbChar = tbParam[11]
|
||||
self.mapChangeInfo = tbParam[12]
|
||||
self.tbCharDamage = tbParam[13] or {}
|
||||
self._mapNode.goWorldLevel:SetActive(false)
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
local mapMainline = ConfigTable.GetData_Story(nMainlineId)
|
||||
local sMainlineName = ""
|
||||
if mapMainline ~= nil then
|
||||
sMainlineName = mapMainline.Title
|
||||
end
|
||||
self.bSuccess = 0 < nStar
|
||||
self.mapReward = {}
|
||||
for _, v in pairs(GenerRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(FirstRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.First
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(ChestRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.Three
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
NovaAPI.SetTMPText(v, sMainlineName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
self:RefreshTarget(nStar)
|
||||
local nCurTeam = 5
|
||||
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
|
||||
nCurTeam = PlayerData.Mainline.nCurTeamIndex
|
||||
end
|
||||
local tbTeamMemberId, nCaptain
|
||||
if tbChar == nil then
|
||||
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
|
||||
else
|
||||
tbTeamMemberId = tbChar
|
||||
end
|
||||
local tbRoleId = {}
|
||||
for i = 1, #tbTeamMemberId do
|
||||
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
|
||||
table.insert(tbRoleId, tbTeamMemberId[i])
|
||||
end
|
||||
end
|
||||
if #tbRoleId == 0 then
|
||||
table.insert(tbRoleId, 112)
|
||||
end
|
||||
if bPureAvg then
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
else
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
local nAnimTime
|
||||
if nResultState == 1 then
|
||||
WwiseManger:PlaySound("ui_roguelike_victory")
|
||||
WwiseManger:SetState("system", "victory")
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
nAnimTime = 4
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
nAnimTime = 3
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnableByName(self.gameObject, "Canvas", true)
|
||||
if bPureAvg then
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
nAnimTime = nAnimTime + 1.5
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, nResultState == 1)
|
||||
self.bProcessingClose = false
|
||||
end
|
||||
function BattleResultCtrl:OnDisable()
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function BattleResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
end
|
||||
function BattleResultCtrl:RefreshWorldClass(nExp)
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
local bMax = nFullExp == 0
|
||||
self._mapNode.txtWorldExp.gameObject:SetActive(not bMax)
|
||||
self._mapNode.txtMaxLevel.gameObject:SetActive(bMax)
|
||||
self._mapNode.goRank:SetActive(not bMax)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, nWorldClass)
|
||||
local nMaxWidth = 443
|
||||
local v2Size = self._mapNode.imgExpFillBg.sizeDelta
|
||||
v2Size.y = self._mapNode.imgExp.sizeDelta.y
|
||||
if bMax then
|
||||
v2Size.x = nMaxWidth
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
else
|
||||
local nfillAmount = (nCurExp - nExp) / nFullExp
|
||||
local nAddAmount = nCurExp / nFullExp
|
||||
if nCurExp - nExp <= 0 then
|
||||
nfillAmount = 0
|
||||
nAddAmount = nCurExp / nFullExp
|
||||
end
|
||||
nfillAmount = 1 < nfillAmount and 1 or nfillAmount
|
||||
v2Size.x = nMaxWidth * nfillAmount
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
nAddAmount = 1 < nAddAmount and 1 or nAddAmount
|
||||
v2Size.x = nMaxWidth * nAddAmount
|
||||
self._mapNode.imgExp1.sizeDelta = v2Size
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
|
||||
end
|
||||
end
|
||||
function BattleResultCtrl:RefreshTarget(nStar)
|
||||
for i = 1, 3 do
|
||||
local tr = self._mapNode.getStar[i]
|
||||
local star = tr:Find("star"):GetComponent("Transform")
|
||||
local starPass = star:Find("starPass")
|
||||
local txtCondition = tr:Find("texCondition"):GetComponent("TMP_Text")
|
||||
NovaAPI.SetTMPText(txtCondition, ConfigTable.GetUIText("MainBattle_Task" .. i))
|
||||
if nil ~= starPass then
|
||||
starPass.gameObject:SetActive(i <= nStar)
|
||||
end
|
||||
end
|
||||
end
|
||||
function BattleResultCtrl:ClosePanel()
|
||||
if self.bProcessingClose then
|
||||
return
|
||||
end
|
||||
self.bProcessingClose = true
|
||||
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.bSuccess 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 BattleResultCtrl:OnBtnClick_Close(btn)
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function BattleResultCtrl:OpenReward()
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
end
|
||||
function BattleResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return BattleResultCtrl
|
||||
@@ -0,0 +1,28 @@
|
||||
local BattleResultMaskCtrl = class("BattleResultMaskCtrl", BaseCtrl)
|
||||
BattleResultMaskCtrl._mapNodeConfig = {
|
||||
animRoot = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
BattleResultMaskCtrl._mapEventConfig = {
|
||||
SettlementPerformLoadFinish = "OnEvent_LoadFinish"
|
||||
}
|
||||
function BattleResultMaskCtrl:Awake()
|
||||
end
|
||||
function BattleResultMaskCtrl:OnEnable()
|
||||
end
|
||||
function BattleResultMaskCtrl:OnDisable()
|
||||
end
|
||||
function BattleResultMaskCtrl:OnDestroy()
|
||||
end
|
||||
function BattleResultMaskCtrl:OnEvent_LoadFinish()
|
||||
self._mapNode.animRoot:Play("BattleResultMaskPanel_victory_out")
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(0.5))
|
||||
EventManager.Hit(EventId.ClosePanel, PanelId.BattleResultMask)
|
||||
EventManager.Hit("OpenBattleResultPanel")
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
return BattleResultMaskCtrl
|
||||
@@ -0,0 +1,18 @@
|
||||
local BattleResultMaskPanel = class("BattleResultMaskPanel", BasePanel)
|
||||
BattleResultMaskPanel._bIsMainPanel = false
|
||||
BattleResultMaskPanel._sSortingLayerName = AllEnum.SortingLayerName.UI_Top
|
||||
BattleResultMaskPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultMaskPanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.BattleResultMaskCtrl"
|
||||
}
|
||||
}
|
||||
function BattleResultMaskPanel:Awake()
|
||||
end
|
||||
function BattleResultMaskPanel:OnEnable()
|
||||
end
|
||||
function BattleResultMaskPanel:OnDisable()
|
||||
end
|
||||
function BattleResultMaskPanel:OnDestroy()
|
||||
end
|
||||
return BattleResultMaskPanel
|
||||
@@ -0,0 +1,17 @@
|
||||
local BattleResultPanel = class("BattleResultPanel", BasePanel)
|
||||
BattleResultPanel._bAddToBackHistory = false
|
||||
BattleResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.BattleResultCtrl"
|
||||
}
|
||||
}
|
||||
function BattleResultPanel:Awake()
|
||||
end
|
||||
function BattleResultPanel:OnEnable()
|
||||
end
|
||||
function BattleResultPanel:OnDisable()
|
||||
end
|
||||
function BattleResultPanel:OnDestroy()
|
||||
end
|
||||
return BattleResultPanel
|
||||
@@ -0,0 +1,365 @@
|
||||
local DailyInstanceResultCtrl = class("DailyInstanceResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
DailyInstanceResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
goWorldLevel = {},
|
||||
imgExp = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgExp1 = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtRankEn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtWorldExp = {sComponentName = "TMP_Text"},
|
||||
imgExpBg = {},
|
||||
txtGetWorldExp = {sComponentName = "TMP_Text"},
|
||||
goRankArrow = {},
|
||||
goRank = {},
|
||||
goStarList = {},
|
||||
getStar = {nCount = 3, sComponentName = "Transform"},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtExp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_ExpTips"
|
||||
},
|
||||
txtMaxLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Max_Level"
|
||||
},
|
||||
goGacha = {},
|
||||
animGacha = {
|
||||
sNodeName = "goGachaItem",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgFull = {sComponentName = "Image"},
|
||||
imgSplitB = {sComponentName = "Image"},
|
||||
imgSplitC = {sComponentName = "Image"},
|
||||
imgSplitD = {sComponentName = "Image"},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult"
|
||||
},
|
||||
imgExpFillBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
}
|
||||
}
|
||||
DailyInstanceResultCtrl._mapEventConfig = {}
|
||||
local starGachaCfg = {
|
||||
[1] = {
|
||||
iconPath = "icon_roguegacha_03%s",
|
||||
animName = "BattleResultgoGacha_r"
|
||||
},
|
||||
[2] = {
|
||||
iconPath = "icon_roguegacha_02%s",
|
||||
animName = "BattleResultgoGacha_sr"
|
||||
},
|
||||
[3] = {
|
||||
iconPath = "icon_roguegacha_01%s",
|
||||
animName = "BattleResultgoGacha_ssr"
|
||||
}
|
||||
}
|
||||
function DailyInstanceResultCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnable(self.canvas, false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function DailyInstanceResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
nResultState = 3
|
||||
elseif tbParam[1] then
|
||||
nResultState = 1
|
||||
elseif #tbParam == 3 and tbParam[1] == false then
|
||||
nResultState = 2
|
||||
end
|
||||
local tbStar = tbParam[2]
|
||||
local GenerRewardItems = tbParam[3]
|
||||
local FirstRewardItems = tbParam[4]
|
||||
local ChestRewardItems = tbParam[5]
|
||||
local nExp = tbParam[6] or 0
|
||||
local bPureAvg = tbParam[7]
|
||||
local sLarge = tbParam[8]
|
||||
local sSmall = tbParam[9]
|
||||
local nDailyInstanceId = tbParam[10]
|
||||
local tbChar = tbParam[11]
|
||||
self.mapChangeInfo = tbParam[12]
|
||||
self.tbCharDamage = tbParam[13]
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
self.mapDailyInstance = ConfigTable.GetData("DailyInstance", nDailyInstanceId)
|
||||
local sDailyInstanceName = ""
|
||||
if self.mapDailyInstance ~= nil then
|
||||
sDailyInstanceName = self.mapDailyInstance.Name
|
||||
end
|
||||
local nStar = 0
|
||||
for i = 0, 2 do
|
||||
if tbStar[i] then
|
||||
nStar = nStar + 1
|
||||
end
|
||||
end
|
||||
self.nLevelStar = nStar
|
||||
self.bSuccess = 0 < nStar
|
||||
self.mapReward = {}
|
||||
for _, v in pairs(GenerRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(FirstRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.First
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(ChestRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.Three
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
local sName = orderedFormat(ConfigTable.GetUIText("Dungeon_Difficulty") or "", sDailyInstanceName, ConfigTable.GetUIText("Diffculty_" .. self.mapDailyInstance.Difficulty) or "")
|
||||
NovaAPI.SetTMPText(v, sName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
self:RefreshTarget(tbStar)
|
||||
local nCurTeam = 5
|
||||
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
|
||||
nCurTeam = PlayerData.Mainline.nCurTeamIndex
|
||||
end
|
||||
local tbTeamMemberId, nCaptain
|
||||
if tbChar == nil then
|
||||
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
|
||||
else
|
||||
tbTeamMemberId = tbChar
|
||||
end
|
||||
local tbRoleId = {}
|
||||
for i = 1, #tbTeamMemberId do
|
||||
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
|
||||
table.insert(tbRoleId, tbTeamMemberId[i])
|
||||
end
|
||||
end
|
||||
if #tbRoleId == 0 then
|
||||
table.insert(tbRoleId, 112)
|
||||
end
|
||||
if bPureAvg then
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
else
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
local nAnimTime
|
||||
if nResultState == 1 then
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
CS.WwiseAudioManager.Instance:PlaySound("ui_roguelike_victory")
|
||||
WwiseManger:SetState("system", "victory")
|
||||
nAnimTime = 4
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
nAnimTime = 3
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnable(self.canvas, true)
|
||||
if bPureAvg then
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
self.bClick = false
|
||||
self.bProcessingClose = false
|
||||
nAnimTime = nAnimTime + 1.5
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, nResultState == 1)
|
||||
end
|
||||
function DailyInstanceResultCtrl:OnDisable()
|
||||
PlayerData.DailyInstance:SetSettlementState(false)
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function DailyInstanceResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
self.bClick = not self.bOpenUpgrade
|
||||
end
|
||||
function DailyInstanceResultCtrl:RefreshWorldClass(nExp)
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
local bMax = nFullExp == 0
|
||||
self._mapNode.txtExp.gameObject:SetActive(true)
|
||||
self._mapNode.txtMaxLevel.gameObject:SetActive(bMax)
|
||||
self._mapNode.txtWorldExp.gameObject:SetActive(not bMax)
|
||||
self._mapNode.goRank:SetActive(not bMax)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat") or "", nWorldClass))
|
||||
local nMaxWidth = 443
|
||||
local v2Size = self._mapNode.imgExpFillBg.sizeDelta
|
||||
v2Size.y = self._mapNode.imgExp.sizeDelta.y
|
||||
if bMax then
|
||||
v2Size.x = nMaxWidth
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
else
|
||||
local nfillAmount = (nCurExp - nExp) / nFullExp
|
||||
local nAddAmount = nCurExp / nFullExp
|
||||
if nCurExp - nExp <= 0 then
|
||||
nfillAmount = 0
|
||||
nAddAmount = nCurExp / nFullExp
|
||||
end
|
||||
nfillAmount = 1 < nfillAmount and 1 or nfillAmount
|
||||
v2Size.x = nMaxWidth * nfillAmount
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
nAddAmount = 1 < nAddAmount and 1 or nAddAmount
|
||||
v2Size.x = nMaxWidth * nAddAmount
|
||||
self._mapNode.imgExp1.sizeDelta = v2Size
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
|
||||
end
|
||||
end
|
||||
function DailyInstanceResultCtrl:RefreshTarget(tbStar)
|
||||
for i = 1, 3 do
|
||||
local tr = self._mapNode.getStar[i]
|
||||
local star = tr:Find("star"):GetComponent("Transform")
|
||||
local starPass = star:Find("starPass")
|
||||
local txtCondition = tr:Find("texCondition"):GetComponent("TMP_Text")
|
||||
if i == 1 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapDailyInstance.OneStarDesc)
|
||||
elseif i == 2 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapDailyInstance.TwoStarDesc)
|
||||
elseif i == 3 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapDailyInstance.ThreeStarDesc)
|
||||
end
|
||||
if nil ~= starPass then
|
||||
starPass.gameObject:SetActive(tbStar[i - 1])
|
||||
end
|
||||
end
|
||||
end
|
||||
function DailyInstanceResultCtrl:ClosePanel()
|
||||
if self.bProcessingClose then
|
||||
return
|
||||
end
|
||||
self.bProcessingClose = true
|
||||
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.bSuccess 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 DailyInstanceResultCtrl:RefreshGacha()
|
||||
local sIconPath = "UI/big_sprites/"
|
||||
local gachaCfg = starGachaCfg[3]
|
||||
if nil ~= gachaCfg then
|
||||
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
|
||||
self._mapNode.animGacha:Play(gachaCfg.animName)
|
||||
end
|
||||
end
|
||||
function DailyInstanceResultCtrl:OnBtnClick_Close(btn)
|
||||
if not self.bClick then
|
||||
return
|
||||
end
|
||||
self.bClick = false
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function DailyInstanceResultCtrl:OpenReward()
|
||||
if #self.mapReward > 0 then
|
||||
local nAnimTime = 2
|
||||
self._mapNode.goGacha.gameObject:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_gacha_specialOpen")
|
||||
self:RefreshGacha()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
local wait = function()
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
end
|
||||
self:AddTimer(1, nAnimTime, wait, true, true, true)
|
||||
else
|
||||
self:ClosePanel()
|
||||
end
|
||||
end
|
||||
function DailyInstanceResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return DailyInstanceResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local DailyInstanceResultPanel = class("DailyInstanceResultPanel", BasePanel)
|
||||
DailyInstanceResultPanel._bAddToBackHistory = false
|
||||
DailyInstanceResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.DailyInstanceResultCtrl"
|
||||
}
|
||||
}
|
||||
function DailyInstanceResultPanel:Awake()
|
||||
end
|
||||
function DailyInstanceResultPanel:OnEnable()
|
||||
end
|
||||
function DailyInstanceResultPanel:OnDisable()
|
||||
end
|
||||
function DailyInstanceResultPanel:OnDestroy()
|
||||
end
|
||||
return DailyInstanceResultPanel
|
||||
@@ -0,0 +1,376 @@
|
||||
local EquipmentInstanceResultCtrl = class("EquipmentInstanceResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
EquipmentInstanceResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
animComplete = {sNodeName = "goComplete", sComponentName = "Animator"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
goWorldLevel = {},
|
||||
imgExp = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgExp1 = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtRankEn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtWorldExp = {sComponentName = "TMP_Text"},
|
||||
imgExpBg = {},
|
||||
txtGetWorldExp = {sComponentName = "TMP_Text"},
|
||||
goRankArrow = {},
|
||||
goRank = {},
|
||||
goStarList = {},
|
||||
getStar = {nCount = 3, sComponentName = "Transform"},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtExp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_ExpTips"
|
||||
},
|
||||
txtMaxLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Max_Level"
|
||||
},
|
||||
goGacha = {},
|
||||
animGacha = {
|
||||
sNodeName = "goGachaItem",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgFull = {sComponentName = "Image"},
|
||||
imgSplitB = {sComponentName = "Image"},
|
||||
imgSplitC = {sComponentName = "Image"},
|
||||
imgSplitD = {sComponentName = "Image"},
|
||||
imgExpFillBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult"
|
||||
},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
}
|
||||
}
|
||||
EquipmentInstanceResultCtrl._mapEventConfig = {}
|
||||
local starGachaCfg = {
|
||||
[1] = {
|
||||
iconPath = "icon_roguegacha_03%s",
|
||||
animName = "BattleResultgoGacha_r"
|
||||
},
|
||||
[2] = {
|
||||
iconPath = "icon_roguegacha_02%s",
|
||||
animName = "BattleResultgoGacha_sr"
|
||||
},
|
||||
[3] = {
|
||||
iconPath = "icon_roguegacha_01%s",
|
||||
animName = "BattleResultgoGacha_ssr"
|
||||
}
|
||||
}
|
||||
function EquipmentInstanceResultCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnable(self.canvas, false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
nResultState = 3
|
||||
elseif tbParam[1] then
|
||||
nResultState = 1
|
||||
elseif #tbParam == 3 and tbParam[1] == false then
|
||||
nResultState = 2
|
||||
end
|
||||
local tbStar = tbParam[2]
|
||||
local GenerRewardItems = tbParam[3]
|
||||
local FirstRewardItems = tbParam[4]
|
||||
local ChestRewardItems = tbParam[5]
|
||||
local nExp = tbParam[6] or 0
|
||||
local bPureAvg = tbParam[7]
|
||||
local sLarge = tbParam[8]
|
||||
local sSmall = tbParam[9]
|
||||
local nEquipmentInstanceId = tbParam[10]
|
||||
local tbChar = tbParam[11]
|
||||
self.mapChangeInfo = tbParam[12]
|
||||
local SurpriseItems = tbParam[13]
|
||||
self.tbCharDamage = tbParam[14] or {}
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
self.mapEquipmentInstance = ConfigTable.GetData("CharGemInstance", nEquipmentInstanceId)
|
||||
local sEquipmentInstanceName = ""
|
||||
if self.mapEquipmentInstance ~= nil then
|
||||
sEquipmentInstanceName = self.mapEquipmentInstance.Name
|
||||
end
|
||||
local nStar = 0
|
||||
for i = 0, 2 do
|
||||
if tbStar[i] then
|
||||
nStar = nStar + 1
|
||||
end
|
||||
end
|
||||
self.nLevelStar = nStar
|
||||
self.bSuccess = 0 < nStar
|
||||
self.mapReward = {}
|
||||
for _, v in pairs(GenerRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(FirstRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.First
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(ChestRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.Three
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(SurpriseItems) do
|
||||
v.rewardType = AllEnum.RewardType.Extra
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
local sName = orderedFormat(ConfigTable.GetUIText("Dungeon_Difficulty") or "", sEquipmentInstanceName, ConfigTable.GetUIText("Diffculty_" .. self.mapEquipmentInstance.Difficulty) or "")
|
||||
NovaAPI.SetTMPText(v, sName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
self:RefreshTarget(tbStar)
|
||||
local nCurTeam = 5
|
||||
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
|
||||
nCurTeam = PlayerData.Mainline.nCurTeamIndex
|
||||
end
|
||||
local tbTeamMemberId, nCaptain
|
||||
if tbChar == nil then
|
||||
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
|
||||
else
|
||||
tbTeamMemberId = tbChar
|
||||
end
|
||||
local tbRoleId = {}
|
||||
for i = 1, #tbTeamMemberId do
|
||||
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
|
||||
table.insert(tbRoleId, tbTeamMemberId[i])
|
||||
end
|
||||
end
|
||||
if #tbRoleId == 0 then
|
||||
table.insert(tbRoleId, 112)
|
||||
end
|
||||
if bPureAvg then
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
else
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
local nAnimTime
|
||||
if nResultState == 1 then
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_victory")
|
||||
WwiseManger:SetState("system", "victory")
|
||||
nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animComplete, {
|
||||
"BattleResultPanel_victory_out"
|
||||
})
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
nAnimTime = 3
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnable(self.canvas, true)
|
||||
if bPureAvg then
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
nAnimTime = nAnimTime + 1.5
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, nResultState == 1)
|
||||
self.bProcessingClose = false
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:OnDisable()
|
||||
PlayerData.EquipmentInstance:SetSettlementState(false)
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:RefreshWorldClass(nExp)
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
local bMax = nFullExp == 0
|
||||
self._mapNode.txtExp.gameObject:SetActive(true)
|
||||
self._mapNode.txtMaxLevel.gameObject:SetActive(bMax)
|
||||
self._mapNode.txtWorldExp.gameObject:SetActive(not bMax)
|
||||
self._mapNode.goRank:SetActive(not bMax)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat") or "", nWorldClass))
|
||||
local nMaxWidth = 443
|
||||
local v2Size = self._mapNode.imgExpFillBg.sizeDelta
|
||||
v2Size.y = self._mapNode.imgExp.sizeDelta.y
|
||||
if bMax then
|
||||
v2Size.x = nMaxWidth
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
else
|
||||
local nfillAmount = (nCurExp - nExp) / nFullExp
|
||||
local nAddAmount = nCurExp / nFullExp
|
||||
if nCurExp - nExp <= 0 then
|
||||
nfillAmount = 0
|
||||
nAddAmount = nCurExp / nFullExp
|
||||
end
|
||||
nfillAmount = 1 < nfillAmount and 1 or nfillAmount
|
||||
v2Size.x = nMaxWidth * nfillAmount
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
nAddAmount = 1 < nAddAmount and 1 or nAddAmount
|
||||
v2Size.x = nMaxWidth * nAddAmount
|
||||
self._mapNode.imgExp1.sizeDelta = v2Size
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
|
||||
end
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:RefreshTarget(tbStar)
|
||||
for i = 1, 3 do
|
||||
local tr = self._mapNode.getStar[i]
|
||||
local star = tr:Find("star"):GetComponent("Transform")
|
||||
local starPass = star:Find("starPass")
|
||||
local txtCondition = tr:Find("texCondition"):GetComponent("TMP_Text")
|
||||
local tbCond = {}
|
||||
table.insert(tbCond, decodeJson(self.mapEquipmentInstance.OneStarCondition))
|
||||
table.insert(tbCond, decodeJson(self.mapEquipmentInstance.TwoStarCondition))
|
||||
table.insert(tbCond, decodeJson(self.mapEquipmentInstance.ThreeStarCondition))
|
||||
local cond = tbCond[i]
|
||||
if cond ~= nil then
|
||||
local _floorData = ConfigTable.GetData("CharGemInstanceFloor", self.mapEquipmentInstance.FloorId)
|
||||
if _floorData then
|
||||
if cond[1] == 1 then
|
||||
NovaAPI.SetTMPText(txtCondition, orderedFormat(ConfigTable.GetUIText("SkillInstance_PassConfition_1"), _floorData.LevelTotalTime))
|
||||
else
|
||||
NovaAPI.SetTMPText(txtCondition, orderedFormat(ConfigTable.GetUIText("SkillInstance_PassConfition_2"), _floorData.LevelTotalTime - cond[2]))
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil ~= starPass then
|
||||
starPass.gameObject:SetActive(tbStar[i - 1])
|
||||
end
|
||||
end
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:ClosePanel()
|
||||
if self.bProcessingClose then
|
||||
return
|
||||
end
|
||||
self.bProcessingClose = true
|
||||
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.bSuccess 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 EquipmentInstanceResultCtrl:RefreshGacha()
|
||||
local sIconPath = "UI/big_sprites/"
|
||||
local gachaCfg = starGachaCfg[self.nLevelStar]
|
||||
if nil ~= gachaCfg then
|
||||
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
|
||||
self._mapNode.animGacha:Play(gachaCfg.animName)
|
||||
end
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:OnBtnClick_Close(btn)
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:OpenReward()
|
||||
if #self.mapReward > 0 then
|
||||
local nAnimTime = 2
|
||||
self._mapNode.goGacha.gameObject:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_gacha_specialOpen")
|
||||
self:RefreshGacha()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(nAnimTime))
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
self:ClosePanel()
|
||||
end
|
||||
end
|
||||
function EquipmentInstanceResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return EquipmentInstanceResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local EquipmentInstanceResultPanel = class("EquipmentInstanceResultPanel", BasePanel)
|
||||
EquipmentInstanceResultPanel._bAddToBackHistory = false
|
||||
EquipmentInstanceResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.EquipmentInstanceResultCtrl"
|
||||
}
|
||||
}
|
||||
function EquipmentInstanceResultPanel:Awake()
|
||||
end
|
||||
function EquipmentInstanceResultPanel:OnEnable()
|
||||
end
|
||||
function EquipmentInstanceResultPanel:OnDisable()
|
||||
end
|
||||
function EquipmentInstanceResultPanel:OnDestroy()
|
||||
end
|
||||
return EquipmentInstanceResultPanel
|
||||
@@ -0,0 +1,376 @@
|
||||
local SkillInstanceResultCtrl = class("SkillInstanceResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
SkillInstanceResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
animComplete = {sNodeName = "goComplete", sComponentName = "Animator"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
goWorldLevel = {},
|
||||
imgExp = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgExp1 = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtRankEn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtWorldExp = {sComponentName = "TMP_Text"},
|
||||
imgExpBg = {},
|
||||
txtGetWorldExp = {sComponentName = "TMP_Text"},
|
||||
goRankArrow = {},
|
||||
goRank = {},
|
||||
goStarList = {},
|
||||
getStar = {nCount = 3, sComponentName = "Transform"},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtExp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_ExpTips"
|
||||
},
|
||||
txtMaxLevel = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Max_Level"
|
||||
},
|
||||
goGacha = {},
|
||||
animGacha = {
|
||||
sNodeName = "goGachaItem",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgFull = {sComponentName = "Image"},
|
||||
imgSplitB = {sComponentName = "Image"},
|
||||
imgSplitC = {sComponentName = "Image"},
|
||||
imgSplitD = {sComponentName = "Image"},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult"
|
||||
},
|
||||
imgExpFillBg = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
}
|
||||
}
|
||||
SkillInstanceResultCtrl._mapEventConfig = {}
|
||||
local starGachaCfg = {
|
||||
[1] = {
|
||||
iconPath = "icon_roguegacha_03%s",
|
||||
animName = "BattleResultgoGacha_r"
|
||||
},
|
||||
[2] = {
|
||||
iconPath = "icon_roguegacha_02%s",
|
||||
animName = "BattleResultgoGacha_sr"
|
||||
},
|
||||
[3] = {
|
||||
iconPath = "icon_roguegacha_01%s",
|
||||
animName = "BattleResultgoGacha_ssr"
|
||||
}
|
||||
}
|
||||
function SkillInstanceResultCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnable(self.canvas, false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function SkillInstanceResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
local nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
nResultState = 3
|
||||
elseif tbParam[1] then
|
||||
nResultState = 1
|
||||
elseif #tbParam == 3 and tbParam[1] == false then
|
||||
nResultState = 2
|
||||
end
|
||||
local tbStar = tbParam[2]
|
||||
local GenerRewardItems = tbParam[3]
|
||||
local FirstRewardItems = tbParam[4]
|
||||
local ChestRewardItems = tbParam[5]
|
||||
local nExp = tbParam[6] or 0
|
||||
local bPureAvg = tbParam[7]
|
||||
local sLarge = tbParam[8]
|
||||
local sSmall = tbParam[9]
|
||||
local nSkillInstanceId = tbParam[10]
|
||||
local tbChar = tbParam[11]
|
||||
self.mapChangeInfo = tbParam[12]
|
||||
local SurpriseItems = tbParam[13]
|
||||
self.tbCharDamage = tbParam[14] or {}
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
self.mapSkillInstance = ConfigTable.GetData("SkillInstance", nSkillInstanceId)
|
||||
local sSkillInstanceName = ""
|
||||
if self.mapSkillInstance ~= nil then
|
||||
sSkillInstanceName = self.mapSkillInstance.Name
|
||||
end
|
||||
local nStar = 0
|
||||
for i = 0, 2 do
|
||||
if tbStar[i] then
|
||||
nStar = nStar + 1
|
||||
end
|
||||
end
|
||||
self.nLevelStar = nStar
|
||||
self.bSuccess = 0 < nStar
|
||||
self.mapReward = {}
|
||||
for _, v in pairs(GenerRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(FirstRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.First
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(ChestRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.Three
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(SurpriseItems) do
|
||||
v.rewardType = AllEnum.RewardType.Extra
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
local sName = orderedFormat(ConfigTable.GetUIText("Dungeon_Difficulty") or "", sSkillInstanceName, ConfigTable.GetUIText("Diffculty_" .. self.mapSkillInstance.Difficulty) or "")
|
||||
NovaAPI.SetTMPText(v, sName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
self:RefreshTarget(tbStar)
|
||||
local nCurTeam = 5
|
||||
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
|
||||
nCurTeam = PlayerData.Mainline.nCurTeamIndex
|
||||
end
|
||||
local tbTeamMemberId, nCaptain
|
||||
if tbChar == nil then
|
||||
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
|
||||
else
|
||||
tbTeamMemberId = tbChar
|
||||
end
|
||||
local tbRoleId = {}
|
||||
for i = 1, #tbTeamMemberId do
|
||||
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
|
||||
table.insert(tbRoleId, tbTeamMemberId[i])
|
||||
end
|
||||
end
|
||||
if #tbRoleId == 0 then
|
||||
table.insert(tbRoleId, 112)
|
||||
end
|
||||
if bPureAvg then
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
else
|
||||
end
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
local nAnimTime
|
||||
if nResultState == 1 then
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_victory")
|
||||
WwiseManger:SetState("system", "victory")
|
||||
nAnimTime = NovaAPI.GetAnimClipLength(self._mapNode.animComplete, {
|
||||
"BattleResultPanel_victory_out"
|
||||
})
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
nAnimTime = 3
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnable(self.canvas, true)
|
||||
if bPureAvg then
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
nAnimTime = nAnimTime + 1.5
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, nResultState == 1)
|
||||
self.bProcessingClose = false
|
||||
end
|
||||
function SkillInstanceResultCtrl:OnDisable()
|
||||
PlayerData.SkillInstance:SetSettlementState(false)
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function SkillInstanceResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
end
|
||||
function SkillInstanceResultCtrl:RefreshWorldClass(nExp)
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
local bMax = nFullExp == 0
|
||||
self._mapNode.txtExp.gameObject:SetActive(true)
|
||||
self._mapNode.txtMaxLevel.gameObject:SetActive(bMax)
|
||||
self._mapNode.txtWorldExp.gameObject:SetActive(not bMax)
|
||||
self._mapNode.goRank:SetActive(not bMax)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, orderedFormat(ConfigTable.GetUIText("CommonTips_LevelFormat") or "", nWorldClass))
|
||||
local nMaxWidth = 443
|
||||
local v2Size = self._mapNode.imgExpFillBg.sizeDelta
|
||||
v2Size.y = self._mapNode.imgExp.sizeDelta.y
|
||||
if bMax then
|
||||
v2Size.x = nMaxWidth
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
else
|
||||
local nfillAmount = (nCurExp - nExp) / nFullExp
|
||||
local nAddAmount = nCurExp / nFullExp
|
||||
if nCurExp - nExp <= 0 then
|
||||
nfillAmount = 0
|
||||
nAddAmount = nCurExp / nFullExp
|
||||
end
|
||||
nfillAmount = 1 < nfillAmount and 1 or nfillAmount
|
||||
v2Size.x = nMaxWidth * nfillAmount
|
||||
self._mapNode.imgExp.sizeDelta = v2Size
|
||||
nAddAmount = 1 < nAddAmount and 1 or nAddAmount
|
||||
v2Size.x = nMaxWidth * nAddAmount
|
||||
self._mapNode.imgExp1.sizeDelta = v2Size
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
|
||||
end
|
||||
end
|
||||
function SkillInstanceResultCtrl:RefreshTarget(tbStar)
|
||||
for i = 1, 3 do
|
||||
local tr = self._mapNode.getStar[i]
|
||||
local star = tr:Find("star"):GetComponent("Transform")
|
||||
local starPass = star:Find("starPass")
|
||||
local txtCondition = tr:Find("texCondition"):GetComponent("TMP_Text")
|
||||
local tbCond = {}
|
||||
table.insert(tbCond, decodeJson(self.mapSkillInstance.OneStarCondition))
|
||||
table.insert(tbCond, decodeJson(self.mapSkillInstance.TwoStarCondition))
|
||||
table.insert(tbCond, decodeJson(self.mapSkillInstance.ThreeStarCondition))
|
||||
local cond = tbCond[i]
|
||||
if cond ~= nil then
|
||||
local _floorData = ConfigTable.GetData("SkillInstanceFloor", self.mapSkillInstance.FloorId)
|
||||
if _floorData then
|
||||
if cond[1] == 1 then
|
||||
NovaAPI.SetTMPText(txtCondition, orderedFormat(ConfigTable.GetUIText("SkillInstance_PassConfition_1"), _floorData.LevelTotalTime))
|
||||
else
|
||||
NovaAPI.SetTMPText(txtCondition, orderedFormat(ConfigTable.GetUIText("SkillInstance_PassConfition_2"), _floorData.LevelTotalTime - cond[2]))
|
||||
end
|
||||
end
|
||||
end
|
||||
if nil ~= starPass then
|
||||
starPass.gameObject:SetActive(tbStar[i - 1])
|
||||
end
|
||||
end
|
||||
end
|
||||
function SkillInstanceResultCtrl:ClosePanel()
|
||||
if self.bProcessingClose then
|
||||
return
|
||||
end
|
||||
self.bProcessingClose = true
|
||||
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.bSuccess 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 SkillInstanceResultCtrl:RefreshGacha()
|
||||
local sIconPath = "UI/big_sprites/"
|
||||
local gachaCfg = starGachaCfg[self.nLevelStar]
|
||||
if nil ~= gachaCfg then
|
||||
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
|
||||
self._mapNode.animGacha:Play(gachaCfg.animName)
|
||||
end
|
||||
end
|
||||
function SkillInstanceResultCtrl:OnBtnClick_Close(btn)
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function SkillInstanceResultCtrl:OpenReward()
|
||||
if #self.mapReward > 0 then
|
||||
local nAnimTime = 2
|
||||
self._mapNode.goGacha.gameObject:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_gacha_specialOpen")
|
||||
self:RefreshGacha()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(nAnimTime))
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
self:ClosePanel()
|
||||
end
|
||||
end
|
||||
function SkillInstanceResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return SkillInstanceResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local SkillInstanceResultPanel = class("SkillInstanceResultPanel", BasePanel)
|
||||
SkillInstanceResultPanel._bAddToBackHistory = false
|
||||
SkillInstanceResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.SkillInstanceResultCtrl"
|
||||
}
|
||||
}
|
||||
function SkillInstanceResultPanel:Awake()
|
||||
end
|
||||
function SkillInstanceResultPanel:OnEnable()
|
||||
end
|
||||
function SkillInstanceResultPanel:OnDisable()
|
||||
end
|
||||
function SkillInstanceResultPanel:OnDestroy()
|
||||
end
|
||||
return SkillInstanceResultPanel
|
||||
@@ -0,0 +1,440 @@
|
||||
local TDBattleResultCtrl = class("TDBattleResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
|
||||
TDBattleResultCtrl._mapNodeConfig = {
|
||||
imgBlurredBg = {},
|
||||
goComplete = {sComponentName = "GameObject"},
|
||||
goFailed = {sComponentName = "GameObject"},
|
||||
Mask = {
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
goMainlineNameSuc = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
txtMainlineName = {nCount = 2, sComponentName = "TMP_Text"},
|
||||
ButtonClose = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnDamageResult = {
|
||||
nCount = 2,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_ShowDamageResult"
|
||||
},
|
||||
goRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
animatorRoot = {sNodeName = "goComplete", sComponentName = "Animator"},
|
||||
goWorldLevel = {},
|
||||
imgExp = {sComponentName = "Image"},
|
||||
txtRank = {sComponentName = "TMP_Text"},
|
||||
txtRankEn = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainView_RANK"
|
||||
},
|
||||
txtWorldExp = {sComponentName = "TMP_Text"},
|
||||
imgExpBg = {},
|
||||
txtGetWorldExp = {sComponentName = "TMP_Text"},
|
||||
goRankArrow = {},
|
||||
txtTip = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtTipShadow = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Battle_Result_Fail_Tip"
|
||||
},
|
||||
txtExp = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "WorldClass_ExpTips"
|
||||
},
|
||||
goGacha = {},
|
||||
animGacha = {
|
||||
sNodeName = "goGachaItem",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgFull = {sComponentName = "Image"},
|
||||
imgSplitB = {sComponentName = "Image"},
|
||||
imgSplitC = {sComponentName = "Image"},
|
||||
imgSplitD = {sComponentName = "Image"},
|
||||
goAffixes = {},
|
||||
TMPTitleAffix = {sComponentName = "TMP_Text"},
|
||||
goAffix = {sComponentName = "Transform", nCount = 25},
|
||||
imgHardBgXXX = {},
|
||||
TMPHardTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_Difficulty_Title"
|
||||
},
|
||||
TMPTimeTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Battle_Time"
|
||||
},
|
||||
TMPHard = {sComponentName = "TMP_Text"},
|
||||
TMPTime = {sComponentName = "TMP_Text"},
|
||||
imgNewRecord = {},
|
||||
imgHardTitleBg = {},
|
||||
imgHardScoreBg = {},
|
||||
imgHardScoreTitleBg = {},
|
||||
imgTimeScoreBg = {},
|
||||
imgTimeScoreTitleBg = {},
|
||||
rtTimeBg = {
|
||||
sNodeName = "imgTimeBg",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
TMPFinalScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_FinalScore_Title"
|
||||
},
|
||||
TMPFinalScore = {sComponentName = "TMP_Text"},
|
||||
TMPTimeScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_TimeScore_Title"
|
||||
},
|
||||
TMPTimeScore = {sComponentName = "TMP_Text"},
|
||||
TMPHardScore = {sComponentName = "TMP_Text"},
|
||||
TMPHardScoreTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTower_Result_BaseScore_Title"
|
||||
},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
}
|
||||
}
|
||||
TDBattleResultCtrl._mapEventConfig = {}
|
||||
local starGachaCfg = {
|
||||
[1] = {
|
||||
iconPath = "icon_roguegacha_03%s",
|
||||
animName = "BattleResultgoGacha_r"
|
||||
},
|
||||
[2] = {
|
||||
iconPath = "icon_roguegacha_02%s",
|
||||
animName = "BattleResultgoGacha_sr"
|
||||
},
|
||||
[3] = {
|
||||
iconPath = "icon_roguegacha_01%s",
|
||||
animName = "BattleResultgoGacha_ssr"
|
||||
}
|
||||
}
|
||||
local name_bg_pos_y_1 = 220
|
||||
local name_bg_pos_y_2 = 119
|
||||
local time_bg_pos_y_1 = -4.1
|
||||
local time_bg_pos_y_2 = -113
|
||||
function TDBattleResultCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnable(self.canvas, false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function TDBattleResultCtrl:OnEnable()
|
||||
local tbParam = self:GetPanelParam()
|
||||
self.nResultState = 0
|
||||
if #tbParam == 2 and tbParam[1] == false then
|
||||
self.nResultState = 3
|
||||
elseif tbParam[1] then
|
||||
self.nResultState = 1
|
||||
elseif #tbParam == 3 and tbParam[1] == false then
|
||||
self.nResultState = 2
|
||||
end
|
||||
local tbStar = tbParam[2]
|
||||
local GenerRewardItems = tbParam[3]
|
||||
local FirstRewardItems = tbParam[4]
|
||||
local ChestRewardItems = tbParam[5]
|
||||
local nExp = tbParam[6] or 0
|
||||
local bPureAvg = tbParam[7]
|
||||
local nTime = tbParam[8]
|
||||
local nTDLevelId = tbParam[9]
|
||||
local tbChar = tbParam[10]
|
||||
local tbAffixes = tbParam[11]
|
||||
local nTimeScore = tbParam[12]
|
||||
local nHardScore = tbParam[13]
|
||||
local nFinalScore = tbParam[14]
|
||||
local bNewRecord = tbParam[15]
|
||||
self.mapChangeInfo = tbParam[16]
|
||||
local SurpriseItems = tbParam[17]
|
||||
local CustomItems = tbParam[18]
|
||||
self.tbCharDamage = tbParam[19] or {}
|
||||
local nHard = 0
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
self.bNewRecord = bNewRecord
|
||||
self.nFinalScore = nFinalScore
|
||||
self.tbChar = tbChar
|
||||
for _, nAffixesId in ipairs(tbAffixes) do
|
||||
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixesId)
|
||||
if mapAffixCfgData ~= nil then
|
||||
nHard = nHard + mapAffixCfgData.Difficulty
|
||||
end
|
||||
end
|
||||
for index = 1, 25 do
|
||||
self:SetAffixIcon(self._mapNode.goAffix[index], tbAffixes[index])
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPHard, nHard)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTime, nTime .. ConfigTable.GetUIText("Talent_Sec"))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPFinalScore, nFinalScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPTimeScore, nTimeScore)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPHardScore, nHardScore)
|
||||
self._mapNode.imgNewRecord:SetActive(bNewRecord)
|
||||
self.mapTravelerDuelLevel = ConfigTable.GetData("TravelerDuelBossLevel", nTDLevelId)
|
||||
local sTravelerDuelLevelName = ""
|
||||
if self.mapTravelerDuelLevel ~= nil then
|
||||
if 0 < self.mapTravelerDuelLevel.Difficulty then
|
||||
sTravelerDuelLevelName = orderedFormat(ConfigTable.GetUIText("Dungeon_Difficulty") or "", self.mapTravelerDuelLevel.Name, ConfigTable.GetUIText("Diffculty_" .. self.mapTravelerDuelLevel.Difficulty) or "")
|
||||
elseif self.nResultState == 1 then
|
||||
sTravelerDuelLevelName = self.mapTravelerDuelLevel.Name
|
||||
else
|
||||
sTravelerDuelLevelName = self.mapTravelerDuelLevel.Name .. orderedFormat(ConfigTable.GetUIText("TD_BattleResultDifficulty"), nHard)
|
||||
end
|
||||
end
|
||||
local nStar = 0
|
||||
for i = 0, 2 do
|
||||
if tbStar[i] then
|
||||
nStar = nStar + 1
|
||||
end
|
||||
end
|
||||
self.nLevelStar = nStar
|
||||
self.bSuccess = 0 < nStar
|
||||
self.mapReward = {}
|
||||
if SurpriseItems ~= nil then
|
||||
for _, v in pairs(SurpriseItems) do
|
||||
v.rewardType = AllEnum.RewardType.Extra
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
end
|
||||
for _, v in pairs(GenerRewardItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
if CustomItems ~= nil then
|
||||
for _, v in pairs(CustomItems) do
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
end
|
||||
for _, v in pairs(FirstRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.First
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in pairs(ChestRewardItems) do
|
||||
v.rewardType = AllEnum.RewardType.Three
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
NovaAPI.SetTMPText(v, sTravelerDuelLevelName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
local nCurTeam = 5
|
||||
if PlayerData.nCurGameType == AllEnum.WorldMapNodeType.Mainline then
|
||||
nCurTeam = PlayerData.Mainline.nCurTeamIndex
|
||||
end
|
||||
local tbTeamMemberId, nCaptain
|
||||
if tbChar == nil then
|
||||
nCaptain, tbTeamMemberId = PlayerData.Team:GetTeamData(nCurTeam)
|
||||
else
|
||||
tbTeamMemberId = tbChar
|
||||
end
|
||||
local tbRoleId = {}
|
||||
for i = 1, #tbTeamMemberId do
|
||||
if tbTeamMemberId[i] ~= nil and 0 < tbTeamMemberId[i] then
|
||||
table.insert(tbRoleId, tbTeamMemberId[i])
|
||||
end
|
||||
end
|
||||
if #tbRoleId == 0 then
|
||||
table.insert(tbRoleId, 112)
|
||||
end
|
||||
self.tbRoleList = tbRoleId
|
||||
if bPureAvg then
|
||||
self._mapNode.trActor2D_PNG.gameObject:SetActive(false)
|
||||
else
|
||||
end
|
||||
self._mapNode.imgHardBgXXX:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
self._mapNode.imgHardTitleBg:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
self._mapNode.imgHardScoreBg:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
self._mapNode.imgHardScoreTitleBg:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
self._mapNode.imgTimeScoreBg:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
self._mapNode.imgTimeScoreTitleBg:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
self._mapNode.TMPFinalScoreTitle.gameObject:SetActive(self.mapTravelerDuelLevel.Difficulty == 0)
|
||||
WwiseManger:PostEvent("ui_loading_combatSFX_mute", nil, false)
|
||||
WwiseManger:PostEvent("char_common_all_pause")
|
||||
WwiseManger:PostEvent("mon_common_all_pause")
|
||||
WwiseManger:SetState("level", "None")
|
||||
WwiseManger:SetState("combat", "None")
|
||||
local nAnimTime
|
||||
if self.nResultState == 1 then
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(false)
|
||||
self._mapNode.goFailed:SetActive(false)
|
||||
self._mapNode.goComplete:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_victory")
|
||||
WwiseManger:SetState("system", "victory2")
|
||||
if self.mapTravelerDuelLevel.Difficulty == 0 and 0 < #tbAffixes then
|
||||
nAnimTime = 4.2
|
||||
self._mapNode.animatorRoot:Play("TravelerDuelBattleResultPanel_victory_out")
|
||||
else
|
||||
nAnimTime = 4
|
||||
end
|
||||
else
|
||||
WwiseManger:SetState("system", "defeat")
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.goRoot.gameObject:SetActive(false)
|
||||
self._mapNode.imgBlurredBg.gameObject:SetActive(true)
|
||||
self._mapNode.goFailed:SetActive(true)
|
||||
self._mapNode.goComplete:SetActive(false)
|
||||
nAnimTime = 3
|
||||
end
|
||||
self._mapNode.Mask.gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(false)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(false)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self._mapNode.goRoot.gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[1].gameObject:SetActive(true)
|
||||
self._mapNode.ButtonClose[2].gameObject:SetActive(true)
|
||||
NovaAPI.SetComponentEnable(self.canvas, true)
|
||||
if bPureAvg then
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
nAnimTime = nAnimTime + 1.5
|
||||
self:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, self.nResultState == 1)
|
||||
self.bProcessingClose = false
|
||||
end
|
||||
function TDBattleResultCtrl:OnDisable()
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function TDBattleResultCtrl:SetAffixIcon(trIcon, nAffixId)
|
||||
local rtIconRoot = trIcon:Find("rtIcon")
|
||||
local imgIcon = trIcon:Find("rtIcon/imgIcon"):GetComponent("Image")
|
||||
local TMPLevel = trIcon:Find("rtIcon/imgBgLevel/TMPLevel"):GetComponent("TMP_Text")
|
||||
if nAffixId == nil then
|
||||
rtIconRoot.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local mapAffixCfgData = ConfigTable.GetData("TravelerDuelChallengeAffix", nAffixId)
|
||||
if mapAffixCfgData == nil then
|
||||
rtIconRoot.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
NovaAPI.SetTMPText(TMPLevel, mapAffixCfgData.Difficulty)
|
||||
self:SetPngSprite(imgIcon, mapAffixCfgData.Icon)
|
||||
end
|
||||
function TDBattleResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local function RankUploadEnd()
|
||||
EventManager.Remove("TDUploadRankEnd", self, RankUploadEnd)
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.TravelerDuel:TryOpenTDUpgradePanel(callback)
|
||||
end
|
||||
local mapRankingData, _, _, nTimes = PlayerData.TravelerDuel:GetTDRankingData()
|
||||
if self.bNewRecord and 0 < nTimes then
|
||||
EventManager.Add("TDUploadRankEnd", self, RankUploadEnd)
|
||||
local nOldScore = 0
|
||||
if mapRankingData ~= nil then
|
||||
nOldScore = mapRankingData.Score
|
||||
end
|
||||
self:AddTimer(1, 0.5, function()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.TravelerDuelRankingUpload, nOldScore, self.nFinalScore, nTimes, self.tbChar)
|
||||
end, true, true, true)
|
||||
else
|
||||
RankUploadEnd()
|
||||
end
|
||||
end
|
||||
function TDBattleResultCtrl:RefreshWorldClass(nExp)
|
||||
local nWorldClass = PlayerData.Base:GetWorldClass()
|
||||
local nCurExp = PlayerData.Base:GetWorldExp()
|
||||
local mapCfg = ConfigTable.GetData("WorldClass", nWorldClass + 1, true)
|
||||
local nFullExp = 0
|
||||
if mapCfg then
|
||||
nFullExp = mapCfg.Exp
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.txtRank, nWorldClass)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtWorldExp, nCurExp .. "/" .. nFullExp)
|
||||
local nfillAmount = nCurExp / nFullExp
|
||||
NovaAPI.SetImageFillAmount(self._mapNode.imgExp, 1 < nfillAmount and 1 or nfillAmount)
|
||||
self._mapNode.imgExpBg.gameObject:SetActive(0 < nExp)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtGetWorldExp, "+" .. nExp)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(0 < nExp)
|
||||
self._mapNode.goRankArrow.gameObject:SetActive(false)
|
||||
end
|
||||
function TDBattleResultCtrl:ClosePanel()
|
||||
if self.bProcessingClose then
|
||||
return
|
||||
end
|
||||
self.bProcessingClose = true
|
||||
if self.nResultState ~= 1 then
|
||||
CS.AdventureModuleHelper.ResumeLogic()
|
||||
end
|
||||
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.bSuccess 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 TDBattleResultCtrl:RefreshGacha()
|
||||
local sIconPath = "UI/big_sprites/"
|
||||
local gachaCfg = starGachaCfg[self.nLevelStar]
|
||||
if nil ~= gachaCfg then
|
||||
self:SetPngSprite(self._mapNode.imgFull, sIconPath .. string.format(gachaCfg.iconPath, "a"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitB, sIconPath .. string.format(gachaCfg.iconPath, "b"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitC, sIconPath .. string.format(gachaCfg.iconPath, "c"))
|
||||
self:SetPngSprite(self._mapNode.imgSplitD, sIconPath .. string.format(gachaCfg.iconPath, "d"))
|
||||
self._mapNode.animGacha:Play(gachaCfg.animName)
|
||||
end
|
||||
end
|
||||
function TDBattleResultCtrl:OnBtnClick_Close(btn)
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function TDBattleResultCtrl:OpenReward()
|
||||
if #self.mapReward > 0 then
|
||||
local nAnimTime = 2
|
||||
self._mapNode.goGacha.gameObject:SetActive(true)
|
||||
WwiseManger:PlaySound("ui_roguelike_gacha_specialOpen")
|
||||
self:RefreshGacha()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForSeconds(nAnimTime))
|
||||
local callback = function()
|
||||
self:ClosePanel()
|
||||
end
|
||||
UTILS.OpenReceiveByDisplayItem(self.mapReward, self.mapChangeInfo, callback)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
else
|
||||
self:ClosePanel()
|
||||
end
|
||||
end
|
||||
function TDBattleResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return TDBattleResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local TDBattleResultPanel = class("TDBattleResultPanel", BasePanel)
|
||||
TDBattleResultPanel._bAddToBackHistory = false
|
||||
TDBattleResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/TravelerDuelBattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.BattleResult.TDBattleResultCtrl"
|
||||
}
|
||||
}
|
||||
function TDBattleResultPanel:Awake()
|
||||
end
|
||||
function TDBattleResultPanel:OnEnable()
|
||||
end
|
||||
function TDBattleResultPanel:OnDisable()
|
||||
end
|
||||
function TDBattleResultPanel:OnDestroy()
|
||||
end
|
||||
return TDBattleResultPanel
|
||||
Reference in New Issue
Block a user