Skip to content

Commit

Permalink
multiplayer fixes from goob W abber
Browse files Browse the repository at this point in the history
  • Loading branch information
Caeden117 committed Jul 11, 2022
1 parent c9872dc commit be6722a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
39 changes: 23 additions & 16 deletions Counters+/Installers/MultiplayerCountersInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,30 @@ internal class MultiplayerCountersInstaller : CountersInstaller
{
public override void InstallBindings()
{
var coreGameHUD = GetComponentInChildren<CoreGameHUDController>();
// haha i made goobie beg me for this one line of code
if (!Plugin.MainConfig.Enabled) return;

// We need a separate installer to bind the HUD Controller so counters can use it
Container.Bind<CoreGameHUDController>().FromInstance(coreGameHUD).AsSingle();
// If CoreGameHUD isn't bound already (by MultEx or others), we need to bind it ourselves
var coreGameHUD = Container.TryResolve<CoreGameHUDController>();
if (coreGameHUD == null)
{
// Thankfully the CoreGameHUD is just a child of the installer GameObject
coreGameHUD = GetComponentInChildren<CoreGameHUDController>();
Container.Bind<CoreGameHUDController>().FromInstance(coreGameHUD).AsSingle();

// Change base game HUD elements to standard position
var energyUIPanel = coreGameHUD.GetComponentInChildren<GameEnergyUIPanel>();
energyUIPanel.transform.position = new Vector3(0, -0.64f, 7.75f);
energyUIPanel.transform.rotation = Quaternion.Euler(0, 0, 0);

var comboUI = coreGameHUD.GetComponentInChildren<ComboUIController>();
comboUI.transform.position = new Vector3(-3.2f, 1.83f, 7f);
comboUI.transform.rotation = Quaternion.Euler(0, 0, 0);

var multiplierUI = coreGameHUD.GetComponentInChildren<ScoreMultiplierUIController>();
multiplierUI.transform.position = new Vector3(3.2f, 1.7f, 7f);
multiplierUI.transform.rotation = Quaternion.Euler(0, 0, 0);
}

// For the multiplayer rank counter, we also need to bind the Multiplayer Position
Container.Bind<MultiplayerPositionHUDController>()
Expand All @@ -22,19 +42,6 @@ public override void InstallBindings()

Container.BindInterfacesAndSelfTo<CanvasIntroFadeController>().AsSingle();

// Change base game HUD elements to standard position
var energyUIPanel = coreGameHUD.GetComponentInChildren<GameEnergyUIPanel>();
energyUIPanel.transform.position = new Vector3(0, -0.64f, 7.75f);
energyUIPanel.transform.rotation = Quaternion.Euler(0, 0, 0);

var comboUI = coreGameHUD.GetComponentInChildren<ComboUIController>();
comboUI.transform.position = new Vector3(-3.2f, 1.83f, 7f);
comboUI.transform.rotation = Quaternion.Euler(0, 0, 0);

var multiplierUI = coreGameHUD.GetComponentInChildren<ScoreMultiplierUIController>();
multiplierUI.transform.position = new Vector3(3.2f, 1.7f, 7f);
multiplierUI.transform.rotation = Quaternion.Euler(0, 0, 0);

// Install counters like normal
base.InstallBindings();

Expand Down
4 changes: 2 additions & 2 deletions Counters+/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.3.0")]
[assembly: AssemblyFileVersion("2.3.0")]
[assembly: AssemblyVersion("2.3.1")]
[assembly: AssemblyFileVersion("2.3.1")]
4 changes: 2 additions & 2 deletions Counters+/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"id": "Counters+",
"name": "Counters+",
"author": "Caeden117",
"version": "2.3.0",
"version": "2.3.1",
"description": "A suite of enhancements for Beat Saber's UI.",
"icon": "CountersPlus.UI.Images.Logo.png",
"gameVersion": "1.21.0",
"gameVersion": "1.23.0",
"dependsOn": {
"BSIPA": "^4.2.1",
"BeatSaberMarkupLanguage": "^1.6.0",
Expand Down

0 comments on commit be6722a

Please sign in to comment.