internal static void TriggerMultiplayerLevelDidFinish(MultiplayerLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults, IReadOnlyList <MultiplayerPlayerResultsData> otherPlayersLevelCompletionResults) { Logger.log.Debug("Multiplayer level finished."); LevelFinished?.RaiseEventSafe(levelScenesTransitionSetupDataSO, new MultiplayerLevelFinishedEventArgs(levelScenesTransitionSetupDataSO, levelCompletionResults, otherPlayersLevelCompletionResults), nameof(LevelFinished)); }
public static void Postfix(MultiplayerLevelScenesTransitionSetupDataSO multiplayerLevelScenesTransitionSetupData, MultiplayerResultsData multiplayerResultsData) { var dict = new Dictionary <string, LevelCompletionResults>(); foreach (var player in multiplayerResultsData.otherPlayersData) { dict.Add(player.connectedPlayer.userId, player.multiplayerLevelCompletionResults.levelCompletionResults); } SiraEvents.SendMultiplayerEvent(multiplayerLevelScenesTransitionSetupData, multiplayerResultsData.localPlayerResultData.multiplayerLevelCompletionResults.levelCompletionResults, dict); }
static void Prefix(MultiplayerLevelScenesTransitionSetupDataSO __instance, ref EnvironmentInfoSO ____multiplayerEnvironmentInfo, string gameMode, IPreviewBeatmapLevel previewBeatmapLevel, BeatmapDifficulty beatmapDifficulty, BeatmapCharacteristicSO beatmapCharacteristic, IDifficultyBeatmap difficultyBeatmap, ColorScheme overrideColorScheme, GameplayModifiers gameplayModifiers, PlayerSpecificSettings playerSpecificSettings, PracticeSettings practiceSettings, bool useTestNoteCutSoundEffects = false) { ScoreSubmission._wasDisabled = false; ScoreSubmission.LastDisablers = Array.Empty <string>(); Plugin.LevelData.GameplayCoreSceneSetupData = new GameplayCoreSceneSetupData(difficultyBeatmap, gameplayModifiers, playerSpecificSettings, practiceSettings, useTestNoteCutSoundEffects, ____multiplayerEnvironmentInfo); Plugin.LevelData.IsSet = true; Plugin.LevelData.Mode = Mode.Multiplayer; Utilities.Logger.log.Debug("Level Data set"); __instance.didFinishEvent -= __instance_didFinishEvent; __instance.didFinishEvent += __instance_didFinishEvent; }
private void handleLevelFinished(MultiplayerLevelScenesTransitionSetupDataSO sceneSetupData, MultiplayerResultsData resultsData) { if (resultsData.localPlayerResultData.levelCompletionResults == null || !Plugin.Config.Statistics) { return; } string difficulty = sceneSetupData.beatmapDifficulty.ToString(); string characteristic = sceneSetupData.beatmapCharacteristic.serializedName; int timePlayed = (int)Math.Floor(resultsData.localPlayerResultData.levelCompletionResults.endSongTime); bool pass = resultsData.localPlayerResultData.levelCompletionResults.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared; int cutNotes = resultsData.localPlayerResultData.levelCompletionResults.badCutsCount + resultsData.localPlayerResultData.levelCompletionResults.notGoodCount + resultsData.localPlayerResultData.levelCompletionResults.okCount + resultsData.localPlayerResultData.levelCompletionResults.goodCutsCount; int missedNotes = resultsData.localPlayerResultData.levelCompletionResults.missedCount; int score = resultsData.localPlayerResultData.levelCompletionResults.rawScore; double accuracy = score != 0 ? Math.Floor(100 * ((double)ScoreModel.MaxRawScoreForNumberOfNotes(sceneSetupData.difficultyBeatmap.beatmapData.cuttableNotesType) / score)) / 100 : 0; string?hash = Utilities.Utils.LevelIdToHash(sceneSetupData.previewBeatmapLevel.levelID); if (hash != null) { _ = Statistics.PlayMap(ExtendedPlayerManager.localPlatformID, (int)ExtendedPlayerManager.localPlatform, MPState.CurrentMasterServer.hostname, hash, difficulty, characteristic, timePlayed, pass, cutNotes, missedNotes, score, accuracy); } //_ = Statistics.PlayMap(hash, sceneSetupData.beatmapDifficulty.ToString(), sceneSetupData.beatmapCharacteristic.serializedName, (int)Math.Floor(resultsData.localPlayerResultData.levelCompletionResults.endSongTime), (int)ExtendedPlayerManager.localPlatform, MPState.CurrentMasterServer.hostname); }
internal static void TriggerMultiplayerLevelDidFinish(MultiplayerLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults, System.Collections.Generic.Dictionary <string, LevelCompletionResults> otherPlayersLevelCompletionResults) { MultiLevelDidFinishEvent?.Invoke(levelScenesTransitionSetupDataSO, levelCompletionResults, otherPlayersLevelCompletionResults); }
public static void Postfix(MultiplayerLevelScenesTransitionSetupDataSO multiplayerLevelScenesTransitionSetupData, DisconnectedReason disconnectedReason) { SiraEvents.SendDisconnectEvent(multiplayerLevelScenesTransitionSetupData, disconnectedReason); }
public MultiplayerLevelFinishedEventArgs(MultiplayerLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults, IReadOnlyList <MultiplayerPlayerResultsData> otherPlayersLevelCompletionResults) : base(LevelType.Multiplayer, levelScenesTransitionSetupDataSO, levelCompletionResults) { playersCompletionResults = otherPlayersLevelCompletionResults; }
private void OnMultilevelFinished(MultiplayerLevelScenesTransitionSetupDataSO scene, LevelCompletionResults result, IReadOnlyList <MultiplayerPlayerResultsData> _) { SaveRecord(scene?.difficultyBeatmap, result, true); }
private static void __instance_didFinishEvent(MultiplayerLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults, System.Collections.Generic.Dictionary <string, LevelCompletionResults> otherPlayersLevelCompletionResults) { Plugin.TriggerMultiplayerLevelDidFinish(levelScenesTransitionSetupDataSO, levelCompletionResults, otherPlayersLevelCompletionResults); }
private void SiraEvents_MultiplayerFinished(MultiplayerLevelScenesTransitionSetupDataSO setupData, LevelCompletionResults results, Dictionary <string, LevelCompletionResults> remotePlayerResults) { MultiplayerLevelDidFinish?.Invoke(setupData, results, remotePlayerResults); MultiplayerLevelFinished?.Invoke(results, remotePlayerResults); }
private void SiraEvents_MultiplayerDisconnected(MultiplayerLevelScenesTransitionSetupDataSO setupData, DisconnectedReason reason) { LocalPlayerDidDisconnectFromMultiplayer?.Invoke(setupData, reason); MultiplayerLevelDisconnected?.Invoke(reason); }
internal static void SendDisconnectEvent(MultiplayerLevelScenesTransitionSetupDataSO data, DisconnectedReason reason) { MultiplayerDisconnected?.Invoke(data, reason); }
internal static void SendMultiplayerEvent(MultiplayerLevelScenesTransitionSetupDataSO data, LevelCompletionResults results, Dictionary <string, LevelCompletionResults> remotePlayerResults) { MultiplayerFinished?.Invoke(data, results, remotePlayerResults); }
private static void __instance_didFinishEvent(MultiplayerLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, MultiplayerResultsData resultsData) { Utilities.Logger.log.Debug("Triggering Multiplayer LevelFinishEvent."); Plugin.TriggerMultiplayerLevelDidFinish(levelScenesTransitionSetupDataSO, resultsData.localPlayerResultData.levelCompletionResults, resultsData.otherPlayersData); BSEvents.TriggerMultiplayerLevelDidFinish(levelScenesTransitionSetupDataSO, resultsData.localPlayerResultData.levelCompletionResults, resultsData.otherPlayersData); }