public static MenuItem MenuItemFromComponent(StardewValley.Menus.ClickableComponent component, IClickableMenu menu, string label = null)
        {
            MenuItem item = new MenuItem(label, null, component.bounds, menu);

            item.StardewComponent = component;
            item.SetActionFromComponent(component, label);
            return(item);
        }
 protected virtual void SetActionFromComponent(StardewValley.Menus.ClickableComponent component, string label = null)
 {
     if (label == null)
     {
         label = component.name;
     }
     this.Label               = label;
     this.Bounds              = component.bounds;
     this.clickAction        += Click;
     this.speakOnClickAction += DefaultSpeakOnClickAction;
 }
Example #3
0
        public LetterViewerMenu(string mail, string mailTitle) : base((int)Utility.getTopLeftPositionForCenteringOnScreen(320 * Game1.pixelZoom, 180 * Game1.pixelZoom, 0, 0).X, (int)Utility.getTopLeftPositionForCenteringOnScreen(320 * Game1.pixelZoom, 180 * Game1.pixelZoom, 0, 0).Y, 320 * Game1.pixelZoom, 180 * Game1.pixelZoom, true)
        {
            this.isMail = true;
            Game1.playSound("shwip");
            this.backButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 16 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false)
            {
                myID            = 101,
                rightNeighborID = 102
            };
            this.forwardButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 16 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false)
            {
                myID           = 102,
                leftNeighborID = 101
            };
            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", new object[0])).X + Game1.pixelZoom * 6, (int)Game1.dialogueFont.MeasureString(Game1.content.LoadString("Strings\\UI:AcceptQuest", new object[0])).Y + Game1.pixelZoom * 6), "")
            {
                myID            = 103,
                rightNeighborID = 102,
                leftNeighborID  = 101
            };
            this.mailTitle     = mailTitle;
            this.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   text  = mail.Substring(mail.IndexOf("%item"), mail.IndexOf("%%") + 2 - mail.IndexOf("%item"));
                string[] array = text.Split(new char[]
                {
                    ' '
                });
                mail = mail.Replace(text, "");
                if (array[1].Equals("object"))
                {
                    int maxValue = array.Length - 1;
                    int num      = Game1.random.Next(2, maxValue);
                    num -= num % 2;
                    StardewValley.Object item = new StardewValley.Object(Vector2.Zero, Convert.ToInt32(array[num]), Convert.ToInt32(array[num + 1]));
                    this.itemsToGrab.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 24 * Game1.pixelZoom, 24 * Game1.pixelZoom, 24 * Game1.pixelZoom), item)
                    {
                        myID            = 104,
                        leftNeighborID  = 101,
                        rightNeighborID = 102
                    });
                    this.backButton.rightNeighborID   = 104;
                    this.forwardButton.leftNeighborID = 104;
                }
                else if (array[1].Equals("tools"))
                {
                    for (int i = 2; i < array.Length; i++)
                    {
                        Item   item2 = null;
                        string a     = array[i];
                        if (!(a == "Axe"))
                        {
                            if (!(a == "Hoe"))
                            {
                                if (!(a == "Can"))
                                {
                                    if (!(a == "Scythe"))
                                    {
                                        if (a == "Pickaxe")
                                        {
                                            item2 = new Pickaxe();
                                        }
                                    }
                                    else
                                    {
                                        item2 = new MeleeWeapon(47);
                                    }
                                }
                                else
                                {
                                    item2 = new WateringCan();
                                }
                            }
                            else
                            {
                                item2 = new Hoe();
                            }
                        }
                        else
                        {
                            item2 = new Axe();
                        }
                        if (item2 != null)
                        {
                            this.itemsToGrab.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 24 * Game1.pixelZoom, 24 * Game1.pixelZoom, 24 * Game1.pixelZoom), item2));
                        }
                    }
                }
                else if (array[1].Equals("bigobject"))
                {
                    int maxValue2 = array.Length - 1;
                    int num2      = Game1.random.Next(2, maxValue2);
                    StardewValley.Object item3 = new StardewValley.Object(Vector2.Zero, Convert.ToInt32(array[num2]), false);
                    this.itemsToGrab.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 24 * Game1.pixelZoom, 24 * Game1.pixelZoom, 24 * Game1.pixelZoom), item3)
                    {
                        myID            = 104,
                        leftNeighborID  = 101,
                        rightNeighborID = 102
                    });
                    this.backButton.rightNeighborID   = 104;
                    this.forwardButton.leftNeighborID = 104;
                }
                else if (array[1].Equals("money"))
                {
                    int num3 = (array.Length > 4) ? Game1.random.Next(Convert.ToInt32(array[2]), Convert.ToInt32(array[3])) : Convert.ToInt32(array[2]);
                    num3 -= num3 % 10;
                    Game1.player.Money += num3;
                    this.moneyIncluded  = num3;
                }
                else if (array[1].Equals("quest"))
                {
                    this.questID = Convert.ToInt32(array[2].Replace("%%", ""));
                    if (array.Length > 4)
                    {
                        if (!Game1.player.mailReceived.Contains("NOQUEST_" + this.questID))
                        {
                            Game1.player.addQuest(this.questID);
                        }
                        this.questID = -1;
                    }
                    this.backButton.rightNeighborID   = 103;
                    this.forwardButton.leftNeighborID = 103;
                }
                else
                {
                    if (array[1].Equals("cookingRecipe"))
                    {
                        Dictionary <string, string> dictionary = Game1.content.Load <Dictionary <string, string> >("Data\\CookingRecipes");
                        using (Dictionary <string, string> .KeyCollection.Enumerator enumerator = dictionary.Keys.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                string   current = enumerator.Current;
                                string[] array2  = dictionary[current].Split(new char[]
                                {
                                    '/'
                                });
                                string[] array3 = array2[3].Split(new char[]
                                {
                                    ' '
                                });
                                if (array3[0].Equals("f") && array3[1].Equals(mailTitle.Replace("Cooking", "")) && Game1.player.friendships[array3[1]][0] >= Convert.ToInt32(array3[2]) * 250 && !Game1.player.cookingRecipes.ContainsKey(current))
                                {
                                    Game1.player.cookingRecipes.Add(current, 0);
                                    this.learnedRecipe = current;
                                    if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.en)
                                    {
                                        this.learnedRecipe = array2[array2.Length - 1];
                                    }
                                    this.cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_cooking", new object[0]);
                                    break;
                                }
                            }
                            goto IL_864;
                        }
                    }
                    if (array[1].Equals("craftingRecipe"))
                    {
                        this.learnedRecipe = array[2].Replace('_', ' ');
                        Game1.player.craftingRecipes.Add(this.learnedRecipe, 0);
                        this.cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_crafting", new object[0]);
                    }
                }
            }
