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";
11 protected TextWidget m_wText;
12 protected Widget m_wHeader;
13 protected Widget m_wLinks;
14 protected ref array<ref Widget> m_wLinkButtons =
new array<ref Widget>;
15 protected Widget m_wLastFocusedLinkButton;
20 protected int m_iCurrentIndex;
21 protected int m_iMaxIndex;
22 protected ref array<string> m_aPageTexts =
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"
34 override void OnMenuOpen()
38 m_iMaxIndex = m_aPageTexts.Count() - 1;
40 m_wText = TextWidget.Cast(w.FindAnyWidget(m_sTextName));
41 m_wHeader = w.FindAnyWidget(m_sHeaderName);
43 m_wLinks = w.FindAnyWidget(m_sLinksName);
47 if(!m_wLinkButtons.IsEmpty())
50 foreach(Widget linkButton : m_wLinkButtons)
56 buttonComp.m_OnFocus.Insert(OnLinkButtonFocus);
62 m_Previous.m_OnActivated.Insert(OnPrevious);
66 m_Next.m_OnActivated.Insert(OnNext);
68 Widget hint = w.FindAnyWidget(m_sSelectionHintName);
74 m_SelectionHint.SetItemCount(m_aPageTexts.Count(),
false);
75 m_SelectionHint.SetCurrentItem(m_iCurrentIndex,
false);
83 override void OnMenuUpdate(
float tDelta)
85 super.OnMenuUpdate(tDelta);
87 GetGame().GetInputManager().ActivateContext(
"InteractableDialogContext");
91 override void OnConfirm()
94 if(!m_wLastFocusedLinkButton ||
GetGame().
GetInputManager().GetLastUsedInputDevice() != EInputDeviceType.MOUSE)
98 linkComp.OpenBrowser();
102 protected void OnPrevious()
104 ShowIndex(m_iCurrentIndex - 1);
108 protected void OnNext()
110 ShowIndex(m_iCurrentIndex + 1);
114 protected void OnLinkButtonFocus(Widget linkButton)
118 m_wLastFocusedLinkButton = linkButton;
122 protected void ShowIndex(
int index)
124 if (index < 0 || index > m_iMaxIndex)
127 m_iCurrentIndex =
index;
130 m_wLinks.SetVisible(
index == m_iMaxIndex);
132 if(
index == m_iMaxIndex && !m_wLinkButtons.IsEmpty())
135 if(!m_wLastFocusedLinkButton)
136 m_wLastFocusedLinkButton = m_wLinkButtons[0];
137 GetGame().GetWorkspace().SetFocusedWidget(m_wLastFocusedLinkButton);
152 GetGame().GetWorkspace().SetFocusedWidget(
null);
156 m_Previous.SetEnabled(
index != 0);
159 m_Next.SetEnabled(
index != m_iMaxIndex);
162 m_wText.SetTextFormat(m_aPageTexts[
index]);
165 m_SelectionHint.SetCurrentItem(
index);