mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-04 20:36:59 +00:00
* Refactor * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update src/Ryujinx.Input/ButtonValueType.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Add empty line * Requested renames * Update src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * Make parent models private readonly * Fix ControllerInputView * Make line shorter * Mac keys in locale * Double line break * Fix build * Get rid of _isValid * Fix potential race condition * Rename HasAnyButtonPressed to IsAnyButtonPressed * Use switches * Simplify enumeration --------- Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: TSR Berry <20988865+TSRBerry@users.noreply.github.com>
67 lines
2.4 KiB
C#
67 lines
2.4 KiB
C#
using Avalonia.Controls;
|
|
using FluentAvalonia.UI.Controls;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using Ryujinx.Ava.UI.ViewModels.Input;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ryujinx.Ava.UI.Views.Input
|
|
{
|
|
public partial class MotionInputView : UserControl
|
|
{
|
|
private readonly MotionInputViewModel _viewModel;
|
|
|
|
public MotionInputView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public MotionInputView(ControllerInputViewModel viewModel)
|
|
{
|
|
var config = viewModel.Config;
|
|
|
|
_viewModel = new MotionInputViewModel
|
|
{
|
|
Slot = config.Slot,
|
|
AltSlot = config.AltSlot,
|
|
DsuServerHost = config.DsuServerHost,
|
|
DsuServerPort = config.DsuServerPort,
|
|
MirrorInput = config.MirrorInput,
|
|
Sensitivity = config.Sensitivity,
|
|
GyroDeadzone = config.GyroDeadzone,
|
|
EnableCemuHookMotion = config.EnableCemuHookMotion,
|
|
};
|
|
|
|
InitializeComponent();
|
|
DataContext = _viewModel;
|
|
}
|
|
|
|
public static async Task Show(ControllerInputViewModel viewModel)
|
|
{
|
|
MotionInputView content = new(viewModel);
|
|
|
|
ContentDialog contentDialog = new()
|
|
{
|
|
Title = LocaleManager.Instance[LocaleKeys.ControllerMotionTitle],
|
|
PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave],
|
|
SecondaryButtonText = "",
|
|
CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose],
|
|
Content = content,
|
|
};
|
|
contentDialog.PrimaryButtonClick += (sender, args) =>
|
|
{
|
|
var config = viewModel.Config;
|
|
config.Slot = content._viewModel.Slot;
|
|
config.Sensitivity = content._viewModel.Sensitivity;
|
|
config.GyroDeadzone = content._viewModel.GyroDeadzone;
|
|
config.AltSlot = content._viewModel.AltSlot;
|
|
config.DsuServerHost = content._viewModel.DsuServerHost;
|
|
config.DsuServerPort = content._viewModel.DsuServerPort;
|
|
config.EnableCemuHookMotion = content._viewModel.EnableCemuHookMotion;
|
|
config.MirrorInput = content._viewModel.MirrorInput;
|
|
};
|
|
|
|
await contentDialog.ShowAsync();
|
|
}
|
|
}
|
|
}
|