DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ServerBrowserDetailsContainer.c
См. документацию.
1class ServerBrowserDetailsContainer extends ScriptedWidgetEventHandler
2{
4
5 protected Widget m_Root;
11
12 #ifdef PLATFORM_WINDOWS
13 #ifndef PLATFORM_CONSOLE
14 protected GridSpacerWidget m_FriendsContainer;
15 protected TextWidget m_FriendsResult;
16 #endif
17 #endif
18
20 protected ImageWidget m_TimeIcon;
21
23
24 protected WrapSpacerWidget m_VersionContainer;
26
27 protected GridSpacerWidget m_ServerDecContainer;
28 protected MultilineTextWidget m_ServerDesc;
29
30 protected WrapSpacerWidget m_DetailsContainerRight;
31 protected ImageWidget m_MapImage;
32
33 protected ButtonWidget m_BtnShowFilters;
34 protected ButtonWidget m_RefreshList;
35
36 protected bool m_IsOnline;
37
39 {
40 m_Root = root;
41 m_Tab = parent;
42
43 m_ServerNameText = TextWidget.Cast(root.FindAnyWidget("details_servername_label"));
44 m_ServerTypeResult = TextWidget.Cast(root.FindAnyWidget("details_servertype_result_label"));
45 m_ServerModeResult = TextWidget.Cast(root.FindAnyWidget("details_mode_result_label"));
46 m_LastCharacterResult = TextWidget.Cast(root.FindAnyWidget("details_character_result_label"));
47 m_ServerIP = TextWidget.Cast(root.FindAnyWidget("details_ip_result_label"));
48
49 #ifdef PLATFORM_WINDOWS
50 #ifndef PLATFORM_CONSOLE
51 m_FriendsContainer = GridSpacerWidget.Cast(root.FindAnyWidget("details_friends_container"));
52 m_FriendsResult = TextWidget.Cast(root.FindAnyWidget("details_friends_result_label"));
53 #endif
54 #endif
55
56 m_TimeAccelerationResult = TextWidget.Cast(root.FindAnyWidget("details_time_result_label"));
57 m_TimeIcon = ImageWidget.Cast(root.FindAnyWidget("detail_time_img"));
58
59 m_BattleyeResult = TextWidget.Cast(root.FindAnyWidget("details_battleye_result_label"));
60
61 m_VersionContainer = WrapSpacerWidget.Cast(root.FindAnyWidget("details_version_container"));
62 m_VersionResult = TextWidget.Cast(root.FindAnyWidget("details_version_result_label"));
63
64 m_ServerDecContainer = GridSpacerWidget.Cast(root.FindAnyWidget("details_description_container"));
65 m_ServerDesc = MultilineTextWidget.Cast(root.FindAnyWidget("details_description_label"));
66
67 m_DetailsContainerRight = WrapSpacerWidget.Cast(root.FindAnyWidget("details_container_right"));
68 m_MapImage = ImageWidget.Cast(root.FindAnyWidget("map_image"));
69
70 m_TimeIcon.LoadImageFile(0, "set:dayz_gui image:icon_sun");
71 m_TimeIcon.LoadImageFile(1, "set:dayz_gui image:icon_sun_accel");
72 m_TimeIcon.LoadImageFile(2, "set:dayz_gui image:icon_moon");
73 m_TimeIcon.LoadImageFile(3, "set:dayz_gui image:icon_moon_accel");
74
75 m_BtnShowFilters = ButtonWidget.Cast(parent.GetDetailsRoot().FindAnyWidget("show_filters_button"));
76 m_RefreshList = ButtonWidget.Cast(parent.GetFilterRoot().FindAnyWidget("refresh_list_button"));
77 }
78
79 void SetDetails(GetServersResultRow serverInfo, bool online = false)
80 {
81 if (!online)
82 {
84 return;
85 }
86
87 if (serverInfo)
88 {
89 SetName(serverInfo.m_Name);
90 #ifdef PLATFORM_WINDOWS
91 #ifndef PLATFORM_CONSOLE
92 SetType(serverInfo.m_ShardId);
93 SetMode(serverInfo.m_Disable3rdPerson);
94 #endif
95 #endif
96 #ifdef PLATFORM_CONSOLE
97 SetMode(serverInfo.m_ModeId);
98 SetConsoleType(serverInfo.m_Official);
99 #endif
100 SetServerIP(serverInfo.GetIpPort());
101
103 /*
104 SetTimeAcceleration(serverInfo.m_EnvironmentTimeMul, serverInfo.m_EnvironmentNightTimeMul);
105 */
106
107 SetTimeIcon(serverInfo.m_TimeOfDay, serverInfo.m_EnvironmentTimeMul);
108 #ifdef PLATFORM_WINDOWS
109 #ifndef PLATFORM_CONSOLE
110 SetCharacter(serverInfo.m_CharactersAlive);
111 SetFriends(serverInfo.m_SteamFriends);
112 #endif
113 #endif
114
116 /*
117 SetBattleyeState(serverInfo.m_AntiCheat);
118 */
119
121 /*
122 SetVersion(serverInfo.m_GameVersion);
123 */
124
125 SetServerDesc(serverInfo.m_Description);
126 }
127
129 m_DetailsContainerRight.Show(false);
130 //SetServerMap();
131 }
132
134 {
135 m_ServerNameText.SetText("#STR_server_browser_details_no_server_selected");
136 m_ServerTypeResult.SetText("-");
137 m_ServerModeResult.SetText("-");
138 m_ServerIP.SetText("-");
139 m_TimeIcon.Show(false);
140 m_TimeAccelerationResult.Show(true);
141 m_TimeAccelerationResult.SetText("-");
142 }
143
144 protected void SetName(string name)
145 {
146 m_ServerNameText.SetText(name);
147 m_ServerNameText.Update();
148 }
149
150 protected void SetType(string shardId)
151 {
152 string result = "#server_browser_tab_community";
153 if (shardId.Length() == 3 && shardId.ToInt() < 200)
154 result = "#server_browser_entry_official";
155
156 m_ServerTypeResult.SetText(result);
157 }
158
159 #ifdef PLATFORM_CONSOLE
160 protected void SetConsoleType(bool offical)
161 {
162 string result = "#server_browser_tab_community";
163 if (offical)
164 result = "#server_browser_entry_official";
165
166 m_ServerTypeResult.SetText(result);
167 }
168 #endif
169
170 protected void SetMode(int mode)
171 {
172 string result = "#STR_server_browser_no_server_selected";
173 switch (mode)
174 {
175 case 0:
176 {
177 result = "#STR_server_browser_details_third_person";
178 break;
179 }
180 case 1:
181 {
182 result = "#STR_server_browser_details_first_person";
183 break;
184 }
185 }
186
187 m_ServerModeResult.SetText(result);
188 }
189
190 protected void SetServerIP(string ip)
191 {
192 m_ServerIP.SetText(ip);
193 }
194
195#ifdef PLATFORM_WINDOWS
196 #ifndef PLATFORM_CONSOLE
197 protected void SetCharacter(string characterName)
198 {
199 string result = "#STR_server_browser_char_not_alive";
200 if (characterName != "")
201 result = characterName;
202
203 m_LastCharacterResult.SetText(result);
204 }
205
206 protected void SetFriends(string steamFriends = "")
207 {
208 string result = "-";
209 if (steamFriends != "")
210 result = steamFriends;
211
212 m_FriendsResult.SetText(result);
213 m_FriendsResult.Update();
214 }
215 #endif
216#endif
217
218 protected void SetTimeAcceleration(float timeMul, float nightTimeMul)
219 {
220 m_TimeAccelerationResult.SetText(timeMul.ToString() + "/" + nightTimeMul.ToString());
221 }
222
223 void SetTimeIcon(string time, float multiplier)
224 {
225 if (time != "")
226 {
227 TStringArray arr = new TStringArray;
228 time.Split(":", arr);
229
230 if (arr.Count() == 2)
231 {
232 int hour = arr.Get(0).ToInt();
233 int minute = arr.Get(1).ToInt();
234
235 if (hour >= 19 || hour <= 5) //Night
236 {
237 if (multiplier > 1)
238 m_TimeIcon.SetImage(3);
239 else
240 m_TimeIcon.SetImage(2);
241 }
242 else //Day
243 {
244 if (multiplier > 1)
245 m_TimeIcon.SetImage(1);
246 else
247 m_TimeIcon.SetImage(0);
248 }
249
250 m_TimeIcon.Show(true);
251 m_TimeAccelerationResult.Show(false);
252 }
253 }
254 else
255 {
256 m_TimeIcon.Show(false);
257 m_TimeAccelerationResult.Show(true);
258 m_TimeAccelerationResult.SetText("-");
259 }
260 }
261
262 protected void SetBattleyeState(int enabled = -1)
263 {
264 string result = "#STR_server_browser_no_server_selected";
265 int color = ARGB(255, 255, 255, 255);
266
267 switch (enabled)
268 {
269 case 0:
270 {
271 result = "#server_browser_entry_disabled";
272 color = ARGB(255, 255, 0, 0);
273 break:
274 }
275 case 1:
276 {
277 result = "#server_browser_entry_enabled";
278 color = ARGB(255, 0, 255, 0);
279 break:
280 }
281 }
282
283 m_BattleyeResult.SetText(result);
284 m_BattleyeResult.SetColor(color);
285 }
286
287 protected void SetVersion(string version)
288 {
289 m_VersionResult.SetText(version);
290 }
291
292 protected void SetServerDesc(string desc)
293 {
294 m_ServerDesc.SetText(desc);
295 m_ServerDesc.Update();
296 }
297
298 protected void SetServerMap(GetServersResultRow serverInfo)
299 {
300 string mapImagePath = ServerBrowserHelperFunctions.GetServerMapImagePath(serverInfo.m_MapNameToRun);
301 m_MapImage.LoadImageFile(0, mapImagePath);
302 m_DetailsContainerRight.Show(true);
303 }
304
305 void Focus()
306 {
307 #ifdef PLATFORM_CONSOLE
308 if (m_Tab.GetTabType() == TabType.FAVORITE)
309 {
311 }
312 else
313 {
315 }
316 #endif
317 }
318
319 override bool OnFocus(Widget w, int x, int y)
320 {
321 m_Tab.OnDetailsFocus(w);
322 return false;
323 }
324
325 override bool OnMouseEnter(Widget w, int x, int y)
326 {
327 return m_Tab.OnMouseEnter(w, x, y);
328 }
329
330 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
331 {
332 return m_Tab.OnMouseLeave(w, enterW, x, y);
333 }
334}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
TabType
Определения ServerBrowserTab.c:2
bool m_Official
Определения BiosLobbyService.c:152
int m_ModeId
Определения BiosLobbyService.c:155
float m_EnvironmentTimeMul
time multiplier of environment
Определения BiosLobbyService.c:187
string GetIpPort()
Определения BiosLobbyService.c:195
string m_TimeOfDay
Определения BiosLobbyService.c:183
string m_Description
Определения BiosLobbyService.c:148
int m_Disable3rdPerson
disable3rdPerson servers for mode regular/hardcore
Определения BiosLobbyService.c:185
string m_Name
Определения BiosLobbyService.c:147
string m_SteamFriends
Определения BiosLobbyService.c:180
string m_ShardId
Определения BiosLobbyService.c:190
string m_CharactersAlive
Определения BiosLobbyService.c:178
string m_MapNameToRun
Определения BiosLobbyService.c:153
GetServersResultRow the output structure of the GetServers operation that represents one game server.
Определения BiosLobbyService.c:144
PlayerListScriptedWidget m_Tab
Определения PlayerListEntryScriptedWidget.c:15
ButtonWidget m_BtnShowFilters
Определения ServerBrowserDetailsContainer.c:33
void SetServerDesc(string desc)
Widget m_Root
Определения SizeToChild.c:9
void SetVersion(string version)
void SetFriends(string friends_text)
Определения ServerBrowserEntry.c:482
TextWidget m_TimeAccelerationResult
Определения ServerBrowserDetailsContainer.c:19
TextWidget m_LastCharacterResult
Определения ServerBrowserDetailsContainer.c:9
GridSpacerWidget m_ServerDecContainer
Определения ServerBrowserDetailsContainer.c:27
MultilineTextWidget m_ServerDesc
Определения ServerBrowserDetailsContainer.c:28
void SetBattleyeState(int enabled=-1)
void SetType(string shardId)
void ServerBrowserDetailsContainer(Widget root, ServerBrowserTab parent)
Определения ServerBrowserDetailsContainer.c:38
WrapSpacerWidget m_VersionContainer
Определения ServerBrowserDetailsContainer.c:24
void SetServerMap(GetServersResultRow serverInfo)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void SetServerIP(string ip)
WrapSpacerWidget m_DetailsContainerRight
Определения ServerBrowserDetailsContainer.c:30
override bool OnFocus(Widget w, int x, int y)
void SetTimeAcceleration(float timeMul, float nightTimeMul)
override bool OnMouseEnter(Widget w, int x, int y)
void SetDetails(GetServersResultRow serverInfo, bool online=false)
Определения ServerBrowserDetailsContainer.c:79
void SetTimeIcon(string time, float multiplier)
void SetName(string name)
map: item x vector(index, width, height)
Определения EnWidgets.c:651
static string GetServerMapImagePath(string mapName)
Определения BiosLobbyService.c:101
Определения EnWidgets.c:220
Определения EnWidgets.c:190
proto string ToString(bool simple=true)
array< string > TStringArray
Определения EnScript.c:685
proto native int Length()
Returns length of string.
proto native int ToInt()
Converts string to integer.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
Определения EnString.c:396
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Определения proto.c:322