1
0
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:
Dean Herbert 2017-04-18 21:55:44 +09:00
parent 15d62a0c76
commit a0d9c14526
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
5 changed files with 21 additions and 2 deletions

View File

@ -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();
}

View File

@ -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>();
}
}

View File

@ -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
{

View File

@ -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>

View File

@ -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));
});
}