Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ServerDetailEntry.c
Go to the documentation of this file.
1// Class for unifiying simple details widget behavior
2// Widget is displaying label, icons and additional data. Also it's appearance can be change on run to some extend.
3//------------------------------------------------------------------------------------------------
4
6{
7 const string WIDGET_LABEL = "Content";
8 const string WIDGET_ICON = "Icon";
9 const string WIDGET_DATA = "Data";
10
11 const string WIDGET_BACKGROUND = "Background";
12
13 [Attribute("true")]
14 protected bool m_bVisibleBackground;
15
16 [Attribute("true")]
17 protected bool m_bVisibleIcon;
18
19 [Attribute("true")]
20 protected bool m_bVisibleData;
21
22 [Attribute()]
23 protected string m_sLabel;
24
25 [Attribute(UIConstants.ICONS_IMAGE_SET, UIWidgets.ResourceNamePicker)]
27
28 [Attribute()]
29 protected string m_sImage;
30
34
36
37 //------------------------------------------------------------------------------------------------
38 override void HandlerAttached(Widget w)
39 {
40 super.HandlerAttached(w);
41
42 // Find widget elements
43 m_wTxtLabel = TextWidget.Cast(w.FindAnyWidget(WIDGET_LABEL));
44 m_wImgIcon = ImageWidget.Cast(w.FindAnyWidget(WIDGET_ICON));
45 m_wTxtData = TextWidget.Cast(w.FindAnyWidget(WIDGET_DATA));
46
47 m_wImgBackground = ImageWidget.Cast(w.FindAnyWidget(WIDGET_BACKGROUND));
48
49 // Visual setup
52 }
53
54 //------------------------------------------------------------------------------------------------
55 protected void VisualSetup()
56 {
57 // Background
59 {
61 }
62
63 // Icon
64 if (m_wImgIcon)
65 {
66 m_wImgIcon.SetVisible(m_bVisibleIcon);
67 }
68
69 // Data
70 if (m_wTxtData)
71 {
72 m_wTxtData.SetVisible(m_bVisibleData);
73 }
74
75 // Label
76 if (m_wTxtLabel && !m_sLabel.IsEmpty())
77 {
78 m_wTxtLabel.SetText(m_sLabel);
79 }
80 }
81
82 // User API
83 //------------------------------------------------------------------------------------------------
84 void SetLabelText(string text)
85 {
86 if (m_wTxtLabel)
87 m_wTxtLabel.SetText(text);
88 }
89
90 //------------------------------------------------------------------------------------------------
91 void SetIconFromImageSet(string text, ResourceName imageSet = string.Empty)
92 {
93 if (!imageSet)
94 imageSet = m_ImageSetDefault;
95
96 if (!imageSet)
97 return;
98
99 m_sImage = text;
100
101 if (m_wImgIcon)
102 m_wImgIcon.LoadImageFromSet(0, imageSet, m_sImage);
103 }
104
105 //------------------------------------------------------------------------------------------------
106 void SetDataText(string text)
107 {
108 if (m_wTxtData)
109 m_wTxtData.SetText(text);
110 }
111
112 //------------------------------------------------------------------------------------------------
113 void SetElementsVisible(bool label, bool icon, bool data)
114 {
115 if (m_wTxtLabel)
116 m_wTxtLabel.SetVisible(label);
117
118 if (m_wImgIcon)
119 m_wImgIcon.SetVisible(icon);
120
121 if (m_wTxtData)
122 m_wTxtData.SetVisible(data);
123
124 }
125
126 //------------------------------------------------------------------------------------------------
127 void SetBackroundVisible(bool visible)
128 {
130 {
131 m_wImgBackground.SetVisible(visible);
132 }
133 }
134};
Get all prefabs that have the spawner data
bool m_bVisibleData
void SetBackroundVisible(bool visible)
void SetIconFromImageSet(string text, ResourceName imageSet=string.Empty)
void SetLabelText(string text)
void SetElementsVisible(bool label, bool icon, bool data)
string m_sLabel
TextWidget m_wTxtData
ImageWidget m_wImgIcon
bool m_bVisibleBackground
ResourceName m_ImageSetDefault
string m_sImage
void SetDataText(string text)
TextWidget m_wTxtLabel
bool m_bVisibleIcon
override void HandlerAttached(Widget w)
ImageWidget m_wImgBackground
void VisualSetup()
Base class for all final Reforger interactive elements.
SCR_FieldOfViewSettings Attribute