Пример #1
0
        private void resetBounds()
        {
            xPositionOnScreen = Game1.viewport.Width / 2 - maxWidthOfBuildingViewer - IClickableMenu.spaceToClearSideBorder;
            yPositionOnScreen = Game1.viewport.Height / 2 - maxHeightOfBuildingViewer / 2 - IClickableMenu.spaceToClearTopBorder + 32;
            width             = maxWidthOfBuildingViewer + maxWidthOfDescription + IClickableMenu.spaceToClearSideBorder * 2 + 64;
            height            = maxHeightOfBuildingViewer + IClickableMenu.spaceToClearTopBorder;
            initialize(xPositionOnScreen, yPositionOnScreen, width, height, showUpperRightCloseButton: true);
            okButton = new ClickableTextureComponent("OK", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 192 - 12, yPositionOnScreen + maxHeightOfBuildingViewer + 64, 64, 64), null, null, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(366, 373, 16, 16), 4f)
            {
                myID            = 106,
                rightNeighborID = 104,
                leftNeighborID  = 105
            };
            cancelButton = new ClickableTextureComponent("OK", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 64, yPositionOnScreen + maxHeightOfBuildingViewer + 64, 64, 64), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
            {
                myID           = 107,
                leftNeighborID = 104
            };
            backButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + 64, yPositionOnScreen + maxHeightOfBuildingViewer + 64, 48, 44), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(352, 495, 12, 11), 4f)
            {
                myID            = 101,
                rightNeighborID = 102
            };
            forwardButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + maxWidthOfBuildingViewer - 256 + 16, yPositionOnScreen + maxHeightOfBuildingViewer + 64, 48, 44), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(365, 495, 12, 11), 4f)
            {
                myID            = 102,
                leftNeighborID  = 101,
                rightNeighborID = 105
            };
            demolishButton = new ClickableTextureComponent(Game1.content.LoadString("Strings\\UI:Carpenter_Demolish"), new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 128 - 8, yPositionOnScreen + maxHeightOfBuildingViewer + 64 - 4, 64, 64), null, null, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(348, 372, 17, 17), 4f)
            {
                myID            = 104,
                rightNeighborID = 107,
                leftNeighborID  = 106
            };
            upgradeIcon = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + maxWidthOfBuildingViewer - 128 + 32, yPositionOnScreen + 8, 36, 52), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(402, 328, 9, 13), 4f)
            {
                myID            = 103,
                rightNeighborID = 104,
                leftNeighborID  = 105
            };
            moveButton = new ClickableTextureComponent(Game1.content.LoadString("Strings\\UI:Carpenter_MoveBuildings"), new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 256 - 20, yPositionOnScreen + maxHeightOfBuildingViewer + 64, 64, 64), null, null, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(257, 284, 16, 16), 4f)
            {
                myID            = 105,
                rightNeighborID = 106,
                leftNeighborID  = 102
            };
            bool has_owned_buildings = false;

            foreach (Building building in Game1.getFarm().buildings)
            {
                if (building.hasCarpenterPermissions())
                {
                    has_owned_buildings = true;
                }
            }
            demolishButton.visible = Game1.IsMasterGame;
            moveButton.visible     = (Game1.IsMasterGame || Game1.player.team.farmhandsCanMoveBuildings.Value == FarmerTeam.RemoteBuildingPermissions.On || (Game1.player.team.farmhandsCanMoveBuildings.Value == FarmerTeam.RemoteBuildingPermissions.OwnedBuildings && has_owned_buildings));
            if (!demolishButton.visible)
            {
                upgradeIcon.rightNeighborID = demolishButton.rightNeighborID;
                okButton.rightNeighborID    = demolishButton.rightNeighborID;
                cancelButton.leftNeighborID = demolishButton.leftNeighborID;
            }
            if (!moveButton.visible)
            {
                upgradeIcon.leftNeighborID    = moveButton.leftNeighborID;
                forwardButton.rightNeighborID = moveButton.rightNeighborID;
                okButton.leftNeighborID       = moveButton.leftNeighborID;
            }
        }
Пример #2
0
        public CraftingPage(int x, int y, int width, int height, bool cooking = false, bool standalone_menu = false, List <Chest> material_containers = null)
            : base(x, y, width, height)
        {
            _standaloneMenu = standalone_menu;
            this.cooking    = cooking;
            inventory       = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + 320 - 16, playerInventory: false);
            inventory.showGrayedOutSlots   = true;
            currentPageClickableComponents = new List <ClickableComponent>();
            foreach (ClickableComponent item in inventory.GetBorder(InventoryMenu.BorderSide.Top))
            {
                item.upNeighborID = -99998;
            }
            _materialContainers = material_containers;
            _ = _materialContainers;
            if (_standaloneMenu)
            {
                initializeUpperRightCloseButton();
            }
            trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - 32 - IClickableMenu.borderWidth - 104, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
            {
                myID = 106
            };
            dropItemInvisibleButton = new ClickableComponent(new Rectangle(xPositionOnScreen - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 64, trashCan.bounds.Y, 64, 64), "")
            {
                myID            = 107,
                rightNeighborID = 0
            };
            List <string> playerRecipes = new List <string>();

            if (_standaloneMenu)
            {
                Game1.playSound("bigSelect");
            }
            if (!cooking)
            {
                foreach (string s2 in CraftingRecipe.craftingRecipes.Keys)
                {
                    if (Game1.player.craftingRecipes.ContainsKey(s2))
                    {
                        playerRecipes.Add(s2);
                    }
                }
            }
            else
            {
                foreach (string s in CraftingRecipe.cookingRecipes.Keys)
                {
                    playerRecipes.Add(s);
                }
                playerRecipes.Sort(delegate(string a, string b)
                {
                    int num   = -1;
                    int value = -1;
                    if (a != null && CraftingRecipe.cookingRecipes.ContainsKey(a))
                    {
                        string[] array = CraftingRecipe.cookingRecipes[a].Split('/');
                        if (array.Length > 2 && int.TryParse(array[2], out int result))
                        {
                            num = result;
                        }
                    }
                    if (b != null && CraftingRecipe.cookingRecipes.ContainsKey(b))
                    {
                        string[] array2 = CraftingRecipe.cookingRecipes[b].Split('/');
                        if (array2.Length > 2 && int.TryParse(array2[2], out int result2))
                        {
                            value = result2;
                        }
                    }
                    return(num.CompareTo(value));
                });
            }
            layoutRecipes(playerRecipes);
            if (pagesOfCraftingRecipes.Count > 1)
            {
                upButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 768 + 32, craftingPageY(), 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12), 0.8f)
                {
                    myID            = 88,
                    downNeighborID  = 89,
                    rightNeighborID = 106,
                    leftNeighborID  = -99998
                };
                downButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 768 + 32, craftingPageY() + 192 + 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11), 0.8f)
                {
                    myID            = 89,
                    upNeighborID    = 88,
                    rightNeighborID = 106,
                    leftNeighborID  = -99998
                };
            }
            _UpdateCurrentPageButtons();
            if (Game1.options.SnappyMenus)
            {
                snapToDefaultClickableComponent();
            }
        }
Пример #3
0
        public LetterViewerMenu(string mail, string mailTitle, bool fromCollection = false)
            : base((int)Utility.getTopLeftPositionForCenteringOnScreen(1280, 720).X, (int)Utility.getTopLeftPositionForCenteringOnScreen(1280, 720).Y, 1280, 720, showUpperRightCloseButton: true)
        {
            isFromCollection = fromCollection;
            mail             = mail.Split(new string[1]
            {
                "[#]"
            }, StringSplitOptions.None)[0];
            mail = mail.Replace("@", Game1.player.Name);
            if (mail.Contains("%update"))
            {
                mail = mail.Replace("%update", Utility.getStardewHeroStandingsString());
            }
            isMail = true;
            Game1.playSound("shwip");
            backButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 32, yPositionOnScreen + height - 32 - 64, 48, 44), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f)
            {
                myID            = 101,
                rightNeighborID = 102
            };
            forwardButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width - 32 - 48, yPositionOnScreen + height - 32 - 64, 48, 44), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f)
            {
                myID           = 102,
                leftNeighborID = 101
            };
            acceptQuestButton = new ClickableComponent(new Rectangle(xPositionOnScreen + width / 2 - 128, yPositionOnScreen + height - 128, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).X + 24, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).Y + 24), "")
            {
                myID            = 103,
                rightNeighborID = 102,
                leftNeighborID  = 101
            };
            this.mailTitle = mailTitle;
            letterTexture  = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\letterBG");
            if (mail.Contains("¦"))
            {
                mail = (Game1.player.IsMale ? mail.Substring(0, mail.IndexOf("¦")) : mail.Substring(mail.IndexOf("¦") + 1));
            }
            if (mail.Contains("%item"))
            {
                string   itemDescription = mail.Substring(mail.IndexOf("%item"), mail.IndexOf("%%") + 2 - mail.IndexOf("%item"));
                string[] split           = itemDescription.Split(' ');
                mail = mail.Replace(itemDescription, "");
                if (!isFromCollection)
                {
                    if (split[1].Equals("object"))
                    {
                        int maxNum3 = split.Length - 1;
                        int which4  = Game1.random.Next(2, maxNum3);
                        which4 -= which4 % 2;
                        Object o3 = new Object(Vector2.Zero, Convert.ToInt32(split[which4]), Convert.ToInt32(split[which4 + 1]));
                        itemsToGrab.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + width / 2 - 48, yPositionOnScreen + height - 32 - 96, 96, 96), o3)
                        {
                            myID            = 104,
                            leftNeighborID  = 101,
                            rightNeighborID = 102
                        });
                        backButton.rightNeighborID   = 104;
                        forwardButton.leftNeighborID = 104;
                    }
                    else if (split[1].Equals("tools"))
                    {
                        for (int j = 2; j < split.Length; j++)
                        {
                            Item tool = null;
                            switch (split[j])
                            {
                            case "Axe":
                                tool = new Axe();
                                break;

                            case "Hoe":
                                tool = new Hoe();
                                break;

                            case "Can":
                                tool = new WateringCan();
                                break;

                            case "Scythe":
                                tool = new MeleeWeapon(47);
                                break;

                            case "Pickaxe":
                                tool = new Pickaxe();
                                break;
                            }
                            if (tool != null)
                            {
                                itemsToGrab.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + width / 2 - 48, yPositionOnScreen + height - 32 - 96, 96, 96), tool));
                            }
                        }
                    }
                    else if (split[1].Equals("bigobject"))
                    {
                        int    maxNum2 = split.Length - 1;
                        int    which2  = Game1.random.Next(2, maxNum2);
                        Object o2      = new Object(Vector2.Zero, Convert.ToInt32(split[which2]));
                        itemsToGrab.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + width / 2 - 48, yPositionOnScreen + height - 32 - 96, 96, 96), o2)
                        {
                            myID            = 104,
                            leftNeighborID  = 101,
                            rightNeighborID = 102
                        });
                        backButton.rightNeighborID   = 104;
                        forwardButton.leftNeighborID = 104;
                    }
                    else if (split[1].Equals("furniture"))
                    {
                        int  maxNum = split.Length - 1;
                        int  which  = Game1.random.Next(2, maxNum);
                        Item o      = Furniture.GetFurnitureInstance(Convert.ToInt32(split[which]));
                        itemsToGrab.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + width / 2 - 48, yPositionOnScreen + height - 32 - 96, 96, 96), o)
                        {
                            myID            = 104,
                            leftNeighborID  = 101,
                            rightNeighborID = 102
                        });
                        backButton.rightNeighborID   = 104;
                        forwardButton.leftNeighborID = 104;
                    }
                    else if (split[1].Equals("money"))
                    {
                        int moneyToAdd2 = (split.Length > 4) ? Game1.random.Next(Convert.ToInt32(split[2]), Convert.ToInt32(split[3])) : Convert.ToInt32(split[2]);
                        moneyToAdd2        -= moneyToAdd2 % 10;
                        Game1.player.Money += moneyToAdd2;
                        moneyIncluded       = moneyToAdd2;
                    }
                    else if (split[1].Equals("conversationTopic"))
                    {
                        string topic   = split[2];
                        int    numDays = Convert.ToInt32(split[3].Replace("%%", ""));
                        Game1.player.activeDialogueEvents.Add(topic, numDays);
                        if (topic.Equals("ElliottGone3"))
                        {
                            Utility.getHomeOfFarmer(Game1.player).fridge.Value.addItem(new Object(732, 1));
                        }
                    }
                    else if (split[1].Equals("cookingRecipe"))
                    {
                        Dictionary <string, string> cookingRecipes = Game1.content.Load <Dictionary <string, string> >("Data\\CookingRecipes");
                        int    lowest_required_heart_level         = 1000;
                        string recipe_string = "";
                        foreach (string s in cookingRecipes.Keys)
                        {
                            string[] cookingSplit  = cookingRecipes[s].Split('/');
                            string[] getConditions = cookingSplit[3].Split(' ');
                            if (getConditions[0].Equals("f") && getConditions[1].Equals(mailTitle.Replace("Cooking", "")) && !Game1.player.cookingRecipes.ContainsKey(s))
                            {
                                int required_heart_level = Convert.ToInt32(getConditions[2]);
                                if (required_heart_level <= lowest_required_heart_level)
                                {
                                    lowest_required_heart_level = required_heart_level;
                                    recipe_string = s;
                                    learnedRecipe = s;
                                    if (LocalizedContentManager.CurrentLanguageCode != 0)
                                    {
                                        learnedRecipe = cookingSplit[cookingSplit.Length - 1];
                                    }
                                }
                            }
                        }
                        if (recipe_string != "")
                        {
                            if (!Game1.player.cookingRecipes.ContainsKey(recipe_string))
                            {
                                Game1.player.cookingRecipes.Add(recipe_string, 0);
                            }
                            cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_cooking");
                        }
                    }
                    else if (split[1].Equals("craftingRecipe"))
                    {
                        learnedRecipe = split[2].Replace('_', ' ');
                        if (!Game1.player.craftingRecipes.ContainsKey(learnedRecipe))
                        {
                            Game1.player.craftingRecipes.Add(learnedRecipe, 0);
                        }
                        cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_crafting");
                        if (LocalizedContentManager.CurrentLanguageCode != 0)
                        {
                            Dictionary <string, string> craftingRecipes = Game1.content.Load <Dictionary <string, string> >("Data\\CraftingRecipes");
                            if (craftingRecipes.ContainsKey(learnedRecipe))
                            {
                                string[] craftingSplit = craftingRecipes[learnedRecipe].Split('/');
                                learnedRecipe = craftingSplit[craftingSplit.Length - 1];
                            }
                        }
                    }
                    else if (split[1].Equals("itemRecovery"))
                    {
                        if (Game1.player.recoveredItem != null)
                        {
                            Item item = Game1.player.recoveredItem;
                            Game1.player.recoveredItem = null;
                            itemsToGrab.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + width / 2 - 48, yPositionOnScreen + height - 32 - 96, 96, 96), item)
                            {
                                myID            = 104,
                                leftNeighborID  = 101,
                                rightNeighborID = 102
                            });
                            backButton.rightNeighborID   = 104;
                            forwardButton.leftNeighborID = 104;
                        }
                    }
                    else if (split[1].Equals("quest"))
                    {
                        questID = Convert.ToInt32(split[2].Replace("%%", ""));
                        if (split.Length > 4)
                        {
                            if (!Game1.player.mailReceived.Contains("NOQUEST_" + questID))
                            {
                                Game1.player.addQuest(questID);
                            }
                            questID = -1;
                        }
                        backButton.rightNeighborID   = 103;
                        forwardButton.leftNeighborID = 103;
                    }
                }
            }
            if (mailTitle == "ccBulletinThankYou" && !Game1.player.hasOrWillReceiveMail("ccBulletinThankYouReceived"))
            {
                foreach (NPC i in Utility.getAllCharacters())
                {
                    if (!i.datable && i.isVillager())
                    {
                        Game1.player.changeFriendship(500, i);
                    }
                }
                Game1.addMailForTomorrow("ccBulletinThankYouReceived", noLetter: true);
            }
            Random r = new Random((int)(Game1.uniqueIDForThisGame / 2uL) ^ Game1.year ^ (int)Game1.player.UniqueMultiplayerID);
            bool   hide_secret_santa = fromCollection;

            if (Game1.currentSeason == "winter" && Game1.dayOfMonth >= 18 && Game1.dayOfMonth <= 25)
            {
                hide_secret_santa = false;
            }
            mail = mail.Replace("%secretsanta", hide_secret_santa ? "???" : Utility.getRandomTownNPC(r).displayName);
            int page_height = height - 128;

            if (HasInteractable())
            {
                page_height = height - 128 - 32;
            }
            mailMessage = SpriteText.getStringBrokenIntoSectionsOfHeight(mail, width - 64, page_height);
            if (mailTitle.Equals("winter_5_2") || mailTitle.Equals("winter_12_1") || mailTitle.ToLower().Contains("wizard"))
            {
                whichBG = 2;
            }
            else if (mailTitle.Equals("Sandy"))
            {
                whichBG = 1;
            }
            else if (mailTitle.Contains("Krobus"))
            {
                whichBG = 3;
            }
            forwardButton.visible = (page < mailMessage.Count - 1);
            backButton.visible    = (page > 0);
            if (Game1.options.SnappyMenus)
            {
                populateClickableComponentList();
                snapToDefaultClickableComponent();
                if (mailMessage != null && mailMessage.Count <= 1)
                {
                    backButton.myID    = -100;
                    forwardButton.myID = -100;
                }
            }
        }
