/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="costMultiplier">The multiplier applied to the cost of buying back a collectable.</param> public BuyBackMenu(double costMultiplier) : base(Game1.viewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2) { // initialise this.CostMultiplier = costMultiplier; // create components this.SideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4 + this.WidthToMoveActiveTab, this.yPositionOnScreen + Game1.tileSize * 2, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Shipped"), Game1.mouseCursors, new Rectangle(640, 80, 16, 16), Game1.pixelZoom)); this.Collections.Add(BuyBackMenu.OrganicsTab, new List <List <ClickableTextureComponent> >()); this.SideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 3, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Fish"), Game1.mouseCursors, new Rectangle(640, 64, 16, 16), Game1.pixelZoom)); this.Collections.Add(BuyBackMenu.FishTab, new List <List <ClickableTextureComponent> >()); this.SideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 4, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Artifacts"), Game1.mouseCursors, new Rectangle(656, 64, 16, 16), Game1.pixelZoom)); this.Collections.Add(BuyBackMenu.ArchaeologyTab, new List <List <ClickableTextureComponent> >()); this.SideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 5, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Minerals"), Game1.mouseCursors, new Rectangle(672, 64, 16, 16), Game1.pixelZoom)); this.Collections.Add(BuyBackMenu.MineralsTab, new List <List <ClickableTextureComponent> >()); this.SideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 6, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Cooking"), Game1.mouseCursors, new Rectangle(688, 64, 16, 16), Game1.pixelZoom)); this.Collections.Add(BuyBackMenu.CookingTab, new List <List <ClickableTextureComponent> >()); this.SideTabs.Add(new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen - Game1.tileSize * 3 / 4, this.yPositionOnScreen + Game1.tileSize * 7, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:Collections_Achievements"), Game1.mouseCursors, new Rectangle(656, 80, 16, 16), Game1.pixelZoom)); this.Collections.Add(BuyBackMenu.AchievementsTab, new List <List <ClickableTextureComponent> >()); this.BackButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3 / 4, this.yPositionOnScreen + this.height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(352, 495, 12, 11), Game1.pixelZoom); this.ForwardButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2 - 15 * Game1.pixelZoom, this.yPositionOnScreen + this.height - 20 * Game1.pixelZoom, 12 * Game1.pixelZoom, 11 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(365, 495, 12, 11), Game1.pixelZoom); int[] array = new int[this.SideTabs.Count]; int num = this.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearSideBorder; int num2 = this.yPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder - Game1.tileSize / 4; int num3 = 10; foreach (KeyValuePair <int, string> entry in Game1.objectInformation) { string fields = entry.Value.Split('/')[3]; bool drawShadow = false; int selectedTab; if (fields.Contains("Arch")) { selectedTab = BuyBackMenu.ArchaeologyTab; if (Game1.player.archaeologyFound.ContainsKey(entry.Key)) { drawShadow = true; } } else if (fields.Contains("Fish")) { if (entry.Key >= 167 && entry.Key < 173) { continue; } selectedTab = BuyBackMenu.FishTab; if (Game1.player.fishCaught.ContainsKey(entry.Key)) { drawShadow = true; } } else if (fields.Contains("Mineral") || fields.Substring(fields.Length - 3).Equals("-2")) { selectedTab = BuyBackMenu.MineralsTab; if (Game1.player.mineralsFound.ContainsKey(entry.Key)) { drawShadow = true; } } else if (fields.Contains("Cooking") || fields.Substring(fields.Length - 3).Equals("-7")) { selectedTab = BuyBackMenu.CookingTab; if (Game1.player.recipesCooked.ContainsKey(entry.Key)) { drawShadow = true; } if (entry.Key == 217 || entry.Key == 772 || entry.Key == 773) { continue; } } else { if (!Object.isPotentialBasicShippedCategory(entry.Key, fields.Substring(fields.Length - 3))) { continue; } selectedTab = BuyBackMenu.OrganicsTab; if (Game1.player.basicShipped.ContainsKey(entry.Key)) { drawShadow = true; } } int x2 = num + array[selectedTab] % num3 * (Game1.tileSize + 4); int num5 = num2 + array[selectedTab] / num3 * (Game1.tileSize + 4); if (num5 > this.yPositionOnScreen + this.height - 128) { this.Collections[selectedTab].Add(new List <ClickableTextureComponent>()); array[selectedTab] = 0; x2 = num; num5 = num2; } if (this.Collections[selectedTab].Count == 0) { this.Collections[selectedTab].Add(new List <ClickableTextureComponent>()); } this.Collections[selectedTab].Last().Add(new ClickableTextureComponent(entry.Key + " " + drawShadow, new Rectangle(x2, num5, Game1.tileSize, Game1.tileSize), null, "", Game1.objectSpriteSheet, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, entry.Key, 16, 16), Game1.pixelZoom, drawShadow)); array[selectedTab]++; } if (this.Collections[5].Count == 0) { this.Collections[5].Add(new List <ClickableTextureComponent>()); } foreach (KeyValuePair <int, string> current2 in Game1.achievements) { bool flag = Game1.player.achievements.Contains(current2.Key); string[] array2 = current2.Value.Split('^'); if (flag || (array2[2].Equals("true") && (array2[3].Equals("-1") || this.FarmerHasAchievements(array2[3])))) { int x3 = num + array[5] % num3 * (Game1.tileSize + 4); int y2 = num2 + array[5] / num3 * (Game1.tileSize + 4); this.Collections[5][0].Add(new ClickableTextureComponent(current2.Key + " " + flag, new Rectangle(x3, y2, Game1.tileSize, Game1.tileSize), null, "", Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 25), 1f)); array[5]++; } } }
/// <summary>Get all shippable items.</summary> /// <remarks>Derived from <see cref="Utility.hasFarmerShippedAllItems"/>.</remarks> public IEnumerable <KeyValuePair <int, bool> > GetFullShipmentAchievementItems() { return( from obj in this.Objects.Value where obj.Type != "Arch" && obj.Type != "Fish" && obj.Type != "Mineral" && obj.Type != "Cooking" && SObject.isPotentialBasicShippedCategory(obj.ParentSpriteIndex, obj.Category.ToString()) select new KeyValuePair <int, bool>(obj.ParentSpriteIndex, Game1.player.basicShipped.ContainsKey(obj.ParentSpriteIndex)) ); }