2022-12-19 22:47:10 +01:00
|
|
|
using CommonHelpers;
|
|
|
|
|
|
|
|
|
|
namespace PowerControl.Options
|
|
|
|
|
{
|
|
|
|
|
public static class SteamController
|
|
|
|
|
{
|
|
|
|
|
public static Menu.MenuItemWithOptions Instance = new Menu.MenuItemWithOptions()
|
|
|
|
|
{
|
|
|
|
|
Name = "Controller",
|
2023-01-10 11:12:31 +01:00
|
|
|
PersistentKey = "SteamController",
|
|
|
|
|
PersistOnCreate = false,
|
2022-12-19 22:47:10 +01:00
|
|
|
ApplyDelay = 500,
|
|
|
|
|
OptionsValues = delegate ()
|
|
|
|
|
{
|
|
|
|
|
if (SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
|
|
|
|
return value.SelectableProfiles.SplitWithN();
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
CurrentValue = delegate ()
|
|
|
|
|
{
|
|
|
|
|
if (SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
|
|
|
|
return value.CurrentProfile.Length > 0 ? value.CurrentProfile : null;
|
|
|
|
|
return null;
|
|
|
|
|
},
|
2022-12-19 23:36:22 +01:00
|
|
|
ApplyValue = (selected) =>
|
2022-12-19 22:47:10 +01:00
|
|
|
{
|
|
|
|
|
if (!SharedData<SteamControllerSetting>.GetExistingValue(out var value))
|
|
|
|
|
return null;
|
2022-12-19 23:36:22 +01:00
|
|
|
value.DesiredProfile = selected;
|
2022-12-19 22:47:10 +01:00
|
|
|
if (!SharedData<SteamControllerSetting>.SetExistingValue(value))
|
|
|
|
|
return null;
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|