mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Rename SpectatorStreamingClient -> SpectatorClient
This commit is contained in:
parent
80a714a9c4
commit
6beeb7f7c4
@ -27,8 +27,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
private readonly User streamingUser = new User { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Test user" };
|
||||
|
||||
[Cached(typeof(SpectatorStreamingClient))]
|
||||
private TestSpectatorStreamingClient testSpectatorStreamingClient = new TestSpectatorStreamingClient();
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
private TestSpectatorClient testSpectatorClient = new TestSpectatorClient();
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestUserLookupCache();
|
||||
@ -61,8 +61,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddStep("add streaming client", () =>
|
||||
{
|
||||
Remove(testSpectatorStreamingClient);
|
||||
Add(testSpectatorStreamingClient);
|
||||
Remove(testSpectatorClient);
|
||||
Add(testSpectatorClient);
|
||||
});
|
||||
|
||||
finish();
|
||||
@ -212,9 +212,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private void waitForPlayer() => AddUntilStep("wait for player", () => Stack.CurrentScreen is Player);
|
||||
|
||||
private void start(int? beatmapId = null) => AddStep("start play", () => testSpectatorStreamingClient.StartPlay(streamingUser.Id, beatmapId ?? importedBeatmapId));
|
||||
private void start(int? beatmapId = null) => AddStep("start play", () => testSpectatorClient.StartPlay(streamingUser.Id, beatmapId ?? importedBeatmapId));
|
||||
|
||||
private void finish(int? beatmapId = null) => AddStep("end play", () => testSpectatorStreamingClient.EndPlay(streamingUser.Id, beatmapId ?? importedBeatmapId));
|
||||
private void finish(int? beatmapId = null) => AddStep("end play", () => testSpectatorClient.EndPlay(streamingUser.Id, beatmapId ?? importedBeatmapId));
|
||||
|
||||
private void checkPaused(bool state) =>
|
||||
AddUntilStep($"game is {(state ? "paused" : "playing")}", () => player.ChildrenOfType<DrawableRuleset>().First().IsPaused.Value == state);
|
||||
@ -223,7 +223,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
AddStep("send frames", () =>
|
||||
{
|
||||
testSpectatorStreamingClient.SendFrames(streamingUser.Id, nextFrame, count);
|
||||
testSpectatorClient.SendFrames(streamingUser.Id, nextFrame, count);
|
||||
nextFrame += count;
|
||||
});
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient streamingClient { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[Cached]
|
||||
private GameplayBeatmap gameplayBeatmap = new GameplayBeatmap(new Beatmap());
|
||||
@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
replay = new Replay();
|
||||
|
||||
users.BindTo(streamingClient.PlayingUsers);
|
||||
users.BindTo(spectatorClient.PlayingUsers);
|
||||
users.BindCollectionChanged((obj, args) =>
|
||||
{
|
||||
switch (args.Action)
|
||||
@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
foreach (int user in args.NewItems)
|
||||
{
|
||||
if (user == api.LocalUser.Value.Id)
|
||||
streamingClient.WatchUser(user);
|
||||
spectatorClient.WatchUser(user);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -91,14 +91,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
foreach (int user in args.OldItems)
|
||||
{
|
||||
if (user == api.LocalUser.Value.Id)
|
||||
streamingClient.StopWatchingUser(user);
|
||||
spectatorClient.StopWatchingUser(user);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}, true);
|
||||
|
||||
streamingClient.OnNewFrames += onNewFrames;
|
||||
spectatorClient.OnNewFrames += onNewFrames;
|
||||
|
||||
Add(new GridContainer
|
||||
{
|
||||
@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
}
|
||||
|
||||
private double latency = SpectatorStreamingClient.TIME_BETWEEN_SENDS;
|
||||
private double latency = SpectatorClient.TIME_BETWEEN_SENDS;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
@ -233,7 +233,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("stop recorder", () =>
|
||||
{
|
||||
recorder.Expire();
|
||||
streamingClient.OnNewFrames -= onNewFrames;
|
||||
spectatorClient.OnNewFrames -= onNewFrames;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMultiSpectatorLeaderboard : MultiplayerTestScene
|
||||
{
|
||||
[Cached(typeof(SpectatorStreamingClient))]
|
||||
private TestSpectatorStreamingClient streamingClient = new TestSpectatorStreamingClient();
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
private TestSpectatorClient spectatorClient = new TestSpectatorClient();
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestUserLookupCache();
|
||||
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
base.Content.AddRange(new Drawable[]
|
||||
{
|
||||
streamingClient,
|
||||
spectatorClient,
|
||||
lookupCache,
|
||||
content = new Container { RelativeSizeAxes = Axes.Both }
|
||||
});
|
||||
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
foreach (var (userId, clock) in clocks)
|
||||
{
|
||||
streamingClient.EndPlay(userId, 0);
|
||||
spectatorClient.EndPlay(userId, 0);
|
||||
clock.CurrentTime = 0;
|
||||
}
|
||||
});
|
||||
@ -67,7 +67,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("create leaderboard", () =>
|
||||
{
|
||||
foreach (var (userId, _) in clocks)
|
||||
streamingClient.StartPlay(userId, 0);
|
||||
spectatorClient.StartPlay(userId, 0);
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
|
||||
|
||||
@ -96,10 +96,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
// For player 2, send frames in sets of 10.
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
streamingClient.SendFrames(PLAYER_1_ID, i, 1);
|
||||
spectatorClient.SendFrames(PLAYER_1_ID, i, 1);
|
||||
|
||||
if (i % 10 == 0)
|
||||
streamingClient.SendFrames(PLAYER_2_ID, i, 10);
|
||||
spectatorClient.SendFrames(PLAYER_2_ID, i, 10);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -22,8 +22,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMultiSpectatorScreen : MultiplayerTestScene
|
||||
{
|
||||
[Cached(typeof(SpectatorStreamingClient))]
|
||||
private TestSpectatorStreamingClient streamingClient = new TestSpectatorStreamingClient();
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
private TestSpectatorClient spectatorClient = new TestSpectatorClient();
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestUserLookupCache();
|
||||
@ -59,14 +59,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddStep("add streaming client", () =>
|
||||
{
|
||||
Remove(streamingClient);
|
||||
Add(streamingClient);
|
||||
Remove(spectatorClient);
|
||||
Add(spectatorClient);
|
||||
});
|
||||
|
||||
AddStep("finish previous gameplay", () =>
|
||||
{
|
||||
foreach (var id in playingUserIds)
|
||||
streamingClient.EndPlay(id, importedBeatmapId);
|
||||
spectatorClient.EndPlay(id, importedBeatmapId);
|
||||
playingUserIds.Clear();
|
||||
});
|
||||
}
|
||||
@ -87,11 +87,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
loadSpectateScreen(false);
|
||||
|
||||
AddWaitStep("wait a bit", 10);
|
||||
AddStep("load player first_player_id", () => streamingClient.StartPlay(PLAYER_1_ID, importedBeatmapId));
|
||||
AddStep("load player first_player_id", () => spectatorClient.StartPlay(PLAYER_1_ID, importedBeatmapId));
|
||||
AddUntilStep("one player added", () => spectatorScreen.ChildrenOfType<Player>().Count() == 1);
|
||||
|
||||
AddWaitStep("wait a bit", 10);
|
||||
AddStep("load player second_player_id", () => streamingClient.StartPlay(PLAYER_2_ID, importedBeatmapId));
|
||||
AddStep("load player second_player_id", () => spectatorClient.StartPlay(PLAYER_2_ID, importedBeatmapId));
|
||||
AddUntilStep("two players added", () => spectatorScreen.ChildrenOfType<Player>().Count() == 2);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
foreach (int id in userIds)
|
||||
{
|
||||
Client.CurrentMatchPlayingUserIds.Add(id);
|
||||
streamingClient.StartPlay(id, beatmapId ?? importedBeatmapId);
|
||||
spectatorClient.StartPlay(id, beatmapId ?? importedBeatmapId);
|
||||
playingUserIds.Add(id);
|
||||
nextFrame[id] = 0;
|
||||
}
|
||||
@ -262,7 +262,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
AddStep("end play", () =>
|
||||
{
|
||||
streamingClient.EndPlay(userId, beatmapId ?? importedBeatmapId);
|
||||
spectatorClient.EndPlay(userId, beatmapId ?? importedBeatmapId);
|
||||
playingUserIds.Remove(userId);
|
||||
nextFrame.Remove(userId);
|
||||
});
|
||||
@ -276,7 +276,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
foreach (int id in userIds)
|
||||
{
|
||||
streamingClient.SendFrames(id, nextFrame[id], count);
|
||||
spectatorClient.SendFrames(id, nextFrame[id], count);
|
||||
nextFrame[id] += count;
|
||||
}
|
||||
});
|
||||
|
@ -28,8 +28,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
private const int users = 16;
|
||||
|
||||
[Cached(typeof(SpectatorStreamingClient))]
|
||||
private TestMultiplayerStreaming streamingClient = new TestMultiplayerStreaming();
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
private TestMultiplayerSpectatorClient spectatorClient = new TestMultiplayerSpectatorClient();
|
||||
|
||||
[Cached(typeof(UserLookupCache))]
|
||||
private UserLookupCache lookupCache = new TestSceneCurrentlyPlayingDisplay.TestUserLookupCache();
|
||||
@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
base.Content.Children = new Drawable[]
|
||||
{
|
||||
streamingClient,
|
||||
spectatorClient,
|
||||
lookupCache,
|
||||
Content
|
||||
};
|
||||
@ -71,10 +71,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var playable = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
||||
|
||||
for (int i = 0; i < users; i++)
|
||||
streamingClient.StartPlay(i, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0);
|
||||
spectatorClient.StartPlay(i, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0);
|
||||
|
||||
Client.CurrentMatchPlayingUserIds.Clear();
|
||||
Client.CurrentMatchPlayingUserIds.AddRange(streamingClient.PlayingUsers);
|
||||
Client.CurrentMatchPlayingUserIds.AddRange(spectatorClient.PlayingUsers);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -83,7 +83,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
scoreProcessor.ApplyBeatmap(playable);
|
||||
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, streamingClient.PlayingUsers.ToArray())
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, spectatorClient.PlayingUsers.ToArray())
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestScoreUpdates()
|
||||
{
|
||||
AddRepeatStep("update state", () => streamingClient.RandomlyUpdateState(), 100);
|
||||
AddRepeatStep("update state", () => spectatorClient.RandomlyUpdateState(), 100);
|
||||
AddToggleStep("switch compact mode", expanded => leaderboard.Expanded.Value = expanded);
|
||||
}
|
||||
|
||||
@ -109,12 +109,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestChangeScoringMode()
|
||||
{
|
||||
AddRepeatStep("update state", () => streamingClient.RandomlyUpdateState(), 5);
|
||||
AddRepeatStep("update state", () => spectatorClient.RandomlyUpdateState(), 5);
|
||||
AddStep("change to classic", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Classic));
|
||||
AddStep("change to standardised", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised));
|
||||
}
|
||||
|
||||
public class TestMultiplayerStreaming : TestSpectatorStreamingClient
|
||||
public class TestMultiplayerSpectatorClient : TestSpectatorClient
|
||||
{
|
||||
private readonly Dictionary<int, FrameHeader> lastHeaders = new Dictionary<int, FrameHeader>();
|
||||
|
||||
|
@ -19,8 +19,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneCurrentlyPlayingDisplay : OsuTestScene
|
||||
{
|
||||
[Cached(typeof(SpectatorStreamingClient))]
|
||||
private TestSpectatorStreamingClient testSpectatorStreamingClient = new TestSpectatorStreamingClient();
|
||||
[Cached(typeof(SpectatorClient))]
|
||||
private TestSpectatorClient testSpectatorClient = new TestSpectatorClient();
|
||||
|
||||
private CurrentlyPlayingDisplay currentlyPlaying;
|
||||
|
||||
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
AddStep("add streaming client", () =>
|
||||
{
|
||||
nestedContainer?.Remove(testSpectatorStreamingClient);
|
||||
nestedContainer?.Remove(testSpectatorClient);
|
||||
Remove(lookupCache);
|
||||
|
||||
Children = new Drawable[]
|
||||
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
testSpectatorStreamingClient,
|
||||
testSpectatorClient,
|
||||
currentlyPlaying = new CurrentlyPlayingDisplay
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -55,15 +55,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
};
|
||||
});
|
||||
|
||||
AddStep("Reset players", () => testSpectatorStreamingClient.PlayingUsers.Clear());
|
||||
AddStep("Reset players", () => testSpectatorClient.PlayingUsers.Clear());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBasicDisplay()
|
||||
{
|
||||
AddStep("Add playing user", () => testSpectatorStreamingClient.PlayingUsers.Add(2));
|
||||
AddStep("Add playing user", () => testSpectatorClient.PlayingUsers.Add(2));
|
||||
AddUntilStep("Panel loaded", () => currentlyPlaying.ChildrenOfType<UserGridPanel>()?.FirstOrDefault()?.User.Id == 2);
|
||||
AddStep("Remove playing user", () => testSpectatorStreamingClient.PlayingUsers.Remove(2));
|
||||
AddStep("Remove playing user", () => testSpectatorClient.PlayingUsers.Remove(2));
|
||||
AddUntilStep("Panel no longer present", () => !currentlyPlaying.ChildrenOfType<UserGridPanel>().Any());
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Online.Spectator
|
||||
{
|
||||
public class SpectatorStreamingClient : Component, ISpectatorClient
|
||||
public class SpectatorClient : Component, ISpectatorClient
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum milliseconds between frame bundle sends.
|
||||
@ -80,7 +80,7 @@ namespace osu.Game.Online.Spectator
|
||||
/// </summary>
|
||||
public event Action<int, SpectatorState> OnUserFinishedPlaying;
|
||||
|
||||
public SpectatorStreamingClient(EndpointConfiguration endpoints)
|
||||
public SpectatorClient(EndpointConfiguration endpoints)
|
||||
{
|
||||
endpoint = endpoints.SpectatorEndpointUrl;
|
||||
}
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Online.Spectator
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IAPIProvider api)
|
||||
{
|
||||
connector = api.GetHubConnector(nameof(SpectatorStreamingClient), endpoint);
|
||||
connector = api.GetHubConnector(nameof(SpectatorClient), endpoint);
|
||||
|
||||
if (connector != null)
|
||||
{
|
@ -85,7 +85,7 @@ namespace osu.Game
|
||||
|
||||
protected IAPIProvider API;
|
||||
|
||||
private SpectatorStreamingClient spectatorStreaming;
|
||||
private SpectatorClient spectatorClient;
|
||||
private StatefulMultiplayerClient multiplayerClient;
|
||||
|
||||
protected MenuCursorContainer MenuCursorContainer;
|
||||
@ -240,7 +240,7 @@ namespace osu.Game
|
||||
|
||||
dependencies.CacheAs(API ??= new APIAccess(LocalConfig, endpoints, VersionHash));
|
||||
|
||||
dependencies.CacheAs(spectatorStreaming = new SpectatorStreamingClient(endpoints));
|
||||
dependencies.CacheAs(spectatorClient = new SpectatorClient(endpoints));
|
||||
dependencies.CacheAs(multiplayerClient = new MultiplayerClient(endpoints));
|
||||
|
||||
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
||||
@ -313,7 +313,7 @@ namespace osu.Game
|
||||
// add api components to hierarchy.
|
||||
if (API is APIAccess apiAccess)
|
||||
AddInternal(apiAccess);
|
||||
AddInternal(spectatorStreaming);
|
||||
AddInternal(spectatorClient);
|
||||
AddInternal(multiplayerClient);
|
||||
|
||||
AddInternal(RulesetConfigCache);
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Dashboard
|
||||
private FillFlowContainer<PlayingUserPanel> userFlow;
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient spectatorStreaming { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Dashboard
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
playingUsers.BindTo(spectatorStreaming.PlayingUsers);
|
||||
playingUsers.BindTo(spectatorClient.PlayingUsers);
|
||||
playingUsers.BindCollectionChanged(onUsersChanged, true);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.UI
|
||||
public int RecordFrameRate = 60;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private SpectatorStreamingClient spectatorStreaming { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private GameplayBeatmap gameplayBeatmap { get; set; }
|
||||
@ -49,13 +49,13 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
inputManager = GetContainingInputManager();
|
||||
|
||||
spectatorStreaming?.BeginPlaying(gameplayBeatmap, target);
|
||||
spectatorClient?.BeginPlaying(gameplayBeatmap, target);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
spectatorStreaming?.EndPlaying();
|
||||
spectatorClient?.EndPlaying();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
target.Replay.Frames.Add(frame);
|
||||
|
||||
spectatorStreaming?.HandleFrame(frame);
|
||||
spectatorClient?.HandleFrame(frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
public bool AllPlayersLoaded => instances.All(p => p?.PlayerLoaded == true);
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient spectatorClient { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private StatefulMultiplayerClient multiplayerClient { get; set; }
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
protected readonly Dictionary<int, TrackedUserData> UserScores = new Dictionary<int, TrackedUserData>();
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient streamingClient { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private StatefulMultiplayerClient multiplayerClient { get; set; }
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
foreach (var userId in playingUsers)
|
||||
{
|
||||
streamingClient.WatchUser(userId);
|
||||
spectatorClient.WatchUser(userId);
|
||||
|
||||
// probably won't be required in the final implementation.
|
||||
var resolvedUser = userLookupCache.GetUserAsync(userId).Result;
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
playingUsers.BindCollectionChanged(usersChanged);
|
||||
|
||||
// this leaderboard should be guaranteed to be completely loaded before the gameplay starts (is a prerequisite in MultiplayerPlayer).
|
||||
streamingClient.OnNewFrames += handleIncomingFrames;
|
||||
spectatorClient.OnNewFrames += handleIncomingFrames;
|
||||
}
|
||||
|
||||
private void usersChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
@ -98,7 +98,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
foreach (var userId in e.OldItems.OfType<int>())
|
||||
{
|
||||
streamingClient.StopWatchingUser(userId);
|
||||
spectatorClient.StopWatchingUser(userId);
|
||||
|
||||
if (UserScores.TryGetValue(userId, out var trackedData))
|
||||
trackedData.MarkUserQuit();
|
||||
@ -123,14 +123,14 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (streamingClient != null)
|
||||
if (spectatorClient != null)
|
||||
{
|
||||
foreach (var user in playingUsers)
|
||||
{
|
||||
streamingClient.StopWatchingUser(user);
|
||||
spectatorClient.StopWatchingUser(user);
|
||||
}
|
||||
|
||||
streamingClient.OnNewFrames -= handleIncomingFrames;
|
||||
spectatorClient.OnNewFrames -= handleIncomingFrames;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,12 +31,12 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient spectatorStreaming { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
spectatorStreaming.OnUserBeganPlaying += userBeganPlaying;
|
||||
spectatorClient.OnUserBeganPlaying += userBeganPlaying;
|
||||
|
||||
AddInternal(new OsuSpriteText
|
||||
{
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
|
||||
spectatorClient.OnUserBeganPlaying -= userBeganPlaying;
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
@ -84,8 +84,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (spectatorStreaming != null)
|
||||
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
|
||||
if (spectatorClient != null)
|
||||
spectatorClient.OnUserBeganPlaying -= userBeganPlaying;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient spectatorStreaming { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
spectatorStreaming.OnUserBeganPlaying += userBeganPlaying;
|
||||
spectatorClient.OnUserBeganPlaying += userBeganPlaying;
|
||||
}
|
||||
|
||||
private void userBeganPlaying(int userId, SpectatorState state)
|
||||
@ -40,8 +40,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
if (spectatorStreaming != null)
|
||||
spectatorStreaming.OnUserBeganPlaying -= userBeganPlaying;
|
||||
if (spectatorClient != null)
|
||||
spectatorClient.OnUserBeganPlaying -= userBeganPlaying;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Spectate
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient spectatorClient { get; set; }
|
||||
private SpectatorClient spectatorClient { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private UserLookupCache userLookupCache { get; set; }
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Spectator
|
||||
{
|
||||
public class TestSpectatorStreamingClient : SpectatorStreamingClient
|
||||
public class TestSpectatorClient : SpectatorClient
|
||||
{
|
||||
public new BindableList<int> PlayingUsers => (BindableList<int>)base.PlayingUsers;
|
||||
private readonly ConcurrentDictionary<int, byte> watchingUsers = new ConcurrentDictionary<int, byte>();
|
||||
@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Spectator
|
||||
private readonly Dictionary<int, int> userBeatmapDictionary = new Dictionary<int, int>();
|
||||
private readonly Dictionary<int, bool> userSentStateDictionary = new Dictionary<int, bool>();
|
||||
|
||||
public TestSpectatorStreamingClient()
|
||||
public TestSpectatorClient()
|
||||
: base(new DevelopmentEndpointConfiguration())
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user