2022-07-05 20:06:31 +02:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using FluentAvalonia.UI.Controls;
|
|
|
|
using Ryujinx.Ava.Common.Locale;
|
|
|
|
using Ryujinx.Ava.Ui.Models;
|
|
|
|
using Ryujinx.Ava.Ui.ViewModels;
|
|
|
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
namespace Ryujinx.Ava.Ui.Windows
|
|
|
|
{
|
2022-07-24 19:38:38 +02:00
|
|
|
public partial class RumbleSettingsWindow : UserControl
|
2022-07-05 20:06:31 +02:00
|
|
|
{
|
|
|
|
private readonly InputConfiguration<GamepadInputId, StickInputId> _viewmodel;
|
|
|
|
|
|
|
|
public RumbleSettingsWindow()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2022-07-24 19:38:38 +02:00
|
|
|
DataContext = _viewmodel;
|
2022-07-05 20:06:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public RumbleSettingsWindow(ControllerSettingsViewModel viewmodel)
|
|
|
|
{
|
|
|
|
var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
|
|
|
|
|
|
|
|
_viewmodel = new InputConfiguration<GamepadInputId, StickInputId>()
|
|
|
|
{
|
2022-07-24 19:38:38 +02:00
|
|
|
StrongRumble = config.StrongRumble, WeakRumble = config.WeakRumble
|
2022-07-05 20:06:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
DataContext = _viewmodel;
|
|
|
|
}
|
|
|
|
|
2022-07-24 19:38:38 +02:00
|
|
|
public static async Task Show(ControllerSettingsViewModel viewmodel)
|
2022-07-05 20:06:31 +02:00
|
|
|
{
|
|
|
|
RumbleSettingsWindow content = new RumbleSettingsWindow(viewmodel);
|
|
|
|
|
2022-07-24 19:38:38 +02:00
|
|
|
ContentDialog contentDialog = new ContentDialog
|
2022-07-05 20:06:31 +02:00
|
|
|
{
|
2022-07-24 19:38:38 +02:00
|
|
|
Title = LocaleManager.Instance["ControllerRumbleTitle"],
|
|
|
|
PrimaryButtonText = LocaleManager.Instance["ControllerSettingsSave"],
|
|
|
|
SecondaryButtonText = "",
|
|
|
|
CloseButtonText = LocaleManager.Instance["ControllerSettingsClose"],
|
|
|
|
Content = content,
|
|
|
|
};
|
|
|
|
|
|
|
|
contentDialog.PrimaryButtonClick += (sender, args) =>
|
|
|
|
{
|
|
|
|
var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
|
|
|
|
config.StrongRumble = content._viewmodel.StrongRumble;
|
|
|
|
config.WeakRumble = content._viewmodel.WeakRumble;
|
|
|
|
};
|
|
|
|
|
|
|
|
await contentDialog.ShowAsync();
|
2022-07-05 20:06:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|