Пример #4
0
 public InventoryPage(int x, int y, int width, int height)
     : base(x, y, width, height)
 {
     inventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth, playerInventory: true);
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 256 - 12, 64, 64), "Left Ring")
     {
         myID            = 102,
         downNeighborID  = 103,
         upNeighborID    = Game1.player.MaxItems - 12,
         rightNeighborID = 101,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 320 - 12, 64, 64), "Right Ring")
     {
         myID            = 103,
         upNeighborID    = 102,
         downNeighborID  = 104,
         rightNeighborID = 108,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 384 - 12, 64, 64), "Boots")
     {
         myID            = 104,
         upNeighborID    = 103,
         rightNeighborID = 109,
         fullyImmutable  = true
     });
     portrait = new ClickableComponent(new Rectangle(xPositionOnScreen + 192 - 8 - 64 + 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 256 - 8 + 64, 64, 96), "32");
     trashCan = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width / 3 + 576 + 32, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 192 + 64, 64, 104), Game1.mouseCursors, new Rectangle(564 + Game1.player.trashCanLevel * 18, 102, 18, 26), 4f)
     {
         myID           = 105,
         upNeighborID   = 106,
         leftNeighborID = 101
     };
     organizeButton = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width, yPositionOnScreen + height / 3 - 64 + 8, 64, 64), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize"), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), 4f)
     {
         myID           = 106,
         downNeighborID = 105,
         leftNeighborID = 11,
         upNeighborID   = 898
     };
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 256 - 12, 64, 64), "Hat")
     {
         myID            = 101,
         leftNeighborID  = 102,
         downNeighborID  = 108,
         upNeighborID    = Game1.player.MaxItems - 12,
         rightNeighborID = 105,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 320 - 12, 64, 64), "Shirt")
     {
         myID            = 108,
         upNeighborID    = 101,
         downNeighborID  = 109,
         rightNeighborID = 105,
         leftNeighborID  = 103,
         fullyImmutable  = true
     });
     equipmentIcons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 48 + 208, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 + 384 - 12, 64, 64), "Pants")
     {
         myID            = 109,
         upNeighborID    = 108,
         rightNeighborID = 105,
         leftNeighborID  = 104,
         fullyImmutable  = true
     });
     if (ShouldShowJunimoNoteIcon())
     {
         junimoNoteIcon = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width, yPositionOnScreen + 96, 64, 64), "", Game1.content.LoadString("Strings\\UI:GameMenu_JunimoNote_Hover"), Game1.mouseCursors, new Rectangle(331, 374, 15, 14), 4f)
         {
             myID           = 898,
             leftNeighborID = 11,
             downNeighborID = 106
         };
     }
 }
Пример #5
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (Game1.globalFade)
     {
         return;
     }
     if (this.movingAnimal)
     {
         if (this.okButton != null && this.okButton.containsPoint(x, y))
         {
             Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.prepareForReturnFromPlacement), 0.02f);
             Game1.playSound("smallSelect");
         }
         Building buildingAt = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize)));
         if (buildingAt == null)
         {
             return;
         }
         if (buildingAt.buildingType.Contains(this.animal.buildingTypeILiveIn))
         {
             if ((buildingAt.indoors as AnimalHouse).isFull())
             {
                 Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:AnimalQuery_Moving_BuildingFull"));
             }
             else if (buildingAt.Equals((object)this.animal.home))
             {
                 Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:AnimalQuery_Moving_AlreadyHome"));
             }
             else
             {
                 (this.animal.home.indoors as AnimalHouse).animalsThatLiveHere.Remove(this.animal.myID);
                 if ((this.animal.home.indoors as AnimalHouse).animals.ContainsKey(this.animal.myID))
                 {
                     (buildingAt.indoors as AnimalHouse).animals.Add(this.animal.myID, this.animal);
                     (this.animal.home.indoors as AnimalHouse).animals.Remove(this.animal.myID);
                 }
                 this.animal.home         = buildingAt;
                 this.animal.homeLocation = new Vector2((float)buildingAt.tileX, (float)buildingAt.tileY);
                 (buildingAt.indoors as AnimalHouse).animalsThatLiveHere.Add(this.animal.myID);
                 this.animal.makeSound();
                 Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.finishedPlacingAnimal), 0.02f);
             }
         }
         else
         {
             Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:AnimalQuery_Moving_CantLiveThere", (object)this.animal.shortDisplayType()));
         }
     }
     else if (this.confirmingSell)
     {
         if (this.yesButton.containsPoint(x, y))
         {
             Game1.player.money += this.animal.getSellPrice();
             (this.animal.home.indoors as AnimalHouse).animalsThatLiveHere.Remove(this.animal.myID);
             this.animal.health = -1;
             int num1 = this.animal.frontBackSourceRect.Width / 2;
             for (int index = 0; index < num1; ++index)
             {
                 int num2 = Game1.random.Next(25, 200);
                 Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(5, this.animal.position + new Vector2((float)Game1.random.Next(-Game1.tileSize / 2, this.animal.frontBackSourceRect.Width * 3), (float)Game1.random.Next(-Game1.tileSize / 2, this.animal.frontBackSourceRect.Height * 3)), new Color((int)byte.MaxValue - num2, (int)byte.MaxValue, (int)byte.MaxValue - num2), 8, false, Game1.random.NextDouble() < 0.5 ? 50f : (float)Game1.random.Next(30, 200), 0, Game1.tileSize, -1f, Game1.tileSize, Game1.random.NextDouble() < 0.5 ? 0 : Game1.random.Next(0, 600))
                 {
                     scale  = (float)((double)Game1.random.Next(2, 5) * 0.25),
                     alpha  = (float)((double)Game1.random.Next(2, 5) * 0.25),
                     motion = new Vector2(0.0f, (float)-Game1.random.NextDouble())
                 });
             }
             Game1.playSound("newRecipe");
             Game1.playSound("money");
             Game1.exitActiveMenu();
         }
         else
         {
             if (!this.noButton.containsPoint(x, y))
             {
                 return;
             }
             this.confirmingSell = false;
             Game1.playSound("smallSelect");
             if (!Game1.options.SnappyMenus)
             {
                 return;
             }
             this.currentlySnappedComponent = this.getComponentWithID(103);
             this.snapCursorToCurrentSnappedComponent();
         }
     }
     else
     {
         if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose())
         {
             Game1.exitActiveMenu();
             if (this.textBox.Text.Length > 0 && !Utility.areThereAnyOtherAnimalsWithThisName(this.textBox.Text))
             {
                 this.animal.displayName = this.textBox.Text;
                 this.animal.name        = this.textBox.Text;
             }
             Game1.playSound("smallSelect");
         }
         if (this.sellButton.containsPoint(x, y))
         {
             this.confirmingSell = true;
             ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(Game1.viewport.Width / 2 - Game1.tileSize - 4, Game1.viewport.Height / 2 - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
             int num1 = 111;
             textureComponent1.myID = num1;
             int num2 = 105;
             textureComponent1.rightNeighborID = num2;
             this.yesButton = textureComponent1;
             ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(Game1.viewport.Width / 2 + 4, Game1.viewport.Height / 2 - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
             int num3 = 105;
             textureComponent2.myID = num3;
             int num4 = 111;
             textureComponent2.leftNeighborID = num4;
             this.noButton = textureComponent2;
             Game1.playSound("smallSelect");
             if (!Game1.options.SnappyMenus)
             {
                 return;
             }
             this.populateClickableComponentList();
             this.currentlySnappedComponent = (ClickableComponent)this.noButton;
             this.snapCursorToCurrentSnappedComponent();
         }
         else
         {
             if (this.moveHomeButton.containsPoint(x, y))
             {
                 Game1.playSound("smallSelect");
                 Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.prepareForAnimalPlacement), 0.02f);
             }
             if (this.allowReproductionButton != null && this.allowReproductionButton.containsPoint(x, y))
             {
                 Game1.playSound("drumkit6");
                 this.animal.allowReproduction             = !this.animal.allowReproduction;
                 this.allowReproductionButton.sourceRect.X = !this.animal.allowReproduction ? 137 : 128;
             }
             this.textBox.Update();
         }
     }
 }
Пример #6
0
 public override void performHoverAction(int x, int y)
 {
     this.hovered = null;
     if (Game1.globalFade || this.freeze)
     {
         return;
     }
     if (this.okButton != null)
     {
         if (this.okButton.containsPoint(x, y))
         {
             this.okButton.scale = Math.Min(1.1f, this.okButton.scale + 0.05f);
         }
         else
         {
             this.okButton.scale = Math.Max(1f, this.okButton.scale - 0.05f);
         }
     }
     if (this.onFarm)
     {
         if (!this.namingAnimal)
         {
             Vector2 tile = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize));
             Farm    farm = Game1.getLocationFromName("Farm") as Farm;
             using (List <Building> .Enumerator enumerator = farm.buildings.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     enumerator.Current.color = Color.White;
                 }
             }
             Building buildingAt = farm.getBuildingAt(tile);
             if (buildingAt != null)
             {
                 if (buildingAt.buildingType.Contains(this.animalBeingPurchased.buildingTypeILiveIn) && !(buildingAt.indoors as AnimalHouse).isFull())
                 {
                     buildingAt.color = Color.LightGreen * 0.8f;
                 }
                 else
                 {
                     buildingAt.color = Color.Red * 0.8f;
                 }
             }
         }
         if (this.doneNamingButton != null)
         {
             if (this.doneNamingButton.containsPoint(x, y))
             {
                 this.doneNamingButton.scale = Math.Min(1.1f, this.doneNamingButton.scale + 0.05f);
             }
             else
             {
                 this.doneNamingButton.scale = Math.Max(1f, this.doneNamingButton.scale - 0.05f);
             }
         }
         this.randomButton.tryHover(x, y, 0.5f);
         return;
     }
     foreach (ClickableTextureComponent current in this.animalsToPurchase)
     {
         if (current.containsPoint(x, y))
         {
             current.scale = Math.Min(current.scale + 0.05f, 4.1f);
             this.hovered  = current;
         }
         else
         {
             current.scale = Math.Max(4f, current.scale - 0.025f);
         }
     }
 }
Пример #7
0
        public override void draw(SpriteBatch b)
        {
            if (!this.onFarm && !Game1.dialogueUp && !Game1.globalFade)
            {
                b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
                SpriteText.drawStringWithScrollBackground(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11354", new object[0]), this.xPositionOnScreen + Game1.tileSize * 3 / 2, this.yPositionOnScreen, "", 1f, -1);
                Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true, null, false);
                Game1.dayTimeMoneyBox.drawMoneyBox(b, -1, -1);
                using (List <ClickableTextureComponent> .Enumerator enumerator = this.animalsToPurchase.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ClickableTextureComponent current = enumerator.Current;
                        current.draw(b, ((current.item as StardewValley.Object).type != null) ? (Color.Black * 0.4f) : Color.White, 0.87f);
                    }
                    goto IL_2AE;
                }
            }
            if (!Game1.globalFade && this.onFarm)
            {
                string s = Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11355", new object[]
                {
                    this.animalBeingPurchased.displayHouse,
                    this.animalBeingPurchased.displayType
                });
                SpriteText.drawStringWithScrollBackground(b, s, Game1.viewport.Width / 2 - SpriteText.getWidthOfString(s) / 2, Game1.tileSize / 4, "", 1f, -1);
                if (this.namingAnimal)
                {
                    b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
                    Game1.drawDialogueBox(Game1.viewport.Width / 2 - Game1.tileSize * 4, Game1.viewport.Height / 2 - Game1.tileSize * 3 - Game1.tileSize / 2, Game1.tileSize * 8, Game1.tileSize * 3, false, true, null, false);
                    Utility.drawTextWithShadow(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11357", new object[0]), Game1.dialogueFont, new Vector2((float)(Game1.viewport.Width / 2 - Game1.tileSize * 4 + Game1.tileSize / 2 + 8), (float)(Game1.viewport.Height / 2 - Game1.tileSize * 2 + 8)), Game1.textColor, 1f, -1f, -1, -1, 1f, 3);
                    this.textBox.Draw(b);
                    this.doneNamingButton.draw(b);
                    this.randomButton.draw(b);
                }
            }
IL_2AE:
            if (!Game1.globalFade && this.okButton != null)
            {
                this.okButton.draw(b);
            }
            if (this.hovered != null)
            {
                if ((this.hovered.item as StardewValley.Object).type != null)
                {
                    IClickableMenu.drawHoverText(b, Game1.parseText((this.hovered.item as StardewValley.Object).type, Game1.dialogueFont, Game1.tileSize * 5), Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
                }
                else
                {
                    string animalTitle = PurchaseAnimalsMenu.getAnimalTitle(this.hovered.hoverText);
                    SpriteText.drawStringWithScrollBackground(b, animalTitle, this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize, this.yPositionOnScreen + this.height + -Game1.tileSize / 2 + IClickableMenu.spaceToClearTopBorder / 2 + 8, "Truffle Pig", 1f, -1);
                    SpriteText.drawStringWithScrollBackground(b, "$" + Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", new object[]
                    {
                        this.hovered.item.salePrice()
                    }), this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize * 2, this.yPositionOnScreen + this.height + Game1.tileSize + IClickableMenu.spaceToClearTopBorder / 2 + 8, "$99999999g", (Game1.player.Money >= this.hovered.item.salePrice()) ? 1f : 0.5f, -1);
                    string animalDescription = PurchaseAnimalsMenu.getAnimalDescription(this.hovered.hoverText);
                    IClickableMenu.drawHoverText(b, Game1.parseText(animalDescription, Game1.smallFont, Game1.tileSize * 5), Game1.smallFont, 0, 0, -1, animalTitle, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
                }
            }
            Game1.mouseCursorTransparency = 1f;
            base.drawMouse(b);
        }