IL_864:
            Random r = new Random((int)(Game1.uniqueIDForThisGame / 2uL) - Game1.year);

            mail             = mail.Replace("%secretsanta", Utility.getRandomTownNPC(r, Utility.getFarmerNumberFromFarmer(Game1.player)).displayName);
            this.mailMessage = SpriteText.getStringBrokenIntoSectionsOfHeight(mail, this.width - Game1.tileSize, this.height - Game1.tileSize * 2);
            if (Game1.options.SnappyMenus)
            {
                base.populateClickableComponentList();
                this.snapToDefaultClickableComponent();
                if (this.mailMessage != null && this.mailMessage.Count <= 1)
                {
                    this.backButton.myID    = -100;
                    this.forwardButton.myID = -100;
                }
            }
        }
Example #4
0
 public override bool IsAutomaticSnapValid(int direction, ClickableComponent a, ClickableComponent b)
 {
     if ((a == downButton || a == upButton) && direction == 3 && b.region != 8000)
     {
         return(false);
     }
     if (a.region == 8000 && (direction == 3 || direction == 1) && b.region == 9000)
     {
         return(false);
     }
     if (a.region == 8000 && direction == 2 && (b == upButton || b == downButton))
     {
         return(false);
     }
     return(base.IsAutomaticSnapValid(direction, a, b));
 }
Example #5
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 var 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 var 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();
            }
        }
Example #6
0
 public AddNewItemMenu()
     : base(Game1.uiViewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.uiViewport.Height / 2 - (300 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 300 + IClickableMenu.borderWidth * 2)
 {
     playerInventory = new InventoryMenu(xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder, yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder, playerInventory: true);
     garbage         = new ClickableComponent(new Rectangle(xPositionOnScreen + width + IClickableMenu.spaceToClearSideBorder, yPositionOnScreen + height - 64, 64, 64), "Garbage");
 }
Example #7
0
        public override bool IsAutomaticSnapValid(int direction, ClickableComponent a, ClickableComponent b)
        {
            if (a.region == 1000 && b.region != 1000)
            {
                switch (direction)
                {
                case 1:
                case 3:
                    return(false);

                case 2:
                    if (b.myID != 106)
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(base.IsAutomaticSnapValid(direction, a, b));
        }
Example #8
0
 public override bool IsAutomaticSnapValid(int direction, ClickableComponent a, ClickableComponent b)
 {
     if (a.region == 901 && b.region != 901 && direction == 2 && b.myID != 81114)
     {
         return(true);
     }
     if (a.region == 901 && direction == 3 && b.region != 900)
     {
         return(false);
     }
     if (direction == 1 && a.region == 900 && hasDeleteButtons() && b.region != 901)
     {
         return(false);
     }
     if (a.region != 903 && b.region == 903)
     {
         return(false);
     }
     if ((direction == 0 || direction == 2) && a.myID == 81114 && b.region == 902)
     {
         return(false);
     }
     return(base.IsAutomaticSnapValid(direction, a, b));
 }
Example #9
0
        public LevelUpMenu(int skill, int level)
            : base(Game1.uiViewport.Width / 2 - 384, Game1.uiViewport.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)))
                {
                    continue;
                }
                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();
        }
Example #10
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 index = 0; index < 7; ++index)
            {
                List <ClickableComponent> optionSlots        = this.optionSlots;
                ClickableComponent        clickableComponent = new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + index * ((height - Game1.tileSize * 2) / 7), width - Game1.tileSize / 2, (height - Game1.tileSize * 2) / 7 + Game1.pixelZoom), string.Concat((object)index));
                clickableComponent.myID = index;
                int num1 = index < 6 ? index + 1 : -7777;
                clickableComponent.downNeighborID = num1;
                int num2 = index > 0 ? index - 1 : -7777;
                clickableComponent.upNeighborID = num2;
                int num3 = 1;
                clickableComponent.fullyImmutable = num3 != 0;
                optionSlots.Add(clickableComponent);
            }
            this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11233")));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11234"), 0, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11235"), 7, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11236"), 8, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11237"), 11, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11238"), 12, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11239"), 27, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11240"), 14, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\UI:Options_GamepadStyleMenus"), 29, -1, -1));
            this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11241")));
            this.options.Add((OptionsElement) new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11242"), 1, -1, -1));
            this.options.Add((OptionsElement) new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11243"), 2, -1, -1));
            this.options.Add((OptionsElement) new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11244"), 20, -1, -1));
            this.options.Add((OptionsElement) new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11245"), 21, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11246"), 3, -1, -1));
            this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11247")));
            if (!Game1.conventionMode)
            {
                this.options.Add((OptionsElement) new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11248"), 13, -1, -1));
                this.options.Add((OptionsElement) new OptionsDropDown(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11251"), 6, -1, -1));
            }
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11252"), 9, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11253"), 15, -1, -1));
            List <OptionsElement> options1 = this.options;
            string        label1           = Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11254");
            int           whichOption1     = 18;
            List <string> options2         = new List <string>();

            options2.Add("75%");
            options2.Add("80%");
            options2.Add("85%");
            options2.Add("90%");
            options2.Add("95%");
            options2.Add("100%");
            options2.Add("105%");
            options2.Add("110%");
            options2.Add("115%");
            options2.Add("120%");
            options2.Add("125%");
            List <string> displayOptions1 = new List <string>();

            displayOptions1.Add("75%");
            displayOptions1.Add("80%");
            displayOptions1.Add("85%");
            displayOptions1.Add("90%");
            displayOptions1.Add("95%");
            displayOptions1.Add("100%");
            displayOptions1.Add("105%");
            displayOptions1.Add("110%");
            displayOptions1.Add("115%");
            displayOptions1.Add("120%");
            displayOptions1.Add("125%");
            int x1 = -1;
            int y1 = -1;
            OptionsPlusMinus optionsPlusMinus1 = new OptionsPlusMinus(label1, whichOption1, options2, displayOptions1, x1, y1);

            options1.Add((OptionsElement)optionsPlusMinus1);
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11266"), 19, -1, -1));
            List <OptionsElement> options3 = this.options;
            string        label2           = Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11267");
            int           whichOption2     = 25;
            List <string> options4         = new List <string>();

            options4.Add("Low");
            options4.Add("Med.");
            options4.Add("High");
            List <string> displayOptions2 = new List <string>()
            {
                Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11268"),
                Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11269"),
                Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11270")
            };
            int x2 = -1;
            int y2 = -1;
            OptionsPlusMinus optionsPlusMinus2 = new OptionsPlusMinus(label2, whichOption2, options4, displayOptions2, x2, y2);

            options3.Add((OptionsElement)optionsPlusMinus2);
            this.options.Add((OptionsElement) new OptionsSlider(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11271"), 23, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11272"), 24, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11273"), 26, -1, -1));
            this.options.Add(new OptionsElement(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11274")));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11275"), 16, -1, -1));
            this.options.Add((OptionsElement) new OptionsCheckbox(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11276"), 22, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11277"), -1, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11278"), 7, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11279"), 10, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11280"), 15, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11281"), 18, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11282"), 19, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11283"), 11, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11284"), 14, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11285"), 13, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11286"), 12, this.optionSlots[0].bounds.Width, -1, -1));
            if (Game1.IsMultiplayer)
            {
                this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11287"), 17, this.optionSlots[0].bounds.Width, -1, -1));
            }
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11288"), 16, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11289"), 20, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11290"), 21, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11291"), 22, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11292"), 23, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11293"), 24, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11294"), 25, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11295"), 26, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11296"), 27, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11297"), 28, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11298"), 29, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11299"), 30, this.optionSlots[0].bounds.Width, -1, -1));
            this.options.Add((OptionsElement) new OptionsInputListener(Game1.content.LoadString("Strings\\StringsFromCSFiles:OptionsPage.cs.11300"), 31, this.optionSlots[0].bounds.Width, -1, -1));
        }
