public CookingLevelUpMenu(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 * 12; 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); this.newCraftingRecipes.Clear(); this.extraInfoForLevel.Clear(); Game1.player.completelyStopAnimatingOrDoingAction(); this.informationUp = true; this.isProfessionChooser = false; this.currentLevel = level; 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 = string.Concat(new object[] { "Level ", this.currentLevel, " Cooking" }); this.extraInfoForLevel = this.getExtraInfoForLevel(this.currentLevel); sourceRectForLevelIcon = new Rectangle(0, 0, 16, 16); if ((this.currentLevel == 5 || this.currentLevel == 10) /*&& this.currentSkill != 5*/) { this.professionsToChoose.Clear(); this.isProfessionChooser = true; if (this.currentLevel == 5) { this.professionsToChoose.Add(Mod.PROFESSION_SELLPRICE); this.professionsToChoose.Add(Mod.PROFESSION_BUFFTIME); } else if (Game1.player.professions.Contains(Mod.PROFESSION_SELLPRICE)) { this.professionsToChoose.Add(Mod.PROFESSION_CONSERVATION); this.professionsToChoose.Add(Mod.PROFESSION_SILVER); } else { this.professionsToChoose.Add(Mod.PROFESSION_BUFFLEVEL); this.professionsToChoose.Add(Mod.PROFESSION_BUFFPLAIN); } this.leftProfessionDescription = CookingLevelUpMenu.getProfessionDescription(this.professionsToChoose[0]); this.rightProfessionDescription = CookingLevelUpMenu.getProfessionDescription(this.professionsToChoose[1]); } int num = 0; this.height = num + Game1.tileSize * 4 + this.extraInfoForLevel.Count <string>() * Game1.tileSize * 3 / 4; Game1.player.freezePause = 100; this.gameWindowSizeChanged(Rectangle.Empty, Rectangle.Empty); }
private void initCookingSkill(SkillsPage skills) { int cookingLevel = getCookingLevel(); // Bunch of stuff from the constructor int num2 = 0; int num3 = skills.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - Game1.pixelZoom; int num4 = skills.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.pixelZoom * 3; for (int i = 4; i < 10; i += 5) { int j = 5; if (hasLuck) { j++; } string text = ""; string text2 = ""; bool flag = false; int num5 = -1; flag = (cookingLevel > i); num5 = getProfessionForSkill(i + 1); //Game1.player.getProfessionForSkill(5, i + 1); object[] args = new object[] { text, text2, CookingLevelUpMenu.getProfessionDescription(num5) }; Util.CallInstanceMethod(typeof(SkillsPage), skills, "parseProfessionDescription", args); text = (string)args[0]; text2 = (string)args[1]; if (flag && (i + 1) % 5 == 0) { var skillBars = (List <ClickableTextureComponent>)Util.GetInstanceField(typeof(SkillsPage), skills, "skillBars"); skillBars.Add(new ClickableTextureComponent(string.Concat(num5), new Rectangle(num2 + num3 - Game1.pixelZoom + i * (Game1.tileSize / 2 + Game1.pixelZoom), num4 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6), 14 * Game1.pixelZoom, 9 * Game1.pixelZoom), null, text, Game1.mouseCursors, new Rectangle(159, 338, 14, 9), (float)Game1.pixelZoom, true)); } num2 += Game1.pixelZoom * 6; } int k = 5; if (hasLuck) { k++; } int num6 = k; if (num6 == 1) { num6 = 3; } else if (num6 == 3) { num6 = 1; } string text3 = ""; if (cookingLevel > 0) { text3 = string.Concat(new object[] { "+", (int)((getEdibilityMultiplier() - 1) * 100), "% edibility in home-cooked food", Environment.NewLine, }); } var skillAreas = (List <ClickableTextureComponent>)Util.GetInstanceField(typeof(SkillsPage), skills, "skillAreas"); skillAreas.Add(new ClickableTextureComponent(string.Concat(num6), new Rectangle(num3 - Game1.tileSize * 2 - Game1.tileSize * 3 / 4, num4 + k * (Game1.tileSize / 2 + Game1.pixelZoom * 6), Game1.tileSize * 2 + Game1.pixelZoom * 5, 9 * Game1.pixelZoom), string.Concat(num6), text3, null, Rectangle.Empty, 1f, false)); }
public override void update(GameTime time) { if (!this.isActive) { base.exitThisMenu(true); return; } for (int i = this.littleStars.Count - 1; i >= 0; i--) { if (this.littleStars[i].update(time)) { this.littleStars.RemoveAt(i); } } if (Game1.random.NextDouble() < 0.03) { Vector2 position = new Vector2(0f, (float)(Game1.random.Next(this.yPositionOnScreen - Game1.tileSize * 2, this.yPositionOnScreen - Game1.pixelZoom) / (Game1.pixelZoom * 5) * Game1.pixelZoom * 5 + Game1.tileSize / 2)); if (Game1.random.NextDouble() < 0.5) { position.X = (float)Game1.random.Next(this.xPositionOnScreen + this.width / 2 - 57 * Game1.pixelZoom, this.xPositionOnScreen + this.width / 2 - 33 * Game1.pixelZoom); } else { position.X = (float)Game1.random.Next(this.xPositionOnScreen + this.width / 2 + 29 * Game1.pixelZoom, this.xPositionOnScreen + this.width - 40 * Game1.pixelZoom); } if (position.Y < (float)(this.yPositionOnScreen - Game1.tileSize - Game1.pixelZoom * 2)) { position.X = (float)Game1.random.Next(this.xPositionOnScreen + this.width / 2 - 29 * Game1.pixelZoom, this.xPositionOnScreen + this.width / 2 + 29 * Game1.pixelZoom); } position.X = position.X / (float)(Game1.pixelZoom * 5) * (float)Game1.pixelZoom * 5f; this.littleStars.Add(new TemporaryAnimatedSprite("Cursors", new Rectangle(364, 79, 5, 5), 80f, 7, 1, position, false, false, 1f, 0f, Color.White, (float)Game1.pixelZoom, 0f, 0f, 0f, false) { local = true }); } if (this.timerBeforeStart > 0) { this.timerBeforeStart -= time.ElapsedGameTime.Milliseconds; return; } if (this.isActive && this.isProfessionChooser) { this.leftProfessionColor = Game1.textColor; this.rightProfessionColor = Game1.textColor; Game1.player.completelyStopAnimatingOrDoingAction(); Game1.player.freezePause = 100; if (Game1.getMouseY() > this.yPositionOnScreen + Game1.tileSize * 3 && Game1.getMouseY() < this.yPositionOnScreen + this.height) { if (Game1.getMouseX() > this.xPositionOnScreen && Game1.getMouseX() < this.xPositionOnScreen + this.width / 2) { this.leftProfessionColor = Color.Green; if (((Mouse.GetState().LeftButton == ButtonState.Pressed && this.oldMouseState.LeftButton == ButtonState.Released) || (Game1.options.gamepadControls && GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) && !Game1.oldPadState.IsButtonDown(Buttons.A))) && this.readyToClose()) { Game1.player.professions.Add(this.professionsToChoose[0]); this.getImmediateProfessionPerk(this.professionsToChoose[0]); this.isActive = false; this.informationUp = false; this.isProfessionChooser = false; } } else if (Game1.getMouseX() > this.xPositionOnScreen + this.width / 2 && Game1.getMouseX() < this.xPositionOnScreen + this.width) { this.rightProfessionColor = Color.Green; if (((Mouse.GetState().LeftButton == ButtonState.Pressed && this.oldMouseState.LeftButton == ButtonState.Released) || (Game1.options.gamepadControls && GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) && !Game1.oldPadState.IsButtonDown(Buttons.A))) && this.readyToClose()) { Game1.player.professions.Add(this.professionsToChoose[1]); this.getImmediateProfessionPerk(this.professionsToChoose[1]); this.isActive = false; this.informationUp = false; this.isProfessionChooser = false; } } } this.height = Game1.tileSize * 8; } this.oldMouseState = Mouse.GetState(); if (this.isActive && !this.informationUp && this.starIcon != null) { if (this.starIcon.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY())) { this.starIcon.sourceRect.X = 294; } else { this.starIcon.sourceRect.X = 310; } } if (this.isActive && this.starIcon != null && !this.informationUp && (this.oldMouseState.LeftButton == ButtonState.Pressed || (Game1.options.gamepadControls && Game1.oldPadState.IsButtonDown(Buttons.A))) && this.starIcon.containsPoint(this.oldMouseState.X, this.oldMouseState.Y)) { this.newCraftingRecipes.Clear(); this.extraInfoForLevel.Clear(); Game1.player.completelyStopAnimatingOrDoingAction(); Game1.playSound("bigSelect"); this.informationUp = true; this.isProfessionChooser = false; this.currentLevel = Mod.newCookingLevels.First();//Game1.player.newLevels.First<Point>().Y; this.title = string.Concat(new object[] { "Level ", this.currentLevel, " Cooking" }); this.extraInfoForLevel = this.getExtraInfoForLevel(this.currentLevel); sourceRectForLevelIcon = new Rectangle(0, 0, 16, 16); if ((this.currentLevel == 5 || this.currentLevel == 10) /*&& this.currentSkill != 5*/) { this.professionsToChoose.Clear(); this.isProfessionChooser = true; if (this.currentLevel == 5) { this.professionsToChoose.Add(Mod.PROFESSION_SELLPRICE); this.professionsToChoose.Add(Mod.PROFESSION_BUFFTIME); } else if (Game1.player.professions.Contains(Mod.PROFESSION_SELLPRICE)) { this.professionsToChoose.Add(Mod.PROFESSION_CONSERVATION); this.professionsToChoose.Add(Mod.PROFESSION_SILVER); } else { this.professionsToChoose.Add(Mod.PROFESSION_BUFFLEVEL); this.professionsToChoose.Add(Mod.PROFESSION_BUFFPLAIN); } this.leftProfessionDescription = CookingLevelUpMenu.getProfessionDescription(this.professionsToChoose[0]); this.rightProfessionDescription = CookingLevelUpMenu.getProfessionDescription(this.professionsToChoose[1]); } int num = 0; this.height = num + Game1.tileSize * 4 + this.extraInfoForLevel.Count <string>() * Game1.tileSize * 3 / 4; Game1.player.freezePause = 100; } if (this.isActive && this.informationUp) { Game1.player.completelyStopAnimatingOrDoingAction(); if (this.okButton.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) && !this.isProfessionChooser) { this.okButton.scale = Math.Min(1.1f, this.okButton.scale + 0.05f); if ((this.oldMouseState.LeftButton == ButtonState.Pressed || (Game1.options.gamepadControls && Game1.oldPadState.IsButtonDown(Buttons.A))) && this.readyToClose()) { this.getLevelPerk(this.currentLevel); this.isActive = false; this.informationUp = false; } } else { this.okButton.scale = Math.Max(1f, this.okButton.scale - 0.05f); } Game1.player.freezePause = 100; } }