Пример #8
0
        public CraftingPage(int x, int y, int width, int height, bool cooking = false)
            : base(x, y, width, height, false)
        {
            this.cooking   = cooking;
            this.inventory = new InventoryMenu(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth + Game1.tileSize * 5 - Game1.tileSize / 4, false, (List <Item>)null, (InventoryMenu.highlightThisItem)null, -1, 3, 0, 0, true);
            this.inventory.showGrayedOutSlots = true;
            int num1     = this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth - Game1.tileSize / 4;
            int y1       = this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.tileSize / 4;
            int tileSize = Game1.tileSize;
            int num2     = 8;
            int num3     = 10;
            int num4     = -1;

            if (cooking)
            {
                this.initializeUpperRightCloseButton();
            }
            SerializableDictionary <string, int> serializableDictionary = new SerializableDictionary <string, int>();

            foreach (string key in CraftingRecipe.craftingRecipes.Keys)
            {
                if (Game1.player.craftingRecipes.ContainsKey(key))
                {
                    serializableDictionary.Add(key, Game1.player.craftingRecipes[key]);
                }
            }
            Game1.player.craftingRecipes = serializableDictionary;
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width + 4, this.yPositionOnScreen + height - Game1.tileSize * 3 - Game1.tileSize / 2 - IClickableMenu.borderWidth - 104, Game1.tileSize, 104), Game1.mouseCursors, new Rectangle(669, 261, 16, 26), (float)Game1.pixelZoom, false);
            int num5 = 106;

            textureComponent1.myID = num5;
            this.trashCan          = textureComponent1;
            List <string> stringList = new List <string>();

            if (!cooking)
            {
                foreach (string key in Game1.player.craftingRecipes.Keys)
                {
                    stringList.Add(new string(key.ToCharArray()));
                }
            }
            else
            {
                Game1.playSound("bigSelect");
                foreach (string key in CraftingRecipe.cookingRecipes.Keys)
                {
                    stringList.Add(new string(key.ToCharArray()));
                }
            }
            int count1 = stringList.Count;
            int index1 = 0;

            while (stringList.Count > 0)
            {
                CraftingRecipe            craftingRecipe;
                int                       index2;
                ClickableTextureComponent key1;
                bool                      flag;
                do
                {
                    ++num4;
                    if (num4 % 40 == 0)
                    {
                        this.pagesOfCraftingRecipes.Add(new Dictionary <ClickableTextureComponent, CraftingRecipe>());
                    }
                    int num6 = num4 / num3 % (40 / num3);
                    craftingRecipe = new CraftingRecipe(stringList[index1], cooking);
                    int count2 = stringList.Count;
                    while (craftingRecipe.bigCraftable && num6 == 40 / num3 - 1 && count2 > 0)
                    {
                        index1 = (index1 + 1) % stringList.Count;
                        --count2;
                        craftingRecipe = new CraftingRecipe(stringList[index1], false);
                        if (count2 == 0)
                        {
                            num4 += 40 - num4 % 40;
                            num6  = num4 / num3 % (40 / num3);
                            this.pagesOfCraftingRecipes.Add(new Dictionary <ClickableTextureComponent, CraftingRecipe>());
                        }
                    }
                    index2 = num4 / 40;
                    ClickableTextureComponent textureComponent2 = new ClickableTextureComponent("", new Rectangle(num1 + num4 % num3 * (Game1.tileSize + num2), y1 + num6 * (Game1.tileSize + 8), Game1.tileSize, craftingRecipe.bigCraftable ? Game1.tileSize * 2 : Game1.tileSize), (string)null, !cooking || Game1.player.cookingRecipes.ContainsKey(craftingRecipe.name) ? "" : "ghosted", craftingRecipe.bigCraftable ? Game1.bigCraftableSpriteSheet : Game1.objectSpriteSheet, craftingRecipe.bigCraftable ? Game1.getArbitrarySourceRect(Game1.bigCraftableSpriteSheet, 16, 32, craftingRecipe.getIndexOfMenuView()) : Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, craftingRecipe.getIndexOfMenuView(), 16, 16), (float)Game1.pixelZoom, false);
                    int num7 = 200 + num4;
                    textureComponent2.myID = num7;
                    int num8 = craftingRecipe.bigCraftable ? 200 + num4 + num3 : -500;
                    textureComponent2.myAlternateID = num8;
                    int num9 = num4 % num3 < num3 - 1 ? 200 + num4 + 1 : (num6 >= 2 || index2 <= 0 ? 89 : 88);
                    textureComponent2.rightNeighborID = num9;
                    int num10 = num4 % num3 > 0 ? 200 + num4 - 1 : -1;
                    textureComponent2.leftNeighborID = num10;
                    int num11 = num6 == 0 ? 12344 : 200 + num4 - num3;
                    textureComponent2.upNeighborID = num11;
                    int num12 = num6 == 40 / num3 - 1 || num6 == 40 / num3 - 2 && craftingRecipe.bigCraftable || stringList.Count <= 10 ? num4 % num3 : 200 + num4 + (craftingRecipe.bigCraftable ? num3 * 2 : num3);
                    textureComponent2.downNeighborID = num12;
                    int num13 = 1;
                    textureComponent2.fullyImmutable = num13 != 0;
                    int num14 = 8000;
                    textureComponent2.region = num14;
                    key1 = textureComponent2;
                    flag = false;
                    foreach (ClickableComponent key2 in this.pagesOfCraftingRecipes[index2].Keys)
                    {
                        if (key2.bounds.Intersects(key1.bounds))
                        {
                            flag = true;
                            break;
                        }
                    }
                }while (flag);
                this.pagesOfCraftingRecipes[index2].Add(key1, craftingRecipe);
                stringList.RemoveAt(index1);
                index1 = 0;
            }
            if (this.pagesOfCraftingRecipes.Count <= 1)
            {
                return;
            }
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 12 + Game1.tileSize / 2, y1, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12, -1, -1), 0.8f, false);
            int num15 = 88;

            textureComponent3.myID = num15;
            int num16 = 89;

            textureComponent3.downNeighborID = num16;
            int num17 = 106;

            textureComponent3.rightNeighborID = num17;
            this.upButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 12 + Game1.tileSize / 2, y1 + Game1.tileSize * 3 + Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11, -1, -1), 0.8f, false);
            int num18 = 89;

            textureComponent4.myID = num18;
            int num19 = 88;

            textureComponent4.upNeighborID = num19;
            int num20 = 106;

            textureComponent4.rightNeighborID = num20;
            this.downButton = textureComponent4;
        }
Пример #9
0
        public ShippingMenu(IList <Item> items)
            : base(0, 0, Game1.viewport.Width, Game1.viewport.Height)
        {
            Game1.player.team.endOfNightStatus.UpdateState("shipment");
            parseItems(items);
            if (!Game1.wasRainingYesterday)
            {
                Game1.changeMusicTrack(Game1.currentSeason.Equals("summer") ? "nightTime" : "none");
            }
            categoryLabelsWidth    = 512;
            plusButtonWidth        = 40;
            itemSlotWidth          = 96;
            itemAndPlusButtonWidth = plusButtonWidth + itemSlotWidth + 8;
            totalWidth             = categoryLabelsWidth + itemAndPlusButtonWidth;
            centerX      = Game1.viewport.Width / 2;
            centerY      = Game1.viewport.Height / 2;
            _hasFinished = false;
            int lastVisible = -1;

            for (int i = 0; i < 6; i++)
            {
                categories.Add(new ClickableTextureComponent("", new Rectangle(centerX + totalWidth / 2 - plusButtonWidth, centerY - 300 + i * 27 * 4, plusButtonWidth, 44), "", getCategoryName(i), Game1.mouseCursors, new Rectangle(392, 361, 10, 11), 4f)
                {
                    visible             = (i < 5 && categoryItems[i].Count > 0),
                    myID                = i,
                    downNeighborID      = ((i < 4) ? (i + 1) : 101),
                    upNeighborID        = ((i > 0) ? lastVisible : (-1)),
                    upNeighborImmutable = true
                });
                lastVisible = ((i < 5 && categoryItems[i].Count > 0) ? i : lastVisible);
            }
            dayPlaqueY = categories[0].bounds.Y - 128;
            Rectangle okRect = new Rectangle(centerX + totalWidth / 2 - itemAndPlusButtonWidth + 32, centerY + 300 - 64, 64, 64);

            okButton = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11382"), okRect, null, Game1.content.LoadString("Strings\\StringsFromCSFiles:ShippingMenu.cs.11382"), Game1.mouseCursors, new Rectangle(128, 256, 64, 64), 1f)
            {
                myID         = 101,
                upNeighborID = lastVisible
            };
            if (Game1.options.gamepadControls)
            {
                Mouse.SetPosition(okRect.Center.X, okRect.Center.Y);
                Game1.InvalidateOldMouseMovement();
                Game1.lastCursorMotionWasMouse = false;
            }
            backButton = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + 32, yPositionOnScreen + height - 64, 48, 44), null, "", Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f)
            {
                myID            = 103,
                rightNeighborID = -7777
            };
            forwardButton = new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width - 32 - 48, yPositionOnScreen + height - 64, 48, 44), null, "", Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f)
            {
                myID           = 102,
                leftNeighborID = 103
            };
            if (Game1.dayOfMonth == 25 && Game1.currentSeason.Equals("winter"))
            {
                Vector2   startingPosition = new Vector2(Game1.viewport.Width, Game1.random.Next(0, 200));
                Rectangle sourceRect       = new Rectangle(640, 800, 32, 16);
                int       loops            = 1000;
                TemporaryAnimatedSprite t  = new TemporaryAnimatedSprite("LooseSprites\\Cursors", sourceRect, 80f, 2, loops, startingPosition, flicker: false, flipped: false, 0.01f, 0f, Color.White, 4f, 0f, 0f, 0f, local: true)
                {
                    motion = new Vector2(-4f, 0f),
                    delayBeforeAnimationStart = 3000
                };
                animations.Add(t);
            }
            Game1.stats.checkForShippingAchievements();
            if (!Game1.player.achievements.Contains(34) && Utility.hasFarmerShippedAllItems())
            {
                Game1.getAchievement(34);
            }
            RepositionItems();
            populateClickableComponentList();
            if (Game1.options.SnappyMenus)
            {
                snapToDefaultClickableComponent();
            }
        }
Пример #10
0
        public Billboard(bool dailyQuest = false)
            : base(0, 0, 0, 0, true)
        {
            if (!Game1.player.hasOrWillReceiveMail("checkedBulletinOnce"))
            {
                Game1.player.mailReceived.Add("checkedBulletinOnce");
                (Game1.getLocationFromName("Town") as Town).checkedBoard();
            }
            this.dailyQuestBoard  = dailyQuest;
            this.billboardTexture = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\Billboard");
            this.width            = (dailyQuest ? 338 : 301) * Game1.pixelZoom;
            this.height           = 198 * Game1.pixelZoom;
            Vector2 centeringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(this.width, this.height, 0, 0);

            this.xPositionOnScreen = (int)centeringOnScreen.X;
            this.yPositionOnScreen = (int)centeringOnScreen.Y;
            this.acceptQuestButton = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - Game1.tileSize * 2, this.yPositionOnScreen + this.height - Game1.tileSize * 2, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).X + Game1.pixelZoom * 6, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest")).Y + Game1.pixelZoom * 6), "")
            {
                myID = 0
            };
            this.upperRightCloseButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width - 5 * Game1.pixelZoom, this.yPositionOnScreen, 12 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(337, 494, 12, 12), (float)Game1.pixelZoom, false);
            Game1.playSound("bigSelect");
            if (!dailyQuest)
            {
                this.calendarDays = new List <ClickableTextureComponent>();
                Dictionary <int, NPC> dictionary = new Dictionary <int, NPC>();
                foreach (NPC allCharacter in Utility.getAllCharacters())
                {
                    if (allCharacter.birthday_Season != null && allCharacter.birthday_Season.Equals(Game1.currentSeason) && !dictionary.ContainsKey(allCharacter.birthday_Day) && (Game1.player.friendships.ContainsKey(allCharacter.name) || !allCharacter.name.Equals("Dwarf") && !allCharacter.name.Equals("Sandy") && !allCharacter.name.Equals("Krobus")))
                    {
                        dictionary.Add(allCharacter.birthday_Day, allCharacter);
                    }
                }
                for (int index = 1; index <= 28; ++index)
                {
                    string str       = "";
                    string hoverText = "";
                    NPC    npc       = dictionary.ContainsKey(index) ? dictionary[index] : (NPC)null;
                    if (Utility.isFestivalDay(index, Game1.currentSeason))
                    {
                        str = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + (object)index)["name"];
                    }
                    else if ((object)npc != null)
                    {
                        if ((int)npc.name.Last <char>() == 115 || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.de && ((int)npc.name.Last <char>() == 120 || (int)npc.name.Last <char>() == 223 || (int)npc.name.Last <char>() == 122))
                        {
                            hoverText = Game1.content.LoadString("Strings\\UI:Billboard_SBirthday", (object)npc.displayName);
                        }
                        else
                        {
                            hoverText = Game1.content.LoadString("Strings\\UI:Billboard_Birthday", (object)npc.displayName);
                        }
                    }
                    List <ClickableTextureComponent> calendarDays     = this.calendarDays;
                    ClickableTextureComponent        textureComponent = new ClickableTextureComponent(str, new Rectangle(this.xPositionOnScreen + 38 * Game1.pixelZoom + (index - 1) % 7 * 32 * Game1.pixelZoom, this.yPositionOnScreen + 50 * Game1.pixelZoom + (index - 1) / 7 * 32 * Game1.pixelZoom, 31 * Game1.pixelZoom, 31 * Game1.pixelZoom), str, hoverText, (object)npc != null ? npc.sprite.Texture : (Texture2D)null, (object)npc != null ? new Rectangle(0, 0, 16, 24) : Rectangle.Empty, 1f, false);
                    int num1 = index;
                    textureComponent.myID = num1;
                    int num2 = index % 7 != 0 ? index + 1 : -1;
                    textureComponent.rightNeighborID = num2;
                    int num3 = index % 7 != 1 ? index - 1 : -1;
                    textureComponent.leftNeighborID = num3;
                    int num4 = index + 7;
                    textureComponent.downNeighborID = num4;
                    int num5 = index > 7 ? index - 7 : -1;
                    textureComponent.upNeighborID = num5;
                    calendarDays.Add(textureComponent);
                }
            }
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }
Пример #11
0
        private void resetBounds()
        {
            this.xPositionOnScreen = Game1.viewport.Width / 2 - this.maxWidthOfBuildingViewer - IClickableMenu.spaceToClearSideBorder;
            this.yPositionOnScreen = Game1.viewport.Height / 2 - this.maxHeightOfBuildingViewer / 2 - IClickableMenu.spaceToClearTopBorder + Game1.tileSize / 2;
            this.width             = this.maxWidthOfBuildingViewer + this.maxWidthOfDescription + IClickableMenu.spaceToClearSideBorder * 2 + Game1.tileSize;
            this.height            = this.maxHeightOfBuildingViewer + IClickableMenu.spaceToClearTopBorder;
            this.initialize(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, true);
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent("OK", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize * 3 - Game1.pixelZoom * 3, this.yPositionOnScreen + this.maxHeightOfBuildingViewer + Game1.tileSize, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(366, 373, 16, 16), (float)Game1.pixelZoom, false);
            int num1 = 106;

            textureComponent1.myID = num1;
            int num2 = 104;

            textureComponent1.rightNeighborID = num2;
            int num3 = 105;

            textureComponent1.leftNeighborID = num3;
            this.okButton = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent("OK", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize, this.yPositionOnScreen + this.maxHeightOfBuildingViewer + Game1.tileSize, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
            int num4 = 107;

            textureComponent2.myID = num4;
            int num5 = 104;

            textureComponent2.leftNeighborID = num5;
            this.cancelButton = textureComponent2;
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen + this.maxHeightOfBuildingViewer + Game1.tileSize, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num6 = 101;

            textureComponent3.myID = num6;
            int num7 = 102;

            textureComponent3.rightNeighborID = num7;
            this.backButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.maxWidthOfBuildingViewer - Game1.tileSize * 4 + Game1.tileSize / 4, this.yPositionOnScreen + this.maxHeightOfBuildingViewer + Game1.tileSize, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num8 = 102;

            textureComponent4.myID = num8;
            int num9 = 101;

            textureComponent4.leftNeighborID = num9;
            int num10 = 105;

            textureComponent4.rightNeighborID = num10;
            this.forwardButton = textureComponent4;
            ClickableTextureComponent textureComponent5 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\UI:Carpenter_Demolish"), new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize * 2 - Game1.pixelZoom * 2, this.yPositionOnScreen + this.maxHeightOfBuildingViewer + Game1.tileSize - Game1.pixelZoom, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(348, 372, 17, 17), (float)Game1.pixelZoom, false);
            int num11 = 104;

            textureComponent5.myID = num11;
            int num12 = 107;

            textureComponent5.rightNeighborID = num12;
            int num13 = 106;

            textureComponent5.leftNeighborID = num13;
            this.demolishButton = textureComponent5;
            ClickableTextureComponent textureComponent6 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.maxWidthOfBuildingViewer - Game1.tileSize * 2 + Game1.tileSize / 2, this.yPositionOnScreen + Game1.pixelZoom * 2, 9 * Game1.pixelZoom, 13 * Game1.pixelZoom), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(402, 328, 9, 13), (float)Game1.pixelZoom, false);
            int num14 = 103;

            textureComponent6.myID = num14;
            int num15 = 104;

            textureComponent6.rightNeighborID = num15;
            int num16 = 105;

            textureComponent6.leftNeighborID = num16;
            this.upgradeIcon = textureComponent6;
            ClickableTextureComponent textureComponent7 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\UI:Carpenter_MoveBuildings"), new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - Game1.tileSize * 4 - Game1.pixelZoom * 5, this.yPositionOnScreen + this.maxHeightOfBuildingViewer + Game1.tileSize, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(257, 284, 16, 16), (float)Game1.pixelZoom, false);
            int num17 = 105;

            textureComponent7.myID = num17;
            int num18 = 106;

            textureComponent7.rightNeighborID = num18;
            int num19 = 102;

            textureComponent7.leftNeighborID = num19;
            this.moveButton = textureComponent7;
        }
