DayZ 1.30
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 ThirdPersonMode.ENABLED:
176 {
177 result = "#STR_server_browser_details_third_person";
178 break;
179 }
180 case ThirdPersonMode.DISABLED:
181 case ThirdPersonMode.VEHICLES_ONLY:
182 {
183 result = "#STR_server_browser_details_first_person";
184 break;
185 }
186 }
187
188 m_ServerModeResult.SetText(result);
189 }
190
191 protected void SetServerIP(string ip)
192 {
193 m_ServerIP.SetText(ip);
194 }
195
196#ifdef PLATFORM_WINDOWS
197 #ifndef PLATFORM_CONSOLE
198 protected void SetCharacter(string characterName)
199 {
200 string result = "#STR_server_browser_char_not_alive";
201 if (characterName != "")
202 result = characterName;
203
204 m_LastCharacterResult.SetText(result);
205 }
206
207 protected void SetFriends(string steamFriends = "")
208 {
209 string result = "-";
210 if (steamFriends != "")
211 result = steamFriends;
212
213 m_FriendsResult.SetText(result);
214 m_FriendsResult.Update();
215 }
216 #endif
217#endif
218
219 protected void SetTimeAcceleration(float timeMul, float nightTimeMul)
220 {
221 m_TimeAccelerationResult.SetText(timeMul.ToString() + "/" + nightTimeMul.ToString());
222 }
223
224 void SetTimeIcon(string time, float multiplier)
225 {
226 if (time != "")
227 {
228 TStringArray arr = new TStringArray;
229 time.Split(":", arr);
230
231 if (arr.Count() == 2)
232 {
233 int hour = arr.Get(0).ToInt();
234 int minute = arr.Get(1).ToInt();
235
236 if (hour >= 19 || hour <= 5) //Night
237 {
238 if (multiplier > 1)
239 m_TimeIcon.SetImage(3);
240 else
241 m_TimeIcon.SetImage(2);
242 }
243 else //Day
244 {
245 if (multiplier > 1)
246 m_TimeIcon.SetImage(1);
247 else
248 m_TimeIcon.SetImage(0);
249 }
250
251 m_TimeIcon.Show(true);
252 m_TimeAccelerationResult.Show(false);
253 }
254 }
255 else
256 {
257 m_TimeIcon.Show(false);
258 m_TimeAccelerationResult.Show(true);
259 m_TimeAccelerationResult.SetText("-");
260 }
261 }
262
263 protected void SetBattleyeState(int enabled = -1)
264 {
265 string result = "#STR_server_browser_no_server_selected";
266 int color = ARGB(255, 255, 255, 255);
267
268 switch (enabled)
269 {
270 case 0:
271 {
272 result = "#server_browser_entry_disabled";
273 color = ARGB(255, 255, 0, 0);
274 break;
275 }
276 case 1:
277 {
278 result = "#server_browser_entry_enabled";
279 color = ARGB(255, 0, 255, 0);
280 break;
281 }
282 }
283
284 m_BattleyeResult.SetText(result);
285 m_BattleyeResult.SetColor(color);
286 }
287
288 protected void SetVersion(string version)
289 {
290 m_VersionResult.SetText(version);
291 }
292
293 protected void SetServerDesc(string desc)
294 {
295 m_ServerDesc.SetText(desc);
296 m_ServerDesc.Update();
297 }
298
299 protected void SetServerMap(GetServersResultRow serverInfo)
300 {
301 string mapImagePath = ServerBrowserHelperFunctions.GetServerMapImagePath(serverInfo.m_MapNameToRun);
302 m_MapImage.LoadImageFile(0, mapImagePath);
303 m_DetailsContainerRight.Show(true);
304 }
305
306 void Focus()
307 {
308 #ifdef PLATFORM_CONSOLE
309 if (m_Tab.GetTabType() == TabType.FAVORITE)
310 {
312 }
313 else
314 {
316 }
317 #endif
318 }
319
320 override bool OnFocus(Widget w, int x, int y)
321 {
322 m_Tab.OnDetailsFocus(w);
323 return false;
324 }
325
326 override bool OnMouseEnter(Widget w, int x, int y)
327 {
328 return m_Tab.OnMouseEnter(w, x, y);
329 }
330
331 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
332 {
333 return m_Tab.OnMouseLeave(w, enterW, x, y);
334 }
335}
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
TabType
Определения ServerBrowserTab.c:2
bool m_Official
Определения BiosLobbyService.c:179
int m_ModeId
Определения BiosLobbyService.c:182
float m_EnvironmentTimeMul
time multiplier of environment
Определения BiosLobbyService.c:214
string GetIpPort()
Определения BiosLobbyService.c:222
string m_TimeOfDay
Определения BiosLobbyService.c:210
string m_Description
Определения BiosLobbyService.c:175
int m_Disable3rdPerson
disable3rdPerson servers for mode regular/hardcore
Определения BiosLobbyService.c:212
string m_Name
Определения BiosLobbyService.c:174
string m_SteamFriends
Определения BiosLobbyService.c:207
string m_ShardId
Определения BiosLobbyService.c:217
string m_CharactersAlive
Определения BiosLobbyService.c:205
string m_MapNameToRun
Определения BiosLobbyService.c:180
GetServersResultRow the output structure of the GetServers operation that represents one game server.
Определения BiosLobbyService.c:171
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:485
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)
Deprecated.
Определения EnWidgets.c:657
static string GetServerMapImagePath(string mapName)
Определения BiosLobbyService.c:128
Определения EnWidgets.c:220
Определения EnWidgets.c:190
proto string ToString(bool simple=true)
class array< Class T > TStringArray
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
ThirdPersonMode
Определения World.c:302
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Определения proto.c:322