Skip to content

Commit

Permalink
fix: env colors were not being applied
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-r-elp committed Sep 14, 2024
1 parent 3898275 commit af3f98a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions MultiplayerExtensions/MultiplayerExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Tweening">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Tweening.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Unity.Addressables">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\Unity.Addressables.dll</HintPath>
<Private>False</Private>
Expand Down
19 changes: 13 additions & 6 deletions MultiplayerExtensions/Patchers/EnvironmentPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using SiraUtil.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Tweening;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zenject;
Expand Down Expand Up @@ -241,8 +241,8 @@ private static bool RemoveDuplicateInstalls(EnvironmentSceneSetup __instance)
return !container.HasBinding<EnvironmentBrandingManager.InitData>();
}

//[AffinityPostfix]
//[AffinityPatch(typeof(GameplayCoreInstaller), nameof(GameplayCoreInstaller.InstallBindings))]
[AffinityPostfix]
[AffinityPatch(typeof(GameplayCoreInstaller), nameof(GameplayCoreInstaller.InstallBindings))]
private void SetEnvironmentColors(GameplayCoreInstaller __instance)
{
if (!_config.SoloEnvironment || !_scenesManager.IsSceneInStack("MultiplayerEnvironment"))
Expand All @@ -257,7 +257,7 @@ private void SetEnvironmentColors(GameplayCoreInstaller __instance)
container.Inject(colorManager);
colorManager.Awake();

foreach (var gameObject in _objectsToEnable)
foreach (var gameObject in _objectsToEnable)
{
var lightSwitchEventEffects = gameObject.transform.GetComponentsInChildren<LightSwitchEventEffect>();
if (lightSwitchEventEffects == null)
Expand All @@ -267,8 +267,15 @@ private void SetEnvironmentColors(GameplayCoreInstaller __instance)
}

foreach (var component in lightSwitchEventEffects)
component?.Start();
}
{
// We have to set this manually since BG moved the below into Start() which we can't call without causing a nullref
component._usingBoostColors = false;
Color color = (component._lightOnStart ? component._lightColor0 : component._lightColor0.color.ColorWithAlpha(component._offColorIntensity));
Color color2 = (component._lightOnStart ? component._lightColor0Boost : component._lightColor0Boost.color.ColorWithAlpha(component._offColorIntensity));
component._colorTween = new ColorTween(color, color, new Action<Color>(component.SetColor), 0f, EaseType.Linear, 0f);
component.SetupTweenAndSaveOtherColors(color, color, color2, color2);
}
}
}
}
}

0 comments on commit af3f98a

Please sign in to comment.