Пример #12
0
        private void drawFarmerSlot(SpriteBatch b, int i)
        {
            long   farmerID = (long)names[i];
            Farmer farmer   = Game1.getFarmerMaybeOffline(farmerID);

            if (farmer != null)
            {
                int gender = (!farmer.IsMale) ? 1 : 0;
                ClickableTextureComponent clickableTextureComponent = sprites[i];
                int       x        = clickableTextureComponent.bounds.X;
                int       y        = clickableTextureComponent.bounds.Y;
                Rectangle origClip = b.GraphicsDevice.ScissorRectangle;
                Rectangle newClip  = origClip;
                newClip.Height = Math.Min(newClip.Bottom, rowPosition(i)) - newClip.Y - 4;
                b.GraphicsDevice.ScissorRectangle = newClip;
                FarmerRenderer.isDrawingForUI     = true;
                try
                {
                    farmer.FarmerRenderer.draw(b, new FarmerSprite.AnimationFrame(farmer.bathingClothes ? 108 : 0, 0, secondaryArm: false, flip: false), farmer.bathingClothes ? 108 : 0, new Rectangle(0, farmer.bathingClothes ? 576 : 0, 16, 32), new Vector2(x, y), Vector2.Zero, 0.8f, 2, Color.White, 0f, 1f, farmer);
                }
                finally
                {
                    b.GraphicsDevice.ScissorRectangle = origClip;
                }
                FarmerRenderer.isDrawingForUI = false;
                Friendship friendship     = Game1.player.team.GetFriendship(Game1.player.UniqueMultiplayerID, farmerID);
                bool       spouse         = friendship.IsMarried();
                float      lineHeight     = Game1.smallFont.MeasureString("W").Y;
                float      russianOffsetY = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru) ? ((0f - lineHeight) / 2f) : 0f;
                b.DrawString(Game1.dialogueFont, farmer.Name, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 3 / 2 + 96 - 20, (float)(sprites[i].bounds.Y + 48) + russianOffsetY - 24f), Game1.textColor);
                string text2 = (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.pt) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635") : ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635").Split('/').First() : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11635").Split('/').Last());
                if (spouse)
                {
                    text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11636") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11637"));
                }
                else if (farmer.isMarried() && !farmer.hasRoommate())
                {
                    text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\UI:SocialPage_MarriedToOtherPlayer_MaleNPC") : Game1.content.LoadString("Strings\\UI:SocialPage_MarriedToOtherPlayer_FemaleNPC"));
                }
                else if (!Game1.player.isMarried() && friendship.IsDating())
                {
                    text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11639") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11640"));
                }
                else if (friendship.IsDivorced())
                {
                    text2 = ((gender == 0) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11642") : Game1.content.LoadString("Strings\\StringsFromCSFiles:SocialPage.cs.11643"));
                }
                int width = (IClickableMenu.borderWidth * 3 + 128 - 40 + 192) / 2;
                text2 = Game1.parseText(text2, Game1.smallFont, width);
                Vector2 textSize = Game1.smallFont.MeasureString(text2);
                b.DrawString(Game1.smallFont, text2, new Vector2((float)(xPositionOnScreen + 192 + 8) - textSize.X / 2f, (float)sprites[i].bounds.Bottom - (textSize.Y - lineHeight)), Game1.textColor);
                if (spouse)
                {
                    b.Draw(Game1.objectSpriteSheet, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 7 / 4 + 192, sprites[i].bounds.Y), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 801, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f);
                }
                else if (friendship.IsDating())
                {
                    b.Draw(Game1.objectSpriteSheet, new Vector2(xPositionOnScreen + IClickableMenu.borderWidth * 7 / 4 + 192, sprites[i].bounds.Y), Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 458, 16, 16), Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0.88f);
                }
            }
        }
Пример #13
0
        public SocialPage(int x, int y, int width, int height)
            : base(x, y, width, height)
        {
            string[] array = defaultFriendships;
            foreach (string name in array)
            {
                if (!Game1.player.friendshipData.ContainsKey(name))
                {
                    Game1.player.friendshipData.Add(name, new Friendship());
                }
            }
            characterSlots = new List <ClickableTextureComponent>();
            Dictionary <string, string> NPCDispositions = Game1.content.Load <Dictionary <string, string> >("Data\\NPCDispositions");

            npcNames = new Dictionary <string, string>();
            foreach (string name2 in Game1.player.friendshipData.Keys)
            {
                string displayName = name2;
                if (NPCDispositions.ContainsKey(name2) && NPCDispositions[name2].Split('/').Length > 11)
                {
                    displayName = NPCDispositions[name2].Split('/')[11];
                }
                if (!npcNames.ContainsKey(name2))
                {
                    npcNames.Add(name2, displayName);
                }
            }
            foreach (NPC l in Utility.getAllCharacters())
            {
                if (l.CanSocialize)
                {
                    if (Game1.player.friendshipData.ContainsKey(l.Name) && l is Child)
                    {
                        kidsNames.Add(l.Name);
                        npcNames[l.Name] = l.Name.Trim();
                    }
                    else if (Game1.player.friendshipData.ContainsKey(l.Name))
                    {
                        npcNames[l.Name] = l.displayName;
                    }
                    else
                    {
                        npcNames[l.Name] = "???";
                    }
                }
            }
            names   = new List <object>();
            sprites = new List <ClickableTextureComponent>();
            foreach (Farmer farmer in Game1.getAllFarmers())
            {
                if (((bool)farmer.isCustomized || farmer == Game1.MasterPlayer) && farmer != Game1.player)
                {
                    names.Add(farmer.UniqueMultiplayerID);
                    sprites.Add(new ClickableTextureComponent("", new Rectangle(x + IClickableMenu.borderWidth + 4, 0, width, 64), null, "", farmer.Sprite.Texture, Rectangle.Empty, 4f));
                    numFarmers++;
                }
            }
            foreach (KeyValuePair <string, string> namePair in npcNames.OrderBy((KeyValuePair <string, string> p) => - Game1.player.getFriendshipLevelForNPC(p.Key)))
            {
                NPC k = null;
                if (kidsNames.Contains(namePair.Key))
                {
                    k = Game1.getCharacterFromName <Child>(namePair.Key, mustBeVillager: false);
                }
                else if (NPCDispositions.ContainsKey(namePair.Key))
                {
                    string[] location     = NPCDispositions[namePair.Key].Split('/')[10].Split(' ');
                    string   texture_name = NPC.getTextureNameForCharacter(namePair.Key);
                    if (location.Length > 2)
                    {
                        k = new NPC(new AnimatedSprite("Characters\\" + texture_name, 0, 16, 32), new Vector2(Convert.ToInt32(location[1]) * 64, Convert.ToInt32(location[2]) * 64), location[0], 0, namePair.Key, null, Game1.content.Load <Texture2D>("Portraits\\" + texture_name), eventActor: false);
                    }
                }
                if (k != null)
                {
                    names.Add(k.Name);
                    sprites.Add(new ClickableTextureComponent("", new Rectangle(x + IClickableMenu.borderWidth + 4, 0, width, 64), null, "", k.Sprite.Texture, k.getMugShotSourceRect(), 4f));
                }
            }
            for (int j = 0; j < names.Count; j++)
            {
                ClickableTextureComponent slot_component = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + IClickableMenu.borderWidth, 0, width - IClickableMenu.borderWidth * 2, rowPosition(1) - rowPosition(0)), null, new Rectangle(0, 0, 0, 0), 4f)
                {
                    myID           = j,
                    downNeighborID = j + 1,
                    upNeighborID   = j - 1
                };
                if (slot_component.upNeighborID < 0)
                {
                    slot_component.upNeighborID = 12342;
                }
                characterSlots.Add(slot_component);
            }
            upButton        = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + 64, 44, 48), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), 4f);
            downButton      = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + height - 64, 44, 48), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), 4f);
            scrollBar       = new ClickableTextureComponent(new Rectangle(upButton.bounds.X + 12, upButton.bounds.Y + upButton.bounds.Height + 4, 24, 40), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), 4f);
            scrollBarRunner = new Rectangle(scrollBar.bounds.X, upButton.bounds.Y + upButton.bounds.Height + 4, scrollBar.bounds.Width, height - 128 - upButton.bounds.Height - 8);
            int first_character_index = 0;

            for (int i = 0; i < names.Count; i++)
            {
                if (!(names[i] is long))
                {
                    first_character_index = i;
                    break;
                }
            }
            slotPosition = first_character_index;
            setScrollBarToCurrentIndex();
            updateSlots();
        }
Пример #14
0
        public virtual void RepositionElements()
        {
            previewPane.X      = xPositionOnScreen;
            previewPane.Y      = yPositionOnScreen;
            previewPane.Width  = 512;
            previewPane.Height = 576;
            colorPane.Width    = 448;
            colorPane.X        = xPositionOnScreen + width - colorPane.Width;
            colorPane.Y        = yPositionOnScreen;
            colorPane.Height   = 576;
            Rectangle panel_rectangle = colorPane;

            panel_rectangle.Inflate(-32, -32);
            previousRegionButton = new ClickableTextureComponent(new Rectangle(panel_rectangle.Left, panel_rectangle.Top, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 44), 1f)
            {
                myID            = 103,
                leftNeighborID  = -99998,
                rightNeighborID = -99998,
                downNeighborID  = 105,
                upNeighborID    = -99998,
                fullyImmutable  = true
            };
            nextRegionButton = new ClickableTextureComponent(new Rectangle(panel_rectangle.Right - 64, panel_rectangle.Top, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 33), 1f)
            {
                myID            = 102,
                leftNeighborID  = -99998,
                rightNeighborID = -99998,
                downNeighborID  = 105,
                upNeighborID    = -99998,
                fullyImmutable  = true
            };
            panel_rectangle.Y     += 64;
            panel_rectangle.Height = 0;
            int color_x = panel_rectangle.Left;

            defaultColorButton = new ClickableTextureComponent(new Rectangle(color_x, panel_rectangle.Bottom, 64, 64), Game1.mouseCursors2, new Rectangle(80, 144, 16, 16), 4f)
            {
                region          = 1000,
                myID            = 105,
                upNeighborID    = -99998,
                downNeighborID  = -99998,
                leftNeighborID  = -99998,
                rightNeighborID = -99998,
                fullyImmutable  = true
            };
            color_x += 80;
            savedColorButtons.Clear();
            buttonColors.Clear();
            for (int i = 0; i < savedColors.Count; i++)
            {
                if (color_x + 64 > panel_rectangle.X + panel_rectangle.Width)
                {
                    color_x            = panel_rectangle.X;
                    panel_rectangle.Y += 72;
                }
                ClickableTextureComponent color_button = new ClickableTextureComponent(new Rectangle(color_x, panel_rectangle.Bottom, 64, 64), Game1.mouseCursors2, new Rectangle(96, 144, 16, 16), 4f)
                {
                    region          = 1000,
                    myID            = i,
                    upNeighborID    = -99998,
                    downNeighborID  = -99998,
                    leftNeighborID  = -99998,
                    rightNeighborID = -99998,
                    fullyImmutable  = true
                };
                color_x += 80;
                savedColorButtons.Add(color_button);
                Vector3 saved_color = savedColors[i];
                int     r           = 0;
                int     g           = 0;
                int     b           = 0;
                Utility.HSLtoRGB(saved_color.X, saved_color.Y / 100f, Utility.Lerp(0.25f, 0.5f, saved_color.Z), out r, out g, out b);
                buttonColors.Add(new Color((byte)r, (byte)g, (byte)b));
            }
            if (color_x + 64 > panel_rectangle.X + panel_rectangle.Width)
            {
                color_x            = panel_rectangle.X;
                panel_rectangle.Y += 72;
            }
            copyColorButton = new ClickableTextureComponent(new Rectangle(color_x, panel_rectangle.Bottom, 64, 64), Game1.mouseCursors, new Rectangle(274, 284, 16, 16), 4f)
            {
                region          = 1000,
                myID            = 104,
                upNeighborID    = -99998,
                downNeighborID  = -99998,
                leftNeighborID  = -99998,
                rightNeighborID = -99998,
                fullyImmutable  = true
            };
            panel_rectangle.Y += 80;
            panel_rectangle    = colorSliderPanel.Reposition(panel_rectangle);
            panel_rectangle.Y += 64;
            okButton           = new ClickableTextureComponent(new Rectangle(colorPane.Right - 64 - 16, colorPane.Bottom - 64 - 16, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
            {
                myID         = 101,
                upNeighborID = 108
            };
            populateClickableComponentList();
        }
Пример #15
0
        public override void gameWindowSizeChanged(Rectangle oldBounds, Rectangle newBounds)
        {
            base.gameWindowSizeChanged(oldBounds, newBounds);
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize / 4, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), (float)Game1.pixelZoom, false);
            int num1 = 800;

            textureComponent1.myID = num1;
            int num2 = 801;

            textureComponent1.downNeighborID = num2;
            this.upArrow = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + this.height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), (float)Game1.pixelZoom, false);
            int num3 = 801;

            textureComponent2.myID = num3;
            int num4 = 800;

            textureComponent2.upNeighborID = num4;
            this.downArrow       = textureComponent2;
            this.scrollBar       = new ClickableTextureComponent(new Rectangle(this.upArrow.bounds.X + Game1.pixelZoom * 3, this.upArrow.bounds.Y + this.upArrow.bounds.Height + Game1.pixelZoom, 6 * Game1.pixelZoom, 10 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), (float)Game1.pixelZoom, false);
            this.scrollBarRunner = new Rectangle(this.scrollBar.bounds.X, this.upArrow.bounds.Y + this.upArrow.bounds.Height + Game1.pixelZoom, this.scrollBar.bounds.Width, this.height - Game1.tileSize - this.upArrow.bounds.Height - Game1.pixelZoom * 7);
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10992"), new Rectangle((int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).X - Game1.tileSize, (int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).Y + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            int num5 = 802;

            textureComponent3.myID = num5;
            int num6 = 803;

            textureComponent3.rightNeighborID = num6;
            this.okDeleteButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10993"), new Rectangle((int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).X + Game1.tileSize, (int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).Y + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
            int num7 = 803;

            textureComponent4.myID = num7;
            int num8 = 802;

            textureComponent4.leftNeighborID = num8;
            this.cancelDeleteButton          = textureComponent4;
            this.gamesToLoadButton.Clear();
            this.deleteButtons.Clear();
            for (int index = 0; index < 4; ++index)
            {
                List <ClickableComponent> gamesToLoadButton  = this.gamesToLoadButton;
                ClickableComponent        clickableComponent = new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize / 4 + index * (this.height / 4), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom), string.Concat((object)index));
                clickableComponent.myID = index;
                int num9 = index < 3 ? index + 1 : -7777;
                clickableComponent.downNeighborID = num9;
                int num10 = index > 0 ? index - 1 : -7777;
                clickableComponent.upNeighborID = num10;
                int num11 = index + 100;
                clickableComponent.rightNeighborID = num11;
                gamesToLoadButton.Add(clickableComponent);
                List <ClickableTextureComponent> deleteButtons     = this.deleteButtons;
                ClickableTextureComponent        textureComponent5 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize - Game1.pixelZoom, this.yPositionOnScreen + Game1.tileSize / 2 + Game1.pixelZoom + index * (this.height / 4), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10994"), Game1.mouseCursors, new Rectangle(322, 498, 12, 12), (float)((double)Game1.pixelZoom * 3.0 / 4.0), false);
                int num12 = index + 100;
                textureComponent5.myID = num12;
                int num13 = index;
                textureComponent5.leftNeighborID = num13;
                int num14 = index + 1 + 100;
                textureComponent5.downNeighborID = num14;
                int num15 = index - 1 + 100;
                textureComponent5.upNeighborID = num15;
                int num16 = index < 2 ? 800 : 801;
                textureComponent5.rightNeighborID = num16;
                deleteButtons.Add(textureComponent5);
            }
        }
