2022-07-05 14:06:31 -04:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using Avalonia.Markup.Xaml;
|
|
|
|
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 13:38:38 -04:00
|
|
|
public partial class RumbleSettingsWindow : UserControl
|
2022-07-05 14:06:31 -04:00
|
|
|
{
|
|
|
|
private readonly InputConfiguration<GamepadInputId, StickInputId> _viewmodel;
|
|
|
|
|
|
|
|
public RumbleSettingsWindow()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2022-07-24 13:38:38 -04:00
|
|
|
DataContext = _viewmodel;
|
2022-07-05 14:06:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public RumbleSettingsWindow(ControllerSettingsViewModel viewmodel)
|
|
|
|
{
|
|
|
|
var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
|
|
|
|
|
|
|
|
_viewmodel = new InputConfiguration<GamepadInputId, StickInputId>()
|
|
|
|
{
|
2022-07-24 13:38:38 -04:00
|
|
|
StrongRumble = config.StrongRumble, WeakRumble = config.WeakRumble
|
2022-07-05 14:06:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
DataContext = _viewmodel;
|
|
|
|
}
|
|
|
|
|
2022-07-24 13:38:38 -04:00
|
|
|
public static async Task Show(ControllerSettingsViewModel viewmodel)
|
2022-07-05 14:06:31 -04:00
|
|
|
{
|
|
|
|
RumbleSettingsWindow content = new RumbleSettingsWindow(viewmodel);
|
|
|
|
|
2022-07-24 13:38:38 -04:00
|
|
|
ContentDialog contentDialog = new ContentDialog
|
2022-07-05 14:06:31 -04:00
|
|
|
{
|
2022-07-24 13:38:38 -04: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 14:06:31 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|