Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IngameOptions.cs
Go to the documentation of this file.
1using System;
10using Terraria.Social;
11using Terraria.UI;
13
14namespace Terraria;
15
16public static class IngameOptions
17{
18 public const int width = 670;
19
20 public const int height = 480;
21
22 public static float[] leftScale = new float[10] { 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f };
23
24 public static float[] rightScale = new float[17]
25 {
26 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f,
27 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f, 0.7f
28 };
29
31 {
32 { 0, 0 },
33 { 1, 1 },
34 { 2, 2 },
35 { 3, 3 }
36 };
37
38 public static bool[] skipRightSlot = new bool[20];
39
40 public static int leftHover = -1;
41
42 public static int rightHover = -1;
43
44 public static int oldLeftHover = -1;
45
46 public static int oldRightHover = -1;
47
48 public static int rightLock = -1;
49
50 public static bool inBar;
51
52 public static bool notBar;
53
54 public static bool noSound;
55
56 private static Rectangle _GUIHover;
57
58 public static int category;
59
61
62 private static string _mouseOverText;
63
64 private static bool _canConsumeHover;
65
66 public static void Open()
67 {
69 Main.chatText = "";
70 Main.playerInventory = false;
71 Main.editChest = false;
72 Main.npcChatText = "";
74 Main.ingameOptionsWindow = true;
75 category = 0;
76 for (int i = 0; i < leftScale.Length; i++)
77 {
78 leftScale[i] = 0f;
79 }
80 for (int j = 0; j < rightScale.Length; j++)
81 {
82 rightScale[j] = 0f;
83 }
84 leftHover = -1;
85 rightHover = -1;
86 oldLeftHover = -1;
87 oldRightHover = -1;
88 rightLock = -1;
89 inBar = false;
90 notBar = false;
91 noSound = false;
92 }
93
94 public static void Close()
95 {
96 if (Main.setKey == -1)
97 {
98 Main.ingameOptionsWindow = false;
101 Main.playerInventory = true;
103 }
104 }
105
106 public static void Draw(Main mainInstance, SpriteBatch sb)
107 {
108 _canConsumeHover = true;
109 for (int i = 0; i < skipRightSlot.Length; i++)
110 {
111 skipRightSlot[i] = false;
112 }
117 bool flag3 = false;
118 int num = 70;
119 float scale = 0.75f;
120 float num2 = 60f;
121 float num3 = 300f;
122 if (flag)
123 {
124 flag3 = true;
125 }
126 if (isActive)
127 {
128 num3 = 200f;
129 }
131 bool flag4 = Main.mouseLeft && Main.mouseLeftRelease;
133 Vector2 vector2 = new Vector2(670f, 480f);
134 Vector2 vector3 = vector / 2f - vector2 / 2f;
135 int num4 = 20;
136 _GUIHover = new Rectangle((int)(vector3.X - (float)num4), (int)(vector3.Y - (float)num4), (int)(vector2.X + (float)(num4 * 2)), (int)(vector2.Y + (float)(num4 * 2)));
137 Utils.DrawInvBG(sb, vector3.X - (float)num4, vector3.Y - (float)num4, vector2.X + (float)(num4 * 2), vector2.Y + (float)(num4 * 2), new Color(33, 15, 91, 255) * 0.685f);
138 if (new Rectangle((int)vector3.X - num4, (int)vector3.Y - num4, (int)vector2.X + num4 * 2, (int)vector2.Y + num4 * 2).Contains(new Point(Main.mouseX, Main.mouseY)))
139 {
140 Main.player[Main.myPlayer].mouseInterface = true;
141 }
142 Utils.DrawBorderString(sb, Language.GetTextValue("GameUI.SettingsMenu"), vector3 + vector2 * new Vector2(0.5f, 0f), Color.White, 1f, 0.5f);
143 if (flag)
144 {
145 Utils.DrawInvBG(sb, vector3.X + (float)(num4 / 2), vector3.Y + (float)(num4 * 5 / 2), vector2.X / 3f - (float)num4, vector2.Y - (float)(num4 * 3));
146 Utils.DrawInvBG(sb, vector3.X + vector2.X / 3f + (float)num4, vector3.Y + (float)(num4 * 5 / 2), vector2.X * 2f / 3f - (float)(num4 * 3 / 2), vector2.Y - (float)(num4 * 3));
147 }
148 else
149 {
150 Utils.DrawInvBG(sb, vector3.X + (float)(num4 / 2), vector3.Y + (float)(num4 * 5 / 2), vector2.X / 2f - (float)num4, vector2.Y - (float)(num4 * 3));
151 Utils.DrawInvBG(sb, vector3.X + vector2.X / 2f + (float)num4, vector3.Y + (float)(num4 * 5 / 2), vector2.X / 2f - (float)(num4 * 3 / 2), vector2.Y - (float)(num4 * 3));
152 }
153 float num5 = 0.7f;
154 float num6 = 0.8f;
155 float num7 = 0.01f;
156 if (flag)
157 {
158 num5 = 0.4f;
159 num6 = 0.44f;
160 }
161 if (isActive2)
162 {
163 num5 = 0.55f;
164 num6 = 0.6f;
165 }
166 if (oldLeftHover != leftHover && leftHover != -1)
167 {
169 }
170 if (oldRightHover != rightHover && rightHover != -1)
171 {
173 }
174 if (flag4 && rightHover != -1 && !noSound)
175 {
177 }
180 noSound = false;
181 bool flag5 = SocialAPI.Network != null && SocialAPI.Network.CanInvite();
182 int num8 = (flag5 ? 1 : 0);
183 int num9 = 5 + num8 + 2;
184 Vector2 vector4 = new Vector2(vector3.X + vector2.X / 4f, vector3.Y + (float)(num4 * 5 / 2));
185 Vector2 vector5 = new Vector2(0f, vector2.Y - (float)(num4 * 5)) / (num9 + 1);
186 if (flag)
187 {
188 vector4.X -= 55f;
189 }
190 UILinkPointNavigator.Shortcuts.INGAMEOPTIONS_BUTTONS_LEFT = num9 + 1;
191 for (int j = 0; j <= num9; j++)
192 {
193 bool flag6 = false;
194 if (_leftSideCategoryMapping.TryGetValue(j, out var value))
195 {
196 flag6 = category == value;
197 }
198 if (leftHover == j || flag6)
199 {
200 leftScale[j] += num7;
201 }
202 else
203 {
204 leftScale[j] -= num7;
205 }
206 if (leftScale[j] < num5)
207 {
208 leftScale[j] = num5;
209 }
210 if (leftScale[j] > num6)
211 {
212 leftScale[j] = num6;
213 }
214 }
215 leftHover = -1;
216 int num10 = category;
217 int num11 = 0;
218 if (DrawLeftSide(sb, Lang.menu[114].Value, num11, vector4, vector5, leftScale))
219 {
221 if (flag4)
222 {
223 category = 0;
225 }
226 }
227 num11++;
228 if (DrawLeftSide(sb, Lang.menu[210].Value, num11, vector4, vector5, leftScale))
229 {
231 if (flag4)
232 {
233 category = 1;
235 }
236 }
237 num11++;
238 if (DrawLeftSide(sb, Lang.menu[63].Value, num11, vector4, vector5, leftScale))
239 {
241 if (flag4)
242 {
243 category = 2;
245 }
246 }
247 num11++;
248 if (DrawLeftSide(sb, Lang.menu[218].Value, num11, vector4, vector5, leftScale))
249 {
251 if (flag4)
252 {
253 category = 3;
255 }
256 }
257 num11++;
258 if (DrawLeftSide(sb, Lang.menu[66].Value, num11, vector4, vector5, leftScale))
259 {
261 if (flag4)
262 {
263 Close();
265 }
266 }
267 num11++;
268 if (flag5 && DrawLeftSide(sb, Lang.menu[147].Value, num11, vector4, vector5, leftScale))
269 {
271 if (flag4)
272 {
273 Close();
274 SocialAPI.Network.OpenInviteInterface();
275 }
276 }
277 if (flag5)
278 {
279 num11++;
280 }
281 if (DrawLeftSide(sb, Lang.menu[131].Value, num11, vector4, vector5, leftScale))
282 {
284 if (flag4)
285 {
286 Close();
288 }
289 }
290 num11++;
291 if (DrawLeftSide(sb, Lang.menu[118].Value, num11, vector4, vector5, leftScale))
292 {
294 if (flag4)
295 {
296 Close();
297 }
298 }
299 num11++;
300 if (DrawLeftSide(sb, Lang.inter[35].Value, num11, vector4, vector5, leftScale))
301 {
303 if (flag4)
304 {
305 Close();
306 Main.menuMode = 10;
307 Main.gameMenu = true;
309 }
310 }
311 num11++;
312 if (num10 != category)
313 {
314 for (int k = 0; k < rightScale.Length; k++)
315 {
316 rightScale[k] = 0f;
317 }
318 }
319 int num12 = 0;
320 int num13 = 0;
321 switch (category)
322 {
323 case 0:
324 num13 = 16;
325 num5 = 1f;
326 num6 = 1.001f;
327 num7 = 0.001f;
328 break;
329 case 1:
330 num13 = 11;
331 num5 = 1f;
332 num6 = 1.001f;
333 num7 = 0.001f;
334 break;
335 case 2:
336 num13 = 12;
337 num5 = 1f;
338 num6 = 1.001f;
339 num7 = 0.001f;
340 break;
341 case 3:
342 num13 = 15;
343 num5 = 1f;
344 num6 = 1.001f;
345 num7 = 0.001f;
346 break;
347 }
348 if (flag)
349 {
350 num5 -= 0.1f;
351 num6 -= 0.1f;
352 }
353 if (isActive2 && category == 3)
354 {
355 num5 -= 0.15f;
356 num6 -= 0.15f;
357 }
358 if (flag2 && (category == 0 || category == 3))
359 {
360 num5 -= 0.2f;
361 num6 -= 0.2f;
362 }
363 UILinkPointNavigator.Shortcuts.INGAMEOPTIONS_BUTTONS_RIGHT = num13;
364 Vector2 vector6 = new Vector2(vector3.X + vector2.X * 3f / 4f, vector3.Y + (float)(num4 * 5 / 2));
365 Vector2 vector7 = new Vector2(0f, vector2.Y - (float)(num4 * 3)) / (num13 + 1);
366 if (category == 2)
367 {
368 vector7.Y -= 2f;
369 }
370 new Vector2(8f, 0f);
371 if (flag)
372 {
373 vector6.X = vector3.X + vector2.X * 2f / 3f;
374 }
375 for (int l = 0; l < rightScale.Length; l++)
376 {
377 if (rightLock == l || (rightHover == l && rightLock == -1))
378 {
379 rightScale[l] += num7;
380 }
381 else
382 {
383 rightScale[l] -= num7;
384 }
385 if (rightScale[l] < num5)
386 {
387 rightScale[l] = num5;
388 }
389 if (rightScale[l] > num6)
390 {
391 rightScale[l] = num6;
392 }
393 }
394 inBar = false;
395 rightHover = -1;
396 if (!Main.mouseLeft)
397 {
398 rightLock = -1;
399 }
400 if (rightLock == -1)
401 {
402 notBar = false;
403 }
404 if (category == 0)
405 {
406 int num14 = 0;
407 DrawRightSide(sb, Lang.menu[65].Value, num14, vector6, vector7, rightScale[num14], 1f);
408 skipRightSlot[num14] = true;
409 num14++;
410 vector6.X -= num;
411 if (DrawRightSide(sb, Lang.menu[99].Value + " " + Math.Round(Main.musicVolume * 100f) + "%", num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
412 {
413 if (rightLock == -1)
414 {
415 notBar = true;
416 }
417 noSound = true;
419 }
420 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
421 valuePosition.Y -= 3f;
422 float musicVolume = DrawValueBar(sb, scale, Main.musicVolume);
423 if ((inBar || rightLock == num14) && !notBar)
424 {
426 if (Main.mouseLeft && rightLock == num14)
427 {
428 Main.musicVolume = musicVolume;
429 }
430 }
431 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
432 {
433 if (rightLock == -1)
434 {
435 notBar = true;
436 }
438 }
439 if (rightHover == num14)
440 {
441 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 2;
442 }
443 num14++;
444 if (DrawRightSide(sb, Lang.menu[98].Value + " " + Math.Round(Main.soundVolume * 100f) + "%", num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
445 {
446 if (rightLock == -1)
447 {
448 notBar = true;
449 }
451 }
452 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
453 valuePosition.Y -= 3f;
454 float soundVolume = DrawValueBar(sb, scale, Main.soundVolume);
455 if ((inBar || rightLock == num14) && !notBar)
456 {
458 if (Main.mouseLeft && rightLock == num14)
459 {
460 Main.soundVolume = soundVolume;
461 noSound = true;
462 }
463 }
464 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
465 {
466 if (rightLock == -1)
467 {
468 notBar = true;
469 }
471 }
472 if (rightHover == num14)
473 {
474 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 3;
475 }
476 num14++;
477 if (DrawRightSide(sb, Lang.menu[119].Value + " " + Math.Round(Main.ambientVolume * 100f) + "%", num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
478 {
479 if (rightLock == -1)
480 {
481 notBar = true;
482 }
484 }
485 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
486 valuePosition.Y -= 3f;
487 float ambientVolume = DrawValueBar(sb, scale, Main.ambientVolume);
488 if ((inBar || rightLock == num14) && !notBar)
489 {
491 if (Main.mouseLeft && rightLock == num14)
492 {
493 Main.ambientVolume = ambientVolume;
494 noSound = true;
495 }
496 }
497 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
498 {
499 if (rightLock == -1)
500 {
501 notBar = true;
502 }
504 }
505 if (rightHover == num14)
506 {
507 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 4;
508 }
509 num14++;
510 vector6.X += num;
512 skipRightSlot[num14] = true;
513 num14++;
514 DrawRightSide(sb, Language.GetTextValue("GameUI.ZoomCategory"), num14, vector6, vector7, rightScale[num14], 1f);
515 skipRightSlot[num14] = true;
516 num14++;
517 vector6.X -= num;
518 string text = Language.GetTextValue("GameUI.GameZoom", Math.Round(Main.GameZoomTarget * 100f), Math.Round(Main.GameViewMatrix.Zoom.X * 100f));
519 if (flag3)
520 {
521 text = FontAssets.ItemStack.Value.CreateWrappedText(text, num3, Language.ActiveCulture.CultureInfo);
522 }
524 {
525 if (rightLock == -1)
526 {
527 notBar = true;
528 }
530 }
531 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
532 valuePosition.Y -= 3f;
533 float num15 = DrawValueBar(sb, scale, Main.GameZoomTarget - 1f);
534 if ((inBar || rightLock == num14) && !notBar)
535 {
537 if (Main.mouseLeft && rightLock == num14)
538 {
539 Main.GameZoomTarget = num15 + 1f;
540 }
541 }
542 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
543 {
544 if (rightLock == -1)
545 {
546 notBar = true;
547 }
549 }
550 if (rightHover == num14)
551 {
552 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 10;
553 }
554 num14++;
555 bool flag7 = false;
556 if (Main.temporaryGUIScaleSlider == -1f)
557 {
558 Main.temporaryGUIScaleSlider = Main.UIScaleWanted;
559 }
560 string text2 = Language.GetTextValue("GameUI.UIScale", Math.Round(Main.temporaryGUIScaleSlider * 100f), Math.Round(Main.UIScale * 100f));
561 if (flag3)
562 {
563 text2 = FontAssets.ItemStack.Value.CreateWrappedText(text2, num3, Language.ActiveCulture.CultureInfo);
564 }
566 {
567 if (rightLock == -1)
568 {
569 notBar = true;
570 }
572 }
573 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
574 valuePosition.Y -= 3f;
575 float num16 = DrawValueBar(sb, scale, MathHelper.Clamp((Main.temporaryGUIScaleSlider - 0.5f) / 1.5f, 0f, 1f));
576 if ((inBar || rightLock == num14) && !notBar)
577 {
579 if (Main.mouseLeft && rightLock == num14)
580 {
581 Main.temporaryGUIScaleSlider = num16 * 1.5f + 0.5f;
582 Main.temporaryGUIScaleSlider = (float)(int)(Main.temporaryGUIScaleSlider * 100f) / 100f;
583 Main.temporaryGUIScaleSliderUpdate = true;
584 flag7 = true;
585 }
586 }
588 {
589 Main.UIScale = Main.temporaryGUIScaleSlider;
590 Main.temporaryGUIScaleSliderUpdate = false;
591 }
592 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
593 {
594 if (rightLock == -1)
595 {
596 notBar = true;
597 }
599 }
600 if (rightHover == num14)
601 {
602 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 11;
603 }
604 num14++;
605 vector6.X += num;
607 skipRightSlot[num14] = true;
608 num14++;
609 DrawRightSide(sb, Language.GetTextValue("GameUI.Gameplay"), num14, vector6, vector7, rightScale[num14], 1f);
610 skipRightSlot[num14] = true;
611 num14++;
612 if (DrawRightSide(sb, Main.autoSave ? Lang.menu[67].Value : Lang.menu[68].Value, num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
613 {
615 if (flag4)
616 {
617 Main.autoSave = !Main.autoSave;
618 }
619 }
620 num14++;
621 if (DrawRightSide(sb, Main.autoPause ? Lang.menu[69].Value : Lang.menu[70].Value, num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
622 {
624 if (flag4)
625 {
626 Main.autoPause = !Main.autoPause;
627 }
628 }
629 num14++;
631 {
633 if (flag4)
634 {
635 Main.ReversedUpDownArmorSetBonuses = !Main.ReversedUpDownArmorSetBonuses;
636 }
637 }
638 num14++;
640 {
641 DoorOpeningHelper.DoorAutoOpeningPreference.EnabledForEverything => Language.GetTextValue("UI.SmartDoorsEnabled"),
642 DoorOpeningHelper.DoorAutoOpeningPreference.EnabledForGamepadOnly => Language.GetTextValue("UI.SmartDoorsGamepad"),
643 _ => Language.GetTextValue("UI.SmartDoorsDisabled"),
645 {
647 if (flag4)
648 {
650 }
651 }
652 num14++;
653 string textValue;
655 {
656 _ = 1;
657 textValue = Language.GetTextValue("UI.HoverControlSettingIsClick");
658 }
659 else
660 {
661 textValue = Language.GetTextValue("UI.HoverControlSettingIsHold");
662 }
663 if (DrawRightSide(sb, textValue, num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
664 {
666 if (flag4)
667 {
669 }
670 }
671 num14++;
672 if (DrawRightSide(sb, Language.GetTextValue(Main.SettingsEnabled_AutoReuseAllItems ? "UI.AutoReuseAllOn" : "UI.AutoReuseAllOff"), num14, vector6, vector7, rightScale[num14], (rightScale[num14] - num5) / (num6 - num5)))
673 {
675 if (flag4)
676 {
677 Main.SettingsEnabled_AutoReuseAllItems = !Main.SettingsEnabled_AutoReuseAllItems;
678 }
679 }
680 num14++;
682 skipRightSlot[num14] = true;
683 num14++;
684 }
685 if (category == 1)
686 {
687 int num17 = 0;
688 if (DrawRightSide(sb, Main.showItemText ? Lang.menu[71].Value : Lang.menu[72].Value, num17, vector6, vector7, rightScale[num17], (rightScale[num17] - num5) / (num6 - num5)))
689 {
691 if (flag4)
692 {
693 Main.showItemText = !Main.showItemText;
694 }
695 }
696 num17++;
698 {
700 if (flag4)
701 {
703 if (Main.invasionProgressMode >= 3)
704 {
705 Main.invasionProgressMode = 0;
706 }
707 }
708 }
709 num17++;
711 {
713 if (flag4)
714 {
715 Main.placementPreview = !Main.placementPreview;
716 }
717 }
718 num17++;
720 {
722 if (flag4)
723 {
724 ItemSlot.Options.HighlightNewItems = !ItemSlot.Options.HighlightNewItems;
725 }
726 }
727 num17++;
729 {
731 if (flag4)
732 {
733 Main.MouseShowBuildingGrid = !Main.MouseShowBuildingGrid;
734 }
735 }
736 num17++;
738 {
740 if (flag4)
741 {
742 Main.GamepadDisableInstructionsDisplay = !Main.GamepadDisableInstructionsDisplay;
743 }
744 }
745 num17++;
746 string textValue2 = Language.GetTextValue("UI.MinimapFrame_" + Main.MinimapFrameManagerInstance.ActiveSelectionKeyName);
748 {
750 if (flag4)
751 {
752 Main.MinimapFrameManagerInstance.CycleSelection();
753 }
754 }
755 num17++;
756 vector6.X -= num;
757 string text3 = Language.GetTextValue("GameUI.MapScale", Math.Round(Main.MapScale * 100f));
758 if (flag3)
759 {
760 text3 = FontAssets.ItemStack.Value.CreateWrappedText(text3, num3, Language.ActiveCulture.CultureInfo);
761 }
763 {
764 if (rightLock == -1)
765 {
766 notBar = true;
767 }
769 }
770 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
771 valuePosition.Y -= 3f;
772 float num18 = DrawValueBar(sb, scale, (Main.MapScale - 0.5f) / 0.5f);
773 if ((inBar || rightLock == num17) && !notBar)
774 {
776 if (Main.mouseLeft && rightLock == num17)
777 {
778 Main.MapScale = num18 * 0.5f + 0.5f;
779 }
780 }
781 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
782 {
783 if (rightLock == -1)
784 {
785 notBar = true;
786 }
788 }
789 if (rightHover == num17)
790 {
791 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 12;
792 }
793 num17++;
794 vector6.X += num;
795 string activeSetKeyName = Main.ResourceSetsManager.ActiveSetKeyName;
796 string textValue3 = Language.GetTextValue("UI.HealthManaStyle_" + activeSetKeyName);
797 if (DrawRightSide(sb, Language.GetTextValue("UI.SelectHealthStyle", textValue3), num17, vector6, vector7, rightScale[num17], (rightScale[num17] - num5) / (num6 - num5)))
798 {
800 if (flag4)
801 {
802 Main.ResourceSetsManager.CycleResourceSet();
803 }
804 }
805 num17++;
806 string textValue4 = Language.GetTextValue(BigProgressBarSystem.ShowText ? "UI.ShowBossLifeTextOn" : "UI.ShowBossLifeTextOff");
808 {
810 if (flag4)
811 {
813 }
814 }
815 num17++;
816 if (DrawRightSide(sb, Main.SettingsEnabled_OpaqueBoxBehindTooltips ? Language.GetTextValue("GameUI.HoverTextBoxesOn") : Language.GetTextValue("GameUI.HoverTextBoxesOff"), num17, vector6, vector7, rightScale[num17], (rightScale[num17] - num5) / (num6 - num5)))
817 {
819 if (flag4)
820 {
821 Main.SettingsEnabled_OpaqueBoxBehindTooltips = !Main.SettingsEnabled_OpaqueBoxBehindTooltips;
822 }
823 }
824 num17++;
825 }
826 if (category == 2)
827 {
828 int num19 = 0;
829 if (DrawRightSide(sb, Main.graphics.IsFullScreen ? Lang.menu[49].Value : Lang.menu[50].Value, num19, vector6, vector7, rightScale[num19], (rightScale[num19] - num5) / (num6 - num5)))
830 {
832 if (flag4)
833 {
835 }
836 }
837 num19++;
839 {
841 if (flag4)
842 {
843 int num20 = 0;
844 for (int m = 0; m < Main.numDisplayModes; m++)
845 {
847 {
848 num20 = m;
849 break;
850 }
851 }
852 num20++;
854 {
855 num20 = 0;
856 }
857 Main.PendingResolutionWidth = Main.displayWidth[num20];
858 Main.PendingResolutionHeight = Main.displayHeight[num20];
860 }
861 }
862 num19++;
863 vector6.X -= num;
864 if (DrawRightSide(sb, Lang.menu[52].Value + ": " + Main.bgScroll + "%", num19, vector6, vector7, rightScale[num19], (rightScale[num19] - num5) / (num6 - num5)))
865 {
866 if (rightLock == -1)
867 {
868 notBar = true;
869 }
870 noSound = true;
872 }
873 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
874 valuePosition.Y -= 3f;
875 float num21 = DrawValueBar(sb, scale, (float)Main.bgScroll / 100f);
876 if ((inBar || rightLock == num19) && !notBar)
877 {
879 if (Main.mouseLeft && rightLock == num19)
880 {
881 Main.bgScroll = (int)(num21 * 100f);
882 Main.caveParallax = 1f - (float)Main.bgScroll / 500f;
883 }
884 }
885 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
886 {
887 if (rightLock == -1)
888 {
889 notBar = true;
890 }
892 }
893 if (rightHover == num19)
894 {
895 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 1;
896 }
897 num19++;
898 vector6.X += num;
899 if (DrawRightSide(sb, Lang.menu[(int)(247 + Main.FrameSkipMode)].Value, num19, vector6, vector7, rightScale[num19], (rightScale[num19] - num5) / (num6 - num5)))
900 {
902 if (flag4)
903 {
905 }
906 }
907 num19++;
909 {
911 if (flag4)
912 {
914 }
915 }
916 num19++;
918 {
920 if (flag4)
921 {
922 Main.qaStyle++;
923 if (Main.qaStyle > 3)
924 {
925 Main.qaStyle = 0;
926 }
927 }
928 }
929 num19++;
931 {
933 if (flag4)
934 {
935 Main.BackgroundEnabled = !Main.BackgroundEnabled;
936 }
937 }
938 num19++;
940 {
942 if (flag4)
943 {
944 ChildSafety.Disabled = !ChildSafety.Disabled;
945 }
946 }
947 num19++;
948 if (DrawRightSide(sb, Language.GetTextValue("GameUI.HeatDistortion", Main.UseHeatDistortion ? Language.GetTextValue("GameUI.Enabled") : Language.GetTextValue("GameUI.Disabled")), num19, vector6, vector7, rightScale[num19], (rightScale[num19] - num5) / (num6 - num5)))
949 {
951 if (flag4)
952 {
953 Main.UseHeatDistortion = !Main.UseHeatDistortion;
954 }
955 }
956 num19++;
957 if (DrawRightSide(sb, Language.GetTextValue("GameUI.StormEffects", Main.UseStormEffects ? Language.GetTextValue("GameUI.Enabled") : Language.GetTextValue("GameUI.Disabled")), num19, vector6, vector7, rightScale[num19], (rightScale[num19] - num5) / (num6 - num5)))
958 {
960 if (flag4)
961 {
962 Main.UseStormEffects = !Main.UseStormEffects;
963 }
964 }
965 num19++;
966 if (DrawRightSide(sb, Language.GetTextValue("GameUI.WaveQuality", Main.WaveQuality switch
967 {
968 1 => Language.GetTextValue("GameUI.QualityLow"),
969 2 => Language.GetTextValue("GameUI.QualityMedium"),
970 3 => Language.GetTextValue("GameUI.QualityHigh"),
971 _ => Language.GetTextValue("GameUI.QualityOff"),
973 {
975 if (flag4)
976 {
977 Main.WaveQuality = (Main.WaveQuality + 1) % 4;
978 }
979 }
980 num19++;
981 if (DrawRightSide(sb, Language.GetTextValue("UI.TilesSwayInWind" + (Main.SettingsEnabled_TilesSwayInWind ? "On" : "Off")), num19, vector6, vector7, rightScale[num19], (rightScale[num19] - num5) / (num6 - num5)))
982 {
984 if (flag4)
985 {
986 Main.SettingsEnabled_TilesSwayInWind = !Main.SettingsEnabled_TilesSwayInWind;
987 }
988 }
989 num19++;
990 }
991 if (category == 3)
992 {
993 int num22 = 0;
994 float num23 = num;
995 if (flag)
996 {
997 num2 = 126f;
998 }
999 Vector3 hSLVector = Main.mouseColorSlider.GetHSLVector();
1000 Main.mouseColorSlider.ApplyToMainLegacyBars();
1001 DrawRightSide(sb, Lang.menu[64].Value, num22, vector6, vector7, rightScale[num22], 1f);
1002 skipRightSlot[num22] = true;
1003 num22++;
1004 vector6.X -= num23;
1006 {
1007 if (rightLock == -1)
1008 {
1009 notBar = true;
1010 }
1011 rightHover = num22;
1012 }
1013 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1014 valuePosition.Y -= 3f;
1015 valuePosition.X -= num2;
1016 DelegateMethods.v3_1 = hSLVector;
1017 float x = DrawValueBar(sb, scale, hSLVector.X, 0, DelegateMethods.ColorLerp_HSL_H);
1018 if ((inBar || rightLock == num22) && !notBar)
1019 {
1020 rightHover = num22;
1021 if (Main.mouseLeft && rightLock == num22)
1022 {
1023 hSLVector.X = x;
1024 noSound = true;
1025 }
1026 }
1027 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1028 {
1029 if (rightLock == -1)
1030 {
1031 notBar = true;
1032 }
1033 rightHover = num22;
1034 }
1035 if (rightHover == num22)
1036 {
1037 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 5;
1038 Main.menuMode = 25;
1039 }
1040 num22++;
1042 {
1043 if (rightLock == -1)
1044 {
1045 notBar = true;
1046 }
1047 rightHover = num22;
1048 }
1049 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1050 valuePosition.Y -= 3f;
1051 valuePosition.X -= num2;
1052 DelegateMethods.v3_1 = hSLVector;
1054 if ((inBar || rightLock == num22) && !notBar)
1055 {
1056 rightHover = num22;
1057 if (Main.mouseLeft && rightLock == num22)
1058 {
1059 hSLVector.Y = x;
1060 noSound = true;
1061 }
1062 }
1063 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1064 {
1065 if (rightLock == -1)
1066 {
1067 notBar = true;
1068 }
1069 rightHover = num22;
1070 }
1071 if (rightHover == num22)
1072 {
1073 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 6;
1074 Main.menuMode = 25;
1075 }
1076 num22++;
1078 {
1079 if (rightLock == -1)
1080 {
1081 notBar = true;
1082 }
1083 rightHover = num22;
1084 }
1085 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1086 valuePosition.Y -= 3f;
1087 valuePosition.X -= num2;
1088 DelegateMethods.v3_1 = hSLVector;
1089 DelegateMethods.v3_1.Z = Utils.GetLerpValue(0.15f, 1f, DelegateMethods.v3_1.Z, clamped: true);
1091 if ((inBar || rightLock == num22) && !notBar)
1092 {
1093 rightHover = num22;
1094 if (Main.mouseLeft && rightLock == num22)
1095 {
1096 hSLVector.Z = x * 0.85f + 0.15f;
1097 noSound = true;
1098 }
1099 }
1100 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1101 {
1102 if (rightLock == -1)
1103 {
1104 notBar = true;
1105 }
1106 rightHover = num22;
1107 }
1108 if (rightHover == num22)
1109 {
1110 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 7;
1111 Main.menuMode = 25;
1112 }
1113 num22++;
1114 if (hSLVector.Z < 0.15f)
1115 {
1116 hSLVector.Z = 0.15f;
1117 }
1119 Main.mouseColor = Main.mouseColorSlider.GetColor();
1120 vector6.X += num23;
1122 skipRightSlot[num22] = true;
1123 num22++;
1124 hSLVector = Main.mouseBorderColorSlider.GetHSLVector();
1125 if (PlayerInput.UsingGamepad && rightHover == -1)
1126 {
1127 Main.mouseBorderColorSlider.ApplyToMainLegacyBars();
1128 }
1129 DrawRightSide(sb, Lang.menu[217].Value, num22, vector6, vector7, rightScale[num22], 1f);
1130 skipRightSlot[num22] = true;
1131 num22++;
1132 vector6.X -= num23;
1134 {
1135 if (rightLock == -1)
1136 {
1137 notBar = true;
1138 }
1139 rightHover = num22;
1140 }
1141 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1142 valuePosition.Y -= 3f;
1143 valuePosition.X -= num2;
1144 DelegateMethods.v3_1 = hSLVector;
1146 if ((inBar || rightLock == num22) && !notBar)
1147 {
1148 rightHover = num22;
1149 if (Main.mouseLeft && rightLock == num22)
1150 {
1151 hSLVector.X = x;
1152 noSound = true;
1153 }
1154 }
1155 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1156 {
1157 if (rightLock == -1)
1158 {
1159 notBar = true;
1160 }
1161 rightHover = num22;
1162 }
1163 if (rightHover == num22)
1164 {
1165 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 5;
1166 Main.menuMode = 252;
1167 }
1168 num22++;
1170 {
1171 if (rightLock == -1)
1172 {
1173 notBar = true;
1174 }
1175 rightHover = num22;
1176 }
1177 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1178 valuePosition.Y -= 3f;
1179 valuePosition.X -= num2;
1180 DelegateMethods.v3_1 = hSLVector;
1182 if ((inBar || rightLock == num22) && !notBar)
1183 {
1184 rightHover = num22;
1185 if (Main.mouseLeft && rightLock == num22)
1186 {
1187 hSLVector.Y = x;
1188 noSound = true;
1189 }
1190 }
1191 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1192 {
1193 if (rightLock == -1)
1194 {
1195 notBar = true;
1196 }
1197 rightHover = num22;
1198 }
1199 if (rightHover == num22)
1200 {
1201 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 6;
1202 Main.menuMode = 252;
1203 }
1204 num22++;
1206 {
1207 if (rightLock == -1)
1208 {
1209 notBar = true;
1210 }
1211 rightHover = num22;
1212 }
1213 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1214 valuePosition.Y -= 3f;
1215 valuePosition.X -= num2;
1216 DelegateMethods.v3_1 = hSLVector;
1218 if ((inBar || rightLock == num22) && !notBar)
1219 {
1220 rightHover = num22;
1221 if (Main.mouseLeft && rightLock == num22)
1222 {
1223 hSLVector.Z = x;
1224 noSound = true;
1225 }
1226 }
1227 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1228 {
1229 if (rightLock == -1)
1230 {
1231 notBar = true;
1232 }
1233 rightHover = num22;
1234 }
1235 if (rightHover == num22)
1236 {
1237 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 7;
1238 Main.menuMode = 252;
1239 }
1240 num22++;
1242 {
1243 if (rightLock == -1)
1244 {
1245 notBar = true;
1246 }
1247 rightHover = num22;
1248 }
1249 valuePosition.X = vector3.X + vector2.X - (float)(num4 / 2) - 20f;
1250 valuePosition.Y -= 3f;
1251 valuePosition.X -= num2;
1252 DelegateMethods.v3_1 = hSLVector;
1253 float num24 = Main.mouseBorderColorSlider.Alpha;
1255 if ((inBar || rightLock == num22) && !notBar)
1256 {
1257 rightHover = num22;
1258 if (Main.mouseLeft && rightLock == num22)
1259 {
1260 num24 = x;
1261 noSound = true;
1262 }
1263 }
1264 if ((float)Main.mouseX > vector3.X + vector2.X * 2f / 3f + (float)num4 && (float)Main.mouseX < valuePosition.X + 3.75f && (float)Main.mouseY > valuePosition.Y - 10f && (float)Main.mouseY <= valuePosition.Y + 10f)
1265 {
1266 if (rightLock == -1)
1267 {
1268 notBar = true;
1269 }
1270 rightHover = num22;
1271 }
1272 if (rightHover == num22)
1273 {
1274 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 8;
1275 Main.menuMode = 252;
1276 }
1277 num22++;
1279 Main.mouseBorderColorSlider.Alpha = num24;
1280 Main.MouseBorderColor = Main.mouseBorderColorSlider.GetColor();
1281 vector6.X += num23;
1283 skipRightSlot[num22] = true;
1284 num22++;
1285 string txt = "";
1286 switch (LockOnHelper.UseMode)
1287 {
1288 case LockOnHelper.LockOnMode.FocusTarget:
1289 txt = Lang.menu[232].Value;
1290 break;
1291 case LockOnHelper.LockOnMode.TargetClosest:
1292 txt = Lang.menu[233].Value;
1293 break;
1294 case LockOnHelper.LockOnMode.ThreeDS:
1295 txt = Lang.menu[234].Value;
1296 break;
1297 }
1299 {
1300 rightHover = num22;
1301 if (flag4)
1302 {
1304 }
1305 }
1306 num22++;
1308 {
1309 rightHover = num22;
1310 if (flag4)
1311 {
1312 Player.SmartCursorSettings.SmartBlocksEnabled = !Player.SmartCursorSettings.SmartBlocksEnabled;
1313 }
1314 }
1315 num22++;
1317 {
1318 rightHover = num22;
1319 if (flag4)
1320 {
1321 Main.cSmartCursorModeIsToggleAndNotHold = !Main.cSmartCursorModeIsToggleAndNotHold;
1322 }
1323 }
1324 num22++;
1326 {
1327 rightHover = num22;
1328 if (flag4)
1329 {
1330 Player.SmartCursorSettings.SmartAxeAfterPickaxe = !Player.SmartCursorSettings.SmartAxeAfterPickaxe;
1331 }
1332 }
1333 num22++;
1334 }
1335 if (rightHover != -1 && rightLock == -1)
1336 {
1338 }
1339 for (int n = 0; n < num9 + 1; n++)
1340 {
1342 }
1344 if (flag)
1345 {
1346 zero.X = -40f;
1347 }
1348 for (int num25 = 0; num25 < num13; num25++)
1349 {
1350 if (!skipRightSlot[num25])
1351 {
1353 num12++;
1354 }
1355 }
1356 UILinkPointNavigator.Shortcuts.INGAMEOPTIONS_BUTTONS_RIGHT = num12;
1359 Main.mouseText = false;
1360 Main.instance.GUIBarsDraw();
1361 Main.instance.DrawMouseOver();
1363 }
1364
1365 public static void MouseOver()
1366 {
1368 {
1369 if (_GUIHover.Contains(Main.MouseScreen.ToPoint()))
1370 {
1371 Main.mouseText = true;
1372 }
1373 if (_mouseOverText != null)
1374 {
1375 Main.instance.MouseText(_mouseOverText, 0, 0);
1376 }
1377 _mouseOverText = null;
1378 }
1379 }
1380
1381 public static bool DrawLeftSide(SpriteBatch sb, string txt, int i, Vector2 anchor, Vector2 offset, float[] scales, float minscale = 0.7f, float maxscale = 0.8f, float scalespeed = 0.01f)
1382 {
1383 bool flag = false;
1384 if (_leftSideCategoryMapping.TryGetValue(i, out var value))
1385 {
1386 flag = category == value;
1387 }
1389 if (flag)
1390 {
1391 color = Color.Gold;
1392 }
1393 Vector2 vector = Utils.DrawBorderStringBig(sb, txt, anchor + offset * (1 + i), color, scales[i], 0.5f, 0.5f);
1394 bool flag2 = new Rectangle((int)anchor.X - (int)vector.X / 2, (int)anchor.Y + (int)(offset.Y * (float)(1 + i)) - (int)vector.Y / 2, (int)vector.X, (int)vector.Y).Contains(new Point(Main.mouseX, Main.mouseY));
1395 if (!_canConsumeHover)
1396 {
1397 return false;
1398 }
1399 if (flag2)
1400 {
1401 _canConsumeHover = false;
1402 return true;
1403 }
1404 return false;
1405 }
1406
1407 public static bool DrawRightSide(SpriteBatch sb, string txt, int i, Vector2 anchor, Vector2 offset, float scale, float colorScale, Color over = default(Color))
1408 {
1410 if (over != default(Color))
1411 {
1412 color = over;
1413 }
1414 Vector2 vector = Utils.DrawBorderString(sb, txt, anchor + offset * (1 + i), color, scale, 0.5f, 0.5f);
1415 valuePosition = anchor + offset * (1 + i) + vector * new Vector2(0.5f, 0f);
1416 bool flag = new Rectangle((int)anchor.X - (int)vector.X / 2, (int)anchor.Y + (int)(offset.Y * (float)(1 + i)) - (int)vector.Y / 2, (int)vector.X, (int)vector.Y).Contains(new Point(Main.mouseX, Main.mouseY));
1417 if (!_canConsumeHover)
1418 {
1419 return false;
1420 }
1421 if (flag)
1422 {
1423 _canConsumeHover = false;
1424 return true;
1425 }
1426 return false;
1427 }
1428
1430 {
1431 return Utils.CenteredRectangle(anchor + offset * (1 + itemIndex), new Vector2(areaWidth, offset.Y - 4f));
1432 }
1433
1434 public static bool DrawValue(SpriteBatch sb, string txt, int i, float scale, Color over = default(Color))
1435 {
1436 Color color = Color.Gray;
1437 Vector2 vector = FontAssets.MouseText.Value.MeasureString(txt) * scale;
1438 bool flag = new Rectangle((int)valuePosition.X, (int)valuePosition.Y - (int)vector.Y / 2, (int)vector.X, (int)vector.Y).Contains(new Point(Main.mouseX, Main.mouseY));
1439 if (flag)
1440 {
1441 color = Color.White;
1442 }
1443 if (over != default(Color))
1444 {
1445 color = over;
1446 }
1447 Utils.DrawBorderString(sb, txt, valuePosition, color, scale, 0f, 0.5f);
1448 valuePosition.X += vector.X;
1449 if (!_canConsumeHover)
1450 {
1451 return false;
1452 }
1453 if (flag)
1454 {
1455 _canConsumeHover = false;
1456 return true;
1457 }
1458 return false;
1459 }
1460
1461 public static float DrawValueBar(SpriteBatch sb, float scale, float perc, int lockState = 0, Utils.ColorLerpMethod colorMethod = null)
1462 {
1463 if (colorMethod == null)
1464 {
1465 colorMethod = Utils.ColorLerp_BlackToWhite;
1466 }
1468 Vector2 vector = new Vector2(value.Width, value.Height) * scale;
1469 valuePosition.X -= (int)vector.X;
1470 Rectangle rectangle = new Rectangle((int)valuePosition.X, (int)valuePosition.Y - (int)vector.Y / 2, (int)vector.X, (int)vector.Y);
1471 Rectangle destinationRectangle = rectangle;
1473 int num = 167;
1474 float num2 = (float)rectangle.X + 5f * scale;
1475 float num3 = (float)rectangle.Y + 4f * scale;
1476 for (float num4 = 0f; num4 < (float)num; num4 += 1f)
1477 {
1478 float percent = num4 / (float)num;
1479 sb.Draw(TextureAssets.ColorBlip.Value, new Vector2(num2 + num4 * scale, num3), null, colorMethod(percent), 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);
1480 }
1481 rectangle.Inflate((int)(-5f * scale), 0);
1482 bool flag = rectangle.Contains(new Point(Main.mouseX, Main.mouseY));
1483 if (lockState == 2)
1484 {
1485 flag = false;
1486 }
1487 if (flag || lockState == 1)
1488 {
1489 sb.Draw(TextureAssets.ColorHighlight.Value, destinationRectangle, Main.OurFavoriteColor);
1490 }
1491 sb.Draw(TextureAssets.ColorSlider.Value, new Vector2(num2 + 167f * scale * perc, num3 + 4f * scale), null, Color.White, 0f, new Vector2(0.5f * (float)TextureAssets.ColorSlider.Width(), 0.5f * (float)TextureAssets.ColorSlider.Height()), scale, SpriteEffects.None, 0f);
1492 if (Main.mouseX >= rectangle.X && Main.mouseX <= rectangle.X + rectangle.Width)
1493 {
1494 inBar = flag;
1495 return (float)(Main.mouseX - rectangle.X) / (float)rectangle.Width;
1496 }
1497 inBar = false;
1498 if (rectangle.X >= Main.mouseX)
1499 {
1500 return 0f;
1501 }
1502 return 1f;
1503 }
1504}
void Draw(Texture2D texture, Vector2 position, Color color)
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
static decimal Round(decimal d)
Definition Math.cs:1096
static void PlaySound(int type, Vector2 position, int style=1)
static Color ColorLerp_HSL_S(float percent)
static Color ColorLerp_HSL_H(float percent)
static Color ColorLerp_HSL_L(float percent)
static Color ColorLerp_HSL_O(float percent)
static DoorAutoOpeningPreference PreferenceSettings
static Asset< DynamicSpriteFont > ItemStack
Definition FontAssets.cs:8
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static Asset< Texture2D > ColorHighlight
static Asset< Texture2D > ColorSlider
static Asset< Texture2D > ColorBlip
static Asset< Texture2D > ColorBar
static bool _canConsumeHover
static float[] rightScale
static bool DrawValue(SpriteBatch sb, string txt, int i, float scale, Color over=default(Color))
static void Draw(Main mainInstance, SpriteBatch sb)
static bool[] skipRightSlot
static Rectangle _GUIHover
static bool DrawRightSide(SpriteBatch sb, string txt, int i, Vector2 anchor, Vector2 offset, float scale, float colorScale, Color over=default(Color))
static float DrawValueBar(SpriteBatch sb, float scale, float perc, int lockState=0, Utils.ColorLerpMethod colorMethod=null)
static string _mouseOverText
static Rectangle GetExpectedRectangleForNotification(int itemIndex, Vector2 anchor, Vector2 offset, int areaWidth)
static Vector2 valuePosition
static float[] leftScale
static bool DrawLeftSide(SpriteBatch sb, string txt, int i, Vector2 anchor, Vector2 offset, float[] scales, float minscale=0.7f, float maxscale=0.8f, float scalespeed=0.01f)
static Dictionary< int, int > _leftSideCategoryMapping
static LocalizedText[] inter
Definition Lang.cs:28
static LocalizedText[] menu
Definition Lang.cs:19
static void NextLightMode()
Definition Lighting.cs:167
static LightMode Mode
Definition Lighting.cs:30
static GameCulture FromCultureName(CultureName name)
static GameCulture ActiveCulture
Definition Language.cs:8
static string GetTextValue(string key)
Definition Language.cs:15
static float temporaryGUIScaleSlider
Definition Main.cs:1902
static int WaveQuality
Definition Main.cs:425
static bool ingameOptionsWindow
Definition Main.cs:704
static bool autoPause
Definition Main.cs:1324
static bool temporaryGUIScaleSliderUpdate
Definition Main.cs:1904
static FrameSkipMode FrameSkipMode
Definition Main.cs:2223
static bool UseHeatDistortion
Definition Main.cs:429
static ColorSlidersSet mouseBorderColorSlider
Definition Main.cs:2201
static bool cSmartCursorModeIsToggleAndNotHold
Definition Main.cs:2143
static float ambientVolume
Definition Main.cs:1423
static int myPlayer
Definition Main.cs:1801
static int[] displayHeight
Definition Main.cs:1924
static void SetResolution(int width, int height)
Definition Main.cs:62997
static bool SettingsEnabled_AutoReuseAllItems
Definition Main.cs:247
static int PendingResolutionHeight
Definition Main.cs:1966
static PlayerResourceSetsManager ResourceSetsManager
Definition Main.cs:2261
static float UIScale
Definition Main.cs:2624
static Vector2 DrawThickCursor(bool smart=false)
Definition Main.cs:45092
static bool mouseLeftRelease
Definition Main.cs:1755
static Main instance
Definition Main.cs:283
static bool UseStormEffects
Definition Main.cs:427
static int screenHeight
Definition Main.cs:1721
static void DrawCursor(Vector2 bonus, bool smart=false)
Definition Main.cs:45012
static Vector2 MouseScreen
Definition Main.cs:2773
static void CycleFrameSkipMode()
Definition Main.cs:48876
static int setKey
Definition Main.cs:2503
static bool BackgroundEnabled
Definition Main.cs:802
static Microsoft.Xna.Framework.Color OurFavoriteColor
Definition Main.cs:902
static SpriteViewMatrix GameViewMatrix
Definition Main.cs:227
static bool showItemText
Definition Main.cs:1238
static float MapScale
Definition Main.cs:2543
static int qaStyle
Definition Main.cs:762
static bool SettingsEnabled_TilesSwayInWind
Definition Main.cs:1372
static bool autoSave
Definition Main.cs:1240
static int[] displayWidth
Definition Main.cs:1922
static float GameZoomTarget
Definition Main.cs:239
static int numDisplayModes
Definition Main.cs:1920
static float UIScaleWanted
Definition Main.cs:2621
static ColorSlidersSet mouseColorSlider
Definition Main.cs:2199
static void DrawInterface_29_SettingsButton()
Definition Main.cs:42325
static void ToggleFullScreen()
Definition Main.cs:62987
static int invasionProgressMode
Definition Main.cs:1984
static MinimapFrameManager MinimapFrameManagerInstance
Definition Main.cs:2259
static int screenWidth
Definition Main.cs:1719
static bool SettingsEnabled_OpaqueBoxBehindTooltips
Definition Main.cs:253
static int PendingResolutionWidth
Definition Main.cs:1964
static float musicVolume
Definition Main.cs:1421
static bool placementPreview
Definition Main.cs:1342
static int mouseY
Definition Main.cs:606
static bool ReversedUpDownArmorSetBonuses
Definition Main.cs:259
static bool SaveSettings()
Definition Main.cs:3806
static void ClosePlayerChat()
Definition Main.cs:16993
static float soundVolume
Definition Main.cs:1425
static bool GamepadDisableInstructionsDisplay
Definition Main.cs:271
static void DrawGamepadInstructions()
Definition Main.cs:20036
static Player[] player
Definition Main.cs:1803
static int mouseX
Definition Main.cs:604
static GraphicsDeviceManager graphics
Definition Main.cs:972
static bool MouseShowBuildingGrid
Definition Main.cs:263
static int bgScroll
Definition Main.cs:2505
static bool mouseLeft
Definition Main.cs:614
static void CycleHoverControl()
Definition Player.cs:345
static HoverControlMode HoverControl
Definition Player.cs:343
static void FindRecipes(bool canDelayCheck=false)
Definition Recipe.cs:453
static Terraria.Social.Base.NetSocialModule Network
Definition SocialAPI.cs:20
static void SetPosition(int ID, Vector2 Position)
static void OpenAchievements()
static bool HighlightNewItems
Definition ItemSlot.cs:26
static void DrawInvBG(SpriteBatch sb, Rectangle R, Color c=default(Color))
Definition Utils.cs:1921
static Vector2 DrawBorderString(SpriteBatch sb, string text, Vector2 pos, Color color, float scale=1f, float anchorx=0f, float anchory=0f, int maxCharactersDisplayed=-1)
Definition Utils.cs:1891
static Color ColorLerp_BlackToWhite(float percent)
Definition Utils.cs:59
delegate Color ColorLerpMethod(float percent)
static Vector2 DrawBorderStringBig(SpriteBatch spriteBatch, string text, Vector2 pos, Color color, float scale=1f, float anchorx=0f, float anchory=0f, int maxCharactersDisplayed=-1)
Definition Utils.cs:1903
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static void SaveAndQuit(Action callback=null)
Definition WorldGen.cs:3146
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
bool Contains(int x, int y)
Definition Rectangle.cs:92