Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MapUIElement.c
Go to the documentation of this file.
2 {
3  NONE,
4  BASE,
7  TASK,
10 };
11 
12 class SCR_MapUIElement : ScriptedWidgetComponent
13 {
14  protected SCR_MapUIElementContainer m_Parent;
15  protected static SCR_MapUIElement s_SelectedElement;
16 
17  protected Widget m_wRoot;
18 
19  protected MapItem m_MapItem; // todo@lk: delet
20 
21  protected ImageWidget m_wImage;
22  protected ImageWidget m_wGradient;
23  protected ImageWidget m_wSelectImg;
24  protected ImageWidget m_wHighlightImg;
25 
26  protected bool m_bIsSelected;
27  protected const float ANIM_SPEED = 20;
28  protected SCR_EIconType m_eIconType;
29  protected bool m_bVisible = false;
30 
31  [Attribute("{8479B3B5347DF5CF}UI/Imagesets/MilitarySymbol/ID_D.imageset")]
32  protected ResourceName m_sImageSetARO;
33 
34  [Attribute("{27F2439D610D02B3}UI/Imagesets/MilitarySymbol/ICO_Land.imageset")]
35  protected ResourceName m_sImageSetSpecial;
36 
37  [Attribute("1")]
38  protected bool m_bUseBackgroundGradient;
39 
40  [Attribute(SCR_SoundEvent.SOUND_MAP_HOVER_BASE)]
41  protected string m_sSoundBase;
42 
43  [Attribute(SCR_SoundEvent.SOUND_MAP_HOVER_ENEMY)]
44  protected string m_sSoundEnemyBase;
45 
46  [Attribute(SCR_SoundEvent.SOUND_MAP_HOVER_TRANS_TOWER)]
47  protected string m_sSoundRelay;
48 
49  [Attribute(SCR_SoundEvent.SOUND_FE_BUTTON_HOVER)]
50  protected string m_sSoundTask;
51 
52  [Attribute(SCR_SoundEvent.SOUND_FE_BUTTON_HOVER)]
53  protected string m_sSoundService;
54 
55  [Attribute(SCR_SoundEvent.SOUND_FE_BUTTON_HOVER)]
56  protected string m_sSoundHover;
57 
58  [Attribute()]
59  ref Color m_UnknownFactionColor;
60 
61  protected string m_sName;
62 
63  //------------------------------------------------------------------------------
64  override void HandlerAttached(Widget w)
65  {
66  m_wRoot = w;
67 
68  m_wImage = ImageWidget.Cast(w.FindAnyWidget("Image"));
69  m_wSelectImg = ImageWidget.Cast(w.FindAnyWidget("Corners"));
70  m_wHighlightImg = ImageWidget.Cast(w.FindAnyWidget("Highlight"));
71 
72  if (m_bUseBackgroundGradient)
73  m_wGradient = ImageWidget.Cast(w.FindAnyWidget("BackgroundGradient"));
74  }
75 
76  //------------------------------------------------------------------------------
77  void SetParent(SCR_MapUIElementContainer parent)
78  {
79  m_Parent = parent;
80  }
81 
82  //------------------------------------------------------------------------------
83  string GetName()
84  {
85  return m_sName;
86  }
87 
88  //------------------------------------------------------------------------------
89  bool GetIconVisible()
90  {
91  return m_bVisible;
92  }
93 
94 
95  //------------------------------------------------------------------------------
96  void ShowName(bool visible)
97  {
98  }
99 
100  //------------------------------------------------------------------------------
101  void SetVisible(bool visible)
102  {
103  m_wRoot.SetVisible(visible);
104  }
105 
106  //------------------------------------------------------------------------------
107  Widget GetRoot()
108  {
109  return m_wRoot;
110  }
111 
112 
113  // //------------------------------------------------------------------------------
114  // override bool OnMouseEnter(Widget w, int x, int y)
115  // {
116 
117  // return false;
118  // }
119 
120  // //------------------------------------------------------------------------------
121  // override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
122  // {
123 
124  // return false;
125  // }
126 
127  // ------------------------------------------------------------------------------
128  override bool OnClick(Widget w, int x, int y, int button)
129  {
130  if (m_bVisible)
131  SelectIcon();
132 
133  return false;
134  }
135 
136  // ------------------------------------------------------------------------------
137  void SelectIcon(bool invoke = true)
138  {
139  }
140 
141  // ------------------------------------------------------------------------------
142  void Select(bool select = true)
143  {
144  s_SelectedElement = this;
145  m_bIsSelected = select;
146  if (m_wSelectImg)
147  m_wSelectImg.SetVisible(select);
148  if (select)
149  {
150  s_SelectedElement = this;
151  AnimExpand();
152  }
153  else
154  {
155  AnimCollapse();
156  }
157  if (m_wGradient)
158  m_wGradient.SetVisible(select);
159  }
160 
161  //------------------------------------------------------------------------------
162  protected void AnimExpand()
163  {
164  }
165 
166  //------------------------------------------------------------------------------
167  protected void AnimCollapse()
168  {
169  }
170 
171  //------------------------------------------------------------------------------
172  protected void PlayHoverSound(string sound)
173  {
174  if (sound != string.Empty)
175  SCR_UISoundEntity.SoundEvent(sound);
176  }
177 
178  //------------------------------------------------------------------------------
179  vector GetPos()
180  {
181  }
182 
183  //------------------------------------------------------------------------------
184  protected void SetImage(string image)
185  {
186  }
187 
188  //------------------------------------------------------------------------------
189  Color GetColorForFaction(string factionKey)
190  {
191  FactionManager fm = GetGame().GetFactionManager();
192  if (!fm)
193  return null;
194 
195  Faction faction = fm.GetFactionByKey(factionKey);
196  if (!faction)
197  return Color.FromInt(m_UnknownFactionColor.PackToInt());
198 
199  return Color.FromInt(faction.GetFactionColor().PackToInt());
200  }
201 
202  //------------------------------------------------------------------------------
203  RplId GetSpawnPointId()
204  {
205  return RplId.Invalid();
206  }
207 
208  //------------------------------------------------------------------------------------------------
209  void SetName(string name);
210 };
NONE
@ NONE
Definition: SCR_MapUIElement.c:3
BASE
@ BASE
Definition: SCR_MapUIElement.c:4
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_UISoundEntity
Definition: SCR_UISoundEntity.c:7
SCR_EIconType
SCR_EIconType
Definition: SCR_MapUIElement.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
RELAY
@ RELAY
Definition: SCR_MapUIElement.c:6
SPAWNPOINT
@ SPAWNPOINT
Definition: SCR_MapUIElement.c:9
ENEMY_BASE
@ ENEMY_BASE
Definition: SCR_MapUIElement.c:5
Attribute
typedef Attribute
Post-process effect of scripted camera.
MapItem
Definition: MapItem.c:12
SERVICE
@ SERVICE
Definition: SCR_MapUIElement.c:8
TASK
@ TASK
Definition: SCR_MapUIElement.c:7
SCR_MapUIElement
Definition: SCR_MapUIElement.c:12
Faction
Definition: Faction.c:12
m_wImage
protected ImageWidget m_wImage
Definition: SCR_BackendImageComponent.c:248
SCR_MapUIElementContainer
Definition: SCR_MapUIElementContainer.c:1
m_sName
protected LocalizedString m_sName
Definition: SCR_GroupIdentityComponent.c:19
m_bVisible
protected bool m_bVisible
Definition: SCR_UITaskManagerComponent.c:28