public void Init(OnlinePlayerController newOwner) { BeatmapObjectCallbackController original = FindObjectsOfType <BeatmapObjectCallbackController>().First(x => !(x is OnlineBeatmapCallbackController)); 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; _beatmapObjectDataCallbackCacheList = new List <BeatmapObjectData>(); _beatmapObjectCallbackData = new List <BeatmapObjectCallbackData>(); _beatmapDataModel = new GameObject("CustomBeatmapDataModel").AddComponent <BeatmapDataModel>(); 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); BeatmapData data = diffBeatmap.beatmapData; _beatmapDataModel.beatmapData = BeatDataTransformHelper.CreateTransformedBeatmapData(data, levelInfo.modifiers.ToGameplayModifiers(), PracticeSettings.defaultPracticeSettings, PlayerSpecificSettings.defaultSettings); HandleBeatmapDataModelDidChangeBeatmapData(); Plugin.log.Info($"Set custom BeatmapDataModel for difficulty {levelInfo.difficulty}"); } }
public void Init(OnlinePlayerController newOwner) { BeatmapObjectCallbackController original = FindObjectsOfType <BeatmapObjectCallbackController>().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; _beatmapObjectDataCallbackCacheList = new List <BeatmapObjectData>(); _beatmapObjectCallbackData = new List <BeatmapObjectCallbackData>(); }