Example #11
0
 public override bool IsAutomaticSnapValid(int direction, ClickableComponent a, ClickableComponent b)
 {
     if (a.region == 1000 && (direction == 2 || direction == 0) && b.region == 1000)
     {
         return(false);
     }
     if (a.myID == 810 && direction == 0 && b.region != 900)
     {
         return(false);
     }
     if (a.myID == 810 && direction == 1 && b.myID == 81114)
     {
         return(false);
     }
     return(base.IsAutomaticSnapValid(direction, a, b));
 }
Example #12
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(null, 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 = this.textBox;
     this.textBox.Selected = false;
     if (animal.parentId != -1L)
     {
         FarmAnimal farmAnimal = Utility.getAnimal(animal.parentId);
         if (farmAnimal != null)
         {
             this.parentName = farmAnimal.displayName;
         }
     }
     if (animal.sound != null && Game1.soundBank != null)
     {
         Cue expr_1B2 = Game1.soundBank.GetCue(animal.sound);
         expr_1B2.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201)));
         expr_1B2.Play();
     }
     this.okButton = 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)
     {
         myID         = 101,
         upNeighborID = 103
     };
     this.sellButton = 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)
     {
         myID           = 103,
         downNeighborID = 101,
         upNeighborID   = 104
     };
     this.moveHomeButton = 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)
     {
         myID           = 104,
         downNeighborID = 103,
         upNeighborID   = 110
     };
     if (!animal.isBaby() && !animal.isCoopDweller())
     {
         this.allowReproductionButton = 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)
         {
             myID = 106
         };
     }
     this.love = new ClickableTextureComponent(Math.Round((double)animal.friendshipTowardFarmer, 0) / 10.0 + "<", 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), null, "Friendship", Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(172, 512, 16, 16), 4f, false)
     {
         myID = 102
     };
     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)((float)animal.fullness / 255f);
     if (animal.home != null && animal.home.indoors != null)
     {
         int num = animal.home.indoors.numberOfObjectsWithName("Hay");
         if (num > 0)
         {
             int count = (animal.home.indoors as AnimalHouse).animalsThatLiveHere.Count;
             this.fullnessLevel = Math.Min(1.0, this.fullnessLevel + (double)num / (double)count);
         }
     }
     else
     {
         Utility.fixAllAnimals();
     }
     this.happinessLevel = (double)((float)animal.happiness / 255f);
     this.loveLevel      = (double)((float)animal.friendshipTowardFarmer / 1000f);
     if (Game1.options.SnappyMenus)
     {
         base.populateClickableComponentList();
         this.snapToDefaultClickableComponent();
     }
 }
Example #13
0
        public void SetUpCredits()
        {
            foreach (string s in Game1.temporaryContent.Load <List <string> >("Strings\\credits"))
            {
                if (s != "" && s.Length >= 6 && s.Substring(0, 6) == "[image")
                {
                    string[]  split           = s.Split(' ');
                    string    path            = split[1];
                    int       sourceX         = Convert.ToInt32(split[2]);
                    int       sourceY         = Convert.ToInt32(split[3]);
                    int       sourceWidth     = Convert.ToInt32(split[4]);
                    int       sourceHeight    = Convert.ToInt32(split[5]);
                    int       zoom            = Convert.ToInt32(split[6]);
                    int       animationFrames = ((split.Count() <= 7) ? 1 : Convert.ToInt32(split[7]));
                    Texture2D tex             = null;
                    try
                    {
                        tex = Game1.temporaryContent.Load <Texture2D>(path);
                    }
                    catch (Exception)
                    {
                    }
                    if (tex != null)
                    {
                        if (sourceWidth == -1)
                        {
                            sourceWidth  = tex.Width;
                            sourceHeight = tex.Height;
                        }
                        credits.Add(new ImageCreditsBlock(tex, new Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), zoom, animationFrames));
                    }
                }
                else if (s != "" && s.Length >= 6 && s.Substring(0, 5) == "[link")
                {
                    string url  = s.Split(' ')[1];
                    string text = s.Substring(s.IndexOf(' ') + 1);
                    text = text.Substring(text.IndexOf(' ') + 1);
                    credits.Add(new LinkCreditsBlock(text, url));
                }
                else
                {
                    credits.Add(new TextCreditsBlock(s));
                }
            }
            if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.de && LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.es)
            {
                _ = LocalizedContentManager.CurrentLanguageCode;
                _ = 4;
            }
            Vector2 topLeft = Utility.getTopLeftPositionForCenteringOnScreen(width, 700);

            xPositionOnScreen = (int)topLeft.X;
            yPositionOnScreen = (int)topLeft.Y;
            upButton          = new ClickableTextureComponent(new Rectangle((int)topLeft.X + width - 80, (int)topLeft.Y + 64 + 16, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 12), 0.8f)
            {
                myID            = 94444,
                downNeighborID  = 95555,
                rightNeighborID = -99998,
                leftNeighborID  = -99998
            };
            downButton = new ClickableTextureComponent(new Rectangle((int)topLeft.X + width - 80, (int)topLeft.Y + 700 - 32, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 11), 0.8f)
            {
                myID            = 95555,
                upNeighborID    = -99998,
                rightNeighborID = -99998,
                leftNeighborID  = -99998
            };
            backButton = new ClickableComponent(new Rectangle(Game1.uiViewport.Width + -198 - 48, Game1.uiViewport.Height - 81 - 24, 198, 81), "")
            {
                myID            = 81114,
                leftNeighborID  = -99998,
                rightNeighborID = -99998,
                upNeighborID    = 95555
            };
        }
