mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-12-12 07:36:59 +00:00
more C# 14 partial properties
This commit is contained in:
parent
09748b140a
commit
e8751e1c40
8 changed files with 230 additions and 103 deletions
|
|
@ -27,82 +27,136 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
public ControllerType ControllerType { get; set; }
|
||||
public PlayerIndex PlayerIndex { get; set; }
|
||||
|
||||
[ObservableProperty] private StickInputId _leftJoystick;
|
||||
[ObservableProperty] private bool _leftInvertStickX;
|
||||
[ObservableProperty] private bool _leftInvertStickY;
|
||||
[ObservableProperty] private bool _leftRotate90;
|
||||
[ObservableProperty] private GamepadInputId _leftStickButton;
|
||||
[ObservableProperty]
|
||||
public partial StickInputId LeftJoystick { get; set; }
|
||||
|
||||
[ObservableProperty] private StickInputId _rightJoystick;
|
||||
[ObservableProperty] private bool _rightInvertStickX;
|
||||
[ObservableProperty] private bool _rightInvertStickY;
|
||||
[ObservableProperty] private bool _rightRotate90;
|
||||
[ObservableProperty] private GamepadInputId _rightStickButton;
|
||||
[ObservableProperty]
|
||||
public partial bool LeftInvertStickX { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _dpadUp;
|
||||
[ObservableProperty] private GamepadInputId _dpadDown;
|
||||
[ObservableProperty] private GamepadInputId _dpadLeft;
|
||||
[ObservableProperty] private GamepadInputId _dpadRight;
|
||||
[ObservableProperty]
|
||||
public partial bool LeftInvertStickY { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _buttonMinus;
|
||||
[ObservableProperty] private GamepadInputId _buttonPlus;
|
||||
[ObservableProperty]
|
||||
public partial bool LeftRotate90 { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _buttonA;
|
||||
[ObservableProperty] private GamepadInputId _buttonB;
|
||||
[ObservableProperty] private GamepadInputId _buttonX;
|
||||
[ObservableProperty] private GamepadInputId _buttonY;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId LeftStickButton { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _buttonZl;
|
||||
[ObservableProperty] private GamepadInputId _buttonZr;
|
||||
[ObservableProperty]
|
||||
public partial StickInputId RightJoystick { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _buttonL;
|
||||
[ObservableProperty] private GamepadInputId _buttonR;
|
||||
[ObservableProperty]
|
||||
public partial bool RightInvertStickX { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _leftButtonSl;
|
||||
[ObservableProperty] private GamepadInputId _leftButtonSr;
|
||||
[ObservableProperty]
|
||||
public partial bool RightInvertStickY { get; set; }
|
||||
|
||||
[ObservableProperty] private GamepadInputId _rightButtonSl;
|
||||
[ObservableProperty] private GamepadInputId _rightButtonSr;
|
||||
[ObservableProperty]
|
||||
public partial bool RightRotate90 { get; set; }
|
||||
|
||||
[ObservableProperty] private float _deadzoneLeft;
|
||||
[ObservableProperty] private float _deadzoneRight;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId RightStickButton { get; set; }
|
||||
|
||||
[ObservableProperty] private float _rangeLeft;
|
||||
[ObservableProperty] private float _rangeRight;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId DpadUp { get; set; }
|
||||
|
||||
[ObservableProperty] private float _triggerThreshold;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId DpadDown { get; set; }
|
||||
|
||||
[ObservableProperty] private bool _enableMotion;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId DpadLeft { get; set; }
|
||||
|
||||
[ObservableProperty] private bool _enableRumble;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId DpadRight { get; set; }
|
||||
|
||||
[ObservableProperty] private bool _enableLedChanging;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonMinus { get; set; }
|
||||
|
||||
[ObservableProperty] private Color _ledColor;
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonPlus { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonA { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonB { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonX { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonY { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonZl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonZr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonL { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId ButtonR { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId LeftButtonSl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId LeftButtonSr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId RightButtonSl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial GamepadInputId RightButtonSr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial float DeadzoneLeft { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial float DeadzoneRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial float RangeLeft { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial float RangeRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial float TriggerThreshold { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool EnableMotion { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool EnableRumble { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool EnableLedChanging { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Color LedColor { get; set; }
|
||||
|
||||
public bool ShowLedColorPicker => !TurnOffLed && !UseRainbowLed;
|
||||
|
||||
private bool _turnOffLed;
|
||||
|
||||
public bool TurnOffLed
|
||||
{
|
||||
get => _turnOffLed;
|
||||
get;
|
||||
set
|
||||
{
|
||||
_turnOffLed = value;
|
||||
field = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(ShowLedColorPicker));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _useRainbowLed;
|
||||
|
||||
public bool UseRainbowLed
|
||||
{
|
||||
get => _useRainbowLed;
|
||||
get;
|
||||
set
|
||||
{
|
||||
_useRainbowLed = value;
|
||||
field = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(ShowLedColorPicker));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,31 +6,44 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
{
|
||||
public partial class HotkeyConfig : BaseModel
|
||||
{
|
||||
[ObservableProperty] private Key _toggleVSyncMode;
|
||||
[ObservableProperty]
|
||||
public partial Key ToggleVSyncMode { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _screenshot;
|
||||
[ObservableProperty]
|
||||
public partial Key Screenshot { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _showUI;
|
||||
[ObservableProperty]
|
||||
public partial Key ShowUI { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _pause;
|
||||
[ObservableProperty]
|
||||
public partial Key Pause { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _toggleMute;
|
||||
[ObservableProperty]
|
||||
public partial Key ToggleMute { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _resScaleUp;
|
||||
[ObservableProperty]
|
||||
public partial Key ResScaleUp { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _resScaleDown;
|
||||
[ObservableProperty]
|
||||
public partial Key ResScaleDown { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _volumeUp;
|
||||
[ObservableProperty]
|
||||
public partial Key VolumeUp { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _volumeDown;
|
||||
[ObservableProperty]
|
||||
public partial Key VolumeDown { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _customVSyncIntervalIncrement;
|
||||
[ObservableProperty]
|
||||
public partial Key CustomVSyncIntervalIncrement { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _customVSyncIntervalDecrement;
|
||||
[ObservableProperty]
|
||||
public partial Key CustomVSyncIntervalDecrement { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _turboMode;
|
||||
[ObservableProperty]
|
||||
public partial Key TurboMode { get; set; }
|
||||
|
||||
[ObservableProperty] private bool _turboModeWhileHeld;
|
||||
[ObservableProperty]
|
||||
public partial bool TurboModeWhileHeld { get; set; }
|
||||
|
||||
public HotkeyConfig(KeyboardHotkeys config)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,42 +12,89 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
public ControllerType ControllerType { get; set; }
|
||||
public PlayerIndex PlayerIndex { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _leftStickUp;
|
||||
[ObservableProperty] private Key _leftStickDown;
|
||||
[ObservableProperty] private Key _leftStickLeft;
|
||||
[ObservableProperty] private Key _leftStickRight;
|
||||
[ObservableProperty] private Key _leftStickButton;
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickUp { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _rightStickUp;
|
||||
[ObservableProperty] private Key _rightStickDown;
|
||||
[ObservableProperty] private Key _rightStickLeft;
|
||||
[ObservableProperty] private Key _rightStickRight;
|
||||
[ObservableProperty] private Key _rightStickButton;
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickDown { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _dpadUp;
|
||||
[ObservableProperty] private Key _dpadDown;
|
||||
[ObservableProperty] private Key _dpadLeft;
|
||||
[ObservableProperty] private Key _dpadRight;
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickLeft { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _buttonMinus;
|
||||
[ObservableProperty] private Key _buttonPlus;
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickRight { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _buttonA;
|
||||
[ObservableProperty] private Key _buttonB;
|
||||
[ObservableProperty] private Key _buttonX;
|
||||
[ObservableProperty] private Key _buttonY;
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickButton { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _buttonL;
|
||||
[ObservableProperty] private Key _buttonR;
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickUp { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _buttonZl;
|
||||
[ObservableProperty] private Key _buttonZr;
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickDown { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _leftButtonSl;
|
||||
[ObservableProperty] private Key _leftButtonSr;
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickLeft { get; set; }
|
||||
|
||||
[ObservableProperty] private Key _rightButtonSl;
|
||||
[ObservableProperty] private Key _rightButtonSr;
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickButton { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadUp { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadDown { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadLeft { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonMinus { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonPlus { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonA { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonB { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonX { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonY { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonL { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonR { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonZl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonZr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftButtonSl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftButtonSr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightButtonSl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightButtonSr { get; set; }
|
||||
|
||||
public KeyboardInputConfig(InputConfig config)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace Ryujinx.Ava.UI.Models
|
|||
{
|
||||
public partial class ModModel : BaseModel
|
||||
{
|
||||
[ObservableProperty] private bool _enabled;
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool Enabled { get; set; }
|
||||
public bool InSd { get; }
|
||||
public string Path { get; }
|
||||
public string Name { get; }
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ namespace Ryujinx.Ava.UI.Models
|
|||
public string Name { get; set; }
|
||||
public byte[] Data { get; set; }
|
||||
|
||||
[ObservableProperty] private SolidColorBrush _backgroundColor = new(Colors.White);
|
||||
[ObservableProperty]
|
||||
public partial SolidColorBrush BackgroundColor { get; set; } = new(Colors.White);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,24 +7,26 @@ namespace Ryujinx.Ava.UI.Models
|
|||
{
|
||||
public partial class TempProfile : BaseModel
|
||||
{
|
||||
[ObservableProperty] private byte[] _image;
|
||||
[ObservableProperty] private string _name = String.Empty;
|
||||
private UserId _userId;
|
||||
[ObservableProperty]
|
||||
public partial byte[] Image { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string Name { get; set; } = string.Empty;
|
||||
|
||||
public static uint MaxProfileNameLength => 0x20;
|
||||
|
||||
public UserId UserId
|
||||
{
|
||||
get => _userId;
|
||||
get;
|
||||
set
|
||||
{
|
||||
_userId = value;
|
||||
field = value;
|
||||
OnPropertyChanged();
|
||||
OnPropertyChanged(nameof(UserIdString));
|
||||
}
|
||||
}
|
||||
|
||||
public string UserIdString => _userId.ToString();
|
||||
public string UserIdString => UserId.ToString();
|
||||
|
||||
public TempProfile(UserProfile profile)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,11 +13,20 @@ namespace Ryujinx.Ava.UI.Models
|
|||
{
|
||||
private readonly Profile _profile;
|
||||
private readonly NavigationDialogHost _owner;
|
||||
[ObservableProperty] private byte[] _image;
|
||||
[ObservableProperty] private string _name;
|
||||
[ObservableProperty] private UserId _userId;
|
||||
[ObservableProperty] private bool _isPointerOver;
|
||||
[ObservableProperty] private IBrush _backgroundColor;
|
||||
[ObservableProperty]
|
||||
public partial byte[] Image { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string Name { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial UserId UserId { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool IsPointerOver { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial IBrush BackgroundColor { get; set; }
|
||||
|
||||
public UserProfile(Profile profile, NavigationDialogHost owner)
|
||||
{
|
||||
|
|
@ -39,7 +48,7 @@ namespace Ryujinx.Ava.UI.Models
|
|||
|
||||
private void UpdateBackground()
|
||||
{
|
||||
Application currentApplication = Avalonia.Application.Current;
|
||||
Application currentApplication = Application.Current;
|
||||
currentApplication.Styles.TryGetResource("ControlFillColorSecondary", currentApplication.ActualThemeVariant, out object color);
|
||||
|
||||
if (color is not null)
|
||||
|
|
|
|||
|
|
@ -359,7 +359,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
[ObservableProperty] private bool _matchSystemTime;
|
||||
[ObservableProperty]
|
||||
public partial bool MatchSystemTime { get; set; }
|
||||
|
||||
public DateTimeOffset CurrentDate { get; set; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue