mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Add temporary means of getting the user which is responsible for a resulting play.
This commit is contained in:
parent
15d62a0c76
commit
a0d9c14526
@ -12,6 +12,7 @@ using System.Diagnostics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
@ -27,6 +28,11 @@ namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
|
||||
User = new User
|
||||
{
|
||||
Username = @"Autoplay",
|
||||
};
|
||||
|
||||
createAutoReplay();
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,14 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
public class Replay
|
||||
{
|
||||
public User User;
|
||||
|
||||
public List<ReplayFrame> Frames = new List<ReplayFrame>();
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Scoring
|
||||
{
|
||||
|
@ -91,11 +91,17 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay);
|
||||
|
||||
public Replay Replay { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets a replay to be used, overriding local input.
|
||||
/// </summary>
|
||||
/// <param name="replay">The replay, null for local input.</param>
|
||||
public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
public void SetReplay(Replay replay)
|
||||
{
|
||||
Replay = replay;
|
||||
InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -22,6 +22,7 @@ using System.Linq;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -266,7 +267,9 @@ namespace osu.Game.Screens.Play
|
||||
Delay(1000);
|
||||
onCompletionEvent = Schedule(delegate
|
||||
{
|
||||
Push(new Results(scoreProcessor.CreateScore()));
|
||||
var score = scoreProcessor.CreateScore();
|
||||
score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value;
|
||||
Push(new Results(score));
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user