diff --git a/ShockOsc/Services/UnderscoreConfig.cs b/ShockOsc/Services/UnderscoreConfig.cs index 3c0a191..8fda63a 100644 --- a/ShockOsc/Services/UnderscoreConfig.cs +++ b/ShockOsc/Services/UnderscoreConfig.cs @@ -193,6 +193,7 @@ private void ValidateSettings() public async Task SendUpdateForAll() { await _oscClient.SendGameMessage("/avatar/parameters/ShockOsc/_Config/Paused", KillSwitch); + await _oscClient.SendGameMessage("/avatar/parameters/ShockOsc/_Config/_All/Paused", KillSwitch); await _oscClient.SendGameMessage("/avatar/parameters/ShockOsc/_Config/_All/MinIntensity", MathUtils.ClampFloat(_configManager.Config.Behaviour.IntensityRange.Min / 100f)); await _oscClient.SendGameMessage("/avatar/parameters/ShockOsc/_Config/_All/MaxIntensity", diff --git a/ShockOsc/Ui/Pages/Dash/Tabs/ConfigTab.razor b/ShockOsc/Ui/Pages/Dash/Tabs/ConfigTab.razor index 129964c..86f094e 100644 --- a/ShockOsc/Ui/Pages/Dash/Tabs/ConfigTab.razor +++ b/ShockOsc/Ui/Pages/Dash/Tabs/ConfigTab.razor @@ -2,6 +2,7 @@ @using OpenShock.ShockOsc.Config @using OpenShock.ShockOsc.Services @using OpenShock.ShockOsc.Ui.Utils +@using OpenShock.ShockOsc.Utils @implements IDisposable @inject UnderscoreConfig underscoreConfig @inject ConfigManager ConfigManager @@ -14,7 +15,7 @@ Global Shocker Options (_All Shocker) - + @foreach (BehaviourConf.BoneHeldAction boneHeldAction in Enum.GetValues(typeof(BehaviourConf.BoneHeldAction))) { @boneHeldAction @@ -24,10 +25,10 @@

- - + +
- + @@ -37,7 +38,7 @@ @if (!ConfigManager.Config.Behaviour.RandomIntensity) { + OnSaveAction="_ => OnSettingsValueChange()"> Intensity: @ConfigManager.Config.Behaviour.FixedIntensity% } @@ -45,19 +46,19 @@ { + OnSaveAction="_ => OnSettingsValueChange()"> Min Intensity: @ConfigManager.Config.Behaviour.IntensityRange.Min% + OnSaveAction="_ => OnSettingsValueChange()"> Max Intensity: @ConfigManager.Config.Behaviour.IntensityRange.Max% } - + @@ -66,7 +67,7 @@ @if (!ConfigManager.Config.Behaviour.RandomDuration) { Duration: @MathF.Round(ConfigManager.Config.Behaviour.FixedDuration / 1000f, 1).ToString(CultureInfo.InvariantCulture)s @@ -75,14 +76,14 @@ { Min Duration: @MathF.Round(ConfigManager.Config.Behaviour.DurationRange.Min / 1000f, 1).ToString(CultureInfo.InvariantCulture)s Max Duration: @MathF.Round(ConfigManager.Config.Behaviour.DurationRange.Max / 1000f, 1).ToString(CultureInfo.InvariantCulture)s @@ -95,9 +96,9 @@ Game Options - - - + + + @code { @@ -114,11 +115,14 @@ set => ConfigManager.Config.Behaviour.RandomDuration = value == "Random Duration"; } + private void OnSettingsValueChange() + { + OsTask.Run(OnSettingsValueChangeAsync); + } - private async Task OnSettingsValueChange() + private Task OnSettingsValueChangeAsync() { - await ConfigManager.SaveAsync(); - await underscoreConfig.SendUpdateForAll(); + return Task.WhenAll(ConfigManager.SaveAsync(), underscoreConfig.SendUpdateForAll()); } protected override void OnInitialized() @@ -135,5 +139,7 @@ { UnderscoreConfig.OnConfigUpdate -= OnConfigUpdate; } + + } \ No newline at end of file