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,243 @@
|
||||
local ActivityLevelsInstancePauseCtrl = class("ActivityLevelsInstancePauseCtrl", BaseCtrl)
|
||||
local GameCameraStackManager = CS.GameCameraStackManager.Instance
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ActivityLevelsInstancePauseCtrl._mapNodeConfig = {
|
||||
goBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01"
|
||||
},
|
||||
aniBlur = {
|
||||
sNodeName = "t_fullscreen_blur_01",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
safeAreaRoot = {
|
||||
sNodeName = "----SafeAreaRoot----"
|
||||
},
|
||||
imgBlocker = {},
|
||||
btnBgClose = {
|
||||
sComponentName = "Button",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
aniWindow = {
|
||||
sNodeName = "PauseWindow",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
txtWindowTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Pause"
|
||||
},
|
||||
btnClose = {
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Close"
|
||||
},
|
||||
btnGiveUp = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_GiveUp",
|
||||
sAction = "Giveup"
|
||||
},
|
||||
btnBack = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Close",
|
||||
sAction = "Back"
|
||||
},
|
||||
btnSettings = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Settings"
|
||||
},
|
||||
btnPopSkill = {
|
||||
sComponentName = "NaviButton",
|
||||
callback = "OnBtnClick_Skill"
|
||||
},
|
||||
ActionBar = {
|
||||
sCtrlName = "Game.UI.ActionBar.ActionBarCtrl"
|
||||
},
|
||||
txtGiveUp = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_EndBattle"
|
||||
},
|
||||
txtBack = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Pause_Btn_ContinueBattle"
|
||||
},
|
||||
txtBtnSkill = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
txtBtnSettings = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "StarTowerMap_Btn_Settings"
|
||||
},
|
||||
btnChar = {
|
||||
nCount = 3,
|
||||
sComponentName = "UIButton",
|
||||
callback = "OnBtnClick_Char"
|
||||
},
|
||||
goChar = {
|
||||
nCount = 3,
|
||||
sNodeName = "btnChar",
|
||||
sCtrlName = "Game.UI.TemplateEx.TemplateCharCtrl"
|
||||
},
|
||||
txtSubTitle1 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Time"
|
||||
},
|
||||
txtSubTitle2 = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "MainBattle_Task"
|
||||
},
|
||||
txtAim = {nCount = 3, sComponentName = "TMP_Text"},
|
||||
goAim = {nCount = 3},
|
||||
imgOff = {nCount = 3},
|
||||
imgOn = {nCount = 3},
|
||||
txtTime = {sComponentName = "TMP_Text"},
|
||||
txtLeader = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Leader"
|
||||
},
|
||||
txtSub = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Build_Sub"
|
||||
}
|
||||
}
|
||||
ActivityLevelsInstancePauseCtrl._mapEventConfig = {
|
||||
ActivityLevels_Instance_Gameplay_Time = "OnEvent_Time",
|
||||
OpenActivityLevelsInstancePause = "Pause",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
function ActivityLevelsInstancePauseCtrl:Refresh()
|
||||
local mapCfg = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local activityLevelsData = PlayerData.Activity:GetActivityDataById(self.nActivityId)
|
||||
local curStar = activityLevelsData:GetLevelStar(self.nLevelId)
|
||||
local tbCond = {
|
||||
mapCfg.OneStarDesc,
|
||||
mapCfg.TwoStarDesc,
|
||||
mapCfg.ThreeStarDesc
|
||||
}
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgOn[i]:SetActive(i <= curStar)
|
||||
self._mapNode.imgOff[i]:SetActive(i > curStar)
|
||||
local cond = tbCond[i]
|
||||
if cond == "" then
|
||||
self._mapNode.goAim[i]:SetActive(false)
|
||||
break
|
||||
else
|
||||
self._mapNode.goAim[i]:SetActive(true)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAim[i], cond)
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl: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 ActivityLevelsInstancePauseCtrl:PlayCloseAni(bGiveUp)
|
||||
self._mapNode.aniWindow:Play("t_window_04_t_out")
|
||||
self._mapNode.aniBlur:SetTrigger("tOut")
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.2)
|
||||
self:AddTimer(1, 0.2, "OnPanelClose", true, true, true, bGiveUp)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnPanelClose(_, bGiveUp)
|
||||
PanelManager.InputEnable()
|
||||
GamepadUIManager.DisableGamepadUI("ActivityLevelsInstancePauseCtrl")
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, true)
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self._mapNode.goBlur:SetActive(false)
|
||||
self._mapNode.imgBlocker:SetActive(false)
|
||||
if bGiveUp then
|
||||
EventManager.Hit(EventId.AbandonBattle)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:Awake()
|
||||
self._mapNode.safeAreaRoot:SetActive(false)
|
||||
self.tbGamepadUINode = self:GetGamepadUINode()
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", 0, 0))
|
||||
local tbConfig = {
|
||||
{
|
||||
sAction = "Skill",
|
||||
sLang = "StarTowerMap_Btn_Skill"
|
||||
},
|
||||
{
|
||||
sAction = "Settings",
|
||||
sLang = "StarTowerMap_Btn_Settings"
|
||||
}
|
||||
}
|
||||
self._mapNode.ActionBar:InitActionBar(tbConfig)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnEnable()
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnDisable()
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:Pause(nActivityId, nLevelId, tbCharId)
|
||||
self.tbChar = tbCharId
|
||||
self.nLevelId = nLevelId
|
||||
self.nActivityId = nActivityId
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
PanelManager.InputDisable()
|
||||
self:PlayInAni()
|
||||
self:Refresh()
|
||||
GamepadUIManager.EnableGamepadUI("ActivityLevelsInstancePauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnEvent_Time(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.txtTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_GiveUp(btn)
|
||||
local sTip = ""
|
||||
local mapCfg = ConfigTable.GetData("ActivityLevelsLevel", self.nLevelId)
|
||||
if mapCfg == nil then
|
||||
printError("没有当前关卡信息")
|
||||
sTip = "Level None"
|
||||
else
|
||||
local sAlert = orderedFormat(ConfigTable.GetUIText("RogueBoss_Pause_GiveUpTips_Simple") or "", mapCfg.Name)
|
||||
sTip = sAlert
|
||||
end
|
||||
local confirmCallback = function()
|
||||
self:PlayCloseAni(true)
|
||||
self._mapNode.imgBlocker:SetActive(true)
|
||||
end
|
||||
local msg = {
|
||||
nType = AllEnum.MessageBox.Confirm,
|
||||
sContent = sTip,
|
||||
callbackConfirm = confirmCallback,
|
||||
bBlur = false
|
||||
}
|
||||
EventManager.Hit(EventId.OpenMessageBox, msg)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Close(btn)
|
||||
self:PlayCloseAni(false)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnBtnClick_Settings(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstancePauseCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "ActivityLevelsInstancePauseCtrl" then
|
||||
return
|
||||
end
|
||||
self._mapNode.ActionBar.gameObject:SetActive(true)
|
||||
end
|
||||
return ActivityLevelsInstancePauseCtrl
|
||||
@@ -0,0 +1,347 @@
|
||||
local ActivityLevelsInstanceResultCtrl = class("ActivityLevelsInstanceResultCtrl", BaseCtrl)
|
||||
local WwiseManger = CS.WwiseAudioManager.Instance
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
ActivityLevelsInstanceResultCtrl._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"
|
||||
},
|
||||
txtClickToContinue = {
|
||||
nCount = 2,
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "Tips_Continue"
|
||||
},
|
||||
imgExpFillBg = {
|
||||
sComponentName = "RectTransform"
|
||||
}
|
||||
}
|
||||
ActivityLevelsInstanceResultCtrl._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 ActivityLevelsInstanceResultCtrl:Awake()
|
||||
self.canvas = self.gameObject:GetComponent("Canvas")
|
||||
EventManager.Hit(EventId.AvgBubbleShutDown)
|
||||
NovaAPI.SetComponentEnable(self.canvas, false)
|
||||
self._mapNode.goGacha.gameObject:SetActive(false)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl: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 starCount = 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 nLevelInstanceId = tbParam[10]
|
||||
local tbChar = tbParam[11]
|
||||
self.mapChangeInfo = tbParam[12]
|
||||
self.tbCharDamage = tbParam[13] or {}
|
||||
for i = 1, 2 do
|
||||
self._mapNode.btnDamageResult[i].gameObject:SetActive(self.tbCharDamage ~= nil and 0 < #self.tbCharDamage)
|
||||
end
|
||||
self.mapLevelsInstance = ConfigTable.GetData("ActivityLevelsLevel", nLevelInstanceId)
|
||||
local sDailyInstanceName = ""
|
||||
if self.mapLevelsInstance ~= nil then
|
||||
sDailyInstanceName = self.mapLevelsInstance.Name
|
||||
end
|
||||
local nStar = starCount
|
||||
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
|
||||
table.insert(self.mapReward, v)
|
||||
end
|
||||
for _, v in ipairs(self._mapNode.txtMainlineName) do
|
||||
NovaAPI.SetTMPText(v, sDailyInstanceName)
|
||||
end
|
||||
self:RefreshWorldClass(nExp)
|
||||
self:RefreshTarget(starCount)
|
||||
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:AddTimer(1, nAnimTime, "PlayAnim", true, true, true)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, nAnimTime)
|
||||
PlayerData.Voice:PlayBattleResultVoice(tbRoleId, nResultState == 1)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:OnDisable()
|
||||
PlayerData.DailyInstance:SetSettlementState(false)
|
||||
PlayerData.Voice:StopCharVoice()
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:PlayAnim()
|
||||
PlayerData.SideBanner:TryOpenSideBanner()
|
||||
local callback = function()
|
||||
self:OpenReward()
|
||||
end
|
||||
self.bOpenUpgrade = PlayerData.Base:TryOpenWorldClassUpgrade(callback)
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl: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, 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 ActivityLevelsInstanceResultCtrl:RefreshTarget(starCount)
|
||||
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.mapLevelsInstance.OneStarDesc)
|
||||
elseif i == 2 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapLevelsInstance.TwoStarDesc)
|
||||
elseif i == 3 then
|
||||
NovaAPI.SetTMPText(txtCondition, self.mapLevelsInstance.ThreeStarDesc)
|
||||
end
|
||||
if nil ~= starPass then
|
||||
starPass.gameObject:SetActive(i <= starCount)
|
||||
end
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl:ClosePanel()
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 0.6)
|
||||
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 ActivityLevelsInstanceResultCtrl: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 ActivityLevelsInstanceResultCtrl:OnBtnClick_Close(btn)
|
||||
if self.bOpenUpgrade then
|
||||
self:ClosePanel()
|
||||
else
|
||||
self:OpenReward()
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceResultCtrl: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 ActivityLevelsInstanceResultCtrl:OnBtnClick_ShowDamageResult()
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleDamage, self.tbCharDamage)
|
||||
end
|
||||
return ActivityLevelsInstanceResultCtrl
|
||||
@@ -0,0 +1,17 @@
|
||||
local ActivityLevelsInstanceResultPanel = class("ActivityLevelsInstanceResultPanel", BasePanel)
|
||||
ActivityLevelsInstanceResultPanel._bAddToBackHistory = false
|
||||
ActivityLevelsInstanceResultPanel._tbDefine = {
|
||||
{
|
||||
sPrefabPath = "BattleResult/BattleResultPanel.prefab",
|
||||
sCtrlName = "Game.UI.ActivityTheme.LevelCommon.ActivityLevelsInstanceResultCtrl"
|
||||
}
|
||||
}
|
||||
function ActivityLevelsInstanceResultPanel:Awake()
|
||||
end
|
||||
function ActivityLevelsInstanceResultPanel:OnEnable()
|
||||
end
|
||||
function ActivityLevelsInstanceResultPanel:OnDisable()
|
||||
end
|
||||
function ActivityLevelsInstanceResultPanel:OnDestroy()
|
||||
end
|
||||
return ActivityLevelsInstanceResultPanel
|
||||
@@ -0,0 +1,175 @@
|
||||
local ActivityLevelsInstanceRoomInfo = class("ActivityLevelsInstanceRoomInfo", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
ActivityLevelsInstanceRoomInfo._mapNodeConfig = {
|
||||
BossChallenge = {
|
||||
sCtrlName = "Game.UI.DailyInstanceRoomInfo.DailyInstanceExp.DailyInstanceExp"
|
||||
},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
rtnfo = {},
|
||||
TMPTitle = {
|
||||
sComponentName = "TMP_Text",
|
||||
sLanguageId = "DailyInstanceExp_SubTitle"
|
||||
},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
btnStar = {sComponentName = "Button", nCount = 3},
|
||||
rtChallengeTime = {},
|
||||
animatorTime = {
|
||||
sNodeName = "rtChallengeTime",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
AnimatorInfo = {sNodeName = "rtnfo", sComponentName = "Animator"},
|
||||
AnimatorRoot = {
|
||||
sNodeName = "BossChallenge",
|
||||
sComponentName = "Animator"
|
||||
}
|
||||
}
|
||||
ActivityLevelsInstanceRoomInfo._mapEventConfig = {
|
||||
OpenActivityLevelsInstanceRoomInfo = "OnEvent_OpenUI",
|
||||
ActivityLevelsInstanceLevelEnd = "OnEvent_CloseUI",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
ActivityLevelsInstanceBattleEnd = "OnEvent_BattleEnd",
|
||||
ActivityLevels_Instance_Gameplay_Time = "OnEvent_SpecialMode_Count"
|
||||
}
|
||||
function ActivityLevelsInstanceRoomInfo:Awake()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:FadeIn()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:FadeOut()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEnable()
|
||||
self.bBattleEnd = false
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnDisable()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnDestroy()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnRelease()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_OpenUI(nLevelId)
|
||||
self._mapNode.BossChallenge.gameObject:SetActive(true)
|
||||
self:StartEvent(1, nLevelId)
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_CloseUI()
|
||||
self:LevelEnd()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_InputEnable(bEnable)
|
||||
if self.bBattleEnd == true then
|
||||
return
|
||||
end
|
||||
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
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_BattleEnd()
|
||||
self.bBattleEnd = true
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:StartEvent(nWaitTime, nLevelId)
|
||||
self.mapLevelCfgData = ConfigTable.GetData("ActivityLevelsLevel", nLevelId)
|
||||
self.tbTime = {
|
||||
self.mapLevelCfgData.ThreeStarCondition[1],
|
||||
self.mapLevelCfgData.TwoStarCondition[1],
|
||||
self.mapLevelCfgData.OneStarCondition[1]
|
||||
}
|
||||
self.totalTime = self.mapLevelCfgData.OneStarCondition[1]
|
||||
self.nState = 1
|
||||
self.bEnd = false
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self:SetTime(self.totalTime)
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
local nStateDesc = 3 - #self.tbTime > 0 and 3 - #self.tbTime or 1
|
||||
if nStateDesc < 3 then
|
||||
local nextStateTime = self.totalTime - self.tbTime[nStateDesc]
|
||||
if 0 < nextStateTime then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, orderedFormat(ConfigTable.GetUIText("DailyInstanceExp_SubTips"), nextStateTime, tostring(4 - nStateDesc)))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.btnStar[i].interactable = true
|
||||
end
|
||||
local waitCallback = function()
|
||||
self._mapNode.rtnfo:SetActive(true)
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
end
|
||||
self:AddTimer(1, nWaitTime, waitCallback, true, true, false)
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:OnEvent_SpecialMode_Count(nTime)
|
||||
if self.tbTime[self.nState] ~= nil then
|
||||
if self.tbTime[self.nState] - nTime <= 5 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
self._mapNode.animatorTime:Play("BossChallengeTime_show")
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
if self.tbTime[self.nState] - nTime == 5 then
|
||||
self._mapNode.AnimatorRoot:Play("BossChallenge_" .. 4 - self.nState)
|
||||
end
|
||||
if nTime >= self.tbTime[self.nState] then
|
||||
self:StageChange()
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
local RemainingT = self.totalTime - nTime
|
||||
if 0 <= RemainingT then
|
||||
self:SetTime(RemainingT)
|
||||
end
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:StageChange()
|
||||
if self.bEnd then
|
||||
return
|
||||
end
|
||||
self.nState = self.nState + 1
|
||||
local failedCallback = function()
|
||||
if self.bEnd then
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
local nStateDesc = 3 - #self.tbTime + self.nState > 0 and 3 - #self.tbTime + self.nState or 1
|
||||
if nStateDesc < 3 then
|
||||
local nextStateTime = self.totalTime - self.tbTime[nStateDesc]
|
||||
if 0 < nextStateTime then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, orderedFormat(ConfigTable.GetUIText("DailyInstanceExp_SubTips"), nextStateTime, tostring(4 - nStateDesc)))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
end
|
||||
for i = 1, 3 do
|
||||
if i <= 4 - nStateDesc then
|
||||
self._mapNode.btnStar[i].interactable = true
|
||||
else
|
||||
self._mapNode.btnStar[i].interactable = false
|
||||
end
|
||||
end
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, ConfigTable.GetUIText("DailyInstanceExp_SubTips_Zero"))
|
||||
self._mapNode.btnStar[1].interactable = true
|
||||
self._mapNode.btnStar[2].interactable = false
|
||||
self._mapNode.btnStar[3].interactable = false
|
||||
end
|
||||
end
|
||||
failedCallback()
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:SetTime(nTime)
|
||||
local nMin = math.floor(nTime / 60)
|
||||
local nSec = math.fmod(nTime, 60)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, string.format("%02d:%02d", nMin, nSec))
|
||||
end
|
||||
function ActivityLevelsInstanceRoomInfo:LevelEnd()
|
||||
self._mapNode.AnimatorInfo:Play("FRRoomInfo_rtnfo_out")
|
||||
local close = function()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.35, close, true, true, true)
|
||||
end
|
||||
return ActivityLevelsInstanceRoomInfo
|
||||
Reference in New Issue
Block a user