Пример #16
0
        protected void _CreateButtons()
        {
            _slotDrawPositions = inventory.GetSlotDrawPositions();
            Dictionary <int, Item> old_items = new Dictionary <int, Item>();

            if (dyePots != null)
            {
                for (int l = 0; l < dyePots.Count; l++)
                {
                    old_items[l] = dyePots[l].item;
                }
            }
            dyePots = new List <ClickableTextureComponent>();
            for (int k = 0; k < validPotColors.Length; k++)
            {
                ClickableTextureComponent dye_pot = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 - 4 + 68 + 18 * k * 4, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 132, 64, 64), dyeTexture, new Rectangle(32 + 16 * k, 80, 16, 16), 4f)
                {
                    myID            = k + 5000,
                    downNeighborID  = -99998,
                    leftNeighborID  = -99998,
                    rightNeighborID = -99998,
                    upNeighborID    = -99998,
                    item            = (old_items.ContainsKey(k) ? old_items[k] : null)
                };
                dyePots.Add(dye_pot);
            }
            _dyeDropAnimationFrames = new int[dyePots.Count];
            for (int j = 0; j < _dyeDropAnimationFrames.Length; j++)
            {
                _dyeDropAnimationFrames[j] = -1;
            }
            dyeButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + 4 + 448, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 8 + 200, 96, 96), dyeTexture, new Rectangle(0, 80, 24, 24), 4f)
            {
                myID            = 1000,
                downNeighborID  = -99998,
                leftNeighborID  = -99998,
                rightNeighborID = -99998,
                upNeighborID    = -99998,
                item            = ((dyeButton != null) ? dyeButton.item : null)
            };
            if (inventory.inventory != null && inventory.inventory.Count >= 12)
            {
                for (int i = 0; i < 12; i++)
                {
                    if (inventory.inventory[i] != null)
                    {
                        inventory.inventory[i].upNeighborID = -99998;
                    }
                }
            }
            dyedClothesDisplays.Clear();
            _dyedClothesDisplayPosition = new Vector2(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + IClickableMenu.borderWidth / 2 + 4 + 692, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 8 + 232);
            Vector2 dyed_items_position = _dyedClothesDisplayPosition;
            int     drawn_items_count   = 0;

            if (Game1.player.shirtItem.Value != null && Game1.player.shirtItem.Value.dyeable.Value)
            {
                drawn_items_count++;
            }
            if (Game1.player.pantsItem.Value != null && Game1.player.pantsItem.Value.dyeable.Value)
            {
                drawn_items_count++;
            }
            dyed_items_position.X -= drawn_items_count * 64 / 2;
            if (Game1.player.shirtItem.Value != null && Game1.player.shirtItem.Value.dyeable.Value)
            {
                ClickableTextureComponent component2 = new ClickableTextureComponent(new Rectangle((int)dyed_items_position.X, (int)dyed_items_position.Y, 64, 64), null, new Rectangle(0, 0, 64, 64), 4f);
                component2.item        = Game1.player.shirtItem.Value;
                dyed_items_position.X += 64f;
                dyedClothesDisplays.Add(component2);
            }
            if (Game1.player.pantsItem.Value != null && Game1.player.pantsItem.Value.dyeable.Value)
            {
                ClickableTextureComponent component = new ClickableTextureComponent(new Rectangle((int)dyed_items_position.X, (int)dyed_items_position.Y, 64, 64), null, new Rectangle(0, 0, 64, 64), 4f);
                component.item         = Game1.player.pantsItem.Value;
                dyed_items_position.X += 64f;
                dyedClothesDisplays.Add(component);
            }
        }
Пример #17
0
        public LoadGameMenu()
            : base(Game1.viewport.Width / 2 - (1100 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 1100 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2, false)
        {
            this.backButton = new ClickableComponent(new Rectangle(Game1.viewport.Width - 198 - 48, Game1.viewport.Height - 81 - 24, 198, 81), "")
            {
                myID           = 81114,
                upNeighborID   = 801,
                leftNeighborID = 801
            };
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize / 4, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), (float)Game1.pixelZoom, false);
            int num1 = 800;

            textureComponent1.myID = num1;
            int num2 = 801;

            textureComponent1.downNeighborID = num2;
            int num3 = 100;

            textureComponent1.leftNeighborID = num3;
            this.upArrow = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + this.height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), (float)Game1.pixelZoom, false);
            int num4 = 801;

            textureComponent2.myID = num4;
            int num5 = 800;

            textureComponent2.upNeighborID = num5;
            int num6 = 103;

            textureComponent2.leftNeighborID = num6;
            int num7 = 81114;

            textureComponent2.rightNeighborID = num7;
            int num8 = 81114;

            textureComponent2.downNeighborID = num8;
            this.downArrow       = textureComponent2;
            this.scrollBar       = new ClickableTextureComponent(new Rectangle(this.upArrow.bounds.X + Game1.pixelZoom * 3, this.upArrow.bounds.Y + this.upArrow.bounds.Height + Game1.pixelZoom, 6 * Game1.pixelZoom, 10 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), (float)Game1.pixelZoom, false);
            this.scrollBarRunner = new Rectangle(this.scrollBar.bounds.X, this.upArrow.bounds.Y + this.upArrow.bounds.Height + Game1.pixelZoom, this.scrollBar.bounds.Width, this.height - Game1.tileSize - this.upArrow.bounds.Height - Game1.pixelZoom * 7);
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10992"), new Rectangle((int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).X - Game1.tileSize, (int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).Y + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            int num9 = 802;

            textureComponent3.myID = num9;
            int num10 = 803;

            textureComponent3.rightNeighborID = num10;
            this.okDeleteButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10993"), new Rectangle((int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).X + Game1.tileSize, (int)Utility.getTopLeftPositionForCenteringOnScreen(Game1.tileSize, Game1.tileSize, 0, 0).Y + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), (string)null, (string)null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false);
            int num11 = 803;

            textureComponent4.myID = num11;
            int num12 = 802;

            textureComponent4.leftNeighborID = num12;
            this.cancelDeleteButton          = textureComponent4;
            for (int index = 0; index < 4; ++index)
            {
                List <ClickableComponent> gamesToLoadButton  = this.gamesToLoadButton;
                ClickableComponent        clickableComponent = new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize / 4 + index * (this.height / 4), this.width - Game1.tileSize / 2, this.height / 4 + Game1.pixelZoom), string.Concat((object)index));
                clickableComponent.myID = index;
                int num13 = index < 3 ? index + 1 : -7777;
                clickableComponent.downNeighborID = num13;
                int num14 = index > 0 ? index - 1 : -7777;
                clickableComponent.upNeighborID = num14;
                int num15 = index + 100;
                clickableComponent.rightNeighborID = num15;
                gamesToLoadButton.Add(clickableComponent);
                List <ClickableTextureComponent> deleteButtons     = this.deleteButtons;
                ClickableTextureComponent        textureComponent5 = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize - Game1.pixelZoom, this.yPositionOnScreen + Game1.tileSize / 2 + Game1.pixelZoom + index * (this.height / 4), 12 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10994"), Game1.mouseCursors, new Rectangle(322, 498, 12, 12), (float)((double)Game1.pixelZoom * 3.0 / 4.0), false);
                int num16 = index + 100;
                textureComponent5.myID = num16;
                int num17 = index;
                textureComponent5.leftNeighborID = num17;
                int num18 = index + 1 + 100;
                textureComponent5.downNeighborID = num18;
                int num19 = index - 1 + 100;
                textureComponent5.upNeighborID = num19;
                int num20 = index < 2 ? 800 : 801;
                textureComponent5.rightNeighborID = num20;
                deleteButtons.Add(textureComponent5);
            }
            this._initTask = new Task <List <Farmer> >((Func <List <Farmer> >)(() =>
            {
                Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
                return(LoadGameMenu.FindSaveGames());
            }));
            this._initTask.Start();
            if (!Game1.options.snappyMenus || !Game1.options.gamepadControls)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }
Пример #18
0
        private void _DyePotClicked(ClickableTextureComponent dye_pot)
        {
            Item old_item = dye_pot.item;
            int  index    = dyePots.IndexOf(dye_pot);

            if (index < 0)
            {
                return;
            }
            if (heldItem == null || (heldItem.canBeTrashed() && GetPotIndex(heldItem) == index))
            {
                if (dye_pot.item != null && heldItem != null && dye_pot.item.canStackWith(heldItem))
                {
                    heldItem.Stack++;
                    dye_pot.item = null;
                    Game1.playSound("quickSlosh");
                    return;
                }
                dye_pot.item = ((heldItem == null) ? null : heldItem.getOne());
                if (heldItem != null)
                {
                    heldItem.Stack--;
                }
                if (heldItem != null && heldItem.Stack <= 0)
                {
                    heldItem = old_item;
                }
                else if (heldItem != null && old_item != null)
                {
                    Item j = Game1.player.addItemToInventory(heldItem);
                    if (j != null)
                    {
                        Game1.createItemDebris(j, Game1.player.getStandingPosition(), Game1.player.FacingDirection);
                    }
                    heldItem = old_item;
                }
                else if (old_item != null)
                {
                    heldItem = old_item;
                }
                else if (heldItem != null && old_item == null && Game1.GetKeyboardState().IsKeyDown(Keys.LeftShift))
                {
                    Game1.player.addItemToInventory(heldItem);
                    heldItem = null;
                }
                if (old_item != dye_pot.item)
                {
                    _dyeDropAnimationFrames[index] = 0;
                    Game1.playSound("quickSlosh");
                    int count = 0;
                    for (int i = 0; i < dyePots.Count; i++)
                    {
                        if (dyePots[i].item != null)
                        {
                            count++;
                        }
                    }
                    if (count >= dyePots.Count)
                    {
                        DelayedAction.playSoundAfterDelay("newArtifact", 200);
                    }
                }
                _highlightDictionary = null;
                GenerateHighlightDictionary();
            }
            _UpdateDescriptionText();
        }
Пример #19
0
 public PurchaseAnimalsMenu(List <StardewValley.Object> stock) : base(Game1.viewport.Width / 2 - PurchaseAnimalsMenu.menuWidth / 2 - IClickableMenu.borderWidth * 2, Game1.viewport.Height / 2 - PurchaseAnimalsMenu.menuHeight - IClickableMenu.borderWidth * 2, PurchaseAnimalsMenu.menuWidth + IClickableMenu.borderWidth * 2, PurchaseAnimalsMenu.menuHeight + IClickableMenu.borderWidth, false)
 {
     this.height += Game1.tileSize;
     for (int i = 0; i < stock.Count; i++)
     {
         this.animalsToPurchase.Add(new ClickableTextureComponent(string.Concat(stock[i].salePrice()), new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth + i % 3 * Game1.tileSize * 2, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth / 2 + i / 3 * (Game1.tileSize + Game1.tileSize / 3), Game1.tileSize * 2, Game1.tileSize), null, stock[i].Name, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(i % 3 * 16 * 2, 448 + i / 3 * 16, 32, 16), 4f, stock[i].type == null)
         {
             item            = stock[i],
             myID            = i,
             rightNeighborID = ((i % 3 == 2) ? -1 : (i + 1)),
             leftNeighborID  = ((i % 3 == 0) ? -1 : (i - 1)),
             downNeighborID  = i + 3,
             upNeighborID    = i - 3
         });
     }
     this.okButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47, -1, -1), 1f, false)
     {
         myID           = 101,
         upNeighborID   = 103,
         leftNeighborID = 103
     };
     this.randomButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize * 4 / 5 + Game1.tileSize, Game1.viewport.Height / 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(381, 361, 10, 10), (float)Game1.pixelZoom, false)
     {
         myID            = 103,
         downNeighborID  = 101,
         rightNeighborID = 101
     };
     PurchaseAnimalsMenu.menuHeight = Game1.tileSize * 5;
     PurchaseAnimalsMenu.menuWidth  = Game1.tileSize * 7;
     this.textBox        = new TextBox(null, null, Game1.dialogueFont, Game1.textColor);
     this.textBox.X      = Game1.viewport.Width / 2 - Game1.tileSize * 3;
     this.textBox.Y      = Game1.viewport.Height / 2;
     this.textBox.Width  = Game1.tileSize * 4;
     this.textBox.Height = Game1.tileSize * 3;
     this.e         = new TextBoxEvent(this.textBoxEnter);
     this.textBoxCC = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(this.textBox.X, this.textBox.Y, 192, 48), "")
     {
         myID            = 104,
         rightNeighborID = 102,
         downNeighborID  = 101
     };
     this.randomButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.textBox.X + this.textBox.Width + Game1.tileSize + Game1.tileSize * 3 / 4 - Game1.pixelZoom * 2, Game1.viewport.Height / 2 + Game1.pixelZoom, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(381, 361, 10, 10), (float)Game1.pixelZoom, false)
     {
         myID            = 103,
         leftNeighborID  = 102,
         downNeighborID  = 101,
         rightNeighborID = 101
     };
     this.doneNamingButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.textBox.X + this.textBox.Width + Game1.tileSize / 2 + Game1.pixelZoom, Game1.viewport.Height / 2 - Game1.pixelZoom * 2, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false)
     {
         myID            = 102,
         rightNeighborID = 103,
         leftNeighborID  = 104,
         downNeighborID  = 101
     };
     if (Game1.options.SnappyMenus)
     {
         base.populateClickableComponentList();
         this.snapToDefaultClickableComponent();
     }
 }