Example #14
0
        public LevelUpMenu(int skill, int level) : base(Game1.viewport.Width / 2 - 384, Game1.viewport.Height / 2 - 256, 768, 512, false)
        {
            this.timerBeforeStart = 250;
            this.isActive         = true;
            this.width            = Game1.tileSize * 15;
            this.height           = Game1.tileSize * 8;
            this.okButton         = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false)
            {
                myID = 101
            };
            this.newCraftingRecipes.Clear();
            this.extraInfoForLevel.Clear();
            Game1.player.completelyStopAnimatingOrDoingAction();
            this.informationUp       = true;
            this.isProfessionChooser = false;
            this.currentLevel        = level;
            this.currentSkill        = skill;
            if (level == 10)
            {
                Game1.getSteamAchievement("Achievement_SingularTalent");
                if (Game1.player.farmingLevel == 10 && Game1.player.miningLevel == 10 && Game1.player.fishingLevel == 10 && Game1.player.foragingLevel == 10 && Game1.player.combatLevel == 10)
                {
                    Game1.getSteamAchievement("Achievement_MasterOfTheFiveWays");
                }
            }
            this.title = Game1.content.LoadString("Strings\\UI:LevelUp_Title", new object[]
            {
                this.currentLevel,
                Farmer.getSkillDisplayNameFromIndex(this.currentSkill)
            });
            this.extraInfoForLevel = this.getExtraInfoForLevel(this.currentSkill, this.currentLevel);
            switch (this.currentSkill)
            {
            case 0:
                this.sourceRectForLevelIcon = new Rectangle(0, 0, 16, 16);
                break;

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

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

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

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

            case 5:
                this.sourceRectForLevelIcon = new Rectangle(64, 0, 16, 16);
                break;
            }
            if ((this.currentLevel == 5 || this.currentLevel == 10) && this.currentSkill != 5)
            {
                this.professionsToChoose.Clear();
                this.isProfessionChooser = true;
                if (this.currentLevel == 5)
                {
                    this.professionsToChoose.Add(this.currentSkill * 6);
                    this.professionsToChoose.Add(this.currentSkill * 6 + 1);
                }
                else if (Game1.player.professions.Contains(this.currentSkill * 6))
                {
                    this.professionsToChoose.Add(this.currentSkill * 6 + 2);
                    this.professionsToChoose.Add(this.currentSkill * 6 + 3);
                }
                else
                {
                    this.professionsToChoose.Add(this.currentSkill * 6 + 4);
                    this.professionsToChoose.Add(this.currentSkill * 6 + 5);
                }
                this.leftProfessionDescription  = LevelUpMenu.getProfessionDescription(this.professionsToChoose[0]);
                this.rightProfessionDescription = LevelUpMenu.getProfessionDescription(this.professionsToChoose[1]);
            }
            int num = 0;

            foreach (KeyValuePair <string, string> current in CraftingRecipe.craftingRecipes)
            {
                string text = current.Value.Split(new char[]
                {
                    '/'
                })[4];
                if (text.Contains(Farmer.getSkillNameFromIndex(this.currentSkill)) && text.Contains(string.Concat(this.currentLevel)))
                {
                    this.newCraftingRecipes.Add(new CraftingRecipe(current.Key, false));
                    if (!Game1.player.craftingRecipes.ContainsKey(current.Key))
                    {
                        Game1.player.craftingRecipes.Add(current.Key, 0);
                    }
                    num += (this.newCraftingRecipes.Last <CraftingRecipe>().bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize);
                }
            }
            foreach (KeyValuePair <string, string> current2 in CraftingRecipe.cookingRecipes)
            {
                string text2 = current2.Value.Split(new char[]
                {
                    '/'
                })[3];
                if (text2.Contains(Farmer.getSkillNameFromIndex(this.currentSkill)) && text2.Contains(string.Concat(this.currentLevel)))
                {
                    this.newCraftingRecipes.Add(new CraftingRecipe(current2.Key, true));
                    if (!Game1.player.cookingRecipes.ContainsKey(current2.Key))
                    {
                        Game1.player.cookingRecipes.Add(current2.Key, 0);
                        if (!Game1.player.hasOrWillReceiveMail("robinKitchenLetter"))
                        {
                            Game1.mailbox.Enqueue("robinKitchenLetter");
                        }
                    }
                    num += (this.newCraftingRecipes.Last <CraftingRecipe>().bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize);
                }
            }
            this.height = num + Game1.tileSize * 4 + this.extraInfoForLevel.Count * Game1.tileSize * 3 / 4;
            Game1.player.freezePause = 100;
            this.gameWindowSizeChanged(Rectangle.Empty, Rectangle.Empty);
            if (Game1.options.SnappyMenus)
            {
                if (this.isProfessionChooser)
                {
                    this.leftProfession = new ClickableComponent(new Rectangle(this.xPositionOnScreen, this.yPositionOnScreen + Game1.tileSize * 2, this.width / 2, this.height), "")
                    {
                        myID            = 102,
                        rightNeighborID = 103
                    };
                    this.rightProfession = new ClickableComponent(new Rectangle(this.width / 2 + this.xPositionOnScreen, this.yPositionOnScreen + Game1.tileSize * 2, this.width / 2, this.height), "")
                    {
                        myID           = 103,
                        leftNeighborID = 102
                    };
                }
                base.populateClickableComponentList();
                this.snapToDefaultClickableComponent();
            }
        }
