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,173 @@
|
||||
local SkillInstanceExp = class("SkillInstanceExp", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
SkillInstanceExp._mapNodeConfig = {
|
||||
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"}
|
||||
}
|
||||
SkillInstanceExp._mapEventConfig = {}
|
||||
local tbDescName = {
|
||||
[1] = "ThreeStarDesc",
|
||||
[2] = "TwoStarDesc",
|
||||
[3] = "OneStarDesc"
|
||||
}
|
||||
function SkillInstanceExp:Awake()
|
||||
self.AnimatorRoot = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function SkillInstanceExp:FadeIn()
|
||||
end
|
||||
function SkillInstanceExp:FadeOut()
|
||||
end
|
||||
function SkillInstanceExp:OnEnable()
|
||||
end
|
||||
function SkillInstanceExp:OnDisable()
|
||||
end
|
||||
function SkillInstanceExp:OnDestroy()
|
||||
EventManager.Remove("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Remove("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
end
|
||||
function SkillInstanceExp:OnRelease()
|
||||
end
|
||||
function SkillInstanceExp: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 SkillInstanceExp:StartEvent(nFloorId, nWaitTime, nLevelId)
|
||||
local mapFloorCfgData = ConfigTable.GetData("SkillInstanceFloor", nFloorId)
|
||||
self.mapLevelCfgData = ConfigTable.GetData("SkillInstance", nLevelId)
|
||||
self.tbTime = {
|
||||
mapFloorCfgData.ThreeStarCondition,
|
||||
mapFloorCfgData.TwoStarCondition,
|
||||
mapFloorCfgData.OneStarCondition
|
||||
}
|
||||
self.totalTime = mapFloorCfgData.LevelTotalTime
|
||||
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)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, self.mapLevelCfgData.ThreeStarDesc)
|
||||
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
|
||||
EventManager.Add("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Add("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
local waitCallback = function()
|
||||
self._mapNode.rtnfo:SetActive(true)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
end
|
||||
self:AddTimer(1, nWaitTime, waitCallback, true, true, false)
|
||||
if nStateDesc < 3 then
|
||||
return orderedFormat(ConfigTable.GetUIText("FRBattleInfo_BossChallenge_Title"), self.tbTime[self.nState], ConfigTable.GetUIText("FRBattleInfo_Box" .. nStateDesc))
|
||||
else
|
||||
return ConfigTable.GetUIText("FRBattleInfo_BossChallenge_Min")
|
||||
end
|
||||
end
|
||||
function SkillInstanceExp: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.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 SkillInstanceExp: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 SkillInstanceExp:Success()
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
self.bEnd = true
|
||||
local playIconCallback = function()
|
||||
end
|
||||
local playWinCallback = function()
|
||||
end
|
||||
local closeWin = function()
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
end
|
||||
self:AddTimer(1, 0.6, playWinCallback, true, true, true)
|
||||
self:AddTimer(1, 2, closeWin, true, true, true)
|
||||
end
|
||||
function SkillInstanceExp:ShowRtChallengeTime()
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
end
|
||||
function SkillInstanceExp:LevelEnd()
|
||||
EventManager.Remove("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Remove("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
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 SkillInstanceExp
|
||||
@@ -0,0 +1,246 @@
|
||||
local SkillInstancePauseCtrl = class("SkillInstancePauseCtrl", BaseCtrl)
|
||||
local GameCameraStackManager = CS.GameCameraStackManager.Instance
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
|
||||
SkillInstancePauseCtrl._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"
|
||||
}
|
||||
}
|
||||
SkillInstancePauseCtrl._mapEventConfig = {
|
||||
Skill_Instance_Gameplay_Time = "OnEvent_Time",
|
||||
OpenSkillInstancePause = "Pause",
|
||||
GamepadUIReopen = "OnEvent_Reopen"
|
||||
}
|
||||
function SkillInstancePauseCtrl:Refresh()
|
||||
local mapCfg = ConfigTable.GetData("SkillInstance", self.nLevelId)
|
||||
if mapCfg == nil then
|
||||
return
|
||||
end
|
||||
local curStar = PlayerData.SkillInstance:GetSkillInstanceStar(self.nLevelId)
|
||||
local tbCond = {}
|
||||
table.insert(tbCond, decodeJson(mapCfg.OneStarCondition))
|
||||
table.insert(tbCond, decodeJson(mapCfg.TwoStarCondition))
|
||||
table.insert(tbCond, decodeJson(mapCfg.ThreeStarCondition))
|
||||
for i = 1, 3 do
|
||||
self._mapNode.imgOn[i]:SetActive(curStar >= i)
|
||||
self._mapNode.imgOff[i]:SetActive(curStar < i)
|
||||
local cond = tbCond[i]
|
||||
if cond == nil then
|
||||
self._mapNode.goAim[i].gameObject:SetActive(false)
|
||||
else
|
||||
self._mapNode.goAim[i].gameObject:SetActive(true)
|
||||
local _floorData = ConfigTable.GetData("SkillInstanceFloor", mapCfg.FloorId)
|
||||
if _floorData then
|
||||
if cond[1] == 1 then
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAim[i], orderedFormat(ConfigTable.GetUIText("SkillInstance_PassConfition_1"), _floorData.LevelTotalTime))
|
||||
else
|
||||
NovaAPI.SetTMPText(self._mapNode.txtAim[i], orderedFormat(ConfigTable.GetUIText("SkillInstance_PassConfition_2"), _floorData.LevelTotalTime - cond[2]))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = 1, 3 do
|
||||
self._mapNode.goChar[i]:SetChar(self.tbChar[i])
|
||||
end
|
||||
end
|
||||
function SkillInstancePauseCtrl: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 SkillInstancePauseCtrl: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 SkillInstancePauseCtrl:OnPanelClose(_, bGiveUp)
|
||||
PanelManager.InputEnable()
|
||||
GamepadUIManager.DisableGamepadUI("SkillInstancePauseCtrl")
|
||||
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 SkillInstancePauseCtrl: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 SkillInstancePauseCtrl:OnEnable()
|
||||
end
|
||||
function SkillInstancePauseCtrl:OnDisable()
|
||||
end
|
||||
function SkillInstancePauseCtrl:OnDestroy()
|
||||
end
|
||||
function SkillInstancePauseCtrl:Pause(nLevelId, tbCharId)
|
||||
self.tbChar = tbCharId
|
||||
self.nLevelId = nLevelId
|
||||
EventManager.Hit(EventId.BattleDashboardVisible, false)
|
||||
PanelManager.InputDisable()
|
||||
self:PlayInAni()
|
||||
self:Refresh()
|
||||
GamepadUIManager.EnableGamepadUI("SkillInstancePauseCtrl", self.tbGamepadUINode)
|
||||
end
|
||||
function SkillInstancePauseCtrl: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 SkillInstancePauseCtrl:OnBtnClick_GiveUp(btn)
|
||||
local sTip = ""
|
||||
local mapCfg = ConfigTable.GetData("SkillInstance", self.nLevelId)
|
||||
if mapCfg == nil then
|
||||
printError("没有当前关卡信息")
|
||||
sTip = "Level None"
|
||||
else
|
||||
local sAlert = orderedFormat(ConfigTable.GetUIText("RogueBoss_Pause_GiveUpTips") or "", mapCfg.Name, mapCfg.Difficulty)
|
||||
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 SkillInstancePauseCtrl:OnBtnClick_Close(btn)
|
||||
self:PlayCloseAni(false)
|
||||
end
|
||||
function SkillInstancePauseCtrl:OnBtnClick_Char(btn, nIndex)
|
||||
end
|
||||
function SkillInstancePauseCtrl:OnBtnClick_Skill(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, self.tbChar)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function SkillInstancePauseCtrl:OnBtnClick_Settings(btn)
|
||||
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
|
||||
self._mapNode.ActionBar.gameObject:SetActive(false)
|
||||
end
|
||||
function SkillInstancePauseCtrl:OnEvent_Reopen(sName)
|
||||
if sName ~= "SkillInstancePauseCtrl" then
|
||||
return
|
||||
end
|
||||
self._mapNode.ActionBar.gameObject:SetActive(true)
|
||||
end
|
||||
return SkillInstancePauseCtrl
|
||||
@@ -0,0 +1,113 @@
|
||||
local SkillInstanceRoomInfoCtrl = class("SkillInstanceRoomInfoCtrl", BaseCtrl)
|
||||
SkillInstanceRoomInfoCtrl._mapNodeConfig = {
|
||||
Shelock = {
|
||||
sCtrlName = "Game.UI.SkillInstanceRoomInfo.SkillInstanceShelock.SkillInstanceShelock"
|
||||
},
|
||||
Slime = {
|
||||
sCtrlName = "Game.UI.SkillInstanceRoomInfo.SkillInstanceSlime.SkillInstanceSlimeCtrl"
|
||||
},
|
||||
BossChallenge = {
|
||||
sCtrlName = "Game.UI.SkillInstanceRoomInfo.SkillInstanceExp.SkillInstanceExp"
|
||||
},
|
||||
rootAnim = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
Title = {},
|
||||
imgTitle = {sComponentName = "Image"},
|
||||
imgTitle1 = {sComponentName = "Image"},
|
||||
TMPSubTitle = {sComponentName = "TMP_Text"},
|
||||
EdgeMask = {},
|
||||
canvasGroup = {
|
||||
sNodeName = "----SafeAreaRoot----",
|
||||
sComponentName = "CanvasGroup"
|
||||
}
|
||||
}
|
||||
SkillInstanceRoomInfoCtrl._mapEventConfig = {
|
||||
OpenSkillInstanceRoomInfo = "OnEvent_OpenUI",
|
||||
SkillInstanceLevelEnd = "OnEvent_CloseUI",
|
||||
InputEnable = "OnEvent_InputEnable",
|
||||
SkillInstanceBattleEnd = "OnEvent_BattleEnd"
|
||||
}
|
||||
function SkillInstanceRoomInfoCtrl:Awake()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:FadeIn()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:FadeOut()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnEnable()
|
||||
self._mapNode.Title:SetActive(false)
|
||||
self._mapNode.EdgeMask:SetActive(false)
|
||||
self._mapNode.Shelock.gameObject:SetActive(false)
|
||||
self._mapNode.Slime.gameObject:SetActive(false)
|
||||
self.bBattleEnd = true
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnDisable()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnDestroy()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnRelease()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnEvent_OpenUI(nFloorId, nLevelId)
|
||||
local mapFloorCfgData = ConfigTable.GetData("SkillInstanceFloor", nFloorId)
|
||||
local mapLevelCfgData = ConfigTable.GetData("SkillInstance", nLevelId)
|
||||
if mapLevelCfgData.Type == 1 then
|
||||
self:SetAtlasSprite(self._mapNode.imgTitle, "05_language", "zs_vestige_title_15")
|
||||
self:SetAtlasSprite(self._mapNode.imgTitle1, "05_language", "zs_vestige_title_15")
|
||||
elseif mapLevelCfgData.Type == 2 then
|
||||
self:SetAtlasSprite(self._mapNode.imgTitle, "05_language", "zs_vestige_title_16")
|
||||
self:SetAtlasSprite(self._mapNode.imgTitle1, "05_language", "zs_vestige_title_16")
|
||||
elseif mapLevelCfgData.Type == 3 then
|
||||
self:SetAtlasSprite(self._mapNode.imgTitle, "05_language", "zs_vestige_title_17")
|
||||
self:SetAtlasSprite(self._mapNode.imgTitle1, "05_language", "zs_vestige_title_17")
|
||||
end
|
||||
if mapFloorCfgData.StarConditionType == 1 then
|
||||
self._mapNode.Shelock.gameObject:SetActive(true)
|
||||
self._mapNode.Shelock:StartEvent(nFloorId, 2, nLevelId)
|
||||
elseif mapFloorCfgData.StarConditionType == 2 then
|
||||
self._mapNode.Slime.gameObject:SetActive(true)
|
||||
self._mapNode.Slime:StartEvent(nFloorId, 2, nLevelId)
|
||||
elseif mapFloorCfgData.StarConditionType == 3 then
|
||||
self._mapNode.BossChallenge.gameObject:SetActive(true)
|
||||
self._mapNode.BossChallenge:StartEvent(nFloorId, 2, nLevelId)
|
||||
end
|
||||
self._mapNode.rootAnim:Play("FRRoomInfo_in")
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPSubTitle, mapLevelCfgData.Desc)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgTitle)
|
||||
NovaAPI.SetImageNativeSize(self._mapNode.imgTitle1)
|
||||
local ShowTitleCallback = function()
|
||||
CS.AdventureModuleHelper.ResumeLogic()
|
||||
self.bBattleEnd = false
|
||||
EventManager.Hit("ShowOrHideBattleDash", true)
|
||||
self._mapNode.Title:SetActive(false)
|
||||
self._mapNode.EdgeMask:SetActive(false)
|
||||
end
|
||||
local wait = function()
|
||||
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
|
||||
self.bBattleEnd = true
|
||||
EventManager.Hit("ShowOrHideBattleDash", false)
|
||||
EventManager.Hit(EventId.TemporaryBlockInput, 2)
|
||||
CS.AdventureModuleHelper.PauseLogic()
|
||||
self._mapNode.Title:SetActive(true)
|
||||
self._mapNode.EdgeMask:SetActive(true)
|
||||
self:AddTimer(1, 2, ShowTitleCallback, true, true, true)
|
||||
end
|
||||
cs_coroutine.start(wait)
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnEvent_CloseUI()
|
||||
self._mapNode.Shelock:LevelEnd()
|
||||
self._mapNode.Slime:LevelEnd()
|
||||
self._mapNode.BossChallenge:LevelEnd()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl: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 SkillInstanceRoomInfoCtrl:OnEvent_BattleEnd()
|
||||
self.bBattleEnd = true
|
||||
end
|
||||
return SkillInstanceRoomInfoCtrl
|
||||
@@ -0,0 +1,104 @@
|
||||
local SkillInstanceRoomInfoCtrl = class("SkillInstanceRoomInfoCtrl", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
SkillInstanceRoomInfoCtrl._mapNodeConfig = {
|
||||
BossHUDPanel = {
|
||||
sNodeName = "BossHUDPanel",
|
||||
sCtrlName = "Game.UI.SkillInstanceRoomInfo.SkillInstanceShelock.SkillInstanceShelockHpBar"
|
||||
},
|
||||
rtnfo = {},
|
||||
TMPTitle = {sComponentName = "TMP_Text"},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
imgBoxIcon = {sComponentName = "Image"},
|
||||
rtChallengeTime = {},
|
||||
imgBoxIconMask = {sComponentName = "Image"}
|
||||
}
|
||||
SkillInstanceRoomInfoCtrl._mapEventConfig = {
|
||||
Equipment_Instance_Gameplay_TypeOne_UniqueID = "OnEvent_OpenHpBar"
|
||||
}
|
||||
local tbIconName = {
|
||||
[3] = "item_90101",
|
||||
[2] = "item_90102",
|
||||
[1] = "item_90103"
|
||||
}
|
||||
function SkillInstanceRoomInfoCtrl:Awake()
|
||||
self.rootAnim = self.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:FadeIn()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:FadeOut()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnEnable()
|
||||
self._mapNode.imgBoxIconMask.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgBoxIcon, "Icon/Item/" .. tbIconName[1])
|
||||
self:SetPngSprite(self._mapNode.imgBoxIconMask, "Icon/Item/" .. tbIconName[1])
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnDisable()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnDestroy()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnRelease()
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnStageChange(nCond)
|
||||
self.rootAnim:Play("DailyShelock_reward")
|
||||
local Wait = function()
|
||||
self._mapNode.imgBoxIconMask.gameObject:SetActive(false)
|
||||
self:SetPngSprite(self._mapNode.imgBoxIcon, "Icon/Item/" .. tbIconName[nCond])
|
||||
end
|
||||
self:AddTimer(1, 1, Wait, true, true, nil, nil)
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:StartEvent(nFloorId, nWaitTime, nLevelId)
|
||||
self.gameObject:SetActive(true)
|
||||
local mapFloorCfgData = ConfigTable.GetData("SkillInstanceFloor", nFloorId)
|
||||
local mapLevelCfgData = ConfigTable.GetData("SkillInstance", nLevelId)
|
||||
self.nBossDataId = mapFloorCfgData.monsterId
|
||||
self.nTotalTime = mapFloorCfgData.LevelTotalTime
|
||||
self._mapNode.BossHUDPanel:SetHpBarGrid(mapFloorCfgData.OneStarCondition, mapFloorCfgData.TwoStarCondition)
|
||||
self.cond1 = mapFloorCfgData.OneStarCondition
|
||||
self.cond2 = mapFloorCfgData.TwoStarCondition
|
||||
self.nState = 1
|
||||
self.bEnd = false
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.imgBoxIcon.gameObject:SetActive(true)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, mapLevelCfgData.ThreeStarDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, "00:00")
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
self._mapNode.BossHUDPanel.gameObject:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
EventManager.Add("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Add("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
local waitCallback = function()
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
self._mapNode.BossHUDPanel.gameObject:SetActive(true)
|
||||
end
|
||||
self:AddTimer(1, nWaitTime, waitCallback, true, true, false)
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl: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 SkillInstanceRoomInfoCtrl:OnEvent_SpecialMode_Count(nTime)
|
||||
if self.nTotalTime - nTime <= 5 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
self:SetTime(self.nTotalTime - nTime)
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:OnEvent_OpenHpBar(nEntityId)
|
||||
self._mapNode.BossHUDPanel:OpenUI(nEntityId, self.nBossDataId, self)
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:ShowRtChallengeTime()
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
end
|
||||
function SkillInstanceRoomInfoCtrl:LevelEnd()
|
||||
self.bEnd = true
|
||||
self.gameObject:SetActive(false)
|
||||
EventManager.Remove("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Remove("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
end
|
||||
return SkillInstanceRoomInfoCtrl
|
||||
@@ -0,0 +1,572 @@
|
||||
local AdventureModuleHelper = CS.AdventureModuleHelper
|
||||
local SkillInstanceShelockHpBar = class("SkillInstanceShelockHpBar", BaseCtrl)
|
||||
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
|
||||
local ConfigData = require("GameCore.Data.ConfigData")
|
||||
local ResType = GameResourceLoader.ResType
|
||||
local MinShowBuff = 8
|
||||
local BarHeight = 21
|
||||
local BarWidth = 640
|
||||
local lineOffset = 9
|
||||
local AniTimeHighlight = 0.5
|
||||
local AniTime = 0.16
|
||||
local ToughnessRecoverTime = 0.3
|
||||
local ToughnessWidth = 680
|
||||
local ToughnessHeight = 21
|
||||
local colorHide = Color(1, 1, 1, 0)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorShieldDelay = Color(1, 1, 1, 0.5)
|
||||
local colorRed = Color(0.9176470588235294, 0.043137254901960784, 0.08627450980392157, 1)
|
||||
local colorRedHide = Color(0.9176470588235294, 0.043137254901960784, 0.08627450980392157, 0)
|
||||
local colorRecover = Color(0.9921568627450981, 0.5098039215686274, 0, 1)
|
||||
SkillInstanceShelockHpBar._mapNodeConfig = {
|
||||
BossCanvas = {sNodeName = "rtHPRoot", sComponentName = "Canvas"},
|
||||
BossCanvasGroup = {
|
||||
sNodeName = "rtHPRoot",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
BuffScrollView = {
|
||||
sComponentName = "LoopScrollView"
|
||||
},
|
||||
cgBuffScrollView = {
|
||||
sNodeName = "BuffScrollView",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
rtHpFillDelay = {
|
||||
sNodeName = "imgHpFillDelay",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtHpFill = {
|
||||
sNodeName = "imgHpFill",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
aniRtHpDelay = {
|
||||
sNodeName = "imgHpFillDelay",
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
ainColorHpDelay = {
|
||||
sNodeName = "imgHpFillDelay",
|
||||
sComponentName = "HpBarColor"
|
||||
},
|
||||
aniRtHpFill = {
|
||||
sNodeName = "imgHpFill",
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
ainColorHpDelayHighlight = {
|
||||
sNodeName = "imgHpDelayHighLight",
|
||||
sComponentName = "HpBarColor"
|
||||
},
|
||||
ainColorHpFillHighLight = {
|
||||
sNodeName = "imgHpHighLight",
|
||||
sComponentName = "HpBarColor"
|
||||
},
|
||||
ainColorHpFillRecoverLight = {
|
||||
sNodeName = "imgHpFillRecoverLight",
|
||||
sComponentName = "HpBarColor"
|
||||
},
|
||||
imgLine = {
|
||||
nCount = 2,
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtShieldDelay = {
|
||||
sNodeName = "imgShieldDelay",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
aniRtShieldDelay = {
|
||||
sNodeName = "imgShieldDelay",
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
imgShieldDelay = {sComponentName = "Image"},
|
||||
ainColorShieldDelay = {
|
||||
sNodeName = "imgShieldDelay",
|
||||
sComponentName = "HpBarColor"
|
||||
},
|
||||
rtShieldFill = {
|
||||
sNodeName = "imgShieldFill",
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
aniRtShieldFill = {
|
||||
sNodeName = "imgShieldFill",
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
imgShieldFillHighLight = {sComponentName = "Image"},
|
||||
ainColorShieldFillHighLight = {
|
||||
sNodeName = "imgShieldFillHighLight",
|
||||
sComponentName = "HpBarColor"
|
||||
},
|
||||
rtToughness = {},
|
||||
rtNormal = {},
|
||||
imgBroken = {},
|
||||
imgToughnessMaskDelay = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
imgToughnessMask = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtHighlight = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
Highlight = {
|
||||
sNodeName = "rtHighlight",
|
||||
sComponentName = "CanvasGroup"
|
||||
},
|
||||
imgBrokenChip = {sComponentName = "Image"},
|
||||
aniRtToughnessDelay = {
|
||||
sNodeName = "imgToughnessMaskDelay",
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
aniRtToughnessFill = {
|
||||
sNodeName = "imgToughnessMask",
|
||||
sComponentName = "HpBarRectTransform"
|
||||
},
|
||||
ainColorToughnessHighlight = {
|
||||
sNodeName = "rtHighlight",
|
||||
sComponentName = "HpBarCanvasGroup"
|
||||
},
|
||||
ainColorToughnessBrokenChip = {
|
||||
sNodeName = "imgBrokenChip",
|
||||
sComponentName = "Animator"
|
||||
},
|
||||
imgLight = {
|
||||
sComponentName = "RectTransform"
|
||||
},
|
||||
rtShakeRoot = {sComponentName = "Animator"},
|
||||
rtBuff = {
|
||||
sCtrlName = "Game.UI.Hud.Buff.BuffCtrl"
|
||||
},
|
||||
DailyShelockblood = {nCount = 3}
|
||||
}
|
||||
SkillInstanceShelockHpBar._mapEventConfig = {
|
||||
AllHudShow = "OnEvent_HudShow"
|
||||
}
|
||||
function SkillInstanceShelockHpBar:InitBuff()
|
||||
self.buffList = nil
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgBuffScrollView, 0)
|
||||
local buffList = AdventureModuleHelper.GetEntityBuffList(self.bossId)
|
||||
if not buffList then
|
||||
self._mapNode.BuffScrollView.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.buffList = {}
|
||||
for i = 0, buffList.Count - 1 do
|
||||
local nBuffId = buffList[i].buffConfig.Id
|
||||
if ConfigTable.GetData_Buff(nBuffId).IsShow then
|
||||
table.insert(self.buffList, {
|
||||
nId = buffList[i].buffConfig.Id,
|
||||
nNum = buffList[i]:GetBuffNum(),
|
||||
nLeftTime = buffList[i]:GetBuffLeftTime():AsFloat()
|
||||
})
|
||||
end
|
||||
end
|
||||
self:RefreshBuff()
|
||||
end
|
||||
function SkillInstanceShelockHpBar:RefreshBuff()
|
||||
local curCount = #self.buffList
|
||||
if 0 < curCount then
|
||||
self._mapNode.BuffScrollView.gameObject:SetActive(true)
|
||||
self._mapNode.BuffScrollView:Init(curCount, self, self.OnGridRefresh)
|
||||
NovaAPI.SetCanvasGroupInteractable(self._mapNode.cgBuffScrollView, curCount > MinShowBuff)
|
||||
else
|
||||
self._mapNode.BuffScrollView.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnGridRefresh(goGrid, gridIndex)
|
||||
local index = gridIndex + 1
|
||||
local imgIcon = goGrid.transform:Find("imgBuffIcon"):GetComponent("Image")
|
||||
local txtCount = goGrid.transform:Find("imgBuffIcon/txtBuffCount"):GetComponent("TMP_Text")
|
||||
local nBuffId = self.buffList[index].nId
|
||||
local config = ConfigTable.GetData_Buff(nBuffId)
|
||||
local nBuffNum = self.buffList[index].nNum
|
||||
local nLeftTime = self.buffList[index].bnLeftTime
|
||||
NovaAPI.SetTMPText(txtCount, nBuffNum)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:PlayTweenHp(hp, hpMax)
|
||||
if self.bInit == true then
|
||||
return
|
||||
end
|
||||
local nWidth = 1 <= hp / hpMax and BarWidth or hp / hpMax * BarWidth
|
||||
if nWidth > BarWidth then
|
||||
nWidth = BarWidth
|
||||
end
|
||||
if hp < self.nBeforeHp then
|
||||
if self._mapNode.rtHpFill.sizeDelta.x > self._mapNode.rtHpFillDelay.sizeDelta.x then
|
||||
self._mapNode.aniRtHpDelay:SetTarget(self._mapNode.rtHpFill.sizeDelta, 0)
|
||||
end
|
||||
self._mapNode.aniRtHpFill:SetTarget(Vector2(nWidth, BarHeight), 0)
|
||||
self._mapNode.ainColorHpFillHighLight:SetTarget(colorWhite, 0)
|
||||
self._mapNode.ainColorHpDelay:SetTarget(colorRed)
|
||||
local delayTime = 0
|
||||
if (self.nBeforeHp - hp) / hpMax > self.bigDamageThreshold then
|
||||
self._mapNode.ainColorHpDelay:SetTarget(colorWhite, 0)
|
||||
self._mapNode.ainColorHpDelay:SetTarget(colorRed, 0.1, AniTime)
|
||||
self._mapNode.rtShakeRoot:Play("HPShake_in")
|
||||
delayTime = 0.5
|
||||
end
|
||||
self._mapNode.aniRtHpDelay:SetTarget(Vector2(nWidth, BarHeight), AniTime, delayTime)
|
||||
self._mapNode.ainColorHpFillHighLight:SetTarget(colorHide, AniTimeHighlight, 0.2 + delayTime)
|
||||
else
|
||||
self._mapNode.aniRtHpDelay:SetTarget(self._mapNode.rtHpFill.sizeDelta, 0)
|
||||
self._mapNode.ainColorHpFillHighLight:SetTarget(colorWhite, 0)
|
||||
self._mapNode.ainColorHpFillHighLight:SetTarget(colorHide, AniTimeHighlight, AniTime)
|
||||
self._mapNode.ainColorHpDelayHighlight:SetTarget(colorWhite, 0)
|
||||
self._mapNode.ainColorHpDelayHighlight:SetTarget(colorHide, AniTimeHighlight)
|
||||
self._mapNode.ainColorHpDelay:SetTarget(colorRecover, 0)
|
||||
self._mapNode.aniRtHpDelay:SetTarget(Vector2(nWidth, BarHeight), AniTime)
|
||||
self._mapNode.aniRtHpFill:SetTarget(Vector2(nWidth, BarHeight), AniTime, AniTime)
|
||||
self._mapNode.ainColorHpFillRecoverLight:SetTarget(colorRed, 0)
|
||||
self._mapNode.ainColorHpFillRecoverLight:SetTarget(colorRedHide, AniTimeHighlight, AniTime)
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:PlayTweenShield(shieldValue, shieldValueMax)
|
||||
local nWidth = 1 <= shieldValue / shieldValueMax and BarWidth or shieldValue / shieldValueMax * BarWidth
|
||||
if shieldValue < self.nBeforeShield then
|
||||
if self._mapNode.rtShieldDelay.sizeDelta.x < self._mapNode.rtShieldFill.sizeDelta.x then
|
||||
self._mapNode.aniRtShieldDelay:SetTarget(self._mapNode.rtShieldFill.sizeDelta, 0)
|
||||
end
|
||||
self._mapNode.aniRtShieldFill:SetTarget(Vector2(nWidth, BarHeight), 0)
|
||||
NovaAPI.SetImageColor(self._mapNode.imgShieldFillHighLight, colorWhite)
|
||||
local delayTime = 0
|
||||
if (self.nBeforeShield - shieldValue) / shieldValueMax > self.bigDamageThreshold then
|
||||
NovaAPI.SetImageColor(self._mapNode.imgShieldDelay, colorWhite)
|
||||
self._mapNode.ainColorShieldDelay:SetTarget(colorShieldDelay, 0.1, AniTime)
|
||||
delayTime = 0.5
|
||||
end
|
||||
self._mapNode.aniRtShieldDelay:SetTarget(Vector2(nWidth, BarHeight), AniTime, delayTime)
|
||||
self._mapNode.ainColorShieldFillHighLight:SetTarget(colorHide, AniTimeHighlight, 0.2 + delayTime)
|
||||
else
|
||||
NovaAPI.SetImageColor(self._mapNode.imgShieldFillHighLight, colorWhite)
|
||||
self._mapNode.ainColorShieldDelay:SetTarget(colorShieldDelay, 0)
|
||||
self._mapNode.aniRtShieldDelay:SetTarget(Vector2(nWidth, BarHeight), AniTime)
|
||||
self._mapNode.aniRtShieldFill:SetTarget(Vector2(nWidth, BarHeight), AniTime)
|
||||
self._mapNode.ainColorShieldFillHighLight:SetTarget(colorHide, AniTimeHighlight, 0.2 + AniTime)
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:KillTweenToughness()
|
||||
self._mapNode.aniRtToughnessDelay:Stop()
|
||||
self._mapNode.aniRtToughnessFill:Stop()
|
||||
self._mapNode.ainColorToughnessHighlight:Stop()
|
||||
end
|
||||
function SkillInstanceShelockHpBar:PlayTweenToughness(toughness, toughnessMax)
|
||||
self:KillTweenToughness()
|
||||
local nWidth = 1 <= toughness / toughnessMax and ToughnessWidth or toughness / toughnessMax * ToughnessWidth
|
||||
if self._mapNode.imgToughnessMaskDelay.sizeDelta.x < self._mapNode.imgToughnessMask.sizeDelta.x then
|
||||
self._mapNode.imgToughnessMaskDelay.sizeDelta = self._mapNode.imgToughnessMask.sizeDelta
|
||||
end
|
||||
self._mapNode.imgToughnessMask.sizeDelta = Vector2(0 < nWidth and nWidth or 0, ToughnessHeight)
|
||||
self._mapNode.rtHighlight.anchoredPosition = Vector2(871 < nWidth and nWidth - 12 or nWidth - 5, 0)
|
||||
self._mapNode.imgLight.anchoredPosition = Vector2(-2, 871 < nWidth and -(nWidth - 871) * 0.75 or 3)
|
||||
local delayTime = 0
|
||||
if (self.nBeforeToughness - toughness) / toughnessMax > self.bigDamageThreshold then
|
||||
delayTime = 0.5
|
||||
self._mapNode.rtShakeRoot:Play("HPShake_in")
|
||||
end
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Highlight, 1)
|
||||
self._mapNode.ainColorToughnessHighlight:SetTarget(0, AniTime, delayTime + AniTime)
|
||||
self._mapNode.aniRtToughnessDelay:SetTarget(Vector2(nWidth, ToughnessHeight), AniTime, delayTime)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:PlayTweenToughnessBroken()
|
||||
self._mapNode.imgToughnessMask.sizeDelta = Vector2(0, ToughnessHeight)
|
||||
self._mapNode.imgToughnessMaskDelay.sizeDelta = Vector2(0, ToughnessHeight)
|
||||
self._mapNode.rtHighlight.anchoredPosition = Vector2(0, 0)
|
||||
self._mapNode.rtNormal:SetActive(false)
|
||||
self._mapNode.imgBroken:SetActive(true)
|
||||
self._mapNode.ainColorToughnessBrokenChip:Play("imgBrokenChip_in")
|
||||
self._mapNode.rtShakeRoot:Play("HPShake_in")
|
||||
end
|
||||
function SkillInstanceShelockHpBar:PlayTweenToughnessRecover()
|
||||
self:KillTweenToughness()
|
||||
self._mapNode.imgToughnessMask.sizeDelta = Vector2(0, ToughnessHeight)
|
||||
self._mapNode.imgToughnessMaskDelay.sizeDelta = Vector2(0, ToughnessHeight)
|
||||
self._mapNode.rtHighlight.anchoredPosition = Vector2(ToughnessWidth - 12, 0)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Highlight, 0)
|
||||
self._mapNode.rtNormal:SetActive(true)
|
||||
self._mapNode.imgBroken:SetActive(false)
|
||||
self.tweenerToughness3 = self._mapNode.aniRtToughnessFill:SetTarget(Vector2(ToughnessWidth, ToughnessHeight), ToughnessRecoverTime)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:ResetHit()
|
||||
self._mapNode.ainColorHpDelay:SetTarget(colorRed, 0)
|
||||
self._mapNode.ainColorHpFillHighLight:SetTarget(colorHide, 0)
|
||||
self._mapNode.ainColorHpDelayHighlight:SetTarget(colorHide, 0)
|
||||
self._mapNode.ainColorShieldFillHighLight:SetTarget(colorHide, 0)
|
||||
self.nBeforeHp = 0
|
||||
self.nBeforeHpMax = 0
|
||||
self.nBeforeShield1 = 0
|
||||
self.nBeforeShield2 = 0
|
||||
self.nBeforeShield3 = 0
|
||||
self.nBeforeShield4 = 0
|
||||
self.nBeforeToughness = 0
|
||||
self._mapNode.rtNormal:SetActive(true)
|
||||
self._mapNode.imgBroken:SetActive(false)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:KillTween()
|
||||
self._mapNode.aniRtHpDelay:Stop()
|
||||
self._mapNode.ainColorHpDelay:Stop()
|
||||
self._mapNode.aniRtHpFill:Stop()
|
||||
self._mapNode.ainColorHpDelayHighlight:Stop()
|
||||
self._mapNode.ainColorHpFillHighLight:Stop()
|
||||
self._mapNode.ainColorHpFillRecoverLight:Stop()
|
||||
self._mapNode.aniRtShieldDelay:Stop()
|
||||
self._mapNode.ainColorShieldDelay:Stop()
|
||||
self._mapNode.aniRtShieldFill:Stop()
|
||||
self._mapNode.ainColorShieldFillHighLight:Stop()
|
||||
self._mapNode.aniRtToughnessDelay:Stop()
|
||||
self._mapNode.aniRtToughnessFill:Stop()
|
||||
self._mapNode.ainColorToughnessHighlight:Stop()
|
||||
end
|
||||
function SkillInstanceShelockHpBar:SetHpBarGrid(nGrid1, nGrid2)
|
||||
self.cond1 = nGrid1 / 100
|
||||
self.cond2 = nGrid2 / 100
|
||||
self._mapNode.imgLine[1].anchoredPosition = Vector2(BarWidth * self.cond1 + lineOffset, 0.3)
|
||||
self._mapNode.imgLine[2].anchoredPosition = Vector2(BarWidth * self.cond2 + lineOffset, 0.3)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:Awake()
|
||||
self.bigDamageThreshold = ConfigTable.GetConfigNumber("BloodSpecialEffectThresholdValue") / 100
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEnable()
|
||||
self.bossId = 0
|
||||
NovaAPI.SetComponentEnable(self._mapNode.BossCanvas, false)
|
||||
self:ResetHit()
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnDisable()
|
||||
self:KillTween()
|
||||
self:ResetHit()
|
||||
self._mapNode.rtBuff:UnbindEntity()
|
||||
EventManager.RemoveEntityEvent("ShieldChanged", self.bossId, self, self.OnEvent_ShieldChanged)
|
||||
EventManager.RemoveEntityEvent("HpChanged", self.bossId, self, self.OnEvent_HpChanged)
|
||||
EventManager.RemoveEntityEvent("Dead", self.bossId, self, self.OnEvent_Deaded)
|
||||
EventManager.RemoveEntityEvent("ClearSlef", self.bossId, self, self.OnEvent_Deaded)
|
||||
EventManager.RemoveEntityEvent("BossBuffChanged", self.bossId, self, self.OnEvent_BuffChanged)
|
||||
EventManager.RemoveEntityEvent("ToughnessStateChanged", self.bossId, self, self.OnEvent_ToughnessStateChanged)
|
||||
EventManager.RemoveEntityEvent("ToughnessValueChanged", self.bossId, self, self.OnEvent_ToughnessValueChanged)
|
||||
EventManager.RemoveEntityEvent("ToughnessShowStateChanged", self.bossId, self, self.OnEvent_ToughnessShowStateChanged)
|
||||
self.bossId = 0
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnDestroy()
|
||||
end
|
||||
function SkillInstanceShelockHpBar:SetHp(hp, hpMax, bChange)
|
||||
if self.bossId == 0 then
|
||||
return
|
||||
end
|
||||
local nBeforePersent = self.nBeforeHp / self.nBeforeHpMax
|
||||
if hpMax <= 0 then
|
||||
self._mapNode.rtHpFillDelay.sizeDelta = Vector2(0, BarHeight)
|
||||
self._mapNode.rtHpFill.sizeDelta = Vector2(0, BarHeight)
|
||||
elseif bChange then
|
||||
self._mapNode.rtHpFillDelay.sizeDelta = Vector2(hp / hpMax * BarWidth, BarHeight)
|
||||
self._mapNode.rtHpFill.sizeDelta = Vector2(hp / hpMax * BarWidth, BarHeight)
|
||||
else
|
||||
self:PlayTweenHp(hp, hpMax)
|
||||
end
|
||||
local curPersent = hp / hpMax
|
||||
if 0 < nBeforePersent and curPersent <= 0 then
|
||||
local goGlow = self._mapNode.DailyShelockblood[3].transform:Find("UIParticle/glow")
|
||||
local goStar = self._mapNode.DailyShelockblood[3].transform:Find("UIParticle/star")
|
||||
GameUIUtils.RestartParticle(goGlow.gameObject)
|
||||
GameUIUtils.RestartParticle(goStar.gameObject)
|
||||
if self.parent ~= nil then
|
||||
self.parent:OnStageChange(3)
|
||||
end
|
||||
elseif nBeforePersent > self.cond2 and curPersent < self.cond2 then
|
||||
local goGlow = self._mapNode.DailyShelockblood[2].transform:Find("UIParticle/glow")
|
||||
local goStar = self._mapNode.DailyShelockblood[2].transform:Find("UIParticle/star")
|
||||
GameUIUtils.RestartParticle(goGlow.gameObject)
|
||||
GameUIUtils.RestartParticle(goStar.gameObject)
|
||||
if self.parent ~= nil then
|
||||
self.parent:OnStageChange(2)
|
||||
end
|
||||
elseif nBeforePersent > self.cond1 and curPersent < self.cond1 then
|
||||
local goGlow = self._mapNode.DailyShelockblood[1].transform:Find("UIParticle/glow")
|
||||
local goStar = self._mapNode.DailyShelockblood[1].transform:Find("UIParticle/star")
|
||||
GameUIUtils.RestartParticle(goGlow.gameObject)
|
||||
GameUIUtils.RestartParticle(goStar.gameObject)
|
||||
if self.parent ~= nil then
|
||||
self.parent:OnStageChange(1)
|
||||
end
|
||||
end
|
||||
self.nBeforeHp = hp
|
||||
self.nBeforeHpMax = hpMax
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_HpChanged(hp, hpMax)
|
||||
if hp == self.nBeforeHp then
|
||||
self:SetHp(hp, hpMax, true)
|
||||
else
|
||||
self:SetHp(hp, hpMax)
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_ToughnessStateChanged(bBroken, nValue, nToughnessMax)
|
||||
if bBroken then
|
||||
self:SetToughness(0, nToughnessMax, true)
|
||||
elseif nValue ~= 0 then
|
||||
self:SetToughness(nToughnessMax, nToughnessMax, true)
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_ToughnessValueChanged(toughness, toughnessMax)
|
||||
self:SetToughness(toughness, toughnessMax, false)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_ToughnessShowStateChanged(bShow)
|
||||
if bShow then
|
||||
self._mapNode.rtToughness.transform.localScale = Vector3.one
|
||||
else
|
||||
self._mapNode.rtToughness.transform.localScale = Vector3.zero
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_Deaded()
|
||||
local wait = function()
|
||||
self:CloseUI()
|
||||
end
|
||||
self:AddTimer(1, 1.6, self, wait, true, true, nil, nil)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OpenUI(bossId, nDataId, parent)
|
||||
self.bossId = bossId
|
||||
self.parent = parent
|
||||
self:ResetHit()
|
||||
self:KillTween()
|
||||
local mapMonster = ConfigTable.GetData("Monster", nDataId)
|
||||
if mapMonster ~= nil then
|
||||
end
|
||||
NovaAPI.SetComponentEnable(self._mapNode.BossCanvas, true)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, 0)
|
||||
self:InitBuff()
|
||||
local hp = AdventureModuleHelper.GetEntityHp(self.bossId)
|
||||
local hpMax = AdventureModuleHelper.GetEntityMaxHp(self.bossId)
|
||||
local toughness = AdventureModuleHelper.GetMonsterToughness(self.bossId)
|
||||
local toughnessMax = AdventureModuleHelper.GetMonsterToughnessMax(self.bossId)
|
||||
self._mapNode.rtToughness.transform.localScale = Vector3.one
|
||||
self:SetHp(hp, hpMax, true)
|
||||
self:SetToughness(toughness, toughnessMax, false, true)
|
||||
local shieldValue, shieldValueMax = AdventureModuleHelper.GetEntityShieldValue(self.bossId)
|
||||
self:SetShield(shieldValue, shieldValueMax, true)
|
||||
self._mapNode.rtBuff:BindEntity(self.bossId)
|
||||
EventManager.AddEntityEvent("ShieldChanged", self.bossId, self, self.OnEvent_ShieldChanged)
|
||||
EventManager.AddEntityEvent("HpChanged", self.bossId, self, self.OnEvent_HpChanged)
|
||||
EventManager.AddEntityEvent("Dead", self.bossId, self, self.OnEvent_Deaded)
|
||||
EventManager.AddEntityEvent("ClearSlef", self.bossId, self, self.OnEvent_Deaded)
|
||||
EventManager.AddEntityEvent("BossBuffChanged", self.bossId, self, self.OnEvent_BuffChanged)
|
||||
EventManager.AddEntityEvent("ToughnessStateChanged", self.bossId, self, self.OnEvent_ToughnessStateChanged)
|
||||
EventManager.AddEntityEvent("ToughnessValueChanged", self.bossId, self, self.OnEvent_ToughnessValueChanged)
|
||||
EventManager.AddEntityEvent("ToughnessShowStateChanged", self.bossId, self, self.OnEvent_ToughnessShowStateChanged)
|
||||
self.bInit = true
|
||||
self.bossHUDAnimTweener = Sequence()
|
||||
self.bossHUDAnimTweener:Append(self._mapNode.BossCanvasGroup:DOFade(1, 0.5))
|
||||
self.bossHUDAnimTweener:Join(self._mapNode.cgBuffScrollView:DOFade(1, 0.5))
|
||||
self.bossHUDAnimTweener:SetUpdate(true)
|
||||
self._mapNode.aniRtHpDelay:SetTarget(Vector2(0, BarHeight), 0)
|
||||
self._mapNode.aniRtHpFill:SetTarget(Vector2(0, BarHeight), 0)
|
||||
self._mapNode.aniRtHpDelay:SetTarget(Vector2(BarWidth, BarHeight), 0.5, 0.5)
|
||||
self._mapNode.aniRtHpFill:SetTarget(Vector2(BarWidth, BarHeight), 0.5, 0.5)
|
||||
local InitCompleteCallback = function()
|
||||
self.bInit = false
|
||||
self:SetHp(self.nBeforeHp, self.nBeforeHpMax)
|
||||
end
|
||||
self:AddTimer(1, 1, InitCompleteCallback, true, true, true)
|
||||
end
|
||||
function SkillInstanceShelockHpBar:SetShield(shieldValue, shieldValueMax, bChange)
|
||||
if self.bossId == 0 then
|
||||
return
|
||||
end
|
||||
if shieldValue <= 0 then
|
||||
self._mapNode.rtShieldFill.sizeDelta = Vector2(0, BarHeight)
|
||||
self._mapNode.rtShieldDelay.sizeDelta = Vector2(0, BarHeight)
|
||||
elseif bChange then
|
||||
self._mapNode.rtShieldFill.sizeDelta = Vector2(shieldValue / shieldValueMax * BarWidth, BarHeight)
|
||||
self._mapNode.rtShieldDelay.sizeDelta = Vector2(shieldValue / shieldValueMax * BarWidth, BarHeight)
|
||||
else
|
||||
self:PlayTweenShield(shieldValue, shieldValueMax)
|
||||
end
|
||||
self.nBeforeShield = shieldValue
|
||||
self.nBeforeShieldMax = shieldValueMax
|
||||
end
|
||||
function SkillInstanceShelockHpBar:SetToughness(toughness, toughnessMax, bState, bChange)
|
||||
if self.bossId == 0 then
|
||||
return
|
||||
end
|
||||
if toughnessMax <= 0 then
|
||||
self._mapNode.rtToughness:SetActive(false)
|
||||
elseif bChange then
|
||||
self._mapNode.imgToughnessMask.sizeDelta = Vector2(toughness / toughnessMax * ToughnessWidth, ToughnessHeight)
|
||||
self._mapNode.imgToughnessMaskDelay.sizeDelta = Vector2(toughness / toughnessMax * ToughnessWidth, ToughnessHeight)
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Highlight, 0)
|
||||
elseif bState then
|
||||
if toughness == 0 then
|
||||
self:PlayTweenToughnessBroken()
|
||||
else
|
||||
self:PlayTweenToughnessRecover()
|
||||
end
|
||||
else
|
||||
self:PlayTweenToughness(toughness, toughnessMax)
|
||||
end
|
||||
self.nBeforeToughness = toughness
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_ShieldChanged(value1, value2)
|
||||
if value1 == self.nBeforeShield then
|
||||
self:SetShield(value1, value2, true)
|
||||
else
|
||||
self:SetShield(value1, value2)
|
||||
end
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_BuffChanged(buffId, bGet)
|
||||
if self.bossId == 0 then
|
||||
return
|
||||
end
|
||||
local buffList = AdventureModuleHelper.GetEntityBuffList(self.bossId)
|
||||
if not buffList then
|
||||
self._mapNode.BuffScrollView.gameObject:SetActive(false)
|
||||
return
|
||||
end
|
||||
self.buffList = {}
|
||||
local bHasBuff = false
|
||||
for i = 0, buffList.Count - 1 do
|
||||
local nBuffId = buffList[i].buffConfig.Id
|
||||
local mapCfg = ConfigTable.GetData_Buff(nBuffId)
|
||||
if nBuffId == buffId then
|
||||
bHasBuff = true
|
||||
if bGet and mapCfg.IsShow then
|
||||
table.insert(self.buffList, {
|
||||
nId = buffList[i].buffConfig.Id,
|
||||
nNum = buffList[i]:GetBuffNum(),
|
||||
nLeftTime = buffList[i]:GetBuffLeftTime():AsFloat()
|
||||
})
|
||||
end
|
||||
elseif mapCfg.IsShow then
|
||||
table.insert(self.buffList, {
|
||||
nId = buffList[i].buffConfig.Id,
|
||||
nNum = buffList[i]:GetBuffNum(),
|
||||
nLeftTime = buffList[i]:GetBuffLeftTime():AsFloat()
|
||||
})
|
||||
end
|
||||
end
|
||||
if bHasBuff == false and bGet then
|
||||
table.insert(self.buffList, {
|
||||
nId = buffId,
|
||||
nNum = 1,
|
||||
nLeftTime = ConfigTable.GetData_Buff(buffId).Time * ConfigData.IntFloatPrecision
|
||||
})
|
||||
end
|
||||
self:RefreshBuff()
|
||||
end
|
||||
function SkillInstanceShelockHpBar:CloseUI()
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, 1)
|
||||
self.bossHUDAnimTweener = Sequence()
|
||||
self.bossHUDAnimTweener:Append(self._mapNode.BossCanvasGroup.DOFade(0, 0.5))
|
||||
self.bossHUDAnimTweener:OnComplete(function()
|
||||
NovaAPI.SetComponentEnable(self._mapNode.BossCanvas, false)
|
||||
end)
|
||||
self.bossHUDAnimTweener:SetUpdate(true)
|
||||
self._mapNode.rtBuff:UnbindEntity()
|
||||
EventManager.RemoveEntityEvent("ShieldChanged", self.bossId, self, self.OnEvent_ShieldChanged)
|
||||
EventManager.RemoveEntityEvent("HpChanged", self.bossId, self, self.OnEvent_HpChanged)
|
||||
EventManager.RemoveEntityEvent("Dead", self.bossId, self, self.OnEvent_Deaded)
|
||||
EventManager.RemoveEntityEvent("ClearSlef", self.bossId, self, self.OnEvent_Deaded)
|
||||
EventManager.RemoveEntityEvent("BossBuffChanged", self.bossId, self, self.OnEvent_BuffChanged)
|
||||
EventManager.RemoveEntityEvent("ToughnessStateChanged", self.bossId, self, self.OnEvent_ToughnessStateChanged)
|
||||
EventManager.RemoveEntityEvent("ToughnessValueChanged", self.bossId, self, self.OnEvent_ToughnessValueChanged)
|
||||
EventManager.RemoveEntityEvent("ToughnessShowStateChanged", self.bossId, self, self.OnEvent_ToughnessShowStateChanged)
|
||||
self.bossId = 0
|
||||
end
|
||||
function SkillInstanceShelockHpBar:OnEvent_HudShow(bShow)
|
||||
if bShow then
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, 1)
|
||||
else
|
||||
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, 1)
|
||||
end
|
||||
end
|
||||
return SkillInstanceShelockHpBar
|
||||
@@ -0,0 +1,150 @@
|
||||
local SkillInstanceSlimeCtrl = class("SkillInstanceSlimeCtrl", BaseCtrl)
|
||||
local colorWhite = Color(1, 1, 1, 1)
|
||||
local colorRed = Color(0.8470588235294118, 0.3137254901960784, 0.32941176470588235)
|
||||
SkillInstanceSlimeCtrl._mapNodeConfig = {
|
||||
rtnfo = {},
|
||||
TMPDesc = {sComponentName = "TMP_Text"},
|
||||
TMPChallengeTime = {sComponentName = "TMP_Text"},
|
||||
imgBoxIcon = {sComponentName = "Image"},
|
||||
imgBoxIconMask = {sComponentName = "Image"},
|
||||
TMPKillCountTarget = {sComponentName = "TMP_Text"},
|
||||
TMPKillCountCur = {sComponentName = "TMP_Text"},
|
||||
TMPKillTitle = {sComponentName = "TMP_Text"},
|
||||
rtKillCount = {},
|
||||
rtChallengeTime = {}
|
||||
}
|
||||
SkillInstanceSlimeCtrl._mapEventConfig = {}
|
||||
local tbIconName = {
|
||||
[3] = "item_90101",
|
||||
[2] = "item_90102",
|
||||
[1] = "item_90103"
|
||||
}
|
||||
function SkillInstanceSlimeCtrl:Awake()
|
||||
self.rootAnim = self.gameObject:GetComponent("Animator")
|
||||
self.rootAnimNumber = self._mapNode.rtKillCount.gameObject:GetComponent("Animator")
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:FadeIn()
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:FadeOut()
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:OnEnable()
|
||||
self._mapNode.imgBoxIconMask.gameObject:SetActive(true)
|
||||
self:SetPngSprite(self._mapNode.imgBoxIcon, "Icon/Item/" .. tbIconName[1])
|
||||
self:SetPngSprite(self._mapNode.imgBoxIconMask, "Icon/Item/" .. tbIconName[1])
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:OnDisable()
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:OnDestroy()
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:OnRelease()
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:SetNumber()
|
||||
if self.nShowCount >= self.nCurCount then
|
||||
return
|
||||
end
|
||||
if self.isNumberPlaying == true then
|
||||
return
|
||||
end
|
||||
self.nShowCount = self.nCurCount
|
||||
local wait = function()
|
||||
self.isNumberPlaying = false
|
||||
if self.nShowCount < self.nCurCount then
|
||||
self:SetNumber()
|
||||
end
|
||||
end
|
||||
self.isNumberPlaying = true
|
||||
if self.nShowCount == self.cond3 then
|
||||
self.rootAnimNumber:Play("rtKillCount_up")
|
||||
else
|
||||
self.rootAnimNumber:Play("rtKillCount_full")
|
||||
end
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillCountCur, self.nShowCount)
|
||||
self:AddTimer(1, 0.27, wait, true, true, nil, nil)
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:StartEvent(nFloorId, nWaitTime, nLevelId)
|
||||
self.gameObject:SetActive(true)
|
||||
local mapFloorCfgData = ConfigTable.GetData("SkillInstanceFloor", nFloorId)
|
||||
local mapLevelCfgData = ConfigTable.GetData("SkillInstance", nLevelId)
|
||||
self.nMonsterId = mapFloorCfgData.monsterId
|
||||
self.nTotalTime = mapFloorCfgData.LevelTotalTime
|
||||
self.cond1 = mapFloorCfgData.OneStarCondition
|
||||
self.cond2 = mapFloorCfgData.TwoStarCondition
|
||||
self.cond3 = mapFloorCfgData.ThreeStarCondition
|
||||
self.bEnd = false
|
||||
self.nCurCount = 0
|
||||
self.nShowCount = 0
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.imgBoxIcon.gameObject:SetActive(true)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(false)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPDesc, mapLevelCfgData.ThreeStarDesc)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillCountTarget, string.format("/%d", self.cond1))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillTitle, orderedFormat(ConfigTable.GetUIText("DailyInstance_Kill_Title"), 1))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillCountCur, self.nCurCount)
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPChallengeTime, "00:00")
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
self._mapNode.rtKillCount:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
EventManager.Add("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Add("ADVENTURE_BATTLE_MONSTER_DIED", self, self.OnEvent_MonsterDied)
|
||||
EventManager.Add("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
local waitCallback = function()
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.TMPDesc.gameObject:SetActive(true)
|
||||
self._mapNode.rtKillCount:SetActive(true)
|
||||
end
|
||||
self:AddTimer(1, nWaitTime, waitCallback, true, true, false)
|
||||
end
|
||||
function SkillInstanceSlimeCtrl: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 SkillInstanceSlimeCtrl:OnEvent_SpecialMode_Count(nTime)
|
||||
if self.nTotalTime - nTime <= 5 then
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorRed)
|
||||
else
|
||||
NovaAPI.SetTMPColor(self._mapNode.TMPChallengeTime, colorWhite)
|
||||
end
|
||||
self:SetTime(self.nTotalTime - nTime)
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:OnEvent_MonsterDied(nMonsterId)
|
||||
if nMonsterId == self.nMonsterId then
|
||||
local Wait = function(_, _, nCond)
|
||||
self._mapNode.imgBoxIconMask.gameObject:SetActive(false)
|
||||
self:SetPngSprite(self._mapNode.imgBoxIcon, "Icon/Item/" .. tbIconName[nCond])
|
||||
end
|
||||
if self.bEnd then
|
||||
return
|
||||
end
|
||||
self.nCurCount = self.nCurCount + 1
|
||||
if self.nCurCount >= self.cond3 then
|
||||
self.bEnd = true
|
||||
self.nCurCount = self.cond3
|
||||
self.rootAnim:Play("DailySlime_reward")
|
||||
self:AddTimer(1, 0.5, Wait, true, true, nil, 3)
|
||||
elseif self.nCurCount == self.cond2 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillCountTarget, string.format("/%d", self.cond3))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillTitle, orderedFormat(ConfigTable.GetUIText("DailyInstance_Kill_Title"), 3))
|
||||
self.rootAnim:Play("DailySlime_reward")
|
||||
self:AddTimer(1, 0.5, Wait, true, true, nil, 2)
|
||||
elseif self.nCurCount == self.cond1 then
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillCountTarget, string.format("/%d", self.cond2))
|
||||
NovaAPI.SetTMPText(self._mapNode.TMPKillTitle, orderedFormat(ConfigTable.GetUIText("DailyInstance_Kill_Title"), 2))
|
||||
self.rootAnim:Play("DailySlime_reward")
|
||||
self:AddTimer(1, 0.5, Wait, true, true, nil, 1)
|
||||
end
|
||||
self:SetNumber()
|
||||
end
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:ShowRtChallengeTime()
|
||||
self._mapNode.rtChallengeTime:SetActive(true)
|
||||
end
|
||||
function SkillInstanceSlimeCtrl:LevelEnd()
|
||||
self._mapNode.rtnfo:SetActive(false)
|
||||
self._mapNode.rtKillCount:SetActive(false)
|
||||
self._mapNode.rtChallengeTime:SetActive(false)
|
||||
EventManager.Remove("Skill_Instance_Gameplay_Time", self, self.OnEvent_SpecialMode_Count)
|
||||
EventManager.Remove("ADVENTURE_BATTLE_MONSTER_DIED", self, self.OnEvent_MonsterDied)
|
||||
EventManager.Remove("OnEvent_ShowRtChallengeTime", self, self.ShowRtChallengeTime)
|
||||
end
|
||||
return SkillInstanceSlimeCtrl
|
||||
Reference in New Issue
Block a user