Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
WelcomeDialog.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 protected string m_sHeaderName = "Title";
5 protected string m_sTextName = "Text";
6 protected string m_sSelectionHintName = "SelectionHint";
7 protected string m_sPreviousName = "Previous";
8 protected string m_sNextName = "Next";
9 protected string m_sLinksName = "Links";
10
12 protected Widget m_wHeader;
13 protected Widget m_wLinks;
14 protected ref array<ref Widget> m_wLinkButtons = new array<ref Widget>;
19
20 protected int m_iCurrentIndex;
21 protected int m_iMaxIndex;
22 protected ref array<string> m_aPageTexts =
23 {
24 "#ar-welcomescreen_text_01",
25 "#ar-welcomescreen_text_02",
26 "#ar-welcomescreen_text_03",
27 "#ar-welcomescreen_text_04",
28 "#ar-welcomescreen_text_05",
29 "#ar-welcomescreen_text_06",
30 "#ar-welcomescreen_text_07"
31 };
32
33 protected ref array<string> m_aPageTextsPS =
34 {
35 "#ar-welcomescreen_text_01",
36 "#ar-welcomescreen_text_02",
37 "#ar-welcomescreen_text_03",
38 "#ar-welcomescreen_text_06"
39 };
40
41 //------------------------------------------------------------------------------------------------
42 override void OnMenuOpen()
43 {
44 super.OnMenuOpen();
45
46 if (System.GetPlatform() == EPlatform.PS5 || System.GetPlatform() == EPlatform.PS4 || System.GetPlatform() == EPlatform.PS5_PRO)
48
49 m_iMaxIndex = m_aPageTexts.Count() - 1;
51 m_wText = TextWidget.Cast(w.FindAnyWidget(m_sTextName));
52 m_wHeader = w.FindAnyWidget(m_sHeaderName);
53
54 m_wLinks = w.FindAnyWidget(m_sLinksName);
55 if(m_wLinks)
57
58 if(!m_wLinkButtons.IsEmpty())
59 {
60 SCR_ButtonTextComponent buttonComp;
61 foreach(Widget linkButton : m_wLinkButtons)
62 {
63 buttonComp = SCR_ButtonTextComponent.Cast(linkButton.FindHandler(SCR_ButtonTextComponent));
64 if(!buttonComp)
65 continue;
66
67 buttonComp.m_OnFocus.Insert(OnLinkButtonFocus);
68 }
69 }
70
72 if (m_Previous)
73 m_Previous.m_OnActivated.Insert(OnPrevious);
74
76 if (m_Next)
77 m_Next.m_OnActivated.Insert(OnNext);
78
79 Widget hint = w.FindAnyWidget(m_sSelectionHintName);
80 if (hint)
81 {
84 {
85 m_SelectionHint.SetItemCount(m_aPageTexts.Count(), false);
86 m_SelectionHint.SetCurrentItem(m_iCurrentIndex, false);
87 }
88 }
89
90 ShowIndex(0);
91 }
92
93 //------------------------------------------------------------------------------------------------
94 override void OnMenuUpdate(float tDelta)
95 {
96 super.OnMenuUpdate(tDelta);
97
98 GetGame().GetInputManager().ActivateContext("InteractableDialogContext");
99 }
100
101 //------------------------------------------------------------------------------------------------
102 override void OnConfirm()
103 {
105 if(!m_wLastFocusedLinkButton || GetGame().GetInputManager().GetLastUsedInputDevice() != EInputDeviceType.MOUSE)
106 return;
107
109 linkComp.OpenBrowser();
110 }
111
112 //------------------------------------------------------------------------------------------------
113 protected void OnPrevious()
114 {
116 }
117
118 //------------------------------------------------------------------------------------------------
119 protected void OnNext()
120 {
122 }
123
124 //------------------------------------------------------------------------------------------------
125 protected void OnLinkButtonFocus(Widget linkButton)
126 {
127 SCR_BrowserLinkComponent linkComp = SCR_BrowserLinkComponent.Cast(linkButton.FindHandler(SCR_BrowserLinkComponent));
128
129 m_wLastFocusedLinkButton = linkButton;
130 }
131
132 //------------------------------------------------------------------------------------------------
133 protected void ShowIndex(int index)
134 {
136 return;
137
139
140 if (m_wLinks)
141 m_wLinks.SetVisible(index == m_iMaxIndex);
142
143 if(index == m_iMaxIndex && !m_wLinkButtons.IsEmpty())
144 {
148 GetGame().GetWorkspace().SetFocusedWidget(m_wLastFocusedLinkButton);
149
150 /*
151 if (m_Confirm)
152 //m_Confirm.SetVisible(true);
153 */
154 }
155 else
156 {
157 /*
158 if (m_Confirm)
159 m_Confirm.SetVisible(false);
160 */
161
163 GetGame().GetWorkspace().SetFocusedWidget(null);
164 }
165
166 if (m_Previous)
167 m_Previous.SetEnabled(index != 0);
168
169 if (m_Next)
170 m_Next.SetEnabled(index != m_iMaxIndex);
171
172 if (m_wText)
173 m_wText.SetTextFormat(m_aPageTexts[index]);
174
175 if (m_SelectionHint)
176 m_SelectionHint.SetCurrentItem(index);
177 }
178
179};
180
181
ArmaReforgerScripted GetGame()
Definition game.c:1398
InputManager GetInputManager()
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Widget GetRootWidget()
static SCR_InputButtonComponent GetInputButtonComponent(string name, notnull Widget parent, bool searchAllChildren=true)
void ShowIndex(int index)
string m_sSelectionHintName
void OnLinkButtonFocus(Widget linkButton)
string m_sPreviousName
Widget m_wLastFocusedLinkButton
override void OnMenuOpen()
TextWidget m_wText
override void OnMenuUpdate(float tDelta)
SCR_SelectionHintComponent m_SelectionHint
SCR_InputButtonComponent m_Previous
override void OnConfirm()
ref array< ref Widget > m_wLinkButtons
ref array< string > m_aPageTexts
SCR_InputButtonComponent m_Next
ref array< string > m_aPageTextsPS
EPlatform
Definition EPlatform.c:13