Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Click_PastePlayerTemplate()

void Terraria.GameContent.UI.States.UICharacterCreation.Click_PastePlayerTemplate ( UIMouseEvent evt,
UIElement listeningElement )
inlineprivate

Definition at line 942 of file UICharacterCreation.cs.

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);
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 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
static void PlaySound(int type, Vector2 position, int style=1)
bool GetHexColor(string hexString, out Vector3 hsl)
void Click_CharClothStyle(UIMouseEvent evt, UIElement listeningElement)

References Terraria.GameContent.UI.States.UICharacterCreation._validClothStyles, Terraria.GameContent.UI.States.UICharacterCreation.Click_CharClothStyle(), Terraria.GameContent.UI.States.UICharacterCreation.GetHexColor(), Terraria.Main.Hairstyles, Terraria.Audio.SoundEngine.PlaySound(), Terraria.GameContent.UI.States.UICharacterCreation.ScaledHslToRgb(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), and Terraria.GameContent.UI.States.UICharacterCreation.UpdateColorPickers().

Referenced by Terraria.GameContent.UI.States.UICharacterCreation.MakeClothStylesMenu().