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

◆ DrawClothesWindow()

void Terraria.Main.DrawClothesWindow ( )
inlineprotected

Definition at line 41191 of file Main.cs.

41192 {
41193 if (npcChatText != "" || playerInventory || player[myPlayer].chest != -1 || npcShop != 0 || player[myPlayer].talkNPC != -1 || InGuideCraftMenu)
41194 {
41196 return;
41197 }
41199 {
41201 return;
41202 }
41203 int num = 477;
41204 int num2 = num / 2;
41205 num2 = 180;
41206 num = 511;
41207 num -= num / 2 - num2 - 26;
41208 int num3 = screenHeight / 2 + 60;
41209 int num4 = screenWidth / 2 - num / 2;
41210 int num5 = num3 + 32;
41211 int num6 = num4 + 22;
41212 num5 -= 16;
41213 int num7 = num4 + num - num2;
41214 int num8 = num3 + 18;
41215 if (selClothes == 0)
41216 {
41217 selColor = player[myPlayer].shirtColor;
41218 }
41219 if (selClothes == 1)
41220 {
41221 selColor = player[myPlayer].underShirtColor;
41222 }
41223 if (selClothes == 2)
41224 {
41225 selColor = player[myPlayer].pantsColor;
41226 }
41227 if (selClothes == 3)
41228 {
41229 selColor = player[myPlayer].shoeColor;
41230 }
41231 if (selClothes == 4)
41232 {
41233 selColor = player[myPlayer].eyeColor;
41234 }
41235 if (selClothes == 5)
41236 {
41237 selColor = player[myPlayer].skinColor;
41238 }
41239 Utils.DrawInvBG(spriteBatch, new Microsoft.Xna.Framework.Rectangle(num4, num3, num, 133));
41241 {
41242 player[myPlayer].mouseInterface = true;
41243 }
41244 Vector2 vector = new Vector2(num4 + num / 2 - 16 - 28, num3 + 66 + dresserInterfaceDummy.height / 2 - 20);
41245 vector.Y += 18f;
41246 vector.X += 58f;
41248 bool flag = r.Contains(MouseScreen.ToPoint());
41249 int num9 = selClothes;
41250 int num10 = (mouseTextColor * 2 + 255) / 3;
41251 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(num10, (int)((double)num10 / 1.1), num10 / 2, num10);
41252 float num11 = 0.9f;
41253 string textValue = Language.GetTextValue("GameUI.Change");
41254 int num12 = num4 + num - num2 + 22;
41255 num12 = num4 + 22;
41256 int num13 = num3 + 94;
41257 bool flag2 = false;
41258 if (oldClothesColor[0] != player[myPlayer].shirtColor || oldClothesColor[1] != player[myPlayer].underShirtColor || oldClothesColor[2] != player[myPlayer].pantsColor || oldClothesColor[3] != player[myPlayer].shoeColor || oldClothesColor[4] != player[myPlayer].eyeColor || oldClothesColor[5] != player[myPlayer].skinColor || oldClothesStyle != player[myPlayer].skinVariant)
41259 {
41260 flag2 = true;
41261 }
41262 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(textValue);
41263 bool flag3 = false;
41265 if (flag2 && mouseX > num12 && (float)mouseX < (float)num12 + vector2.X && mouseY > num13 && (float)mouseY < (float)num13 + vector2.Y)
41266 {
41267 flag3 = true;
41268 num11 = 1.1f;
41269 if (!npcChatFocus1)
41270 {
41272 }
41273 npcChatFocus1 = true;
41274 player[myPlayer].releaseUseItem = false;
41275 }
41276 else
41277 {
41278 if (npcChatFocus1)
41279 {
41281 }
41282 npcChatFocus1 = false;
41283 }
41284 for (int i = 0; i < 5; i++)
41285 {
41286 int num14 = num12;
41287 int num15 = num13;
41289 if (flag3)
41290 {
41292 }
41293 if (i == 0)
41294 {
41295 num14 -= 2;
41296 }
41297 if (i == 1)
41298 {
41299 num14 += 2;
41300 }
41301 if (i == 2)
41302 {
41303 num15 -= 2;
41304 }
41305 if (i == 3)
41306 {
41307 num15 += 2;
41308 }
41309 if (i == 4)
41310 {
41311 color2 = (flag2 ? color : new Microsoft.Xna.Framework.Color(100, 100, 100));
41312 }
41313 Vector2 vector3 = FontAssets.MouseText.Value.MeasureString(textValue);
41314 vector3 *= 0.5f;
41316 }
41317 num11 = 0.9f;
41318 string textValue2 = Language.GetTextValue("GameUI.Cancel");
41319 num12 += 130;
41320 bool flag4 = false;
41321 vector2 = FontAssets.MouseText.Value.MeasureString(textValue2);
41323 if (mouseX > num12 && (float)mouseX < (float)num12 + vector2.X && mouseY > num13 && (float)mouseY < (float)num13 + vector2.Y)
41324 {
41325 flag4 = true;
41326 num11 = 1.1f;
41327 if (!npcChatFocus2)
41328 {
41330 }
41331 npcChatFocus2 = true;
41332 player[myPlayer].releaseUseItem = false;
41333 }
41334 else
41335 {
41336 if (npcChatFocus2)
41337 {
41339 }
41340 npcChatFocus2 = false;
41341 }
41342 for (int j = 0; j < 5; j++)
41343 {
41344 int num16 = num12;
41345 int num17 = num13;
41347 if (flag4)
41348 {
41350 }
41351 if (j == 0)
41352 {
41353 num16 -= 2;
41354 }
41355 if (j == 1)
41356 {
41357 num16 += 2;
41358 }
41359 if (j == 2)
41360 {
41361 num17 -= 2;
41362 }
41363 if (j == 3)
41364 {
41365 num17 += 2;
41366 }
41367 if (j == 4)
41368 {
41369 color3 = color;
41370 }
41371 Vector2 vector4 = FontAssets.MouseText.Value.MeasureString(textValue2);
41372 vector4 *= 0.5f;
41374 }
41376 {
41377 if (npcChatFocus1)
41378 {
41380 return;
41381 }
41382 if (npcChatFocus2)
41383 {
41385 return;
41386 }
41387 }
41388 if (!mouseLeft)
41389 {
41390 grabColorSlider = 0;
41391 blockMouse = false;
41392 }
41393 int num18 = 167;
41395 float num19 = vector5.X;
41396 float num20 = vector5.Y;
41397 float z = vector5.Z;
41398 if (hBar == -1f || sBar == -1f || lBar == -1f)
41399 {
41400 hBar = num19;
41401 sBar = num20;
41402 lBar = z;
41403 }
41404 else
41405 {
41406 num19 = hBar;
41407 num20 = sBar;
41408 z = lBar;
41409 }
41411 if ((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 1)
41412 {
41414 }
41415 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num6 + (float)(TextureAssets.Hue.Width() - 2) * hBar - (float)(TextureAssets.ColorSlider.Width() / 2), num5 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41416 if (((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 1) && mouseLeft && !blockMouse)
41417 {
41418 grabColorSlider = 1;
41419 num19 = mouseX - num6;
41420 num19 /= (float)TextureAssets.Hue.Width();
41421 if (num19 < 0f)
41422 {
41423 num19 = 0f;
41424 }
41425 if (num19 > 1f)
41426 {
41427 num19 = 1f;
41428 }
41429 hBar = num19;
41430 }
41431 UILinkPointNavigator.SetPosition(2800, new Vector2(num6, num5) + TextureAssets.Hue.Value.Size() / 2f);
41432 num5 += 26;
41434 for (int k = 0; k <= num18; k++)
41435 {
41436 float saturation = (float)k / (float)num18;
41438 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num6 + k + 5, num5 + 4), color4);
41439 }
41440 if ((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 2)
41441 {
41443 }
41444 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num6 + (float)(TextureAssets.Hue.Width() - 2) * sBar - (float)(TextureAssets.ColorSlider.Width() / 2), num5 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41445 if (((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 2) && mouseLeft && !blockMouse)
41446 {
41447 grabColorSlider = 2;
41448 num20 = mouseX - num6;
41449 num20 /= (float)TextureAssets.Hue.Width();
41450 if (num20 < 0f)
41451 {
41452 num20 = 0f;
41453 }
41454 if (num20 > 1f)
41455 {
41456 num20 = 1f;
41457 }
41458 sBar = num20;
41459 }
41460 UILinkPointNavigator.SetPosition(2801, new Vector2(num6, num5) + TextureAssets.Hue.Value.Size() / 2f);
41461 num5 += 26;
41463 float num21 = 0.15f;
41464 for (int l = 0; l <= num18; l++)
41465 {
41466 float luminosity = (float)l / (float)num18;
41468 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num6 + l + 5, num5 + 4), color5);
41469 }
41470 if ((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 3)
41471 {
41473 }
41474 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num6 + (float)(TextureAssets.Hue.Width() - 2) * ((lBar - num21) / (1f - num21)) - (float)(TextureAssets.ColorSlider.Width() / 2), num5 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41475 if (((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 3) && mouseLeft && !blockMouse)
41476 {
41477 grabColorSlider = 3;
41478 z = mouseX - num6;
41479 z /= (float)TextureAssets.Hue.Width();
41480 if (z < 0f)
41481 {
41482 z = 0f;
41483 }
41484 if (z > 1f)
41485 {
41486 z = 1f;
41487 }
41488 z = z * (1f - num21) + num21;
41489 lBar = z;
41490 }
41491 UILinkPointNavigator.SetPosition(2802, new Vector2(num6, num5) + TextureAssets.Hue.Value.Size() / 2f);
41493 if (selClothes == 0)
41494 {
41495 player[myPlayer].shirtColor = selColor;
41496 }
41497 if (selClothes == 1)
41498 {
41499 player[myPlayer].underShirtColor = selColor;
41500 }
41501 if (selClothes == 2)
41502 {
41503 player[myPlayer].pantsColor = selColor;
41504 }
41505 if (selClothes == 3)
41506 {
41507 player[myPlayer].shoeColor = selColor;
41508 }
41509 if (selClothes == 4)
41510 {
41511 player[myPlayer].eyeColor = selColor;
41512 }
41513 if (selClothes == 5)
41514 {
41515 player[myPlayer].skinColor = selColor;
41516 }
41517 int num22 = num7;
41518 int num23 = num8;
41519 num23 -= 8;
41520 for (int m = 0; m < 6; m++)
41521 {
41522 if (num9 == m)
41523 {
41524 spriteBatch.Draw(TextureAssets.InventoryBack14.Value, new Vector2(num22, num23), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41525 }
41526 else
41527 {
41528 spriteBatch.Draw(TextureAssets.InventoryBack8.Value, new Vector2(num22, num23), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41529 }
41531 {
41532 mouseLeftRelease = false;
41533 selClothes = m;
41535 hBar = -1f;
41536 lBar = -1f;
41537 sBar = -1f;
41538 }
41539 float x = num22 + TextureAssets.InventoryBack.Width() / 2 - TextureAssets.Clothes[m].Width() / 2;
41540 float y = num23 + TextureAssets.InventoryBack.Height() / 2 - TextureAssets.Clothes[m].Height() / 2;
41542 if (m == 0)
41543 {
41544 color6 = player[myPlayer].shirtColor;
41545 }
41546 if (m == 1)
41547 {
41548 color6 = player[myPlayer].underShirtColor;
41549 }
41550 if (m == 2)
41551 {
41552 color6 = player[myPlayer].pantsColor;
41553 }
41554 if (m == 3)
41555 {
41556 color6 = player[myPlayer].shoeColor;
41557 }
41558 if (m == 4)
41559 {
41560 color6 = player[myPlayer].eyeColor;
41561 }
41562 if (m == 5)
41563 {
41564 color6 = player[myPlayer].skinColor;
41565 }
41566 spriteBatch.Draw(TextureAssets.Clothes[m].Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Clothes[m].Width(), TextureAssets.Clothes[m].Height()), color6, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41567 if (m == 4)
41568 {
41569 Texture2D value = Assets.Request<Texture2D>("Images/UI/CharCreation/ColorEyeBack", (AssetRequestMode)1).Value;
41570 spriteBatch.Draw(value, new Vector2(x, y), value.Frame(), Microsoft.Xna.Framework.Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41571 }
41572 UILinkPointNavigator.SetPosition(2806 + m, new Vector2(x, y) + TextureAssets.Clothes[m].Value.Size() * 0.75f);
41573 num22 += 56;
41574 if (m == 1)
41575 {
41576 num22 -= 112;
41577 num23 += 56;
41578 }
41579 if (m == 3)
41580 {
41581 num23 -= 56;
41582 }
41583 if (m == 4)
41584 {
41585 num23 += 56;
41586 num22 -= 56;
41587 }
41588 }
41589 dresserInterfaceDummy.skinVariant = player[myPlayer].skinVariant;
41590 dresserInterfaceDummy.eyeColor = player[myPlayer].eyeColor;
41591 dresserInterfaceDummy.hairColor = player[myPlayer].hairColor;
41592 dresserInterfaceDummy.hair = player[myPlayer].hair;
41593 dresserInterfaceDummy.skinColor = player[myPlayer].skinColor;
41594 dresserInterfaceDummy.shirtColor = player[myPlayer].shirtColor;
41595 dresserInterfaceDummy.underShirtColor = player[myPlayer].underShirtColor;
41596 dresserInterfaceDummy.shoeColor = player[myPlayer].shoeColor;
41597 dresserInterfaceDummy.pantsColor = player[myPlayer].pantsColor;
41598 dresserInterfaceDummy.Bottom = screenPosition + vector;
41599 dresserInterfaceDummy.direction = -1;
41600 dresserInterfaceDummy.gravDir = 1f;
41601 dresserInterfaceDummy.PlayerFrame();
41602 dresserInterfaceDummy.socialIgnoreLight = true;
41603 Microsoft.Xna.Framework.Color c = new Microsoft.Xna.Framework.Color(46, 106, 98) * 0.6f;
41604 if (flag)
41605 {
41606 c = new Microsoft.Xna.Framework.Color(46, 106, 98) * 2f * 0.6f;
41608 {
41609 mouseLeftRelease = false;
41612 }
41613 }
41614 UILinkPointNavigator.SetPosition(2805, r.Center.ToVector2());
41615 Utils.DrawInvBG(spriteBatch, r, c);
41616 spriteBatch.End();
41617 spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, UIScaleMatrix);
41619 }
static void DrawString(this SpriteBatch spriteBatch, DynamicSpriteFont spriteFont, string text, Vector2 position, Color color)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
static void PlaySound(int type, Vector2 position, int style=1)
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static Asset< Texture2D > ColorHighlight
static Asset< Texture2D > InventoryBack8
static Asset< Texture2D > InventoryBack
static Asset< Texture2D > Hue
static Asset< Texture2D > ClothesStyleBack
static Asset< Texture2D > ColorSlider
static Asset< Texture2D > InventoryBack14
static Asset< Texture2D > ColorBlip
static Asset< Texture2D >[] Clothes
static Asset< Texture2D > ColorBar
static string GetTextValue(string key)
Definition Language.cs:15
int grabColorSlider
Definition Main.cs:2519
static float lBar
Definition Main.cs:2515
static float sBar
Definition Main.cs:2513
static bool npcChatFocus1
Definition Main.cs:1827
static int interactedDresserTopLeftX
Definition Main.cs:2471
static Microsoft.Xna.Framework.Color[] oldClothesColor
Definition Main.cs:2467
static bool npcChatFocus2
Definition Main.cs:1829
static string npcChatText
Definition Main.cs:1825
static Chest[] chest
Definition Main.cs:1699
static SpriteBatch spriteBatch
Definition Main.cs:974
static int myPlayer
Definition Main.cs:1801
static Microsoft.Xna.Framework.Color selColor
Definition Main.cs:2497
static IPlayerRenderer PlayerRenderer
Definition Main.cs:291
static bool mouseLeftRelease
Definition Main.cs:1755
static bool blockMouse
Definition Main.cs:2521
static int screenHeight
Definition Main.cs:1721
static Vector2 screenPosition
Definition Main.cs:1715
static Vector2 MouseScreen
Definition Main.cs:2773
static byte mouseTextColor
Definition Main.cs:1751
static Matrix UIScaleMatrix
Definition Main.cs:2619
static Microsoft.Xna.Framework.Color OurFavoriteColor
Definition Main.cs:902
static void SaveClothesWindow()
Definition Main.cs:41184
static Tile[,] tile
Definition Main.cs:1675
static float hBar
Definition Main.cs:2511
static int npcShop
Definition Main.cs:2833
static bool InGuideCraftMenu
Definition Main.cs:1906
static Vector3 rgbToHsl(Microsoft.Xna.Framework.Color newColor)
Definition Main.cs:44972
static int interactedDresserTopLeftY
Definition Main.cs:2473
static bool playerInventory
Definition Main.cs:1759
static int screenWidth
Definition Main.cs:1719
static void CycleClothingStyle(Player plr)
Definition Main.cs:49267
static Player dresserInterfaceDummy
Definition Main.cs:2475
static int selClothes
Definition Main.cs:2465
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 Player LocalPlayer
Definition Main.cs:2829
static int oldClothesStyle
Definition Main.cs:2469
static Player[] player
Definition Main.cs:1803
static void CancelClothesWindow(bool quiet=false)
Definition Main.cs:41163
static int mouseX
Definition Main.cs:604
static bool mouseLeft
Definition Main.cs:614
static void SetPosition(int ID, Vector2 Position)

References Terraria.Main.Assets, Microsoft.Xna.Framework.Color.Black, Terraria.Main.blockMouse, Microsoft.Xna.Framework.Color.Brown, Terraria.Main.CancelClothesWindow(), Terraria.Main.chest, Terraria.GameContent.TextureAssets.Clothes, Terraria.GameContent.TextureAssets.ClothesStyleBack, Terraria.GameContent.TextureAssets.ColorBar, Terraria.GameContent.TextureAssets.ColorBlip, Terraria.GameContent.TextureAssets.ColorHighlight, Terraria.GameContent.TextureAssets.ColorSlider, System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), Terraria.Main.CycleClothingStyle(), Terraria.Utils.DrawInvBG(), ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString(), Terraria.Main.dresserInterfaceDummy, Terraria.Localization.Language.GetTextValue(), Terraria.Main.grabColorSlider, Terraria.Main.hBar, Terraria.Main.hslToRgb(), Terraria.GameContent.TextureAssets.Hue, System.Text.RegularExpressions.i, Terraria.GameInput.PlayerInput.IgnoreMouseInterface, Terraria.Main.InGuideCraftMenu, Terraria.Main.interactedDresserTopLeftX, Terraria.Main.interactedDresserTopLeftY, Terraria.GameContent.TextureAssets.InventoryBack, Terraria.GameContent.TextureAssets.InventoryBack14, Terraria.GameContent.TextureAssets.InventoryBack8, Terraria.Main.lBar, Terraria.Main.LocalPlayer, Terraria.Main.mouseLeft, Terraria.Main.mouseLeftRelease, Terraria.Main.MouseScreen, Terraria.GameContent.FontAssets.MouseText, Terraria.Main.mouseTextColor, Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.Main.myPlayer, Terraria.Main.npcChatFocus1, Terraria.Main.npcChatFocus2, Terraria.Main.npcChatText, Terraria.Main.npcShop, Terraria.Main.oldClothesColor, Terraria.Main.oldClothesStyle, Terraria.Main.OurFavoriteColor, Terraria.Main.player, Terraria.Main.playerInventory, Terraria.Main.PlayerRenderer, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rgbToHsl(), Terraria.Main.SaveClothesWindow(), Terraria.Main.sBar, Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.screenWidth, Terraria.Main.selClothes, Terraria.Main.selColor, Terraria.UI.Gamepad.UILinkPointNavigator.SetPosition(), Terraria.Main.spriteBatch, Terraria.Main.tile, Terraria.Main.UIScaleMatrix, System.value, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Color.White.

Referenced by Terraria.Main.DrawInterface_22_DresserWindow().