Esempio n. 1
0
        /*********
        ** Private methods
        *********/
        /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            // ignore if player hasn't loaded a save yet
            if (!Context.IsPlayerFree)
            {
                return;
            }

            if (e.Button.IsActionButton())
            {
                var objects = Game1.player.currentLocation.Objects;

                objects.TryGetValue(e.Cursor.GrabTile, out SObject machine);

                if (machine != null && machine.Name == qualityScrubberType)
                {
                    // See if the machine accepts the item, suppress the input to prevent the eating menu from opening
                    if (controller.CanProcess(Game1.player.ActiveObject, machine))
                    {
                        controller.StartProcessing(Game1.player.ActiveObject, machine, Game1.player);
                        Helper.Input.Suppress(e.Button);
                    }
                }
            }
        }