Example #15
0
        public Billboard(bool dailyQuest = false)
            : base(0, 0, 0, 0, showUpperRightCloseButton: true)
        {
            _upcomingWeddings = new Dictionary <ClickableTextureComponent, List <string> >();
            if (!Game1.player.hasOrWillReceiveMail("checkedBulletinOnce"))
            {
                Game1.player.mailReceived.Add("checkedBulletinOnce");
                (Game1.getLocationFromName("Town") as Town).checkedBoard();
            }
            dailyQuestBoard  = dailyQuest;
            billboardTexture = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\Billboard");
            width            = (dailyQuest ? 338 : 301) * 4;
            height           = 792;
            Vector2 center = Utility.getTopLeftPositionForCenteringOnScreen(width, height);

            xPositionOnScreen = (int)center.X;
            yPositionOnScreen = (int)center.Y;
            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 = 0
            };
            UpdateDailyQuestButton();
            upperRightCloseButton = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width - 20, yPositionOnScreen, 48, 48), Game1.mouseCursors, new Rectangle(337, 494, 12, 12), 4f);
            Game1.playSound("bigSelect");
            if (!dailyQuest)
            {
                calendarDays = new List <ClickableTextureComponent>();
                Dictionary <int, NPC> birthdays = new Dictionary <int, NPC>();
                foreach (NPC k in Utility.getAllCharacters())
                {
                    if (k.isVillager() && k.Birthday_Season != null && k.Birthday_Season.Equals(Game1.currentSeason) && !birthdays.ContainsKey(k.Birthday_Day) && (Game1.player.friendshipData.ContainsKey(k.Name) || (!k.Name.Equals("Dwarf") && !k.Name.Equals("Sandy") && !k.Name.Equals("Krobus"))))
                    {
                        birthdays.Add(k.Birthday_Day, k);
                    }
                }
                nightMarketLocalized    = Game1.content.LoadString("Strings\\UI:Billboard_NightMarket");
                wizardBirthdayLocalized = Game1.content.LoadString("Strings\\UI:Billboard_Birthday", Game1.getCharacterFromName("Wizard").displayName);
                for (int i = 1; i <= 28; i++)
                {
                    string festival = "";
                    string birthday = "";
                    NPC    j        = (birthdays.ContainsKey(i) ? birthdays[i] : null);
                    if (Utility.isFestivalDay(i, Game1.currentSeason))
                    {
                        festival = Game1.temporaryContent.Load <Dictionary <string, string> >(string.Concat("Data\\Festivals\\" + Game1.currentSeason, i))["name"];
                    }
                    else
                    {
                        if (j != null)
                        {
                            birthday = ((j.displayName.Last() != 's' && (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.de || (j.displayName.Last() != 'x' && j.displayName.Last() != 'ß' && j.displayName.Last() != 'z'))) ? Game1.content.LoadString("Strings\\UI:Billboard_Birthday", j.displayName) : Game1.content.LoadString("Strings\\UI:Billboard_SBirthday", j.displayName));
                        }
                        if (Game1.currentSeason.Equals("winter") && i >= 15 && i <= 17)
                        {
                            festival = nightMarketLocalized;
                        }
                    }
                    Texture2D character_texture = null;
                    if (j != null)
                    {
                        try
                        {
                            character_texture = Game1.content.Load <Texture2D>("Characters\\" + j.getTextureName());
                        }
                        catch (Exception)
                        {
                            character_texture = j.Sprite.Texture;
                        }
                    }
                    ClickableTextureComponent calendar_day = new ClickableTextureComponent(festival, new Rectangle(xPositionOnScreen + 152 + (i - 1) % 7 * 32 * 4, yPositionOnScreen + 200 + (i - 1) / 7 * 32 * 4, 124, 124), festival, birthday, character_texture, (j != null) ? new Rectangle(0, 0, 16, 24) : Rectangle.Empty, 1f)
                    {
                        myID            = i,
                        rightNeighborID = ((i % 7 != 0) ? (i + 1) : (-1)),
                        leftNeighborID  = ((i % 7 != 1) ? (i - 1) : (-1)),
                        downNeighborID  = i + 7,
                        upNeighborID    = ((i > 7) ? (i - 7) : (-1))
                    };
                    HashSet <Farmer> traversed_farmers = new HashSet <Farmer>();
                    foreach (Farmer farmer in Game1.getOnlineFarmers())
                    {
                        if (traversed_farmers.Contains(farmer) || !farmer.isEngaged() || farmer.hasCurrentOrPendingRoommate())
                        {
                            continue;
                        }
                        string    spouse_name  = null;
                        WorldDate wedding_date = null;
                        if (Game1.getCharacterFromName(farmer.spouse) != null)
                        {
                            wedding_date = farmer.friendshipData[farmer.spouse].WeddingDate;
                            spouse_name  = Game1.getCharacterFromName(farmer.spouse).displayName;
                        }
                        else
                        {
                            long?spouse = farmer.team.GetSpouse(farmer.uniqueMultiplayerID);
                            if (spouse.HasValue)
                            {
                                Farmer spouse_farmer = Game1.getFarmerMaybeOffline(spouse.Value);
                                if (spouse_farmer != null && Game1.getOnlineFarmers().Contains(spouse_farmer))
                                {
                                    wedding_date = farmer.team.GetFriendship(farmer.uniqueMultiplayerID, spouse.Value).WeddingDate;
                                    traversed_farmers.Add(spouse_farmer);
                                    spouse_name = spouse_farmer.Name;
                                }
                            }
                        }
                        if (wedding_date == null)
                        {
                            continue;
                        }
                        if (wedding_date.TotalDays < Game1.Date.TotalDays)
                        {
                            wedding_date = new WorldDate(Game1.Date);
                            wedding_date.TotalDays++;
                        }
                        if (wedding_date != null && wedding_date.TotalDays >= Game1.Date.TotalDays && Utility.getSeasonNumber(Game1.currentSeason) == wedding_date.SeasonIndex && i == wedding_date.DayOfMonth)
                        {
                            if (!_upcomingWeddings.ContainsKey(calendar_day))
                            {
                                _upcomingWeddings[calendar_day] = new List <string>();
                            }
                            traversed_farmers.Add(farmer);
                            _upcomingWeddings[calendar_day].Add(farmer.Name);
                            _upcomingWeddings[calendar_day].Add(spouse_name);
                        }
                    }
                    calendarDays.Add(calendar_day);
                }
            }
            if (Game1.options.SnappyMenus)
            {
                populateClickableComponentList();
                snapToDefaultClickableComponent();
            }
        }
Example #16
0
 public PurchaseAnimalsMenu(List <Object> stock)
     : base(Game1.uiViewport.Width / 2 - menuWidth / 2 - IClickableMenu.borderWidth * 2, (Game1.uiViewport.Height - menuHeight - IClickableMenu.borderWidth * 2) / 4, menuWidth + IClickableMenu.borderWidth * 2, menuHeight + IClickableMenu.borderWidth)
 {
     height += 64;
     for (int i = 0; i < stock.Count; i++)
     {
         animalsToPurchase.Add(new ClickableTextureComponent(string.Concat(stock[i].salePrice()), new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + IClickableMenu.borderWidth + i % 3 * 64 * 2, yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth / 2 + i / 3 * 85, 128, 64), null, stock[i].Name, (i >= 9) ? Game1.mouseCursors2 : Game1.mouseCursors, (i >= 9) ? new Microsoft.Xna.Framework.Rectangle(128 + i % 3 * 16 * 2, i / 3 * 16, 32, 16) : 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
         });
     }
     okButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width + 4, yPositionOnScreen + height - 64 - IClickableMenu.borderWidth, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
     {
         myID           = 101,
         upNeighborID   = 103,
         leftNeighborID = 103
     };
     randomButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(xPositionOnScreen + width + 51 + 64, Game1.uiViewport.Height / 2, 64, 64), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(381, 361, 10, 10), 4f)
     {
         myID            = 103,
         downNeighborID  = 101,
         rightNeighborID = 101
     };
     menuHeight     = 320;
     menuWidth      = 448;
     textBox        = new TextBox(null, null, Game1.dialogueFont, Game1.textColor);
     textBox.X      = Game1.uiViewport.Width / 2 - 192;
     textBox.Y      = Game1.uiViewport.Height / 2;
     textBox.Width  = 256;
     textBox.Height = 192;
     e         = textBoxEnter;
     textBoxCC = new ClickableComponent(new Microsoft.Xna.Framework.Rectangle(textBox.X, textBox.Y, 192, 48), "")
     {
         myID            = 104,
         rightNeighborID = 102,
         downNeighborID  = 101
     };
     randomButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(textBox.X + textBox.Width + 64 + 48 - 8, Game1.uiViewport.Height / 2 + 4, 64, 64), Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(381, 361, 10, 10), 4f)
     {
         myID            = 103,
         leftNeighborID  = 102,
         downNeighborID  = 101,
         rightNeighborID = 101
     };
     doneNamingButton = new ClickableTextureComponent(new Microsoft.Xna.Framework.Rectangle(textBox.X + textBox.Width + 32 + 4, Game1.uiViewport.Height / 2 - 8, 64, 64), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
     {
         myID            = 102,
         rightNeighborID = 103,
         leftNeighborID  = 104,
         downNeighborID  = 101
     };
     if (Game1.options.SnappyMenus)
     {
         populateClickableComponentList();
         snapToDefaultClickableComponent();
     }
 }
