diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-06 18:25:00 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-06 18:25:00 -0400 |
commit | 0539bb8f3705e5c50d0e5790e2af97f39aed04b8 (patch) | |
tree | c21f468cdae670432aa067d97f71106a23210608 /src/SMAPI/Utilities | |
parent | b6c8cfc28b2c94e6dc3cb07d3058371dd6775e70 (diff) | |
download | SMAPI-0539bb8f3705e5c50d0e5790e2af97f39aed04b8.tar.gz SMAPI-0539bb8f3705e5c50d0e5790e2af97f39aed04b8.tar.bz2 SMAPI-0539bb8f3705e5c50d0e5790e2af97f39aed04b8.zip |
simplify with newer pattern features
Diffstat (limited to 'src/SMAPI/Utilities')
-rw-r--r-- | src/SMAPI/Utilities/Keybind.cs | 4 | ||||
-rw-r--r-- | src/SMAPI/Utilities/KeybindList.cs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/SMAPI/Utilities/Keybind.cs b/src/SMAPI/Utilities/Keybind.cs index 403ecf4a..7aefe686 100644 --- a/src/SMAPI/Utilities/Keybind.cs +++ b/src/SMAPI/Utilities/Keybind.cs @@ -118,11 +118,11 @@ namespace StardewModdingAPI.Utilities return SButtonState.None; // mix of held + pressed => pressed - if (states.All(p => p == SButtonState.Pressed || p == SButtonState.Held)) + if (states.All(p => p is SButtonState.Pressed or SButtonState.Held)) return SButtonState.Pressed; // mix of held + released => released - if (states.All(p => p == SButtonState.Held || p == SButtonState.Released)) + if (states.All(p => p is SButtonState.Held or SButtonState.Released)) return SButtonState.Released; // not down last tick or now diff --git a/src/SMAPI/Utilities/KeybindList.cs b/src/SMAPI/Utilities/KeybindList.cs index f8f569af..f24976f7 100644 --- a/src/SMAPI/Utilities/KeybindList.cs +++ b/src/SMAPI/Utilities/KeybindList.cs @@ -139,7 +139,7 @@ namespace StardewModdingAPI.Utilities public bool IsDown() { SButtonState state = this.GetState(); - return state == SButtonState.Pressed || state == SButtonState.Held; + return state is SButtonState.Pressed or SButtonState.Held; } /// <summary>Get whether the input binding was just pressed this tick.</summary> |