DayZ 1.24
Loading...
Searching...
No Matches
MainMenuNewsfeed.c
Go to the documentation of this file.
1class MainMenuNewsfeed extends ScriptedWidgetEventHandler
2{
3 protected Widget m_Root;
4
5 protected Widget m_DLDLC;
6 protected Widget m_Discord;
7 protected Widget m_Feedback;
8 protected Widget m_DayZForum;
9 protected Widget m_Twitter;
10 protected Widget m_Youtube;
11
18
20 {
21 m_Root = root;
22
23 m_DLDLC = m_Root.FindAnyWidget("downloaddlc");
24 m_Discord = m_Root.FindAnyWidget("discord");
25 m_Feedback = m_Root.FindAnyWidget("feedback_tracker");
26 m_DayZForum = m_Root.FindAnyWidget("dayz_forums");
27 m_Twitter = m_Root.FindAnyWidget("twitter");
28 m_Youtube = m_Root.FindAnyWidget("youtube");
29
30 m_MainText1 = TextWidget.Cast(m_Root.FindAnyWidget("SGInfoT1"));
31 m_MainText2 = TextWidget.Cast(m_Root.FindAnyWidget("SGInfoT2"));
32 m_MainText3 = TextWidget.Cast(m_Root.FindAnyWidget("SGInfoT3"));
33 m_SecText1 = TextWidget.Cast(m_Root.FindAnyWidget("SGInfoC1"));
34 m_SecText2 = TextWidget.Cast(m_Root.FindAnyWidget("SGInfoC2"));
35 m_SecText3 = TextWidget.Cast(m_Root.FindAnyWidget("SGInfoC3"));
36
38
39 m_Root.SetHandler(this);
40 }
41
43 {
44 //m_Root.Show( true );
45 m_MainText1.SetText("#layout_mainmenu_newsfeed_sgz_title_1");
46 m_MainText1.Update();
47 m_MainText2.SetText("#layout_mainmenu_newsfeed_sgz_title_2");
48 m_MainText2.Update();
49 m_MainText3.SetText("#layout_mainmenu_newsfeed_sgz_title_3");
50 m_MainText3.Update();
51 m_SecText1.SetText("#layout_mainmenu_newsfeed_sgz_text_1");
52 m_SecText1.Update();
53 m_SecText2.SetText("#layout_mainmenu_newsfeed_sgz_text_2");
54 m_SecText2.Update();
55 m_SecText3.SetText("#layout_mainmenu_newsfeed_sgz_text_3");
56 m_SecText3.Update();
57 }
58
60 {
61 m_Root.Show(false);
62 }
63
64 void OpenDLC()
65 {
66 GetGame().OpenURL("https://store.steampowered.com/app/830660/Survivor_GameZ/");
67 }
68
70 {
71 GetGame().OpenURL("https://discord.gg/bXkyMNm");
72 }
73
75 {
76 GetGame().OpenURL("https://feedback.bistudio.com/tag/dayz");
77 }
78
80 {
81 GetGame().OpenURL("https://forums.dayz.com");
82 }
83
85 {
86 GetGame().OpenURL("https://twitter.com/DayZ");
87 }
88
90 {
91 GetGame().OpenURL("https://www.youtube.com/user/DayZDevTeam");
92 }
93
94 override bool OnClick(Widget w, int x, int y, int button)
95 {
96 if (button == MouseState.LEFT)
97 {
98 if (w == m_DLDLC)
99 {
100 OpenDLC();
101 return true;
102 }
103 else if (w == m_Discord)
104 {
105 OpenDiscord();
106 return true;
107 }
108 else if (w == m_Feedback)
109 {
110 OpenFeedback();
111 return true;
112 }
113 else if (w == m_DayZForum)
114 {
115 OpenForums();
116 return true;
117 }
118 else if (w == m_Twitter)
119 {
120 OpenTwitter();
121 return true;
122 }
123 else if (w == m_Youtube)
124 {
125 OpenYoutube();
126 return true;
127 }
128 }
129 return false;
130 }
131
132 override bool OnMouseEnter(Widget w, int x, int y)
133 {
134 if (IsFocusable(w))
135 {
136 ColorRed(w, x, y);
137 return true;
138 }
139 return false;
140 }
141
142 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
143 {
144 if (IsFocusable(w))
145 {
146 ColorWhite(w, enterW, x, y);
147 return true;
148 }
149 return false;
150 }
151
152 override bool OnFocus(Widget w, int x, int y)
153 {
154 if (IsFocusable(w))
155 {
156 ColorRed(w, x, y);
157 return true;
158 }
159 return false;
160 }
161
162 override bool OnFocusLost(Widget w, int x, int y)
163 {
164 if (IsFocusable(w))
165 {
166 ColorWhite(w, null, x, y);
167 return true;
168 }
169 return false;
170 }
171
173 {
174 if (w)
175 return (w == m_DLDLC || w == m_Discord || w == m_Feedback || w == m_DayZForum || w == m_Twitter || w == m_Youtube);
176 return false;
177 }
178
179 //Coloring functions (Until WidgetStyles are useful)
180 void ColorRed(Widget w, int x, int y)
181 {
182 SetFocus(w);
183 if (w.IsInherited(ButtonWidget))
184 {
186 button.SetTextColor(ARGB(255, 255, 0, 0));
187 button.SetAlpha(0.9);
188 }
189
190 TextWidget text = TextWidget.Cast(w.FindWidget(w.GetName() + "_text"));
191 TextWidget text2 = TextWidget.Cast(w.FindWidget(w.GetName() + "_text_1"));
192 ImageWidget image = ImageWidget.Cast(w.FindWidget(w.GetName() + "_image"));
193
194 if (text)
195 text.SetColor(ARGB(255, 255, 0, 0));
196
197 if (text2)
198 text2.SetColor(ARGB(255, 255, 0, 0));
199
200 if (image)
201 image.SetColor(ARGB(255, 255, 0, 0));
202 }
203
204 void ColorWhite(Widget w, Widget enterW, int x, int y)
205 {
206 if (w.IsInherited(ButtonWidget))
207 {
209 button.SetTextColor(ARGB(255, 255, 255, 255));
210 button.SetAlpha(0.75);
211 }
212
213 TextWidget text = TextWidget.Cast(w.FindWidget(w.GetName() + "_text"));
214 TextWidget text2 = TextWidget.Cast(w.FindWidget(w.GetName() + "_text_1"));
215 ImageWidget image = ImageWidget.Cast(w.FindWidget(w.GetName() + "_image"));
216
217 if (text)
218 text.SetColor(ARGB(255, 255, 255, 255));
219
220 if (text2)
221 text2.SetColor(ARGB(255, 255, 255, 255));
222
223 if (image)
224 image.SetColor(ARGB(255, 255, 255, 255));
225 }
226}
Icon x
Icon y
Widget m_Root
Definition SizeToChild.c:85
map: item x vector(index, width, height)
Definition EnWidgets.c:651
override bool OnFocusLost(Widget w, int x, int y)
void MainMenuNewsfeed(Widget root)
void ColorWhite(Widget w, Widget enterW, int x, int y)
void ColorRed(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
override bool OnClick(Widget w, int x, int y, int button)
bool IsFocusable(Widget w)
Definition CTKeyframe.c:156
override bool OnFocus(Widget w, int x, int y)
override bool OnMouseEnter(Widget w, int x, int y)
proto native CGame GetGame()
MouseState
Definition EnSystem.c:311
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Definition proto.c:322