Skip to content

Commit

Permalink
Fix MM status
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Nov 1, 2024
1 parent 81f2e89 commit f48c165
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public static async Task CreateFikaGame(TarkovApplication instance, TimeAndWeath
metricsEvents.SetGameCreated();
FikaEventDispatcher.DispatchEvent(new AbstractGameCreatedEvent(coopGame));

ScreenUpdater updater = new(instance.MatchmakerPlayerControllerClass, coopGame);

if (!isServer)
{
coopGame.SetMatchmakerStatus("Coop game joined");
Expand All @@ -161,6 +163,7 @@ public static async Task CreateFikaGame(TarkovApplication instance, TimeAndWeath
MainMenuController mmc = Traverse.Create(instance).Field<MainMenuController>("mainMenuController").Value;
mmc?.Unsubscribe();
gameWorld.OnGameStarted();
updater.Dispose();

if (FikaBackendUtils.IsSpectator)
{
Expand Down Expand Up @@ -204,4 +207,27 @@ private static async Task HandleJoinAsSpectator()
MainPlayer.ApplyDamageInfo(damageInfo, EBodyPart.Head, EBodyPartColliderType.Eyes, 0);
}
}

internal class ScreenUpdater : IDisposable
{
private readonly MatchmakerPlayerControllerClass matchmakerPlayerControllerClass;
private readonly CoopGame coopGame;

public ScreenUpdater(MatchmakerPlayerControllerClass controller, CoopGame game)
{
matchmakerPlayerControllerClass = controller;
coopGame = game;
game.OnMatchingStatusChanged += UpdateStatus;
}

private void UpdateStatus(string text, float? progress)
{
matchmakerPlayerControllerClass.UpdateMatchingStatus(text, progress);
}

public void Dispose()
{
coopGame.OnMatchingStatusChanged -= UpdateStatus;
}
}
}

0 comments on commit f48c165

Please sign in to comment.