Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UICharacterCreation.cs
Go to the documentation of this file.
3using System.Linq;
6using Newtonsoft.Json;
8using ReLogic.OS;
13using Terraria.ID;
15using Terraria.IO;
17using Terraria.UI;
19
21
23{
24 private enum CategoryId
25 {
30 Eye,
31 Skin,
32 Shirt,
34 Pants,
35 Shoes,
36 Count
37 }
38
39 private enum HSLSliderId
40 {
41 Hue,
44 }
45
46 private int[] _validClothStyles = new int[10] { 0, 2, 1, 3, 8, 4, 6, 5, 7, 9 };
47
48 private readonly Player _player;
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99
100 public const int MAX_NAME_LENGTH = 20;
101
103
105
107 {
108 _player = player;
109 _player.difficulty = 0;
110 BuildPage();
111 }
112
113 private void BuildPage()
114 {
116 int num = 4;
118 {
120 Height = StyleDimension.FromPixels(380 + num),
122 HAlign = 0.5f,
123 VAlign = 0f
124 };
125 uIElement.SetPadding(0f);
128 {
130 Height = StyleDimension.FromPixels(uIElement.Height.Pixels - 150f - (float)num),
132 BackgroundColor = new Color(33, 43, 79) * 0.8f
133 };
134 uIPanel.SetPadding(0f);
135 uIElement.Append(uIPanel);
139 {
142 };
143 uIElement2.SetPadding(0f);
144 uIElement2.PaddingTop = 4f;
145 uIElement2.PaddingBottom = 0f;
146 uIPanel.Append(uIElement2);
148 {
149 Top = StyleDimension.FromPixelsAndPercent(uIElement2.Height.Pixels + 6f, 0f),
151 Height = StyleDimension.FromPixelsAndPercent(uIPanel.Height.Pixels - 70f, 0f)
152 };
153 uIElement3.SetPadding(0f);
154 uIElement3.PaddingTop = 3f;
155 uIElement3.PaddingBottom = 0f;
156 uIPanel.Append(uIElement3);
164 Click_CharInfo(null, null);
165 }
166
167 private void MakeCharPreview(UIPanel container)
168 {
169 float num = 70f;
170 for (float num2 = 0f; num2 <= 1f; num2 += 1f)
171 {
172 UICharacter element = new UICharacter(_player, animated: true, hasBackPanel: false, 1.5f)
173 {
177 VAlign = 0f,
178 HAlign = 0.5f
179 };
180 container.Append(element);
181 }
182 }
183
185 {
186 Main.Hairstyles.UpdateUnlocks();
188 {
191 HAlign = 0.5f,
192 VAlign = 0.5f,
194 };
196 uIElement.SetPadding(0f);
197 UIList uIList = new UIList
198 {
201 };
202 uIList.SetPadding(4f);
203 uIElement.Append(uIList);
205 {
206 HAlign = 1f,
209 };
210 uIScrollbar.SetView(100f, 1000f);
211 uIList.SetScrollbar(uIScrollbar);
212 uIElement.Append(uIScrollbar);
213 int count = Main.Hairstyles.AvailableHairstyles.Count;
215 {
217 Height = StyleDimension.FromPixelsAndPercent(48 * (count / 10 + ((count % 10 != 0) ? 1 : 0)), 0f)
218 };
220 uIElement2.SetPadding(0f);
221 for (int i = 0; i < count; i++)
222 {
224 {
225 Left = StyleDimension.FromPixels((float)(i % 10) * 46f + 6f),
226 Top = StyleDimension.FromPixels((float)(i / 10) * 48f + 1f)
227 };
228 uIHairStyleButton.SetSnapPoint("Middle", i);
229 uIHairStyleButton.SkipRenderingContent(i);
231 }
233 }
234
236 {
238 {
241 HAlign = 0.5f,
242 VAlign = 0.5f
243 };
245 uIElement.SetPadding(0f);
246 int num = 15;
247 for (int i = 0; i < _validClothStyles.Length; i++)
248 {
249 int num2 = 0;
250 if (i >= _validClothStyles.Length / 2)
251 {
252 num2 = 20;
253 }
255 {
256 Left = StyleDimension.FromPixels((float)i * 46f + (float)num2 + 6f),
258 };
259 uIClothStyleButton.OnLeftMouseDown += Click_CharClothStyle;
260 uIClothStyleButton.SetSnapPoint("Middle", i);
262 }
263 for (int j = 0; j < 2; j++)
264 {
265 int num3 = 0;
266 if (j >= 1)
267 {
268 num3 = 20;
269 }
271 {
272 Left = StyleDimension.FromPixels((float)j * 230f + (float)num3 + 6f),
273 Top = StyleDimension.FromPixels(num + 86),
275 Color = Color.Lerp(Color.White, new Color(63, 65, 151, 255), 0.85f) * 0.9f
276 };
277 uIElement.Append(element);
278 UIColoredImageButton uIColoredImageButton = CreatePickerWithoutClick(CategoryId.Clothing, "Images/UI/CharCreation/" + ((j == 0) ? "ClothStyleMale" : "ClothStyleFemale"), 0f, 0f);
279 uIColoredImageButton.Top = StyleDimension.FromPixelsAndPercent(num + 92, 0f);
280 uIColoredImageButton.Left = StyleDimension.FromPixels((float)j * 230f + 92f + (float)num3 + 6f);
281 uIColoredImageButton.HAlign = 0f;
282 uIColoredImageButton.VAlign = 0f;
284 if (j == 0)
285 {
286 uIColoredImageButton.OnLeftMouseDown += Click_CharGenderMale;
288 }
289 else
290 {
291 uIColoredImageButton.OnLeftMouseDown += Click_CharGenderFemale;
293 }
294 uIColoredImageButton.SetSnapPoint("Low", j * 4);
295 }
297 {
300 HAlign = 0.5f,
301 VAlign = 1f
302 };
303 uIElement.Append(uIElement2);
304 UIColoredImageButton uIColoredImageButton2 = new UIColoredImageButton(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/Copy", (AssetRequestMode)1), isSmall: true)
305 {
306 VAlign = 0.5f,
307 HAlign = 0f,
309 };
310 uIColoredImageButton2.OnLeftMouseDown += Click_CopyPlayerTemplate;
313 UIColoredImageButton uIColoredImageButton3 = new UIColoredImageButton(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/Paste", (AssetRequestMode)1), isSmall: true)
314 {
315 VAlign = 0.5f,
316 HAlign = 0.5f
317 };
318 uIColoredImageButton3.OnLeftMouseDown += Click_PastePlayerTemplate;
321 UIColoredImageButton uIColoredImageButton4 = new UIColoredImageButton(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/Randomize", (AssetRequestMode)1), isSmall: true)
322 {
323 VAlign = 0.5f,
324 HAlign = 1f
325 };
326 uIColoredImageButton4.OnLeftMouseDown += Click_RandomizePlayer;
329 uIColoredImageButton2.SetSnapPoint("Low", 1);
330 uIColoredImageButton3.SetSnapPoint("Low", 2);
331 uIColoredImageButton4.SetSnapPoint("Low", 3);
333 }
334
336 {
337 float xPositionStart = -240f;
338 float xPositionPerId = 48f;
340 categoryContainer.Append(CreateColorPicker(CategoryId.HairColor, "Images/UI/CharCreation/ColorHair", xPositionStart, xPositionPerId));
341 categoryContainer.Append(CreateColorPicker(CategoryId.Eye, "Images/UI/CharCreation/ColorEye", xPositionStart, xPositionPerId));
342 categoryContainer.Append(CreateColorPicker(CategoryId.Skin, "Images/UI/CharCreation/ColorSkin", xPositionStart, xPositionPerId));
343 categoryContainer.Append(CreateColorPicker(CategoryId.Shirt, "Images/UI/CharCreation/ColorShirt", xPositionStart, xPositionPerId));
344 categoryContainer.Append(CreateColorPicker(CategoryId.Undershirt, "Images/UI/CharCreation/ColorUndershirt", xPositionStart, xPositionPerId));
345 categoryContainer.Append(CreateColorPicker(CategoryId.Pants, "Images/UI/CharCreation/ColorPants", xPositionStart, xPositionPerId));
346 categoryContainer.Append(CreateColorPicker(CategoryId.Shoes, "Images/UI/CharCreation/ColorShoes", xPositionStart, xPositionPerId));
347 _colorPickers[4].SetMiddleTexture(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/ColorEyeBack", (AssetRequestMode)1));
348 _clothingStylesCategoryButton = CreatePickerWithoutClick(CategoryId.Clothing, "Images/UI/CharCreation/ClothStyleMale", xPositionStart, xPositionPerId);
349 _clothingStylesCategoryButton.OnLeftMouseDown += Click_ClothStyles;
352 _hairStylesCategoryButton = CreatePickerWithoutClick(CategoryId.HairStyle, "Images/UI/CharCreation/HairStyle_Hair", xPositionStart, xPositionPerId);
353 _hairStylesCategoryButton.OnLeftMouseDown += Click_HairStyles;
354 _hairStylesCategoryButton.SetMiddleTexture(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/HairStyle_Arrow", (AssetRequestMode)1));
357 _charInfoCategoryButton = CreatePickerWithoutClick(CategoryId.CharInfo, "Images/UI/CharCreation/CharInfo", xPositionStart, xPositionPerId);
358 _charInfoCategoryButton.OnLeftMouseDown += Click_CharInfo;
363 {
366 VAlign = 1f,
367 HAlign = 0.5f,
368 Color = Color.Lerp(Color.White, new Color(63, 65, 151, 255), 0.85f) * 0.9f
369 };
370 categoryContainer.Append(element);
371 int num = 21;
373 {
374 Left = new StyleDimension(-num, 0f),
375 VAlign = 0.5f,
376 Top = new StyleDimension(-4f, 0f)
377 };
380 {
381 HAlign = 1f,
382 Left = new StyleDimension(12 + num, 0f),
383 VAlign = 0.5f,
384 Top = new StyleDimension(-4f, 0f)
385 };
389 categoryContainer.OnUpdate += UpdateHelpGlyphs;
390 }
391
392 private void UpdateHelpGlyphs(UIElement element)
393 {
394 string text = "";
395 string text2 = "";
397 {
400 }
403 }
404
406 {
409 uIColoredImageButton.VAlign = 0f;
410 uIColoredImageButton.HAlign = 0f;
411 uIColoredImageButton.Left.Set(xPositionStart + (float)id * xPositionPerId, 0.5f);
412 uIColoredImageButton.OnLeftMouseDown += Click_ColorPicker;
413 uIColoredImageButton.SetSnapPoint("Top", (int)id);
415 }
416
418 {
420 uIColoredImageButton.VAlign = 0f;
421 uIColoredImageButton.HAlign = 0f;
422 uIColoredImageButton.Left.Set(xPositionStart + (float)id * xPositionPerId, 0.5f);
424 }
425
427 {
429 {
432 HAlign = 0.5f,
433 VAlign = 0f
434 };
435 uIElement.SetPadding(10f);
436 uIElement.PaddingBottom = 0f;
437 uIElement.PaddingTop = 0f;
439 UICharacterNameButton uICharacterNameButton = new UICharacterNameButton(Language.GetText("UI.WorldCreationName"), Language.GetText("UI.PlayerEmptyName"));
440 uICharacterNameButton.Width = StyleDimension.FromPixelsAndPercent(0f, 1f);
441 uICharacterNameButton.HAlign = 0.5f;
444 uICharacterNameButton.OnLeftMouseDown += Click_Naming;
445 uICharacterNameButton.SetSnapPoint("Middle", 0);
446 float num = 4f;
447 float num2 = 0f;
448 float num3 = 0.4f;
450 {
451 HAlign = 0f,
452 VAlign = 1f,
455 };
456 uIElement2.SetPadding(0f);
457 uIElement.Append(uIElement2);
458 UISlicedImage uISlicedImage = new UISlicedImage(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1))
459 {
460 HAlign = 1f,
461 VAlign = 1f,
462 Width = StyleDimension.FromPixelsAndPercent((0f - num) * 2f, 1f - num3),
463 Left = StyleDimension.FromPixels(0f - num),
464 Height = StyleDimension.FromPixelsAndPercent(uIElement2.Height.Pixels, uIElement2.Height.Precent)
465 };
466 uISlicedImage.SetSliceDepths(10);
467 uISlicedImage.Color = Color.LightGray * 0.7f;
468 uIElement.Append(uISlicedImage);
469 float num4 = 4f;
471 {
472 HAlign = 0f,
473 VAlign = 1f / (num4 - 1f),
476 };
478 {
479 HAlign = 0f,
480 VAlign = 2f / (num4 - 1f),
483 };
485 {
486 HAlign = 0f,
487 VAlign = 1f,
490 };
492 {
493 HAlign = 0f,
494 VAlign = 0f,
497 };
498 UIText uIText = new UIText(Lang.menu[26])
499 {
500 HAlign = 0f,
501 VAlign = 0.5f,
505 IsWrapped = true
506 };
507 uIText.PaddingLeft = 20f;
508 uIText.PaddingRight = 20f;
509 uISlicedImage.Append(uIText);
516 uIDifficultyButton4.OnLeftMouseDown += UpdateDifficultyDescription;
517 uIDifficultyButton.OnLeftMouseDown += UpdateDifficultyDescription;
518 uIDifficultyButton2.OnLeftMouseDown += UpdateDifficultyDescription;
519 uIDifficultyButton3.OnLeftMouseDown += UpdateDifficultyDescription;
520 UpdateDifficultyDescription(null, null);
521 uIDifficultyButton4.SetSnapPoint("Middle", 1);
522 uIDifficultyButton.SetSnapPoint("Middle", 2);
523 uIDifficultyButton2.SetSnapPoint("Middle", 3);
524 uIDifficultyButton3.SetSnapPoint("Middle", 4);
525 }
526
528 {
529 LocalizedText text = Lang.menu[31];
530 switch (_player.difficulty)
531 {
532 case 0:
533 text = Lang.menu[31];
534 break;
535 case 1:
536 text = Lang.menu[30];
537 break;
538 case 2:
539 text = Lang.menu[29];
540 break;
541 case 3:
542 text = Language.GetText("UI.CreativeDescriptionPlayer");
543 break;
544 }
546 }
547
549 {
551 {
554 HAlign = 0.5f,
555 VAlign = 0f
556 };
557 uIElement.SetPadding(0f);
560 {
563 HAlign = 0.5f,
564 VAlign = 0f,
566 };
567 uIElement2.SetPadding(0f);
568 uIElement2.PaddingTop = 3f;
569 uIElement.Append(uIElement2);
571 uIElement2.Append(CreateHSLSlider(HSLSliderId.Saturation));
572 uIElement2.Append(CreateHSLSlider(HSLSliderId.Luminance));
574 {
575 VAlign = 1f,
576 HAlign = 1f,
579 };
580 UIText uIText = new UIText("FFFFFF")
581 {
582 VAlign = 0.5f,
583 HAlign = 0.5f
584 };
585 uIPanel.Append(uIText);
586 uIElement.Append(uIPanel);
587 UIColoredImageButton uIColoredImageButton = new UIColoredImageButton(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/Copy", (AssetRequestMode)1), isSmall: true)
588 {
589 VAlign = 1f,
590 HAlign = 0f,
592 };
593 uIColoredImageButton.OnLeftMouseDown += Click_CopyHex;
596 UIColoredImageButton uIColoredImageButton2 = new UIColoredImageButton(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/Paste", (AssetRequestMode)1), isSmall: true)
597 {
598 VAlign = 1f,
599 HAlign = 0f,
601 };
602 uIColoredImageButton2.OnLeftMouseDown += Click_PasteHex;
605 UIColoredImageButton uIColoredImageButton3 = new UIColoredImageButton(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/Randomize", (AssetRequestMode)1), isSmall: true)
606 {
607 VAlign = 1f,
608 HAlign = 0f,
610 };
611 uIColoredImageButton3.OnLeftMouseDown += Click_RandomizeSingleColor;
616 uIColoredImageButton.SetSnapPoint("Low", 0);
617 uIColoredImageButton2.SetSnapPoint("Low", 1);
618 uIColoredImageButton3.SetSnapPoint("Low", 2);
619 }
620
622 {
624 uIColoredSlider.VAlign = 0f;
625 uIColoredSlider.HAlign = 0f;
626 uIColoredSlider.Width = StyleDimension.FromPixelsAndPercent(-10f, 1f);
627 uIColoredSlider.Top.Set(30 * (int)id, 0f);
628 uIColoredSlider.OnLeftMouseDown += Click_ColorPicker;
629 uIColoredSlider.SetSnapPoint("Middle", (int)id, null, new Vector2(0f, 20f));
630 return uIColoredSlider;
631 }
632
634 {
635 return id switch
636 {
637 HSLSliderId.Saturation => new UIColoredSlider(LocalizedText.Empty, () => GetHSLSliderPosition(HSLSliderId.Saturation), delegate(float x)
638 {
639 UpdateHSLValue(HSLSliderId.Saturation, x);
640 }, UpdateHSL_S, (float x) => GetHSLSliderColorAt(HSLSliderId.Saturation, x), Color.Transparent),
641 HSLSliderId.Luminance => new UIColoredSlider(LocalizedText.Empty, () => GetHSLSliderPosition(HSLSliderId.Luminance), delegate(float x)
642 {
643 UpdateHSLValue(HSLSliderId.Luminance, x);
644 }, UpdateHSL_L, (float x) => GetHSLSliderColorAt(HSLSliderId.Luminance, x), Color.Transparent),
646 {
648 }, UpdateHSL_H, (float x) => GetHSLSliderColorAt(HSLSliderId.Hue, x), Color.Transparent),
649 };
650 }
651
652 private void UpdateHSL_H()
653 {
654 float value = UILinksInitializer.HandleSliderHorizontalInput(_currentColorHSL.X, 0f, 1f, PlayerInput.CurrentProfile.InterfaceDeadzoneX, 0.35f);
655 UpdateHSLValue(HSLSliderId.Hue, value);
656 }
657
658 private void UpdateHSL_S()
659 {
660 float value = UILinksInitializer.HandleSliderHorizontalInput(_currentColorHSL.Y, 0f, 1f, PlayerInput.CurrentProfile.InterfaceDeadzoneX, 0.35f);
661 UpdateHSLValue(HSLSliderId.Saturation, value);
662 }
663
664 private void UpdateHSL_L()
665 {
666 float value = UILinksInitializer.HandleSliderHorizontalInput(_currentColorHSL.Z, 0f, 1f, PlayerInput.CurrentProfile.InterfaceDeadzoneX, 0.35f);
667 UpdateHSLValue(HSLSliderId.Luminance, value);
668 }
669
671 {
672 return id switch
673 {
674 HSLSliderId.Hue => _currentColorHSL.X,
675 HSLSliderId.Saturation => _currentColorHSL.Y,
676 HSLSliderId.Luminance => _currentColorHSL.Z,
677 _ => 1f,
678 };
679 }
680
681 private void UpdateHSLValue(HSLSliderId id, float value)
682 {
683 switch (id)
684 {
685 case HSLSliderId.Hue:
686 _currentColorHSL.X = value;
687 break;
688 case HSLSliderId.Saturation:
689 _currentColorHSL.Y = value;
690 break;
691 case HSLSliderId.Luminance:
692 _currentColorHSL.Z = value;
693 break;
694 }
696 ApplyPendingColor(color);
697 _colorPickers[(int)_selectedPicker]?.SetColor(color);
698 if (_selectedPicker == CategoryId.HairColor)
699 {
701 }
702 UpdateHexText(color);
703 }
704
706 {
707 return id switch
708 {
709 HSLSliderId.Hue => ScaledHslToRgb(pointAt, 1f, 0.5f),
710 HSLSliderId.Saturation => ScaledHslToRgb(_currentColorHSL.X, pointAt, _currentColorHSL.Z),
711 HSLSliderId.Luminance => ScaledHslToRgb(_currentColorHSL.X, _currentColorHSL.Y, pointAt),
712 _ => Color.White,
713 };
714 }
715
717 {
718 switch (_selectedPicker)
719 {
720 case CategoryId.HairColor:
721 _player.hairColor = pendingColor;
722 break;
723 case CategoryId.Eye:
724 _player.eyeColor = pendingColor;
725 break;
726 case CategoryId.Skin:
727 _player.skinColor = pendingColor;
728 break;
729 case CategoryId.Shirt:
730 _player.shirtColor = pendingColor;
731 break;
732 case CategoryId.Undershirt:
733 _player.underShirtColor = pendingColor;
734 break;
735 case CategoryId.Pants:
736 _player.pantsColor = pendingColor;
737 break;
738 case CategoryId.Shoes:
739 _player.shoeColor = pendingColor;
740 break;
741 }
742 }
743
748
749 private static string GetHexText(Color pendingColor)
750 {
751 return "#" + pendingColor.Hex3().ToUpper();
752 }
753
755 {
757 {
760 VAlign = 1f,
761 HAlign = 0f,
763 };
764 uITextPanel.OnMouseOver += FadedMouseOver;
765 uITextPanel.OnMouseOut += FadedMouseOut;
766 uITextPanel.OnLeftMouseDown += Click_GoBack;
767 uITextPanel.SetSnapPoint("Back", 0);
770 {
773 VAlign = 1f,
774 HAlign = 1f,
776 };
777 uITextPanel2.OnMouseOver += FadedMouseOver;
778 uITextPanel2.OnMouseOut += FadedMouseOut;
779 uITextPanel2.OnLeftMouseDown += Click_NamingAndCreating;
780 uITextPanel2.SetSnapPoint("Create", 0);
782 }
783
789
791 {
793 ((UIPanel)evt.Target).BackgroundColor = new Color(73, 94, 171);
794 ((UIPanel)evt.Target).BorderColor = Colors.FancyUIFatButtonMouseOver;
795 }
796
798 {
799 ((UIPanel)evt.Target).BackgroundColor = new Color(63, 82, 151) * 0.8f;
800 ((UIPanel)evt.Target).BorderColor = Color.Black;
801 }
802
804 {
806 for (int i = 0; i < _colorPickers.Length; i++)
807 {
808 if (_colorPickers[i] == evt.Target)
809 {
811 break;
812 }
813 }
814 }
815
825
834
843
845 {
846 _clothingStylesCategoryButton.SetImageWithoutSettingSize(Main.Assets.Request<Texture2D>("Images/UI/CharCreation/" + (_player.Male ? "ClothStyleMale" : "ClothStyleFemale"), (AssetRequestMode)1));
848 }
849
857
865
871
877
879 {
881 string value = Platform.Get<IClipboard>().Value;
882 if (GetHexColor(value, out var hsl))
883 {
888 }
889 }
890
892 {
893 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
894 //IL_0123: Unknown result type (might be due to invalid IL or missing references)
895 //IL_012a: Unknown result type (might be due to invalid IL or missing references)
896 //IL_0131: Unknown result type (might be due to invalid IL or missing references)
897 //IL_013d: Expected O, but got Unknown
899 string text = JsonConvert.SerializeObject((object)new Dictionary<string, object>
900 {
901 { "version", 1 },
902 { "hairStyle", _player.hair },
903 { "clothingStyle", _player.skinVariant },
904 {
905 "hairColor",
907 },
908 {
909 "eyeColor",
911 },
912 {
913 "skinColor",
915 },
916 {
917 "shirtColor",
919 },
920 {
921 "underShirtColor",
923 },
924 {
925 "pantsColor",
927 },
928 {
929 "shoeColor",
931 }
933 {
936 Formatting = (Formatting)1
937 });
939 Platform.Get<IClipboard>().Value = text;
940 }
941
943 {
945 try
946 {
947 string value = Platform.Get<IClipboard>().Value;
948 int num = value.IndexOf("{");
949 if (num == -1)
950 {
951 return;
952 }
953 value = value.Substring(num);
954 int num2 = value.LastIndexOf("}");
955 if (num2 == -1)
956 {
957 return;
958 }
959 value = value.Substring(0, num2 + 1);
960 Dictionary<string, object> dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(value);
961 if (dictionary == null)
962 {
963 return;
964 }
966 foreach (KeyValuePair<string, object> item in dictionary)
967 {
968 dictionary2[item.Key.ToLower()] = item.Value;
969 }
970 if (dictionary2.TryGetValue("version", out var value2))
971 {
972 _ = (long)value2;
973 }
974 if (dictionary2.TryGetValue("hairstyle", out value2))
975 {
976 int num3 = (int)(long)value2;
977 if (Main.Hairstyles.AvailableHairstyles.Contains(num3))
978 {
979 _player.hair = num3;
980 }
981 }
982 if (dictionary2.TryGetValue("clothingstyle", out value2))
983 {
984 int num4 = (int)(long)value2;
985 if (_validClothStyles.Contains(num4))
986 {
987 _player.skinVariant = num4;
988 }
989 }
990 if (dictionary2.TryGetValue("haircolor", out value2) && GetHexColor((string)value2, out var hsl))
991 {
992 _player.hairColor = ScaledHslToRgb(hsl);
993 }
994 if (dictionary2.TryGetValue("eyecolor", out value2) && GetHexColor((string)value2, out hsl))
995 {
996 _player.eyeColor = ScaledHslToRgb(hsl);
997 }
998 if (dictionary2.TryGetValue("skincolor", out value2) && GetHexColor((string)value2, out hsl))
999 {
1000 _player.skinColor = ScaledHslToRgb(hsl);
1001 }
1002 if (dictionary2.TryGetValue("shirtcolor", out value2) && GetHexColor((string)value2, out hsl))
1003 {
1004 _player.shirtColor = ScaledHslToRgb(hsl);
1005 }
1006 if (dictionary2.TryGetValue("undershirtcolor", out value2) && GetHexColor((string)value2, out hsl))
1007 {
1008 _player.underShirtColor = ScaledHslToRgb(hsl);
1009 }
1010 if (dictionary2.TryGetValue("pantscolor", out value2) && GetHexColor((string)value2, out hsl))
1011 {
1012 _player.pantsColor = ScaledHslToRgb(hsl);
1013 }
1014 if (dictionary2.TryGetValue("shoecolor", out value2) && GetHexColor((string)value2, out hsl))
1015 {
1016 _player.shoeColor = ScaledHslToRgb(hsl);
1017 }
1018 Click_CharClothStyle(null, null);
1020 }
1021 catch
1022 {
1023 }
1024 }
1025
1027 {
1029 Player player = _player;
1030 int index = Main.rand.Next(Main.Hairstyles.AvailableHairstyles.Count);
1031 player.hair = Main.Hairstyles.AvailableHairstyles[index];
1032 player.eyeColor = ScaledHslToRgb(GetRandomColorVector());
1033 while (player.eyeColor.R + player.eyeColor.G + player.eyeColor.B > 300)
1034 {
1035 player.eyeColor = ScaledHslToRgb(GetRandomColorVector());
1036 }
1037 float num = (float)Main.rand.Next(60, 120) * 0.01f;
1038 if (num > 1f)
1039 {
1040 num = 1f;
1041 }
1042 player.skinColor.R = (byte)((float)Main.rand.Next(240, 255) * num);
1043 player.skinColor.G = (byte)((float)Main.rand.Next(110, 140) * num);
1044 player.skinColor.B = (byte)((float)Main.rand.Next(75, 110) * num);
1045 player.hairColor = ScaledHslToRgb(GetRandomColorVector());
1046 player.shirtColor = ScaledHslToRgb(GetRandomColorVector());
1047 player.underShirtColor = ScaledHslToRgb(GetRandomColorVector());
1048 player.pantsColor = ScaledHslToRgb(GetRandomColorVector());
1049 player.shoeColor = ScaledHslToRgb(GetRandomColorVector());
1050 player.skinVariant = _validClothStyles[Main.rand.Next(_validClothStyles.Length)];
1051 switch (player.hair + 1)
1052 {
1053 case 5:
1054 case 6:
1055 case 7:
1056 case 10:
1057 case 12:
1058 case 19:
1059 case 22:
1060 case 23:
1061 case 26:
1062 case 27:
1063 case 30:
1064 case 33:
1065 case 34:
1066 case 35:
1067 case 37:
1068 case 38:
1069 case 39:
1070 case 40:
1071 case 41:
1072 case 44:
1073 case 45:
1074 case 46:
1075 case 47:
1076 case 48:
1077 case 49:
1078 case 51:
1079 case 56:
1080 case 65:
1081 case 66:
1082 case 67:
1083 case 68:
1084 case 69:
1085 case 70:
1086 case 71:
1087 case 72:
1088 case 73:
1089 case 74:
1090 case 79:
1091 case 80:
1092 case 81:
1093 case 82:
1094 case 84:
1095 case 85:
1096 case 86:
1097 case 87:
1098 case 88:
1099 case 90:
1100 case 91:
1101 case 92:
1102 case 93:
1103 case 95:
1104 case 96:
1105 case 98:
1106 case 100:
1107 case 102:
1108 case 104:
1109 case 107:
1110 case 108:
1111 case 113:
1112 case 124:
1113 case 126:
1114 case 133:
1115 case 134:
1116 case 135:
1117 case 144:
1118 case 146:
1119 case 147:
1120 case 163:
1121 case 165:
1122 player.Male = false;
1123 break;
1124 default:
1125 player.Male = true;
1126 break;
1127 }
1128 Click_CharClothStyle(null, null);
1131 }
1132
1134 {
1136 _player.name = "";
1137 Main.clrInput();
1139 uIVirtualKeyboard.SetMaxInputLength(20);
1140 Main.MenuUI.SetState(uIVirtualKeyboard);
1141 }
1142
1144 {
1146 if (string.IsNullOrEmpty(_player.name))
1147 {
1148 _player.name = "";
1149 Main.clrInput();
1151 uIVirtualKeyboard.SetMaxInputLength(20);
1152 Main.MenuUI.SetState(uIVirtualKeyboard);
1153 }
1154 else
1155 {
1157 }
1158 }
1159
1160 private void OnFinishedNaming(string name)
1161 {
1162 _player.name = name.Trim();
1163 Main.MenuUI.SetState(this);
1165 }
1166
1167 private void OnCanceledNaming()
1168 {
1169 Main.MenuUI.SetState(this);
1170 }
1171
1172 private void OnFinishedNamingAndCreating(string name)
1173 {
1174 _player.name = name.Trim();
1175 Main.MenuUI.SetState(this);
1178 }
1179
1181 {
1184 Main.LoadPlayers();
1185 Main.menuMode = 1;
1186 }
1187
1189 {
1190 int num = 0;
1191 byte difficulty = _player.difficulty;
1192 if (difficulty == 3)
1193 {
1194 _player.statLife = (_player.statLifeMax = 100);
1195 _player.statMana = (_player.statManaMax = 20);
1197 _player.inventory[num++].Prefix(-1);
1199 _player.inventory[num++].Prefix(-1);
1200 _player.inventory[num].SetDefaults(10);
1201 _player.inventory[num++].Prefix(-1);
1203 _player.inventory[num++].Prefix(-1);
1204 _player.inventory[num].SetDefaults(4281);
1205 _player.inventory[num++].Prefix(-1);
1207 _player.inventory[num++].stack = 100;
1208 _player.inventory[num].SetDefaults(965);
1209 _player.inventory[num++].stack = 100;
1210 _player.inventory[num++].SetDefaults(50);
1211 _player.inventory[num++].SetDefaults(84);
1212 _player.armor[3].SetDefaults(4978);
1213 _player.armor[3].Prefix(-1);
1214 if (_player.name == "Wolf Pet" || _player.name == "Wolfpet")
1215 {
1217 }
1218 _player.AddBuff(216, 3600);
1219 }
1220 else
1221 {
1222 _player.inventory[num].SetDefaults(3507);
1223 _player.inventory[num++].Prefix(-1);
1224 _player.inventory[num].SetDefaults(3509);
1225 _player.inventory[num++].Prefix(-1);
1226 _player.inventory[num].SetDefaults(3506);
1227 _player.inventory[num++].Prefix(-1);
1228 }
1230 {
1231 _player.inventory[num++].SetDefaults(603);
1232 }
1233 _player.savedPerPlayerFieldsThatArentInThePlayerClass = new Player.SavedPlayerDataWithAnnoyingRules();
1234 CreativePowerManager.Instance.ResetDataForNewPlayer(_player);
1235 }
1236
1237 private bool GetHexColor(string hexString, out Vector3 hsl)
1238 {
1239 if (hexString.StartsWith("#"))
1240 {
1241 hexString = hexString.Substring(1);
1242 }
1243 if (hexString.Length <= 6 && uint.TryParse(hexString, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out var result))
1244 {
1245 uint b = result & 0xFFu;
1246 uint g = (result >> 8) & 0xFFu;
1247 uint r = (result >> 16) & 0xFFu;
1248 hsl = RgbToScaledHsl(new Color((int)r, (int)g, (int)b));
1249 return true;
1250 }
1251 hsl = Vector3.Zero;
1252 return false;
1253 }
1254
1264
1266 {
1267 return new Vector3(Main.rand.NextFloat(), Main.rand.NextFloat(), Main.rand.NextFloat());
1268 }
1269
1271 {
1273 for (int i = 0; i < colorPickers.Length; i++)
1274 {
1275 colorPickers[i]?.SetSelected(selected: false);
1276 }
1284 }
1285
1287 {
1289 switch (selection)
1290 {
1291 case CategoryId.CharInfo:
1292 Click_CharInfo(null, null);
1293 return;
1294 case CategoryId.Clothing:
1295 Click_ClothStyles(null, null);
1296 return;
1297 case CategoryId.HairStyle:
1298 Click_HairStyles(null, null);
1299 return;
1300 }
1303 for (int i = 0; i < _colorPickers.Length; i++)
1304 {
1305 if (_colorPickers[i] != null)
1306 {
1307 _colorPickers[i].SetSelected(i == (int)selection);
1308 }
1309 }
1311 switch (_selectedPicker)
1312 {
1313 case CategoryId.HairColor:
1315 break;
1316 case CategoryId.Eye:
1318 break;
1319 case CategoryId.Skin:
1321 break;
1322 case CategoryId.Shirt:
1324 break;
1325 case CategoryId.Undershirt:
1327 break;
1328 case CategoryId.Pants:
1330 break;
1331 case CategoryId.Shoes:
1333 break;
1334 }
1337 }
1338
1351
1352 public override void Draw(SpriteBatch spriteBatch)
1353 {
1354 base.Draw(spriteBatch);
1355 string text = null;
1357 {
1358 text = Language.GetTextValue("UI.CopyColorToClipboard");
1359 }
1361 {
1362 text = Language.GetTextValue("UI.PasteColorFromClipboard");
1363 }
1365 {
1366 text = Language.GetTextValue("UI.RandomizeColor");
1367 }
1369 {
1370 text = Language.GetTextValue("UI.CopyPlayerToClipboard");
1371 }
1373 {
1374 text = Language.GetTextValue("UI.PastePlayerFromClipboard");
1375 }
1377 {
1378 text = Language.GetTextValue("UI.RandomizePlayer");
1379 }
1380 if (text != null)
1381 {
1382 float x = FontAssets.MouseText.Value.MeasureString(text).X;
1383 Vector2 vector = new Vector2(Main.mouseX, Main.mouseY) + new Vector2(16f);
1384 if (vector.Y > (float)(Main.screenHeight - 30))
1385 {
1386 vector.Y = Main.screenHeight - 30;
1387 }
1388 if (vector.X > (float)Main.screenWidth - x)
1389 {
1390 vector.X = Main.screenWidth - 460;
1391 }
1393 }
1394 SetupGamepadPoints(spriteBatch);
1395 }
1396
1397 private void SetupGamepadPoints(SpriteBatch spriteBatch)
1398 {
1399 UILinkPointNavigator.Shortcuts.BackButtonCommand = 1;
1400 int num = 3000;
1401 int num2 = num + 20;
1402 int num3 = num;
1404 SnapPoint snapPoint = snapPoints.First((SnapPoint a) => a.Name == "Back");
1405 SnapPoint snapPoint2 = snapPoints.First((SnapPoint a) => a.Name == "Create");
1407 uILinkPoint.Unlink();
1409 num3++;
1411 uILinkPoint2.Unlink();
1413 num3++;
1414 uILinkPoint.Right = uILinkPoint2.ID;
1415 uILinkPoint2.Left = uILinkPoint.ID;
1419 List<SnapPoint> list = snapPoints.Where((SnapPoint a) => a.Name == "Top").ToList();
1420 list.Sort(SortPoints);
1421 for (int i = 0; i < list.Count; i++)
1422 {
1424 uILinkPoint3.Unlink();
1426 uILinkPoint3.Left = num3 - 1;
1427 uILinkPoint3.Right = num3 + 1;
1428 uILinkPoint3.Down = num2;
1429 if (i == 0)
1430 {
1431 uILinkPoint3.Left = -3;
1432 }
1433 if (i == list.Count - 1)
1434 {
1435 uILinkPoint3.Right = -4;
1436 }
1437 if (_selectedPicker == CategoryId.HairStyle || _selectedPicker == CategoryId.Clothing)
1438 {
1439 uILinkPoint3.Down = num2 + i;
1440 }
1442 num3++;
1443 }
1444 List<SnapPoint> list2 = snapPoints.Where((SnapPoint a) => a.Name == "Middle").ToList();
1445 list2.Sort(SortPoints);
1446 num3 = num2;
1447 switch (_selectedPicker)
1448 {
1449 case CategoryId.CharInfo:
1450 {
1451 for (int l = 0; l < list2.Count; l++)
1452 {
1454 andSet3.Up = andSet3.ID - 1;
1455 andSet3.Down = andSet3.ID + 1;
1456 if (l == 0)
1457 {
1458 andSet3.Up = num + 2;
1459 }
1460 if (l == list2.Count - 1)
1461 {
1462 andSet3.Down = uILinkPoint.ID;
1463 uILinkPoint.Up = andSet3.ID;
1464 uILinkPoint2.Up = andSet3.ID;
1465 }
1467 num3++;
1468 }
1469 break;
1470 }
1471 case CategoryId.HairStyle:
1472 {
1473 if (list2.Count == 0)
1474 {
1475 break;
1476 }
1478 SnapPoint snapPoint3 = list2[list2.Count - 1];
1479 _ = snapPoint3.Id / 10;
1480 _ = snapPoint3.Id % 10;
1481 int count = Main.Hairstyles.AvailableHairstyles.Count;
1482 for (int m = 0; m < list2.Count; m++)
1483 {
1486 andSet4.Left = andSet4.ID - 1;
1487 if (snapPoint4.Id == 0)
1488 {
1489 andSet4.Left = -3;
1490 }
1491 andSet4.Right = andSet4.ID + 1;
1492 if (snapPoint4.Id == count - 1)
1493 {
1494 andSet4.Right = -4;
1495 }
1496 andSet4.Up = andSet4.ID - 10;
1497 if (m < 10)
1498 {
1499 andSet4.Up = num + 2 + m;
1500 }
1501 andSet4.Down = andSet4.ID + 10;
1502 if (snapPoint4.Id + 10 > snapPoint3.Id)
1503 {
1504 if (snapPoint4.Id % 10 < 5)
1505 {
1506 andSet4.Down = uILinkPoint.ID;
1507 }
1508 else
1509 {
1510 andSet4.Down = uILinkPoint2.ID;
1511 }
1512 }
1513 if (m == list2.Count - 1)
1514 {
1515 uILinkPoint.Up = andSet4.ID;
1516 uILinkPoint2.Up = andSet4.ID;
1517 }
1519 num3++;
1520 }
1521 break;
1522 }
1523 default:
1524 {
1525 List<SnapPoint> list4 = snapPoints.Where((SnapPoint a) => a.Name == "Low").ToList();
1526 list4.Sort(SortPoints);
1527 num3 = num2 + 20;
1528 for (int n = 0; n < list4.Count; n++)
1529 {
1531 andSet5.Up = num2 + 2;
1532 andSet5.Down = uILinkPoint.ID;
1533 andSet5.Left = andSet5.ID - 1;
1534 andSet5.Right = andSet5.ID + 1;
1535 if (n == 0)
1536 {
1537 andSet5.Left = andSet5.ID + 2;
1538 uILinkPoint.Up = andSet5.ID;
1539 }
1540 if (n == list4.Count - 1)
1541 {
1542 andSet5.Right = andSet5.ID - 2;
1543 uILinkPoint2.Up = andSet5.ID;
1544 }
1546 num3++;
1547 }
1548 num3 = num2;
1549 for (int num4 = 0; num4 < list2.Count; num4++)
1550 {
1552 andSet6.Up = andSet6.ID - 1;
1553 andSet6.Down = andSet6.ID + 1;
1554 if (num4 == 0)
1555 {
1556 andSet6.Up = num + 2 + 5;
1557 }
1558 if (num4 == list2.Count - 1)
1559 {
1560 andSet6.Down = num2 + 20 + 2;
1561 }
1563 num3++;
1564 }
1565 break;
1566 }
1567 case CategoryId.Clothing:
1568 {
1569 List<SnapPoint> list3 = snapPoints.Where((SnapPoint a) => a.Name == "Low").ToList();
1570 list3.Sort(SortPoints);
1571 int down = -2;
1572 int down2 = -2;
1573 num3 = num2 + 20;
1574 for (int j = 0; j < list3.Count; j++)
1575 {
1577 andSet.Up = num2 + j + 2;
1578 andSet.Down = uILinkPoint.ID;
1579 if (j >= 3)
1580 {
1581 andSet.Up++;
1582 andSet.Down = uILinkPoint2.ID;
1583 }
1584 andSet.Left = andSet.ID - 1;
1585 andSet.Right = andSet.ID + 1;
1586 if (j == 0)
1587 {
1588 down = andSet.ID;
1589 andSet.Left = andSet.ID + 4;
1590 uILinkPoint.Up = andSet.ID;
1591 }
1592 if (j == list3.Count - 1)
1593 {
1594 down2 = andSet.ID;
1595 andSet.Right = andSet.ID - 4;
1596 uILinkPoint2.Up = andSet.ID;
1597 }
1599 num3++;
1600 }
1601 num3 = num2;
1602 for (int k = 0; k < list2.Count; k++)
1603 {
1605 andSet2.Up = num + 2 + k;
1606 andSet2.Left = andSet2.ID - 1;
1607 andSet2.Right = andSet2.ID + 1;
1608 if (k == 0)
1609 {
1610 andSet2.Left = andSet2.ID + 9;
1611 }
1612 if (k == list2.Count - 1)
1613 {
1614 andSet2.Right = andSet2.ID - 9;
1615 }
1616 andSet2.Down = down;
1617 if (k >= 5)
1618 {
1619 andSet2.Down = down2;
1620 }
1622 num3++;
1623 }
1624 break;
1625 }
1626 }
1628 {
1630 }
1631 }
1632
1634 {
1637 UILinkPoint uILinkPoint = null;
1638 foreach (int foundPoint in _foundPoints)
1639 {
1640 if (!points.TryGetValue(foundPoint, out var value))
1641 {
1642 return;
1643 }
1644 if (uILinkPoint == null || Vector2.Distance(mouseScreen, uILinkPoint.Position) > Vector2.Distance(mouseScreen, value.Position))
1645 {
1646 uILinkPoint = value;
1647 }
1648 }
1649 if (uILinkPoint != null)
1650 {
1652 }
1653 }
1654
1655 public void TryMovingCategory(int direction)
1656 {
1657 int num = (int)(_selectedPicker + direction) % 10;
1658 if (num < 0)
1659 {
1660 num += 10;
1661 }
1663 }
1664
1672
1673 private bool PointWithName(SnapPoint a, string comp)
1674 {
1675 return a.Name == comp;
1676 }
1677
1679 {
1680 return a.Id.CompareTo(b.Id);
1681 }
1682
1684 {
1685 return ScaledHslToRgb(hsl.X, hsl.Y, hsl.Z);
1686 }
1687
1688 private static Color ScaledHslToRgb(float hue, float saturation, float luminosity)
1689 {
1690 return Main.hslToRgb(hue, saturation, luminosity * 0.85f + 0.15f);
1691 }
1692
1693 private static Vector3 RgbToScaledHsl(Color color)
1694 {
1695 Vector3 value = Main.rgbToHsl(color);
1696 value.Z = (value.Z - 0.15f) / 0.85f;
1697 return Vector3.Clamp(value, Vector3.Zero, Vector3.One);
1698 }
1699}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static CultureInfo CurrentCulture
static void PlaySound(int type, Vector2 position, int style=1)
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
void Click_PasteHex(UIMouseEvent evt, UIElement listeningElement)
void Click_Naming(UIMouseEvent evt, UIElement listeningElement)
void Click_RandomizePlayer(UIMouseEvent evt, UIElement listeningElement)
bool GetHexColor(string hexString, out Vector3 hsl)
UILinkPoint GetAndSet(int ptid, SnapPoint snap)
void Click_PastePlayerTemplate(UIMouseEvent evt, UIElement listeningElement)
void Click_NamingAndCreating(UIMouseEvent evt, UIElement listeningElement)
static Color ScaledHslToRgb(float hue, float saturation, float luminosity)
Color GetHSLSliderColorAt(HSLSliderId id, float pointAt)
void Click_CharGenderMale(UIMouseEvent evt, UIElement listeningElement)
void Click_GoBack(UIMouseEvent evt, UIElement listeningElement)
UIColoredSlider CreateHSLSliderButtonBase(HSLSliderId id)
void Click_CharGenderFemale(UIMouseEvent evt, UIElement listeningElement)
void UpdateDifficultyDescription(UIMouseEvent evt, UIElement listeningElement)
void FadedMouseOver(UIMouseEvent evt, UIElement listeningElement)
void Click_HairStyles(UIMouseEvent evt, UIElement listeningElement)
void Click_CharInfo(UIMouseEvent evt, UIElement listeningElement)
void Click_CharClothStyle(UIMouseEvent evt, UIElement listeningElement)
UIColoredImageButton CreateColorPicker(CategoryId id, string texturePath, float xPositionStart, float xPositionPerId)
void Click_CopyHex(UIMouseEvent evt, UIElement listeningElement)
void Click_ColorPicker(UIMouseEvent evt, UIElement listeningElement)
UIColoredImageButton CreatePickerWithoutClick(CategoryId id, string texturePath, float xPositionStart, float xPositionPerId)
void Click_ClothStyles(UIMouseEvent evt, UIElement listeningElement)
void Click_RandomizeSingleColor(UIMouseEvent evt, UIElement listeningElement)
void Click_CopyPlayerTemplate(UIMouseEvent evt, UIElement listeningElement)
void FadedMouseOut(UIMouseEvent evt, UIElement listeningElement)
static string GenerateInputTag_ForCurrentGamemode(bool tagForGameplay, string triggerName)
static void PrettyPrintProfiles(ref string text)
static PlayerInputProfile CurrentProfile
static readonly Color FancyUIFatButtonMouseOver
Definition Colors.cs:91
static PlayerFileData CreateAndSave(Player player)
static float HandleSliderHorizontalInput(float currentValue, float min, float max, float deadZone=0.2f, float sensitivity=0.5f)
int stack
Definition Item.cs:149
bool Prefix(int prefixWeWant)
Definition Item.cs:487
void SetDefaults(int Type=0)
Definition Item.cs:47332
static LocalizedText[] menu
Definition Lang.cs:19
static LocalizedText GetText(string key)
Definition Language.cs:10
static string GetTextValue(string key)
Definition Language.cs:15
static readonly LocalizedText Empty
static Microsoft.Xna.Framework.Color hcColor
Definition Main.cs:994
static UserInterface MenuUI
Definition Main.cs:381
static void LoadPlayers()
Definition Main.cs:3718
static Microsoft.Xna.Framework.Color creativeModeColor
Definition Main.cs:996
static Microsoft.Xna.Framework.Color mcColor
Definition Main.cs:992
static int screenHeight
Definition Main.cs:1721
static Vector2 MouseScreen
Definition Main.cs:2773
static byte mouseTextColor
Definition Main.cs:1751
static void OpenCharacterSelectUI()
Definition Main.cs:49236
static void clrInput()
Definition Main.cs:18584
static UnifiedRandom rand
Definition Main.cs:1387
static Vector3 rgbToHsl(Microsoft.Xna.Framework.Color newColor)
Definition Main.cs:44972
static int screenWidth
Definition Main.cs:1719
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static int mouseY
Definition Main.cs:606
static IAssetRepository Assets
Definition Main.cs:209
static HairstyleUnlocksHelper Hairstyles
Definition Main.cs:1669
static bool runningCollectorsEdition
Definition Main.cs:578
static int mouseX
Definition Main.cs:604
string name
Definition Player.cs:621
Color hairColor
Definition Player.cs:2133
Color underShirtColor
Definition Player.cs:2141
Color shirtColor
Definition Player.cs:2139
Item[] miscEquips
Definition Player.cs:1171
Color skinColor
Definition Player.cs:2135
Color pantsColor
Definition Player.cs:2143
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441
Color shoeColor
Definition Player.cs:2145
Item[] inventory
Definition Player.cs:1257
static Dictionary< int, UILinkPoint > Points
static void SetPosition(int ID, Vector2 Position)
StyleDimension Height
Definition UIElement.cs:29
void Append(UIElement element)
Definition UIElement.cs:166
StyleDimension Left
Definition UIElement.cs:25
void SetSnapPoint(string name, int id, Vector2? anchor=null, Vector2? offset=null)
Definition UIElement.cs:122
StyleDimension Width
Definition UIElement.cs:27
virtual List< SnapPoint > GetSnapPoints()
Definition UIElement.cs:267
StyleDimension Top
Definition UIElement.cs:23
static void DrawBorderStringFourWay(SpriteBatch sb, DynamicSpriteFont font, string text, float x, float y, Color textColor, Color borderColor, Vector2 origin, float scale=1f)
Definition Utils.cs:1857
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector3 Clamp(Vector3 value1, Vector3 min, Vector3 max)
Definition Vector3.cs:273
void CullPointsOutOfElementArea(SpriteBatch spriteBatch, List< SnapPoint > pointsAtMiddle, UIElement container)
static StyleDimension FromPixels(float pixels)
static StyleDimension FromPercent(float percent)
static StyleDimension FromPixelsAndPercent(float pixels, float percent)