3 [
Attribute(
desc:
"Identifier used by HudManager to find the correct layout. \nMUST BE UNIQUE!!")]
4 protected string m_sIdentifier;
11 protected bool m_bIsMenuEnabled;
14 override void HandlerAttached(Widget w)
25 override void HandlerDeattached(Widget w)
27 if (!m_LayoutHandler || !m_bIsMenuEnabled)
30 m_bIsMenuEnabled =
false;
31 DeactivateHudLayout();
36 protected void ActivateHudLayout()
40 Print(
"Failed to initialize SCR_HUDLayout!", LogLevel.WARNING);
44 m_HudLayout.SetRootWidget(
m_wRoot);
48 Print(
"No Identifier set in " + ClassName() +
". Set a unique identifier!", LogLevel.WARNING);
54 PlayerController pController =
GetGame().GetPlayerController();
66 if (m_HudManager.GetHUDElements().IsEmpty())
69 m_LayoutHandler.GetOnMainLayoutInitialize().Insert(DelayHUDLayoutChange);
73 m_LayoutHandler.GetOnMainLayoutInitialize().Remove(DelayHUDLayoutChange);
75 if (!m_LayoutHandler.GetAllHUDLayouts().Contains(m_HudLayout))
76 m_LayoutHandler.AddHUDLayout(m_HudLayout);
80 m_bIsMenuEnabled =
true;
85 protected void DeactivateHudLayout()
91 m_LayoutHandler.GetOnMainLayoutInitialize().Remove(DelayHUDLayoutChange);
93 if (m_HudManager.GetHUDElements().IsEmpty())
96 SCR_HUDLayout currentLayout = m_LayoutHandler.GetActiveLayout();
99 if (currentLayout == m_HudLayout)
100 m_LayoutHandler.ChangeActiveHUDLayout();
102 if (m_LayoutHandler.GetAllHUDLayouts().Contains(m_HudLayout))
103 m_LayoutHandler.RemoveHUDLayout(m_HudLayout);
107 void DelayHUDLayoutChange()
110 GetGame().GetCallqueue().Call(ActivateHudLayout);
123 void DisableHUDMenu()
125 m_bIsMenuEnabled =
false;
126 DeactivateHudLayout();