public static void GameLoop_UpdateTicked(object sender, UpdateTickedEventArgs e) { if (ModEntry.modActive && (Helper.Input.IsDown(Config.PasteButton) || Helper.Input.IsSuppressed(Config.PasteButton)) && ModEntry.pastedTileLoc.X > -1 && ModEntry.pastedTileLoc != Game1.currentCursorTile) { TileActions.PasteCurrentTile(); } else if (ModEntry.modActive && (Helper.Input.IsDown(Config.RevertButton) || Helper.Input.IsSuppressed(Config.RevertButton)) && MapActions.MapHasTile(Game1.currentCursorTile)) { TileActions.RevertCurrentTile(); } }
public static void Input_ButtonPressed(object sender, ButtonPressedEventArgs e) { if (!Config.EnableMod || !Context.IsPlayerFree) { ModActions.DeactivateMod(); return; } if (e.Button == Config.ToggleButton) { Helper.Input.Suppress(e.Button); ModEntry.modActive = !ModEntry.modActive; ModEntry.copiedTileLoc = new Vector2(-1, -1); ModEntry.currentTileDict.Clear(); Monitor.Log($"Toggled mod: {ModEntry.modActive}"); if (ModEntry.modActive) { ModActions.ShowMessage(string.Format(Helper.Translation.Get("mod-active"), Config.ToggleButton)); } else { ModActions.ShowMessage(string.Format(Helper.Translation.Get("mod-inactive"), Config.ToggleButton)); } } else if (ModEntry.modActive && e.Button == Config.CopyButton) { Helper.Input.Suppress(e.Button); TileActions.CopyCurrentTile(); } else if (ModEntry.modActive && ModEntry.copiedTileLoc.X > -1 && e.Button == Config.PasteButton && ModEntry.pastedTileLoc != Game1.currentCursorTile) { Helper.Input.Suppress(e.Button); TileActions.PasteCurrentTile(); } else if (ModEntry.modActive && e.Button == Config.RevertButton && MapActions.MapHasTile(Game1.currentCursorTile)) { Helper.Input.Suppress(e.Button); TileActions.RevertCurrentTile(); } else if (ModEntry.modActive && e.Button == SButton.Escape) { Helper.Input.Suppress(e.Button); if (ModEntry.copiedTileLoc.X > -1) { ModEntry.copiedTileLoc = new Vector2(-1, -1); ModEntry.pastedTileLoc = new Vector2(-1, -1); ModEntry.currentLayer = 0; ModEntry.currentTileDict.Clear(); } else { ModActions.DeactivateMod(); } } else if (ModEntry.modActive && e.Button == Config.RefreshButton) { Helper.Input.Suppress(e.Button); ModEntry.cleanMaps.Clear(); MapActions.GetMapCollectionData(); MapActions.UpdateCurrentMap(true); } else if (ModEntry.modActive && e.Button == Config.ScrollUpButton) { Helper.Input.Suppress(e.Button); ModActions.SwitchTile(true); } else if (ModEntry.modActive && e.Button == Config.ScrollDownButton) { Helper.Input.Suppress(e.Button); ModActions.SwitchTile(false); } }