Пример #20
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (Game1.globalFade)
     {
         return;
     }
     if (movingAnimal)
     {
         if (okButton != null && okButton.containsPoint(x, y))
         {
             Game1.globalFadeToBlack(prepareForReturnFromPlacement);
             Game1.playSound("smallSelect");
         }
         Vector2  clickTile = new Vector2((Game1.viewport.X + Game1.getOldMouseX(ui_scale: false)) / 64, (Game1.viewport.Y + Game1.getOldMouseY(ui_scale: false)) / 64);
         Building selection = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(clickTile);
         if (selection == null)
         {
             return;
         }
         if (selection.buildingType.Value.Contains(animal.buildingTypeILiveIn.Value))
         {
             if ((selection.indoors.Value as AnimalHouse).isFull())
             {
                 Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:AnimalQuery_Moving_BuildingFull"));
                 return;
             }
             if (selection.Equals(animal.home))
             {
                 Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:AnimalQuery_Moving_AlreadyHome"));
                 return;
             }
             (animal.home.indoors.Value as AnimalHouse).animalsThatLiveHere.Remove(animal.myID);
             if ((animal.home.indoors.Value as AnimalHouse).animals.ContainsKey(animal.myID))
             {
                 (selection.indoors.Value as AnimalHouse).animals.Add(animal.myID, animal);
                 (animal.home.indoors.Value as AnimalHouse).animals.Remove(animal.myID);
             }
             animal.home = selection;
             animal.homeLocation.Value = new Vector2((int)selection.tileX, (int)selection.tileY);
             (selection.indoors.Value as AnimalHouse).animalsThatLiveHere.Add(animal.myID);
             animal.makeSound();
             Game1.globalFadeToBlack(finishedPlacingAnimal);
         }
         else
         {
             Game1.showRedMessage(Game1.content.LoadString("Strings\\UI:AnimalQuery_Moving_CantLiveThere", animal.shortDisplayType()));
         }
         return;
     }
     if (confirmingSell)
     {
         if (yesButton.containsPoint(x, y))
         {
             Game1.player.Money += animal.getSellPrice();
             (animal.home.indoors.Value as AnimalHouse).animalsThatLiveHere.Remove(animal.myID);
             animal.health.Value = -1;
             if (animal.foundGrass != null && FarmAnimal.reservedGrass.Contains(animal.foundGrass))
             {
                 FarmAnimal.reservedGrass.Remove(animal.foundGrass);
             }
             int numClouds = animal.frontBackSourceRect.Width / 2;
             for (int i = 0; i < numClouds; i++)
             {
                 int nonRedness = Game1.random.Next(25, 200);
                 Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(5, animal.Position + new Vector2(Game1.random.Next(-32, animal.frontBackSourceRect.Width * 3), Game1.random.Next(-32, animal.frontBackSourceRect.Height * 3)), new Color(255 - nonRedness, 255, 255 - nonRedness), 8, flipped: false, (Game1.random.NextDouble() < 0.5) ? 50 : Game1.random.Next(30, 200), 0, 64, -1f, 64, (!(Game1.random.NextDouble() < 0.5)) ? Game1.random.Next(0, 600) : 0)
                 {
                     scale  = (float)Game1.random.Next(2, 5) * 0.25f,
                     alpha  = (float)Game1.random.Next(2, 5) * 0.25f,
                     motion = new Vector2(0f, (float)(0.0 - Game1.random.NextDouble()))
                 });
             }
             Game1.playSound("newRecipe");
             Game1.playSound("money");
             Game1.exitActiveMenu();
         }
         else if (noButton.containsPoint(x, y))
         {
             confirmingSell = false;
             Game1.playSound("smallSelect");
             if (Game1.options.SnappyMenus)
             {
                 currentlySnappedComponent = getComponentWithID(103);
                 snapCursorToCurrentSnappedComponent();
             }
         }
         return;
     }
     if (okButton != null && okButton.containsPoint(x, y) && readyToClose())
     {
         Game1.exitActiveMenu();
         if (textBox.Text.Length > 0 && !Utility.areThereAnyOtherAnimalsWithThisName(textBox.Text))
         {
             animal.displayName = textBox.Text;
             animal.Name        = textBox.Text;
         }
         Game1.playSound("smallSelect");
     }
     if (sellButton.containsPoint(x, y))
     {
         confirmingSell = true;
         yesButton      = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(Game1.uiViewport.Width / 2 - 64 - 4, Game1.uiViewport.Height / 2 - 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
         {
             myID            = 111,
             rightNeighborID = 105
         };
         noButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(Game1.uiViewport.Width / 2 + 4, Game1.uiViewport.Height / 2 - 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
         {
             myID           = 105,
             leftNeighborID = 111
         };
         Game1.playSound("smallSelect");
         if (Game1.options.SnappyMenus)
         {
             populateClickableComponentList();
             currentlySnappedComponent = noButton;
             snapCursorToCurrentSnappedComponent();
         }
         return;
     }
     if (moveHomeButton.containsPoint(x, y))
     {
         Game1.playSound("smallSelect");
         Game1.globalFadeToBlack(prepareForAnimalPlacement);
     }
     if (allowReproductionButton != null && allowReproductionButton.containsPoint(x, y))
     {
         Game1.playSound("drumkit6");
         animal.allowReproduction.Value = !animal.allowReproduction;
         if ((bool)animal.allowReproduction)
         {
             allowReproductionButton.sourceRect.X = 128;
         }
         else
         {
             allowReproductionButton.sourceRect.X = 137;
         }
     }
     textBox.Update();
 }
 // Token: 0x06000DB9 RID: 3513 RVA: 0x00116F10 File Offset: 0x00115110
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (!this.placingStructure)
     {
         this.heldItem = this.inventory.leftClick(x, y, this.heldItem, true);
         for (int i = 0; i < this.sideTabs.Count; i++)
         {
             if (this.sideTabs[i].containsPoint(x, y) && this.currentTab != i)
             {
                 Game1.playSound("smallSelect");
                 if (i == 3)
                 {
                     this.placingStructure = true;
                     this.demolishing      = true;
                     this.parent.invisible = true;
                 }
                 else
                 {
                     ClickableTextureComponent expr_8F_cp_0_cp_0 = this.sideTabs[this.currentTab];
                     expr_8F_cp_0_cp_0.bounds.X = expr_8F_cp_0_cp_0.bounds.X - CataloguePage.widthToMoveActiveTab;
                     this.currentTab            = i;
                     ClickableTextureComponent expr_B5_cp_0_cp_0 = this.sideTabs[i];
                     expr_B5_cp_0_cp_0.bounds.X = expr_B5_cp_0_cp_0.bounds.X + CataloguePage.widthToMoveActiveTab;
                 }
             }
         }
         using (Dictionary <ClickableComponent, BluePrint> .KeyCollection.Enumerator enumerator = this.blueprintButtons[this.currentTab].Keys.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ClickableComponent c = enumerator.Current;
                 if (c.containsPoint(x, y))
                 {
                     if (this.blueprintButtons[this.currentTab][c].doesFarmerHaveEnoughResourcesToBuild())
                     {
                         this.structureForPlacement = this.blueprintButtons[this.currentTab][c];
                         this.placingStructure      = true;
                         this.parent.invisible      = true;
                         if (this.currentTab == 1)
                         {
                             this.upgrading = true;
                         }
                         Game1.playSound("smallSelect");
                         break;
                     }
                     Game1.addHUDMessage(new HUDMessage("Not Enough Resources", Color.Red, 3500f));
                     break;
                 }
             }
             return;
         }
     }
     if (this.demolishing)
     {
         if (!(Game1.currentLocation is Farm))
         {
             return;
         }
         if (Game1.IsClient)
         {
             Game1.addHUDMessage(new HUDMessage("Only the farm owner can demolish.", Color.Red, 3500f));
             return;
         }
         Vector2  tileLocation = new Vector2((float)((Game1.viewport.X + Game1.getOldMouseX()) / Game1.tileSize), (float)((Game1.viewport.Y + Game1.getOldMouseY()) / Game1.tileSize));
         Building destroyed    = ((Farm)Game1.currentLocation).getBuildingAt(tileLocation);
         if (Game1.IsMultiplayer && destroyed != null && destroyed.indoors.farmers.Count > 0)
         {
             Game1.addHUDMessage(new HUDMessage("Someone's in there!", Color.Red, 3500f));
             return;
         }
         if (destroyed == null || !((Farm)Game1.currentLocation).destroyStructure(destroyed))
         {
             this.parent.invisible = false;
             this.placingStructure = false;
             this.demolishing      = false;
             return;
         }
         int groundYTile = destroyed.tileY + destroyed.tilesHigh;
         for (int j = 0; j < destroyed.texture.Bounds.Height / Game1.tileSize; j++)
         {
             Game1.createRadialDebris(Game1.currentLocation, destroyed.texture, new Microsoft.Xna.Framework.Rectangle(destroyed.texture.Bounds.Center.X, destroyed.texture.Bounds.Center.Y, Game1.tileSize / 16, Game1.tileSize / 16), destroyed.tileX + Game1.random.Next(destroyed.tilesWide), destroyed.tileY + destroyed.tilesHigh - j, Game1.random.Next(20, 45), groundYTile);
         }
         Game1.playSound("explosion");
         Utility.spreadAnimalsAround(destroyed, (Farm)Game1.currentLocation);
         if (Game1.IsServer)
         {
             MultiplayerUtility.broadcastBuildingChange(1, tileLocation, "", Game1.currentLocation.name, Game1.player.uniqueMultiplayerID);
             return;
         }
     }
     else
     {
         if (this.upgrading && Game1.currentLocation.GetType() == typeof(Farm))
         {
             (Game1.currentLocation as Farm).tryToUpgrade(((Farm)Game1.getLocationFromName("Farm")).getBuildingAt(new Vector2((float)((Game1.viewport.X + Game1.getOldMouseX()) / Game1.tileSize), (float)((Game1.viewport.Y + Game1.getOldMouseY()) / Game1.tileSize))), this.structureForPlacement);
             return;
         }
         if (!CataloguePage.canPlaceThisBuildingOnTheCurrentMap(this.structureForPlacement, Game1.currentLocation))
         {
             Game1.addHUDMessage(new HUDMessage("You can't build that in this location.", Color.Red, 3500f));
             return;
         }
         if (!this.structureForPlacement.doesFarmerHaveEnoughResourcesToBuild())
         {
             Game1.addHUDMessage(new HUDMessage("Not Enough Resources", Color.Red, 3500f));
             return;
         }
         if (this.tryToBuild())
         {
             this.structureForPlacement.consumeResources();
             if (!this.structureForPlacement.blueprintType.Equals("Animals"))
             {
                 Game1.playSound("axe");
                 return;
             }
         }
         else if (!Game1.IsClient)
         {
             Game1.addHUDMessage(new HUDMessage("Can't Build There", Color.Red, 3500f));
         }
     }
 }
Пример #22
0
 public AnimalQueryMenu(FarmAnimal animal)
     : base(Game1.uiViewport.Width / 2 - width / 2, Game1.uiViewport.Height / 2 - height / 2, width, height)
 {
     Game1.player.Halt();
     Game1.player.faceGeneralDirection(animal.Position, 0, opposite: false, useTileCalculations: false);
     width          = 384;
     height         = 512;
     this.animal    = animal;
     textBox        = new TextBox(null, null, Game1.dialogueFont, Game1.textColor);
     textBox.X      = Game1.uiViewport.Width / 2 - 128 - 12;
     textBox.Y      = yPositionOnScreen - 4 + 128;
     textBox.Width  = 256;
     textBox.Height = 192;
     textBoxCC      = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(textBox.X, textBox.Y, textBox.Width, 64), "")
     {
         myID           = 110,
         downNeighborID = 104
     };
     textBox.Text = animal.displayName;
     Game1.keyboardDispatcher.Subscriber = textBox;
     textBox.Selected = false;
     if ((long)animal.parentId != -1)
     {
         FarmAnimal parent = Utility.getAnimal(animal.parentId);
         if (parent != null)
         {
             parentName = parent.displayName;
         }
     }
     if (animal.sound.Value != null && Game1.soundBank != null && !Game1.options.muteAnimalSounds)
     {
         ICue cue = Game1.soundBank.GetCue(animal.sound.Value);
         cue.SetVariable("Pitch", 1200 + Game1.random.Next(-200, 201));
         cue.Play();
     }
     okButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 64 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
     {
         myID         = 101,
         upNeighborID = -99998
     };
     sellButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 192 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(0, 384, 16, 16), 4f)
     {
         myID           = 103,
         downNeighborID = -99998,
         upNeighborID   = 104
     };
     moveHomeButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 256 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(16, 384, 16, 16), 4f)
     {
         myID           = 104,
         downNeighborID = 103,
         upNeighborID   = 110
     };
     if (!animal.isBaby() && !animal.isCoopDweller() && animal.CanHavePregnancy())
     {
         allowReproductionButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + height - 128 - IClickableMenu.borderWidth + 8, 36, 36), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(animal.allowReproduction ? 128 : 137, 393, 9, 9), 4f)
         {
             myID           = 106,
             downNeighborID = 101,
             upNeighborID   = 103
         };
     }
     love = new ClickableTextureComponent(Math.Round((double)(int)animal.friendshipTowardFarmer, 0) / 10.0 + "<", new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + 32 + 16, yPositionOnScreen - 32 + IClickableMenu.spaceToClearTopBorder + 256 - 32, width - 128, 64), null, "Friendship", Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(172, 512, 16, 16), 4f)
     {
         myID = 102
     };
     loveHover = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + IClickableMenu.spaceToClearSideBorder, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + 192 - 32, width, 64), "Friendship")
     {
         myID = 109
     };
     fullnessLevel = (float)(int)(byte)animal.fullness / 255f;
     if (animal.home != null && animal.home.indoors.Value != null)
     {
         int piecesHay = animal.home.indoors.Value.numberOfObjectsWithName("Hay");
         if (piecesHay > 0)
         {
             int numAnimals = (animal.home.indoors.Value as AnimalHouse).animalsThatLiveHere.Count;
             fullnessLevel = Math.Min(1.0, fullnessLevel + (double)piecesHay / (double)numAnimals);
         }
     }
     else
     {
         Utility.fixAllAnimals();
     }
     happinessLevel = (float)(int)(byte)animal.happiness / 255f;
     loveLevel      = (float)(int)animal.friendshipTowardFarmer / 1000f;
     if (Game1.options.SnappyMenus)
     {
         populateClickableComponentList();
         snapToDefaultClickableComponent();
     }
 }
Пример #23
0
        public CollectionsPage(int x, int y, int width, int height) : base(x, y, width, height, false)
        {
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4 + CollectionsPage.widthToMoveActiveTab, this.yPositionOnScreen + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Shipped", new object[0]), Game1.mouseCursors, new Rectangle(640, 80, 16, 16), (float)Game1.pixelZoom, false)
            {
                myID            = 7001,
                downNeighborID  = 7002,
                rightNeighborID = 0
            });
            this.collections.Add(0, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 3, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Fish", new object[0]), Game1.mouseCursors, new Rectangle(640, 64, 16, 16), (float)Game1.pixelZoom, false)
            {
                myID            = 7002,
                upNeighborID    = 7001,
                downNeighborID  = 7003,
                rightNeighborID = 0
            });
            this.collections.Add(1, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 4, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Artifacts", new object[0]), Game1.mouseCursors, new Rectangle(656, 64, 16, 16), (float)Game1.pixelZoom, false)
            {
                myID            = 7003,
                upNeighborID    = 7002,
                downNeighborID  = 7004,
                rightNeighborID = 0
            });
            this.collections.Add(2, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 5, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Minerals", new object[0]), Game1.mouseCursors, new Rectangle(672, 64, 16, 16), (float)Game1.pixelZoom, false)
            {
                myID            = 7004,
                upNeighborID    = 7003,
                downNeighborID  = 7005,
                rightNeighborID = 0
            });
            this.collections.Add(3, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 6, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Cooking", new object[0]), Game1.mouseCursors, new Rectangle(688, 64, 16, 16), (float)Game1.pixelZoom, false)
            {
                myID            = 7005,
                upNeighborID    = 7004,
                downNeighborID  = 7006,
                rightNeighborID = 0
            });
            this.collections.Add(4, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 7, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Achievements", new object[0]), Game1.mouseCursors, new Rectangle(656, 80, 16, 16), (float)Game1.pixelZoom, false)
            {
                myID            = 7006,
                upNeighborID    = 7005,
                rightNeighborID = 0
            });
            this.collections.Add(5, new List <List <ClickableTextureComponent> >());
            CollectionsPage.widthToMoveActiveTab = Game1.tileSize / 8;
            this.backButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false)
            {
                myID            = 706,
                rightNeighborID = -7777
            };
            this.forwardButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2 - 15 * Game1.pixelZoom, this.yPositionOnScreen + height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false)
            {
                myID           = 707,
                leftNeighborID = -7777
            };
            int[] array = new int[this.sideTabs.Count];
            int   num   = this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder;
            int   num2  = this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - Game1.tileSize / 4;
            int   num3  = 10;

            foreach (KeyValuePair <int, string> current in Game1.objectInformation)
            {
                string text = current.Value.Split(new char[]
                {
                    '/'
                })[3];
                bool drawShadow = false;
                int  num4;
                if (text.Contains("Arch"))
                {
                    num4 = 2;
                    if (Game1.player.archaeologyFound.ContainsKey(current.Key))
                    {
                        drawShadow = true;
                    }
                }
                else if (text.Contains("Fish"))
                {
                    if (current.Key >= 167 && current.Key < 173)
                    {
                        continue;
                    }
                    num4 = 1;
                    if (Game1.player.fishCaught.ContainsKey(current.Key))
                    {
                        drawShadow = true;
                    }
                }
                else if (text.Contains("Mineral") || text.Substring(text.Length - 3).Equals("-2"))
                {
                    num4 = 3;
                    if (Game1.player.mineralsFound.ContainsKey(current.Key))
                    {
                        drawShadow = true;
                    }
                }
                else if (text.Contains("Cooking") || text.Substring(text.Length - 3).Equals("-7"))
                {
                    num4 = 4;
                    if (Game1.player.recipesCooked.ContainsKey(current.Key))
                    {
                        drawShadow = true;
                    }
                    if (current.Key == 217 || current.Key == 772)
                    {
                        continue;
                    }
                    if (current.Key == 773)
                    {
                        continue;
                    }
                }
                else
                {
                    if (!StardewValley.Object.isPotentialBasicShippedCategory(current.Key, text.Substring(text.Length - 3)))
                    {
                        continue;
                    }
                    num4 = 0;
                    if (Game1.player.basicShipped.ContainsKey(current.Key))
                    {
                        drawShadow = true;
                    }
                }
                int x2   = num + array[num4] % num3 * (Game1.tileSize + 4);
                int num5 = num2 + array[num4] / num3 * (Game1.tileSize + 4);
                if (num5 > this.yPositionOnScreen + height - 128)
                {
                    this.collections[num4].Add(new List <ClickableTextureComponent>());
                    array[num4] = 0;
                    x2          = num;
                    num5        = num2;
                }
                if (this.collections[num4].Count == 0)
                {
                    this.collections[num4].Add(new List <ClickableTextureComponent>());
                }
                this.collections[num4].Last <List <ClickableTextureComponent> >().Add(new ClickableTextureComponent(current.Key + " " + drawShadow.ToString(), new Rectangle(x2, num5, Game1.tileSize, Game1.tileSize), null, "", Game1.objectSpriteSheet, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, current.Key, 16, 16), (float)Game1.pixelZoom, drawShadow)
                {
                    myID            = this.collections[num4].Last <List <ClickableTextureComponent> >().Count,
                    rightNeighborID = (((this.collections[num4].Last <List <ClickableTextureComponent> >().Count + 1) % num3 == 0) ? -1 : (this.collections[num4].Last <List <ClickableTextureComponent> >().Count + 1)),
                    leftNeighborID  = ((this.collections[num4].Last <List <ClickableTextureComponent> >().Count % num3 == 0) ? 7001 : (this.collections[num4].Last <List <ClickableTextureComponent> >().Count - 1)),
                    downNeighborID  = ((num5 + (Game1.tileSize + 4) > this.yPositionOnScreen + height - 128) ? -7777 : (this.collections[num4].Last <List <ClickableTextureComponent> >().Count + num3)),
                    upNeighborID    = ((this.collections[num4].Last <List <ClickableTextureComponent> >().Count < num3) ? 12345 : (this.collections[num4].Last <List <ClickableTextureComponent> >().Count - num3)),
                    fullyImmutable  = true
                });
                array[num4]++;
            }
            if (this.collections[5].Count == 0)
            {
                this.collections[5].Add(new List <ClickableTextureComponent>());
            }
            foreach (KeyValuePair <int, string> current2 in Game1.achievements)
            {
                bool     flag   = Game1.player.achievements.Contains(current2.Key);
                string[] array2 = current2.Value.Split(new char[]
                {
                    '^'
                });
                if (flag || (array2[2].Equals("true") && (array2[3].Equals("-1") || this.farmerHasAchievements(array2[3]))))
                {
                    int x3 = num + array[5] % num3 * (Game1.tileSize + 4);
                    int y2 = num2 + array[5] / num3 * (Game1.tileSize + 4);
                    this.collections[5][0].Add(new ClickableTextureComponent(current2.Key + " " + flag.ToString(), new Rectangle(x3, y2, Game1.tileSize, Game1.tileSize), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 25, -1, -1), 1f, false));
                    array[5]++;
                }
            }
        }
