Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_DamageStateUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute(desc: "Config to get visuals from", params: "conf class=SCR_DamageStateConfig")]
5
6 [Attribute(desc: "If true will auto set icon, background and outline for the given type as well as colors")]
7 protected bool m_bAutoSetVisuals;
8
9 [Attribute(desc: "Damage type of visuals. Will be set automatically m_bAutoSetVisuals = true. Will be ignored if custom is set", uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EDamageType))]
11
12 [Attribute("Icon", desc: "Icon to set")]
13 protected string m_sIconName;
14
15 [Attribute("Outline", desc: "Outline to set")]
16 protected string m_sOutlineName;
17
18 [Attribute("Background", desc: "Background to set")]
19 protected string m_sBackgroundName;
20
22
23 protected Widget m_wRoot;
24
29 void SetVisuals(EDamageType damageType)
30 {
32 return;
33
34 m_eDamageType = damageType;
35
36 SetVisuals(m_DamageStateConfig.GetUiInfo(damageType));
37 }
38
43 void SetVisuals(SCR_DamageStateUIInfo uiInfo, int iconIndex = -1)
44 {
45 m_UiInfo = uiInfo;
46
47 m_wRoot.SetVisible(m_UiInfo != null);
48
49 if (!m_UiInfo)
50 return;
51
52 ImageWidget icon = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sIconName));
53 ImageWidget outline = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sOutlineName));
54 ImageWidget background = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sBackgroundName));
55
56 ResourceName image;
57 string quadName;
58
59 if (icon)
60 {
61 icon.SetVisible(m_UiInfo.SetIconTo(icon, iconIndex));
62 icon.SetColor(m_UiInfo.GetColor());
63 }
64
65 if (outline)
66 {
67 image = m_UiInfo.GetOutlineImage();
68 quadName = m_UiInfo.GetOutlineQuadName();
69
70 outline.SetVisible(m_UiInfo.SetImageTo(outline, image, quadName));
71 outline.SetColor(m_UiInfo.GetOutlineColor());
72 }
73
74 if (background)
75 {
76 image = m_UiInfo.GetBackgroundImage();
77 quadName = m_UiInfo.GetBackgroundQuadName();
78
79 background.SetVisible(m_UiInfo.SetImageTo(background, image, quadName));
80 background.SetColor(m_UiInfo.GetBackgroundColor());
81 }
82 }
83
88 void SetSize(float size)
89 {
90 ImageWidget icon = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sIconName));
91 ImageWidget outline = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sOutlineName));
92 ImageWidget background = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sBackgroundName));
93
94 if (icon)
95 icon.SetSize(size, size);
96 if (outline)
97 outline.SetSize(size, size);
98 if (background)
99 background.SetSize(size, size);
100 }
101
107 {
108 return m_UiInfo;
109 }
110
111 override void HandlerAttached(Widget w)
112 {
113 m_wRoot = w;
114
116 {
117 Print("'SCR_DamageStateUIComponent' is missing 'SCR_DamageStateConfig'", LogLevel.ERROR);
118 return;
119 }
120
123 }
124};
int size
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ref SCR_DamageStateConfig m_DamageStateConfig
override void HandlerAttached(Widget w)
void SetVisuals(EDamageType damageType)
void SetVisuals(SCR_DamageStateUIInfo uiInfo, int iconIndex=-1)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
EDamageType
Definition EDamageType.c:13