Ejemplo n.º 1
0
 /// <inheritdoc />
 public void Suppress(SButton button)
 {
     this.InputState.OverrideButton(button, setDown: false);
 }
Ejemplo n.º 2
0
 public static bool IsTTSTimeButton(SButton b) => ModEntry.GetConfig().key_tts_time.Contains(b);
Ejemplo n.º 3
0
 public static bool IsGameMenuInventoryButton(SButton b) => ModEntry.GetConfig().key_gamemenu_inv.Contains(b);
Ejemplo n.º 4
0
 public static bool IsTTSMapCheckUnderneathButton(SButton b, System.Func <SButton, bool> extra) => IsTTSMapCheckButton(b) && (extra(SButton.LeftShift) || extra(SButton.RightShift));
Ejemplo n.º 5
0
 public static bool IsTTSRepeatButton(SButton b) => ModEntry.GetConfig().key_tts_repeat.Contains(b);
Ejemplo n.º 6
0
 public static bool IsMenuDeleteButton(SButton b) => ModEntry.GetConfig().key_menu_delete.Contains(b);
Ejemplo n.º 7
0
 public static bool IsMenuTitleMuteButton(SButton b) => ModEntry.GetConfig().key_menu_title_mute.Contains(b);
Ejemplo n.º 8
0
        public void AddKey(SButton key, string description)
        {
            var component = new ClickableTextureComponent("", Rectangle.Empty, null, description, Game1.mouseCursors, new Rectangle(473, 36, 24, 24), 2.5f, false);

            this.Keys.Add(key, component);
        }
Ejemplo n.º 9
0
 /// <summary>Raise a <see cref="ButtonReleased"/> event.</summary>
 /// <param name="monitor">Encapsulates monitoring and logging.</param>
 /// <param name="button">The button on the controller, keyboard, or mouse.</param>
 /// <param name="cursor">The cursor position.</param>
 /// <param name="isActionButton">Whether the input should trigger actions on the affected tile.</param>
 /// <param name="isUseToolButton">Whether the input should use tools on the affected tile.</param>
 internal static void InvokeButtonReleased(IMonitor monitor, SButton button, ICursorPosition cursor, bool isActionButton, bool isUseToolButton)
 {
     monitor.SafelyRaiseGenericEvent($"{nameof(InputEvents)}.{nameof(InputEvents.ButtonReleased)}", InputEvents.ButtonReleased?.GetInvocationList(), null, new EventArgsInput(button, cursor, isActionButton, isUseToolButton));
 }
Ejemplo n.º 10
0
 /// <summary>Get the state of a button.</summary>
 /// <param name="button">The button to check.</param>
 public SButtonState GetState(SButton button)
 {
     return(this.InputState.GetState(button));
 }
Ejemplo n.º 11
0
 /// <summary>Whether we should consume the input, preventing it from reaching the game.</summary>
 /// <param name="keyPressed">The key that was pressed.</param>
 /// <returns>True if it should be consumed, false otherwise.</returns>
 protected virtual bool ShouldConsumeKeyboardInput(SButton keyPressed)
 {
     return(this.SplitMenu != null);
 }
Ejemplo n.º 12
0
 /// <summary>Prevent the game from handling a button press. This doesn't prevent other mods from receiving the event.</summary>
 /// <param name="button">The button to suppress.</param>
 public void Suppress(SButton button)
 {
     this.InputState.SuppressButtons.Add(button);
 }
Ejemplo n.º 13
0
 /// <summary>Get the status of a button.</summary>
 /// <param name="button">The button to check.</param>
 public InputStatus GetStatus(SButton button)
 {
     return(this.GetStatus(this.ActiveButtons, button));
 }
        private void OverrideRanching(GameLocation currentLocation, int x, int y, Farmer who, SButton button, string toolName)
        {
            AnimalBeingRanched = null;
            FarmAnimal animal       = null;
            string     ranchAction  = string.Empty;
            string     ranchProduct = string.Empty;

            if (toolName == null)
            {
                return;
            }

            switch (toolName)
            {
            case GameConstants.Tools.MilkPail:
                ranchAction  = "Milking";
                ranchProduct = "milk";
                break;

            case GameConstants.Tools.Shears:
                ranchAction  = "Shearing";
                ranchProduct = "wool";
                break;
            }
            var rectangle = new Rectangle(x - (Game1.tileSize / 2), y - (Game1.tileSize / 2), Game1.tileSize, Game1.tileSize);

            if (currentLocation is AnimalHouse animalHouse)
            {
                animal = animalHouse.GetSelectedAnimal(rectangle);
            }
            else if (currentLocation.IsFarm && currentLocation.IsOutdoors)
            {
                animal = ((Farm)currentLocation).GetSelectedAnimal(rectangle);
            }

            if (animal == null)
            {
                this.Helper.Input.OverwriteState(button, $"{ranchAction} Failed");
                return;
            }

            if (animal.CanBeRanched(toolName))
            {
                if (who.couldInventoryAcceptThisObject(animal.currentProduce.Value, 1, 0))
                {
                    AnimalBeingRanched = animal;
                    return;
                }
                else
                {
                    this.Helper.Input.OverwriteState(button, "Inventory Full");
                }
            }
            else if (animal?.isBaby() == true && animal.toolUsedForHarvest.Equals(toolName))
            {
                this.Helper.Input.OverwriteState(button);
                DelayedAction.showDialogueAfterDelay($"Baby {animal.Name} will produce {ranchProduct} in {animal.ageWhenMature.Value - animal.age.Value} days.", 0);
            }
            else
            {
                this.Helper.Input.OverwriteState(button, $"{ranchAction} Failed");
            }
        }