Пример #24
0
        public QuestLog()
            : base(0, 0, 0, 0, showUpperRightCloseButton: true)
        {
            Game1.dayTimeMoneyBox.DismissQuestPing();
            Game1.playSound("bigSelect");
            paginateQuests();
            width  = 832;
            height = 576;
            if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.fr)
            {
                height += 64;
            }
            Vector2 topLeft = Utility.getTopLeftPositionForCenteringOnScreen(width, height);

            xPositionOnScreen = (int)topLeft.X;
            yPositionOnScreen = (int)topLeft.Y + 32;
            questLogButtons   = new List <ClickableComponent>();
            for (int i = 0; i < 6; i++)
            {
                questLogButtons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 16, yPositionOnScreen + 16 + i * ((height - 32) / 6), width - 32, (height - 32) / 6 + 4), string.Concat(i))
                {
                    myID            = i,
                    downNeighborID  = -7777,
                    upNeighborID    = ((i > 0) ? (i - 1) : (-1)),
                    rightNeighborID = -7777,
                    leftNeighborID  = -7777,
                    fullyImmutable  = true
                });
            }
            upperRightCloseButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width - 20, yPositionOnScreen - 8, 48, 48), Game1.mouseCursors, new Rectangle(337, 494, 12, 12), 4f);
            backButton            = new ClickableTextureComponent(new Rectangle(xPositionOnScreen - 64, yPositionOnScreen + 8, 48, 44), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), 4f)
            {
                myID            = 102,
                rightNeighborID = -7777
            };
            forwardButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 64 - 48, yPositionOnScreen + height - 48, 48, 44), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), 4f)
            {
                myID = 101
            };
            rewardBox = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width / 2 - 80, yPositionOnScreen + height - 32 - 96, 96, 96), Game1.mouseCursors, new Rectangle(293, 360, 24, 24), 4f, drawShadow: true)
            {
                myID = 103
            };
            cancelQuestButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + 4, yPositionOnScreen + height + 4, 48, 48), Game1.mouseCursors, new Rectangle(322, 498, 12, 12), 4f, drawShadow: true)
            {
                myID = 104
            };
            int scrollbar_x = xPositionOnScreen + width + 16;

            upArrow                = new ClickableTextureComponent(new Rectangle(scrollbar_x, yPositionOnScreen + 96, 44, 48), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), 4f);
            downArrow              = new ClickableTextureComponent(new Rectangle(scrollbar_x, yPositionOnScreen + height - 64, 44, 48), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), 4f);
            scrollBarBounds        = default(Rectangle);
            scrollBarBounds.X      = upArrow.bounds.X + 12;
            scrollBarBounds.Width  = 24;
            scrollBarBounds.Y      = upArrow.bounds.Y + upArrow.bounds.Height + 4;
            scrollBarBounds.Height = downArrow.bounds.Y - 4 - scrollBarBounds.Y;
            scrollBar              = new ClickableTextureComponent(new Rectangle(scrollBarBounds.X, scrollBarBounds.Y, 24, 40), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), 4f);
            if (Game1.options.SnappyMenus)
            {
                populateClickableComponentList();
                snapToDefaultClickableComponent();
            }
        }
Пример #25
0
        public AnimalQueryMenu(FarmAnimal animal)
            : base(Game1.viewport.Width / 2 - AnimalQueryMenu.width / 2, Game1.viewport.Height / 2 - AnimalQueryMenu.height / 2, AnimalQueryMenu.width, AnimalQueryMenu.height, false)
        {
            Game1.player.Halt();
            Game1.player.faceGeneralDirection(animal.position, 0);
            AnimalQueryMenu.width  = Game1.tileSize * 6;
            AnimalQueryMenu.height = Game1.tileSize * 8;
            this.animal            = animal;
            this.textBox           = new TextBox((Texture2D)null, (Texture2D)null, Game1.dialogueFont, Game1.textColor);
            this.textBox.X         = Game1.viewport.Width / 2 - Game1.tileSize * 2 - 12;
            this.textBox.Y         = this.yPositionOnScreen - 4 + Game1.tileSize * 2;
            this.textBox.Width     = Game1.tileSize * 4;
            this.textBox.Height    = Game1.tileSize * 3;
            this.textBoxCC         = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(this.textBox.X, this.textBox.Y, this.textBox.Width, Game1.tileSize), "")
            {
                myID           = 110,
                downNeighborID = 104
            };
            this.textBox.Text = animal.displayName;
            Game1.keyboardDispatcher.Subscriber = (IKeyboardSubscriber)this.textBox;
            this.textBox.Selected = false;
            if (animal.parentId != -1L)
            {
                FarmAnimal animal1 = Utility.getAnimal(animal.parentId);
                if (animal1 != null)
                {
                    this.parentName = animal1.displayName;
                }
            }
            if (animal.sound != null && Game1.soundBank != null)
            {
                Cue    cue  = Game1.soundBank.GetCue(animal.sound);
                string name = "Pitch";
                double num  = (double)(1200 + Game1.random.Next(-200, 201));
                cue.SetVariable(name, (float)num);
                cue.Play();
            }
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            int num1 = 101;

            textureComponent1.myID = num1;
            int num2 = 103;

            textureComponent1.upNeighborID = num2;
            this.okButton = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 3 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(0, 384, 16, 16), 4f, false);
            int num3 = 103;

            textureComponent2.myID = num3;
            int num4 = 101;

            textureComponent2.downNeighborID = num4;
            int num5 = 104;

            textureComponent2.upNeighborID = num5;
            this.sellButton = textureComponent2;
            ClickableTextureComponent textureComponent3 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 4 - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(16, 384, 16, 16), 4f, false);
            int num6 = 104;

            textureComponent3.myID = num6;
            int num7 = 103;

            textureComponent3.downNeighborID = num7;
            int num8 = 110;

            textureComponent3.upNeighborID = num8;
            this.moveHomeButton            = textureComponent3;
            if (!animal.isBaby() && !animal.isCoopDweller())
            {
                ClickableTextureComponent textureComponent4 = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + AnimalQueryMenu.width + Game1.pixelZoom * 4, this.yPositionOnScreen + AnimalQueryMenu.height - Game1.tileSize * 2 - IClickableMenu.borderWidth + Game1.pixelZoom * 2, Game1.pixelZoom * 9, Game1.pixelZoom * 9), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(animal.allowReproduction ? 128 : 137, 393, 9, 9), 4f, false);
                int num9 = 106;
                textureComponent4.myID       = num9;
                this.allowReproductionButton = textureComponent4;
            }
            ClickableTextureComponent textureComponent5 = new ClickableTextureComponent((Math.Round((double)animal.friendshipTowardFarmer, 0) / 10.0).ToString() + "<", new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder + Game1.tileSize / 2 + 16, this.yPositionOnScreen - Game1.tileSize / 2 + IClickableMenu.spaceToClearTopBorder + Game1.tileSize * 4 - Game1.tileSize / 2, AnimalQueryMenu.width - Game1.tileSize * 2, Game1.tileSize), (string)null, "Friendship", Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(172, 512, 16, 16), 4f, false);
            int num10 = 102;

            textureComponent5.myID = num10;
            this.love      = textureComponent5;
            this.loveHover = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + IClickableMenu.spaceToClearSideBorder, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + Game1.tileSize * 3 - Game1.tileSize / 2, AnimalQueryMenu.width, Game1.tileSize), "Friendship")
            {
                myID = 109
            };
            this.fullnessLevel = (double)animal.fullness / (double)byte.MaxValue;
            if (animal.home != null && animal.home.indoors != null)
            {
                int num9 = animal.home.indoors.numberOfObjectsWithName("Hay");
                if (num9 > 0)
                {
                    int count = (animal.home.indoors as AnimalHouse).animalsThatLiveHere.Count;
                    this.fullnessLevel = Math.Min(1.0, this.fullnessLevel + (double)num9 / (double)count);
                }
            }
            else
            {
                Utility.fixAllAnimals();
            }
            this.happinessLevel = (double)animal.happiness / (double)byte.MaxValue;
            this.loveLevel      = (double)animal.friendshipTowardFarmer / 1000.0;
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }
Пример #26
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (Game1.globalFade)
     {
         return;
     }
     if (confirmingEmpty)
     {
         if (yesButton.containsPoint(x, y))
         {
             Game1.playSound("fishSlap");
             _pond.ClearPond();
             exitThisMenu();
         }
         else if (noButton.containsPoint(x, y))
         {
             confirmingEmpty = false;
             Game1.playSound("smallSelect");
             if (Game1.options.SnappyMenus)
             {
                 currentlySnappedComponent = getComponentWithID(103);
                 snapCursorToCurrentSnappedComponent();
             }
         }
         return;
     }
     if (okButton != null && okButton.containsPoint(x, y) && readyToClose())
     {
         Game1.exitActiveMenu();
         Game1.playSound("smallSelect");
     }
     if (changeNettingButton.containsPoint(x, y))
     {
         Game1.playSound("drumkit6");
         _pond.nettingStyle.Value++;
         _pond.nettingStyle.Value %= 4;
     }
     else if (emptyButton.containsPoint(x, y))
     {
         _confirmationBoxRectangle   = new Rectangle(0, 0, 400, 100);
         _confirmationBoxRectangle.X = Game1.uiViewport.Width / 2 - _confirmationBoxRectangle.Width / 2;
         _confirmationText           = Game1.content.LoadString("Strings\\UI:PondQuery_ConfirmEmpty");
         _confirmationText           = Game1.parseText(_confirmationText, Game1.smallFont, _confirmationBoxRectangle.Width);
         Vector2 text_size = Game1.smallFont.MeasureString(_confirmationText);
         _confirmationBoxRectangle.Height = (int)text_size.Y;
         _confirmationBoxRectangle.Y      = Game1.uiViewport.Height / 2 - _confirmationBoxRectangle.Height / 2;
         confirmingEmpty = true;
         yesButton       = new ClickableTextureComponent(new Rectangle(Game1.uiViewport.Width / 2 - 64 - 4, _confirmationBoxRectangle.Bottom + 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
         {
             myID            = 111,
             rightNeighborID = 105
         };
         noButton = new ClickableTextureComponent(new Rectangle(Game1.uiViewport.Width / 2 + 4, _confirmationBoxRectangle.Bottom + 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
         {
             myID           = 105,
             leftNeighborID = 111
         };
         Game1.playSound("smallSelect");
         if (Game1.options.SnappyMenus)
         {
             populateClickableComponentList();
             currentlySnappedComponent = noButton;
             snapCursorToCurrentSnappedComponent();
         }
     }
 }
Пример #27
0
 public OptionsPage(int x, int y, int width, int height) : base(x, y, width, height, false)
 {
     this.upArrow         = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), (float)Game1.pixelZoom, false);
     this.downArrow       = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + width + Game1.tileSize / 4, this.yPositionOnScreen + height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), (float)Game1.pixelZoom, false);
     this.scrollBar       = new ClickableTextureComponent(new Rectangle(this.upArrow.bounds.X + Game1.pixelZoom * 3, this.upArrow.bounds.Y + this.upArrow.bounds.Height + Game1.pixelZoom, 6 * Game1.pixelZoom, 10 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), (float)Game1.pixelZoom, false);
     this.scrollBarRunner = new Rectangle(this.scrollBar.bounds.X, this.upArrow.bounds.Y + this.upArrow.bounds.Height + Game1.pixelZoom, this.scrollBar.bounds.Width, height - Game1.tileSize * 2 - this.upArrow.bounds.Height - Game1.pixelZoom * 2);
     for (int i = 0; i < 7; i++)
     {
         this.optionSlots.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * ((height - Game1.tileSize * 2) / 7), width - Game1.tileSize / 2, (height - Game1.tileSize * 2) / 7 + Game1.pixelZoom), string.Concat(i))
         {
             myID           = i,
             downNeighborID = ((i < 6) ? (i + 1) : -7777),
             upNeighborID   = ((i > 0) ? (i - 1) : -7777),
             fullyImmutable = true
         });
     }
     this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11233", new object[0])));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11234", new object[0]), 0, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11235", new object[0]), 7, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11236", new object[0]), 8, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11237", new object[0]), 11, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11238", new object[0]), 12, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11239", new object[0]), 27, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11240", new object[0]), 14, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:Options_GamepadStyleMenus", new object[0]), 29, -1, -1));
     this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11241", new object[0])));
     this.options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11242", new object[0]), 1, -1, -1));
     this.options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11243", new object[0]), 2, -1, -1));
     this.options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11244", new object[0]), 20, -1, -1));
     this.options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11245", new object[0]), 21, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11246", new object[0]), 3, -1, -1));
     this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11247", new object[0])));
     if (!Game1.conventionMode)
     {
         this.options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11248", new object[0]), 13, -1, -1));
         this.options.Add(new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11251", new object[0]), 6, -1, -1));
     }
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11252", new object[0]), 9, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11253", new object[0]), 15, -1, -1));
     this.options.Add(new OptionsPlusMinus(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11254", new object[0]), 18, new List <string>
     {
         "75%",
         "80%",
         "85%",
         "90%",
         "95%",
         "100%",
         "105%",
         "110%",
         "115%",
         "120%",
         "125%"
     }, new List <string>
     {
         "75%",
         "80%",
         "85%",
         "90%",
         "95%",
         "100%",
         "105%",
         "110%",
         "115%",
         "120%",
         "125%"
     }, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11266", new object[0]), 19, -1, -1));
     this.options.Add(new OptionsPlusMinus(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11267", new object[0]), 25, new List <string>
     {
         "Low",
         "Med.",
         "High"
     }, new List <string>
     {
         Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11268", new object[0]),
         Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11269", new object[0]),
         Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11270", new object[0])
     }, -1, -1));
     this.options.Add(new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11271", new object[0]), 23, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11272", new object[0]), 24, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11273", new object[0]), 26, -1, -1));
     this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11274", new object[0])));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11275", new object[0]), 16, -1, -1));
     this.options.Add(new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11276", new object[0]), 22, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11277", new object[0]), -1, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11278", new object[0]), 7, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11279", new object[0]), 10, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11280", new object[0]), 15, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11281", new object[0]), 18, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11282", new object[0]), 19, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11283", new object[0]), 11, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11284", new object[0]), 14, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11285", new object[0]), 13, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11286", new object[0]), 12, this.optionSlots[0].bounds.Width, -1, -1));
     if (Game1.IsMultiplayer)
     {
         this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11287", new object[0]), 17, this.optionSlots[0].bounds.Width, -1, -1));
     }
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11288", new object[0]), 16, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11289", new object[0]), 20, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11290", new object[0]), 21, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11291", new object[0]), 22, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11292", new object[0]), 23, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11293", new object[0]), 24, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11294", new object[0]), 25, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11295", new object[0]), 26, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11296", new object[0]), 27, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11297", new object[0]), 28, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11298", new object[0]), 29, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11299", new object[0]), 30, this.optionSlots[0].bounds.Width, -1, -1));
     this.options.Add(new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11300", new object[0]), 31, this.optionSlots[0].bounds.Width, -1, -1));
 }