Example #17
0
 public override bool IsAutomaticSnapValid(int direction, ClickableComponent a, ClickableComponent b)
 {
     if (b.myID == 5948 && b.myID != 4857)
     {
         return(false);
     }
     return(base.IsAutomaticSnapValid(direction, a, b));
 }
Example #18
0
 public LoadGameMenu()
     : base(Game1.uiViewport.Width / 2 - (1100 + IClickableMenu.borderWidth * 2) / 2, Game1.uiViewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 1100 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2)
 {
     backButton = new ClickableComponent(new Rectangle(Game1.uiViewport.Width + -198 - 48, Game1.uiViewport.Height - 81 - 24, 198, 81), "")
     {
         myID            = 81114,
         upNeighborID    = -99998,
         leftNeighborID  = -99998,
         rightNeighborID = -99998,
         downNeighborID  = -99998
     };
     upArrow = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + 16, 44, 48), Game1.mouseCursors, new Rectangle(421, 459, 11, 12), 4f)
     {
         myID            = 800,
         downNeighborID  = 801,
         leftNeighborID  = -99998,
         rightNeighborID = -99998,
         region          = 902
     };
     downArrow = new ClickableTextureComponent(new Rectangle(xPositionOnScreen + width + 16, yPositionOnScreen + height - 64, 44, 48), Game1.mouseCursors, new Rectangle(421, 472, 11, 12), 4f)
     {
         myID            = 801,
         upNeighborID    = 800,
         leftNeighborID  = -99998,
         downNeighborID  = -99998,
         rightNeighborID = -99998,
         region          = 902
     };
     scrollBar       = new ClickableTextureComponent(new Rectangle(upArrow.bounds.X + 12, upArrow.bounds.Y + upArrow.bounds.Height + 4, 24, 40), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), 4f);
     scrollBarRunner = new Rectangle(scrollBar.bounds.X, upArrow.bounds.Y + upArrow.bounds.Height + 4, scrollBar.bounds.Width, height - 64 - upArrow.bounds.Height - 28);
     okDeleteButton  = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10992"), new Rectangle((int)Utility.getTopLeftPositionForCenteringOnScreen(64, 64).X - 64, (int)Utility.getTopLeftPositionForCenteringOnScreen(64, 64).Y + 128, 64, 64), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46), 1f)
     {
         myID            = 802,
         rightNeighborID = 803,
         region          = 903
     };
     cancelDeleteButton = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10993"), new Rectangle((int)Utility.getTopLeftPositionForCenteringOnScreen(64, 64).X + 64, (int)Utility.getTopLeftPositionForCenteringOnScreen(64, 64).Y + 128, 64, 64), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 47), 1f)
     {
         myID           = 803,
         leftNeighborID = 802,
         region         = 903
     };
     for (int i = 0; i < 4; i++)
     {
         slotButtons.Add(new ClickableComponent(new Rectangle(xPositionOnScreen + 16, yPositionOnScreen + 16 + i * (height / 4), width - 32, height / 4 + 4), string.Concat(i))
         {
             myID            = i,
             region          = 900,
             downNeighborID  = ((i < 3) ? (-99998) : (-7777)),
             upNeighborID    = ((i > 0) ? (-99998) : (-7777)),
             rightNeighborID = -99998,
             fullyImmutable  = true
         });
         if (hasDeleteButtons())
         {
             deleteButtons.Add(new ClickableTextureComponent("", new Rectangle(xPositionOnScreen + width - 64 - 4, yPositionOnScreen + 32 + 4 + i * (height / 4), 48, 48), "", Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.10994"), Game1.mouseCursors, new Rectangle(322, 498, 12, 12), 3f)
             {
                 myID                  = i + 100,
                 region                = 901,
                 leftNeighborID        = -99998,
                 downNeighborImmutable = true,
                 downNeighborID        = -99998,
                 upNeighborImmutable   = true,
                 upNeighborID          = ((i > 0) ? (-99998) : (-1)),
                 rightNeighborID       = -99998
             });
         }
     }
     startListPopulation();
     if (Game1.options.snappyMenus && Game1.options.gamepadControls)
     {
         populateClickableComponentList();
         snapToDefaultClickableComponent();
     }
     UpdateButtons();
 }
Example #19
0
        public FieldOfficeMenu(IslandFieldOffice office)
            : base(highlightBones, okButton: true, trashCan: true, 16, 132)
        {
            this.office            = office;
            fieldOfficeMenuTexture = Game1.temporaryContent.Load <Texture2D>("LooseSprites\\FieldOfficeDonationMenu");
            Point topLeft = new Point(xPositionOnScreen + 32, yPositionOnScreen + 96);

            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 76, topLeft.Y + 180, 64, 64), office.piecesDonated[0] ? new Object(823, 1) : null)
            {
                label = "823"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 144, topLeft.Y + 180, 64, 64), office.piecesDonated[1] ? new Object(824, 1) : null)
            {
                label = "824"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 212, topLeft.Y + 180, 64, 64), office.piecesDonated[2] ? new Object(823, 1) : null)
            {
                label = "823"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 76, topLeft.Y + 112, 64, 64), office.piecesDonated[3] ? new Object(822, 1) : null)
            {
                label = "822"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 144, topLeft.Y + 112, 64, 64), office.piecesDonated[4] ? new Object(821, 1) : null)
            {
                label = "821"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 212, topLeft.Y + 112, 64, 64), office.piecesDonated[5] ? new Object(820, 1) : null)
            {
                label = "820"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 412, topLeft.Y + 48, 64, 64), office.piecesDonated[6] ? new Object(826, 1) : null)
            {
                label = "826"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 412, topLeft.Y + 128, 64, 64), office.piecesDonated[7] ? new Object(826, 1) : null)
            {
                label = "826"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 412, topLeft.Y + 208, 64, 64), office.piecesDonated[8] ? new Object(825, 1) : null)
            {
                label = "825"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 616, topLeft.Y + 36, 64, 64), office.piecesDonated[9] ? new Object(827, 1) : null)
            {
                label = "827"
            });
            pieceHolders.Add(new ClickableComponent(new Rectangle(topLeft.X + 624, topLeft.Y + 156, 64, 64), office.piecesDonated[10] ? new Object(828, 1) : null)
            {
                label = "828"
            });
            if (Game1.activeClickableMenu == null)
            {
                Game1.playSound("bigSelect");
            }
            for (int i = 0; i < pieceHolders.Count; i++)
            {
                ClickableComponent clickableComponent = pieceHolders[i];
                clickableComponent.upNeighborID = (clickableComponent.downNeighborID = (clickableComponent.rightNeighborID = (clickableComponent.leftNeighborID = -99998)));
                clickableComponent.myID         = 1000 + i;
            }
            foreach (ClickableComponent item in inventory.GetBorder(InventoryMenu.BorderSide.Top))
            {
                item.upNeighborID = -99998;
            }
            foreach (ClickableComponent item2 in inventory.GetBorder(InventoryMenu.BorderSide.Right))
            {
                item2.rightNeighborID        = 4857;
                item2.rightNeighborImmutable = true;
            }
            populateClickableComponentList();
            if (Game1.options.SnappyMenus)
            {
                snapToDefaultClickableComponent();
            }
            trashCan.leftNeighborID = (okButton.leftNeighborID = 11);
            exitFunction            = delegate
            {
                if (madeADonation)
                {
                    string str = gotReward ? ("#$b#" + Game1.content.LoadString("Strings\\Locations:FieldOfficeDonated_Reward")) : "";
                    Game1.drawDialogue(office.getSafariGuy(), Game1.content.LoadString("Strings\\Locations:FieldOfficeDonated_" + Game1.random.Next(4)) + str);
                    if (gotReward)
                    {
                        Game1.multiplayer.globalChatInfoMessage("FieldOfficeCompleteSet", Game1.player.Name);
                    }
                }
            };
        }
