mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-05-18 19:25:48 +00:00
@@ -64,7 +64,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
};
|
||||
|
||||
if (!float.IsNaN(_changeSlider) && _changeSlider != (float)check.Value)
|
||||
{
|
||||
{
|
||||
FlagInputConfigChanged();
|
||||
|
||||
_changeSlider = (float)check.Value;
|
||||
@@ -83,7 +83,6 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ToggleButton button)
|
||||
@@ -104,7 +103,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
this.Focus(NavigationMethod.Pointer);
|
||||
|
||||
PointerPressed += MouseClick;
|
||||
|
||||
|
||||
ControllerInputViewModel viewModel = (DataContext as ControllerInputViewModel);
|
||||
|
||||
IKeyboard keyboard =
|
||||
@@ -225,8 +224,8 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
PointerPressed -= MouseClick;
|
||||
}
|
||||
|
||||
private IButtonAssigner CreateButtonAssigner(bool forStick) =>
|
||||
new GamepadButtonAssigner(
|
||||
private GamepadButtonAssigner CreateButtonAssigner(bool forStick) =>
|
||||
new(
|
||||
ViewModel.ParentModel.SelectedGamepad,
|
||||
(ViewModel.ParentModel.Config as StandardControllerInputConfig).TriggerThreshold,
|
||||
forStick);
|
||||
@@ -234,11 +233,12 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
base.OnDetachedFromVisualTree(e);
|
||||
|
||||
|
||||
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
|
||||
{
|
||||
gamepad?.ClearLed();
|
||||
}
|
||||
|
||||
_currentAssigner?.Cancel();
|
||||
_currentAssigner = null;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
LocaleManager.Instance[LocaleKeys.Cancel],
|
||||
LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
|
||||
|
||||
|
||||
if (result == UserResult.Yes)
|
||||
{
|
||||
ViewModel.Save();
|
||||
@@ -61,14 +60,14 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
ViewModel.IsModified = true;
|
||||
ViewModel.PlayerId = ((PlayerModel)e.AddedItems[0])!.Id;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ViewModel.IsModified = false;
|
||||
ViewModel.PlayerId = ViewModel.PlayerIdChoose;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
|
||||
@@ -9,8 +9,8 @@ using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.ViewModels.Input;
|
||||
using Ryujinx.Input;
|
||||
using Ryujinx.Input.Assigner;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Button = Ryujinx.Input.Button;
|
||||
using Key = Ryujinx.Common.Configuration.Hid.Key;
|
||||
|
||||
@@ -45,9 +45,9 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
|
||||
private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is not ToggleButton button)
|
||||
if (sender is not ToggleButton button)
|
||||
return;
|
||||
|
||||
|
||||
if (button.IsChecked is true)
|
||||
{
|
||||
if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
|
||||
@@ -65,7 +65,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
|
||||
IKeyboard keyboard =
|
||||
(IKeyboard)ViewModel.ParentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
|
||||
IButtonAssigner assigner =
|
||||
IButtonAssigner assigner =
|
||||
new KeyboardKeyAssigner((IKeyboard)ViewModel.ParentModel.SelectedGamepad);
|
||||
|
||||
_currentAssigner.ButtonAssigned += (_, be) =>
|
||||
@@ -205,7 +205,7 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
|
||||
if (_currentAssigner != null)
|
||||
{
|
||||
Dictionary<string, Action> buttonActions = new Dictionary<string, Action>
|
||||
Dictionary<string, Action> buttonActions = new()
|
||||
{
|
||||
{ "ButtonZl", () => ViewModel.Config.ButtonZl = Key.Unbound },
|
||||
{ "ButtonL", () => ViewModel.Config.ButtonL = Key.Unbound },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Avalonia;
|
||||
using Avalonia;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.UI.Controls;
|
||||
@@ -20,27 +20,32 @@ namespace Ryujinx.UI.Views.Input
|
||||
LedColor = viewModel.Config.LedColor,
|
||||
UseRainbowLed = viewModel.Config.UseRainbowLed,
|
||||
};
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
private void ColorPickerButton_OnColorChanged(ColorPickerButton sender, ColorButtonColorChangedEventArgs args)
|
||||
{
|
||||
if (!args.NewColor.HasValue) return;
|
||||
if (!ViewModel.EnableLedChanging) return;
|
||||
if (ViewModel.TurnOffLed) return;
|
||||
|
||||
if (!args.NewColor.HasValue)
|
||||
return;
|
||||
if (!ViewModel.EnableLedChanging)
|
||||
return;
|
||||
if (ViewModel.TurnOffLed)
|
||||
return;
|
||||
|
||||
ViewModel.ParentModel.SelectedGamepad.SetLed(args.NewColor.Value.ToUInt32());
|
||||
}
|
||||
|
||||
private void ColorPickerButton_OnAttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
|
||||
{
|
||||
if (!ViewModel.EnableLedChanging) return;
|
||||
if (ViewModel.TurnOffLed) return;
|
||||
|
||||
if (!ViewModel.EnableLedChanging)
|
||||
return;
|
||||
if (ViewModel.TurnOffLed)
|
||||
return;
|
||||
|
||||
ViewModel.ParentModel.SelectedGamepad.SetLed(ViewModel.LedColor.ToUInt32());
|
||||
}
|
||||
|
||||
|
||||
public static async Task Show(ControllerInputViewModel viewModel)
|
||||
{
|
||||
LedInputView content = new(viewModel);
|
||||
|
||||
Reference in New Issue
Block a user