Пример #28
0
        public LevelUpMenu(int skill, int level)
            : base(Game1.viewport.Width / 2 - 384, Game1.viewport.Height / 2 - 256, 768, 512)
        {
            Game1.player.team.endOfNightStatus.UpdateState("level");
            timerBeforeStart = 250;
            isActive         = true;
            width            = 960;
            height           = 512;
            okButton         = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 64 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
            {
                myID = 101
            };
            newCraftingRecipes.Clear();
            extraInfoForLevel.Clear();
            Game1.player.completelyStopAnimatingOrDoingAction();
            informationUp       = true;
            isProfessionChooser = false;
            currentLevel        = level;
            currentSkill        = skill;
            if (level == 10)
            {
                Game1.getSteamAchievement("Achievement_SingularTalent");
                if ((int)Game1.player.farmingLevel == 10 && (int)Game1.player.miningLevel == 10 && (int)Game1.player.fishingLevel == 10 && (int)Game1.player.foragingLevel == 10 && (int)Game1.player.combatLevel == 10)
                {
                    Game1.getSteamAchievement("Achievement_MasterOfTheFiveWays");
                }
                if (skill == 0)
                {
                    Game1.addMailForTomorrow("marnieAutoGrabber");
                }
            }
            title             = Game1.content.LoadString("Strings\\UI:LevelUp_Title", currentLevel, Farmer.getSkillDisplayNameFromIndex(currentSkill));
            extraInfoForLevel = getExtraInfoForLevel(currentSkill, currentLevel);
            switch (currentSkill)
            {
            case 0:
                sourceRectForLevelIcon = new Rectangle(0, 0, 16, 16);
                break;

            case 1:
                sourceRectForLevelIcon = new Rectangle(16, 0, 16, 16);
                break;

            case 3:
                sourceRectForLevelIcon = new Rectangle(32, 0, 16, 16);
                break;

            case 2:
                sourceRectForLevelIcon = new Rectangle(80, 0, 16, 16);
                break;

            case 4:
                sourceRectForLevelIcon = new Rectangle(128, 16, 16, 16);
                break;

            case 5:
                sourceRectForLevelIcon = new Rectangle(64, 0, 16, 16);
                break;
            }
            if ((currentLevel == 5 || currentLevel == 10) && currentSkill != 5)
            {
                professionsToChoose.Clear();
                isProfessionChooser = true;
            }
            int newHeight = 0;

            foreach (KeyValuePair <string, string> v2 in CraftingRecipe.craftingRecipes)
            {
                string conditions2 = v2.Value.Split('/')[4];
                if (conditions2.Contains(Farmer.getSkillNameFromIndex(currentSkill)) && conditions2.Contains(string.Concat(currentLevel)))
                {
                    newCraftingRecipes.Add(new CraftingRecipe(v2.Key, isCookingRecipe: false));
                    if (!Game1.player.craftingRecipes.ContainsKey(v2.Key))
                    {
                        Game1.player.craftingRecipes.Add(v2.Key, 0);
                    }
                    newHeight += (newCraftingRecipes.Last().bigCraftable ? 128 : 64);
                }
            }
            foreach (KeyValuePair <string, string> v in CraftingRecipe.cookingRecipes)
            {
                string conditions = v.Value.Split('/')[3];
                if (conditions.Contains(Farmer.getSkillNameFromIndex(currentSkill)) && conditions.Contains(string.Concat(currentLevel)))
                {
                    newCraftingRecipes.Add(new CraftingRecipe(v.Key, isCookingRecipe: true));
                    if (!Game1.player.cookingRecipes.ContainsKey(v.Key))
                    {
                        Game1.player.cookingRecipes.Add(v.Key, 0);
                        if (!Game1.player.hasOrWillReceiveMail("robinKitchenLetter"))
                        {
                            Game1.mailbox.Add("robinKitchenLetter");
                        }
                    }
                    newHeight += (newCraftingRecipes.Last().bigCraftable ? 128 : 64);
                }
            }
            height = newHeight + 256 + extraInfoForLevel.Count * 64 * 3 / 4;
            Game1.player.freezePause = 100;
            gameWindowSizeChanged(Rectangle.Empty, Rectangle.Empty);
            if (isProfessionChooser)
            {
                leftProfession = new ClickableComponent(new Rectangle(xPositionOnScreen, yPositionOnScreen + 128, width / 2, height), "")
                {
                    myID            = 102,
                    rightNeighborID = 103
                };
                rightProfession = new ClickableComponent(new Rectangle(width / 2 + xPositionOnScreen, yPositionOnScreen + 128, width / 2, height), "")
                {
                    myID           = 103,
                    leftNeighborID = 102
                };
            }
            populateClickableComponentList();
        }
Пример #29
0
        public Collections_Buy_Back(int x, int y, int width, int height) : base(x, y, width, height, false)
        {
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4 + CollectionsPage.widthToMoveActiveTab, this.yPositionOnScreen + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), "", "Items Shipped (Farm & Forage)", Game1.mouseCursors, new Rectangle(640, 80, 16, 16), (float)Game1.pixelZoom));
            this.collections.Add(0, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 3, Game1.tileSize, Game1.tileSize), "", "Fish", Game1.mouseCursors, new Rectangle(640, 64, 16, 16), (float)Game1.pixelZoom));
            this.collections.Add(1, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 4, Game1.tileSize, Game1.tileSize), "", "Artifacts", Game1.mouseCursors, new Rectangle(656, 64, 16, 16), (float)Game1.pixelZoom));
            this.collections.Add(2, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 5, Game1.tileSize, Game1.tileSize), "", "Minerals", Game1.mouseCursors, new Rectangle(672, 64, 16, 16), (float)Game1.pixelZoom));
            this.collections.Add(3, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 6, Game1.tileSize, Game1.tileSize), "", "Cooking", Game1.mouseCursors, new Rectangle(688, 64, 16, 16), (float)Game1.pixelZoom));
            this.collections.Add(4, new List <List <ClickableTextureComponent> >());
            this.sideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 7, Game1.tileSize, Game1.tileSize), "", "Achievements", Game1.mouseCursors, new Rectangle(656, 80, 16, 16), (float)Game1.pixelZoom));
            this.collections.Add(5, new List <List <ClickableTextureComponent> >());
            Collections_Buy_Back.widthToMoveActiveTab = Game1.tileSize / 8;
            this.backButton    = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
            this.forwardButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + width - Game1.tileSize / 2 - 15 * Game1.pixelZoom, this.yPositionOnScreen + height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
            int[] array = new int[this.sideTabs.Count <ClickableTextureComponent>()];
            int   num   = this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder;
            int   num2  = this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - Game1.tileSize / 4;
            int   num3  = 10;

            foreach (KeyValuePair <int, string> current in Game1.objectInformation)
            {
                string text = current.Value.Split(new char[]
                {
                    '/'
                })[3];
                bool flag = false;
                int  num4;
                if (text.Contains("Arch"))
                {
                    num4 = 2;
                    if (Game1.player.archaeologyFound.ContainsKey(current.Key))
                    {
                        flag = true;
                    }
                }
                else if (text.Contains("Fish"))
                {
                    if (current.Key >= 167 && current.Key < 173)
                    {
                        continue;
                    }
                    num4 = 1;
                    if (Game1.player.fishCaught.ContainsKey(current.Key))
                    {
                        flag = true;
                    }
                }
                else if (text.Contains("Mineral") || text.Substring(text.Count <char>() - 3).Equals("-2"))
                {
                    num4 = 3;
                    if (Game1.player.mineralsFound.ContainsKey(current.Key))
                    {
                        flag = true;
                    }
                }
                else if (text.Contains("Cooking") || text.Substring(text.Count <char>() - 3).Equals("-7"))
                {
                    num4 = 4;
                    if (Game1.player.recipesCooked.ContainsKey(current.Key))
                    {
                        flag = true;
                    }
                    if (current.Key == 217 || current.Key == 772)
                    {
                        continue;
                    }
                    if (current.Key == 773)
                    {
                        continue;
                    }
                }
                else
                {
                    if (!StardewValley.Object.isPotentialBasicShippedCategory(current.Key, text.Substring(text.Count <char>() - 3)))
                    {
                        continue;
                    }
                    num4 = 0;
                    if (Game1.player.basicShipped.ContainsKey(current.Key))
                    {
                        flag = true;
                    }
                }
                int x2   = num + array[num4] % num3 * (Game1.tileSize + 4);
                int num5 = num2 + array[num4] / num3 * (Game1.tileSize + 4);
                if (num5 > this.yPositionOnScreen + height - 128)
                {
                    this.collections[num4].Add(new List <ClickableTextureComponent>());
                    array[num4] = 0;
                    x2          = num;
                    num5        = num2;
                }
                if (this.collections[num4].Count <List <ClickableTextureComponent> >() == 0)
                {
                    this.collections[num4].Add(new List <ClickableTextureComponent>());
                }
                this.collections[num4].Last <List <ClickableTextureComponent> >().Add(new ClickableTextureComponent("", new Rectangle(x2, num5, Game1.tileSize, Game1.tileSize), current.Key + " " + flag, "", Game1.objectSpriteSheet, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, current.Key, 16, 16), (float)Game1.pixelZoom, false));
                array[num4]++;
            }
            if (this.collections[5].Count <List <ClickableTextureComponent> >() == 0)
            {
                this.collections[5].Add(new List <ClickableTextureComponent>());
            }
            foreach (KeyValuePair <int, string> current2 in Game1.achievements)
            {
                bool     flag2  = Game1.player.achievements.Contains(current2.Key);
                string[] array2 = current2.Value.Split(new char[]
                {
                    '^'
                });
                if (flag2 || (array2[2].Equals("true") && (array2[3].Equals("-1") || this.farmerHasAchievements(array2[3]))))
                {
                    int x3 = num + array[5] % num3 * (Game1.tileSize + 4);
                    int y2 = num2 + array[5] / num3 * (Game1.tileSize + 4);
                    this.collections[5][0].Add(new ClickableTextureComponent("", new Rectangle(x3, y2, Game1.tileSize, Game1.tileSize), current2.Key + " " + flag2, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 25, -1, -1), 1f, false));
                    array[5]++;
                }
            }
        }
Пример #30
0
 public AnimationPreviewTool()
     : base(Game1.uiViewport.Width / 2 - (632 + IClickableMenu.borderWidth * 2) / 2, Game1.uiViewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2 - 64, 632 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2 + 64)
 {
     Game1.player.faceDirection(2);
     Game1.player.FarmerSprite.StopAnimation();
     FieldInfo[] fields = typeof(FarmerSprite).GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
     animationButtons = new List <ClickableTextureComponent>();
     foreach (FieldInfo field in fields.Where((FieldInfo fi) => fi.IsLiteral && !fi.IsInitOnly))
     {
         ClickableTextureComponent component = new ClickableTextureComponent(new Rectangle(0, 0, 200, 48), null, default(Rectangle), 1f)
         {
             myID = (int)field.GetValue(null),
             name = field.Name
         };
         animationButtons.Add(component);
     }
     okButton = new ClickableTextureComponent("OK", new Rectangle(xPositionOnScreen + width - IClickableMenu.borderWidth - IClickableMenu.spaceToClearSideBorder - 64, yPositionOnScreen + height - IClickableMenu.borderWidth - IClickableMenu.spaceToClearTopBorder + 16, 64, 64), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
     {
         upNeighborID    = -99998,
         leftNeighborID  = -99998,
         rightNeighborID = -99998,
         downNeighborID  = -99998
     };
     components = new List <List <ClickableTextureComponent> >();
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[1]
     {
         new ClickableTextureComponent("Hair Heading", new Rectangle(0, 0, 64, 16), "Hair", "", null, default(Rectangle), 1f)
     }));
     hairLabel = new ClickableTextureComponent("Hair Label", new Rectangle(0, 0, 64, 64), "0", "", null, default(Rectangle), 1f);
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[3]
     {
         new ClickableTextureComponent("Hair Style", new Rectangle(0, 0, 64, 64), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 44), 1f)
         {
             myID = -1
         },
         hairLabel,
         new ClickableTextureComponent("Hair Style", new Rectangle(0, 0, 64, 64), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 33), 1f)
         {
             myID = 1
         }
     }));
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[1]
     {
         new ClickableTextureComponent("Shirt Heading", new Rectangle(0, 0, 64, 16), "Shirt", "", null, default(Rectangle), 1f)
     }));
     shirtLabel = new ClickableTextureComponent("Shirt Label", new Rectangle(0, 0, 64, 64), "0", "", null, default(Rectangle), 1f);
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[3]
     {
         new ClickableTextureComponent("Shirt Style", new Rectangle(0, 0, 64, 64), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 44), 1f)
         {
             myID = -1
         },
         shirtLabel,
         new ClickableTextureComponent("Shirt Style", new Rectangle(0, 0, 64, 64), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 33), 1f)
         {
             myID = 1
         }
     }));
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[1]
     {
         new ClickableTextureComponent("Pants Heading", new Rectangle(0, 0, 64, 16), "Pants", "", null, default(Rectangle), 1f)
     }));
     pantsLabel = new ClickableTextureComponent("Pants Label", new Rectangle(0, 0, 64, 64), "0", "", null, default(Rectangle), 1f);
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[3]
     {
         new ClickableTextureComponent("Pants Style", new Rectangle(0, 0, 64, 64), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 44), 1f)
         {
             myID = -1
         },
         pantsLabel,
         new ClickableTextureComponent("Pants Style", new Rectangle(0, 0, 64, 64), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 33), 1f)
         {
             myID = 1
         }
     }));
     components.Add(new List <ClickableTextureComponent>(new ClickableTextureComponent[1]
     {
         new ClickableTextureComponent("Toggle Gender", new Rectangle(0, 0, 64, 64), "Toggle Gender", "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 25), 1f)
     }));
     RepositionElements();
 }