UI: Enable Rainbow cycling in the Settings window

This commit is contained in:
Evan Husted
2025-01-29 20:27:01 -06:00
parent 0ed7fd14ba
commit 023bd5f00f
4 changed files with 31 additions and 3 deletions

View File

@ -5,6 +5,7 @@ using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.UI.Helpers;
using Ryujinx.Ava.UI.Models.Input;
using Ryujinx.Ava.UI.Views.Input;
using Ryujinx.Common.Utilities;
using Ryujinx.UI.Views.Input;
namespace Ryujinx.Ava.UI.ViewModels.Input
@ -48,6 +49,23 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
ParentModel = model;
model.NotifyChangesEvent += OnParentModelChanged;
OnParentModelChanged();
config.PropertyChanged += (_, args) =>
{
if (args.PropertyName is nameof(Config.UseRainbowLed))
{
if (Config is { UseRainbowLed: true, TurnOffLed: false, EnableLedChanging: true })
Rainbow.Updated += color => ParentModel.SelectedGamepad.SetLed((uint)color);
else
{
Rainbow.Reset();
if (Config.TurnOffLed)
ParentModel.SelectedGamepad.ClearLed();
else
ParentModel.SelectedGamepad.SetLed(Config.LedColor.ToUInt32());
}
}
};
Config = config;
}