aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
diff options
context:
space:
mode:
authorIsaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com>2023-10-21 07:26:51 -0400
committerGitHub <noreply@github.com>2023-10-21 13:26:51 +0200
commit49b37550cae6b3c69f59a9c7a44b17e3c12a813b (patch)
tree0cc8e6a3bfd65a876270b682effdb8f9505ff929 /src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
parenta42f0bbb87b890d4f16b1148f9398210a5bfedfa (diff)
Ava UI: Input Menu Refactor (#4998)1.1.1058
* So much boilerplate * Slow and steady * Restructure + Ack suggestions * Restructure + Ack suggestions * Restructure * Clean * Propogate those fields i forgot about * It builds * Progress * Almost there * Fix stupid mistake * Fix more stupid mistakes * Actually fix fuck ups * Start localising * r/therestofthefuckingowl * Localise ButtonKeyAssigner * Are you feeling it now mr krabs * We’re done at last * Crimes against code * Try me in the Hague * Please be quiet * Crimes are here to stay * Dispose stuff * Cleanup a couple things * Visual fixes and improvements One weird bug * Fix rebase errors * Fixes * Ack Suggestions Remaining ack suggestions Update src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> Update src/Ryujinx.Ava/UI/Models/Input/ControllerInputConfig.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Formatting and error More Ava 11-ness Whoops * Code style fixes * Style fixes * Analyzer fix * Remove all ReflectionBindings * Remove ambigious object * Remove redundant property * Old man yells at formatter * r e a d o n l y * Fix profiles * Use new Sliders --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
Diffstat (limited to 'src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs')
-rw-r--r--src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs b/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
index 7e8ba734..54e0918a 100644
--- a/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
+++ b/src/Ryujinx.Ava/UI/Helpers/ButtonKeyAssigner.cs
@@ -1,11 +1,8 @@
-using Avalonia.Controls;
using Avalonia.Controls.Primitives;
-using Avalonia.LogicalTree;
using Avalonia.Threading;
using Ryujinx.Input;
using Ryujinx.Input.Assigner;
using System;
-using System.Linq;
using System.Threading.Tasks;
namespace Ryujinx.Ava.UI.Helpers
@@ -15,12 +12,12 @@ namespace Ryujinx.Ava.UI.Helpers
internal class ButtonAssignedEventArgs : EventArgs
{
public ToggleButton Button { get; }
- public bool IsAssigned { get; }
+ public ButtonValue? ButtonValue { get; }
- public ButtonAssignedEventArgs(ToggleButton button, bool isAssigned)
+ public ButtonAssignedEventArgs(ToggleButton button, ButtonValue? buttonValue)
{
Button = button;
- IsAssigned = isAssigned;
+ ButtonValue = buttonValue;
}
}
@@ -78,15 +75,11 @@ namespace Ryujinx.Ava.UI.Helpers
await Dispatcher.UIThread.InvokeAsync(() =>
{
- string pressedButton = assigner.GetPressedButton();
+ ButtonValue? pressedButton = assigner.GetPressedButton();
if (_shouldUnbind)
{
- SetButtonText(ToggledButton, "Unbound");
- }
- else if (pressedButton != "")
- {
- SetButtonText(ToggledButton, pressedButton);
+ pressedButton = null;
}
_shouldUnbind = false;
@@ -94,17 +87,8 @@ namespace Ryujinx.Ava.UI.Helpers
ToggledButton.IsChecked = false;
- ButtonAssigned?.Invoke(this, new ButtonAssignedEventArgs(ToggledButton, pressedButton != null));
-
- static void SetButtonText(ToggleButton button, string text)
- {
- ILogical textBlock = button.GetLogicalDescendants().First(x => x is TextBlock);
+ ButtonAssigned?.Invoke(this, new ButtonAssignedEventArgs(ToggledButton, pressedButton));
- if (textBlock != null && textBlock is TextBlock block)
- {
- block.Text = text;
- }
- }
});
}