Example #20
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();
        }
Example #21
0
        public LetterViewerMenu(string mail, string mailTitle)
            : base((int)Utility.getTopLeftPositionForCenteringOnScreen(320 * Game1.pixelZoom, 180 * Game1.pixelZoom, 0, 0).X, (int)Utility.getTopLeftPositionForCenteringOnScreen(320 * Game1.pixelZoom, 180 * Game1.pixelZoom, 0, 0).Y, 320 * Game1.pixelZoom, 180 * Game1.pixelZoom, true)
        {
            this.isMail = true;
            Game1.playSound("shwip");
            ClickableTextureComponent textureComponent1 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 16 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num1 = 101;

            textureComponent1.myID = num1;
            int num2 = 102;

            textureComponent1.rightNeighborID = num2;
            this.backButton = textureComponent1;
            ClickableTextureComponent textureComponent2 = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 16 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), (float)Game1.pixelZoom, false);
            int num3 = 102;

            textureComponent2.myID = num3;
            int num4 = 101;

            textureComponent2.leftNeighborID = num4;
            this.forwardButton     = textureComponent2;
            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            = 103,
                rightNeighborID = 102,
                leftNeighborID  = 101
            };
            this.mailTitle     = mailTitle;
            this.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   oldValue  = mail.Substring(mail.IndexOf("%item"), mail.IndexOf("%%") + 2 - mail.IndexOf("%item"));
                string[] strArray1 = oldValue.Split(' ');
                mail = mail.Replace(oldValue, "");
                if (strArray1[1].Equals("object"))
                {
                    int maxValue = strArray1.Length - 1;
                    int num5     = Game1.random.Next(2, maxValue);
                    int index    = num5 - num5 % 2;
                    StardewValley.Object @object = new StardewValley.Object(Vector2.Zero, Convert.ToInt32(strArray1[index]), Convert.ToInt32(strArray1[index + 1]));
                    this.itemsToGrab.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 24 * Game1.pixelZoom, 24 * Game1.pixelZoom, 24 * Game1.pixelZoom), (Item)@object)
                    {
                        myID            = 104,
                        leftNeighborID  = 101,
                        rightNeighborID = 102
                    });
                    this.backButton.rightNeighborID   = 104;
                    this.forwardButton.leftNeighborID = 104;
                }
                else if (strArray1[1].Equals("tools"))
                {
                    for (int index = 2; index < strArray1.Length; ++index)
                    {
                        Item   obj = (Item)null;
                        string str = strArray1[index];
                        if (!(str == "Axe"))
                        {
                            if (!(str == "Hoe"))
                            {
                                if (!(str == "Can"))
                                {
                                    if (!(str == "Scythe"))
                                    {
                                        if (str == "Pickaxe")
                                        {
                                            obj = (Item) new Pickaxe();
                                        }
                                    }
                                    else
                                    {
                                        obj = (Item) new MeleeWeapon(47);
                                    }
                                }
                                else
                                {
                                    obj = (Item) new WateringCan();
                                }
                            }
                            else
                            {
                                obj = (Item) new Hoe();
                            }
                        }
                        else
                        {
                            obj = (Item) new Axe();
                        }
                        if (obj != null)
                        {
                            this.itemsToGrab.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 24 * Game1.pixelZoom, 24 * Game1.pixelZoom, 24 * Game1.pixelZoom), obj));
                        }
                    }
                }
                else if (strArray1[1].Equals("bigobject"))
                {
                    int maxValue = strArray1.Length - 1;
                    int index    = Game1.random.Next(2, maxValue);
                    StardewValley.Object @object = new StardewValley.Object(Vector2.Zero, Convert.ToInt32(strArray1[index]), false);
                    this.itemsToGrab.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2 - 12 * Game1.pixelZoom, this.yPositionOnScreen + this.height - Game1.tileSize / 2 - 24 * Game1.pixelZoom, 24 * Game1.pixelZoom, 24 * Game1.pixelZoom), (Item)@object)
                    {
                        myID            = 104,
                        leftNeighborID  = 101,
                        rightNeighborID = 102
                    });
                    this.backButton.rightNeighborID   = 104;
                    this.forwardButton.leftNeighborID = 104;
                }
                else if (strArray1[1].Equals("money"))
                {
                    int num5 = strArray1.Length > 4 ? Game1.random.Next(Convert.ToInt32(strArray1[2]), Convert.ToInt32(strArray1[3])) : Convert.ToInt32(strArray1[2]);
                    int num6 = num5 - num5 % 10;
                    Game1.player.Money += num6;
                    this.moneyIncluded  = num6;
                }
                else if (strArray1[1].Equals("quest"))
                {
                    this.questID = Convert.ToInt32(strArray1[2].Replace("%%", ""));
                    if (strArray1.Length > 4)
                    {
                        if (!Game1.player.mailReceived.Contains("NOQUEST_" + (object)this.questID))
                        {
                            Game1.player.addQuest(this.questID);
                        }
                        this.questID = -1;
                    }
                    this.backButton.rightNeighborID   = 103;
                    this.forwardButton.leftNeighborID = 103;
                }
                else if (strArray1[1].Equals("cookingRecipe"))
                {
                    Dictionary <string, string> dictionary = Game1.content.Load <Dictionary <string, string> >("Data\\CookingRecipes");
                    foreach (string key in dictionary.Keys)
                    {
                        string[] strArray2 = dictionary[key].Split('/');
                        string[] strArray3 = strArray2[3].Split(' ');
                        if (strArray3[0].Equals("f") && strArray3[1].Equals(mailTitle.Replace("Cooking", "")) && (Game1.player.friendships[strArray3[1]][0] >= Convert.ToInt32(strArray3[2]) * 250 && !Game1.player.cookingRecipes.ContainsKey(key)))
                        {
                            Game1.player.cookingRecipes.Add(key, 0);
                            this.learnedRecipe = key;
                            if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.en)
                            {
                                this.learnedRecipe = strArray2[strArray2.Length - 1];
                            }
                            this.cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_cooking");
                            break;
                        }
                    }
                }
                else if (strArray1[1].Equals("craftingRecipe"))
                {
                    this.learnedRecipe = strArray1[2].Replace('_', ' ');
                    Game1.player.craftingRecipes.Add(this.learnedRecipe, 0);
                    this.cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_crafting");
                }
            }
            Random r = new Random((int)(Game1.uniqueIDForThisGame / 2UL) - Game1.year);

            mail             = mail.Replace("%secretsanta", Utility.getRandomTownNPC(r, Utility.getFarmerNumberFromFarmer(Game1.player)).displayName);
            this.mailMessage = SpriteText.getStringBrokenIntoSectionsOfHeight(mail, this.width - Game1.tileSize, this.height - Game1.tileSize * 2);
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
            if (this.mailMessage == null || this.mailMessage.Count > 1)
            {
                return;
            }
            this.backButton.myID    = -100;
            this.forwardButton.myID = -100;
        }
