Skip to content

Commit

Permalink
Merge pull request #182 from ModdingPink/master
Browse files Browse the repository at this point in the history
Bepinex Publicizer, Unbind CoreGameHUDController
  • Loading branch information
Goobwabber authored Aug 17, 2023
2 parents aaee636 + 60703a3 commit 38e9a0a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions MultiplayerExtensions/MultiplayerExtensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\LiteNetLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="MultiplayerCore">
<HintPath>$(BeatSaberDir)\Plugins\MultiplayerCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="netstandard">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\netstandard.dll</HintPath>
<Private>False</Private>
Expand Down Expand Up @@ -213,6 +209,14 @@
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all" />
<!-- Publicize directly when referencing -->
<Reference Include="$(BeatSaberDir)\Plugins\MultiplayerCore.dll" Publicize="true" />
</ItemGroup>
<ItemGroup>
<Folder Include="Assets" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="BeforeBuild" Condition="'$(NCRUNCH)' != '1'">
<Error Text="The BeatSaberModdingTools.Tasks nuget package doesn't seem to be installed." Condition="'$(BSMTTaskAssembly)' == ''" />
<GetCommitInfo ProjectDir="$(ProjectDir)">
Expand Down
5 changes: 4 additions & 1 deletion MultiplayerExtensions/Patchers/EnvironmentPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using SiraUtil.Logging;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
Expand Down Expand Up @@ -159,6 +160,7 @@ private void InstallEnvironment(Context __instance, List<InstallerBase> normalIn
}
}


[AffinityPrefix]
[AffinityPatch(typeof(GameObjectContext), "InstallInstallers")]
private void LoveYouCountersPlus(GameObjectContext __instance)
Expand All @@ -167,6 +169,7 @@ private void LoveYouCountersPlus(GameObjectContext __instance)
{
DiContainer container = __instance.GetProperty<DiContainer, GameObjectContext>("Container");
var hud = (CoreGameHUDController)_behavioursToInject.Find(x => x is CoreGameHUDController);
container.Unbind<CoreGameHUDController>();
container.Bind<CoreGameHUDController>().FromInstance(hud).AsSingle();
var multihud = __instance.transform.GetComponentInChildren<CoreGameHUDController>();
multihud.gameObject.SetActive(false);
Expand All @@ -175,7 +178,7 @@ private void LoveYouCountersPlus(GameObjectContext __instance)
}
}

[AffinityPostfix]
[AffinityPostfix]
[AffinityPatch(typeof(GameObjectContext), "InstallSceneBindings")]
private void ActivateEnvironment(GameObjectContext __instance)
{
Expand Down

0 comments on commit 38e9a0a

Please sign in to comment.