Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FieldManualConfigLoader.c
Go to the documentation of this file.
2 {
3  //------------------------------------------------------------------------------------------------
7  static SCR_FieldManualConfigRoot LoadConfigRoot(ResourceName configPath)
8  {
9  SCR_FieldManualConfigRoot result = SCR_ConfigHelperT<SCR_FieldManualConfigRoot>.GetConfigObject(configPath);
10  if (!result)
11  return null;
12 
13  if (result.m_aCategories)
14  {
15  foreach (SCR_FieldManualConfigCategory category : result.m_aCategories)
16  {
17  FillCategories(category);
18  }
19  }
20 
21  return result;
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  protected static void FillCategories(notnull SCR_FieldManualConfigCategory category)
26  {
27  if (category.m_aCategories)
28  {
29  foreach (SCR_FieldManualConfigCategory subCategory : category.m_aCategories)
30  {
31  FillCategories(subCategory);
32  }
33  }
34 
35  if (category.m_aEntries)
36  FillEntries(category.m_aEntries);
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  protected static void FillEntries(notnull array<ref SCR_FieldManualConfigEntry> entries)
41  {
42  foreach (SCR_FieldManualConfigEntry entry : entries)
43  {
45  if (weaponEntry)
46  FillEntries_Weapon(weaponEntry);
47  }
48  }
49 
50  //------------------------------------------------------------------------------------------------
51  protected static void FillEntries_Weapon(notnull SCR_FieldManualConfigEntry_Weapon weaponEntry)
52  {
53  if (weaponEntry.m_sWeaponEntityPath.IsEmpty())
54  return;
55 
56  SCR_FieldManualUI_WeaponStatsHelper weaponStatsHelper = new SCR_FieldManualUI_WeaponStatsHelper(weaponEntry.m_sWeaponEntityPath);
57 
58  if (weaponEntry.m_sTitle.IsEmpty())
59  weaponEntry.m_sTitle = weaponStatsHelper.GetDisplayName();
60 
61  if (weaponEntry.m_Image.IsEmpty())
62  weaponEntry.m_Image = weaponStatsHelper.GetInventoryIcon();
63 
64  if (!weaponEntry.m_aContent)
65  weaponEntry.m_aContent = {};
66 
67  if (weaponEntry.m_aContent.IsEmpty())
68  weaponEntry.m_aContent.Insert(new SCR_FieldManualPiece_Text()); // will be auto-filled below
69 
70  // fill the first empty text with weapon description
71  foreach (SCR_FieldManualPiece piece : weaponEntry.m_aContent)
72  {
73  SCR_FieldManualPiece_Text textPiece = SCR_FieldManualPiece_Text.Cast(weaponEntry.m_aContent[0]);
74  if (textPiece && textPiece.m_sText.IsEmpty())
75  {
76  textPiece.m_sText = weaponStatsHelper.GetDescription();
77  break;
78  }
79  }
80 
81  weaponEntry.m_WeaponStatsHelper = weaponStatsHelper;
82  }
83 }
SCR_FieldManualPiece
Definition: SCR_FieldManualPiece.c:2
SCR_FieldManualConfigEntry_Weapon
Definition: SCR_FieldManualConfigEntry_Weapon.c:2
SCR_FieldManualConfigCategory
Definition: SCR_FieldManualConfigCategory.c:2
SCR_FieldManualConfigLoader
Definition: SCR_FieldManualConfigLoader.c:1
SCR_FieldManualUI_WeaponStatsHelper
Definition: SCR_FieldManualUI_WeaponStatsHelper.c:1
SCR_FieldManualConfigRoot
Definition: SCR_FieldManualConfigRoot.c:2
SCR_FieldManualPiece_Text
Definition: SCR_FieldManualPiece_Text.c:2
SCR_FieldManualConfigEntry
Definition: SCR_FieldManualConfigEntry.c:2
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180