56 Print(
"No config component found | " + __FILE__ +
": " + __LINE__,
LogLevel.WARNING);
64 Print(
"Could not load provided config | " + __FILE__ +
": " + __LINE__,
LogLevel.WARNING);
73 bool isMainMenu =
GetGame().m_bIsMainMenuOpen;
76 if (blur && isMainMenu)
77 blur.RemoveFromHierarchy();
79 if (backgroundImage && !isMainMenu)
80 backgroundImage.RemoveFromHierarchy();
82 Widget menuFrame = rootWidget.FindAnyWidget(
"MenuFrame");
86 if (!menuFrame || !menuTitle || !menuCategoryList || !menuGridLayout)
88 Print(
"Important elements (menu frame & title, category list, grid layout) are missing | " + __FILE__ +
": " + __LINE__,
LogLevel.WARNING);
93 Widget readingWidget = rootWidget.FindAnyWidget(
"ReadingWidget");
96 Widget entryFrame = readingWidget.FindAnyWidget(
"EntryFrame");
97 if (!readingWidget || !entryTitle || !entryFrame)
99 Print(
string.Format(
"missing one: reading widget (%1), entryTitle (%2), entryFrame (%3) | " +
FilePath.StripPath(__FILE__) +
":" + __LINE__, readingWidget != null, entryTitle != null, entryFrame != null),
LogLevel.WARNING);
105 if (!backButtonMenuFrame || !backButtonMenuFrame.m_OnClicked)
107 Print(
string.Format(
"missing menu frame's back button menu (%1) or m_OnClicked (%2) | " +
FilePath.StripPath(__FILE__) +
":" + __LINE__, backButtonMenuFrame != null, backButtonMenuFrame.m_OnClicked != null),
LogLevel.WARNING);
216 SCR_ModularButtonComponent btnModularComponent = SCR_ModularButtonComponent.Cast(btnWidget.FindHandler(SCR_ModularButtonComponent));
217 if (!btnModularComponent)
220 btnModularComponent.SetToggled(state);
245 Print(
"could not create tile widget for entry | " +
FilePath.StripPath(__FILE__) +
":" + __LINE__,
LogLevel.WARNING);
254 cardComp.
SetText(entry.m_sTitle);
257 return createdWidget;
278 protected void SetTiles(array<ref SCR_FieldManualConfigEntry> entries)
285 if (!entries || entries.IsEmpty())
299 GridSlot.SetColumn(assetCard, column);
384 scroll.GetSliderPos(x, y);
400 scroll.GetScreenSize(w, h);
408 scroll.SetSliderPos(x, y);
425 if (entry.m_eId == entryId)
450 Widget weaponRender = widget.FindAnyWidget(
"weaponRender");
453 weaponRender.RemoveFromHierarchy();
461 if (!renderTarget || !weaponResourceName)
465 IEntity entity =
GetGame().SpawnEntityPrefabLocal(resource, null, null);
473 ItemPreviewManagerEntity manager = world.GetItemPreviewManager();
481 manager.SetPreviewItem(renderPreview, entity);
492 if (!weaponStatsHelper)
513 float mass = weaponStatsHelper.GetMass();
524 if (!statsSightAdjustments)
527 array<int> sightDistanceSettings = weaponStatsHelper.GetSightDistanceSettings();
528 if (!sightDistanceSettings || sightDistanceSettings.IsEmpty())
534 array<string> settingsStr = {};
535 foreach (
int sightDistanceSetting : sightDistanceSettings)
537 settingsStr.Insert(
WidgetManager.Translate(
"#AR-ValueUnit_Short_Meters", sightDistanceSetting));
547 if (!statsDefaultSightAdjustment)
550 int defaultSightDistanceSetting = weaponStatsHelper.GetDefaultSightDistanceSetting();
551 if (defaultSightDistanceSetting < 0)
554 statsDefaultSightAdjustment.
SetTranslatedValue(
"#AR-ValueUnit_Short_Meters", defaultSightDistanceSetting.ToString());
561 if (!statsRateOfFire)
564 if (weaponStatsHelper.GetRateOfFire() < 1)
567 statsRateOfFire.
SetTranslatedValue(
"#AR-ValueUnit_Short_RoundsPerMinute", weaponStatsHelper.GetRateOfFire().ToString());
574 if (!statsMuzzleVelocity)
577 if (weaponStatsHelper.m_iMuzzleVelocity < 1)
580 statsMuzzleVelocity.
SetTranslatedValue(
"#AR-ValueUnit_Short_MetersPerSeconds", weaponStatsHelper.m_iMuzzleVelocity.ToString());
590 array<string> fireModes = weaponStatsHelper.GetFireModes();
591 if (!fireModes || fireModes.IsEmpty())
603 array<SCR_FieldManualConfigCategory> categoriesToRemove = {};
604 array<SCR_FieldManualConfigCategory> subCategoriesToRemove = {};
605 array<SCR_FieldManualConfigEntry> entriesToRemove = {};
610 categoriesToRemove.Insert(
category);
614 subCategoriesToRemove.Clear();
617 if (!subCategory.m_bEnabled)
619 subCategoriesToRemove.Insert(subCategory);
623 entriesToRemove.Clear();
626 if (!entry.m_bEnabled || entry.m_aContent.IsEmpty())
628 entriesToRemove.Insert(entry);
632 entry.m_Parent = subCategory;
638 subCategory.m_aEntries.RemoveItemOrdered(entry);
641 if (subCategory.m_aEntries.IsEmpty() && subCategory.m_aCategories.IsEmpty())
643 subCategoriesToRemove.Insert(subCategory);
652 category.m_aCategories.RemoveItemOrdered(subCategory);
656 categoriesToRemove.Insert(
category);
740 search = search.Trim();
742 if (search.IsEmpty())
764 ArmaEntry.m_sTitle =
"#AR-FieldManual_Page_EasterEgg_ArmA_Title";
766 ArmaPiece.m_sText =
"#AR-FieldManual_Page_EasterEgg_ArmA_Text";
767 ArmaEntry.m_aContent.Insert(ArmaPiece);
771 string searchText = searchEditBox.GetText();
772 searchText.Replace(
"ArmA",
"Arma");
773 searchEditBox.SetText(searchText);
782 string originalSearch = search;
789 array<ref SCR_FieldManualConfigEntry> entries = {};
793 array<int> indexList = {};
795 array<string> allEntriesKeys = {};
798 allEntriesKeys.Insert(entry.m_sTitle);
803 foreach (
int index : indexList)
811 if (entries.IsEmpty())
872 protected static string ArrayJoin(notnull array<string> entries)
874 int count = entries.Count();
878 case 1:
return entries[0];
879 case 2:
return WidgetManager.Translate(
"#AR-General_List_Short_2", entries[0], entries[1]);
880 case 3:
return WidgetManager.Translate(
"#AR-General_List_Short_3", entries[0], entries[1], entries[2]);
881 case 4:
return WidgetManager.Translate(
"#AR-General_List_Short_4", entries[0], entries[1], entries[2], entries[3]);
882 case 5:
return WidgetManager.Translate(
"#AR-General_List_Short_5", entries[0], entries[1], entries[2], entries[3], entries[4]);
884 Print(
string.Format(
"Too many list entries to join as a string - missing #AR-General_List_Short_%1 translation?", count),
LogLevel.WARNING);
885 return WidgetManager.Translate(
"#AR-General_List_Short_5", entries[0], entries[1], entries[2], entries[3], entries[4]);
901 if (inputDeviceIsGamepadInvoker)
910 if (inputDeviceIsGamepadInvoker)
EFieldManualEntryId
used to grab the first id-matching Field Manual entry
ArmaReforgerScripted GetGame()
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
proto native void Close()
Object holding reference to resource. In destructor release the resource.
void SetImage(ResourceName imageName)
void SetBackgroundImage(ResourceName imageName)
void SetText(string newText)
void RemoveWidgetFromHierarchy()
static SCR_FieldManual_StatisticsLineComponent GetComponent(notnull Widget parentWidget, string widgetName)
void SetTranslatedValue(string value, string parameter1="")
void SetValue(string value)
Widget CreateWidget(notnull Widget parent)
To be overridden by child classes to call CreateWidgetFromLayout.
void OpenEntry(EFieldManualEntryId entryId)
void SetTiles(array< ref SCR_FieldManualConfigEntry > entries)
sets main Field Manual grid tiles from entries
static SCR_FieldManualUI Open(EFieldManualEntryId entryId)
opens the first entry matching the EFieldManualEntryId enum value
override void OnMenuShow()
Widget CreateTileWidget(notnull SCR_FieldManualConfigEntry entry, notnull Widget parent)
creates a tile and sets its image, background & text
void SetScrollAfterRefresh(notnull ScrollLayoutWidget scroll, float x, float y)
static const string SEARCH_RESULT_KEY
ScrollLayoutWidget m_wGridScrollLayoutWidget
void FocusLastSelectedEntry(Widget w=null)
Focus the last selected valid widget.
void FillEntry_Weapon_Statistics_Mass(notnull Widget statsLayout, notnull SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper)
ref array< ref SCR_FieldManualConfigEntry > m_aAllEntries
void RefreshCurrentEntry()
Re-creates the current entry (called by callqueue added in QueueRefreshCurrentEntry).
void OnSubCategoryClicked(Widget w)
void FillEntry_Weapon_Statistics_MuzzleVelocity(notnull Widget statsLayout, notnull SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper)
override void OnMenuHide()
ref map< Widget, ref SCR_FieldManualConfigCategory > m_mWidgetSubCategoryMap
void SetTilesByWidget(Widget widget)
sets entry tiles from a sub-category's widget
void ProcessSearch(SCR_EditBoxSearchComponent searchbox, string search)
the search process itself - finds entries and set tiles
void SetAllEntriesAndParents()
one-time call that goes through all categories and entries and adds enabled entries to a one-level ar...
void HideQueueMessage()
Hide the Server Queue.
ref SCR_FieldManualEntryScriptedWidgetEventHandler m_EntryButtonEventHandler
void CloseReadingPanel()
closes the reading panel (sets the current entry to null)
SCR_BreadCrumbsComponent m_BreadCrumbsComponent
VerticalLayoutWidget m_wMenuCategoryList
void SetCurrentEntry(SCR_FieldManualConfigEntry entry)
Sets the current entry to read - can be null (leave reading mode) or any SCR_FieldManualConfigEntry.
void OpenLastSelectedSubCategory()
Open the last selected Sub Category and selected it.
Widget m_wLastSelectedWidget
void ShowQueueMessage()
Show the Server Queue.
SCR_FieldManualConfigEntry m_CurrentEntry
static const int ENTRY_INPUT_REFRESH_DELAY
ButtonWidget m_wFirstSubCategoryButton
void FillEntry_Weapon(notnull Widget widget, notnull SCR_FieldManualConfigEntry_Weapon entry)
static const int TILES_GRID_WIDTH
void FillEntry_Weapon_Statistics_FireModes(notnull Widget statsLayout, notnull SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper)
void FillEntry_Weapon_Statistics_DefaultSightAdjustment(notnull Widget statsLayout, notnull SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper)
void OnTileClicked(Widget w)
void FillEntry_Weapon_Statistics_RateOfFire(notnull Widget statsLayout, notnull SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper)
static const string SEARCH_NO_RESULT_KEY
bool FillEntry_Weapon_Render(RenderTargetWidget renderTarget, ResourceName weaponResourceName)
TextWidget m_wPageEntryTitle
GridLayoutWidget m_wMenuGridLayout
static const int ENTRY_SCROLL_INPUT_REFRESH_DELAY
void ResetLastSearch()
resets last search value
SCR_InputButtonComponent m_MenuBtnBack
bool m_bOpenedFromOutside
bool m_bIsInEntryViewMode
void QueueRefreshCurrentEntry()
Add current entry's refresh to callqueue (used by KBM/Gamepad switching event).
static const string SCROLL_NAME
SCR_EditBoxSearchComponent m_MenuSearchbar
void FillEntry_Weapon_Statistics(Widget statsLayout, SCR_FieldManualConfigEntry_Weapon entry)
bool FlipButtonState(Widget w, bool state)
void CreateCategoryMenuWidgets()
Create main categories buttons list.
Widget m_wLoadingServerQueue
void CloseMenuOrReadingPanel()
static string ArrayJoin(notnull array< string > entries)
joins strings with a stringtable separator - from 0 to 5 entries
void OpenFirstSubCategory()
Open the first sub-category, showing its entries.
void FillEntry_Weapon_Statistics_SightAdjustments(notnull Widget statsLayout, notnull SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper)
void SetCurrentEntryByWidget(Widget widget)
sets the read entry linked from that widget
ref SCR_FieldManualConfigRoot m_ConfigRoot
ref map< Widget, ref SCR_FieldManualConfigEntry > m_mWidgetEntryMap
void ~SCR_FieldManualUI()
override void OnMenuOpen()
ref SCR_FieldManualSubCategoryScriptedWidgetEventHandler m_SubCategoryButtonEventHandler
Widget m_wLastClickedSubCategory
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.