private void Input_ButtonPressed_DebugHelp(object sender, ButtonPressedEventArgs e) { if (cheats.JustPressed()) { Game1.chatBox.enableCheats = true; } else if (wiz.JustPressed()) { Game1.chatBox.cheat("warp wiz 2 12"); } else if (door.JustPressed()) { Game1.chatBox.cheat("warp farm 15 15"); } else if (slot.JustPressed()) { Game1.chatBox.cheat("warp farm 16 15"); } else if (home.JustPressed()) { Game1.chatBox.cheat("warp farmhouse"); } else if (localInfoFix.JustPressed()) { LocalInfo(); } else if (mayo.JustPressed()) { Helper.ConsoleCommands.Trigger("player_add", new string[] { //"name", "mayonnaise", "69", "4"}); "name", "crystal fruit", "150" }); } else if (dayupdate.JustPressed()) { var winterindoors = Game1.getFarm().buildings.OfType <DimensionBuilding>().Where(db => db.modData[DimensionBuilding.ModData_ShedDimensionKey] == "WinterDimension").Single().indoors.Value; winterindoors.spawnObjects(); //winterindoors.DayUpdate(((Game1.dayOfMonth + tries - 1) % 28 + 1)); //tries++; //Game1.getLocationFromName("Backwoods").spawnObjects(); //tries++; } }
/********* ** Private methods *********/ /// <summary>Raised when button is pressed</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void CheckHotkey(object sender, ButtonsChangedEventArgs e) { if (myKeybinds.Value == null) { return; } KeybindList keybinds = myKeybinds.Value; Farmer player = Game1.player; if (!keybinds.JustPressed()) { return; } if (bestItem.Value != null && keybinds.GetByType(KeybindType.CancelKeybind).IsPressed()) { keybinds.SuppressType(Helper, KeybindType.CancelKeybind); RestoreLastItem(player); return; } if (bestItem.Value != null && keybinds.PressedByType(KeybindType.ForceEatFoodKeybind)) { keybinds.SuppressType(Helper, KeybindType.ForceEatFoodKeybind); EatBestItem(player); return; } if (keybinds.PressedByType(KeybindType.CycleFoodKeybind)) { keybinds.SuppressType(Helper, KeybindType.CycleFoodKeybind); CheckBestItems(player); } if (bestItem != null && (keybinds.PressedByType(KeybindType.ForceEatFoodKeybind) || keybinds.PressedByType(KeybindType.EatCurrentFoodKeybind))) { keybinds.SuppressType(Helper, KeybindType.ForceEatFoodKeybind); keybinds.SuppressType(Helper, KeybindType.EatCurrentFoodKeybind); EatBestItem(player); } }
private void GenericMCColorPicker(IGenericModConfigMenuApi GenericMC, IManifest mod) { MinigameColor state = null; void Draw(SpriteBatch b, Vector2 pos) { if (state == null) { state = new MinigameColor() { color = config.MinigameColor, pos = pos, whichSlider = 0 } } ; KeybindList click = KeybindList.Parse("MouseLeft"); int width = Math.Min(Game1.uiViewport.Width / 4, 400); byte mousePercentage = (byte)(int)((Utility.Clamp(Game1.getOldMouseX(), pos.X, pos.X + width) - pos.X) / width * 255); Rectangle barR = new Rectangle((int)pos.X, (int)pos.Y, width, 24); Rectangle barG = new Rectangle((int)pos.X, (int)pos.Y + 80, width, 24); Rectangle barB = new Rectangle((int)pos.X, (int)pos.Y + 160, width, 24); if ((barR.Contains(Game1.getMouseX(), Game1.getMouseY()) && click.JustPressed()) || (state.whichSlider == 1 && click.IsDown())) { state.whichSlider = 1; state.color.R = mousePercentage; } else if ((barG.Contains(Game1.getMouseX(), Game1.getMouseY()) && click.JustPressed()) || (state.whichSlider == 2 && click.IsDown())) { state.whichSlider = 2; state.color.G = mousePercentage; } else if ((barB.Contains(Game1.getMouseX(), Game1.getMouseY()) && click.JustPressed()) || (state.whichSlider == 3 && click.IsDown())) { state.whichSlider = 3; state.color.B = mousePercentage; } else if (state.whichSlider != 0) { state.whichSlider = 0; } float scale = width / 400f; Rectangle posR = new Rectangle((int)(pos.X + (state.color.R / 255f) * (width - 40)), (int)pos.Y, 40, 24); Rectangle posG = new Rectangle((int)(pos.X + (state.color.G / 255f) * (width - 40)), (int)pos.Y + 80, 40, 24); Rectangle posB = new Rectangle((int)(pos.X + (state.color.B / 255f) * (width - 40)), (int)pos.Y + 160, 40, 24); StardewValley.Menus.IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), barR.X, barR.Y, barR.Width, barR.Height, Color.White, Game1.pixelZoom, false); StardewValley.Menus.IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), barG.X, barG.Y, barG.Width, barG.Height, Color.White, Game1.pixelZoom, false); StardewValley.Menus.IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), barB.X, barB.Y, barB.Width, barB.Height, Color.White, Game1.pixelZoom, false); b.Draw(Game1.mouseCursors, new Vector2(posR.X, posR.Y), new Rectangle(420, 441, 10, 6), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); b.Draw(Game1.mouseCursors, new Vector2(posG.X, posG.Y), new Rectangle(420, 441, 10, 6), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); b.Draw(Game1.mouseCursors, new Vector2(posB.X, posB.Y), new Rectangle(420, 441, 10, 6), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); b.DrawString(Game1.smallFont, "R:" + string.Format("{0,6}", state.color.R), new Vector2(barR.X + width + 20, barR.Y - 4), Color.Black); b.DrawString(Game1.smallFont, "G:" + string.Format("{0,6}", state.color.G), new Vector2(barG.X + width + 20, barG.Y - 4), Color.Black); b.DrawString(Game1.smallFont, "B:" + string.Format("{0,6}", state.color.B), new Vector2(barB.X + width + 20, barB.Y - 4), Color.Black); Vector2 screenMid = new Vector2(pos.X - (width / 1.5f), pos.Y + 90); b.Draw(Game1.mouseCursors, screenMid, new Rectangle(31, 1870, 73, 49), state.color, 0f, new Vector2(36.5f, 22.5f), 4f * scale, SpriteEffects.None, 0.2f); b.Draw(MinigamesStart.minigameTextures[0], screenMid, null, state.color, 0f, new Vector2(69f, 37f), 2f * scale, SpriteEffects.None, 0.3f); b.Draw(MinigamesStart.minigameTextures[1], screenMid + new Vector2(-50f, 0f), new Rectangle(355, 86, 26, 26), state.color, 0f, new Vector2(13f), 1f * scale, SpriteEffects.None, 0.4f); b.Draw(MinigamesStart.minigameTextures[1], screenMid + new Vector2(50f, 0), new Rectangle(322, 82, 12, 12), state.color, 0f, new Vector2(6f), 2f * scale, SpriteEffects.None, 0.4f); b.Draw(Game1.mouseCursors, screenMid, new Rectangle(301, 288, 15, 15), state.color * 0.95f, 0f, new Vector2(7.5f, 7.5f), 2f * scale, SpriteEffects.None, 0.5f); b.DrawString(Game1.smallFont, "5", screenMid + new Vector2(0, 2f), state.color, 0f, Game1.smallFont.MeasureString("5") / 2f, 1f * scale, SpriteEffects.None, 0.51f); b.Draw(Game1.mouseCursors, screenMid + new Vector2(width * -0.6f, -45), new Rectangle(395, 497, 3, 8), state.color, 0f, new Vector2(1.5f, 4f), 4f, SpriteEffects.None, 0.98f); b.Draw(Game1.mouseCursors, screenMid + new Vector2(width * -0.6f, 0), new Rectangle(407, 1660, 10, 10), state.color, 0f, new Vector2(5f), 3.3f, SpriteEffects.None, 0.98f); b.Draw(Game1.mouseCursors, screenMid + new Vector2(width * -0.6f, 45), new Rectangle(473, 36, 24, 24), state.color, 0f, new Vector2(12f), 2f, SpriteEffects.None, 0.98f); b.DrawString(Game1.smallFont, "A", screenMid + new Vector2(width * -0.6f, 47) - (Game1.smallFont.MeasureString("A") / 2 * 1.2f), state.color, 0f, Vector2.Zero, 1.2f, SpriteEffects.None, 1f); //text } void Save() { if (state == null) { return; } config.MinigameColor = state.color; } GenericMC.AddSectionTitle(mod, () => ". " + translate.Get("GenericMC.MinigameColor")); GenericMC.AddComplexOption(mod, () => "", () => "", Draw, Save, () => 300); }