For a long time I can't understand what the matter is, it seems like everything is fine everywhere, or maybe I'm blind
Error while compiling: SkyMenu.cs(550,16): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
If it doesn't bother you, please help me
1 using Oxide.Core.Plugins;
2 using Oxide.Game.Rust.Cui;
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
6 using System.Linq;
7 using System.Globalization;
8 using UnityEngine;
9 using Color = UnityEngine.Color;
10 using Random = UnityEngine.Random;
11
12 namespace Oxide.Plugins
13 {
14 [Info("SkyMenu", "JoyRax", "0.0.1")]
15 [Description("Menu game info")]
16 class SkyMenu : RustPlugin
17 {
18 #region Vars
19 [PluginReference] private Plugin ImageLibrary, NTeleportation;
20 private string MainLayer = "ui_main";
21
22 #endregion
23
24 #region Configuration
25
26 private class PluginConfig
27 {
28 public CuiStandardElementSetting _CuiStandardElementSetting;
29 public CuiServerNameSetting _CuiServerNameSetting;
30 public CuiAvatarSetting _CuiAvatarSetting;
31 public List<CuiUButtonSetting> _CuiUButtonSetting;
32 }
33
34 private class Anchor
35 {
36 public string Min;
37 public string Max;
38 }
39
40 private class CuiStandardElementSetting
41 {
42 public string BackgroundColor;
43 public Anchor Anchor;
44 public bool CursorEnabled;
45 public string Layer;
46 }
47
48 private class CuiServerNameSetting
49 {
50 public string NameServer;
51 public string BackgroundColor;
52 public string TextColor;
53 public Anchor Anchor;
54 public string ELParent;
55 public string ELName;
56 public string Font;
57 public int FontSize;
58 }
59
60 private class CuiAvatarSetting
61 {
62 public string BackgroundColor;
63 public string TextColor;
64 public Anchor Anchor;
65 public string ELParent;
66 public string ELName;
67 public string ELNameImage;
68 public string ELNameText;
69 public string Font;
70 public int FontSize;
71 }
72
73 private class CuiStandardButtonSetting
74 {
75 public string BackgroundColor;
76 public string SmallBackgroundColor;
77 public string TextColor;
78 public string ELParent;
79 public string ELName;
80 public string ELSmallName;
81 public string Font;
82 public int FontSize;
83 public int FontSizeSmall;
84 }
85
86 private class CuiUButtonSetting : CuiStandardButtonSetting
87 {
88 public Anchor Anchor;
89 public string SmallText;
90 public string Text;
91 public string Command;
92 }
93
94 private PluginConfig _config;
95
96 protected override void LoadDefaultConfig()
97 {
98 Config.WriteObject(GetDefaultConfig(), true);
99 }
100
101 private PluginConfig GetDefaultConfig()
102 {
103 return new PluginConfig
104 {
105 _CuiStandardElementSetting = new CuiStandardElementSetting
106 {
107 BackgroundColor = "0 0 0 0.5",
108 Anchor = new Anchor
109 {
110 Min = "0 0",
111 Max = "1 1"
112 },
113 CursorEnabled = true,
114 Layer = MainLayer
115 },
116 _CuiServerNameSetting = new CuiServerNameSetting
117 {
118 NameServer = "POISON RUST",
119 BackgroundColor = "0 0 0 0.9",
120 TextColor = "255 255 255 0.5",
121 Anchor = new Anchor
122 {
123 Min = "0 0.944",
124 Max = "1 1"
125 },
126 ELParent = MainLayer,
127 ELName = MainLayer + ".PanelNameServer",
128 Font = "robotocondensed-bold.ttf",
129 FontSize = 22;
130 }
131 _CuiAvatarSetting = new CuiAvatarSetting
132 {
133 BackgroundColor = "0 0 0 0.9",
134 TextColor = "255 255 255 0.5",
135 Anchor = new Anchor
136 {
137 Min = "0.25 0.542",
138 Max = "0.352 0.764"
139 },
140 ELParent = MainLayer,
141 ELName = MainLayer = ".Avatar",
142 ELNameImage = MainLayer = ".AvatarImage",
143 ELNameText = MainLayer = ".AvatarText",
144 Font = "robotocondensed-bold.ttf",
145 FontSize = 20
146 }
147
148 _CuiUButtonSetting = new List<CuiUButtonSetting>()
149 {
150 new CuiUButtonSetting
151 {
152 BackgroundColor = "0 0 0 0.9",
153 SmallBackgroundColor = "255 255 255 0.05",
154 TextColor = "255 255 255 0.5",
155 ELParent = MainLayer,
156 ELName = MainLayer + ".StandardButton",
157 ELSmallName = MainLayer + ".StandardButtonSmallText",
158 Font = "robotocondensed-bold.ttf",
159 FontSize = 20,
160 FontSizeSmall = 12,
161 Anchor = new Anchor
162 {
163 Min = "0.25 0.465",
164 Max = "0.352 0.535"
165 },
166 SmallText = "OPEN",
167 Text = "STATISTICS",
168 Command = "chat.say /test"
169 },
170 new CuiUButtonSetting
171 {
172 BackgroundColor = "0 0 0 0.9",
173 SmallBackgroundColor = "255 255 255 0.05",
174 TextColor = "255 255 255 0.5",
175 ELParent = MainLayer,
176 ELName = MainLayer + ".StandardButton",
177 ELSmallName = MainLayer + ".StandardButtonSmallText",
178 Font = "robotocondensed-bold.ttf",
179 FontSize = 20,
180 FontSizeSmall = 12,
181 Anchor = new Anchor
182 {
183 Min = "0.25 0.389",
184 Max = "0.352 0.458"
185 },
186 SmallText = "ACCEPT",
187 Text = "TELEPORT",
188 Command = "chat.say /test"
189 },
190 new CuiUButtonSetting
191 {
192 BackgroundColor = "0 0 0 0.9",
193 SmallBackgroundColor = "255 255 255 0.05",
194 TextColor = "255 255 255 0.5",
195 ELParent = MainLayer,
196 ELName = MainLayer + ".StandardButton",
197 ELSmallName = MainLayer + ".StandardButtonSmallText",
198 Font = "robotocondensed-bold.ttf",
199 FontSize = 20,
200 FontSizeSmall = 12,
201 Anchor = new Anchor
202 {
203 Min = "0.25 0.313",
204 Max = "0.352 0.382"
205 },
206 SmallText = "ACCEPT",
207 Text = "TRADE",
208 Command = "chat.say /test"
209 },
210 new CuiUButtonSetting
211 {
212 BackgroundColor = "0 0 0 0.9",
213 SmallBackgroundColor = "255 255 255 0.05",
214 TextColor = "255 255 255 0.5",
215 ELParent = MainLayer,
216 ELName = MainLayer + ".StandardButton",
217 ELSmallName = MainLayer + ".StandardButtonSmallText",
218 Font = "robotocondensed-bold.ttf",
219 FontSize = 20,
220 FontSizeSmall = 12,
221 Anchor = new Anchor
222 {
223 Min = "0.25 0.236",
224 Max = "0.352 0.306"
225 },
226 SmallText = "OPEN",
227 Text = "WIPE BLOCK",
228 Command = "chat.say /test"
229 },
230 new CuiUButtonSetting
231 {
232 BackgroundColor = "0 0 0 0.9",
233 SmallBackgroundColor = "255 255 255 0.05",
234 TextColor = "255 255 255 0.5",
235 ELParent = MainLayer,
236 ELName = MainLayer + ".StandardButton",
237 ELSmallName = MainLayer + ".StandardButtonSmallText",
238 Font = "robotocondensed-bold.ttf",
239 FontSize = 20,
240 FontSizeSmall = 12,
241 Anchor = new Anchor
242 {
243 Min = "0.355 0.694",
244 Max = "0.457 0.764"
245 },
246 SmallText = "OPEN",
247 Text = "KITS",
248 Command = "chat.say /test"
249 },
250 new CuiUButtonSetting
251 {
252 BackgroundColor = "0 0 0 0.9",
253 SmallBackgroundColor = "255 255 255 0.05",
254 TextColor = "255 255 255 0.5",
255 ELParent = MainLayer,
256 ELName = MainLayer + ".StandardButton",
257 ELSmallName = MainLayer + ".StandardButtonSmallText",
258 Font = "robotocondensed-bold.ttf",
259 FontSize = 20,
260 FontSizeSmall = 12,
261 Anchor = new Anchor
262 {
263 Min = "0.355 0.618",
264 Max = "0.457 0.688"
265 },
266 SmallText = "OPEN",
267 Text = "CASES",
268 Command = "chat.say /test"
269 },
270 new CuiUButtonSetting
271 {
272 BackgroundColor = "0 0 0 0.9",
273 SmallBackgroundColor = "255 255 255 0.05",
274 TextColor = "255 255 255 0.5",
275 ELParent = MainLayer,
276 ELName = MainLayer + ".StandardButton",
277 ELSmallName = MainLayer + ".StandardButtonSmallText",
278 Font = "robotocondensed-bold.ttf",
279 FontSize = 20,
280 FontSizeSmall = 12,
281 Anchor = new Anchor
282 {
283 Min = "0.355 0.542",
284 Max = "0.457 0.611"
285 },
286 SmallText = "SEND",
287 Text = "TICKET",
288 Command = "chat.say /test"
289 },
290 new CuiUButtonSetting
291 {
292 BackgroundColor = "0 0 0 0.9",
293 SmallBackgroundColor = "255 255 255 0.05",
294 TextColor = "255 255 255 0.5",
295 ELParent = MainLayer,
296 ELName = MainLayer + ".StandardButton",
297 ELSmallName = MainLayer + ".StandardButtonSmallText",
298 Font = "robotocondensed-bold.ttf",
299 FontSize = 20,
300 FontSizeSmall = 12,
301 Anchor = new Anchor
302 {
303 Min = "0.355 0.465",
304 Max = "0.457 0.535"
305 },
306 SmallText = "OPEN",
307 Text = "STORE",
308 Command = "chat.say /test"
309 },
310 new CuiUButtonSetting
311 {
312 BackgroundColor = "0 0 0 0.9",
313 SmallBackgroundColor = "255 255 255 0.05",
314 TextColor = "255 255 255 0.5",
315 ELParent = MainLayer,
316 ELName = MainLayer + ".StandardButton",
317 ELSmallName = MainLayer + ".StandardButtonSmallText",
318 Font = "robotocondensed-bold.ttf",
319 FontSize = 20,
320 FontSizeSmall = 12,
321 Anchor = new Anchor
322 {
323 Min = "0.355 0.389",
324 Max = "0.457 0.458"
325 },
326 SmallText = "OPEN",
327 Text = "INFO",
328 Command = "chat.say /test"
329 },
330 new CuiUButtonSetting
331 {
332 BackgroundColor = "0 0 0 0.9",
333 SmallBackgroundColor = "255 255 255 0.05",
334 TextColor = "255 255 255 0.5",
335 ELParent = MainLayer,
336 ELName = MainLayer + ".StandardButton",
337 ELSmallName = MainLayer + ".StandardButtonSmallText",
338 Font = "robotocondensed-bold.ttf",
339 FontSize = 20,
340 FontSizeSmall = 12,
341 Anchor = new Anchor
342 {
343 Min = "0.355 0.313",
344 Max = "0.457 0.382"
345 },
346 SmallText = "OPEN",
347 Text = "VK GROUP",
348 Command = "chat.say /test"
349 },
350 new CuiUButtonSetting
351 {
352 BackgroundColor = "0 0 0 0.9",
353 SmallBackgroundColor = "255 255 255 0.05",
354 TextColor = "255 255 255 0.5",
355 ELParent = MainLayer,
356 ELName = MainLayer + ".StandardButton",
357 ELSmallName = MainLayer + ".StandardButtonSmallText",
358 Font = "robotocondensed-bold.ttf",
359 FontSize = 20,
360 FontSizeSmall = 12,
361 Anchor = new Anchor
362 {
363 Min = "0.355 0.236",
364 Max = "0.457 0.306"
365 },
366 SmallText = "OPEN",
367 Text = "DISCORD",
368 Command = "chat.say /test"
369 }
370 };
371 };
372 }
373
374 private void SaveConfig()
375 {
376 Config.WriteObject(_config, true);
377 }
378
379 #endregion
380
381 #region Init
382
383 void OnServerInitialized(bool serverInitialized)
384 {
385 _config = Config.ReadObject<PluginConfig>();
386 }
387
388 #endregion
389
390 #region CuiRustCustomHelper
391
392 private static class CuiRustCustomHelper
393 {
394 public static CuiElementContainer GettingStandardElement(CuiStandardElementSetting _setting)
395 {
396 var container = new CuiElementContainer();
397
398 container.Add(new CuiPanel
399 {
400 Image = { Color = "0 0 0 0" },
401 RectTransform = { AnchorMin = _setting.Anchor.Min, AnchorMax = _setting.Anchor.Max },
402 CursorEnabled = _setting.CursorEnabled,
403 }, "Overlay", _setting.Layer);
404
405 container.Add(new CuiElement
406 {
407 Parent = LayerMain,
408 Components =
409 {
410 new CuiRawImageComponent { Color = _setting.BackgroundColor, FadeIn = 0.5f, Sprite = "assets/content/ui/ui.background.tiletex.psd", Material = "assets/content/ui/uibackgroundblur-ingamemenu.mat" },
411 new CuiRectTransformComponent{ AnchorMin = "0 0", AnchorMax = "1 1" }
412 }
413 });
414
415 return container;
416 }
417
418 public static CuiElementContainer GettingServerNameElement(CuiServerNameSetting _setting)
419 {
420 var container = new CuiElementContainer();
421
422 container.Add(new CuiElement
423 {
424 Parent = _setting.ELParent,
425 Name = _setting.ELName,
426 Components =
427 {
428 new CuiImageComponent { FadeIn = 0.25f, Color = _setting.BackgroundColor} ,
429 new CuiRectTransformComponent { AnchorMin = _setting.Anchor.Min, AnchorMax = _setting.Anchor.Max }
430 }
431 });
432 container.Add(new CuiElement
433 {
434 Parent = _setting.ELName,
435 Components = {
436 new CuiTextComponent() { Color = _setting.TextColor, FadeIn = 1f, Text = _setting.NameServer, FontSize = _setting.FontSize, Align = TextAnchor.MiddleCenter, Font = _setting.Font },
437 new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax = "1 1" },
438 }
439 });
440
441 return container;
442 }
443
444 public static CuiElementContainer GettingAvatarElement(BasePlayer player, CuiAvatarSetting _setting)
445 {
446 var container = new CuiElementContainer();
447
448 container.Add(new CuiElement
449 {
450 Parent = _setting.ELParent,
451 Name = _setting.ELName,
452 Components =
453 {
454 new CuiImageComponent {FadeIn = 0.25f, Color = _setting.BackgroundColor},
455 new CuiRectTransformComponent { AnchorMin = _setting.Anchor.Min, AnchorMax = _setting.Anchor.Max }
456 }
457 });
458 container.Add(new CuiElement
459 {
460 Parent = _setting.ELName,
461 Name = _setting.ELNameImage,
462 Components =
463 {
464 new CuiImageComponent {FadeIn = 0.25f, Color = "0 0 0 0"},
465 new CuiRectTransformComponent {AnchorMin = "0 0.188", AnchorMax = "1 1"}
466 }
467 });
468 container.Add(new CuiElement
469 {
470 Parent = _setting.ELNameImage,
471 Components =
472 {
473 new CuiRawImageComponent { Png = (string) ImageLibrary.Call("GetImage", player.UserIDString) },
474 new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax = "1 1", OffsetMax = "0 0" }
475 }
476 });
477 container.Add(new CuiElement
478 {
479 Parent = _setting.ELName,
480 Name = _setting.ELNameText,
481 Components =
482 {
483 new CuiImageComponent {FadeIn = 0.25f, Color = "0 0 0 0"},
484 new CuiRectTransformComponent {AnchorMin = "0 0", AnchorMax = "1 0.188"}
485 }
486 });
487 container.Add(new CuiElement
488 {
489 Parent = _setting.ELNameText,
490 Components = {
491 new CuiTextComponent() { Color = _setting.TextColor, FadeIn = 1f, Text = ""+player.displayName.ToUpper()+"", FontSize = _setting.FontSize, Align = TextAnchor.MiddleCenter, Font = _setting.Font },
492 new CuiRectTransformComponent { AnchorMin = "0 0", AnchorMax = "1 1" },
493 }
494 });
495
496 return container;
497 }
498
499 public static CuiElementContainer GettingButtonElement(BasePlayer player, List<CuiUButtonSetting> _setting)
500 {
501 var container = new CuiElementContainer();
502
503 foreach (var _settingItem in _setting)
504 {
505 container.Add(new CuiElement
506 {
507 Parent = _settingItem.ELParent,
508 Name = _settingItem.ELName,
509 Components = {
510 new CuiImageComponent {FadeIn = 0.25f, Color = _settingItem.BackgroundColor},
511 new CuiRectTransformComponent {AnchorMin = _settingItem.Anchor.Min, AnchorMax = _settingItem.Anchor.Max}
512 }
513 });
514 container.Add(new CuiButton
515 {
516 RectTransform = { AnchorMin = "0 0", AnchorMax = "1 0.7" },
517 Button = { Command = _settingItem.Command, Close = _settingItem.ELParent, Color = "0 0 0 0" },
518 Text = { Color = _settingItem.TextColor, Text = _settingItem.Text, FontSize = _settingItem.FontSize, Align = TextAnchor.MiddleCenter, Font = _settingItem.Font }
519 }, _settingItem.ELName);
520 container.Add(new CuiElement
521 {
522 Parent = _settingItem.ELName,
523 Name = _settingItem.ELSmallName,
524 Components = {
525 new CuiImageComponent {FadeIn = 0.25f, Color = _settingItem.SmallBackgroundColor},
526 new CuiRectTransformComponent {AnchorMin = "0 0.7", AnchorMax = "1 1"}
527 }
528 });
529 container.Add(new CuiElement
530 {
531 Parent = _settingItem.ELSmallName,
532 Components = {
533 new CuiTextComponent() {Color = _settingItem.TextColor, FadeIn = 1f, Text = _settingItem.SmallText, FontSize = _settingItem.FontSize, Align = TextAnchor.MiddleCenter, Font = _settingItem.Font},
534 new CuiRectTransformComponent {AnchorMin = "0 0", AnchorMax = "1 1"}
535 }
536 });
537 }
538
539 return container;
540 }
541 }
542
543 #endregion
544
545 #region UI
546
547 private void CustomDrawCUI(BasePlayer player)
548 {
549 CuiHelper.AddUi(player, GettingStandardElement(_config._CuiStandardElementSetting));
550 CuiHelper.AddUi(player, GettingServerNameElement(_config._CuiServerNameSetting));
551 CuiHelper.AddUi(player, GettingAvatarElement(player, _config._CuiAvatarSetting));
552 CuiHelper.AddUi(player, GettingButtonElement(player, _config._CuiUButtonSetting));
553 }
554
555 private void CustomDestroyCUI(BasePlayer player)
556 {
557 CuiHelper.DestroyUi(player, MainLayer);
558 }
559
560 #endregion
561
562 #region Hook
563
564 [ChatCommand("menu")]
565 private void ChatOpenMenu(BasePlayer player)
566 {
567 CustomDrawCUI(player);
568 }
569
570 [ChatCommand("menu.close")]
571 private void ChatCloseMenu(BasePlayer player)
572 {
573 CustomDestroyCUI(player);
574 }
575
576 [ConsoleCommand("skymenu.open")]
577 private void CmdOpenMenu(BasePlayer player)
578 {
579 CustomDrawCUI(player);
580 }
581
582 [ConsoleCommand("skymenu.close")]
583 private void CmdCloseMenu(BasePlayer player)
584 {
585 CustomDestroyCUI(player);
586 }
587
588 #endregion
589 }
590 }
What I have tried:
I can't figure out how to deal with this error