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:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -0,0 +1,65 @@
local ActivityLevelsBattlePanel = class("ActivityLevelsBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
ActivityLevelsBattlePanel._sUIResRootPath = ""
ActivityLevelsBattlePanel.OpenMinMap = true
ActivityLevelsBattlePanel._bAddToBackHistory = false
ActivityLevelsBattlePanel._tbDefine = {
{
sPrefabPath = "UI/RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "UI/Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "UI/Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "UI/Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "UI/Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "UI/ActivityLevelCommon/ActivityLevelsInstanceInfo.prefab",
sCtrlName = "Game.UI.ActivityTheme.LevelCommon.ActivityLevelsInstanceRoomInfo"
},
{
sPrefabPath = "UI/Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "UI/Battle/CommonBattlePausePanel.prefab",
sCtrlName = "Game.UI.ActivityTheme.LevelCommon.ActivityLevelsInstancePauseCtrl"
},
{
sPrefabPath = "UI/Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function ActivityLevelsBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.ActivityLevels
end
function ActivityLevelsBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function ActivityLevelsBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function ActivityLevelsBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return ActivityLevelsBattlePanel
+141
View File
@@ -0,0 +1,141 @@
local AutoBattleCtrl = class("AutoBattleCtrl", BaseCtrl)
local LocalData = require("GameCore.Data.LocalData")
local AdventureModuleHelper = CS.AdventureModuleHelper
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
AutoBattleCtrl._mapNodeConfig = {
btnAutoBattleOpen = {
sComponentName = "NaviButton",
callback = "OnClick_AutoBattleOpen",
sAction = "AutoBattle"
},
btnAutoBattleClose = {
sComponentName = "NaviButton",
callback = "OnClick_AutoBattleClose",
sAction = "AutoBattle"
},
txtBtnAutoBattleOpen = {
nCount = 4,
sComponentName = "TMP_Text",
sLanguageId = "AutoBattle_Open"
},
txtBtnAutoBattleClose = {
nCount = 4,
sComponentName = "TMP_Text",
sLanguageId = "AutoBattle_Close"
},
TMPSemiBattleHint = {
sComponentName = "TMP_Text",
sLanguageId = "AutoBattle_Hint"
},
rtAutoBattleHint = {}
}
AutoBattleCtrl._mapEventConfig = {
LoadLevelRefresh = "Reset",
InputEnable = "OnEvent_InputEnable",
UpdateAutoCastUltimateSkill = "UpdateAutoCastUltimateSkill",
ShowOrHideBattleDash = "OnEvent_ShowOrHideAutoBattle"
}
function AutoBattleCtrl:Awake()
self.nType = GameEnum.worldLevelType.Mainline
self.bAuto = false
self.animator = self.gameObject:GetComponent("Animator")
self._mapNode.btnAutoBattleOpen.gameObject:SetActive(true)
self._mapNode.btnAutoBattleClose.gameObject:SetActive(false)
self._mapNode.rtAutoBattleHint.gameObject:SetActive(false)
self.animator:Play("AutoBattle_Close")
end
function AutoBattleCtrl:Reset()
local sKey = "PlayerAutoBattleState" .. self.nType
local sData = LocalData.GetPlayerLocalData(sKey)
local nState = tonumber(sData == nil and "0" or sData)
self.bAuto = nState == 1
if self.nType == GameEnum.worldLevelType.Dynamic and self.nSubType == GameEnum.dynamicLevelType.Tutorial then
self.bAuto = false
end
self._mapNode.btnAutoBattleOpen.gameObject:SetActive(not self.bAuto)
self._mapNode.btnAutoBattleClose.gameObject:SetActive(self.bAuto)
self._mapNode.rtAutoBattleHint.gameObject:SetActive(self.bAuto and self.nType ~= GameEnum.worldLevelType.Mainline)
if self.bAuto then
self.animator:Play("AutoBattle_Open")
else
self.animator:Play("AutoBattle_Close")
end
CS.AdventureModuleHelper.SetSemiAutoBattleMode(self.bAuto)
self:UpdateAutoCastUltimateSkill()
if self.nType == GameEnum.worldLevelType.StarTower then
EventManager.Hit("Guide_PassiveCheck_Msg", "Guide_AutoBattleOpen")
end
end
function AutoBattleCtrl:OnEnable()
GamepadUIManager.AddGamepadUINode("BattleMenu", self:GetGamepadUINode())
end
function AutoBattleCtrl:SetBattleType(nType, nSubType)
self.nType = nType
self.nSubType = nSubType
if self.nType == GameEnum.worldLevelType.PrologueBattleLevel then
self.gameObject.transform.localScale = Vector3.zero
elseif self.nType == GameEnum.worldLevelType.Dynamic and self.nSubType == GameEnum.dynamicLevelType.Tutorial then
self.gameObject.transform.localScale = Vector3.zero
end
end
function AutoBattleCtrl:UpdateAutoCastUltimateSkill()
local bAutoUlt = CS.UIGameSystemSetup.Instance.EnableAutoUlt
CS.AdventureModuleHelper.SetAutoCastUltimateSkill(bAutoUlt)
end
function AutoBattleCtrl:OpenUI()
end
function AutoBattleCtrl:CloseUI()
end
function AutoBattleCtrl:OnDisable()
end
function AutoBattleCtrl:OnDestroy()
end
function AutoBattleCtrl:OnClick_AutoBattleOpen()
self.bAuto = true
self._mapNode.btnAutoBattleOpen.gameObject:SetActive(false)
self._mapNode.btnAutoBattleClose.gameObject:SetActive(true)
self._mapNode.rtAutoBattleHint.gameObject:SetActive(self.nType ~= GameEnum.worldLevelType.Mainline)
CS.AdventureModuleHelper.SetSemiAutoBattleMode(true)
local sKey = "PlayerAutoBattleState" .. self.nType
LocalData.SetPlayerLocalData(sKey, 1)
if self.nType == GameEnum.worldLevelType.InfinityTower then
EventManager.Hit("ChangeAutoBattleState", true)
end
self.animator:Play("AutoBattle_Open")
end
function AutoBattleCtrl:OnClick_AutoBattleClose()
self.bAuto = false
self._mapNode.btnAutoBattleClose.gameObject:SetActive(false)
self._mapNode.btnAutoBattleOpen.gameObject:SetActive(true)
self._mapNode.rtAutoBattleHint.gameObject:SetActive(false)
CS.AdventureModuleHelper.SetSemiAutoBattleMode(false)
local sKey = "PlayerAutoBattleState" .. self.nType
LocalData.SetPlayerLocalData(sKey, 0)
if self.nType == GameEnum.worldLevelType.InfinityTower then
EventManager.Hit("ChangeAutoBattleState", false)
end
self.animator:Play("AutoBattle_Close")
end
function AutoBattleCtrl:OnEvent_InputEnable(bEnable)
if self.nType == GameEnum.worldLevelType.PrologueBattleLevel then
self.gameObject.transform.localScale = Vector3.zero
self._mapNode.btnAutoBattleOpen.interactable = false
self._mapNode.btnAutoBattleClose.interactable = false
return
elseif self.nType == GameEnum.worldLevelType.Dynamic and self.nSubType == GameEnum.dynamicLevelType.Tutorial then
self.gameObject.transform.localScale = Vector3.zero
self._mapNode.btnAutoBattleOpen.interactable = false
self._mapNode.btnAutoBattleClose.interactable = false
return
end
self.gameObject.transform.localScale = bEnable and Vector3.one or Vector3.zero
self._mapNode.btnAutoBattleOpen.interactable = bEnable and true or false
self._mapNode.btnAutoBattleClose.interactable = bEnable and true or false
end
function AutoBattleCtrl:OnEvent_ShowOrHideAutoBattle(isShow)
self.gameObject.transform.localScale = isShow and Vector3.one or Vector3.zero
self._mapNode.btnAutoBattleOpen.interactable = isShow and true or false
self._mapNode.btnAutoBattleClose.interactable = isShow and true or false
end
return AutoBattleCtrl
+908
View File
@@ -0,0 +1,908 @@
local BattleDashboardCtrl = class("BattleDashboardCtrl", BaseCtrl)
local PlayerCharData = PlayerData.Char
local AdventureModuleHelper = CS.AdventureModuleHelper
local v3SkillBtnScale = Vector3(0.85, 0.85, 0.85)
local InteractiveManagerIns = CS.InteractiveManager.Instance
local InputManagerIns = CS.InputManager.Instance
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
BattleDashboardCtrl._mapNodeConfig = {
ShowBtn = {sComponentName = "Button"},
cgMainRole = {
sNodeName = "--main_role--",
sComponentName = "CanvasGroup"
},
dodge = {
sNodeName = "btnDodge",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
RUN = {},
skill = {
sNodeName = "btnSkill",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
ultra = {
sNodeName = "btnUltra",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
cgSupRole = {
sNodeName = "--support_role--",
sComponentName = "CanvasGroup"
},
imgBg_SupportRole = {},
supSkill1 = {
sNodeName = "btnSuportSkill1",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
supUltra1 = {
sNodeName = "btnSupportUltra1",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
imgSupRole1 = {
sNodeName = "suportRole1",
sComponentName = "Image"
},
supSkill2 = {
sNodeName = "btnSuportSkill2",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
supUltra2 = {
sNodeName = "btnSupportUltra2",
sCtrlName = "Game.UI.Battle.SkillBtnCtrl"
},
imgSupRole2 = {
sNodeName = "suportRole2",
sComponentName = "Image"
},
btnHand = {
sComponentName = "ButtonEx",
callback = "OnBtn_ClickHand"
},
trHand = {sNodeName = "btnHand", sComponentName = "Transform"},
cgHand = {
sComponentName = "CanvasGroup"
},
imgHandIcon = {sComponentName = "Image"},
tmpInteract = {nCount = 2, sComponentName = "TMP_Text"},
animBtnHand = {sNodeName = "btnHand", sComponentName = "Animator"},
ActionHand = {
sCtrlName = "Game.UI.Battle.SkillActionIconCtrl"
},
trSkillHint = {
sComponentName = "Transform",
sNodeName = "--skill_hint--"
},
trHoldSkill = {sComponentName = "Transform"},
imgSkillIHintcon = {sComponentName = "Image"},
rtSkillHintProgress = {
sComponentName = "RectTransform"
},
trSkillChange = {sComponentName = "Transform"},
goJoystick = {
sNodeName = "--joystick--"
},
rtJoystick = {
sNodeName = "--joystick--",
sComponentName = "RectTransform"
},
cgJoystick = {
sNodeName = "--joystick--",
sComponentName = "CanvasGroup"
},
trAvgBubbleRoot = {
sNodeName = "--AvgBubble--",
sComponentName = "Transform"
},
SupSkill1_Pos = {sComponentName = "Transform"},
SupUltra1_Pos = {sComponentName = "Transform"},
SupRole1_Pos = {sComponentName = "Transform"},
SupSkill2_Pos = {sComponentName = "Transform"},
SupUltra2_Pos = {sComponentName = "Transform"},
SupRole2_Pos = {sComponentName = "Transform"},
MainDodge_Pos = {sComponentName = "Transform"},
MainSkill_Pos = {sComponentName = "Transform"},
MainUltra_Pos = {sComponentName = "Transform"},
SupSkill1_Pos_Hor = {sComponentName = "Transform"},
SupUltra1_Pos_Hor = {sComponentName = "Transform"},
SupRole1_Pos_Hor = {sComponentName = "Transform"},
SupSkill2_Pos_Hor = {sComponentName = "Transform"},
SupUltra2_Pos_Hor = {sComponentName = "Transform"},
SupRole2_Pos_Hor = {sComponentName = "Transform"},
MainDodge_Pos_Hor = {sComponentName = "Transform"},
MainSkill_Pos_Hor = {sComponentName = "Transform"},
MainUltra_Pos_Hor = {sComponentName = "Transform"}
}
BattleDashboardCtrl._mapEventConfig = {
[EventId.BattleDashboardVisible] = "OnEvent_BattleDashboardVisible",
TimeLineFinishBattleDashboardVisible = "OnEvent_BattleDashboardVisible",
ADVENTURE_LEVEL_UNLOAD_COMPLETE = "OnEvent_LevelUnloadComplete",
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
InputEnable = "OnEvent_InputEnable",
AliveChanged = "OnEvent_AliveChanged",
EnableBtnControl = "OnEvent_EnableBtnControl",
interactiveUI = "OnEvent_ShowHand",
InteractiveEnable = "OnEvent_ClickHand",
SkillHintStart = "OnEvent_SkillHintStart",
SkillHintEnd = "OnEvent_SkillHintEnd",
SkillHintActive = "OnEvent_SkillHintActive",
PlayerAdventureActorCastSkill = "OnEvent_UseSkillSucc",
PrologueBattleOpenBattleDash = "OnEvent_PrologueBattleOpenBattleDash",
SkillUnExecutableTips = "OnEvent_SkillUnExecutableTips",
SupUltraState = "OnEvent_SupUltraState",
SupportSkillUnExecutableTips = "OnEvent_SupportSkillUnExecutableTips",
ShowOrHideBattleDash = "OnEvent_ShowOrHideBattleDash",
ButtonStateChange = "OnEvent_BtnStateChange",
CanRush = "OnEvent_CanRush",
SetVariableJoystickMode = "OnEvent_SetVariableJoystickMode",
BattleSettingsBindingOverride = "OnEvent_BattleSettingsBindingOverride",
TestSwitchUI = "OnEvent_SwitchUI",
TestSwitchSkillBtn = "OnEvent_SwitchSkillBtn",
ProloguelEnableBtnControl = "OnEvent_ProloguelEnableBtnControl",
[EventId.MoveAvgBubbleRoot] = "OnEvent_MoveAvgBubbleRoot",
[EventId.SettingsBattleClose] = "OnEvent_ChangeKeyLayout"
}
function BattleDashboardCtrl:Awake()
self.tbDefine_SkillBtn = {
[1] = {
skillBtnCtrl = self._mapNode.dodge,
sName = "Fire1",
nHoldThreshold = 0.1
},
[2] = {
skillBtnCtrl = self._mapNode.skill,
sName = "Fire2",
nHoldThreshold = 0.1
},
[3] = {
skillBtnCtrl = nil,
goBtn = self._mapNode.RUN,
sName = "Fire3",
nHoldThreshold = 0.2
},
[4] = {
skillBtnCtrl = self._mapNode.ultra,
sName = "Fire4",
nHoldThreshold = 0.1
}
}
self.tbDefine_FunctionBtn = {
[1] = {
sName = "Interactive",
nHoldThreshold = 0.1
}
}
self.tbDefine_SupportSkillBtn = {
[1] = {
skillBtnCtrl = self._mapNode.supSkill1,
sName = "ActorSwitch1",
nHoldThreshold = 0.1
},
[2] = {
skillBtnCtrl = self._mapNode.supSkill2,
sName = "ActorSwitch2",
nHoldThreshold = 0.1
}
}
self.tbDefine_SupportUltraBtn = {
[1] = {
skillBtnCtrl = self._mapNode.supUltra1,
sName = "SwitchWithUltra1",
nHoldThreshold = 0.1,
nPressThreshold = 0.3
},
[2] = {
skillBtnCtrl = self._mapNode.supUltra2,
sName = "SwitchWithUltra2",
nHoldThreshold = 0.1,
nPressThreshold = 0.3
}
}
self.nCurPlayerId = nil
self.nCurCharId = nil
self.v2SkillHintStart = Vector2(0, 19)
self.v2SkillHintEnd = Vector2(352, 19)
if NovaAPI.IsMobilePlatform() or NovaAPI.IsEditorPlatform() then
self._mapNode.goJoystick:SetActive(true)
NovaAPI.RegisterVirtualJoystick("Horizontal", "Vertical", self._mapNode.goJoystick)
else
self._mapNode.goJoystick:SetActive(false)
end
local nW = math.floor(Settings.CURRENT_CANVAS_FULL_RECT_WIDTH)
local nH = math.floor(Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT)
self._mapNode.rtJoystick.sizeDelta = Vector2(nW / 2, nH * 2 / 3)
for i, v in ipairs(self.tbDefine_SkillBtn) do
NovaAPI.RegisterRealButton(v.sName, v.nHoldThreshold)
local go = v.skillBtnCtrl ~= nil and v.skillBtnCtrl.gameObject or v.goBtn
NovaAPI.RegisterVirtualButton(v.sName, go)
NovaAPI.SetButtonExHoldThreshold(go, v.nHoldThreshold)
end
for nIndex, v in ipairs(self.tbDefine_FunctionBtn) do
NovaAPI.RegisterRealButton(v.sName, v.nHoldThreshold)
end
for nIndex, v in ipairs(self.tbDefine_SupportSkillBtn) do
NovaAPI.RegisterVirtualButton(v.sName, v.skillBtnCtrl.gameObject)
NovaAPI.RegisterRealButton(v.sName, v.nHoldThreshold)
end
for nIndex, v in ipairs(self.tbDefine_SupportUltraBtn) do
NovaAPI.RegisterVirtualButton(v.sName, v.skillBtnCtrl.gameObject)
NovaAPI.RegisterRealAxisButton(v.sName, v.nHoldThreshold, v.nPressThreshold)
end
self:SetKeyLayout()
self:SetAllVisible(false, false)
self:SetHandVisible(false)
self:SetActionBind()
self.skillTipTime = 0
self.dodgeTipTime = 0
self.supportSkillTimeTab = {}
self.bInteractiveInCD = false
end
function BattleDashboardCtrl:OnEnable()
self:Refresh(AdventureModuleHelper.GetCurrentActivePlayer())
self._mapNode.ShowBtn.gameObject:SetActive(false)
EventManager.Hit("ShowSettingsG", self._mapNode.ShowBtn)
end
function BattleDashboardCtrl:OnPreExit()
if self.nCurPlayerId ~= nil then
self:Remove_Skill_EntityEvent(self.nCurPlayerId)
self.nCurPlayerId = nil
end
for i, v in ipairs(self.tbDefine_SupportSkillBtn) do
if v.nPlayerId ~= nil then
self:Remove_Skill_EntityEvent(v.nPlayerId)
v.nPlayerId = nil
end
end
end
function BattleDashboardCtrl:OnDestroy()
NovaAPI.DispatchEventWithData("BlockTouchEffect", nil, {false})
NovaAPI.UnRegisterVirtualJoystick("Horizontal", "Vertical")
for nIndex, v in ipairs(self.tbDefine_SkillBtn) do
NovaAPI.UnRegisterRealButton(v.sName)
NovaAPI.UnRegisterVirtualButton(v.sName)
end
self.tbDefine_SkillBtn = nil
for nIndex, v in ipairs(self.tbDefine_FunctionBtn) do
NovaAPI.UnRegisterRealButton(v.sName)
end
self.tbDefine_FunctionBtn = nil
for nIndex, v in ipairs(self.tbDefine_SupportSkillBtn) do
NovaAPI.UnRegisterVirtualButton(v.sName)
NovaAPI.UnRegisterRealButton(v.sName)
end
self.tbDefine_SupportSkillBtn = nil
for nIndex, v in ipairs(self.tbDefine_SupportUltraBtn) do
NovaAPI.UnRegisterVirtualButton(v.sName)
NovaAPI.UnRegisterRealAxisButton(v.sName)
end
self.tbDefine_SupportUltraBtn = nil
end
function BattleDashboardCtrl:SetKeyLayout()
local nType = LocalSettingData.GetLocalSettingData("BattleHUD")
if nType == AllEnum.BattleHudType.Horizontal then
self:SetKeyPos(self._mapNode.supSkill1.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill1_Pos_Hor)
self:SetKeyPos(self._mapNode.supUltra1.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra1_Pos_Hor)
self:SetKeyPos(self._mapNode.imgSupRole1.gameObject:GetComponent("RectTransform"), self._mapNode.SupRole1_Pos_Hor)
self:SetKeyPos(self._mapNode.supSkill2.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill2_Pos_Hor)
self:SetKeyPos(self._mapNode.supUltra2.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra2_Pos_Hor)
self:SetKeyPos(self._mapNode.imgSupRole2.gameObject:GetComponent("RectTransform"), self._mapNode.SupRole2_Pos_Hor)
self:SetKeyPos(self._mapNode.dodge.gameObject:GetComponent("RectTransform"), self._mapNode.MainDodge_Pos_Hor)
self:SetKeyPos(self._mapNode.skill.gameObject:GetComponent("RectTransform"), self._mapNode.MainSkill_Pos_Hor)
self:SetKeyPos(self._mapNode.ultra.gameObject:GetComponent("RectTransform"), self._mapNode.MainUltra_Pos_Hor)
local runTra = self._mapNode.RUN.gameObject:GetComponent("RectTransform")
runTra:SetParent(self._mapNode.MainDodge_Pos_Hor)
runTra.anchoredPosition = Vector2.zero
else
self:SetKeyPos(self._mapNode.supSkill1.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill1_Pos)
self:SetKeyPos(self._mapNode.supUltra1.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra1_Pos)
self:SetKeyPos(self._mapNode.imgSupRole1.gameObject:GetComponent("RectTransform"), self._mapNode.SupRole1_Pos)
self:SetKeyPos(self._mapNode.supSkill2.gameObject:GetComponent("RectTransform"), self._mapNode.SupSkill2_Pos)
self:SetKeyPos(self._mapNode.supUltra2.gameObject:GetComponent("RectTransform"), self._mapNode.SupUltra2_Pos)
self:SetKeyPos(self._mapNode.imgSupRole2.gameObject:GetComponent("RectTransform"), self._mapNode.SupRole2_Pos)
self:SetKeyPos(self._mapNode.dodge.gameObject:GetComponent("RectTransform"), self._mapNode.MainDodge_Pos)
self:SetKeyPos(self._mapNode.skill.gameObject:GetComponent("RectTransform"), self._mapNode.MainSkill_Pos)
self:SetKeyPos(self._mapNode.ultra.gameObject:GetComponent("RectTransform"), self._mapNode.MainUltra_Pos)
local runTra = self._mapNode.RUN.gameObject:GetComponent("RectTransform")
runTra:SetParent(self._mapNode.MainDodge_Pos)
runTra.anchoredPosition = Vector2.zero
end
self._mapNode.supSkill1:SetCDTextSize()
self._mapNode.supUltra1:SetCDTextSize()
self._mapNode.supSkill2:SetCDTextSize()
self._mapNode.supUltra2:SetCDTextSize()
self._mapNode.dodge:SetCDTextSize()
self._mapNode.skill:SetCDTextSize()
self._mapNode.ultra:SetCDTextSize()
self._mapNode.imgBg_SupportRole:SetActive(nType == AllEnum.BattleHudType.Sector)
end
function BattleDashboardCtrl:SetKeyPos(btnTra, parentTra)
btnTra:SetParent(parentTra)
btnTra.anchoredPosition = Vector2.zero
btnTra.localScale = Vector3.one
end
function BattleDashboardCtrl:SetAllVisible(bVisible, bInteractable)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgJoystick, bVisible == true and 0.3 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.cgJoystick, bInteractable == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgJoystick, bInteractable == true)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgMainRole, bVisible == true and 1 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.cgMainRole, bVisible == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgMainRole, bVisible == true)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgSupRole, bVisible == true and 1 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.cgSupRole, bVisible == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgSupRole, bVisible == true)
end
function BattleDashboardCtrl:SetHandVisible(bVisible)
if self._mapNode.trHand.localScale.x == 0 and bVisible == true then
self._mapNode.animBtnHand:SetTrigger("tPlay")
end
self._mapNode.trHand.localScale = bVisible == true and Vector3.one or Vector3.zero
end
function BattleDashboardCtrl:SetHandEnable(bEnable)
self._mapNode.btnHand.interactable = bEnable == true
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgHand, bEnable == true and 1 or 0.3)
end
function BattleDashboardCtrl:OnEvent_BattleDashboardVisible(bVisible)
if bVisible then
local bEnable = NovaAPI.IsInputEnabled()
self:SetAllVisible(bEnable, bEnable)
else
self:SetAllVisible(false, false)
end
end
function BattleDashboardCtrl:OnEvent_LevelUnloadComplete()
end
function BattleDashboardCtrl:OnEvent_LoadLevelRefresh()
self:Refresh(AdventureModuleHelper.GetCurrentActivePlayer())
end
function BattleDashboardCtrl:OnEvent_InputEnable(bEnable)
NovaAPI.DispatchEventWithData("BlockTouchEffect", nil, {bEnable})
self:SetAllVisible(bEnable == true, true)
NovaAPI.SetRealButtonActive("Fire1", bEnable and self.tbDefine_SkillBtn[1].skillBtnCtrl:GetBtnVisible())
local fire2Btn = self.tbDefine_SkillBtn[2].skillBtnCtrl
NovaAPI.SetRealButtonActive("Fire2", bEnable and fire2Btn:GetBtnVisible() and fire2Btn.canFresh)
NovaAPI.SetRealButtonActive("Fire4", bEnable and self.tbDefine_SkillBtn[4].skillBtnCtrl:GetBtnVisible())
NovaAPI.SetRealButtonActive("Interactive", bEnable)
NovaAPI.SetRealButtonActive("ActorSwitch1", bEnable and self.tbDefine_SupportSkillBtn[1].skillBtnCtrl:GetBtnVisible())
NovaAPI.SetRealButtonActive("ActorSwitch2", bEnable and self.tbDefine_SupportSkillBtn[2].skillBtnCtrl:GetBtnVisible())
NovaAPI.SetRealButtonActive("SwitchWithUltra1", bEnable and self.tbDefine_SupportUltraBtn[1].skillBtnCtrl:GetBtnVisible())
NovaAPI.SetRealButtonActive("SwitchWithUltra2", bEnable and self.tbDefine_SupportUltraBtn[2].skillBtnCtrl:GetBtnVisible())
self._mapNode.trSkillHint.localScale = bEnable == true and Vector3.one or Vector3.zero
end
function BattleDashboardCtrl:OnEvent_AliveChanged(nPlayerId, bAlive)
end
function BattleDashboardCtrl:OnEvent_EnableBtnControl(sBtnNames, bEnable)
local tbName = string.split(sBtnNames, "+")
if tbName ~= nil then
for i, sName in pairs(tbName) do
if type(sName) == "string" and sName ~= "" then
if sName == "Fire1" then
self.tbDefine_SkillBtn[1].skillBtnCtrl:SetBtnVisible(bEnable)
elseif sName == "Fire2" then
self.tbDefine_SkillBtn[2].skillBtnCtrl:SetBtnVisible(bEnable)
elseif sName == "Fire4" then
self.tbDefine_SkillBtn[4].skillBtnCtrl:SetBtnVisible(bEnable)
elseif sName == "Interactive" then
self:SetHandEnable(bEnable)
elseif sName == "ActorSwitch1" then
self.tbDefine_SupportSkillBtn[1].skillBtnCtrl:SetBtnVisible(bEnable)
self._mapNode.imgSupRole1.gameObject:SetActive(bEnable)
local nType = LocalSettingData.GetLocalSettingData("BattleHUD")
self._mapNode.imgBg_SupportRole:SetActive(bEnable and nType == AllEnum.BattleHudType.Sector)
elseif sName == "ActorSwitch2" then
self.tbDefine_SupportSkillBtn[2].skillBtnCtrl:SetBtnVisible(bEnable)
self._mapNode.imgSupRole2.gameObject:SetActive(bEnable)
elseif sName == "SwitchWithUltra1" then
self.tbDefine_SupportUltraBtn[1].skillBtnCtrl:SetBtnVisible(bEnable)
elseif sName == "SwitchWithUltra2" then
self.tbDefine_SupportUltraBtn[2].skillBtnCtrl:SetBtnVisible(bEnable)
end
NovaAPI.SetRealButtonActive(sName, bEnable)
end
end
end
end
function BattleDashboardCtrl:OnEvent_ShowHand(nInteractiveId, bShowUI, sIcon, sText, nDuration)
if bShowUI ~= true and self.nInteractiveId ~= nInteractiveId then
return
end
printLog("交互id" .. tostring(nInteractiveId))
self.nInteractiveId = nInteractiveId
self.bShowUI = bShowUI
self:SetHandVisible(self.bShowUI)
self:SetHandEnable(self.bInteractiveInCD ~= true and bShowUI == true)
NovaAPI.SetTMPText(self._mapNode.tmpInteract[1], sText)
NovaAPI.SetTMPText(self._mapNode.tmpInteract[2], sText)
if type(sIcon) == "string" and sIcon ~= "" then
self:SetPngSprite(self._mapNode.imgHandIcon, sIcon)
NovaAPI.SetImageNativeSize(self._mapNode.imgHandIcon)
end
end
function BattleDashboardCtrl:OnEvent_ClickHand()
self:OnBtn_ClickHand()
end
function BattleDashboardCtrl:OnEvent_SkillHintStart(nSkillId, nMax, bReverse, nRemain)
if self.nHoldSkillId == nil or self.nHoldSkillId ~= nSkillId then
if self.tweenerHoldSkill ~= nil then
self.tweenerHoldSkill:Kill()
self.tweenerHoldSkill = nil
end
self.nHoldSkillId = nSkillId
local mapCfgData_Skill = ConfigTable.GetData_Skill(nSkillId)
if mapCfgData_Skill ~= nil then
self:SetPngSprite(self._mapNode.imgSkillIHintcon, mapCfgData_Skill.Icon)
else
NovaAPI.SetImageSpriteAsset(self._mapNode.imgSkillIHintcon, nil)
end
local v2Start, v2End = self.v2SkillHintStart, self.v2SkillHintEnd
if bReverse == true then
v2Start, v2End = self.v2SkillHintEnd, self.v2SkillHintStart
end
if nMax == nil then
nMax = 1
end
if nMax <= 0 then
nMax = 1
end
if nRemain ~= nil and 0 <= nRemain and nRemain <= nMax then
local nCur = nMax - nRemain
if bReverse == true then
local nPercent = 1 - nCur / nMax
v2Start = Vector2(v2Start.x * nPercent, v2Start.y)
else
local nPercent = nCur / nMax
v2Start = Vector2(v2End.x * nPercent, v2End.y)
end
end
self._mapNode.rtSkillHintProgress.sizeDelta = v2Start
self._mapNode.trHoldSkill.localScale = Vector3.one
self.tweenerHoldSkill = self._mapNode.rtSkillHintProgress:DOSizeDelta(v2End, nMax):SetEase(Ease.Linear)
self.tweenerHoldSkill:SetUpdate(CS.DG.Tweening.UpdateType.Manual)
end
end
function BattleDashboardCtrl:OnEvent_SkillHintEnd(nSkillId)
if self.tweenerHoldSkill ~= nil then
self.tweenerHoldSkill:Kill()
self.tweenerHoldSkill = nil
end
self.nHoldSkillId = nil
self._mapNode.rtSkillHintProgress.sizeDelta = self.v2SkillHintStart
self._mapNode.trHoldSkill.localScale = Vector3.zero
end
function BattleDashboardCtrl:OnEvent_SkillHintActive(nSkillId, bActive)
for i, v in ipairs(self.tbDefine_SkillBtn) do
if v.nSkillId == nSkillId and v.skillBtnCtrl ~= nil then
v.skillBtnCtrl:Set_SkillHintActive(bActive)
end
end
end
function BattleDashboardCtrl:OnEvent_UseSkillSucc(nCharId, nSkillId)
for i, v in ipairs(self.tbDefine_SkillBtn) do
if v.nCharId == nCharId and v.nSkillId == nSkillId and v.skillBtnCtrl ~= nil then
v.skillBtnCtrl:SetMainAlpha(false)
end
end
for i, v in ipairs(self.tbDefine_SupportSkillBtn) do
if v.nSkillId == nSkillId and v.skillBtnCtrl ~= nil then
v.skillBtnCtrl:SetMainAlpha(false)
end
end
for i, v in ipairs(self.tbDefine_SupportUltraBtn) do
if v.nSkillId == nSkillId and v.skillBtnCtrl ~= nil then
v.skillBtnCtrl:SetMainAlpha(false)
end
end
end
function BattleDashboardCtrl:OnEvent_EnableTeamUltra(b)
end
function BattleDashboardCtrl:OnEvent_PrologueBattleOpenBattleDash(bEnable)
self:SetAllVisible(bEnable, bEnable)
end
function BattleDashboardCtrl:Refresh(nCurPlayerId)
if nCurPlayerId == nil or nCurPlayerId <= 0 or nCurPlayerId == self.nCurPlayerId then
self:SetAllVisible(false)
return
end
if self.nCurPlayerId ~= nil then
self:Remove_Skill_EntityEvent(self.nCurPlayerId)
end
self.nCurPlayerId = nCurPlayerId
self.nCurCharId = AdventureModuleHelper.GetCharacterId(self.nCurPlayerId)
for i, v in ipairs(self.tbDefine_SkillBtn) do
if v.skillBtnCtrl ~= nil then
v.nPlayerId = self.nCurPlayerId
v.nCharId = self.nCurCharId
v.nSkillId = AdventureModuleHelper.GetCurrentActorBindSkillId(self.nCurPlayerId, i)
local EET = 0
if i == 2 or i == 4 then
EET = ConfigTable.GetData_Character(self.nCurCharId).EET
end
local skilldata = ConfigTable.GetData_Skill(v.nSkillId)
if skilldata ~= nil then
v.skillBtnCtrl:InitSkillBtn(EET, skilldata.Icon, skilldata.SectionAmount > 1, self.nCurCharId, i)
end
end
end
self:Add_Skill_EntityEvent(self.nCurPlayerId)
AdventureModuleHelper.ForceSyncSkillBtnToLua(self.nCurPlayerId)
for i = 1, 2 do
local bSuccess, nSupportCharId, nSupportPlayerId, nSkillId, skilldata = false, 0, 0, 0
if i == 1 then
bSuccess, nSupportCharId, nSupportPlayerId = AdventureModuleHelper.GetFirstSlotPlayer()
elseif i == 2 then
bSuccess, nSupportCharId, nSupportPlayerId = AdventureModuleHelper.GetSecondSlotPlayer()
end
if self.tbDefine_SupportSkillBtn[i].nPlayerId ~= nil then
self:Remove_Skill_EntityEvent(self.tbDefine_SupportSkillBtn[i].nPlayerId)
end
if nSupportCharId ~= 0 and nSupportPlayerId ~= 0 then
self.tbDefine_SupportSkillBtn[i].nPlayerId = nSupportPlayerId
self.tbDefine_SupportSkillBtn[i].nCharId = nSupportCharId
self.tbDefine_SupportUltraBtn[i].nPlayerId = nSupportPlayerId
self.tbDefine_SupportUltraBtn[i].nCharId = nSupportCharId
self.supportSkillTimeTab[nSupportCharId] = 0
local supportCharEET = ConfigTable.GetData_Character(nSupportCharId).EET
nSkillId = AdventureModuleHelper.GetCurrentActorBindSkillId(nSupportPlayerId, 2)
skilldata = ConfigTable.GetData_Skill(nSkillId)
if skilldata ~= nil then
self.tbDefine_SupportSkillBtn[i].nSkillId = nSkillId
self.tbDefine_SupportSkillBtn[i].skillBtnCtrl:InitSkillBtn(supportCharEET, skilldata.Icon, skilldata.SectionAmount > 1, nSupportCharId, 2, true)
else
printError("Skill 表中,该技能 id 未找到:" .. tostring(nSkillId))
end
nSkillId = AdventureModuleHelper.GetCurrentActorBindSkillId(nSupportPlayerId, 4)
skilldata = ConfigTable.GetData_Skill(nSkillId)
if skilldata ~= nil then
self.tbDefine_SupportUltraBtn[i].nSkillId = nSkillId
self.tbDefine_SupportUltraBtn[i].skillBtnCtrl:InitSkillBtn(supportCharEET, skilldata.Icon, skilldata.SectionAmount > 1, nSupportCharId, 4, true)
else
printError("Skill 表中,该技能 id 未找到:" .. tostring(nSkillId))
end
local nSkinId = PlayerCharData:GetCharSkinId(nSupportCharId)
local mapCfgData_Skin = ConfigTable.GetData_CharacterSkin(nSkinId)
local spHead = mapCfgData_Skin ~= nil and self:GetPngSprite(mapCfgData_Skin.Icon .. AllEnum.CharHeadIconSurfix.L) or nil
local img
if i == 1 then
img = self._mapNode.imgSupRole1
elseif i == 2 then
img = self._mapNode.imgSupRole2
end
NovaAPI.SetImageSpriteAsset(img, spHead)
NovaAPI.SetImageNativeSize(img)
NovaAPI.SetImageColor(img, Color(1, 1, 1, 1))
self:Add_Skill_EntityEvent(nSupportPlayerId)
AdventureModuleHelper.ForceSyncSkillBtnToLua(nSupportPlayerId)
else
self.tbDefine_SupportSkillBtn[i].skillBtnCtrl:SetEmptySkillBtn()
self.tbDefine_SupportUltraBtn[i].skillBtnCtrl:SetEmptySkillBtn()
NovaAPI.SetImageColor(self._mapNode["imgSupRole" .. i], Color(0, 0, 0, 0))
end
end
end
function BattleDashboardCtrl:Add_Skill_EntityEvent(nPlayerId)
EventManager.AddEntityEvent("SkillBind", nPlayerId, self, self.OnEvent_SkillBind)
EventManager.AddEntityEvent("SyncSkillBtnToLua", nPlayerId, self, self.OnEvent_SyncSkillBtnToLua)
EventManager.AddEntityEvent("SkillEnableByActionKey", nPlayerId, self, self.OnEvent_SkillEnableByActionKey)
end
function BattleDashboardCtrl:Remove_Skill_EntityEvent(nPlayerId)
EventManager.RemoveEntityEvent("SkillBind", nPlayerId, self, self.OnEvent_SkillBind)
EventManager.RemoveEntityEvent("SyncSkillBtnToLua", nPlayerId, self, self.OnEvent_SyncSkillBtnToLua)
EventManager.RemoveEntityEvent("SkillUseableByActionKey", nPlayerId, self, self.OnEvent_SkillUseableByActionKey)
end
function BattleDashboardCtrl:OnEvent_SkillBind(nActionId, nSkillId, nCharId)
local data
if self.tbDefine_SkillBtn[nActionId] ~= nil and self.tbDefine_SkillBtn[nActionId].nCharId == nCharId then
data = self.tbDefine_SkillBtn[nActionId]
end
if data == nil and nActionId == 2 then
for i, v in ipairs(self.tbDefine_SupportSkillBtn) do
if v.nCharId == nCharId then
data = v
break
end
end
end
if data == nil and nActionId == 4 then
for i, v in ipairs(self.tbDefine_SupportUltraBtn) do
if v.nCharId == nCharId then
data = v
break
end
end
end
if data == nil then
return
end
data.nSkillId = nSkillId
local EET = 0
if nActionId == 2 or nActionId == 4 then
EET = ConfigTable.GetData_Character(nCharId).EET
end
local skilldata = ConfigTable.GetData_Skill(nSkillId)
if skilldata ~= nil then
data.skillBtnCtrl:InitSkillBtn(EET, skilldata.Icon, skilldata.SectionAmount > 1, nCharId, nActionId)
end
end
function BattleDashboardCtrl:OnEvent_SyncSkillBtnToLua(arrayData, bLocking, bBeginResume, bCanUseAssitSkill)
local nSkillId = arrayData[0]
local skillBtnCtrl
local bIsUltra = false
local bIsAssitSkill = false
for i, v in ipairs(self.tbDefine_SkillBtn) do
if v.nSkillId == nSkillId then
skillBtnCtrl = v.skillBtnCtrl
bIsUltra = i == 4
break
end
end
if skillBtnCtrl == nil then
for i, v in ipairs(self.tbDefine_SupportSkillBtn) do
if v.nSkillId == nSkillId then
skillBtnCtrl = v.skillBtnCtrl
bIsAssitSkill = true
break
end
end
end
if skillBtnCtrl == nil then
bIsUltra = true
for i, v in ipairs(self.tbDefine_SupportUltraBtn) do
if v.nSkillId == nSkillId then
skillBtnCtrl = v.skillBtnCtrl
break
end
end
end
if skillBtnCtrl ~= nil then
local nIntervalPercent = arrayData[1]
local nSectionPercent = arrayData[2]
local nUseTimeHintPercent = arrayData[3]
local nEnergyPercent = arrayData[4]
local nInterval = arrayData[5]
local nSectionResume = arrayData[6]
local nSectionNum = math.floor(arrayData[7])
local nTotalSectionNum = math.floor(arrayData[8])
if nSectionNum <= 0 then
nIntervalPercent = 1 - nSectionPercent
nInterval = nSectionResume
end
if bIsUltra == true then
nSectionPercent = nEnergyPercent
end
if bIsAssitSkill ~= true then
bCanUseAssitSkill = true
end
skillBtnCtrl:RefreshBtn(bCanUseAssitSkill, nUseTimeHintPercent, nIntervalPercent, nInterval, nSectionPercent, nSectionNum, nTotalSectionNum, bBeginResume)
end
end
function BattleDashboardCtrl:OnEvent_SkillEnableByActionKey(nActionId, bEnable)
local data = self.tbDefine_SkillBtn[nActionId]
data.skillBtnCtrl:SetBtnEnable(bEnable)
end
function BattleDashboardCtrl:OnBtn_ClickHand(btn)
if self.bInteractiveInCD == true then
return
end
if self.bShowUI ~= true then
return
end
printLog("发送时交互id" .. tostring(self.nInteractiveId))
local bSuccess = safe_call_cs_func(InteractiveManagerIns.setInteractiveObjState, InteractiveManagerIns, self.nInteractiveId)
self._mapNode.trHand.localScale = bSuccess == true and Vector3.zero or Vector3.one
self.bInteractiveInCD = true
self._mapNode.btnHand.interactable = false
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgHand, 0.3)
self:AddTimer(1, 0.2, "SetBtnHandInteractable", true, true, true)
EventManager.Hit("InteractiveBtnClick")
end
function BattleDashboardCtrl:SetBtnHandInteractable()
self.bInteractiveInCD = false
self._mapNode.btnHand.interactable = true
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgHand, 1)
end
function BattleDashboardCtrl:SetProgressFx(tr1, tr2, nPercent)
if 0.02 <= nPercent and nPercent < 1 then
local v3 = Vector3(0, 0, -nPercent * 360)
tr1.localScale = Vector3.one
tr1.localEulerAngles = v3
tr2.localScale = Vector3.one
tr2.localEulerAngles = v3
else
tr1.localScale = Vector3.zero
tr2.localScale = Vector3.zero
end
end
function BattleDashboardCtrl:PlaySkillInLineAnim(nSkillId)
if nSkillId == self.nSkillInLineStartId then
self.bInLineStarted = nil
for i = 0, 2 do
local trChild = self._mapNode.trSkillChange:GetChild(i)
local anim = trChild:GetComponent("Animator")
local stateInfo = anim:GetCurrentAnimatorStateInfo()
if stateInfo:IsName("skill_line_1st_in") == true or stateInfo:IsName("skill_line_in") == true or stateInfo:IsName("skill_line_already_in") == true then
anim:SetTrigger("tHide")
end
end
elseif self.bInLineStarted == nil then
self.bInLineStarted = true
local tr_0 = self._mapNode.trSkillChange:GetChild(0)
local anim_0 = tr_0:GetComponent("Animator")
local img_0 = tr_0:Find("imgBg/imgIcon"):GetComponent("Image")
local mapCfgData_0 = ConfigTable.GetData_Skill(self.nSkillInLineStartId)
if mapCfgData_0 ~= nil then
self:SetPngSprite(img_0, mapCfgData_0.Icon)
else
NovaAPI.SetImageSpriteAsset(img_0, nil)
end
local tr_1 = self._mapNode.trSkillChange:GetChild(1)
local anim_1 = tr_1:GetComponent("Animator")
local img_1 = tr_1:Find("imgBg/imgIcon"):GetComponent("Image")
local mapCfgData_1 = ConfigTable.GetData_Skill(nSkillId)
if mapCfgData_1 ~= nil then
self:SetPngSprite(img_1, mapCfgData_1.Icon)
else
NovaAPI.SetImageSpriteAsset(img_1, nil)
end
tr_0.gameObject.name = tostring(self.nSkillInLineStartId)
tr_0:SetAsLastSibling()
anim_0:SetTrigger("t1stIn")
tr_1.gameObject.name = tostring(nSkillId)
tr_1:SetAsLastSibling()
anim_1:SetTrigger("tIn")
else
local tr_0 = self._mapNode.trSkillChange:GetChild(0)
local anim_0 = tr_0:GetComponent("Animator")
local img_0 = tr_0:Find("imgBg/imgIcon"):GetComponent("Image")
local mapCfgData_0 = ConfigTable.GetData_Skill(nSkillId)
if mapCfgData_0 ~= nil then
self:SetPngSprite(img_0, mapCfgData_0.Icon)
else
NovaAPI.SetImageSpriteAsset(img_0, nil)
end
local tr_1 = self._mapNode.trSkillChange:GetChild(1)
local anim_1 = tr_1:GetComponent("Animator")
local tr_2 = self._mapNode.trSkillChange:GetChild(2)
local anim_2 = tr_2:GetComponent("Animator")
tr_0:SetAsLastSibling()
anim_0:SetTrigger("tIn")
anim_1:SetTrigger("tOut")
anim_2:SetTrigger("tAlreadyIn")
end
end
function BattleDashboardCtrl:OnEvent_SkillUnExecutableTips(skillType, duration)
local timeNow = CS.ClientManager.Instance.serverTimeStampWithTimeZone
if skillType == 4 then
if duration > timeNow - self.skillTipTime then
return
end
local strTips = ConfigTable.GetUIText("Character_UnExecutable_Skill")
EventManager.Hit(EventId.OpenMessageBox, strTips)
self.skillTipTime = timeNow
else
if duration > timeNow - self.dodgeTipTime then
return
end
local strTips = ConfigTable.GetUIText("Character_UnExecutable_Dodge")
EventManager.Hit(EventId.OpenMessageBox, strTips)
self.dodgeTipTime = timeNow
end
end
function BattleDashboardCtrl:OnEvent_SupUltraState(charId, isForbidden)
for i, v in pairs(self.tbDefine_SupportSkillBtn) do
if v.nCharId == charId then
v.skillBtnCtrl:SetSupSkillStateByUltimate(isForbidden)
end
end
end
function BattleDashboardCtrl:OnEvent_SupportSkillUnExecutableTips(dataID, duration)
local timeNow = CS.ClientManager.Instance.serverTimeStampWithTimeZone
if duration > timeNow - self.supportSkillTimeTab[dataID] then
return
end
for i, v in pairs(self.tbDefine_SupportSkillBtn) do
if v.nCharId == dataID and v.skillBtnCtrl:GetSupSkillForbidden() then
return
end
end
local strTips = ConfigTable.GetUIText("Character_UnExecutable_Skill")
EventManager.Hit(EventId.OpenMessageBox, strTips)
self.supportSkillTimeTab[dataID] = timeNow
end
function BattleDashboardCtrl:OnEvent_ShowOrHideBattleDash(isShow)
self.gameObject:SetActive(isShow)
end
function BattleDashboardCtrl:OnEvent_BtnStateChange(sBtnName, nBtnState)
local func_CheckBtnState = function(tb)
for i, v in ipairs(tb) do
if v.sName == sBtnName and v.skillBtnCtrl ~= nil then
v.skillBtnCtrl:BtnStateChange(nBtnState)
end
end
end
func_CheckBtnState(self.tbDefine_SkillBtn)
func_CheckBtnState(self.tbDefine_SupportSkillBtn)
func_CheckBtnState(self.tbDefine_SupportUltraBtn)
end
function BattleDashboardCtrl:OnEvent_CanRush(bEnableRush)
self._mapNode.RUN.transform.localScale = bEnableRush == true and Vector3.one or Vector3.zero
end
function BattleDashboardCtrl:OnEvent_SetVariableJoystickMode()
if not NovaAPI.IsMobilePlatform() then
return
end
NovaAPI.SetVariableJoystickMode(self._mapNode.goJoystick)
end
function BattleDashboardCtrl:OnEvent_SwitchUI()
PanelManager.SwitchUI()
end
function BattleDashboardCtrl:OnEvent_SwitchSkillBtn()
PanelManager.SwitchSkillBtn()
end
function BattleDashboardCtrl:SetActionBind()
local set = function(config)
local bHas, tbControl = InputManagerIns:GetInputActionConfig(config.sName)
if bHas then
local sGamepadBind, mapKeyboardBind = "", {name = "", displayName = ""}
for i = 0, tbControl.Count - 1 do
local mapControl = tbControl[i]
if mapControl.isGamepad then
sGamepadBind = mapControl.name
elseif (mapControl.isKeyboard or mapControl.isMouse) and mapKeyboardBind.name == "" then
mapKeyboardBind.name = mapControl.name
mapKeyboardBind.displayName = mapControl.displayName
end
end
if config.skillBtnCtrl then
config.skillBtnCtrl:SetActionBind(sGamepadBind, mapKeyboardBind)
elseif config.sName == "Interactive" then
self._mapNode.ActionHand:SetActionBind(sGamepadBind, mapKeyboardBind)
end
end
end
for _, v in ipairs(self.tbDefine_SkillBtn) do
set(v)
end
for _, v in ipairs(self.tbDefine_FunctionBtn) do
set(v)
end
for _, v in ipairs(self.tbDefine_SupportSkillBtn) do
set(v)
end
for _, v in ipairs(self.tbDefine_SupportUltraBtn) do
set(v)
end
end
function BattleDashboardCtrl:OnEvent_BattleSettingsBindingOverride()
self:SetActionBind()
end
function BattleDashboardCtrl:OnEvent_ExecuteRealButton(key)
if key == "A" then
local bEnable = NovaAPI.IsInputEnabled()
if bEnable == false then
return
end
if self.tbDefine_SkillBtn and self.tbDefine_SkillBtn[1].skillBtnCtrl.bInCD == false then
local nUIType = GamepadUIManager.GetCurUIType()
if nUIType == AllEnum.GamepadUIType.Keyboard then
EventManager.Hit("Upload_Dodge_Event", "Keyboard")
elseif nUIType == AllEnum.GamepadUIType.Mouse then
EventManager.Hit("Upload_Dodge_Event", "Mouse")
else
EventManager.Hit("Upload_Dodge_Event", "Other")
end
end
end
end
function BattleDashboardCtrl:OnEvent_ProloguelEnableBtnControl(nActionId, bEnable)
local btnName = self.tbDefine_SkillBtn[nActionId].sName
NovaAPI.SetRealButtonActive(btnName, bEnable)
local data = self.tbDefine_SkillBtn[nActionId]
data.skillBtnCtrl:SetbtnEnable_Prologuel(bEnable)
end
function BattleDashboardCtrl:OnEvent_MoveAvgBubbleRoot(trBubble)
if trBubble ~= nil and trBubble:IsNull() == false then
NovaAPI.SetParentAndNormalized(trBubble, self._mapNode.trAvgBubbleRoot)
end
end
function BattleDashboardCtrl:OnEvent_ChangeKeyLayout()
self:SetKeyLayout()
end
return BattleDashboardCtrl
@@ -0,0 +1,45 @@
local BattlePopupTipsCtrl = class("BattlePopupTipsCtrl", BaseCtrl)
BattlePopupTipsCtrl._mapNodeConfig = {
goTips = {sComponentName = "GameObject"},
txtTips = {sComponentName = "TMP_Text"},
imgBg = {
sComponentName = "CanvasGroup"
}
}
BattlePopupTipsCtrl._mapEventConfig = {BattlePopupTips = "PopupTips"}
function BattlePopupTipsCtrl:PopupTips(sLanguageId, nTime, bOpen)
if self.timer1 ~= nil then
self.timer1:Cancel(false)
self.timer1 = nil
end
if self.timer2 ~= nil then
self.timer2:Cancel(false)
self.timer2 = nil
end
if bOpen == false then
NovaAPI.SetCanvasGroupAlpha(self._mapNode.imgBg, 0)
return
end
if not nTime or nTime == 0 then
nTime = 0.5
end
self._mapNode.imgBg.alpha = 0
NovaAPI.SetTMPText(self._mapNode.txtTips, ConfigTable.GetUIText(sLanguageId))
self._mapNode.imgBg:DOFade(1, 0.2):SetUpdate(true)
local countdown = function()
self.timer2 = self:AddTimer(1, nTime, function()
self._mapNode.imgBg:DOFade(0, 0.2):SetUpdate(true)
end, true, true, true)
end
self.timer1 = self:AddTimer(1, 0.2, countdown, true, true, true)
end
function BattlePopupTipsCtrl:Awake()
self._mapNode.imgBg.alpha = 0
end
function BattlePopupTipsCtrl:OnEnable()
end
function BattlePopupTipsCtrl:OnDisable()
end
function BattlePopupTipsCtrl:OnDestroy()
end
return BattlePopupTipsCtrl
+772
View File
@@ -0,0 +1,772 @@
local BossHUDCtrl = class("BossHUDCtrl", BaseCtrl)
local AdventureModuleHelper = CS.AdventureModuleHelper
local AniTimeHighlight = 0.2
local AniTime = 0.5
local ToughnessRecoverTime = 0.3
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)
local tabColorJDBoss = {
[1] = {
Color(0.9176470588235294, 0.34901960784313724, 0.27450980392156865, 1),
Color(1, 0.5803921568627451, 0.30980392156862746, 1)
},
[2] = {
Color(1, 0.5803921568627451, 0.30980392156862746, 1),
Color(0.9803921568627451, 0.8, 0.3411764705882353, 1)
},
[3] = {
Color(0.9803921568627451, 0.8, 0.3411764705882353, 1),
Color(0.9176470588235294, 0.34901960784313724, 0.27450980392156865, 1)
}
}
local jointDrillEnergyAnimStage1 = 0.37
local jointDrillEnergyAnimStage2 = 0.68
local jointDrillEnergyStage = {
None = 1,
Stage1 = 2,
Stage2 = 3,
Max = 4
}
BossHUDCtrl._mapNodeConfig = {
BossIcon = {
sNodeName = "imgBossIcon",
sComponentName = "Image"
},
TMP_MonsterName = {sComponentName = "TMP_Text"},
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"
},
rtLine = {},
rtBossIcon = {},
rtShield = {},
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"
},
ainToughnessBrokenChip = {sNodeName = "imgBroken", sComponentName = "Animator"},
imgLight = {
sComponentName = "RectTransform"
},
toughnessLockLight = {
sComponentName = "CanvasGroup"
},
ainLockToughnessHighlight = {
sNodeName = "toughnessLockLight",
sComponentName = "HpBarCanvasGroup"
},
imgToughnessLock = {},
rtShakeRoot = {sComponentName = "Animator"},
rtBuff = {
sCtrlName = "Game.UI.Hud.Buff.BuffCtrl"
},
imgHpFilBossRushBG = {},
TMP_BossRushLv = {sComponentName = "TMP_Text"},
TMP_BossRushLv1 = {
sComponentName = "TMP_Text",
sLanguageId = "Boss_Rush_Lv"
},
rtHPAin = {sNodeName = "rtHP", sComponentName = "Animator"},
imgHpFilBossRushBGColor = {
sNodeName = "imgHpFilBossRushBG",
sComponentName = "HpBarColor"
},
imgHpFillColor = {sNodeName = "imgHpFill", sComponentName = "HpBarColor"},
jointDrill_BossEnergy = {},
jointDrill_BossEnergyValue = {sComponentName = "Image"}
}
BossHUDCtrl._mapEventConfig = {
AllHudShow = "OnEvent_HudShow",
BattleRestart = "OnEvent_Deaded"
}
BossHUDCtrl._mapRedDotConfig = {}
local multipleBossIcon = {
[GameEnum.monsterBloodType.BOSS] = "icon_story_boss1",
[GameEnum.monsterBloodType.MINIBOSS] = "icon_story_boss2"
}
function BossHUDCtrl:PlayTweenHp(hp, hpMax)
if self.bInit == true then
return
end
local nWidth = 1 <= hp / hpMax and self.BarWidth or hp / hpMax * self.BarWidth
if nWidth > self.BarWidth then
nWidth = self.BarWidth
end
if hp < self.nBeforeHp then
if self._mapNode.rtHpFill.sizeDelta.x > self._mapNode.rtHpFillDelay.sizeDelta.x and not self.isToughness then
self._mapNode.aniRtHpDelay:SetTarget(self._mapNode.rtHpFill.sizeDelta, 0)
end
self._mapNode.aniRtHpFill:SetTarget(Vector2(nWidth, self.BarHeight), 0)
self._mapNode.ainColorHpFillHighLight:SetTarget(colorWhite, 0)
local delayTime = 0
if not self.isToughness then
self._mapNode.ainColorHpDelay:SetTarget(colorRed)
if (self.nBeforeHp - hp) / hpMax > self.bigDamageThreshold then
self._mapNode.ainColorHpDelay:SetTarget(colorWhite, 0, 0.2)
self._mapNode.ainColorHpDelay:SetTarget(colorRed, 0.1, AniTime)
self._mapNode.rtShakeRoot:Play("HPShake_in")
delayTime = 0.2
end
self._mapNode.aniRtHpDelay:SetTarget(Vector2(nWidth, self.BarHeight), AniTime, delayTime)
else
self._mapNode.ainColorHpDelay:SetTarget(colorWhite, 0)
end
self._mapNode.ainColorHpFillHighLight:SetTarget(colorHide, AniTimeHighlight, 0.2 + delayTime)
else
if not self.isToughness then
self._mapNode.aniRtHpDelay:SetTarget(self._mapNode.rtHpFill.sizeDelta, 0)
end
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)
if not self.isToughness then
self._mapNode.ainColorHpDelay:SetTarget(colorRecover, 0)
self._mapNode.aniRtHpDelay:SetTarget(Vector2(nWidth, self.BarHeight), AniTime)
end
self._mapNode.aniRtHpFill:SetTarget(Vector2(nWidth, self.BarHeight), AniTime, AniTime)
self._mapNode.ainColorHpFillRecoverLight:SetTarget(colorRed, 0)
self._mapNode.ainColorHpFillRecoverLight:SetTarget(colorRedHide, AniTimeHighlight, AniTime)
end
end
function BossHUDCtrl:PlayTweenShield(shieldValue, shieldValueMax)
local nWidth = 1 <= shieldValue / shieldValueMax and self.ShieldBarWidth or shieldValue / shieldValueMax * self.ShieldBarWidth
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, self.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, self.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, self.BarHeight), AniTime)
self._mapNode.aniRtShieldFill:SetTarget(Vector2(nWidth, self.BarHeight), AniTime)
self._mapNode.ainColorShieldFillHighLight:SetTarget(colorHide, AniTimeHighlight, 0.2 + AniTime)
end
end
function BossHUDCtrl:KillTweenToughness()
self._mapNode.aniRtToughnessDelay:Stop()
self._mapNode.aniRtToughnessFill:Stop()
self._mapNode.ainColorToughnessHighlight:Stop()
end
function BossHUDCtrl:PlayTweenToughness(toughness, toughnessMax)
if toughness == self.nBeforeToughness then
NovaAPI.SetCanvasGroupAlpha(self._mapNode.toughnessLockLight, 1)
self._mapNode.ainLockToughnessHighlight:SetTarget(0, 0.3)
end
self._mapNode.imgToughnessLock.gameObject:SetActive(false)
self:KillTweenToughness()
local nWidth = 1 <= toughness / toughnessMax and self.ToughnessWidth or toughness / toughnessMax * self.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, self.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, self.ToughnessHeight), AniTime, delayTime)
end
function BossHUDCtrl:PlayTweenToughnessBroken()
self._mapNode.imgToughnessMask.sizeDelta = Vector2(0, self.ToughnessHeight)
self._mapNode.imgToughnessMaskDelay.sizeDelta = Vector2(0, self.ToughnessHeight)
self._mapNode.rtHighlight.anchoredPosition = Vector2(0, 0)
self._mapNode.rtNormal:SetActive(false)
self._mapNode.imgBroken:SetActive(true)
self._mapNode.ainToughnessBrokenChip:Play("imgBrokenChip_in")
self._mapNode.rtShakeRoot:Play("HPShake_in")
end
function BossHUDCtrl:PlayTweenToughnessRecover()
self:KillTweenToughness()
self._mapNode.aniRtToughnessFill:SetTarget(Vector2(0, self.ToughnessHeight), 0)
self._mapNode.aniRtToughnessDelay:SetTarget(Vector2(0, self.ToughnessHeight), 0)
self._mapNode.rtHighlight.anchoredPosition = Vector2(self.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(self.ToughnessWidth, self.ToughnessHeight), ToughnessRecoverTime)
end
function BossHUDCtrl: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 BossHUDCtrl: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 BossHUDCtrl:Awake()
self.bigDamageThreshold = ConfigTable.GetConfigNumber("BloodSpecialEffectThresholdValue") / 100
self.rootCanvasGroup = self.gameObject:GetComponent("CanvasGroup")
self.BarWidth = self._mapNode.rtHpFillDelay.sizeDelta.x
self.BarHeight = self._mapNode.rtHpFillDelay.sizeDelta.y
self.ToughnessWidth = self._mapNode.imgToughnessMaskDelay.sizeDelta.x
self.ToughnessHeight = self._mapNode.imgToughnessMaskDelay.sizeDelta.y
self.ShieldBarWidth = self._mapNode.rtShieldDelay.sizeDelta.x
self.ShieldBar = self._mapNode.rtShieldDelay.sizeDelta.x
self.animRtShield = self.gameObject:GetComponent("Animator")
self.JDBossColorIndex = 0
self.isToughness = false
self.JointDrillBossCount = 0
self.JointDrillEnergyStage = jointDrillEnergyStage.None
end
function BossHUDCtrl:OnEnable()
self.bossId = 0
NovaAPI.SetComponentEnable(self._mapNode.BossCanvas, false)
self:ResetHit()
end
function BossHUDCtrl:OnDisable()
self:KillTween()
self:CloseUI()
end
function BossHUDCtrl:OnDestroy()
end
function BossHUDCtrl:SetHp(hp, hpMax, bChange)
if self.bossId == 0 then
return
end
if hpMax <= 0 then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(0, self.BarHeight), 0)
self._mapNode.aniRtHpFill:SetTarget(Vector2(0, self.BarHeight), 0)
elseif bChange then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(hp / hpMax * self.BarWidth, self.BarHeight), 0)
self._mapNode.aniRtHpFill:SetTarget(Vector2(hp / hpMax * self.BarWidth, self.BarHeight), 0)
else
self:PlayTweenHp(hp, hpMax)
end
self.nBeforeHp = hp
self.nBeforeHpMax = hpMax
end
function BossHUDCtrl:OnEvent_HpChanged(hp, hpMax)
if self.bossType == GameEnum.monsterBloodType.BOSSRUSH and self.isDontChangeHp and hp ~= hpMax then
return
end
if self.bossType ~= GameEnum.monsterBloodType.JOINTDRILLBOSS then
if hp == self.nBeforeHp then
self:SetHp(hp, hpMax, true)
else
self:SetHp(hp, hpMax)
end
else
local tmpHpBarNum = math.floor(hp / self.tmpJDBossHpMax) + 1
if tmpHpBarNum < self.curBossHpBarNum then
self.curBossHpBarNum = tmpHpBarNum
local tmpJDBossHpCur = math.fmod(hp, self.tmpJDBossHpMax)
self:SetHp(tmpJDBossHpCur, self.tmpJDBossHpMax, true)
self:SetJointDrillBossHPValue()
else
local tmpJDBossHpCur = math.fmod(hp, self.tmpJDBossHpMax)
self:SetHp(tmpJDBossHpCur, self.tmpJDBossHpMax)
end
end
end
function BossHUDCtrl:OnEvent_ToughnessStateChanged(bBroken, nValue, nToughnessMax)
if bBroken then
self.isToughness = true
if self.timerToughnessState ~= nil then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(self._mapNode.rtHpFill.sizeDelta.x, self.BarHeight), 0)
self.timerToughnessState:Cancel()
end
self:SetToughness(0, nToughnessMax, true)
else
self._mapNode.aniRtHpDelay:SetTarget(Vector2(self._mapNode.rtHpFill.sizeDelta.x, self.BarHeight), AniTimeHighlight)
local changeToughnessState = function()
self.isToughness = false
self.timerToughnessState = nil
end
self.timerToughnessState = self:AddTimer(1, AniTimeHighlight, changeToughnessState, true, true, true)
if nValue ~= 0 then
self:SetToughness(nToughnessMax, nToughnessMax, true)
end
end
end
function BossHUDCtrl:OnEvent_ToughnessValueChanged(toughness, toughnessMax)
self:SetToughness(toughness, toughnessMax, false)
end
function BossHUDCtrl:OnEvent_ToughnessShowStateChanged(bShow)
if bShow then
self._mapNode.rtToughness.transform.localScale = Vector3.one
else
self._mapNode.rtToughness.transform.localScale = Vector3.zero
end
end
function BossHUDCtrl:OnEvent_Deaded()
EventManager.Hit("MonsterBossDead", self.bossId)
if self.isToughness then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(0, self.BarHeight), AniTime)
local changeToughnessState = function()
self:CloseUI()
NovaAPI.SetCanvasGroupAlpha(self.rootCanvasGroup, 0)
end
self:AddTimer(1, AniTime, changeToughnessState, true, true, true)
else
self:CloseUI()
NovaAPI.SetCanvasGroupAlpha(self.rootCanvasGroup, 0)
end
end
function BossHUDCtrl:AddEntityEvent()
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)
EventManager.AddEntityEvent("BossRushMonsterLevelChanged", self.bossId, self, self.OnEvent_BossRushMonsterLevelChanged)
EventManager.AddEntityEvent("BossRushMonsterBattleAttrChanged", self.bossId, self, self.OnEvent_BossRushMonsterBattleAttrChanged)
EventManager.AddEntityEvent("JointDrillBossEnergyChanged", self.bossId, self, self.OnEvent_JointDrillBossEnergyChanged)
EventManager.AddEntityEvent("RefreshBossEnergyValueHUD", self.bossId, self, self.OnEvent_RefreshBossEnergyValueHUD)
EventManager.AddEntityEvent("CastUltra", self.bossId, self, self.OnEvent_JointDrillBossUseSkill)
end
function BossHUDCtrl:SetBossInfo(nDataId, nType, nBloodType)
local mapMonster = ConfigTable.GetData("Monster", nDataId)
if mapMonster == nil then
return
end
if nType == GameEnum.monsterBloodType.BOSS or nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.MINIBOSS or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS then
local mapSkin = ConfigTable.GetData("MonsterSkin", mapMonster.FAId)
if mapSkin == nil then
return
end
local mapMonsterManual = ConfigTable.GetData("MonsterManual", mapSkin.MonsterManual)
if mapMonsterManual == nil then
return
end
if nBloodType == AllEnum.BossBloodType.Single then
self:SetPngSprite(self._mapNode.BossIcon, mapMonsterManual.Icon)
else
local sIcon = multipleBossIcon[nType]
self:SetAtlasSprite(self._mapNode.BossIcon, "15_battle", sIcon)
end
self._mapNode.rtLine:SetActive(true)
self._mapNode.rtBossIcon:SetActive(true)
else
self._mapNode.rtLine:SetActive(false)
self._mapNode.rtBossIcon:SetActive(false)
end
end
function BossHUDCtrl:InitUI(bossId, nDataId, nType, nBloodType)
local mapMonster = ConfigTable.GetData("Monster", nDataId)
if mapMonster == nil then
return
end
NovaAPI.SetCanvasGroupAlpha(self.rootCanvasGroup, 1)
self.bossType = nType
self._mapNode.rtShakeRoot.gameObject:SetActive(true)
self._mapNode.imgHpFilBossRushBG:SetActive(nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS)
self._mapNode.TMP_BossRushLv1.gameObject:SetActive(nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS)
self:SetBossInfo(nDataId, nType, nBloodType)
self._mapNode.jointDrill_BossEnergy:SetActive(nType == GameEnum.monsterBloodType.JOINTDRILLBOSS)
if nType == GameEnum.monsterBloodType.JOINTDRILLBOSS and self.maxJointDrillBossEnergy == nil then
self.maxJointDrillBossEnergy, self.curJointDrillBossEnergy = safe_call_cs_func2(CS.AdventureModuleHelper.GetJointDrillBossEnergy, bossId)
self:OnEvent_JointDrillBossEnergyChanged(self.curJointDrillBossEnergy)
self.jDBossHpBarNum = PlayerData.JointDrill:GetBossHpBarNum()
end
if nType == GameEnum.monsterBloodType.JOINTDRILLBOSS then
self.JointDrillBossCount = self.JointDrillBossCount + 1
end
self.bossId = bossId
self:ResetHit()
self:KillTween()
NovaAPI.SetTMPText(self._mapNode.TMP_MonsterName, "")
NovaAPI.SetTMPText(self._mapNode.TMP_BossRushLv, 1)
self.bToughnessRecover = mapMonster.ToughnessBrokenTime > 0
if mapMonster ~= nil then
local mSkin = ConfigTable.GetData("MonsterSkin", mapMonster.FAId)
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
if mManual ~= nil then
NovaAPI.SetTMPText(self._mapNode.TMP_MonsterName, mManual.Name)
end
end
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:SetActive(true)
self._mapNode.rtToughness.transform.localScale = Vector3.one
if nType == GameEnum.monsterBloodType.JOINTDRILLBOSS then
self.tmpJDBossHpMax = math.floor(hpMax / self.jDBossHpBarNum)
local tmpJDBossHpCur = 0
if hp == hpMax then
self.curBossHpBarNum = math.floor(hp / self.tmpJDBossHpMax)
tmpJDBossHpCur = self.tmpJDBossHpMax
else
self.curBossHpBarNum = math.floor(hp / self.tmpJDBossHpMax) + 1
tmpJDBossHpCur = math.fmod(hp, self.tmpJDBossHpMax)
end
self:SetHp(tmpJDBossHpCur, self.tmpJDBossHpMax, true)
self:SetJointDrillBossHPValue()
else
self:SetHp(hp, hpMax, true)
end
self:SetToughness(toughness, toughnessMax, false, true)
local shieldValue, shieldValueMax = AdventureModuleHelper.GetEntityShieldValue(self.bossId)
self:SetShield(shieldValue, shieldValueMax, true)
self:AddEntityEvent()
self.bInit = true
if nType == GameEnum.monsterBloodType.JOINTDRILLBOSS and self.JointDrillBossCount >= 2 then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(self.BarWidth, self.BarHeight), 0)
self._mapNode.aniRtHpFill:SetTarget(Vector2(self.BarWidth, self.BarHeight), 0)
else
self._mapNode.aniRtHpDelay:SetTarget(Vector2(0, self.BarHeight), 0)
self._mapNode.aniRtHpFill:SetTarget(Vector2(0, self.BarHeight), 0)
self._mapNode.aniRtHpDelay:SetTarget(Vector2(self.BarWidth, self.BarHeight), 0.5, 0.5)
self._mapNode.aniRtHpFill:SetTarget(Vector2(self.BarWidth, self.BarHeight), 0.5, 0.5)
end
local InitCompleteCallback = function()
self.bInit = false
self:SetHp(self.nBeforeHp, self.nBeforeHpMax)
end
self:AddTimer(1, 1, InitCompleteCallback, true, true, true)
end
function BossHUDCtrl:RefreshUI(bossId, nDataId, nType, nBloodType)
local mapMonster = ConfigTable.GetData("Monster", nDataId)
if mapMonster == nil then
return
end
NovaAPI.SetCanvasGroupAlpha(self.rootCanvasGroup, 1)
self.bossType = nType
self._mapNode.rtShakeRoot.gameObject:SetActive(true)
self._mapNode.imgHpFilBossRushBG:SetActive(nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS)
self._mapNode.TMP_BossRushLv1.gameObject:SetActive(nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS)
self:SetBossInfo(nDataId, nType, nBloodType)
self._mapNode.jointDrill_BossEnergy:SetActive(nType == GameEnum.monsterBloodType.JOINTDRILLBOSS)
if nType == GameEnum.monsterBloodType.JOINTDRILLBOSS and self.maxJointDrillBossEnergy == nil then
self.maxJointDrillBossEnergy, self.curJointDrillBossEnergy = safe_call_cs_func2(CS.AdventureModuleHelper.GetJointDrillBossEnergy, bossId)
self:OnEvent_JointDrillBossEnergyChanged(self.curJointDrillBossEnergy)
self.jDBossHpBarNum = PlayerData.JointDrill:GetBossHpBarNum()
end
self.bossId = bossId
self:KillTween()
NovaAPI.SetTMPText(self._mapNode.TMP_MonsterName, "")
NovaAPI.SetTMPText(self._mapNode.TMP_BossRushLv, 1)
self.bToughnessRecover = mapMonster.ToughnessBrokenTime > 0
if mapMonster ~= nil then
local mSkin = ConfigTable.GetData("MonsterSkin", mapMonster.FAId)
local mManual = ConfigTable.GetData("MonsterManual", mSkin.MonsterManual)
if mManual ~= nil then
NovaAPI.SetTMPText(self._mapNode.TMP_MonsterName, mManual.Name)
end
end
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:SetActive(true)
self._mapNode.rtToughness.transform.localScale = Vector3.one
if nType == GameEnum.monsterBloodType.JOINTDRILLBOSS then
self.tmpJDBossHpMax = math.floor(hpMax / self.jDBossHpBarNum)
local tmpJDBossHpCur = 0
if hp == hpMax then
self.curBossHpBarNum = math.floor(hp / self.tmpJDBossHpMax)
tmpJDBossHpCur = self.tmpJDBossHpMax
else
self.curBossHpBarNum = math.floor(hp / self.tmpJDBossHpMax) + 1
tmpJDBossHpCur = math.fmod(hp, self.tmpJDBossHpMax)
end
self:SetHp(tmpJDBossHpCur, self.tmpJDBossHpMax, true)
self:SetJointDrillBossHPValue()
else
self:SetHp(hp, hpMax, true)
end
self:SetToughness(toughness, toughnessMax, false, true)
local shieldValue, shieldValueMax = AdventureModuleHelper.GetEntityShieldValue(self.bossId)
self:SetShield(shieldValue, shieldValueMax, true)
self:AddEntityEvent()
self.bInit = false
self:SetHp(self.nBeforeHp, self.nBeforeHpMax)
end
function BossHUDCtrl:OpenUI(bossId, nDataId, nType, nBloodType, bRefresh)
if self.bossId ~= 0 and self.bossId ~= nil and bReinit then
printError(string.format("boss血条已被EntityId为%d绑定 %d重复绑定不生效", self.bossId, bossId))
return
end
if not bRefresh then
self:InitUI(bossId, nDataId, nType, nBloodType)
else
self:RefreshUI(bossId, nDataId, nType, nBloodType)
end
end
function BossHUDCtrl:SetShield(shieldValue, shieldValueMax, bChange)
if self.bossId == 0 then
return
end
if shieldValue <= 0 then
self._mapNode.aniRtShieldDelay:SetTarget(Vector2(0, self.BarHeight), 0)
self._mapNode.aniRtShieldFill:SetTarget(Vector2(0, self.BarHeight), 0)
if bChange then
self.animRtShield:Play("rtShield_out_change")
elseif 0 < self.nBeforeShield then
self.animRtShield:Play("rtShield_out")
end
elseif bChange then
self.animRtShield:Play("rtShield_in_change")
self._mapNode.aniRtShieldDelay:SetTarget(Vector2(shieldValue / shieldValueMax * self.ShieldBarWidth, self.BarHeight), 0)
self._mapNode.aniRtShieldFill:SetTarget(Vector2(shieldValue / shieldValueMax * self.ShieldBarWidth, self.BarHeight), 0)
else
if 0 >= self.nBeforeShield then
self.animRtShield:Play("rtShield_in")
end
self:PlayTweenShield(shieldValue, shieldValueMax)
end
self.nBeforeShield = shieldValue
self.nBeforeShieldMax = shieldValueMax
end
function BossHUDCtrl: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 * self.ToughnessWidth, self.ToughnessHeight)
self._mapNode.imgToughnessMaskDelay.sizeDelta = Vector2(toughness / toughnessMax * self.ToughnessWidth, self.ToughnessHeight)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.Highlight, 0)
elseif bState then
if toughness == 0 then
self:PlayTweenToughnessBroken()
else
self._mapNode.rtToughness:SetActive(true)
self:PlayTweenToughnessRecover()
end
else
self:PlayTweenToughness(toughness, toughnessMax)
end
self.nBeforeToughness = toughness
end
function BossHUDCtrl:OnEvent_ShieldChanged(value1, value2)
if value1 == self.nBeforeShield then
return
else
self:SetShield(value1, value2)
end
end
function BossHUDCtrl:CloseUI()
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("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)
EventManager.RemoveEntityEvent("BossRushMonsterLevelChanged", self.bossId, self, self.OnEvent_BossRushMonsterLevelChanged)
EventManager.RemoveEntityEvent("BossRushMonsterBattleAttrChanged", self.bossId, self, self.OnEvent_BossRushMonsterBattleAttrChanged)
EventManager.RemoveEntityEvent("JointDrillBossEnergyChanged", self.bossId, self, self.OnEvent_JointDrillBossEnergyChanged)
EventManager.RemoveEntityEvent("RefreshBossEnergyValueHUD", self.bossId, self, self.OnEvent_RefreshBossEnergyValueHUD)
EventManager.RemoveEntityEvent("CastUltra", self.bossId, self, self.OnEvent_JointDrillBossUseSkill)
self._mapNode.rtBuff:UnbindEntity()
self.bossId = 0
self.isToughness = false
self.maxJointDrillBossEnergy = nil
self.JDBossColorIndex = 0
end
function BossHUDCtrl:HideUI()
self._mapNode.rtShakeRoot.gameObject:SetActive(false)
end
function BossHUDCtrl:OnEvent_HudShow(bShow)
if bShow and self.bossId ~= 0 then
NovaAPI.SetCanvasGroupAlpha(self.rootCanvasGroup, 1)
else
NovaAPI.SetCanvasGroupAlpha(self.rootCanvasGroup, 0)
end
end
function BossHUDCtrl:OnEvent_BossRushMonsterLevelChanged(oldLevel, battleLevel)
self.isDontChangeHp = true
NovaAPI.SetTMPText(self._mapNode.TMP_BossRushLv, battleLevel)
self._mapNode.rtHPAin:Play("BossRushHP_in")
if self.isToughness then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(self.BarWidth, self.BarHeight), 0)
end
end
function BossHUDCtrl:OnEvent_BossRushMonsterBattleAttrChanged()
self.isDontChangeHp = false
end
function BossHUDCtrl:OnEvent_JointDrillBossEnergyChanged(curEnergy, bIsUp)
if self.maxJointDrillBossEnergy and self.maxJointDrillBossEnergy ~= 0 then
local val = 0.3 + curEnergy / self.maxJointDrillBossEnergy * 0.62
NovaAPI.SetImageFillAmount(self._mapNode.jointDrill_BossEnergyValue, val)
if bIsUp then
self:ChangeBossEnergy(curEnergy, self.maxJointDrillBossEnergy)
elseif curEnergy == 0 then
self.JointDrillEnergyStage = jointDrillEnergyStage.None
end
else
NovaAPI.SetImageFillAmount(self._mapNode.jointDrill_BossEnergyValue, 0)
self.JointDrillEnergyStage = jointDrillEnergyStage.None
end
end
function BossHUDCtrl:OnEvent_RefreshBossEnergyValueHUD(isSave)
if not isSave then
NovaAPI.SetImageFillAmount(self._mapNode.jointDrill_BossEnergyValue, 0)
self.JointDrillEnergyStage = jointDrillEnergyStage.None
end
end
function BossHUDCtrl:SetJointDrillBossHPValue()
self._mapNode.TMP_BossRushLv1.text = ""
self._mapNode.TMP_BossRushLv.text = "x" .. self.curBossHpBarNum
self.JDBossColorIndex = self.JDBossColorIndex + 1
local tmpIndex = math.fmod(self.JDBossColorIndex, 3)
if tmpIndex == 0 then
tmpIndex = 3
end
self._mapNode.imgHpFillColor:SetTarget(tabColorJDBoss[tmpIndex][1])
self._mapNode.imgHpFilBossRushBGColor:SetTarget(tabColorJDBoss[tmpIndex][2])
if self.curBossHpBarNum == 1 then
self._mapNode.imgHpFilBossRushBGColor.gameObject:SetActive(false)
end
if self.isToughness then
self._mapNode.aniRtHpDelay:SetTarget(Vector2(self.BarWidth, self.BarHeight), 0)
end
end
function BossHUDCtrl:ChangeBossEnergy(curValue, maxValue)
local anim = self._mapNode.jointDrill_BossEnergy:GetComponent("Animator")
if anim == nil then
return
end
local percent = curValue / maxValue
if 1 <= percent then
anim:Play("JointDrill_BossEnergy_full")
self.JointDrillEnergyStage = jointDrillEnergyStage.Max
elseif percent >= jointDrillEnergyAnimStage2 then
if self.JointDrillEnergyStage < jointDrillEnergyStage.Stage2 then
anim:Play("JointDrill_BossEnergy_recharge2")
self.JointDrillEnergyStage = jointDrillEnergyStage.Stage2
end
else
if percent >= jointDrillEnergyAnimStage1 and self.JointDrillEnergyStage < jointDrillEnergyStage.Stage1 then
anim:Play("JointDrill_BossEnergy_recharge1")
self.JointDrillEnergyStage = jointDrillEnergyStage.Stage1
else
end
end
end
function BossHUDCtrl:OnEvent_JointDrillBossUseSkill()
local anim = self._mapNode.jointDrill_BossEnergy:GetComponent("Animator")
if anim == nil then
return
end
anim:Play("Empty")
self._mapNode.rtHPAin:Play("JointDrill_BossEnergy_open")
self.JointDrillEnergyStage = jointDrillEnergyStage.None
end
return BossHUDCtrl
+249
View File
@@ -0,0 +1,249 @@
local AdventureModuleHelper = CS.AdventureModuleHelper
local BossPanelCtrl = class("BossPanelCtrl", BaseCtrl)
BossPanelCtrl._mapNodeConfig = {
BossCanvas = {sNodeName = "Boss", sComponentName = "Canvas"},
BossCanvasGroup = {
sNodeName = "Boss",
sComponentName = "CanvasGroup"
},
animBoss = {sNodeName = "Boss", sComponentName = "Animator"},
singleBoss = {
sNodeName = "goSingleBoss",
sCtrlName = "Game.UI.Battle.BossHUDCtrl"
},
goMultipleBoss = {},
goBossCtrl = {
nCount = 3,
sNodeName = "goMultipleBoss",
sCtrlName = "Game.UI.Battle.BossHUDCtrl"
}
}
BossPanelCtrl._mapEventConfig = {
RefreshCenterHpBar = "OnEvent_RefreshCenterHpBar",
MonsterBossDead = "OnEvent_MonsterBossDead",
ShowCenterHpBar = "OnEvent_ShowCenterHpBar",
Level_Settlement = "OnEvent_ResetBossHUD",
ResetBossHUD = "OnEvent_ResetBossHUD",
InputEnable = "OnEvent_InputEnable"
}
function BossPanelCtrl:Awake()
self.bInputEnable = false
self.inputEnableCallback = nil
end
function BossPanelCtrl:OnEnable()
self.bInit = true
self.nBloodType = 0
self.tbBoss = {}
self.tbBossCtrl = {}
self._mapNode.BossCanvas.enabled = true
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, 0)
NovaAPI.SetComponentEnable(self._mapNode.BossCanvas, false)
end
function BossPanelCtrl:OnDisable()
self.tbBoss = {}
end
function BossPanelCtrl:OnDestroy()
end
function BossPanelCtrl:SetBossHUD(mapData, ctrl, bRefresh)
ctrl:CloseUI()
ctrl:OpenUI(mapData.nBossId, mapData.nDataId, mapData.nType, self.nBloodType, bRefresh)
self.tbBossCtrl[mapData.nBossId] = ctrl
end
function BossPanelCtrl:RefreshBossPanel(bRefresh)
if #self.tbBoss == 0 then
self:CloseUI()
return
end
if self.bInit then
self.bInit = false
NovaAPI.SetComponentEnable(self._mapNode.BossCanvas, true)
self.bossHUDAnimTweener = Sequence()
self.bossHUDAnimTweener:Append(self._mapNode.BossCanvasGroup:DOFade(1, 0.5))
self.bossHUDAnimTweener:SetUpdate(true)
self.bossHUDAnimTweener:OnComplete(function()
self.bossHUDAnimTweener:Kill()
self.bossHUDAnimTweener = nil
end)
end
self.nBloodType = 0
local refreshHUD = function()
if self.nBloodType == AllEnum.BossBloodType.Single then
self._mapNode.singleBoss.gameObject:SetActive(true)
self._mapNode.goMultipleBoss.gameObject:SetActive(false)
local mapData = self.tbBoss[1]
self:SetBossHUD(mapData, self._mapNode.singleBoss, bRefresh)
self.tbBoss[1].bInit = false
EventManager.Hit("ShowBossHUD", mapData.nBossId, mapData.nType, false, mapData.nDataId, self.nBloodType)
elseif self.nBloodType == AllEnum.BossBloodType.Multiple then
self._mapNode.singleBoss.gameObject:SetActive(false)
self._mapNode.goMultipleBoss.gameObject:SetActive(true)
for i, v in ipairs(self._mapNode.goBossCtrl) do
v.gameObject:SetActive(self.tbBoss[i] ~= nil)
if self.tbBoss[i] ~= nil then
self:SetBossHUD(self.tbBoss[i], v, bRefresh)
self.tbBoss[i].bInit = false
EventManager.Hit("ShowBossHUD", self.tbBoss[i].nBossId, self.tbBoss[i].nType, true, self.tbBoss[i].nDataId, self.nBloodType)
end
end
end
end
if self.bossAnimTimer ~= nil then
self.bossAnimTimer:Cancel()
self.bossAnimTimer = nil
if self.nBloodType == AllEnum.BossBloodType.Multiple then
refreshHUD()
end
end
if #self.tbBoss == 1 then
self.nBloodType = AllEnum.BossBloodType.Single
if self.nLastBossCount == 2 then
local nAnimLen = NovaAPI.GetAnimClipLength(self._mapNode.animBoss, {
"MultipleBoss_out"
})
self.bossAnimTimer = self:AddTimer(1, nAnimLen, function()
self._mapNode.animBoss:Play("SingleBoss_in", 0, 0)
self.bossAnimTimer = nil
refreshHUD()
end)
self._mapNode.animBoss:Play("MultipleBoss_out", 0, 0)
else
self._mapNode.animBoss:Play("SingleBoss_in", 0, 0)
refreshHUD()
end
else
self.nBloodType = AllEnum.BossBloodType.Multiple
if self.nLastBossCount == 3 and #self.tbBoss == 2 then
local nAnimLen = NovaAPI.GetAnimClipLength(self._mapNode.animBoss, {
"MultipleBoss_out"
})
self.bossAnimTimer = self:AddTimer(1, nAnimLen, function()
self._mapNode.animBoss:Play("MultipleBoss_in", 0, 0)
self.bossAnimTimer = nil
refreshHUD()
end)
self._mapNode.animBoss:Play("MultipleBoss_out", 0, 0)
else
refreshHUD()
self._mapNode.animBoss:Play("MultipleBoss_in", 0, 0)
end
end
self.nLastBossCount = #self.tbBoss
end
function BossPanelCtrl:CloseUI()
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, 1)
self.bossHUDAnimTweener = Sequence()
self.bossHUDAnimTweener:Append(self._mapNode.BossCanvasGroup.DOFade(0, 0.5))
self.bossHUDAnimTweener:OnComplete(function()
self._mapNode.BossCanvas.enabled = false
self.bossHUDAnimTweener:Kill()
self.bossHUDAnimTweener = nil
end)
self.bossHUDAnimTweener:SetUpdate(true)
self.tbBoss = {}
self.tbBossCtrl = {}
end
function BossPanelCtrl:OnEvent_ShowCenterHpBar(nBossId, nType, bShow, nDataId)
if (nType == GameEnum.monsterBloodType.BOSS or nType == GameEnum.monsterBloodType.MINIBOSS or nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS) and bShow then
local bAdded = false
self.nLastBossCount = #self.tbBoss
for _, v in ipairs(self.tbBoss) do
if v.nBossId == nBossId then
bAdded = true
break
end
end
if not bAdded then
if #self.tbBoss >= 3 then
printError("场上同时显示boss血条数量超过3!!!")
return
end
local nSortType = 0
if nType == GameEnum.monsterBloodType.BOSSRUSH or nType == GameEnum.monsterBloodType.JOINTDRILLBOSS then
local nBossCount = 0
for _, v in ipairs(self.tbBoss) do
if v.nType == GameEnum.monsterBloodType.BOSSRUSH then
nBossCount = nBossCount + 1
end
end
if 1 < nBossCount then
return
end
elseif nType == GameEnum.monsterBloodType.BOSS then
nSortType = 1
elseif nType == GameEnum.monsterBloodType.MINIBOSS then
nSortType = 2
end
table.insert(self.tbBoss, {
nBossId = nBossId,
nType = nType,
nSortType = nSortType,
nDataId = nDataId,
bInit = true
})
table.sort(self.tbBoss, function(a, b)
if a.nSortType == b.nSortType then
return a.nDataId < b.nDataId
end
return a.nSortType < b.nSortType
end)
if self.bInputEnable then
self.inputEnableCallback = nil
self:RefreshBossPanel()
else
function self.inputEnableCallback()
self:RefreshBossPanel()
end
end
end
else
end
end
function BossPanelCtrl:OnEvent_ResetBossHUD()
self.bInit = true
self.nBloodType = 0
for _, v in ipairs(self.tbBossCtrl) do
v:CloseUI()
end
self:CloseUI()
end
function BossPanelCtrl:OnEvent_RefreshCenterHpBar()
if self.bInputEnable then
self.inputEnableCallback = nil
self:RefreshBossPanel(true)
else
function self.inputEnableCallback()
self:RefreshBossPanel(true)
end
end
end
function BossPanelCtrl:OnEvent_MonsterBossDead(nBossId)
local nIndex = 0
for k, v in ipairs(self.tbBoss) do
if v.nBossId == nBossId then
nIndex = k
break
end
end
if nIndex ~= 0 then
table.remove(self.tbBoss, nIndex)
end
if self.nBloodType == AllEnum.BossBloodType.Single then
self._mapNode.animBoss:Play("SingleBoss_out", 0, 0)
end
end
function BossPanelCtrl:OnEvent_InputEnable(bEnable)
self.bInputEnable = bEnable
if self.bossHUDAnimTweener ~= nil then
if not bEnable then
self.bossHUDAnimTweener:Pause()
else
self.bossHUDAnimTweener:Play()
end
end
NovaAPI.SetCanvasGroupAlpha(self._mapNode.BossCanvasGroup, bEnable == true and 1 or 0)
if bEnable and self.inputEnableCallback ~= nil then
self.inputEnableCallback()
self.inputEnableCallback = nil
end
end
return BossPanelCtrl
+41
View File
@@ -0,0 +1,41 @@
local CinemaModeCtrl = class("CinemaModeCtrl", BaseCtrl)
CinemaModeCtrl._mapNodeConfig = {
Cinema = {sNodeName = "Cinema"},
Letterbox_Top = {
sNodeName = "Letterbox_Top",
sComponentName = "RectTransform"
},
Letterbox_Bottom = {
sNodeName = "Letterbox_Bottom",
sComponentName = "RectTransform"
}
}
CinemaModeCtrl._mapEventConfig = {}
function CinemaModeCtrl:Awake()
self.cinemaModeUpPosOffset = Vector2(0, 130)
self.cinemaModeDownPosOffset = Vector2(0, -130)
self.cinemaModeBoardAnimTime = 1
end
function CinemaModeCtrl:OnEnable()
self._mapNode.Cinema:SetActive(false)
end
function CinemaModeCtrl:OnDisable()
end
function CinemaModeCtrl:OnDestroy()
end
function CinemaModeCtrl:OpenUI()
self._mapNode.Cinema:SetActive(true)
self._mapNode.Letterbox_Top.anchoredPosition = self.cinemaModeUpPosOffset
self._mapNode.Letterbox_Bottom.anchoredPosition = self.cinemaModeDownPosOffset
self._mapNode.Letterbox_Top:DOAnchorPos(Vector2.zero, self.cinemaModeBoardAnimTime):SetUpdate(true)
self._mapNode.Letterbox_Bottom:DOAnchorPos(Vector2.zero, self.cinemaModeBoardAnimTime):SetUpdate(true)
end
function CinemaModeCtrl:CloseUI()
self._mapNode.Letterbox_Top.anchoredPosition = Vector2.zero
self._mapNode.Letterbox_Bottom.anchoredPosition = Vector2.zero
self._mapNode.Letterbox_Top:DOAnchorPos(self.cinemaModeUpPosOffset, self.cinemaModeBoardAnimTime):SetUpdate(true)
self._mapNode.Letterbox_Bottom:DOAnchorPos(self.cinemaModeDownPosOffset, self.cinemaModeBoardAnimTime):OnComplete(function()
self._mapNode.Cinema:SetActive(false)
end):SetUpdate(true)
end
return CinemaModeCtrl
@@ -0,0 +1,66 @@
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local CommonMonsterWarningCtrl = class("CommonMonsterWarningCtrl", BaseCtrl)
CommonMonsterWarningCtrl._mapNodeConfig = {
HighThreat = {},
texHighThreat = {
sComponentName = "TMP_Text",
sLanguageId = "CommonMonsterWarning_HighThreat"
},
Boss = {},
texBoss = {
sComponentName = "TMP_Text",
sLanguageId = "CommonMonsterWarning_Boss"
},
Elite = {},
texElite = {
sComponentName = "TMP_Text",
sLanguageId = "CommonMonsterWarning_Elite"
},
TravelTeam = {},
texTravelTeam = {
sComponentName = "TMP_Text",
sLanguageId = "CommonMonsterWarning_TravelTeam"
}
}
CommonMonsterWarningCtrl._mapEventConfig = {
Show_HighThreat_Warning = "ShowHighThreat",
Show_Survivor_Warning = "ShowSurvivorWarning"
}
function CommonMonsterWarningCtrl:Awake()
self:SetObjDeactive()
end
function CommonMonsterWarningCtrl:ShowHighThreat()
self._mapNode.HighThreat:SetActive(true)
WwiseAudioMgr:PlaySound("ui_bossRank_warning_lv3")
EventManager.Hit("RegionBoss_CloseTime")
local waitCallback = function()
self:SetObjDeactive()
EventManager.Hit("RegionBoss_StartTime")
WwiseAudioMgr:PlaySound("ui_bossRank_warning_stop")
end
self:AddTimer(1, 4, waitCallback, true, true, true, nil)
end
function CommonMonsterWarningCtrl:ShowSurvivorWarning(index)
if index == 1 then
self._mapNode.Boss:SetActive(true)
WwiseAudioMgr:PlaySound("ui_vampire_warning_lv3")
elseif index == 2 then
self._mapNode.Elite:SetActive(true)
WwiseAudioMgr:PlaySound("ui_vampire_warning_lv2")
elseif index < 0 then
self._mapNode.TravelTeam:SetActive(true)
WwiseAudioMgr:PlaySound("ui_vampire_warning_lv1")
end
local waitCallback = function()
self:SetObjDeactive()
WwiseAudioMgr:PlaySound("ui_vampire_warning_stop")
end
self:AddTimer(1, 4, waitCallback, true, true, true, nil)
end
function CommonMonsterWarningCtrl:SetObjDeactive()
self._mapNode.HighThreat:SetActive(false)
self._mapNode.Boss:SetActive(false)
self._mapNode.Elite:SetActive(false)
self._mapNode.TravelTeam:SetActive(false)
end
return CommonMonsterWarningCtrl
@@ -0,0 +1,68 @@
local DailyInstanceBattlePanel = class("DailyInstanceBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
DailyInstanceBattlePanel.OpenMinMap = true
DailyInstanceBattlePanel._bAddToBackHistory = false
DailyInstanceBattlePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "DailyInstanceBattlePanel/DailyInstanceInfo.prefab",
sCtrlName = "Game.UI.DailyInstanceRoomInfo.DailyInstanceRoomInfoCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/CommonBattlePausePanel.prefab",
sCtrlName = "Game.UI.DailyInstanceRoomInfo.DailyInstancePauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function DailyInstanceBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.DailyInstance
end
function DailyInstanceBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function DailyInstanceBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function DailyInstanceBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return DailyInstanceBattlePanel
@@ -0,0 +1,68 @@
local EquipmentInstanceBattlePanel = class("EquipmentInstanceBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
EquipmentInstanceBattlePanel.OpenMinMap = true
EquipmentInstanceBattlePanel._bAddToBackHistory = false
EquipmentInstanceBattlePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "EquipmentInstanceBattlePanel/EquipmentInstanceInfo.prefab",
sCtrlName = "Game.UI.EquipmentInstanceRoomInfo.EquipmentInstanceRoomInfoCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/CommonBattlePausePanel.prefab",
sCtrlName = "Game.UI.EquipmentInstanceRoomInfo.EquipmentInstancePauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function EquipmentInstanceBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.EquipmentInstance
end
function EquipmentInstanceBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function EquipmentInstanceBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function EquipmentInstanceBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return EquipmentInstanceBattlePanel
+55
View File
@@ -0,0 +1,55 @@
local InfinityAutoCtrl = class("InfinityAutoCtrl", BaseCtrl)
InfinityAutoCtrl._mapNodeConfig = {
btnAutoLevel = {
sComponentName = "UIButton",
callback = "OnClick_AutoLevel"
},
texAutoLevel = {
sComponentName = "TMP_Text",
sLanguageId = "Auto_Overlayer"
},
AutoLevelOpen = {},
AutoLevelClose = {},
btnAutoLevelAin = {
sNodeName = "btnAutoLevel",
sComponentName = "Animator"
}
}
InfinityAutoCtrl._mapEventConfig = {
InputEnable = "OnEvent_InputEnable"
}
function InfinityAutoCtrl:OnEnable()
self.isAuto = PlayerData.InfinityTower:GetAutoNextLv()
self._mapNode.AutoLevelOpen:SetActive(self.isAuto)
self._mapNode.AutoLevelClose:SetActive(not self.isAuto)
end
function InfinityAutoCtrl:OnClick_AutoLevel()
self.isAuto = not self.isAuto
self._mapNode.AutoLevelOpen:SetActive(self.isAuto)
self._mapNode.AutoLevelClose:SetActive(not self.isAuto)
PlayerData.InfinityTower:SetAutoNextLv(self.isAuto)
end
function InfinityAutoCtrl:SetAutoLevelState(isAuto)
self.isAuto = isAuto
self._mapNode.AutoLevelOpen:SetActive(self.isAuto)
self._mapNode.AutoLevelClose:SetActive(not self.isAuto)
end
function InfinityAutoCtrl:OnEvent_InputEnable(bEnable)
self.gameObject.transform.localScale = bEnable and Vector3.one or Vector3.zero
end
function InfinityAutoCtrl:PlayAin(isIn)
if self.isAutoTime then
self.isAutoTime:Cancel(false)
self.isAutoTime = nil
end
if isIn then
self._mapNode.btnAutoLevelAin:Play("InfinityAutoPanel_in")
else
self._mapNode.btnAutoLevelAin:Play("InfinityAutoPanel_out")
self.isAutoTime = self:AddTimer(1, 0.4, function()
self.gameObject:SetActive(false)
self.isAutoTime = nil
end, true, true, true)
end
end
return InfinityAutoCtrl
@@ -0,0 +1,67 @@
local InfinityTowerBattlePanel = class("InfinityTowerBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
InfinityTowerBattlePanel.OpenMinMap = true
InfinityTowerBattlePanel._bAddToBackHistory = false
InfinityTowerBattlePanel._tbDefine = {
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "InfinityTower/InfinityTowerBattleMsg.prefab",
sCtrlName = "Game.UI.InfinityTower.InfinityTowerBattleMsgCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
},
{
sPrefabPath = "InfinityTower/InfinityTowerPause.prefab",
sCtrlName = "Game.UI.InfinityTower.InfinityTowerPauseCtrl"
},
{
sPrefabPath = "InfinityTower/InfinityTowerBattleResultPanel.prefab",
sCtrlName = "Game.UI.InfinityTower.InfinityTowerBattleResultCtrl"
},
{
sPrefabPath = "InfinityTower/InfinityTowerBountyUp.prefab",
sCtrlName = "Game.UI.InfinityTower.InfinityTowerBountyUp"
}
}
function InfinityTowerBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.InfinityTower
end
function InfinityTowerBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function InfinityTowerBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function InfinityTowerBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return InfinityTowerBattlePanel
@@ -0,0 +1,73 @@
local JointDrillBattlePanel = class("JointDrillBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
JointDrillBattlePanel.OpenMinMap = true
JointDrillBattlePanel._bAddToBackHistory = false
JointDrillBattlePanel._tbDefine = {
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Play_JointDrill/JointDrillMenu.prefab",
sCtrlName = "Game.UI.JointDrill.JointDrillMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
},
{
sPrefabPath = "Battle/CommonMonsterWarning.prefab",
sCtrlName = "Game.UI.Battle.CommonMonsterWarningCtrl"
},
{
sPrefabPath = "Play_JointDrill/JointDrillBossTime.prefab",
sCtrlName = "Game.UI.JointDrill.JintDrillTimeCtrl"
},
{
sPrefabPath = "Play_JointDrill/JointDrillPausePanel.prefab",
sCtrlName = "Game.UI.JointDrill.JointDrillPauseCtrl"
}
}
function JointDrillBattlePanel:Awake()
self.BattleType = GameEnum.worldLevelType.Dynamic
self.DynamicType = GameEnum.dynamicLevelType.JointDrill
self.trUIRoot = GameObject.Find("---- UI ----").transform
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.tbTeam = self._tbParam[1]
self.nLevelId = self._tbParam[2]
self.mapCharData = {}
for _, nCharId in ipairs(self.tbTeam) do
self.mapCharData[nCharId] = clone(PlayerData.Char:GetCharDataByTid(nCharId))
end
end
function JointDrillBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
end
cs_coroutine.start(wait)
end
function JointDrillBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function JointDrillBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return JointDrillBattlePanel
@@ -0,0 +1,52 @@
local JumpOverTimeLineCtrl = class("JumpOverTimeLineCtrl", BaseCtrl)
local AdventureModuleHelper = CS.AdventureModuleHelper
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
JumpOverTimeLineCtrl._mapNodeConfig = {
btn_JumpOver = {
sComponentName = "NaviButton",
callback = "OnClickJump",
sAction = "Skip"
}
}
JumpOverTimeLineCtrl._mapEventConfig = {
CloseJumpOverTimeLine = "OnEvent_CloseJumpOverTimeLine"
}
function JumpOverTimeLineCtrl:Awake()
end
function JumpOverTimeLineCtrl:OnEnable()
EventManager.Hit("FirstInputEnable")
GamepadUIManager.EnableGamepadUI("JumpOverTimeLineCtrl", self:GetGamepadUINode())
end
function JumpOverTimeLineCtrl:OnDisable()
end
function JumpOverTimeLineCtrl:OnDestroy()
end
function JumpOverTimeLineCtrl:OnClickJump()
WwiseAudioMgr:PostEvent("char_common_all_pause")
WwiseAudioMgr:PostEvent("mon_common_all_pause")
local confirmCallback = function()
WwiseAudioMgr:PostEvent("char_common_all_stop")
WwiseAudioMgr:PostEvent("mon_common_all_stop")
AdventureModuleHelper.StopPlayableDirector()
end
local cancelCallback = function()
WwiseAudioMgr:PostEvent("char_common_all_resume")
WwiseAudioMgr:PostEvent("mon_common_all_resume")
AdventureModuleHelper.PausePlayableDirector(false)
end
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = ConfigTable.GetUIText("JumpOverTimeLine_Tips"),
callbackConfirm = confirmCallback,
callbackCancel = cancelCallback
}
EventManager.Hit(EventId.OpenMessageBox, msg)
AdventureModuleHelper.PausePlayableDirector(true)
end
function JumpOverTimeLineCtrl:OnEvent_CloseJumpOverTimeLine()
EventManager.Hit(EventId.BattleDashboardVisible, true)
GamepadUIManager.DisableGamepadUI("JumpOverTimeLineCtrl")
self.gameObject:SetActive(false)
end
return JumpOverTimeLineCtrl
+58
View File
@@ -0,0 +1,58 @@
local JumpTimelineCtrl = class("JumpTimelineCtrl", BaseCtrl)
local AdventureModuleHelper = CS.AdventureModuleHelper
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
JumpTimelineCtrl._mapNodeConfig = {
btn_JumpOver = {
sComponentName = "NaviButton",
callback = "OnClickJump",
sAction = "Skip"
}
}
JumpTimelineCtrl._mapEventConfig = {
CloseJumpOverTimeLine = "OnEvent_CloseJumpOverTimeLine"
}
function JumpTimelineCtrl:Awake()
self.gameObject:SetActive(false)
end
function JumpTimelineCtrl:OnEnable()
end
function JumpTimelineCtrl:OpenUI()
EventManager.Hit("FirstInputEnable")
self.gameObject:SetActive(true)
GamepadUIManager.EnableGamepadUI("JumpTimelineCtrl", self:GetGamepadUINode())
end
function JumpTimelineCtrl:CloseUI()
GamepadUIManager.DisableGamepadUI("JumpTimelineCtrl")
self.gameObject:SetActive(false)
end
function JumpTimelineCtrl:OnDisable()
end
function JumpTimelineCtrl:OnDestroy()
end
function JumpTimelineCtrl:OnClickJump()
WwiseAudioMgr:PostEvent("char_common_all_pause")
WwiseAudioMgr:PostEvent("mon_common_all_pause")
AdventureModuleHelper.PausePerformTimeline()
AdventureModuleHelper.PauseLogic()
local confirmCallback = function()
WwiseAudioMgr:PostEvent("char_common_all_stop")
WwiseAudioMgr:PostEvent("mon_common_all_stop")
AdventureModuleHelper.StopPerformTimeline()
AdventureModuleHelper.ResumeLogic()
end
local cancelCallback = function()
WwiseAudioMgr:PostEvent("char_common_all_resume")
WwiseAudioMgr:PostEvent("mon_common_all_resume")
AdventureModuleHelper.ResumePerformTimeline()
AdventureModuleHelper.ResumeLogic()
end
local msg = {
nType = AllEnum.MessageBox.Confirm,
sContent = ConfigTable.GetUIText("JumpOverTimeLine_Tips"),
callbackConfirm = confirmCallback,
callbackCancel = cancelCallback
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
return JumpTimelineCtrl
+93
View File
@@ -0,0 +1,93 @@
local AdventureModuleHelper = CS.AdventureModuleHelper
local LocalData = require("GameCore.Data.LocalData")
local MainBattleCtrl = class("MainBattleCtrl", BaseCtrl)
MainBattleCtrl._mapNodeConfig = {
BossHUDPanel = {
sNodeName = "BossHUDPanel",
sCtrlName = "Game.UI.Battle.BossPanelCtrl"
},
CinemaModePanel = {
sNodeName = "CinemaModePanel",
sCtrlName = "Game.UI.Battle.CinemaModeCtrl"
},
PopupTipsPanel = {
sNodeName = "PopupTipsPanel",
sCtrlName = "Game.UI.Battle.TipsPanelCtrl"
},
JumpTimelinePanel = {
sNodeName = "JumpTimelinePanel",
sCtrlName = "Game.UI.Battle.JumpTimelineCtrl"
},
AutoBattlePanel = {
sNodeName = "AutoBattlePanel",
sCtrlName = "Game.UI.Battle.AutoBattleCtrl"
},
InfinityAutoPanel = {
sNodeName = "InfinityAutoPanel",
sCtrlName = "Game.UI.Battle.InfinityAutoCtrl"
}
}
MainBattleCtrl._mapEventConfig = {
OpenCinema = "OnEvent_OpenCinema",
CloseCinema = "OnEvent_CloseCinema",
OpenTipsPanel = "OnEvent_OpenTips",
ShowJumpTimeline = "OnEvent_ShowJumpTimeline",
HideJumpTimeline = "OnEvent_HideJumpTimeline",
ChangeAutoBattleState = "OnEvent_ChangeAutoBattleState",
ChangeAutoBattleStateClose = "OnEvent_ChangeAutoBattleStateClose"
}
function MainBattleCtrl:Awake()
end
function MainBattleCtrl:OnEnable()
self._mapNode.PopupTipsPanel.gameObject:SetActive(false)
self.battleType = self._panel.BattleType == nil and GameEnum.worldLevelType.Mainline or self._panel.BattleType
self.dynamicType = self._panel.DynamicType
self._mapNode.AutoBattlePanel:SetBattleType(self.battleType, self.dynamicType)
if self.battleType == GameEnum.worldLevelType.InfinityTower then
local sKey = "PlayerAutoBattleState" .. self.battleType
local sData = LocalData.GetPlayerLocalData(sKey)
local nState = tonumber(sData == nil and "0" or sData)
self._mapNode.InfinityAutoPanel.gameObject:SetActive(nState == 1)
end
end
function MainBattleCtrl:OnDisable()
end
function MainBattleCtrl:OnDestroy()
end
function MainBattleCtrl:SetBattleType(nType)
end
function MainBattleCtrl:OnEvent_OpenCinema()
self._mapNode.CinemaModePanel:OpenUI()
end
function MainBattleCtrl:OnEvent_CloseCinema()
self._mapNode.CinemaModePanel:CloseUI()
end
function MainBattleCtrl:OnEvent_ShowJumpTimeline()
self._mapNode.JumpTimelinePanel:OpenUI()
end
function MainBattleCtrl:OnEvent_HideJumpTimeline()
self._mapNode.JumpTimelinePanel:CloseUI()
end
function MainBattleCtrl:OnEvent_OpenTips(sTip)
self._mapNode.PopupTipsPanel.gameObject:SetActive(true)
self._mapNode.PopupTipsPanel:OpenUI(sTip)
end
function MainBattleCtrl:OnEvent_ChangeAutoBattleState(isAuto)
if self.battleType == GameEnum.worldLevelType.InfinityTower then
if isAuto then
self._mapNode.InfinityAutoPanel.gameObject:SetActive(true)
self._mapNode.InfinityAutoPanel:PlayAin(true)
else
PlayerData.InfinityTower:SetAutoNextLv(false)
self._mapNode.InfinityAutoPanel:SetAutoLevelState(false)
self._mapNode.InfinityAutoPanel:PlayAin(false)
end
end
end
function MainBattleCtrl:OnEvent_ChangeAutoBattleStateClose()
if self.battleType == GameEnum.worldLevelType.InfinityTower then
PlayerData.InfinityTower:SetAutoNextLv(false)
self._mapNode.InfinityAutoPanel:SetAutoLevelState(false)
end
end
return MainBattleCtrl
+84
View File
@@ -0,0 +1,84 @@
local MainBattleMenuCtrl = class("MainBattleMenuCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local AdventureModuleHelper = CS.AdventureModuleHelper
MainBattleMenuCtrl._mapNodeConfig = {
canvas_group = {
sComponentName = "CanvasGroup"
},
trMiniMapBg = {sComponentName = "Transform"},
btnMiniMap = {
sComponentName = "ButtonEx",
callback = "OnBtn_MiniMap"
},
rawImgMiniMap = {sComponentName = "RawImage"},
btnPause = {
sComponentName = "NaviButton",
callback = "OnBtn_Pause"
},
btnFullMap = {
sComponentName = "ButtonEx",
callback = "OnBtn_FullMap"
},
trFullMap = {sNodeName = "btnFullMap", sComponentName = "Transform"},
rawImgFullMap = {sComponentName = "RawImage"}
}
MainBattleMenuCtrl._mapEventConfig = {
InputEnable = "OnEvent_InputEnable",
MainBattleMenuBtnPauseActive = "OnEvent_MainBattleMenuBtnPauseActive",
RegionBoss_Success = "OnEvent_RegionBossSuccess",
Region_Boss_PlayerDied = "OnEvent_RegionBossPlayerDied"
}
local bOpenMiniMap = false
function MainBattleMenuCtrl:OnEnable()
if bOpenMiniMap == true then
AdventureModuleHelper.SetMiniMapFeatureActive(true)
self._mapNode.trMiniMapBg.localScale = Vector3.one
self._mapNode.trFullMap.localScale = Vector3.zero
NovaAPI.SetTexture(self._mapNode.rawImgMiniMap, AdventureModuleHelper.GetMiniMapRenderTexture())
NovaAPI.SetTexture(self._mapNode.rawImgFullMap, AdventureModuleHelper.GetMapRenderTexture())
AdventureModuleHelper.SetMapCameraActive(false)
end
GamepadUIManager.AddGamepadUINode("BattleMenu", self:GetGamepadUINode())
end
function MainBattleMenuCtrl:OnDisable()
if bOpenMiniMap == true then
NovaAPI.SetTexture(self._mapNode.rawImgMiniMap, nil)
NovaAPI.SetTexture(self._mapNode.rawImgFullMap, nil)
end
end
function MainBattleMenuCtrl:OnBtn_Pause()
EventManager.Hit("BattlePause")
EventManager.Hit(EventId.PasueAvgBubble, true)
end
function MainBattleMenuCtrl:OnBtn_MiniMap()
if bOpenMiniMap == true then
EventManager.Hit(EventId.BattleDashboardVisible, false)
self._mapNode.trMiniMapBg.localScale = Vector3.zero
self._mapNode.trFullMap.localScale = Vector3.one
AdventureModuleHelper.SetMapCameraActive(true)
end
end
function MainBattleMenuCtrl:OnBtn_FullMap()
if bOpenMiniMap == true then
EventManager.Hit(EventId.BattleDashboardVisible, true)
self._mapNode.trMiniMapBg.localScale = Vector3.one
self._mapNode.trFullMap.localScale = Vector3.zero
AdventureModuleHelper.SetMapCameraActive(false)
end
end
function MainBattleMenuCtrl:OnEvent_InputEnable(bEnable)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvas_group, bEnable == true and 1 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.canvas_group, bEnable == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.canvas_group, bEnable == true)
self._mapNode.btnPause.interactable = bEnable == true
end
function MainBattleMenuCtrl:OnEvent_MainBattleMenuBtnPauseActive(bActive)
self._mapNode.btnPause.gameObject:SetActive(bActive)
end
function MainBattleMenuCtrl:OnEvent_RegionBossSuccess()
self._mapNode.btnPause.gameObject:SetActive(false)
end
function MainBattleMenuCtrl:OnEvent_RegionBossPlayerDied()
self._mapNode.btnPause.gameObject:SetActive(false)
end
return MainBattleMenuCtrl
+60
View File
@@ -0,0 +1,60 @@
local MainBattlePanel = class("MainBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MainBattlePanel.OpenMinMap = true
MainBattlePanel._bAddToBackHistory = false
MainBattlePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function MainBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.Mainline
end
function MainBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function MainBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function MainBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return MainBattlePanel
+221
View File
@@ -0,0 +1,221 @@
local MainBattlePauseCtrl = class("MainBattlePauseCtrl", BaseCtrl)
local GameCameraStackManager = CS.GameCameraStackManager.Instance
local AdventureModuleHelper = CS.AdventureModuleHelper
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
MainBattlePauseCtrl._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"
},
txtSubTitle3 = {
sComponentName = "TMP_Text",
sLanguageId = "MainBattle_Time"
},
txtAim1 = {sComponentName = "TMP_Text"},
txtTime = {sComponentName = "TMP_Text"},
txtLeader = {
sComponentName = "TMP_Text",
sLanguageId = "Build_Leader"
},
txtSub = {
nCount = 2,
sComponentName = "TMP_Text",
sLanguageId = "Build_Sub"
}
}
MainBattlePauseCtrl._mapEventConfig = {
Mainline_Time_CountUp = "OnEvent_Time",
GamepadUIReopen = "OnEvent_Reopen"
}
function MainBattlePauseCtrl:Refresh(sAim)
NovaAPI.SetTMPText(self._mapNode.txtAim1, sAim)
for i = 1, 3 do
self._mapNode.goChar[i].gameObject:SetActive(self.tbChar[i])
if self.tbChar[i] then
self._mapNode.goChar[i]:SetChar(self.tbChar[i].nTid, false, false, self.tbChar[i].nTrialId)
end
end
end
function MainBattlePauseCtrl: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 MainBattlePauseCtrl: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 MainBattlePauseCtrl:OnPanelClose(_, bGiveUp)
PanelManager.InputEnable()
GamepadUIManager.DisableGamepadUI("MainBattlePauseCtrl")
EventManager.Hit(EventId.BattleDashboardVisible, true)
self._mapNode.safeAreaRoot:SetActive(false)
self._mapNode.goBlur:SetActive(false)
self._mapNode.imgBlocker:SetActive(false)
EventManager.Hit(EventId.ClosePanel, PanelId.MainBattlePause)
if bGiveUp then
EventManager.Hit(EventId.AbandonBattle)
else
EventManager.Hit(EventId.PasueAvgBubble, false)
end
end
function MainBattlePauseCtrl:Awake()
self._mapNode.safeAreaRoot:SetActive(false)
local tbConfig = {
{
sAction = "Skill",
sLang = "StarTowerMap_Btn_Skill"
},
{
sAction = "Settings",
sLang = "StarTowerMap_Btn_Settings"
}
}
self._mapNode.ActionBar:InitActionBar(tbConfig)
end
function MainBattlePauseCtrl:OnEnable()
self:Pause()
end
function MainBattlePauseCtrl:OnDisable()
end
function MainBattlePauseCtrl:OnDestroy()
end
function MainBattlePauseCtrl:Pause()
local tbParam = self:GetPanelParam()
local nTime = 0
local sAim = ""
if type(tbParam) == "table" then
nTime = tbParam[1]
self.tbChar = tbParam[2]
sAim = tbParam[3]
end
EventManager.Hit(EventId.BattleDashboardVisible, false)
PanelManager.InputDisable()
self:PlayInAni()
self:Refresh(sAim)
self:OnEvent_Time(nTime)
GamepadUIManager.EnableGamepadUI("MainBattlePauseCtrl", self:GetGamepadUINode())
end
function MainBattlePauseCtrl: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 MainBattlePauseCtrl:OnBtnClick_GiveUp(btn)
self:PlayCloseAni(true)
self._mapNode.imgBlocker:SetActive(true)
end
function MainBattlePauseCtrl:OnBtnClick_Close(btn)
self:PlayCloseAni(false)
end
function MainBattlePauseCtrl:OnBtnClick_Char(btn, nIndex)
end
function MainBattlePauseCtrl:OnBtnClick_Skill(btn)
local tbCharId, tbTrial = {}, {}
for _, v in ipairs(self.tbChar) do
table.insert(tbCharId, v.nTid)
if v.nTrialId then
table.insert(tbTrial, v.nTrialId)
end
end
EventManager.Hit(EventId.OpenPanel, PanelId.PopupSkillPanel, tbCharId, false, tbTrial)
self._mapNode.ActionBar.gameObject:SetActive(false)
end
function MainBattlePauseCtrl:OnBtnClick_Settings(btn)
EventManager.Hit(EventId.OpenPanel, PanelId.BattleSettings)
self._mapNode.ActionBar.gameObject:SetActive(false)
end
function MainBattlePauseCtrl:OnEvent_Reopen(sName)
if sName ~= "MainBattlePauseCtrl" then
return
end
self._mapNode.ActionBar.gameObject:SetActive(true)
end
return MainBattlePauseCtrl
@@ -0,0 +1,17 @@
local MainBattlePausePanel = class("MainBattlePausePanel", BasePanel)
MainBattlePausePanel._bIsMainPanel = false
MainBattlePausePanel._tbDefine = {
{
sPrefabPath = "Battle/MainBattlePausePanel.prefab",
sCtrlName = "Game.UI.Battle.MainBattlePauseCtrl"
}
}
function MainBattlePausePanel:Awake()
end
function MainBattlePausePanel:OnEnable()
end
function MainBattlePausePanel:OnDisable()
end
function MainBattlePausePanel:OnDestroy()
end
return MainBattlePausePanel
@@ -0,0 +1,55 @@
local PrologueAdventurePanel = class("PrologueAdventurePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
PrologueAdventurePanel.OpenMinMap = true
PrologueAdventurePanel._bAddToBackHistory = false
PrologueAdventurePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function PrologueAdventurePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.PrologueBattleLevel
end
function PrologueAdventurePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function PrologueAdventurePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function PrologueAdventurePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return PrologueAdventurePanel
+113
View File
@@ -0,0 +1,113 @@
local PrologueCtrl = class("PrologueCtrl", BaseCtrl)
local ConfigData = require("GameCore.Data.ConfigData")
local PlayerCharData = PlayerData.Char
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResType = GameResourceLoader.ResType
local AdventureModuleHelper = CS.AdventureModuleHelper
local InteractiveManagerIns = CS.InteractiveManager.Instance
PrologueCtrl._mapNodeConfig = {
cgRoot = {
sNodeName = "--safe_area--",
sComponentName = "CanvasGroup"
},
btnHand = {
sComponentName = "ButtonEx",
callback = "OnBtn_ClickHand"
},
trHand = {sNodeName = "btnHand", sComponentName = "Transform"},
imgHandIcon = {sComponentName = "Image"},
tmpInteract = {nCount = 2, sComponentName = "TMP_Text"},
animBtnHand = {sNodeName = "btnHand", sComponentName = "Animator"},
goJoystick = {
sNodeName = "--joystick--"
},
rtJoystick = {
sNodeName = "--joystick--",
sComponentName = "RectTransform"
},
cgJoystick = {
sNodeName = "--joystick--",
sComponentName = "CanvasGroup"
}
}
PrologueCtrl._mapEventConfig = {
InputEnable = "OnEvent_InputEnable",
interactiveUI = "OnUIInfoShow",
InteractiveEnable = "OnBtn_ClickHand",
FadeIn = "OnFadeIn"
}
function PrologueCtrl:Awake()
self.tbDefine_FunctionBtn = {
[1] = {
sName = "Interactive",
nHoldThreshold = 0.1
}
}
NovaAPI.RegisterVirtualJoystick("Horizontal", "Vertical", self._mapNode.goJoystick)
local nW = math.floor(Settings.CURRENT_CANVAS_FULL_RECT_WIDTH)
local nH = math.floor(Settings.CURRENT_CANVAS_FULL_RECT_HEIGHT)
self._mapNode.rtJoystick.sizeDelta = Vector2(nW / 2, nH * 2 / 3)
for nIndex, v in ipairs(self.tbDefine_FunctionBtn) do
NovaAPI.RegisterRealButton(v.sName, v.nHoldThreshold)
end
self:SetVisible(false)
self._mapNode.trHand.localScale = Vector3.zero
end
function PrologueCtrl:OnPreExit()
NovaAPI.UnRegisterVirtualJoystick("Horizontal", "Vertical")
for nIndex, v in ipairs(self.tbDefine_FunctionBtn) do
NovaAPI.UnRegisterRealButton(v.sName)
end
end
function PrologueCtrl:OnDestroy()
end
function PrologueCtrl:OnFadeIn()
end
function PrologueCtrl:OnEvent_InputEnable(bEnable)
self:SetVisible(bEnable == true)
end
function PrologueCtrl:SetVisible(bVisible)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.cgRoot, bVisible == true and 1 or 0)
NovaAPI.SetCanvasGroupInteractable(self._mapNode.cgRoot, bVisible == true)
NovaAPI.SetCanvasGroupBlocksRaycasts(self._mapNode.cgRoot, bVisible == true)
end
function PrologueCtrl:OnBtn_ClickHand(btn)
if self.bInteractiveInCD == true then
return
end
if self.bShowUI ~= true then
return
end
printLog("发送时交互id" .. tostring(self.nInteractiveId))
local bSuccess = safe_call_cs_func(InteractiveManagerIns.setInteractiveObjState, InteractiveManagerIns, self.nInteractiveId)
self._mapNode.trHand.localScale = bSuccess == true and Vector3.zero or Vector3.one
self.bInteractiveInCD = true
self._mapNode.btnHand.interactable = false
self:AddTimer(1, 0.2, "SetBtnHandInteractable", true, true, true)
end
function PrologueCtrl:SetBtnHandInteractable()
self.bInteractiveInCD = false
self._mapNode.btnHand.interactable = true
end
function PrologueCtrl:OnUIInfoShow(nInteractiveId, bShowUI, sIcon, sText, nDuration)
if bShowUI ~= true and self.nInteractiveId ~= nInteractiveId then
return
end
printLog("交互id" .. tostring(nInteractiveId))
self.nInteractiveId = nInteractiveId
self.bShowUI = bShowUI
if self.bInteractiveInCD ~= true then
self._mapNode.btnHand.interactable = true
end
if self._mapNode.trHand.localScale.x == 0 and bShowUI == true then
self._mapNode.animBtnHand:SetTrigger("tPlay")
end
self._mapNode.trHand.localScale = bShowUI == true and Vector3.one or Vector3.zero
NovaAPI.SetTMPText(self._mapNode.tmpInteract[1], sText)
NovaAPI.SetTMPText(self._mapNode.tmpInteract[2], sText)
if type(sIcon) == "string" and sIcon ~= "" then
self:SetPngSprite(self._mapNode.imgHandIcon, sIcon)
NovaAPI.SetImageNativeSize(self._mapNode.imgHandIcon)
end
end
return PrologueCtrl
+20
View File
@@ -0,0 +1,20 @@
local ProloguePanel = class("ProloguePanel", BasePanel)
ProloguePanel.OpenMinMap = false
ProloguePanel._bAddToBackHistory = false
ProloguePanel._tbDefine = {
{
sPrefabPath = "Battle/ProloguePanel.prefab",
sCtrlName = "Game.UI.Battle.PrologueCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
}
}
function ProloguePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
end
cs_coroutine.start(wait)
end
return ProloguePanel
@@ -0,0 +1,64 @@
local RegionBossBattlePanel = class("RegionBossBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
RegionBossBattlePanel.OpenMinMap = true
RegionBossBattlePanel._bAddToBackHistory = false
RegionBossBattlePanel._tbDefine = {
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "RegionBossTimeEx/RegionBossTime.prefab",
sCtrlName = "Game.UI.RegionBossTimeEx.RegionBossTimeCtrl"
},
{
sPrefabPath = "Battle/CommonMonsterWarning.prefab",
sCtrlName = "Game.UI.Battle.CommonMonsterWarningCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/CommonBattlePausePanel.prefab",
sCtrlName = "Game.UI.RegionBossTimeEx.RegionBossPauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function RegionBossBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.RegionBoss
end
function RegionBossBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function RegionBossBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function RegionBossBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return RegionBossBattlePanel
@@ -0,0 +1,60 @@
local ScoreBossBattlePanel = class("ScoreBossBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
ScoreBossBattlePanel.OpenMinMap = true
ScoreBossBattlePanel._bAddToBackHistory = false
ScoreBossBattlePanel._tbDefine = {
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Play_ScoreBoss/ScoreBossLevelInfo.prefab",
sCtrlName = "Game.UI.ScoreBoss.ScoreBossLevelInfoCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Play_ScoreBoss/ScoreBossPausePanel.prefab",
sCtrlName = "Game.UI.ScoreBoss.ScoreBossPauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function ScoreBossBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.ScoreBoss
end
function ScoreBossBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function ScoreBossBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function ScoreBossBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return ScoreBossBattlePanel
@@ -0,0 +1,74 @@
local SkillActionIconCtrl = class("SkillActionIconCtrl", BaseCtrl)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
local MouseName = {
leftButton = 1,
rightButton = 2,
middleButton = 3,
backButton = 4,
forwardButton = 5
}
local ImageKey = {backspace = 1, enter = 2}
SkillActionIconCtrl._mapNodeConfig = {
Keyboard = {},
goKey = {},
imgKeyboard = {sComponentName = "Image"},
txtKeyboard = {sComponentName = "TMP_Text"},
Mouse = {},
imgMouse = {sComponentName = "Image"},
Gamepad = {},
imgGamepad = {sComponentName = "Image"},
KeyNone = {}
}
SkillActionIconCtrl._mapEventConfig = {
GamepadUIChange = "OnEvent_GamepadUIChange"
}
function SkillActionIconCtrl:Awake()
self.bMobile = NovaAPI.IsMobilePlatform()
end
function SkillActionIconCtrl:SetActionBind(sGamepadBind, mapKeyboardBind)
self.sGamepadBind = sGamepadBind
self.mapKeyboardBind = mapKeyboardBind
self:RefreshActionBind()
end
function SkillActionIconCtrl:RefreshActionBind()
local nUIType = GamepadUIManager.GetCurUIType()
self._mapNode.KeyNone:SetActive(false)
self._mapNode.Gamepad:SetActive(nUIType == AllEnum.GamepadUIType.PS or nUIType == AllEnum.GamepadUIType.Xbox)
self._mapNode.Keyboard:SetActive((nUIType == AllEnum.GamepadUIType.Other or nUIType == AllEnum.GamepadUIType.Keyboard or nUIType == AllEnum.GamepadUIType.Mouse) and not self.bMobile and not MouseName[self.mapKeyboardBind.name])
self._mapNode.Mouse:SetActive((nUIType == AllEnum.GamepadUIType.Other or nUIType == AllEnum.GamepadUIType.Keyboard or nUIType == AllEnum.GamepadUIType.Mouse) and not self.bMobile and MouseName[self.mapKeyboardBind.name])
if nUIType == AllEnum.GamepadUIType.Other or nUIType == AllEnum.GamepadUIType.Keyboard or nUIType == AllEnum.GamepadUIType.Mouse then
if not self.bMobile then
if self.mapKeyboardBind.name == "" then
self._mapNode.Keyboard:SetActive(false)
self._mapNode.Mouse:SetActive(false)
self._mapNode.KeyNone:SetActive(true)
elseif MouseName[self.mapKeyboardBind.name] then
local sIcon = ConfigTable.GetField("GamepadButton", self.mapKeyboardBind.name, "XboxIcon")
self:SetPngSprite(self._mapNode.imgMouse, sIcon)
elseif ImageKey[self.mapKeyboardBind.name] then
self._mapNode.imgKeyboard.gameObject:SetActive(true)
self._mapNode.goKey:SetActive(false)
local sIcon = ConfigTable.GetField("GamepadButton", self.mapKeyboardBind.name, "XboxIcon")
self:SetPngSprite(self._mapNode.imgKeyboard, sIcon)
NovaAPI.SetImageNativeSize(self._mapNode.imgKeyboard)
else
self._mapNode.imgKeyboard.gameObject:SetActive(false)
self._mapNode.goKey:SetActive(true)
local sName = GamepadUIManager.GetInputName(self.mapKeyboardBind)
NovaAPI.SetTMPText(self._mapNode.txtKeyboard, sName)
end
end
else
local sIcon
if nUIType == AllEnum.GamepadUIType.PS then
sIcon = ConfigTable.GetField("GamepadButton", self.sGamepadBind, "PlayStationIcon")
elseif nUIType == AllEnum.GamepadUIType.Xbox then
sIcon = ConfigTable.GetField("GamepadButton", self.sGamepadBind, "XboxIcon")
end
self:SetPngSprite(self._mapNode.imgGamepad, sIcon)
end
end
function SkillActionIconCtrl:OnEvent_GamepadUIChange(sName, nBeforeType, nAfterType)
self:RefreshActionBind()
end
return SkillActionIconCtrl
+363
View File
@@ -0,0 +1,363 @@
local SkillBtnCtrl = class("SkillBtnCtrl", BaseCtrl)
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local NormalCDSize = 34
local eftColor = {
[1] = "#00B7FF",
[2] = "#FF587E",
[3] = "#FF902A",
[4] = "#86FF3B",
[5] = "#FFCF00",
[6] = "#F186FF"
}
local SKILL_FLEE = 1
local SKILL_A = 2
local SKILL_B = 3
local SKILL_ULTRA = 4
local BTN_STATE = {
None = 0,
Press = 1,
Click = 2,
Hold = 3,
Cancel = 4
}
SkillBtnCtrl._mapNodeConfig = {
CanvasGroupMain = {
sNodeName = "main",
sComponentName = "CanvasGroup"
},
transformFX = {sNodeName = "FX", sComponentName = "Transform"},
imageFX = {sNodeName = "FX", sComponentName = "Image"},
imageType = {sNodeName = "type", sComponentName = "Image"},
imageFXFire = {sNodeName = "fx_fire", sComponentName = "Image"},
transformQTE = {sNodeName = "QTE", sComponentName = "Transform"},
imageQteLoading = {
sNodeName = "qte_loading",
sComponentName = "Image"
},
ICON = {sComponentName = "Image"},
transformCD = {sNodeName = "CD", sComponentName = "Transform"},
TMP_CD = {sNodeName = "CD_TMP", sComponentName = "TMP_Text"},
transformCharge = {sNodeName = "Charge", sComponentName = "Transform"},
tbTransformRotate = {
sNodeName = "rotate",
nCount = 2,
sComponentName = "Transform"
},
imageChargeLoading = {
sNodeName = "charge_loading",
nCount = 2,
sComponentName = "Image"
},
TMP_Charge = {sNodeName = "Charge_TMP", sComponentName = "TMP_Text"},
fx = {sComponentName = "Image"},
glow = {sComponentName = "Image"},
Charge_Max_glow = {},
transformCharge_glow = {
sNodeName = "Charge_Max_glow",
sComponentName = "Transform"
},
Img_Charge_glow = {
sNodeName = "Charge_Max_glow",
sComponentName = "Image"
},
Transform_ChargeLoading = {
sNodeName = "charge_loading1",
sComponentName = "Transform"
},
transformX = {sNodeName = "X", sComponentName = "Transform"},
fx_tip = {},
transformXcd = {sNodeName = "Xcd", sComponentName = "Transform"},
imgPressed = {sNodeName = "pressed", sComponentName = "Image"},
imgXtips = {sNodeName = "Xtips", sComponentName = "Image"},
Action = {
sCtrlName = "Game.UI.Battle.SkillActionIconCtrl"
},
Empty = {},
Action_Pos = {sComponentName = "Transform"},
Action_Pos_Hor = {sComponentName = "Transform"}
}
SkillBtnCtrl._mapEventConfig = {
Open_Ultra_Special_FX = "OpenUltraSpecialFX",
[EventId.SettingsBattleClose] = "OnEvent_ChangeKeyLayout"
}
function SkillBtnCtrl:Awake()
self.BTN = self.gameObject:GetComponent("ButtonEx")
self.AnimFX = self.gameObject:GetComponent("Animator")
self.tbUltraColor = {
"#69C6F6",
"#FA886E",
"#FFAE67",
"#B0EE50",
"#FACC55",
"#ED78DF"
}
self.bCanUse = true
self.bInCD = false
self.nCDpercent = 0
self.nSectionNum = 0
self.bInCharge = true
self.bCanPlayCDSound = true
self.canFresh = true
self:SetActionLayout()
self:SetCDTextSize()
self._mapNode.fx_tip:SetActive(false)
end
function SkillBtnCtrl:InitSkillBtn(EET, icon, bShowSection, charId, actionId, bIsSupportChar)
self:SetMainAlpha(true)
self.EET = EET
self.ActionId = actionId
self.tmpActionPosId = charId * 10 + self.ActionId
self.bShowSection = bShowSection
self._mapNode.TMP_Charge.gameObject:SetActive(bShowSection)
if 0 < EET then
local _, _color = ColorUtility.TryParseHtmlString(self.tbUltraColor[EET])
local _, _colorFire = ColorUtility.TryParseHtmlString(eftColor[EET])
NovaAPI.SetImageColor(self._mapNode.imageFX, _color)
NovaAPI.SetImageColor(self._mapNode.imageChargeLoading[1], _color)
NovaAPI.SetImageColor(self._mapNode.imageChargeLoading[2], _color)
NovaAPI.SetImageColor(self._mapNode.fx, _color)
NovaAPI.SetImageColor(self._mapNode.glow, _color)
NovaAPI.SetImageColor(self._mapNode.imageFXFire, _colorFire)
NovaAPI.SetImageColor(self._mapNode.Img_Charge_glow, _color)
self:SetAtlasSprite(self._mapNode.imageType, "15_battle", "skill_btn_b_type_" .. tostring(EET))
end
self:SetPngSprite(self._mapNode.ICON, icon)
self._mapNode.transformCharge.localScale = Vector3.zero
self._mapNode.CanvasGroupMain.gameObject:SetActive(true)
self._mapNode.Action.gameObject:SetActive(true)
self._mapNode.Empty:SetActive(false)
self.bIsSupportChar = bIsSupportChar == true
if self.bIsSupportChar == true then
self.parentCanvasGroup = self.gameObject.transform.parent.parent.parent:GetComponent("CanvasGroup")
else
self.parentCanvasGroup = self.gameObject.transform.parent.parent:GetComponent("CanvasGroup")
end
end
function SkillBtnCtrl:SetEmptySkillBtn()
self._mapNode.CanvasGroupMain.gameObject:SetActive(false)
self._mapNode.Action.gameObject:SetActive(false)
self._mapNode.TMP_Charge.gameObject:SetActive(false)
self._mapNode.transformCharge.localScale = Vector3.zero
self._mapNode.Empty:SetActive(true)
end
function SkillBtnCtrl:RefreshBtn(bSuportSkillUseable, QTEpercent, CDpercent, CDsecond, ChargePercent, ChargeSectionNum, nTotalSectionNum, bBeginResume)
if self.canFresh == false then
return
end
local bCanUse = false
if self.ActionId == SKILL_ULTRA then
bCanUse = 1 <= ChargeSectionNum and 1 <= ChargePercent and CDpercent <= 0
else
bCanUse = 1 <= ChargeSectionNum
end
if self.bIsSupportChar == true and bCanUse then
bCanUse = bSuportSkillUseable
end
if self.bShowSection ~= (1 < nTotalSectionNum) then
self.bShowSection = 1 < nTotalSectionNum
self._mapNode.TMP_Charge.gameObject:SetActive(self.bShowSection)
end
local sAnimName, sFxSoundName
if self.bCanUse == true then
if bCanUse == true then
if 1 < nTotalSectionNum and ChargeSectionNum > self.nSectionNum then
if self.ActionId == SKILL_ULTRA then
sAnimName = "BattlecgUltra_in0" .. self.EET
sFxSoundName = "ui_skill_freeze_ultra_ok"
elseif self.ActionId == SKILL_A then
sAnimName = "BattlecgSkill_in0" .. self.EET
sFxSoundName = "ui_skill_freeze_ok"
elseif self.ActionId == SKILL_FLEE then
sAnimName = "BattlecgSkill_in"
end
end
elseif self.ActionId ~= 1 then
NovaAPI.DispatchEventWithData("CHAR_ULTRA_CAN_USE", nil, {
self.tmpActionPosId,
false
})
end
elseif bCanUse == true then
if self.ActionId == SKILL_ULTRA then
sAnimName = "BattlecgUltra_in0" .. self.EET
sFxSoundName = "ui_skill_freeze_ultra_ok"
elseif self.ActionId == SKILL_A then
sAnimName = "BattlecgSkill_in0" .. self.EET
sFxSoundName = "ui_skill_freeze_ok"
elseif self.ActionId == SKILL_FLEE then
sAnimName = "BattlecgSkill_in"
end
if self.ActionId ~= 1 then
NovaAPI.DispatchEventWithData("CHAR_ULTRA_CAN_USE", nil, {
self.tmpActionPosId,
true
})
else
end
end
if sAnimName ~= nil then
self:PlayAnimFX(sAnimName)
end
if sFxSoundName ~= nil and self.gameObject.activeInHierarchy == true and 0 < NovaAPI.GetCanvasGroupAlpha(self.parentCanvasGroup) then
WwiseAudioMgr:PlaySound(sFxSoundName)
end
self.bCanUse = bCanUse
self.nCDpercent = CDpercent
self.nSectionNum = ChargeSectionNum
self:SetMainAlpha(bCanUse)
self:SetQTE(QTEpercent)
if self.ActionId == SKILL_ULTRA or self.bShowSection then
self:SetCharge(ChargePercent, ChargeSectionNum)
end
self:SetCD(CDpercent, CDsecond, bBeginResume)
self:SetFX(self.ActionId == SKILL_ULTRA and 1 <= ChargePercent and not self.bInCD)
end
function SkillBtnCtrl:SetBtnEnable(bEnable)
self.BTN.interactable = bEnable == true
self:SetMainAlpha(bEnable)
end
function SkillBtnCtrl:SetBtnVisible(bVisible)
self.BTN.gameObject:SetActive(bVisible)
end
function SkillBtnCtrl:GetBtnVisible()
return self.BTN.gameObject.activeSelf
end
function SkillBtnCtrl:SetMainAlpha(bCanUse)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.CanvasGroupMain, bCanUse == true and 1 or 0.3)
end
function SkillBtnCtrl:SetFX(bVisible)
self._mapNode.transformFX.localScale = bVisible == true and Vector3.one or Vector3.zero
end
function SkillBtnCtrl:SetQTE(percent)
if self._mapNode.transformQTE.localScale.x < 1 and 0 < percent then
self.AnimFX:Play("BattlecgUltra_Qte_in")
end
self._mapNode.transformQTE.localScale = 0 < percent and Vector3.one or Vector3.zero
NovaAPI.SetImageFillAmount(self._mapNode.imageQteLoading, percent)
end
function SkillBtnCtrl:PlayAnimFX(sAnimName)
self.AnimFX:Play(sAnimName)
end
function SkillBtnCtrl:SetCD(percent, second, bBeginResume)
self.bInCD = 0 < percent
self._mapNode.transformCD.localScale = self.bInCD == true and Vector3.one or Vector3.zero
self._mapNode.transformXcd.localScale = self.bInCD == true and Vector3.one or Vector3.zero
if 1.0 <= second then
NovaAPI.SetTMPSourceText(self._mapNode.TMP_CD, tostring(math.ceil(second)))
else
NovaAPI.SetTMPSourceText(self._mapNode.TMP_CD, string.format("%.1f", second))
end
self._mapNode.TMP_CD.transform.localScale = bBeginResume == true and Vector3.one or Vector3.zero
self._mapNode.Charge_Max_glow:SetActive(self.bInCD and not self.bInCharge)
self._mapNode.Transform_ChargeLoading.gameObject:SetActive(self.bInCD and not self.bInCharge)
end
function SkillBtnCtrl:SetCharge(percent, second)
if second == 0 and self.ActionId ~= SKILL_ULTRA then
self._mapNode.transformCharge.localScale = Vector3.zero
NovaAPI.SetTMPSourceText(self._mapNode.TMP_Charge, "")
return
end
self.bInCharge = percent < 1
self._mapNode.transformCharge.localScale = 0 < percent and percent < 1 and Vector3.one or Vector3.zero
self._mapNode.transformCharge_glow.localScale = self.bInCharge and Vector3.zero or Vector3.one
self._mapNode.Transform_ChargeLoading.localScale = self.bInCharge and Vector3.zero or Vector3.one
local tr1 = self._mapNode.tbTransformRotate[1]
local tr2 = self._mapNode.tbTransformRotate[2]
if 0.02 <= percent and percent < 1 then
local v3 = Vector3(0, 0, -percent * 360)
tr1.localScale = Vector3.one
tr1.localEulerAngles = v3
tr2.localScale = Vector3.one
tr2.localEulerAngles = v3
else
tr1.localScale = Vector3.zero
tr2.localScale = Vector3.zero
end
NovaAPI.SetImageFillAmount(self._mapNode.imageChargeLoading[1], percent)
NovaAPI.SetImageFillAmount(self._mapNode.imageChargeLoading[2], percent)
NovaAPI.SetTMPSourceText(self._mapNode.TMP_Charge, tostring(math.floor(second)))
end
function SkillBtnCtrl:SetForbidden(bForbidden, bAvailable)
self._mapNode.transformX.localScale = bForbidden == true and Vector3.one or Vector3.zero
end
function SkillBtnCtrl:OpenUltraSpecialFX(mTmpActionPosId, isShow)
if self.tmpActionPosId == mTmpActionPosId then
self._mapNode.fx_tip:SetActive(isShow)
end
end
function SkillBtnCtrl:Set_SkillHintActive(bActive)
self._mapNode.transformQTE.localScale = bActive == true and Vector3.one or Vector3.zero
self._mapNode.imageQteLoading.transform.localScale = bActive == true and Vector3.zero or Vector3.one
end
function SkillBtnCtrl:SetSupSkillStateByUltimate(bForbidden)
self._mapNode.transformX.localScale = bForbidden == true and Vector3.one or Vector3.zero
self._mapNode.transformCD.gameObject:SetActive(not bForbidden)
end
function SkillBtnCtrl:GetSupSkillForbidden()
return self._mapNode.transformX.localScale == Vector3.one
end
function SkillBtnCtrl:BtnStateChange(nState)
if nState == BTN_STATE.Cancel then
NovaAPI.SetComponentEnable(self._mapNode.imgPressed, false)
NovaAPI.SetComponentEnable(self._mapNode.imgXtips, false)
elseif nState == BTN_STATE.Press then
NovaAPI.SetComponentEnable(self._mapNode.imgPressed, self.bInCD == false and self.bCanUse == true)
NovaAPI.SetComponentEnable(self._mapNode.imgXtips, self.bInCD == true)
if self.bInCD == true and self.gameObject.activeInHierarchy == true and NovaAPI.GetCanvasGroupAlpha(self.parentCanvasGroup) > 0 and self.bCanPlayCDSound then
WwiseAudioMgr:PlaySound("ui_skill_freeze_click")
self.bCanPlayCDSound = false
self:AddTimer(1, 0.5, function()
self.bCanPlayCDSound = true
end, true, true, true)
end
elseif nState == BTN_STATE.Click then
NovaAPI.SetComponentEnable(self._mapNode.imgPressed, false)
NovaAPI.SetComponentEnable(self._mapNode.imgXtips, false)
elseif nState == BTN_STATE.Hold then
NovaAPI.SetComponentEnable(self._mapNode.imgPressed, self.bInCD == false and self.bCanUse == true)
NovaAPI.SetComponentEnable(self._mapNode.imgXtips, self.bInCD == true)
end
end
function SkillBtnCtrl:SetActionBind(sGamepadBind, mapKeyboardBind)
self._mapNode.Action:SetActionBind(sGamepadBind, mapKeyboardBind)
end
function SkillBtnCtrl:SetActionLayout()
local nType = LocalSettingData.GetLocalSettingData("BattleHUD")
if nType == AllEnum.BattleHudType.Horizontal then
self:SetKeyPos(self._mapNode.Action.gameObject:GetComponent("RectTransform"), self._mapNode.Action_Pos_Hor)
else
self:SetKeyPos(self._mapNode.Action.gameObject:GetComponent("RectTransform"), self._mapNode.Action_Pos)
end
end
function SkillBtnCtrl:SetKeyPos(btnTra, parentTra)
btnTra:SetParent(parentTra)
btnTra.anchoredPosition = Vector2.zero
btnTra.localScale = Vector3.one
end
function SkillBtnCtrl:SetCDTextSize()
local nType = LocalSettingData.GetLocalSettingData("BattleHUD")
if nType == AllEnum.BattleHudType.Horizontal then
self._mapNode.TMP_CD.fontSize = 74
else
local parentTra = self.gameObject.transform.parent
local scale = parentTra.localScale
local size = 1 / scale.x * NormalCDSize
self._mapNode.TMP_CD.fontSize = math.ceil(size)
end
end
function SkillBtnCtrl:SetbtnEnable_Prologuel(bEnable)
self.BTN.interactable = bEnable == true
self.canFresh = bEnable
self:SetMainAlpha(bEnable)
if bEnable == false then
self:SetMainAlpha(false)
self:SetFX(false)
self:SetCD(1, 0, false)
end
end
function SkillBtnCtrl:OnEvent_ChangeKeyLayout()
self:SetActionLayout()
self:SetCDTextSize()
end
return SkillBtnCtrl
@@ -0,0 +1,120 @@
local BossSkillHintIndicator = class("BossSkillHintIndicator", BaseCtrl)
BossSkillHintIndicator._mapNodeConfig = {
ImageIcon = {sComponentName = "Image"},
ImageBossIconBtn = {
sNodeName = "ImageBossIcon",
sComponentName = "Button"
},
ImageBossWarn = {},
ImageArrow = {sComponentName = "Button"}
}
BossSkillHintIndicator._mapEventConfig = {}
function BossSkillHintIndicator:Awake()
self.animtor = self.gameObject:GetComponent("Animator")
self.canvasGroup = self.gameObject:GetComponent("CanvasGroup")
self.nEntityId = nil
end
function BossSkillHintIndicator:FadeIn()
end
function BossSkillHintIndicator:FadeOut()
end
function BossSkillHintIndicator:OnEnable()
end
function BossSkillHintIndicator:OnDisable()
self:UnBindEvent()
end
function BossSkillHintIndicator:OnDestroy()
end
function BossSkillHintIndicator:OnRelease()
end
function BossSkillHintIndicator:SetTarget(nEntityId, nBossSkinId, bHold, fRecycleCallback)
if self.nEntityId ~= nil then
printError("重复绑定")
return
end
self.fRecycleCallback = fRecycleCallback
self.nEntityId = nEntityId
self.bHold = bHold
local mapMonsterSkin = ConfigTable.GetData("MonsterSkin", nBossSkinId)
local previewMonster
if mapMonsterSkin.MonsterManual ~= "" then
previewMonster = ConfigTable.GetData("MonsterManual", mapMonsterSkin.MonsterManual)
end
if self.bHold and previewMonster ~= nil and (previewMonster.Icon ~= nil or previewMonster.Icon ~= "") then
self:SetPngSprite(self._mapNode.ImageIcon, previewMonster.Icon)
else
end
EventManager.AddEntityEvent("AttackHintCancel", self.nEntityId, self, self.OnEvent_SkillCancel)
EventManager.AddEntityEvent("AttackHint", self.nEntityId, self, self.OnEvent_SkillHint)
EventManager.AddEntityEvent("AttackHintEnd", self.nEntityId, self, self.OnEvent_SkillEnd)
EventManager.AddEntityEvent("AttackHintShow", self.nEntityId, self, self.OnEvent_HintShow)
EventManager.AddEntityEvent("AttackHintHide", self.nEntityId, self, self.OnEvent_HintHide)
self._mapNode.ImageBossWarn:SetActive(false)
self.gameObject:SetActive(self.bHold)
self.animtor:Play("TemplateBoss_in")
NovaAPI.SetSkillIndicatorTarget(nEntityId, self.gameObject, Vector3.zero)
end
function BossSkillHintIndicator:UnBindEvent()
if self.nEntityId == nil then
return
end
if self.endTimer ~= nil then
self.endTimer:Cancel()
end
EventManager.RemoveEntityEvent("AttackHintCancel", self.nEntityId, self, self.OnEvent_SkillCancel)
EventManager.RemoveEntityEvent("AttackHint", self.nEntityId, self, self.OnEvent_SkillHint)
EventManager.RemoveEntityEvent("AttackHintEnd", self.nEntityId, self, self.OnEvent_SkillEnd)
EventManager.RemoveEntityEvent("AttackHintShow", self.nEntityId, self, self.OnEvent_HintShow)
EventManager.RemoveEntityEvent("AttackHintHide", self.nEntityId, self, self.OnEvent_HintHide)
if self.fRecycleCallback ~= nil then
self.fRecycleCallback(self.nEntityId, self, self.bHold)
self.fRecycleCallback = nil
end
self.nEntityId = nil
end
function BossSkillHintIndicator:OnEvent_SkillHint()
if self.endTimer ~= nil then
printError("已在技能结束处理中")
return
end
self.gameObject:SetActive(true)
self._mapNode.ImageBossWarn:SetActive(true)
self.animtor:Play("TemplateBoss_Hint")
end
function BossSkillHintIndicator:OnEvent_SkillEnd()
if self.endTimer ~= nil then
printError("已在技能结束处理中")
return
end
self.animtor:Play("TemplateBoss_out_2")
local EndCallBack = function()
self.animtor:Play("TemplateBoss_in_loop")
self._mapNode.ImageBossWarn:SetActive(false)
self.endTimer = nil
end
self.endTimer = self:AddTimer(1, 0.5, EndCallBack, true, true, nil, true)
end
function BossSkillHintIndicator:OnEvent_SkillCancel()
if self.endTimer ~= nil then
self.endTimer:Cancel()
end
if self.bHold then
self.animtor:Play("TemplateBoss_in_loop")
else
self.gameObject:SetActive(false)
end
self._mapNode.ImageBossWarn:SetActive(false)
self.endTimer = nil
end
function BossSkillHintIndicator:OnEvent_HintShow()
local indicatorBase = self.gameObject:GetComponent("IndicatorBase")
indicatorBase:SetLogicHide(false)
end
function BossSkillHintIndicator:OnEvent_HintHide()
local indicatorBase = self.gameObject:GetComponent("IndicatorBase")
indicatorBase:SetLogicHide(true)
end
function BossSkillHintIndicator:MonsterDied()
self:UnBindEvent()
end
return BossSkillHintIndicator
@@ -0,0 +1,121 @@
local HintIndicators = class("HintIndicators", BaseCtrl)
HintIndicators._mapNodeConfig = {
canvas_group = {
sNodeName = "----SafeAreaRoot----",
sComponentName = "CanvasGroup"
},
IndictorArea = {sComponentName = "Transform"},
TemplateBossIndicator = {},
TemplateMonsterIndictor = {}
}
HintIndicators._mapEventConfig = {
MonsterActive = "OnEvent_MonsterActive",
InputEnable = "OnEvent_InputEnable"
}
function HintIndicators:Awake()
self.tbAllIndicators = {}
self.mapActiveIndicator = {}
self.tbPoolBossIndicator = {}
self.tbPoolMonsterIndicator = {}
end
function HintIndicators:FadeIn()
end
function HintIndicators:FadeOut()
end
function HintIndicators:OnEnable()
end
function HintIndicators:OnDisable()
self:ClearAllCtrl()
end
function HintIndicators:OnDestroy()
end
function HintIndicators:OnRelease()
end
function HintIndicators:GetIndicator(bHold)
if not bHold then
if #self.tbPoolMonsterIndicator > 0 then
local mapCtrl = table.remove(self.tbPoolMonsterIndicator)
return mapCtrl
else
local goIndicator = instantiate(self._mapNode.TemplateMonsterIndictor, self._mapNode.IndictorArea)
local rtIndicator = goIndicator:GetComponent("RectTransform")
rtIndicator.localScale = Vector3.one
rtIndicator.localPosition = Vector3.zero
local mapCtrl = self:BindCtrlByNode(goIndicator, "Game.UI.Battle.SkillHintIndicator.MonsterSkillHintIndicator")
table.insert(self.tbAllIndicators, mapCtrl)
return mapCtrl
end
elseif 0 < #self.tbPoolBossIndicator then
local mapCtrl = table.remove(self.tbPoolBossIndicator)
return mapCtrl
else
local goIndicator = instantiate(self._mapNode.TemplateBossIndicator, self._mapNode.IndictorArea)
local rtIndicator = goIndicator:GetComponent("RectTransform")
rtIndicator.localScale = Vector3.one
rtIndicator.localPosition = Vector3.zero
local mapCtrl = self:BindCtrlByNode(goIndicator, "Game.UI.Battle.SkillHintIndicator.BossSkillHintIndicator")
table.insert(self.tbAllIndicators, mapCtrl)
return mapCtrl
end
end
function HintIndicators:OnEvent_MonsterSpawn(nEntityId, nDataId)
local mapMonster = ConfigTable.GetData("Monster", nDataId)
if mapMonster == nil then
printError("Monster Data Missing:" .. nDataId)
return
end
local mapMonsterSkin = ConfigTable.GetData("MonsterSkin", mapMonster.FAId)
if mapMonsterSkin == nil then
printError("MonsterSkin Data Missing:" .. mapMonster.FAId)
return
end
if mapMonster.AttackHintType ~= nil and mapMonster.AttackHintType ~= GameEnum.AttackHintType.Null then
if self.mapActiveIndicator[nEntityId] ~= nil then
printError("重复EntityId绑定指示器:" .. nEntityId)
return
end
local mapCtrl = self:GetIndicator(mapMonster.AttackHintType == GameEnum.AttackHintType.Always)
local RecycleCallback = function(nCtrlEntityId, goCtrl, bHold)
if not bHold then
table.insert(self.tbPoolMonsterIndicator, goCtrl)
else
table.insert(self.tbPoolBossIndicator, goCtrl)
end
goCtrl.gameObject:SetActive(false)
if self.mapActiveIndicator[nCtrlEntityId] ~= nil then
self.mapActiveIndicator[nCtrlEntityId] = nil
end
end
mapCtrl:SetTarget(nEntityId, mapMonster.FAId, mapMonster.AttackHintType == GameEnum.AttackHintType.Always, RecycleCallback)
self.mapActiveIndicator[nEntityId] = mapCtrl
end
end
function HintIndicators:OnEvent_MonsterDied(nEntityId)
if self.mapActiveIndicator[nEntityId] ~= nil then
self.mapActiveIndicator[nEntityId]:UnBindEvent()
end
end
function HintIndicators:OnEvent_MonsterActive(nEntityId, dataID, bShow)
if bShow then
self:OnEvent_MonsterSpawn(nEntityId, dataID)
else
self:OnEvent_MonsterDied(nEntityId)
end
end
function HintIndicators:OnEvent_InputEnable(bEnable)
NovaAPI.SetCanvasGroupAlpha(self._mapNode.canvas_group, bEnable == true and 1 or 0)
end
function HintIndicators:ClearAllCtrl()
for _, mapCtrl in ipairs(self.mapActiveIndicator) do
mapCtrl:UnBindEvent()
end
for _, mapCtrl in pairs(self.tbAllIndicators) do
local go = mapCtrl.gameObject
self:UnbindCtrlByNode(mapCtrl)
destroy(go)
end
self.tbAllIndicators = {}
self.mapActiveIndicator = {}
self.tbPoolBossIndicator = {}
end
return HintIndicators
@@ -0,0 +1,115 @@
local MonsterSkillHintIndicator = class("MonsterSkillHintIndicator", BaseCtrl)
MonsterSkillHintIndicator._mapNodeConfig = {
imgIcon = {sComponentName = "Image"}
}
MonsterSkillHintIndicator._mapEventConfig = {}
function MonsterSkillHintIndicator:Awake()
self.animtor = self.gameObject:GetComponent("Animator")
self.canvasGroup = self.gameObject:GetComponent("CanvasGroup")
self.nEntityId = nil
end
function MonsterSkillHintIndicator:FadeIn()
end
function MonsterSkillHintIndicator:FadeOut()
end
function MonsterSkillHintIndicator:OnEnable()
end
function MonsterSkillHintIndicator:OnDisable()
self:UnBindEvent()
end
function MonsterSkillHintIndicator:OnDestroy()
end
function MonsterSkillHintIndicator:OnRelease()
end
function MonsterSkillHintIndicator:SetTarget(nEntityId, _, bHold, fRecycleCallback)
if self.nEntityId ~= nil then
printError("重复绑定")
return
end
self.fRecycleCallback = fRecycleCallback
self.nEntityId = nEntityId
self.bHold = bHold
EventManager.AddEntityEvent("AttackHintCancel", self.nEntityId, self, self.OnEvent_SkillCancel)
EventManager.AddEntityEvent("AttackHint", self.nEntityId, self, self.OnEvent_SkillHint)
EventManager.AddEntityEvent("AttackHintEnd", self.nEntityId, self, self.OnEvent_SkillEnd)
EventManager.AddEntityEvent("AttackHintShow", self.nEntityId, self, self.OnEvent_HintShow)
EventManager.AddEntityEvent("AttackHintHide", self.nEntityId, self, self.OnEvent_HintHide)
NovaAPI.SetSkillIndicatorTarget(nEntityId, self.gameObject, Vector3.zero)
self.gameObject:SetActive(self.bHold)
if self.bHold then
self.animtor:Play("TemplateMonster_in")
end
NovaAPI.SetComponentEnable(self._mapNode.imgIcon, false)
end
function MonsterSkillHintIndicator:UnBindEvent()
if self.nEntityId == nil then
return
end
if self.endTimer ~= nil then
self.endTimer:Cancel()
end
EventManager.RemoveEntityEvent("AttackHintCancel", self.nEntityId, self, self.OnEvent_SkillCancel)
EventManager.RemoveEntityEvent("AttackHint", self.nEntityId, self, self.OnEvent_SkillHint)
EventManager.RemoveEntityEvent("AttackHintEnd", self.nEntityId, self, self.OnEvent_SkillEnd)
EventManager.RemoveEntityEvent("AttackHintShow", self.nEntityId, self, self.OnEvent_HintShow)
EventManager.RemoveEntityEvent("AttackHintHide", self.nEntityId, self, self.OnEvent_HintHide)
if self.fRecycleCallback ~= nil then
self.fRecycleCallback(self.nEntityId, self, self.bHold)
self.fRecycleCallback = nil
end
self.nEntityId = nil
end
function MonsterSkillHintIndicator:OnEvent_SkillHint()
if self.endTimer ~= nil then
printError("已在技能结束处理中")
return
end
self.gameObject:SetActive(true)
NovaAPI.SetComponentEnable(self._mapNode.imgIcon, true)
if self.bHold then
self.animtor:Play("TemplateMonster_loop")
else
self.animtor:Play("TemplateMonster_Hint")
end
end
function MonsterSkillHintIndicator:OnEvent_SkillEnd()
if self.endTimer ~= nil then
printError("已在技能结束处理中")
return
end
self.animtor:Play("TemplateMonster_out")
local EndCallBack = function()
if self.bHold then
self.animtor:Play("TemplateMonster_in")
NovaAPI.SetComponentEnable(self._mapNode.imgIcon, false)
else
self.gameObject:SetActive(false)
end
self.endTimer = nil
end
self.endTimer = self:AddTimer(1, 0.2, EndCallBack, true, true, nil, true)
end
function MonsterSkillHintIndicator:OnEvent_SkillCancel()
if self.endTimer ~= nil then
self.endTimer:Cancel()
end
if self.bHold then
self.animtor:Play("TemplateMonster_in")
NovaAPI.SetComponentEnable(self._mapNode.imgIcon, false)
else
self.gameObject:SetActive(false)
end
self.endTimer = nil
end
function MonsterSkillHintIndicator:OnEvent_HintShow()
local indicatorBase = self.gameObject:GetComponent("IndicatorBase")
indicatorBase:SetLogicHide(false)
end
function MonsterSkillHintIndicator:OnEvent_HintHide()
local indicatorBase = self.gameObject:GetComponent("IndicatorBase")
indicatorBase:SetLogicHide(true)
end
function MonsterSkillHintIndicator:MonsterDied()
self:UnBindEvent()
end
return MonsterSkillHintIndicator
@@ -0,0 +1,68 @@
local SkillInstanceBattlePanel = class("SkillInstanceBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
SkillInstanceBattlePanel.OpenMinMap = true
SkillInstanceBattlePanel._bAddToBackHistory = false
SkillInstanceBattlePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "GuideProloguel/GuideProloguelPanel.prefab",
sCtrlName = "Game.UI.GuideProloguel.GuideProloguelCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "SkillInstanceBattlePanel/SkillInstanceInfo.prefab",
sCtrlName = "Game.UI.SkillInstanceRoomInfo.SkillInstanceRoomInfoCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/CommonBattlePausePanel.prefab",
sCtrlName = "Game.UI.SkillInstanceRoomInfo.SkillInstancePauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function SkillInstanceBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.SkillInstance
end
function SkillInstanceBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function SkillInstanceBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function SkillInstanceBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return SkillInstanceBattlePanel
@@ -0,0 +1,80 @@
local SkillDisplayCtrl = class("SkillDisplayCtrl", BaseCtrl)
SkillDisplayCtrl._mapNodeConfig = {
TMP_SkillName = {sComponentName = "TMP_Text"},
imgSubSkillIcon = {sComponentName = "Image"}
}
SkillDisplayCtrl._mapEventConfig = {}
function SkillDisplayCtrl:Awake()
end
function SkillDisplayCtrl:FadeIn()
end
function SkillDisplayCtrl:FadeOut()
end
function SkillDisplayCtrl:OnEnable()
self.animRoot = self.gameObject:GetComponent("Animator")
self.canvasGroup = self.gameObject:GetComponent("CanvasGroup")
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self.gameObject:SetActive(false)
end
cs_coroutine.start(wait)
end
function SkillDisplayCtrl:OnDisable()
end
function SkillDisplayCtrl:OnDestroy()
end
function SkillDisplayCtrl:OnRelease()
end
function SkillDisplayCtrl:ShowSkillTips(nSkillId, nCharId, callback)
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self.animRoot.enabled = true
self.animRoot:Play("SubSkillDisplay_skill_1")
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 1)
end
self.animRoot.enabled = false
NovaAPI.SetCanvasGroupAlpha(self.canvasGroup, 0)
cs_coroutine.start(wait)
local mapSkillCfgData = ConfigTable.GetData_Skill(nSkillId)
if mapSkillCfgData == nil then
printError("Skill Data Missing:" .. nSkillId)
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, "")
else
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, mapSkillCfgData.Title)
end
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
self:SetPngSprite(self._mapNode.imgSubSkillIcon, mapSkin.Icon .. AllEnum.CharHeadIconSurfix.XXL)
self.ShowEndCallback = callback
self.gameObject:SetActive(true)
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
self.bPlaying = true
end
function SkillDisplayCtrl:ShowEnd()
NovaAPI.SetImageSpriteAsset(self._mapNode.imgSubSkillIcon, nil)
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, "")
if self.ShowEndCallback ~= nil and type(self.ShowEndCallback) == "function" then
self.ShowEndCallback()
end
self.ShowEndCallback = nil
self.gameObject:SetActive(false)
self.timer = nil
self.bPlaying = false
end
function SkillDisplayCtrl:InterrputAnim()
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
NovaAPI.SetImageSpriteAsset(self._mapNode.imgSubSkillIcon, nil)
NovaAPI.SetTMPText(self._mapNode.TMP_SkillName, "")
self.ShowEndCallback = nil
self.gameObject:SetActive(false)
self.timer = nil
self.bPlaying = false
end
return SkillDisplayCtrl
@@ -0,0 +1,190 @@
local SubSkillDisplayCtrl = class("SubSkillDisplayCtrl", BaseCtrl)
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local LocalData = require("GameCore.Data.LocalData")
local LocalSettingData = require("GameCore.Data.LocalSettingData")
local RapidJson = require("rapidjson")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
SubSkillDisplayCtrl._mapNodeConfig = {
rtDisplay = {
nCount = 2,
sCtrlName = "Game.UI.Battle.SubSkillDisplay.UltimateDisplayCtrl"
},
rtSubSkill = {
nCount = 2,
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SkillDisplayCtrl"
}
}
SubSkillDisplayCtrl._mapEventConfig = {
CastAssistSkill = "OnEvent_CastAssistSkill",
[EventId.SubSkillDisplayInit] = "OnEvent_Init",
InputEnable = "OnEvent_InputEnable"
}
function SubSkillDisplayCtrl:Awake()
local sSavedDate = LocalData.GetPlayerLocalData("SkillShowDate")
local sDate = os.date("%x")
self.mapCharShow = {}
if sDate ~= sSavedDate then
LocalData.SetPlayerLocalData("SkillShowDate", sDate)
LocalData.SetPlayerLocalData("SkillShowCount", RapidJson.encode({}))
else
local sJson = LocalData.GetPlayerLocalData("SkillShowCount")
local mapData = decodeJson(sJson)
if mapData ~= nil then
for _, nCharId in ipairs(mapData) do
self.mapCharShow[nCharId] = true
end
end
end
end
function SubSkillDisplayCtrl:FadeIn()
end
function SubSkillDisplayCtrl:FadeOut()
end
function SubSkillDisplayCtrl:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
NovaAPI.ForceUpdateCanvases()
end
cs_coroutine.start(wait)
end
function SubSkillDisplayCtrl:OnDisable()
for _, mapData in pairs(self.mapChar) do
Actor2DManager.UnsetActor2D(false, mapData.Idx, true)
end
end
function SubSkillDisplayCtrl:OnDestroy()
end
function SubSkillDisplayCtrl:OnRelease()
end
function SubSkillDisplayCtrl:OnEvent_Init(tbTeam)
self.mapChar = {}
if #tbTeam < 3 then
printWarn("人数小于3")
return
end
for i = 2, 3 do
local charTid = tbTeam[i]
if charTid ~= nil and charTid ~= 0 then
local nSkillId = ConfigTable.GetData_Character(charTid).AssistSkillId
self.mapChar[charTid] = {
Idx = i,
nSkillId = nSkillId,
bPlaying = false,
rtIdx = i - 1,
nSkillShowIdx = 0
}
end
self._mapNode.rtDisplay[i - 1]:InitL2dRes(charTid, i)
end
end
function SubSkillDisplayCtrl:OnEvent_CastAssistSkill(nCharId)
if self.mapChar[nCharId] ~= nil then
local nSkillId = self.mapChar[nCharId].nSkillId
local checkType = self:CheckPlayType(nCharId)
if checkType == 0 then
return
elseif checkType == 1 then
self:UltimateDisplay(nCharId)
elseif checkType == 2 then
self:SkillDisplay(nCharId, nSkillId)
end
end
end
function SubSkillDisplayCtrl:OnEvent_InputEnable(bEnable)
if not bEnable then
self:InterrputAllDisplay()
end
end
function SubSkillDisplayCtrl:InterrputAllDisplay()
self._mapNode.rtDisplay[1]:InterrputAnim()
self._mapNode.rtDisplay[2]:InterrputAnim()
self._mapNode.rtSubSkill[1]:InterrputAnim()
self._mapNode.rtSubSkill[2]:InterrputAnim()
for _, mapSkill in pairs(self.mapChar) do
mapSkill.bPlaying = false
mapSkill.nSkillShowIdx = 0
end
end
function SubSkillDisplayCtrl:SkillDisplay(nCharId, nSkillId)
local mapData = self.mapChar[nCharId]
if mapData == nil then
return
end
local Callback = function()
mapData.nSkillShowIdx = 0
end
if mapData.nSkillShowIdx == 0 then
for nIdx, skillCtrl in ipairs(self._mapNode.rtSubSkill) do
if not skillCtrl.bPlaying then
skillCtrl:ShowSkillTips(nSkillId, nCharId, Callback)
mapData.nSkillShowIdx = nIdx
return
end
end
printError("没有槽位播放技能展示")
else
self._mapNode.rtSubSkill[mapData.nSkillShowIdx]:ShowSkillTips(nSkillId, nCharId, Callback)
WwiseAudioMgr:PostEvent("ui_tip_feadback")
end
end
function SubSkillDisplayCtrl:UltimateDisplay(nCharId)
local mapData = self.mapChar[nCharId]
if mapData == nil then
return
end
local Callback = function()
mapData.bPlaying = false
end
if mapData.bPlaying then
self._mapNode.rtDisplay[mapData.rtIdx]:ReShowSkill(Callback, mapData.Idx)
else
self._mapNode.rtDisplay[mapData.rtIdx]:ShowSkill(nCharId, mapData.Idx, Callback)
mapData.bPlaying = true
end
self._mapNode.rtDisplay[mapData.rtIdx % 2 + 1]:Set2SecondSkill()
end
function SubSkillDisplayCtrl:CheckPlayType(nCharId)
local bForce = self:CheckForcePlay()
local nType = LocalSettingData.GetLocalSettingData("AnimationSub")
if bForce then
nType = 2
end
if nType == 3 then
return 2
elseif nType == 2 then
if self.mapCharShow[nCharId] == nil then
self.mapCharShow[nCharId] = true
self:SetLocalData()
end
return 1
elseif nType == 1 then
if self.mapCharShow[nCharId] == nil then
self.mapCharShow[nCharId] = true
self:SetLocalData()
return 1
else
return 2
end
end
end
function SubSkillDisplayCtrl:SetLocalData()
local jsonData = {}
for nCharId, _ in pairs(self.mapCharShow) do
table.insert(jsonData, nCharId)
end
local sJson = RapidJson.encode(jsonData)
LocalData.SetPlayerLocalData("SkillShowCount", sJson)
return 1
end
function SubSkillDisplayCtrl:CheckForcePlay()
local bUseLive2D = LocalSettingData.mapData.UseLive2D
if not bUseLive2D then
return false
end
local tbDynamic = {
[GameEnum.dynamicLevelType.Trial] = true
}
local tbBattle = {}
return tbDynamic[self._panel.DynamicType] or tbBattle[self._panel.BattleType]
end
return SubSkillDisplayCtrl
@@ -0,0 +1,27 @@
local SubSkillDisplayPanel = class("SubSkillDisplayPanel", BasePanel)
SubSkillDisplayPanel._bIsMainPanel = false
SubSkillDisplayPanel._tbDefine = {
{
sPrefabPath = "Battle/SubSkillDisplay_forActor2dEditor.prefab"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
if RUNNING_ACTOR2D_EDITOR ~= true then
table.remove(SubSkillDisplayPanel._tbDefine, 1)
end
function SubSkillDisplayPanel:Awake()
end
function SubSkillDisplayPanel:OnEnable()
end
function SubSkillDisplayPanel:OnAfterEnter()
end
function SubSkillDisplayPanel:OnDisable()
end
function SubSkillDisplayPanel:OnDestroy()
end
function SubSkillDisplayPanel:OnRelease()
end
return SubSkillDisplayPanel
@@ -0,0 +1,145 @@
local UltimateDisplayCtrl = class("UltimateDisplayCtrl", BaseCtrl)
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local ResTypeAny = GameResourceLoader.ResType.Any
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local Path = require("path")
local WwiseAudioMgr = CS.WwiseAudioManager.Instance
UltimateDisplayCtrl._mapNodeConfig = {
imgBgChar = {sComponentName = "Image"},
imgBgPortrait = {sComponentName = "Image"},
DisplayL2d = {sComponentName = "RawImage"},
animRoot = {sComponentName = "Animator", sNodeName = "animove"},
imgBgCharL2d = {}
}
UltimateDisplayCtrl._mapEventConfig = {}
function UltimateDisplayCtrl:Awake()
end
function UltimateDisplayCtrl:FadeIn()
end
function UltimateDisplayCtrl:FadeOut()
end
function UltimateDisplayCtrl:OnEnable()
self.bPlaying = false
self.bSecond = false
self.animScale = self.gameObject:GetComponent("Animator")
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self.gameObject:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self.gameObject:SetActive(false)
end
cs_coroutine.start(wait)
end
function UltimateDisplayCtrl:OnDisable()
end
function UltimateDisplayCtrl:OnDestroy()
end
function UltimateDisplayCtrl:OnRelease()
end
function UltimateDisplayCtrl:ShowSkill(nCharId, nIdx, callback)
if self.bPlaying then
printError("上一个技能未播放完毕")
return
end
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
WwiseAudioMgr:PostEvent("ui_tip_support_ult")
self.gameObject:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
self.bSecond = false
self.animScale:Play("Empty")
self._mapNode.animRoot:Play("SubskillDisplay_moves_1")
self.gameObject.transform.localScale = Vector3.one
self.gameObject.transform:SetAsFirstSibling()
self.nIdx = nIdx
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
Actor2DManager.SetActor2D_ForSubSKill(PanelId.SubSkillDisplay, self._mapNode.DisplayL2d, nCharId, nSkinId, nil, nIdx)
Actor2DManager.PlayAnim("ultra", true, nIdx)
self.callback = callback
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
self.bPlaying = true
end
function UltimateDisplayCtrl:ReShowSkill(callback, nIdx)
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self._mapNode.animRoot:Play("SubskillDisplay_moves_1")
Actor2DManager.PlayAnim("ultra", true, nIdx)
end
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
WwiseAudioMgr:PostEvent("ui_tip_support_ult")
self.gameObject:SetActive(true)
NovaAPI.SetMaskAllDirty(self._mapNode.imgBgCharL2d)
self.bSecond = false
self._mapNode.animRoot:Play("Empty")
self.animScale:Play("Empty")
cs_coroutine.start(wait)
self.gameObject.transform:SetAsFirstSibling()
self.gameObject.transform.localScale = Vector3.one
self.callback = callback
self.timer = self:AddTimer(1, 1.5, "ShowEnd", true, true, true, true)
self.bPlaying = true
end
function UltimateDisplayCtrl:Set2SecondSkill()
if self.bSecond then
return
end
self.bSecond = true
if self.bPlaying then
self.animScale:Play("SubskillDisplay_scale_1")
else
return
end
end
function UltimateDisplayCtrl:ShowEnd()
if self.callback ~= nil and type(self.callback) == "function" then
self.callback()
end
Actor2DManager.UnsetActor2D(false, self.nIdx)
self.callback = nil
self.gameObject:SetActive(false)
self.bSecond = false
self.timer = nil
self.bPlaying = false
self.nIdx = 0
end
function UltimateDisplayCtrl:InterrputAnim()
if not self.bPlaying then
return
end
if self.timer ~= nil then
self.timer:Cancel(false)
self.timer = nil
end
Actor2DManager.UnsetActor2D(false, self.nIdx)
self.callback = nil
self.gameObject:SetActive(false)
self.bPlaying = false
self.nIdx = 0
end
function UltimateDisplayCtrl:InitL2dRes(nCharId, nIdx)
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
local mapSkin = ConfigTable.GetData_CharacterSkin(nSkinId)
local sBodyName = string.format("%s_001", nSkinId)
local mapCharCfgData = ConfigTable.GetData_Character(nCharId)
self.LoadSprite(self._mapNode.imgBgPortrait, mapSkin.Portrait, sBodyName)
local mapCharDescCfg = ConfigTable.GetData("CharacterDes", nCharId)
local sColor
if mapCharDescCfg == nil then
sColor = ""
else
sColor = mapCharDescCfg.CharSkillColor == "" and mapCharDescCfg.CharColor or mapCharDescCfg.CharSkillColor
end
local _b, _color = ColorUtility.TryParseHtmlString(sColor)
NovaAPI.SetImageColor(self._mapNode.imgBgChar, _color)
end
function UltimateDisplayCtrl.LoadSprite(imgObj, sPath, sName)
local _sPath = string.format("%s/atlas_png/a/%s.png", Path.dirname(sPath), sName)
NovaAPI.SetImageSprite(imgObj, Settings.AB_ROOT_PATH .. _sPath)
end
return UltimateDisplayCtrl
+72
View File
@@ -0,0 +1,72 @@
local TDBattlePanel = class("TDBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
TDBattlePanel.OpenMinMap = true
TDBattlePanel._bAddToBackHistory = false
TDBattlePanel._tbDefine = {
{
sPrefabPath = "RoguelikeItemTip/RoguelikeItemTipPanel.prefab",
sCtrlName = "Game.UI.RoguelikeItemTips.RoguelikeItemTipsCtrl"
},
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "Battle/MainBattleMenu.prefab",
sCtrlName = "Game.UI.Battle.MainBattleMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "TDRoomInfo/TDRoomInfo.prefab",
sCtrlName = "Game.UI.TravelerDuelRoomInfo.TDRoomInfoCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/CommonBattlePausePanel.prefab",
sCtrlName = "Game.UI.TravelerDuelRoomInfo.TDPauseCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function TDBattlePanel:Awake()
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.BattleType = GameEnum.worldLevelType.TravelerDuel
end
function TDBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
local mapLevel = ConfigTable.GetData("TravelerDuelBossLevel", PlayerData.TravelerDuel.entryLevelId)
if mapLevel then
local FloorId = mapLevel.FloorId
local floorData = ConfigTable.GetData("TravelerDuelFloor", FloorId)
if floorData and floorData.IntroCutscene ~= "" then
EventManager.Hit(EventId.BattleDashboardVisible, false)
end
end
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
end
cs_coroutine.start(wait)
end
function TDBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function TDBattlePanel:OnDisable()
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
return TDBattlePanel
+76
View File
@@ -0,0 +1,76 @@
local TipsPanelCtrl = class("MessageBoxTipsCtrl", BaseCtrl)
TipsPanelCtrl._mapNodeConfig = {
trContent = {sComponentName = "Transform"},
goPool = {sComponentName = "Transform"},
goTips = {sComponentName = "GameObject"}
}
TipsPanelCtrl._mapEventConfig = {}
local HEIGHT = 90
local MOVE_TIME = 0.2
local WAIT_TIME = 0.5
local RECYCLE_TIME = 1.3
function TipsPanelCtrl:GetItem()
local goItem
if #self.tbPool > 0 then
local nlast = #self.tbPool
goItem = self.tbPool[nlast]
table.remove(self.tbPool, nlast)
goItem.gameObject.transform:SetParent(self._mapNode.trContent)
goItem.gameObject.transform.localPosition = Vector3(0, 0, 0)
return goItem
else
goItem = instantiate(self._mapNode.goTips, self._mapNode.trContent)
goItem.gameObject.transform.localPosition = Vector3(0, 0, 0)
goItem:SetActive(true)
return goItem
end
end
function TipsPanelCtrl:RecycleItem()
local goItem = self.tbShowItem[1]
table.remove(self.tbTipsQueue, 1)
table.remove(self.tbShowItem, 1)
if self.tbTweener[1] then
self.tbTweener[1]:Kill()
table.remove(self.tbTweener, 1)
end
end
function TipsPanelCtrl:PopupTips()
for nIndex, goOther in pairs(self.tbShowItem) do
local rtOther = goOther.gameObject:GetComponent("RectTransform")
local nCount = #self.tbShowItem + 1 - nIndex
local v3Target = Vector3(0, nCount * HEIGHT, 0)
self.tbTweener[nIndex] = rtOther:DOLocalMove(v3Target, MOVE_TIME):SetUpdate(true):SetEase(Ease.OutCubic)
end
local goItem = self:GetItem()
table.insert(self.tbShowItem, goItem)
NovaAPI.SetTMPText(goItem.gameObject.transform:Find("imgBg/txtTips"):GetComponent("TMP_Text"), self.tbTipsQueue[#self.tbTipsQueue])
self:AddTimer(1, RECYCLE_TIME, "RecycleItem", true, true, true)
end
function TipsPanelCtrl:EnableReceive()
self.bReceive = true
end
function TipsPanelCtrl:OpenUI(sTip)
if self.bReceive then
self.bReceive = false
self:AddTimer(1, WAIT_TIME, "EnableReceive", true, true, true)
table.insert(self.tbTipsQueue, sTip)
self:PopupTips()
end
end
function TipsPanelCtrl:Awake()
self.tbTipsQueue = {}
self.tbShowItem = {}
self.tbPool = {}
self.tbTweener = {}
self.bReceive = true
self._mapNode.goTips:SetActive(false)
end
function TipsPanelCtrl:OnDisable()
self.tbTipsQueue = nil
self.tbShowItem = nil
self.tbPool = nil
self.tbTweener = nil
end
function TipsPanelCtrl:OnDestroy()
end
return TipsPanelCtrl
+40
View File
@@ -0,0 +1,40 @@
local TopMenuCtrl = class("TopMenuCtrl", BaseCtrl)
TopMenuCtrl._mapNodeConfig = {
txt_boxSmallCount = {sComponentName = "TMP_Text"},
txt_boxMediumCount = {sComponentName = "TMP_Text"}
}
TopMenuCtrl._mapEventConfig = {
RefreshBoxCount = "OnEvent_SetBoxCount"
}
function TopMenuCtrl:Awake()
NovaAPI.SetTMPSourceText(self._mapNode.txt_boxSmallCount, "0/0")
NovaAPI.SetTMPSourceText(self._mapNode.txt_boxMediumCount, "0/0")
end
function TopMenuCtrl:OnEnable()
end
function TopMenuCtrl:OnDisable()
end
function TopMenuCtrl:OnDestroy()
end
function TopMenuCtrl:OnRelease()
end
function TopMenuCtrl:OnEvent_SetBoxCount(nType, nTotalCount, nCurCount)
if nType == 1 then
local str
if 0 < nCurCount then
str = string.format("<color=#70f1ce>%d</color>/%d", nCurCount, nTotalCount)
else
str = string.format("%d/%d", nCurCount, nTotalCount)
end
NovaAPI.SetTMPSourceText(self._mapNode.txt_boxSmallCount, str)
else
local str
if 0 < nCurCount then
str = string.format("<color=#70f1ce>%d</color>/%d", nCurCount, nTotalCount)
else
str = string.format("%d/%d", nCurCount, nTotalCount)
end
NovaAPI.SetTMPSourceText(self._mapNode.txt_boxMediumCount, str)
end
end
return TopMenuCtrl
@@ -0,0 +1,107 @@
local VampireSurvivorBattlePanel = class("VampireSurvivorBattlePanel", BasePanel)
local GamepadUIManager = require("GameCore.Module.GamepadUIManager")
VampireSurvivorBattlePanel.OpenMinMap = true
VampireSurvivorBattlePanel._bAddToBackHistory = false
VampireSurvivorBattlePanel._tbDefine = {
{
sPrefabPath = "Battle/BattleDashboard.prefab",
sCtrlName = "Game.UI.Battle.BattleDashboardCtrl"
},
{
sPrefabPath = "VampireBattle/VampireMenu.prefab",
sCtrlName = "Game.UI.VampireSurvivor.VampireMenuCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/AdventureMainUI.prefab",
sCtrlName = "Game.UI.Battle.MainBattleCtrl"
},
{
sPrefabPath = "Battle/AdventureMainUI/BattlePopupTips.prefab",
sCtrlName = "Game.UI.Battle.BattlePopupTipsCtrl"
},
{
sPrefabPath = "Battle/SkillHintIndicators.prefab",
sCtrlName = "Game.UI.Battle.SkillHintIndicator.HintIndicators"
},
{
sPrefabPath = "Battle/CommonMonsterWarning.prefab",
sCtrlName = "Game.UI.Battle.CommonMonsterWarningCtrl"
},
{
sPrefabPath = "RegionBossTimeEx/RegionBossTime.prefab",
sCtrlName = "Game.UI.VampireSurvivor.VampireSurvivorTimeCtrl"
},
{
sPrefabPath = "VampireBattle/VampireFateCardSelectPanel.prefab",
sCtrlName = "Game.UI.VampireSurvivor.VampireFateCardSelect"
},
{
sPrefabPath = "VampireBattle/VampireRoomInfo.prefab",
sCtrlName = "Game.UI.VampireSurvivor.VampireSurvivorRoomInfo"
},
{
sPrefabPath = "VampireBattle/VampirePausePanel.prefab",
sCtrlName = "Game.UI.VampireSurvivor.VampireSurvivorPauseCtrl"
},
{
sPrefabPath = "VampireBattle/VampireDepotPanel.prefab",
sCtrlName = "Game.UI.VampireSurvivor.VampireDepotCtrl"
},
{
sPrefabPath = "Battle/SubSkillDisplay.prefab",
sCtrlName = "Game.UI.Battle.SubSkillDisplay.SubSkillDisplayCtrl"
}
}
function VampireSurvivorBattlePanel:Awake()
self.BattleType = GameEnum.worldLevelType.VampireInstance
self.trUIRoot = GameObject.Find("---- UI ----").transform
EventManager.Add("VampireSurvivorChangeArea", self, self.OnEvent_ChangeArea)
GamepadUIManager.EnterAdventure()
GamepadUIManager.EnableGamepadUI("BattleMenu", {})
self.tbTeam = self._tbParam[1]
self.nLevelId = self._tbParam[2]
self.mapCharData = {}
for _, nCharId in ipairs(self.tbTeam) do
self.mapCharData[nCharId] = clone(PlayerData.Char:GetCharDataByTid(nCharId))
end
end
function VampireSurvivorBattlePanel:SetTop(goCanvas)
local nTopLayer = 0
if nil ~= self.trUIRoot then
local nChildCount = self.trUIRoot.childCount
local trChild
for i = 1, nChildCount do
trChild = self.trUIRoot:GetChild(i - 1)
nTopLayer = math.max(nTopLayer, NovaAPI.GetCanvasSortingOrder(trChild:GetComponent("Canvas")))
end
end
if 0 < nTopLayer then
NovaAPI.SetCanvasSortingOrder(goCanvas, nTopLayer + 1)
end
end
function VampireSurvivorBattlePanel:OnEnable()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.Hud, true, true)
EventManager.Hit(EventId.ClosePanel, PanelId.MainlineFormation)
EventManager.Hit(EventId.ClosePanel, PanelId.RegionBossFormation)
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
end
cs_coroutine.start(wait)
end
function VampireSurvivorBattlePanel:OnAfterEnter()
EventManager.Hit(EventId.SubSkillDisplayInit, self._tbParam[1])
end
function VampireSurvivorBattlePanel:OnDisable()
EventManager.Remove("VampireSurvivorChangeArea", self, self.OnEvent_ChangeArea)
GamepadUIManager.DisableGamepadUI("BattleMenu")
GamepadUIManager.QuitAdventure()
end
function VampireSurvivorBattlePanel:OnEvent_ChangeArea(tbTeam)
self.tbTeam = tbTeam
self.mapCharData = {}
for _, nCharId in ipairs(self.tbTeam) do
self.mapCharData[nCharId] = clone(PlayerData.Char:GetCharDataByTid(nCharId))
end
end
return VampireSurvivorBattlePanel