Beispiel #1
0
        private static bool pressSwitchToolButton_Prefix()
        {
            if (!Config.EnableMod || !Context.IsPlayerFree || Game1.input.GetMouseState().ScrollWheelValue == Game1.oldMouseState.ScrollWheelValue || !modActive || copiedTileLoc.X < 0)
            {
                return(true);
            }

            ModActions.SwitchTile(Game1.input.GetMouseState().ScrollWheelValue - Game1.oldMouseState.ScrollWheelValue > 0);

            return(false);
        }
        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);
            }
        }