Improve Motion/Rumble/LED Windows

Due to resizing issues.
This commit is contained in:
_Neo_
2025-11-20 19:43:09 +02:00
parent 359af1d310
commit cdbe4921e6
7 changed files with 144 additions and 52 deletions

View File

@@ -29,7 +29,20 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
[ObservableProperty]
public partial Color LedColor { get; set; }
public string RainbowSpeedText => RainbowSpeed.ToString("F2", CultureInfo.CurrentCulture);
public string RainbowSpeedText
{
get
{
if (RainbowSpeed == 10)
{
return RainbowSpeed.ToString("F1", CultureInfo.CurrentCulture);
}
else
{
return RainbowSpeed.ToString("F2", CultureInfo.CurrentCulture);
}
}
}
public float RainbowSpeed
{

View File

@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System.Globalization;
namespace Ryujinx.Ava.UI.ViewModels.Input
{
@@ -22,8 +23,36 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
[ObservableProperty]
public partial int Sensitivity { get; set; }
[ObservableProperty]
public partial double GyroDeadzone { get; set; }
private double _gyroDeadzone;
public double GyroDeadzone
{
get => _gyroDeadzone;
set
{
if (_gyroDeadzone != value)
{
_gyroDeadzone = value;
OnPropertyChanged();
OnPropertyChanged(nameof(GyroDeadzoneText));
}
}
}
public string GyroDeadzoneText
{
get
{
if (_gyroDeadzone == 100)
{
return _gyroDeadzone.ToString("F1", CultureInfo.CurrentCulture);
}
else
{
return _gyroDeadzone.ToString("F2", CultureInfo.CurrentCulture);
}
}
}
[ObservableProperty]
public partial bool EnableCemuHookMotion { get; set; }

View File

@@ -1,13 +1,68 @@
using CommunityToolkit.Mvvm.ComponentModel;
using System.Globalization;
namespace Ryujinx.Ava.UI.ViewModels.Input
{
public partial class RumbleInputViewModel : BaseModel
{
[ObservableProperty]
public partial float StrongRumble { get; set; }
private float strongRumble;
private float weakRumble;
[ObservableProperty]
public partial float WeakRumble { get; set; }
public float StrongRumble
{
get => strongRumble;
set
{
if (strongRumble != value)
{
strongRumble = value;
OnPropertyChanged();
OnPropertyChanged(nameof(StrongRumbleText));
}
}
}
public float WeakRumble
{
get => weakRumble;
set
{
if (weakRumble != value)
{
weakRumble = value;
OnPropertyChanged();
OnPropertyChanged(nameof(WeakRumbleText));
}
}
}
public string StrongRumbleText
{
get
{
if (StrongRumble == 10)
{
return StrongRumble.ToString("F1", CultureInfo.CurrentCulture);
}
else
{
return StrongRumble.ToString("F2", CultureInfo.CurrentCulture);
}
}
}
public string WeakRumbleText
{
get
{
if (WeakRumble == 10)
{
return WeakRumble.ToString("F1", CultureInfo.CurrentCulture);
}
else
{
return WeakRumble.ToString("F2", CultureInfo.CurrentCulture);
}
}
}
}
}

View File

@@ -9,34 +9,29 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="viewModels:LedInputViewModel"
x:Class="Ryujinx.UI.Views.Input.LedInputView">
<StackPanel Margin="10" Orientation="Vertical" HorizontalAlignment="Center">
<CheckBox
Margin="0,0,0,2.5"
IsChecked="{Binding TurnOffLed, Mode=TwoWay}"
Command="{Binding LedDisabledChanged}"
IsVisible="{Binding ParentModel.CanClearLed}">
<Grid Margin="10" HorizontalAlignment="Center" RowDefinitions="Auto,Auto,Auto,Auto" ColumnDefinitions="Auto,Auto">
<CheckBox Grid.Row="0" Margin="0,0,0,2.5" IsChecked="{Binding TurnOffLed, Mode=TwoWay}"
Command="{Binding LedDisabledChanged}" IsVisible="{Binding ParentModel.CanClearLed}">
<TextBlock Text="{ext:Locale ControllerSettingsLedColorDisable}" />
</CheckBox>
<CheckBox
Margin="0,0,0,2.5"
IsChecked="{Binding UseRainbowLed, Mode=TwoWay}">
<CheckBox Grid.Row="1" Margin="0,0,0,2.5" IsChecked="{Binding UseRainbowLed, Mode=TwoWay}">
<TextBlock Text="{ext:Locale ControllerSettingsLedColorRainbow}" />
</CheckBox>
<StackPanel Orientation="Horizontal" IsEnabled="{Binding !TurnOffLed}">
<StackPanel Grid.Row="2" Orientation="Horizontal" IsEnabled="{Binding !TurnOffLed}">
<TextBlock Margin="0,0,10,2.5" Text="{ext:Locale ControllerSettingsLedColorRainbowSpeed}" />
<controls:SliderScroll
Value="{Binding RainbowSpeed}"
Width="150"
Margin="0,0,0,2.5"
TickFrequency="0.25"
IsSnapToTickEnabled="True"
LargeChange="1"
SmallChange="0.25"
Minimum="0"
Maximum="10" />
Value="{Binding RainbowSpeed}"
Width="150"
Margin="0,0,0,2.5"
TickFrequency="0.25"
IsSnapToTickEnabled="True"
LargeChange="1"
SmallChange="0.25"
Minimum="0"
Maximum="10" />
<TextBlock Margin="5,0,0,2.5" Text="{Binding RainbowSpeedText}" />
</StackPanel>
<StackPanel Margin="0,2.5,0,0" Orientation="Horizontal" IsEnabled="{Binding ShowLedColorPicker}">
<StackPanel Grid.Row="3" Orientation="Horizontal" IsEnabled="{Binding ShowLedColorPicker}">
<TextBlock Text="{ext:Locale ControllerSettingsLedColor}" />
<ui:ColorPickerButton
Margin="20,0,0,0"
@@ -51,5 +46,5 @@
Color="{Binding LedColor, Mode=TwoWay}">
</ui:ColorPickerButton>
</StackPanel>
</StackPanel>
</Grid>
</UserControl>

View File

@@ -65,7 +65,7 @@
VerticalAlignment="Center"
HorizontalAlignment="Center"
Margin="5,0,5,1"
Text="{Binding GyroDeadzone, StringFormat=\{0:0.00\}}" />
Text="{Binding GyroDeadzoneText}" />
</Grid>
<Separator Height="1" Margin="0,0,0,5" />
<CheckBox Margin="0,5,0,5" HorizontalAlignment="Center" IsChecked="{Binding EnableCemuHookMotion}">

View File

@@ -30,7 +30,7 @@
Grid.Row="0"
Grid.Column="2"
Margin="5,0,5,1"
Text="{Binding StrongRumble, StringFormat=\{0:0.00\}}" />
Text="{Binding StrongRumbleText}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
@@ -45,11 +45,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
Value="{Binding WeakRumble, Mode=TwoWay}" />
Value="{Binding WeakRumble, Mode=TwoWay}" />
<TextBlock
Grid.Row="1"
Grid.Column="2"
Margin="5,0,5,1"
Text="{Binding WeakRumble, StringFormat=\{0:0.00\}}" />
Text="{Binding WeakRumbleText}" />
</Grid>
</UserControl>