diff --git a/PracticePlugin/CustomEffectPoolsInstaller.cs b/PracticePlugin/CustomEffectPoolsInstaller.cs index 8c68f7e..94615d1 100644 --- a/PracticePlugin/CustomEffectPoolsInstaller.cs +++ b/PracticePlugin/CustomEffectPoolsInstaller.cs @@ -1,17 +1,9 @@ -using System; - -namespace PracticePlugin +namespace PracticePlugin { public class CustomEffectPoolsInstaller : EffectPoolsInstaller { - private void Awake() - { - Console.WriteLine("Custom Awake!"); - } - public override void InstallBindings() { - Console.WriteLine("Custom install bindings!"); Container.BindMemoryPool().WithInitialSize(20).FromComponentInNewPrefab(_flyingTextEffectPrefab); Container.BindMemoryPool().WithInitialSize(20) .FromComponentInNewPrefab(_flyingScoreTextEffectPrefab); diff --git a/PracticePlugin/CustomNoteCutSoundEffect.cs b/PracticePlugin/CustomNoteCutSoundEffect.cs index 375d881..d6499b1 100644 --- a/PracticePlugin/CustomNoteCutSoundEffect.cs +++ b/PracticePlugin/CustomNoteCutSoundEffect.cs @@ -33,7 +33,6 @@ public override void LateUpdate() public override void Init(AudioClip audioClip, double noteDSPTime, float aheadTime, float missedTimeOffset, Saber saber, NoteData noteData, bool handleWrongSaberTypeAsGood) { - Console.WriteLine("Custom Init!"); base.Init(audioClip, noteDSPTime, aheadTime, missedTimeOffset, saber, noteData, handleWrongSaberTypeAsGood); _audioSource.Stop(); var dspTime = AudioSettings.dspTime; diff --git a/PracticePlugin/Plugin.cs b/PracticePlugin/Plugin.cs index 1e569aa..100e655 100644 --- a/PracticePlugin/Plugin.cs +++ b/PracticePlugin/Plugin.cs @@ -21,7 +21,7 @@ public string Name public string Version { - get { return "v3.0.1"; } + get { return "v3.0.2"; } } public const float MaxSize = 5.05f; @@ -85,45 +85,7 @@ public void OnApplicationStart() _init = true; SceneManager.sceneLoaded += SceneManagerOnSceneLoaded; } - - private void SceneManagerOnActiveSceneChanged(Scene oldScene, Scene newScene) - { - Console.WriteLine("Active scene changed: " + newScene.name); - for (var i = 0; i < SceneManager.sceneCount; i++) - { - var scene = SceneManager.GetSceneAt(i); - Console.WriteLine("Scene loaded!!: " + scene.name); - } - - var gameScene = new Scene(); - if (!gameScene.isLoaded) return; - - Console.WriteLine("It's loaded!"); - - var effectPoolsInstaller = Resources.FindObjectsOfTypeAll().FirstOrDefault(); - if (effectPoolsInstaller != null) - { - ReflectionUtil.CopyComponent(effectPoolsInstaller, typeof(EffectPoolsInstaller), typeof(CustomEffectPoolsInstaller), - effectPoolsInstaller.gameObject); - Object.DestroyImmediate(effectPoolsInstaller); - - Console.WriteLine("Trying to find scene context"); - SceneContext sceneContext = null; - foreach (var gameObject in gameScene.GetRootGameObjects()) - { - sceneContext = gameObject.GetComponentInChildren(); - if (sceneContext != null) - { - break; - } - } - - if (sceneContext == null) return; - Console.WriteLine("Found it"); - sceneContext.enabled = false; - } - } - + public void OnApplicationQuit() { SceneManager.sceneLoaded -= SceneManagerOnSceneLoaded; @@ -189,25 +151,17 @@ private void SceneManagerOnSceneLoaded(Scene scene, LoadSceneMode mode) if (sceneDecoratorContext == null) { sceneDecoratorContext = gameObject.GetComponentInChildren(true); - - if (sceneDecoratorContext != null) - { - Console.WriteLine("Found one in " + gameObject.name); - } } } if (sceneContext != null && sceneDecoratorContext != null) { - Console.WriteLine("We're live!"); var prop = typeof(Context).GetField("_installers", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); var installersList = (List) prop.GetValue(sceneDecoratorContext); - Console.WriteLine("There are " + installersList.Count + " installers!"); installersList.Remove(effectPoolsInstaller); Object.DestroyImmediate(effectPoolsInstaller); installersList.Add(customEffectPoolsInstaller); - Console.WriteLine("Done!"); } if (_mainGameSceneSetupData == null) diff --git a/PracticePlugin/Properties/AssemblyInfo.cs b/PracticePlugin/Properties/AssemblyInfo.cs index 3706669..925953f 100644 --- a/PracticePlugin/Properties/AssemblyInfo.cs +++ b/PracticePlugin/Properties/AssemblyInfo.cs @@ -31,5 +31,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("3.0.1.0")] -[assembly: AssemblyFileVersion("3.0.1.0")] \ No newline at end of file +[assembly: AssemblyVersion("3.0.2.0")] +[assembly: AssemblyFileVersion("3.0.2.0")] \ No newline at end of file diff --git a/PracticePlugin/SongSeekBeatmapHandler.cs b/PracticePlugin/SongSeekBeatmapHandler.cs index a0c08b7..fcb194c 100644 --- a/PracticePlugin/SongSeekBeatmapHandler.cs +++ b/PracticePlugin/SongSeekBeatmapHandler.cs @@ -73,11 +73,9 @@ public static void OnSongTimeChanged(float newSongTime, float aheadTime) for (var i = 0; i < _beatmapData.beatmapLinesData.Length; i++) { callbackData.nextObjectIndexInLine[i] = 0; - while (callbackData.nextObjectIndexInLine[i] < - _beatmapData.beatmapLinesData[i].beatmapObjectsData.Length) + while (callbackData.nextObjectIndexInLine[i] < _beatmapData.beatmapLinesData[i].beatmapObjectsData.Length) { - var beatmapObjectData = _beatmapData.beatmapLinesData[i] - .beatmapObjectsData[callbackData.nextObjectIndexInLine[i]]; + var beatmapObjectData = _beatmapData.beatmapLinesData[i].beatmapObjectsData[callbackData.nextObjectIndexInLine[i]]; if (beatmapObjectData.time - aheadTime >= newSongTime) { break; @@ -102,11 +100,36 @@ public static void OnSongTimeChanged(float newSongTime, float aheadTime) } _beatmapObjectCallbackController.SetPrivateField("_nextEventIndex", newNextEventIndex); - - _noteAPool.DespawnAll(); - _bombNotePool.DespawnAll(); - _fullHeightObstaclePool.DespawnAll(); - _topObstaclePool.DespawnAll(); + + var notesA = _noteAPool.activeItems.ToList(); + foreach (var noteA in notesA) + { + _beatmapObjectSpawnController.Despawn(noteA); + } + + var notesB = _noteBPool.activeItems.ToList(); + foreach (var noteB in notesB) + { + _beatmapObjectSpawnController.Despawn(noteB); + } + + var bombs = _bombNotePool.activeItems.ToList(); + foreach (var bomb in bombs) + { + _beatmapObjectSpawnController.Despawn(bomb); + } + + var fullHeights = _fullHeightObstaclePool.activeItems.ToList(); + foreach (var fullHeight in fullHeights) + { + _beatmapObjectSpawnController.Despawn(fullHeight); + } + + var tops = _topObstaclePool.activeItems.ToList(); + foreach (var top in tops) + { + _beatmapObjectSpawnController.Despawn(top); + } Plugin.AudioTimeSync.SetPrivateField("_prevAudioSamplePos", -1); Plugin.AudioTimeSync.GetPrivateField("_songTime").value = newSongTime;