Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WidgetHintComponent.c
Go to the documentation of this file.
1/*
2Widget component for short message suggesting what needs to be done with widget.
3*/
4
5//------------------------------------------------------------------------------------------------
7{
8//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
9// While these attributes in theory allow reusing the component in different layouts, it is often the case that for the prefab to work the layout hierarchy needs to be very consistent, so components end up tied to very specific layouts anyways. Might as well have predefined widget names: these just attributes clutter the component's settings
10
11 [Attribute("Icon", UIWidgets.EditBox, "Widget name to find icon")]
12 protected string m_sWidgetIcon;
13
14 [Attribute("Message", UIWidgets.EditBox, "Widget name to find message text widget")]
15 protected string m_sWidgetMessage;
16
17 [Attribute("Bumper", UIWidgets.EditBox, "Widget name to find message text widget")]
18 protected string m_sWidgetBumper;
19
20//---- REFACTOR NOTE END ----
21
22 [Attribute("", UIWidgets.EditBox, "Default message to display")]
23 protected string m_sDefaultMessage;
24
25 [Attribute("0", UIWidgets.EditBox, "True will set bumper widget to visible which will offest the message")]
26 protected bool m_bUseBumber;
27
30 protected Widget m_wBumper;
31
32 //------------------------------------------------------------------------------------------------
33 override void HandlerAttached(Widget w)
34 {
35 super.HandlerAttached(w);
36
37 m_wIcon = ImageWidget.Cast(w.FindAnyWidget(m_sWidgetIcon));
38 m_wMessage = TextWidget.Cast(w.FindAnyWidget(m_sWidgetMessage));
39 m_wBumper = w.FindAnyWidget(m_sWidgetBumper);
40
42
43 if (m_wBumper)
44 m_wBumper.SetVisible(m_bUseBumber);
45 }
46
47 //------------------------------------------------------------------------------------------------
48 override void SetVisible(bool visible, bool animate = true)
49 {
50 if (animate)
51 {
52 if (!visible || m_wRoot.GetOpacity() == 0)
53 {
54 m_wRoot.SetVisible(visible);
55 return;
56 }
57 else if (visible || m_wRoot.GetOpacity() == 1)
58 {
59 m_wRoot.SetVisible(visible);
60 return;
61 }
62 }
63
64 super.SetVisible(visible, animate);
65 }
66
67 //-----------------------------------------------------------/-------------------------------------
68 // API
69 //------------------------------------------------------------------------------------------------
70
71 //------------------------------------------------------------------------------------------------
72 void SetMessage(string message)
73 {
74 if (m_wMessage)
75 m_wMessage.SetText(message);
76 }
77
78 //------------------------------------------------------------------------------------------------
79 string GetMessage()
80 {
81 return m_wMessage.GetText();
82 }
83
84 //------------------------------------------------------------------------------------------------
86 {
87 if (m_wMessage)
89 }
90}
Base class for all final Reforger interactive elements.
override void HandlerAttached(Widget w)
void SetMessage(string message)
override void SetVisible(bool visible, bool animate=true)
SCR_FieldOfViewSettings Attribute