It builds

This commit is contained in:
Isaac Marovitz 2023-05-18 14:30:25 -04:00 committed by Isaac Marovitz
parent 281a078773
commit d224996c15
7 changed files with 47 additions and 46 deletions

View file

@ -39,17 +39,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
}
}
private bool _showSettings;
public bool ShowSettings
{
get => _showSettings;
set
{
_showSettings = value;
OnPropertyChanged();
}
}
private SvgImage _image;
public SvgImage Image
{
@ -70,5 +59,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{
await RumbleInputView.Show(this);
}
public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config)
{
IsLeft = model.IsLeft;
IsRight = model.IsRight;
Image = model.Image;
Config = config;
}
}
}

View file

@ -47,7 +47,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
private int _controllerNumber = 0;
private string _controllerImage;
private int _device;
private object _configuration;
private object _configViewModel;
private string _profileName;
private bool _isLoaded;
private readonly UserControl _owner;
@ -72,12 +72,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public bool IsModified { get; set; }
public object Configuration
public object ConfigViewModel
{
get => _configuration;
get => _configViewModel;
set
{
_configuration = value;
_configViewModel = value;
OnPropertyChanged();
}
@ -286,12 +286,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
if (Config is StandardKeyboardInputConfig keyboardInputConfig)
{
Configuration = new KeyboardInputConfig(keyboardInputConfig);
ConfigViewModel = new KeyboardInputViewModel(this, new KeyboardInputConfig(keyboardInputConfig));
}
if (Config is StandardControllerInputConfig controllerInputConfig)
{
Configuration = new ControllerInputConfig(controllerInputConfig);
ConfigViewModel = new ControllerInputViewModel(this, new ControllerInputConfig(controllerInputConfig));
}
}
@ -733,7 +733,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
return;
}
if (Configuration == null)
if (ConfigViewModel == null)
{
return;
}
@ -756,11 +756,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
if (IsKeyboard)
{
config = (Configuration as KeyboardInputConfig).GetConfig();
config = (ConfigViewModel as KeyboardInputViewModel).Config.GetConfig();
}
else if (IsController)
{
config = (Configuration as ControllerInputConfig).GetConfig();
config = (ConfigViewModel as ControllerInputViewModel).Config.GetConfig();
}
config.ControllerType = Controllers[_controller].Type;
@ -825,18 +825,18 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
if (device.Type == DeviceType.Keyboard)
{
var inputConfig = Configuration as KeyboardInputConfig;
var inputConfig = (ConfigViewModel as KeyboardInputViewModel).Config;
inputConfig.Id = device.Id;
}
else
{
var inputConfig = Configuration as ControllerInputConfig;
var inputConfig = (ConfigViewModel as ControllerInputViewModel).Config;
inputConfig.Id = device.Id.Split(" ")[0];
}
var config = !IsController
? (Configuration as KeyboardInputConfig).GetConfig()
: (Configuration as ControllerInputConfig).GetConfig();
? (ConfigViewModel as KeyboardInputViewModel).Config.GetConfig()
: (ConfigViewModel as ControllerInputViewModel).Config.GetConfig();
config.ControllerType = Controllers[_controller].Type;
config.PlayerIndex = _playerId;
@ -867,7 +867,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public void NotifyChanges()
{
OnPropertyChanged(nameof(Configuration));
OnPropertyChanged(nameof(ConfigViewModel));
OnPropertyChanged(nameof(IsController));
OnPropertyChanged(nameof(ShowSettings));
OnPropertyChanged(nameof(IsKeyboard));

View file

@ -38,17 +38,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
}
}
private bool _showSettings;
public bool ShowSettings
{
get => _showSettings;
set
{
_showSettings = value;
OnPropertyChanged();
}
}
private SvgImage _image;
public SvgImage Image
{
@ -59,5 +48,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
OnPropertyChanged();
}
}
public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config)
{
IsLeft = model.IsLeft;
IsRight = model.IsRight;
Image = model.Image;
Config = config;
}
}
}

View file

@ -35,8 +35,7 @@
<!-- Button / JoyStick Settings -->
<Grid
Name="SettingButtons"
MinHeight="450"
IsVisible="{Binding ShowSettings}">
MinHeight="450">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@ -451,7 +450,7 @@
<Button
Margin="10"
Grid.Column="1"
Command="{Binding ShowMotionConfig}">
Command="{ReflectionBinding ShowMotionConfig}">
<TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
</Button>
</Grid>
@ -477,7 +476,7 @@
<Button
Margin="10"
Grid.Column="1"
Command="{Binding ShowRumbleConfig}">
Command="{ReflectionBinding ShowRumbleConfig}">
<TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
</Button>
</Grid>

View file

@ -211,7 +211,15 @@
</Grid>
</Grid>
</StackPanel>
<views:ControllerInputView IsVisible="{Binding IsController}"/>
<views:KeyboardInputView IsVisible="{Binding !IsController}"/>
<ContentControl Content="{Binding ConfigViewModel}" IsVisible="{Binding ShowSettings}">
<ContentControl.DataTemplates>
<DataTemplate DataType="viewModels:ControllerInputViewModel">
<views:ControllerInputView/>
</DataTemplate>
<DataTemplate DataType="viewModels:KeyboardInputViewModel">
<views:KeyboardInputView/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</StackPanel>
</UserControl>

View file

@ -27,14 +27,15 @@ namespace Ryujinx.Ava.UI.Views.Input
InitializeComponent();
foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
// TODO: Move this stuff to Controller/KeyboardInputView
/*foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
{
if (visual is ToggleButton button && !(visual is CheckBox))
{
button.Checked += Button_Checked;
button.Unchecked += Button_Unchecked;
}
}
}*/
}
protected override void OnPointerReleased(PointerReleasedEventArgs e)

View file

@ -35,8 +35,7 @@
<!-- Button / JoyStick Settings -->
<Grid
Name="SettingButtons"
MinHeight="450"
IsVisible="{Binding ShowSettings}">
MinHeight="450">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />