Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WeaponsTooltipDetail.c
Go to the documentation of this file.
3 {
4  //[Attribute(defvalue: "3")]
5  //protected int m_iColumns;
6 
7  //protected Widget m_Grid;
8  //protected ResourceName m_WeaponLayout;
9 
10  [Attribute("#AR-Editor_TooltipDetail_Weapons_None")]
11  protected LocalizedString m_sUnarmedText;
12 
13  protected TextWidget m_Text;
14  protected BaseWeaponManagerComponent m_WeaponManager;
15 
16  //------------------------------------------------------------------------------------------------
17  override bool NeedUpdate()
18  {
19  return false;//m_WeaponManager != null; //--- ToDo: More optimized
20  }
21 
22  //------------------------------------------------------------------------------------------------
23  override void UpdateDetail(SCR_EditableEntityComponent entity)
24  {
25  if (!m_WeaponManager || !m_Text)
26  return;
27 
28  //WorkspaceWidget workspace = GetGame().GetWorkspace();
29 
30  array<WeaponSlotComponent> weapons = {};
31  m_WeaponManager.GetWeaponsSlots(weapons);
32  WeaponUIInfo info;
33  string text;
34  //int n;
35  foreach (WeaponSlotComponent weapon : weapons)
36  {
37  if (weapon.GetWeaponSlotType() == "grenade")
38  continue;
39 
40  info = WeaponUIInfo.Cast(weapon.GetUIInfo());
41  if (!info)
42  continue;
43 
44  text += info.GetName() + "\n";
45 
46 // ImageWidget weaponWidget = ImageWidget.Cast(workspace.CreateWidgets(m_WeaponLayout, m_Grid));
47 // weaponWidget.LoadImageTexture(0, info.GetWeaponIconPath());
48 //
49 // GridSlot.SetRow(weaponWidget, Math.Floor(n / m_iColumns));
50 // GridSlot.SetColumn(weaponWidget, n % m_iColumns);
51 // n++;
52  }
53 
54  if (!text.IsEmpty())
55  m_Text.SetText(text);
56  else
57  m_Text.SetText(m_sUnarmedText);
58 
59  }
60 
61  //------------------------------------------------------------------------------------------------
62  override bool InitDetail(SCR_EditableEntityComponent entity, Widget widget)
63  {
64  m_WeaponManager = BaseWeaponManagerComponent.Cast(entity.GetOwner().FindComponent(BaseWeaponManagerComponent));
65  if (!m_WeaponManager)
66  return false;
67 
68  m_Text = TextWidget.Cast(widget);
69  if (!m_Text)
70  return false;
71 
72  DamageManagerComponent damageManager = DamageManagerComponent.Cast(entity.GetOwner().FindComponent(DamageManagerComponent));
73  if (damageManager)
74  {
75  if (damageManager.GetState() == EDamageState.DESTROYED)
76  return false;
77  }
78 
79  return true;
80 
81 // m_Grid = widget;
82 // if (!m_Grid)
83 // return false;
84 //
85 // m_WeaponLayout = SCR_LayoutTemplateComponent.GetLayout(widget);
86 // if (m_WeaponLayout.IsEmpty())
87 // return false;
88 //
89 // return true;
90  }
91 }
SCR_WeaponsTooltipDetail
Definition: SCR_WeaponsTooltipDetail.c:2
EDamageState
EDamageState
Definition: EDamageState.c:12
WeaponSlotComponent
Definition: WeaponSlotComponent.c:12
m_WeaponManager
protected BaseWeaponManagerComponent m_WeaponManager
Definition: SCR_CharacterCommandHandler.c:120
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
Attribute
typedef Attribute
Post-process effect of scripted camera.
WeaponUIInfo
Definition: WeaponUIInfo.c:3
SCR_EntityTooltipDetail
Definition: SCR_EntityTooltipDetail.c:2
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
DamageManagerComponent
Definition: DamageManagerComponent.c:12
LocalizedString
Definition: LocalizedString.c:21
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468