/// <summary>Get the <see cref="InputButton"/> equivalent for the given button.</summary> /// <param name="input">The button to convert.</param> /// <param name="button">The Secrets Of Grindea input button equivalent.</param> /// <returns>Returns whether the value was converted successfully.</returns> public static bool TryGetSoGInput(this SButton input, out LocalInputHelper.KeyOrMouse button) { // keyboard if (input.TryGetKeyboard(out Keys key)) { button = new LocalInputHelper.KeyOrMouse(key); return(true); } // mouse if (input == SButton.MouseLeft) { button = new LocalInputHelper.KeyOrMouse(LocalInputHelper.MouseButton.Left_Mouse); return(true); } // mouse if (input == SButton.MouseRight) { button = new LocalInputHelper.KeyOrMouse(LocalInputHelper.MouseButton.Right_Mouse); return(true); } // not valid button = default; return(false); }
/// <summary>Get the <see cref="SButton"/> equivalent for the given button.</summary> /// <param name="input">The Secrets Of Grindea button to convert.</param> public static SButton ToSButton(this LocalInputHelper.KeyOrMouse input) { // derived from InputButton constructors if (input.mouse == LocalInputHelper.MouseButton.Left_Mouse) { return(SButton.MouseLeft); } if (input.mouse == LocalInputHelper.MouseButton.Right_Mouse) { return(SButton.MouseRight); } return(input.key.ToSButton()); }