2022-07-05 12:06:31 -06:00
|
|
|
using Avalonia.Controls;
|
|
|
|
using FluentAvalonia.UI.Controls;
|
|
|
|
using Ryujinx.Ava.Common.Locale;
|
2022-12-29 07:24:05 -07:00
|
|
|
using Ryujinx.Ava.UI.Models;
|
|
|
|
using Ryujinx.Ava.UI.ViewModels;
|
2022-07-05 12:06:31 -06:00
|
|
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
2022-12-29 07:24:05 -07:00
|
|
|
namespace Ryujinx.Ava.UI.Windows
|
2022-07-05 12:06:31 -06:00
|
|
|
{
|
2022-07-24 11:38:38 -06:00
|
|
|
public partial class RumbleSettingsWindow : UserControl
|
2022-07-05 12:06:31 -06:00
|
|
|
{
|
|
|
|
private readonly InputConfiguration<GamepadInputId, StickInputId> _viewmodel;
|
|
|
|
|
|
|
|
public RumbleSettingsWindow()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
2022-07-24 11:38:38 -06:00
|
|
|
DataContext = _viewmodel;
|
2022-07-05 12:06:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
public RumbleSettingsWindow(ControllerSettingsViewModel viewmodel)
|
|
|
|
{
|
|
|
|
var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
|
|
|
|
|
|
|
|
_viewmodel = new InputConfiguration<GamepadInputId, StickInputId>()
|
|
|
|
{
|
2022-07-24 11:38:38 -06:00
|
|
|
StrongRumble = config.StrongRumble, WeakRumble = config.WeakRumble
|
2022-07-05 12:06:31 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
DataContext = _viewmodel;
|
|
|
|
}
|
|
|
|
|
2022-07-24 11:38:38 -06:00
|
|
|
public static async Task Show(ControllerSettingsViewModel viewmodel)
|
2022-07-05 12:06:31 -06:00
|
|
|
{
|
|
|
|
RumbleSettingsWindow content = new RumbleSettingsWindow(viewmodel);
|
|
|
|
|
2022-07-24 11:38:38 -06:00
|
|
|
ContentDialog contentDialog = new ContentDialog
|
2022-07-05 12:06:31 -06:00
|
|
|
{
|
2023-01-03 11:45:08 -07:00
|
|
|
Title = LocaleManager.Instance[LocaleKeys.ControllerRumbleTitle],
|
|
|
|
PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave],
|
2022-07-24 11:38:38 -06:00
|
|
|
SecondaryButtonText = "",
|
2023-01-03 11:45:08 -07:00
|
|
|
CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose],
|
2022-07-24 11:38:38 -06:00
|
|
|
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 12:06:31 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|