Skip to content

Commit

Permalink
Merge pull request #127 from ToniMacaroni/NewBranch
Browse files Browse the repository at this point in the history
1.20 First release
  • Loading branch information
ToniMacaroni authored Mar 17, 2022
2 parents 05491a6 + c232a49 commit b147cf7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 33 deletions.
40 changes: 20 additions & 20 deletions SaberFactory/Game/EventPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,6 @@ internal class EventPlayer : IDisposable

private float _prevScore;

public void Dispose()
{
_beatmapObjectManager.noteWasCutEvent -= OnNoteCut;
_beatmapObjectManager.noteWasMissedEvent -= OnNoteMiss;

if (_obstacleSaberSparkleEffectManager)
{
_obstacleSaberSparkleEffectManager.sparkleEffectDidStartEvent -= SaberStartCollide;
_obstacleSaberSparkleEffectManager.sparkleEffectDidEndEvent -= SaberEndCollide;
}

_energyCounter.gameEnergyDidReach0Event -= InvokeOnLevelFail;

_scoreController.multiplierDidChangeEvent -= MultiplayerDidChange;

_scoreCounter.relativeScoreOrImmediateRankDidChangeEvent -= ScoreChanged;

_comboController.comboDidChangeEvent -= OnComboDidChangeEvent;
}

public void SetPartEventList(List<PartEvents> partEventsList, SaberType saberType)
{
_partEventsList = partEventsList;
Expand Down Expand Up @@ -112,6 +92,26 @@ public void SetPartEventList(List<PartEvents> partEventsList, SaberType saberTyp

InvokeOnLevelStart();
}

public void Dispose()
{
_beatmapObjectManager.noteWasCutEvent -= OnNoteCut;
_beatmapObjectManager.noteWasMissedEvent -= OnNoteMiss;

if (_obstacleSaberSparkleEffectManager)
{
_obstacleSaberSparkleEffectManager.sparkleEffectDidStartEvent -= SaberStartCollide;
_obstacleSaberSparkleEffectManager.sparkleEffectDidEndEvent -= SaberEndCollide;
}

_energyCounter.gameEnergyDidReach0Event -= InvokeOnLevelFail;

_scoreController.multiplierDidChangeEvent -= MultiplayerDidChange;

_scoreCounter.relativeScoreOrImmediateRankDidChangeEvent -= ScoreChanged;

_comboController.comboDidChangeEvent -= OnComboDidChangeEvent;
}

public void InvokeLevelEnded()
{
Expand Down
14 changes: 14 additions & 0 deletions SaberFactory/Installers/PluginGameInstaller.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//#define TEST_TRAIL


using ModestTree;
using SaberFactory.Configuration;
using SaberFactory.Game;
using SaberFactory.Helpers;
Expand All @@ -26,6 +27,12 @@ public override void InstallBindings()
Container.BindInterfacesAndSelfTo<EventPlayer>().AsTransient();

//Container.BindInterfacesAndSelfTo<AFHandler>().AsSingle();

if (!Container.HasBinding<ObstacleSaberSparkleEffectManager>())
{
Container.Bind<ObstacleSaberSparkleEffectManager>().FromMethod(ObstanceSaberSparkleEffectManagerGetter).AsSingle();
}

Container.BindInterfacesAndSelfTo<GameSaberSetup>().AsSingle();
Container.BindInstance(SaberModelRegistration.Create<SfSaberModelController>(300));

Expand All @@ -37,5 +44,12 @@ public override void InstallBindings()
}
#endif
}

private ObstacleSaberSparkleEffectManager ObstanceSaberSparkleEffectManagerGetter(InjectContext ctx)
{
var playerSpaceConverter = Container.TryResolve<PlayerSpaceConvertor>();
Assert.IsNotNull(playerSpaceConverter, $"{nameof(playerSpaceConverter)} was null");
return playerSpaceConverter.GetComponentInChildren<ObstacleSaberSparkleEffectManager>();
}
}
}
2 changes: 1 addition & 1 deletion SaberFactory/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async void Init(IPALogger logger, Config conf, Zenjector zenjector, Plugi

zenjector.UseLogger(logger);
zenjector.UseHttpService();
zenjector.Expose<ObstacleSaberSparkleEffectManager>("Gameplay");

zenjector.Install<PluginAppInstaller>(Location.App, logger, pluginConfig, metadata);
zenjector.Install<PluginMenuInstaller>(Location.Menu);
zenjector.Install<PluginGameInstaller>(Location.Player | Location.MultiPlayer);
Expand Down
4 changes: 0 additions & 4 deletions SaberFactory/SaberFactory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,4 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<Folder Include="UI\CUI" />
</ItemGroup>

</Project>
8 changes: 0 additions & 8 deletions SaberFactory/UI/CustomSaber/CustomSaberUiComposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ protected override void SetupTemplates()
{
base.SetupTemplates();
BsmlDecorator.AddTemplate("NavHeight", "70");
// if (BsmlDecorator.StyleSheetHandler.GetSelector("btn", out var selector))
// {
// Debug.LogWarning($"Found {selector.Name}");
// foreach (var rule in selector.GetRules())
// {
// Debug.LogWarning($"- {rule.Name} = {rule.Value}");
// }
// }
}

#region Views
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
- Allow mods to add sabers from memory
- Fixed auto refreshing trail when changin whitestep
- Fixed rotation offset not being mirrored
- Fixed accuracy events
- New saber creation project <https://github.com/ToniMacaroni/AssetCreationProject>

*Needs `BeatSaberMarkupLanguage` and `SiraUtil` (available on ModAssistant)*

0 comments on commit b147cf7

Please sign in to comment.