Ejemplo n.º 15
0
 public static bool IsMenuPrevButton(SButton b) => ModEntry.GetConfig().key_menu_prev.Contains(b);
Ejemplo n.º 16
0
 /// <summary>Get whether a given button was pressed or held.</summary>
 /// <param name="button">The button to check.</param>
 public bool IsDown(SButton button)
 {
     return(this.GetStatus(this.ActiveButtons, button).IsDown());
 }
Ejemplo n.º 17
0
 public static bool IsMenuActivateButton(SButton b) => ModEntry.GetConfig().key_menu_activate.Contains(b) || b.IsActionButton();
Ejemplo n.º 18
0
 /// <summary>Get the status of a button.</summary>
 /// <param name="activeButtons">The current button states to check.</param>
 /// <param name="button">The button to check.</param>
 private InputStatus GetStatus(IDictionary <SButton, InputStatus> activeButtons, SButton button)
 {
     return(activeButtons.TryGetValue(button, out InputStatus status) ? status : InputStatus.None);
 }
Ejemplo n.º 19
0
 public static bool IsMenuEscapeButton(SButton b) => ModEntry.GetConfig().key_menu_escape.Contains(b);
Ejemplo n.º 20
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="button">The button on the controller, keyboard, or mouse.</param>
 /// <param name="cursor">The cursor position.</param>
 /// <param name="inputState">The game's current input state.</param>
 internal ButtonPressedEventArgs(SButton button, ICursorPosition cursor, SInputState inputState)
 {
     this.Button     = button;
     this.Cursor     = cursor;
     this.InputState = inputState;
 }
Ejemplo n.º 21
0
 public static bool IsTTSMapCheckButton(SButton b) => ModEntry.GetConfig().key_tts_map_check.Contains(b);
Ejemplo n.º 22
0
 /// <summary>Whether a mod has indicated the key was already handled, so the game should handle it.</summary>
 /// <param name="button">The button to check.</param>
 public bool IsSuppressed(SButton button)
 {
     return(this.InputState.SuppressButtons.Contains(button));
 }
Ejemplo n.º 23
0
 public static bool IsTTSInfoButton(SButton b) => ModEntry.GetConfig().key_tts_info.Contains(b);
Ejemplo n.º 24
0
 /// <summary>Get whether a given button was pressed or held.</summary>
 /// <param name="button">The button to check.</param>
 public bool IsDown(SButton button)
 {
     return(this.InputState.IsDown(button));
 }
Ejemplo n.º 25
0
 public static bool IsTTSStopButton(SButton b) => ModEntry.GetConfig().key_tts_stop.Contains(b);
Ejemplo n.º 26
0
 public static string constructCmdKey(SButton modifyKey, SButton key)
 {
     return(modifyKey + "+" + key);
 }
Ejemplo n.º 27
0
 public static bool IsTTSHealthButton(SButton b) => ModEntry.GetConfig().key_tts_health.Contains(b);
Ejemplo n.º 28
0
 public static bool IsMenuNextButton(SButton b) => ModEntry.GetConfig().key_menu_next.Contains(b);
Ejemplo n.º 29
0
 public static bool IsGameMenuSkillsButton(SButton b) => ModEntry.GetConfig().key_gamemenu_skills.Contains(b);
Ejemplo n.º 30
0
 /// <inheritdoc />
 public bool IsSuppressed(SButton button)
 {
     return(this.InputState.IsSuppressed(button));
 }