mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Refactor ctor
This commit is contained in:
parent
7d276144b8
commit
1b5679b0d7
@ -9,7 +9,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Online.Spectator;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Spectate;
|
||||
@ -29,20 +28,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
[Resolved]
|
||||
private SpectatorStreamingClient spectatorClient { get; set; }
|
||||
|
||||
private readonly int[] userIds;
|
||||
private readonly PlayerInstance[] instances;
|
||||
|
||||
private PlayerGrid grid;
|
||||
|
||||
public MultiplayerSpectator(PlaylistItem playlistItem, int[] userIds)
|
||||
: this(userIds.AsSpan().Slice(0, Math.Min(16, userIds.Length)).ToArray())
|
||||
public MultiplayerSpectator(int[] userIds)
|
||||
: base(userIds.AsSpan().Slice(0, Math.Min(16, userIds.Length)).ToArray())
|
||||
{
|
||||
}
|
||||
|
||||
private MultiplayerSpectator(int[] userIds)
|
||||
: base(userIds)
|
||||
{
|
||||
this.userIds = userIds;
|
||||
instances = new PlayerInstance[userIds.Length];
|
||||
}
|
||||
|
||||
@ -141,6 +132,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
spectatorClient.StopWatchingUser(userId);
|
||||
}
|
||||
|
||||
private int getIndexForUser(int userId) => Array.IndexOf(userIds, userId);
|
||||
private int getIndexForUser(int userId) => Array.IndexOf(UserIds, userId);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Spectate
|
||||
/// </summary>
|
||||
public abstract class SpectatorScreen : OsuScreen
|
||||
{
|
||||
private readonly int[] userIds;
|
||||
protected readonly int[] UserIds;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Spectate
|
||||
/// <param name="userIds">The users to spectate.</param>
|
||||
protected SpectatorScreen(params int[] userIds)
|
||||
{
|
||||
this.userIds = userIds;
|
||||
this.UserIds = userIds;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Spectate
|
||||
spectatorClient.OnUserFinishedPlaying += userFinishedPlaying;
|
||||
spectatorClient.OnNewFrames += userSentFrames;
|
||||
|
||||
foreach (var id in userIds)
|
||||
foreach (var id in UserIds)
|
||||
{
|
||||
userLookupCache.GetUserAsync(id).ContinueWith(u => Schedule(() =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user