mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 15:03:10 +08:00
Store MultiplayerRoomUser
as part of tracked data
This commit is contained in:
parent
54ffb8dc4e
commit
0fa1f085df
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
((SpectatingTrackedUserData)data).Clock = null;
|
((SpectatingTrackedUserData)data).Clock = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TrackedUserData CreateUserData(int userId, ScoreProcessor scoreProcessor) => new SpectatingTrackedUserData(userId, scoreProcessor);
|
protected override TrackedUserData CreateUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor) => new SpectatingTrackedUserData(user, scoreProcessor);
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
@ -47,8 +48,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public IClock Clock;
|
public IClock Clock;
|
||||||
|
|
||||||
public SpectatingTrackedUserData(int userId, ScoreProcessor scoreProcessor)
|
public SpectatingTrackedUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor)
|
||||||
: base(userId, scoreProcessor)
|
: base(user, scoreProcessor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Configuration;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
@ -55,7 +56,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
foreach (var userId in playingUsers)
|
foreach (var userId in playingUsers)
|
||||||
{
|
{
|
||||||
var trackedUser = CreateUserData(userId, scoreProcessor);
|
var user = multiplayerClient.Room?.Users.FirstOrDefault(u => u.UserID == userId);
|
||||||
|
|
||||||
|
var trackedUser = CreateUserData(user, scoreProcessor);
|
||||||
trackedUser.ScoringMode.BindTo(scoringMode);
|
trackedUser.ScoringMode.BindTo(scoringMode);
|
||||||
UserScores[userId] = trackedUser;
|
UserScores[userId] = trackedUser;
|
||||||
}
|
}
|
||||||
@ -145,7 +148,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
protected class TrackedUserData
|
protected class TrackedUserData
|
||||||
{
|
{
|
||||||
public readonly int UserId;
|
public readonly MultiplayerRoomUser User;
|
||||||
public readonly ScoreProcessor ScoreProcessor;
|
public readonly ScoreProcessor ScoreProcessor;
|
||||||
|
|
||||||
public readonly BindableDouble Score = new BindableDouble();
|
public readonly BindableDouble Score = new BindableDouble();
|
||||||
@ -157,9 +160,9 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
public readonly List<TimedFrame> Frames = new List<TimedFrame>();
|
public readonly List<TimedFrame> Frames = new List<TimedFrame>();
|
||||||
|
|
||||||
public TrackedUserData(int userId, ScoreProcessor scoreProcessor)
|
public TrackedUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor)
|
||||||
{
|
{
|
||||||
UserId = userId;
|
User = user;
|
||||||
ScoreProcessor = scoreProcessor;
|
ScoreProcessor = scoreProcessor;
|
||||||
|
|
||||||
ScoringMode.BindValueChanged(_ => UpdateScore());
|
ScoringMode.BindValueChanged(_ => UpdateScore());
|
||||||
|
Loading…
Reference in New Issue
Block a user