Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_TaskIconComponent.c
Go to the documentation of this file.
1 class SCR_TaskIconComponent : ScriptedWidgetComponent
2 {
3  [Attribute("1", UIWidgets.ComboBox, "Icon type", "", ParamEnumArray.FromEnum(ETaskIconType) )]
4  protected ETaskIconType m_TaskIconType;
5 
6  [Attribute("0.898 0.541 0.184 1", UIWidgets.ColorPicker)]
7  protected ref Color m_BackgroundColor;
8 
9  [Attribute("0 0 0 1", UIWidgets.ColorPicker)]
10  protected ref Color m_IconColor;
11 
12  [Attribute("0 0 0 1", UIWidgets.ColorPicker)]
13  protected ref Color m_OutlineColor;
14 
15  [Attribute("0 0 0 1", UIWidgets.ColorPicker)]
16  protected ref Color m_HoverColor;
17 
18  [Attribute("1", UIWidgets.CheckBox)]
19  protected bool m_BackgroundShown;
20 
21  [Attribute("1", UIWidgets.CheckBox)]
22  protected bool m_IconShown;
23 
24  [Attribute("1", UIWidgets.CheckBox)]
25  protected bool m_OutlineShown;
26 
27  [Attribute("0", UIWidgets.CheckBox)]
28  protected bool m_HoverShown;
29 
30  protected const string TASK_ICON_IMAGESET = "{10C0A9A305E8B3A4}UI/Imagesets/Tasks/Task_Icons.imageset";
31 
32  protected Widget m_wRoot;
33  //------------------------------------------------------------------------------------------------
34  override void HandlerAttached(Widget w)
35  {
36  m_wRoot = w;
37  SetBackgroundColor(m_BackgroundColor);
38  SetIconColor(m_IconColor);
39  SetOutlineColor(m_OutlineColor);
40  SetHoverColor(m_HoverColor);
41  BackgroundShown(m_BackgroundShown);
42  IconShown(m_IconShown);
43  OutlineShown(m_OutlineShown);
44  HoverShown(m_HoverShown);
45  SetIconType(m_TaskIconType);
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  void SetBackgroundColor(Color color)
50  {
51  ImageWidget background = ImageWidget.Cast(m_wRoot.FindAnyWidget("Background"));
52  if (!background)
53  return;
54  background.SetColor(color);
55  }
56 
57  //------------------------------------------------------------------------------------------------
58  void SetIconColor(Color color)
59  {
60  ImageWidget icon = ImageWidget.Cast(m_wRoot.FindAnyWidget("Icon"));
61  if (!icon)
62  return;
63  icon.SetColor(color);
64  }
65 
66  //------------------------------------------------------------------------------------------------
67  void SetOutlineColor(Color color)
68  {
69  ImageWidget outline = ImageWidget.Cast(m_wRoot.FindAnyWidget("Outline"));
70  if (!outline)
71  return;
72  outline.SetColor(color);
73  }
74 
75  //------------------------------------------------------------------------------------------------
76  void SetHoverColor(Color color)
77  {
78  ImageWidget hover = ImageWidget.Cast(m_wRoot.FindAnyWidget("Hover"));
79  if (!hover)
80  return;
81  hover.SetColor(color);
82  }
83 
84  //------------------------------------------------------------------------------------------------
85  void BackgroundShown(bool shown)
86  {
87  ImageWidget background = ImageWidget.Cast(m_wRoot.FindAnyWidget("Background"));
88  if (!background)
89  return;
90  if (shown)
91  background.SetOpacity(1);
92  else
93  background.SetOpacity(0);
94  }
95 
96  //------------------------------------------------------------------------------------------------
97  void IconShown(bool shown)
98  {
99  ImageWidget icon = ImageWidget.Cast(m_wRoot.FindAnyWidget("Icon"));
100  if (!icon)
101  return;
102  if (shown)
103  icon.SetOpacity(1);
104  else
105  icon.SetOpacity(0);
106  }
107 
108  //------------------------------------------------------------------------------------------------
109  void OutlineShown(bool shown)
110  {
111  ImageWidget outline = ImageWidget.Cast(m_wRoot.FindAnyWidget("Outline"));
112  if (!outline)
113  return;
114  if (shown)
115  outline.SetOpacity(1);
116  else
117  outline.SetOpacity(0);
118  }
119 
120  //------------------------------------------------------------------------------------------------
121  void HoverShown(bool shown)
122  {
123  ImageWidget hover = ImageWidget.Cast(m_wRoot.FindAnyWidget("Hover"));
124  if (!hover)
125  return;
126  if (shown)
127  hover.SetOpacity(1);
128  else
129  hover.SetOpacity(0);
130  }
131 
132  //------------------------------------------------------------------------------------------------
133  void SetIconType(ETaskIconType type)
134  {
135  ImageWidget icon = ImageWidget.Cast(m_wRoot.FindAnyWidget("Icon"));
136  if (!icon)
137  return;
138  string iconName;
139  int x,y;
140  //TODO:Marian change this to not use enum but strings to become modder friendly
141  switch (type)
142  {
143  case ETaskIconType.CUSTOM:
144  iconName = "Icon_Task_Custom";
145  break;
146  case ETaskIconType.EVACUATE:
147  iconName = "Icon_Task_Evacuate";
148  break;
149  case ETaskIconType.GUARD:
150  iconName = "Icon_Task_Guard";
151  break;
152  case ETaskIconType.MOVE:
153  iconName = "Icon_Task_Move";
154  break;
155  case ETaskIconType.SEIZE_RELAY:
156  iconName = "Icon_Task_Seize_Relay";
157  break;
158  case ETaskIconType.REFUEL:
159  iconName = "Icon_Task_Refuel";
160  break;
161  case ETaskIconType.SEIZE:
162  iconName = "Icon_Task_Seize";
163  break;
164  case ETaskIconType.TRANSPORT:
165  iconName = "Icon_Task_Transport";
166  }
167  icon.LoadImageFromSet(0, TASK_ICON_IMAGESET, iconName);
168  icon.GetImageSize(0, x, y);
169  icon.SetSize(x, y);
170  }
171 };
172 
174 {
183 };
CUSTOM
@ CUSTOM
Definition: SCR_TaskIconComponent.c:175
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
ETaskIconType
ETaskIconType
Definition: SCR_TaskIconComponent.c:173
GUARD
@ GUARD
Definition: SCR_TaskIconComponent.c:177
SEIZE_RELAY
@ SEIZE_RELAY
Definition: SCR_TaskIconComponent.c:179
MOVE
@ MOVE
Definition: SCR_TaskIconComponent.c:178
SCR_TaskIconComponent
Definition: SCR_TaskIconComponent.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
TRANSPORT
@ TRANSPORT
Definition: SCR_TaskIconComponent.c:182
REFUEL
@ REFUEL
Definition: SCR_TaskIconComponent.c:180
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
EVACUATE
@ EVACUATE
Definition: SCR_TaskIconComponent.c:176
SEIZE
@ SEIZE
Definition: SCR_TaskIconComponent.c:181