示例#1
0
 public static void DrawUnderwearIcon(Underwear underwear, int x, int y)
 {
     if (underwear.CleanStatus == 1)
     {
         Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y, 64, 64), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "drying", 16)), Microsoft.Xna.Framework.Color.White);
     }
     else
     {
         Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y, 64, 64), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "clean", 16)), Microsoft.Xna.Framework.Color.White);
         int height1 = Math.Min((int)((double)underwear.Wetness / (double)underwear.absorbency * 16.0), 16);
         int height2 = Math.Min((int)((double)underwear.Messiness / (double)underwear.containment * 16.0), 16);
         if (height1 > 0 && height1 >= height2)
         {
             Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height1 * 4), 64, height1 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "wet", height1)), Microsoft.Xna.Framework.Color.White);
         }
         if (height2 > 0)
         {
             Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height2 * 4), 64, height2 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "messy", height2)), Microsoft.Xna.Framework.Color.White);
         }
         if (height1 > 0 && height1 < height2)
         {
             Game1.spriteBatch.Draw(Animations.sprites, new Microsoft.Xna.Framework.Rectangle(x, y + (64 - height1 * 4), 64, height1 * 4), new Microsoft.Xna.Framework.Rectangle?(Animations.UnderwearRectangle(underwear, "wet", height1)), Microsoft.Xna.Framework.Color.White);
         }
         if (Game1.getMouseX() >= x && Game1.getMouseX() <= x + 64 && Game1.getMouseY() >= y && Game1.getMouseY() <= y + 64)
         {
             string source = Strings.DescribeUnderwear(underwear, (string)null);
             string text   = source.First <char>().ToString().ToUpper() + source.Substring(1);
             int    width  = Game1.tileSize * 6 + Game1.tileSize / 6;
             IClickableMenu.drawHoverText(Game1.spriteBatch, Game1.parseText(text, Game1.tinyFont, width), Game1.smallFont, 0, 0, -1, (string)null, -1, (string[])null, (Item)null, 0, -1, -1, -1, -1, 1f, (CraftingRecipe)null);
         }
     }
 }