Example #22
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 = this.height + Game1.tileSize;
            for (int index = 0; index < stock.Count; ++index)
            {
                List <ClickableTextureComponent> animalsToPurchase = this.animalsToPurchase;
                ClickableTextureComponent        textureComponent  = new ClickableTextureComponent(string.Concat((object)stock[index].salePrice()), new Microsoft.Xna.Framework.Rectangle(this.xPositionOnScreen + IClickableMenu.borderWidth + index % 3 * Game1.tileSize * 2, this.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth / 2 + index / 3 * (Game1.tileSize + Game1.tileSize / 3), Game1.tileSize * 2, Game1.tileSize), (string)null, stock[index].Name, Game1.mouseCursors, new Microsoft.Xna.Framework.Rectangle(index % 3 * 16 * 2, 448 + index / 3 * 16, 32, 16), 4f, stock[index].type == null);
                StardewValley.Object             @object           = stock[index];
                textureComponent.item = (Item)@object;
                int num1 = index;
                textureComponent.myID = num1;
                int num2 = index % 3 == 2 ? -1 : index + 1;
                textureComponent.rightNeighborID = num2;
                int num3 = index % 3 == 0 ? -1 : index - 1;
                textureComponent.leftNeighborID = num3;
                int num4 = index + 3;
                textureComponent.downNeighborID = num4;
                int num5 = index - 3;
                textureComponent.upNeighborID = num5;
                animalsToPurchase.Add(textureComponent);
            }
            ClickableTextureComponent textureComponent1 = 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);
            int num6 = 101;

            textureComponent1.myID = num6;
            int num7 = 103;

            textureComponent1.upNeighborID = num7;
            int num8 = 103;

            textureComponent1.leftNeighborID = num8;
            this.okButton = textureComponent1;
            ClickableTextureComponent textureComponent2 = 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);
            int num9 = 103;

            textureComponent2.myID = num9;
            int num10 = 101;

            textureComponent2.downNeighborID = num10;
            int num11 = 101;

            textureComponent2.rightNeighborID = num11;
            this.randomButton = textureComponent2;
            PurchaseAnimalsMenu.menuHeight = Game1.tileSize * 5;
            PurchaseAnimalsMenu.menuWidth  = Game1.tileSize * 7;
            this.textBox        = new TextBox((Texture2D)null, (Texture2D)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
            };
            ClickableTextureComponent textureComponent3 = 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);
            int num12 = 103;

            textureComponent3.myID = num12;
            int num13 = 102;

            textureComponent3.leftNeighborID = num13;
            int num14 = 101;

            textureComponent3.downNeighborID = num14;
            int num15 = 101;

            textureComponent3.rightNeighborID = num15;
            this.randomButton = textureComponent3;
            ClickableTextureComponent textureComponent4 = 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);
            int num16 = 102;

            textureComponent4.myID = num16;
            int num17 = 103;

            textureComponent4.rightNeighborID = num17;
            int num18 = 104;

            textureComponent4.leftNeighborID = num18;
            int num19 = 101;

            textureComponent4.downNeighborID = num19;
            this.doneNamingButton            = textureComponent4;
            if (!Game1.options.SnappyMenus)
            {
                return;
            }
            this.populateClickableComponentList();
            this.snapToDefaultClickableComponent();
        }
 // Token: 0x06000EB9 RID: 3769 RVA: 0x0012C1CC File Offset: 0x0012A3CC
 public override int moveCursorInDirection(int direction)
 {
     if (this.currentRegion == 0)
     {
         int result = this.inventory.moveCursorInDirection(direction);
         if (result == 0)
         {
             return(0);
         }
         if (result == 2)
         {
             this.currentRegion = 1;
             this.equipmentIcons[0].snapMouseCursor();
         }
     }
     else if (this.currentRegion == 1)
     {
         if (direction == 0)
         {
             this.currentRegion = 0;
             ClickableComponent c = base.getLastClickableComponentInThisListThatContainsThisXCoord(this.inventory.inventory, Game1.getMousePosition().X);
             if (c != null)
             {
                 c.snapMouseCursor();
             }
         }
         else if (direction == 2)
         {
             this.currentRegion = 2;
             this.equipmentIcons[1].snapMouseCursor();
         }
     }
     else if (this.currentRegion == 2)
     {
         if (direction == 0)
         {
             this.currentRegion = 1;
             this.equipmentIcons[0].snapMouseCursor();
         }
         else if (direction == 2)
         {
             this.currentRegion = 3;
             this.equipmentIcons[2].snapMouseCursor();
         }
     }
     else if (this.currentRegion == 3)
     {
         if (direction == 0)
         {
             this.currentRegion = 2;
             this.equipmentIcons[1].snapMouseCursor();
         }
         else if (direction == 2)
         {
             this.currentRegion = 4;
             this.equipmentIcons[3].snapMouseCursor();
         }
     }
     else if (this.currentRegion == 4 && direction == 0)
     {
         this.currentRegion = 3;
         this.equipmentIcons[2].snapMouseCursor();
     }
     return(-1);
 }