From 5012c14cdfdad7e71cc40382483f64a8a30d6a19 Mon Sep 17 00:00:00 2001 From: Eris Date: Thu, 2 Apr 2020 18:49:56 +0200 Subject: [PATCH] Release v1.10.0 (#35) Adds: - Beat Saber v1.8.0 support - BSIPA v4 support Co-authored-by: Eris --- .../BeatSaberHTTPStatusPlugin.csproj | 10 ++++----- BeatSaberHTTPStatus/Plugin.cs | 22 +++++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/BeatSaberHTTPStatus/BeatSaberHTTPStatusPlugin.csproj b/BeatSaberHTTPStatus/BeatSaberHTTPStatusPlugin.csproj index 715b5ec..f070469 100644 --- a/BeatSaberHTTPStatus/BeatSaberHTTPStatusPlugin.csproj +++ b/BeatSaberHTTPStatus/BeatSaberHTTPStatusPlugin.csproj @@ -12,8 +12,8 @@ v4.6.1 512 - 1.9.1 - 1.6.0 + 1.10.0 + 1.8.0 ..\libs\beatsaber\ $(Version) @@ -48,8 +48,8 @@ $(GameDirPath)\Beat Saber_Data\Managed\IPA.Loader.dll False - - $(GameDirPath)\Beat Saber_Data\Managed\MainAssembly.dll + + $(GameDirPath)\Beat Saber_Data\Managed\Main.dll False @@ -106,7 +106,7 @@ - + diff --git a/BeatSaberHTTPStatus/Plugin.cs b/BeatSaberHTTPStatus/Plugin.cs index ab086dd..fd8d531 100644 --- a/BeatSaberHTTPStatus/Plugin.cs +++ b/BeatSaberHTTPStatus/Plugin.cs @@ -18,7 +18,8 @@ // protected ScoreController._baseScore namespace BeatSaberHTTPStatus { - public class Plugin : IBeatSaberPlugin { + [Plugin(RuntimeOptions.SingleStartInit)] + internal class Plugin { private bool initialized; private StatusManager statusManager = new StatusManager(); @@ -62,19 +63,26 @@ public string Version { public static IPALogger log; + [Init] public void Init(IPALogger logger) { log = logger; } + [OnStart] public void OnApplicationStart() { if (initialized) return; initialized = true; server = new HTTPServer(statusManager); server.InitServer(); + + SceneManager.activeSceneChanged += OnActiveSceneChanged; } + [OnExit] public void OnApplicationQuit() { + SceneManager.activeSceneChanged -= OnActiveSceneChanged; + if (gamePause != null) { gamePause.didPauseEvent -= OnGamePause; gamePause.didResumeEvent -= OnGameResume; @@ -206,7 +214,7 @@ public void OnActiveSceneChanged(Scene oldScene, Scene newScene) { gameStatus.obstaclesCount = diff.beatmapData.obstaclesCount; gameStatus.environmentName = level.environmentInfo.sceneInfo.sceneName; - gameStatus.maxScore = ScoreController.MaxModifiedScoreForMaxRawScore(ScoreController.MaxRawScoreForNumberOfNotes(diff.beatmapData.notesCount), gameplayModifiers, gameplayModifiersSO); + gameStatus.maxScore = gameplayModifiersSO.MaxModifiedScoreForMaxRawScore(ScoreModel.MaxRawScoreForNumberOfNotes(diff.beatmapData.notesCount), gameplayModifiers, gameplayModifiersSO); gameStatus.maxRank = RankModel.MaxRankForGameplayModifiers(gameplayModifiers, gameplayModifiersSO).ToString(); try { @@ -321,7 +329,7 @@ public void OnNoteWasCut(NoteData noteData, NoteCutInfo noteCutInfo, int multipl int afterScore = 0; int cutDistanceScore = 0; - ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore); + ScoreModel.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore); gameStatus.initialScore = score; gameStatus.finalScore = -1; @@ -371,8 +379,8 @@ public void OnNoteWasFullyCut(CutScoreBuffer acsb) { SetNoteCutStatus(noteData, noteCutInfo, false); - // public ScoreController.RawScoreWithoutMultiplier(NoteCutInfo, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore) - ScoreController.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore); + // public static ScoreModel.RawScoreWithoutMultiplier(NoteCutInfo, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore) + ScoreModel.RawScoreWithoutMultiplier(noteCutInfo, out score, out afterScore, out cutDistanceScore); int multiplier = (int) cutScoreBufferMultiplierField.GetValue(acsb); @@ -437,8 +445,8 @@ public void OnScoreDidChange(int scoreBeforeMultiplier, int scoreAfterMultiplier gameStatus.score = scoreAfterMultiplier; - int currentMaxScoreBeforeMultiplier = ScoreController.MaxRawScoreForNumberOfNotes(gameStatus.passedNotes); - gameStatus.currentMaxScore = ScoreController.MaxModifiedScoreForMaxRawScore(currentMaxScoreBeforeMultiplier, gameplayModifiers, gameplayModifiersSO); + int currentMaxScoreBeforeMultiplier = ScoreModel.MaxRawScoreForNumberOfNotes(gameStatus.passedNotes); + gameStatus.currentMaxScore = gameplayModifiersSO.MaxModifiedScoreForMaxRawScore(currentMaxScoreBeforeMultiplier, gameplayModifiers, gameplayModifiersSO); RankModel.Rank rank = RankModel.GetRankForScore(scoreBeforeMultiplier, gameStatus.score, currentMaxScoreBeforeMultiplier, gameStatus.currentMaxScore); gameStatus.rank = RankModel.GetRankName(rank);