public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineAudioTimeController syncController) { BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !x.name.StartsWith("Online")); foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Default).Where(x => !x.Name.ToLower().Contains("event"))) { info.SetValue(this, info.GetValue(original)); } owner = newOwner; onlineCallbackController = callbackController; _beatmapObjectCallbackController = onlineCallbackController; onlineSyncController = syncController; if (onlineCallbackController != null) { _noteSpawnCallbackId = onlineCallbackController.AddBeatmapObjectCallback(new BeatmapObjectCallbackController.BeatmapObjectCallback(BeatmapObjectSpawnCallback), _spawnAheadTime); } _localPlayer = FindObjectsOfType <PlayerController>().First(x => !x.name.Contains("Online")); _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !x.name.Contains("Online")); (this as BeatmapObjectSpawnController).noteWasMissedEvent += FindObjectOfType <MissedNoteEffectSpawner>().HandleNoteWasMissed; (this as BeatmapObjectSpawnController).noteWasCutEvent += FindObjectOfType <NoteCutSoundEffectManager>().HandleNoteWasCut; (this as BeatmapObjectSpawnController).noteWasCutEvent += FindObjectOfType <BombCutSoundEffectManager>().HandleNoteWasCut; (this as BeatmapObjectSpawnController).noteWasCutEvent += FindObjectOfType <NoteCutEffectSpawner>().HandleNoteWasCutEvent; _activeNotes = new List <NoteController>(); _activeObstacles = new List <ObstacleController>(); }
public void Init(OnlinePlayerController newOwner, OnlineAudioTimeController onlineSyncController) { BeatmapObjectCallbackController original = FindObjectsOfType <BeatmapObjectCallbackController>().First(x => !(x is OnlineBeatmapCallbackController)); transform.position = original.transform.position; owner = newOwner; _audioTimeSource = onlineSyncController; _initData = original.GetPrivateField <InitData>("_initData"); _beatmapData = original.GetPrivateField <BeatmapData>("_beatmapData"); }
public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineBeatmapObjectManager objectManager, OnlineAudioTimeController syncController) { BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !(x is OnlineBeatmapSpawnController)); transform.position = original.transform.position; _initData = original.GetPrivateField <InitData>("_initData"); _beatmapObjectCallbackController = original.GetPrivateField <BeatmapObjectCallbackController>("_beatmapObjectCallbackController"); owner = newOwner; onlineObjectManager = objectManager; _beatmapObjectCallbackController = callbackController; onlineSyncController = syncController; }
public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineAudioTimeController syncController) { BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !x.name.StartsWith("Online")); foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Default).Where(x => !x.Name.ToLower().Contains("event"))) { info.SetValue(this, info.GetValue(original)); } owner = newOwner; try { if (BS_Utils.Plugin.LevelData.IsSet) { LevelOptionsInfo levelInfo = owner.PlayerInfo.playerLevelOptions; IDifficultyBeatmap diffBeatmap = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.level.beatmapLevelData.difficultyBeatmapSets.First(x => x.beatmapCharacteristic.serializedName == owner.PlayerInfo.playerLevelOptions.characteristicName).difficultyBeatmaps.First(x => x.difficulty == owner.PlayerInfo.playerLevelOptions.difficulty); Init(diffBeatmap.level.beatsPerMinute, diffBeatmap.beatmapData.beatmapLinesData.Length, diffBeatmap.noteJumpMovementSpeed, diffBeatmap.noteJumpStartBeatOffset, levelInfo.modifiers.disappearingArrows, levelInfo.modifiers.ghostNotes); } }catch (Exception e) { Plugin.log.Warn("Unable to update beatmap data! Exception: " + e); } onlineCallbackController = callbackController; _beatmapObjectCallbackController = onlineCallbackController; onlineSyncController = syncController; if (onlineCallbackController != null) { _beatmapObjectCallbackId = onlineCallbackController.AddBeatmapObjectCallback(new BeatmapObjectCallbackController.BeatmapObjectCallback(BeatmapObjectSpawnCallback), _spawnAheadTime); } _localPlayer = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController)); _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController)); NoteCutEffectSpawner cutEffectSpawner = FindObjectOfType <NoteCutEffectSpawner>(); (this as BeatmapObjectSpawnController).noteWasCutEvent += (sender, controller, cutInfo) => { if (cutInfo.allIsOK) { cutEffectSpawner.HandleNoteWasCutEvent(sender, controller, cutInfo); } }; _activeNotes = new List <NoteController>(); _activeObstacles = new List <ObstacleController>(); }
public void Init(OnlinePlayerController newOwner, OnlineAudioTimeController syncController) { BeatmapObjectManager original = FindObjectsOfType <BeatmapObjectManager>().First(x => !(x is OnlineBeatmapObjectManager)); transform.position = original.transform.position; foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).Where(x => !x.Name.ToLower().Contains("event"))) { info.SetValue(this, info.GetValue(original)); } owner = newOwner; onlineSyncController = syncController; _localPlayer = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController)); _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController)); }
public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineAudioTimeController syncController) { BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !(x is OnlineBeatmapSpawnController)); foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).Where(x => !x.Name.ToLower().Contains("event"))) { info.SetValue(this, info.GetValue(original)); } _beatmapCallbackItemDataList = new List <BeatmapObjectSpawnController.BeatmapCallbackItemData>(10); owner = newOwner; _beatmapObjectCallbackController = callbackController; onlineSyncController = syncController; _localPlayer = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController)); _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController)); _activeNotes = new List <NoteController>(); _activeObstacles = new List <ObstacleController>(); }
public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineAudioTimeController syncController) { BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !(x is OnlineBeatmapSpawnController)); foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).Where(x => !x.Name.ToLower().Contains("event"))) { info.SetValue(this, info.GetValue(original)); } owner = newOwner; try { if (BS_Utils.Plugin.LevelData.IsSet) { LevelOptionsInfo levelInfo = owner.playerInfo.updateInfo.playerLevelOptions; IDifficultyBeatmap diffBeatmap = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.level.beatmapLevelData.difficultyBeatmapSets.First(x => x.beatmapCharacteristic.serializedName == owner.playerInfo.updateInfo.playerLevelOptions.characteristicName).difficultyBeatmaps.First(x => x.difficulty == owner.playerInfo.updateInfo.playerLevelOptions.difficulty); _beatsPerMinute = diffBeatmap.level.beatsPerMinute; _noteLinesCount = (float)diffBeatmap.beatmapData.beatmapLinesData.Length; _noteJumpMovementSpeed = diffBeatmap.noteJumpMovementSpeed; _disappearingArrows = levelInfo.modifiers.disappearingArrows; _ghostNotes = levelInfo.modifiers.ghostNotes; float num = 60f / _beatsPerMinute; _moveDistance = _moveSpeed * num * _moveDurationInBeats; while (_noteJumpMovementSpeed * num * _halfJumpDurationInBeats > _maxHalfJumpDistance) { _halfJumpDurationInBeats /= 2f; } _halfJumpDurationInBeats += diffBeatmap.noteJumpStartBeatOffset; if (_halfJumpDurationInBeats < 1f) { _halfJumpDurationInBeats = 1f; } _jumpDistance = _noteJumpMovementSpeed * num * _halfJumpDurationInBeats * 2f; _spawnAheadTime = _moveDistance / _moveSpeed + _jumpDistance * 0.5f / _noteJumpMovementSpeed; } }catch (Exception e) { Plugin.log.Warn("Unable to update beatmap data! Exception: " + e); } _beatmapObjectCallbackController = callbackController; onlineSyncController = syncController; if (_beatmapObjectCallbackId != -1) { _beatmapObjectCallbackController.RemoveBeatmapObjectCallback(_beatmapObjectCallbackId); } if (_beatmapObjectCallbackController != null) { _beatmapObjectCallbackId = _beatmapObjectCallbackController.AddBeatmapObjectCallback(new BeatmapObjectCallbackController.BeatmapObjectCallback(BeatmapObjectSpawnCallback), _spawnAheadTime); } _localPlayer = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController)); _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController)); NoteCutEffectSpawner cutEffectSpawner = FindObjectOfType <NoteCutEffectSpawner>(); (this as BeatmapObjectSpawnController).noteWasCutEvent += (sender, controller, cutInfo) => { if (cutInfo.allIsOK) { cutEffectSpawner.HandleNoteWasCutEvent(sender, controller, cutInfo); } }; _activeNotes = new List <NoteController>(); _activeObstacles = new List <ObstacleController>(); }