Skip to content

Commit

Permalink
Add tools submenu with SCR_MissionHeader and ACE Settings debug
Browse files Browse the repository at this point in the history
  • Loading branch information
veteran29 committed Dec 28, 2024
1 parent 2a511aa commit 1a5fd18
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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 {
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 1a5fd18

Please sign in to comment.