From 1a5fd18e30df99f34f77a8a5b05921179bb86bb7 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Sat, 28 Dec 2024 21:48:08 +0100 Subject: [PATCH] Add tools submenu with SCR_MissionHeader and ACE Settings debug --- .../AFM_Tools_ServerSettingsSubMenu.layout | 126 ++++++++++++++++++ ...FM_Tools_ServerSettingsSubMenu.layout.meta | 17 +++ .../AFM_Tools/AFM_ServerSettingsSubMenu.c | 79 +++++++++++ 3 files changed, 222 insertions(+) create mode 100644 addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout create mode 100644 addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout.meta create mode 100644 addons/core/scripts/Game/AFM_Core/AFM_Tools/AFM_ServerSettingsSubMenu.c diff --git a/addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout b/addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout new file mode 100644 index 0000000..074e86a --- /dev/null +++ b/addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout @@ -0,0 +1,126 @@ +HorizontalLayoutWidgetClass : "{0C2FFE60CB37F8CA}UI/layouts/AFM_Tools/AFM_Tools_TabContentBase.layout" { + components { + AFM_SubMenuBase "{632D326AA6ED1C3D}" { + Enabled 0 + } + AFM_ServerSettingsSubMenu "{63382472B4C2F7CA}" { + } + } + { + ScrollLayoutWidgetClass "{632D326BCA924163}" { + Prefab "{632D326BCA924163}" + Slot LayoutSlot "{632D326BCA924094}" { + Padding 2 4 2 0 + } + { + VerticalLayoutWidgetClass "{632D326BB84185A9}" { + Prefab "{632D326BB84185A9}" + Slot AlignableSlot "{632D326BB84185DF}" { + HorizontalAlign 0 + } + { + VerticalLayoutWidgetClass "{633940800A325E7F}" { + Name "VerticalLayout0" + Slot LayoutSlot "{633940800A325DA5}" { + } + { + HorizontalLayoutWidgetClass "{6339408035CE336A}" : "{829BC1189A899017}UI/layouts/WidgetLibrary/BaseElements/WLib_Label.layout" { + Name "LabelRoot0" + Slot LayoutSlot "{55367D9A1530D6F9}" { + } + { + TextWidgetClass "{554CD830975E8F3E}" { + Prefab "{554CD830975E8F3E}" + Text "Mission header" + } + } + } + PanelWidgetClass "{6338247480AC1BF3}" { + Name "Panel0" + Slot LayoutSlot "{6338247480AC1BE4}" { + } + style pixel_frame + { + ScrollLayoutWidgetClass "{63392EC98914E35F}" { + Name "Scroll0" + Slot FrameWidgetSlot "{63392EC98914E28D}" { + OffsetLeft 0 + OffsetTop 0 + SizeX 1024 + OffsetRight -1024 + SizeY 512 + OffsetBottom -512 + } + { + TextWidgetClass "{6338247485929E47}" { + Name "TextMissionHeader" + Slot AlignableSlot "{63392EC98947F04E}" { + HorizontalAlign 0 + VerticalAlign 0 + Padding 6 5 6 5 + } + Text "" + "No Localization" 1 + } + } + } + } + } + } + } + VerticalLayoutWidgetClass "{63394080137065DB}" { + Name "VerticalLayout1" + Slot LayoutSlot "{633940800A325DA5}" { + Padding 0 15 0 0 + } + { + HorizontalLayoutWidgetClass "{633940802DC4CBC0}" : "{829BC1189A899017}UI/layouts/WidgetLibrary/BaseElements/WLib_Label.layout" { + Name "LabelRoot0" + Slot LayoutSlot "{55367D9A1530D6F9}" { + } + { + TextWidgetClass "{554CD830975E8F3E}" { + Prefab "{554CD830975E8F3E}" + Text "ACE Settings" + } + } + } + PanelWidgetClass "{63394080137065DA}" { + Name "Panel0" + Slot LayoutSlot "{6338247480AC1BE4}" { + } + style pixel_frame + { + ScrollLayoutWidgetClass "{63394080137065D9}" { + Name "Scroll0" + Slot FrameWidgetSlot "{63392EC98914E28D}" { + OffsetLeft 0 + OffsetTop 0 + SizeX 1024 + OffsetRight -1024 + SizeY 512 + OffsetBottom -512 + } + { + TextWidgetClass "{6339408013701C1B}" { + Name "TextAceSettings" + Slot AlignableSlot "{63392EC98947F04E}" { + HorizontalAlign 0 + VerticalAlign 0 + Padding 6 5 6 5 + } + Text "" + "No Localization" 1 + } + } + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout.meta b/addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout.meta new file mode 100644 index 0000000..c10bbef --- /dev/null +++ b/addons/core/UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout.meta @@ -0,0 +1,17 @@ +MetaFileClass { + Name "{DEC85F306F40902A}UI/layouts/AFM_Tools/AFM_Tools_ServerSettingsSubMenu.layout" + Configurations { + LayoutResourceClass PC { + } + LayoutResourceClass XBOX_ONE : PC { + } + LayoutResourceClass XBOX_SERIES : PC { + } + LayoutResourceClass PS4 : PC { + } + LayoutResourceClass PS5 : PC { + } + LayoutResourceClass HEADLESS : PC { + } + } +} \ No newline at end of file diff --git a/addons/core/scripts/Game/AFM_Core/AFM_Tools/AFM_ServerSettingsSubMenu.c b/addons/core/scripts/Game/AFM_Core/AFM_Tools/AFM_ServerSettingsSubMenu.c new file mode 100644 index 0000000..cc8e55f --- /dev/null +++ b/addons/core/scripts/Game/AFM_Core/AFM_Tools/AFM_ServerSettingsSubMenu.c @@ -0,0 +1,79 @@ +class AFM_ServerSettingsSubMenu : AFM_SubMenuBase +{ + protected bool m_bLoadedMissionHeader = false; + protected bool m_bLoadedAceSettings = false; + + protected TextWidget m_wMissionHeaderText; + protected TextWidget m_wAceSettingsText; + + //------------------------------------------------------------------------------------------------ + override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index) + { + super.OnTabCreate(menuRoot, buttonsLayout, index); + + m_wMissionHeaderText = TextWidget.Cast(m_wRoot.FindAnyWidget("TextMissionHeader")); + m_wAceSettingsText = TextWidget.Cast(m_wRoot.FindAnyWidget("TextAceSettings")); + } + + //------------------------------------------------------------------------------------------------ + override void OnTabShow() + { + super.OnTabShow(); + + if (!m_bLoadedMissionHeader || !m_bLoadedAceSettings) + LoadTabData(); + } + + //------------------------------------------------------------------------------------------------ + protected void LoadTabData() + { + SCR_PlayerController pc = SCR_PlayerController.Cast(GetGame().GetPlayerController()); + AFM_SettingsComponent settingsComponent = AFM_SettingsComponent.Cast(pc.FindComponent(AFM_SettingsComponent)); + + if (m_wMissionHeaderText) + { + Print("UI: Loading mission header data"); + SCR_LoadingOverlay.ShowForWidget(m_wMissionHeaderText.GetParent()); + + settingsComponent.m_pMissionHeaderResponseInvoker.Insert(OnMissionHeader); + #ifdef WORKBENCH + GetGame().GetCallqueue().CallLater(settingsComponent.RequestMissionHeader, 700); + #else + settingsComponent.RequestMissionHeader(); + #endif + } + + if (m_wAceSettingsText) + { + Print("UI: Loading ACE settings data"); + SCR_LoadingOverlay.ShowForWidget(m_wAceSettingsText.GetParent()); + + settingsComponent.m_pAceSettingsResponseInvoker.Insert(OnAceSettings); + #ifdef WORKBENCH + GetGame().GetCallqueue().CallLater(settingsComponent.RequestAceSettings, 1400); + #else + settingsComponent.RequestAceSettings(); + #endif + } + } + + //------------------------------------------------------------------------------------------------ + //! Set mission header data + protected void OnMissionHeader(AFM_ContainerTextResponse response) + { + m_bLoadedMissionHeader = true; + SCR_LoadingOverlay.HideForWidget(m_wMissionHeaderText.GetParent()); + + m_wMissionHeaderText.SetText(response.m_sContent); + } + + //------------------------------------------------------------------------------------------------ + //! Set ACE settings data + protected void OnAceSettings(AFM_ContainerTextResponse response) + { + m_bLoadedAceSettings = true; + SCR_LoadingOverlay.HideForWidget(m_wAceSettingsText.GetParent()); + + m_wAceSettingsText.SetText(response.m_sContent); + } +} \ No newline at end of file