mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Remove User from Replay
This commit is contained in:
parent
ed67984638
commit
8eff49bccd
@ -9,7 +9,6 @@ using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.UI;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Replays
|
||||
{
|
||||
@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Replays
|
||||
public CatchAutoGenerator(Beatmap<CatchHitObject> beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
Replay = new Replay { User = new User { Username = @"Autoplay" } };
|
||||
Replay = new Replay();
|
||||
}
|
||||
|
||||
protected Replay Replay;
|
||||
|
@ -8,7 +8,6 @@ using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Replays
|
||||
{
|
||||
@ -23,7 +22,7 @@ namespace osu.Game.Rulesets.Mania.Replays
|
||||
public ManiaAutoGenerator(ManiaBeatmap beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
Replay = new Replay { User = new User { Username = @"Autoplay" } };
|
||||
Replay = new Replay();
|
||||
|
||||
columnActions = new ManiaAction[Beatmap.TotalColumns];
|
||||
|
||||
|
@ -8,6 +8,7 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Replays;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
@ -17,6 +18,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
protected override Score CreateReplayScore(Beatmap<OsuHitObject> beatmap) => new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
||||
Replay = new OsuAutoGenerator(beatmap).Generate()
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ using System.Collections.Generic;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Replays
|
||||
{
|
||||
@ -38,13 +37,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
||||
protected OsuAutoGeneratorBase(Beatmap<OsuHitObject> beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
Replay = new Replay
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
Username = @"Autoplay",
|
||||
}
|
||||
};
|
||||
Replay = new Replay();
|
||||
|
||||
// We are using ApplyModsToRate and not ApplyModsToTime to counteract the speed up / slow down from HalfTime / DoubleTime so that we remain at a constant framerate of 60 fps.
|
||||
FrameDelay = ApplyModsToRate(1000.0 / 60.0);
|
||||
|
@ -9,7 +9,6 @@ using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Replays
|
||||
{
|
||||
@ -20,13 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
||||
public TaikoAutoGenerator(Beatmap<TaikoHitObject> beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
Replay = new Replay
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
Username = @"Autoplay",
|
||||
}
|
||||
};
|
||||
Replay = new Replay();
|
||||
}
|
||||
|
||||
protected Replay Replay;
|
||||
|
@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -19,13 +20,10 @@ namespace osu.Game.Tests.Visual
|
||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
||||
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(Beatmap.Value);
|
||||
|
||||
// We have the replay
|
||||
var replay = dummyRulesetContainer.Replay;
|
||||
|
||||
// Reset the mods
|
||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Where(m => !(m is ModAutoplay));
|
||||
|
||||
return new ReplayPlayer(replay);
|
||||
return new ReplayPlayer(new Score { Replay = dummyRulesetContainer.Replay });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ namespace osu.Game
|
||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||
Beatmap.Value.Mods.Value = score.Mods;
|
||||
|
||||
menu.Push(new PlayerLoader(new ReplayPlayer(score.Replay)));
|
||||
menu.Push(new PlayerLoader(new ReplayPlayer(score)));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -3,13 +3,11 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Replays
|
||||
{
|
||||
public class Replay
|
||||
{
|
||||
public User User;
|
||||
public List<ReplayFrame> Frames = new List<ReplayFrame>();
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
currentBeatmap = workingBeatmap.Beatmap;
|
||||
score.ScoreInfo.Beatmap = currentBeatmap.BeatmapInfo;
|
||||
|
||||
score.ScoreInfo.User = score.Replay.User = new User { Username = sr.ReadString() };
|
||||
score.ScoreInfo.User = new User { Username = sr.ReadString() };
|
||||
|
||||
// MD5Hash
|
||||
sr.ReadString();
|
||||
|
@ -273,20 +273,27 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (!IsCurrentScreen) return;
|
||||
|
||||
var score = new ScoreInfo
|
||||
{
|
||||
Beatmap = Beatmap.Value.BeatmapInfo,
|
||||
Ruleset = ruleset
|
||||
};
|
||||
ScoreProcessor.PopulateScore(score);
|
||||
score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value;
|
||||
Push(new Results(score));
|
||||
Push(new Results(CreateScoreInfo()));
|
||||
|
||||
onCompletionEvent = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual ScoreInfo CreateScoreInfo()
|
||||
{
|
||||
var score = new ScoreInfo
|
||||
{
|
||||
BeatmapInfo = Beatmap.Value.BeatmapInfo,
|
||||
Ruleset = ruleset,
|
||||
User = api.LocalUser.Value
|
||||
};
|
||||
|
||||
ScoreProcessor.PopulateScore(score);
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
private bool onFail()
|
||||
{
|
||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
||||
|
@ -1,23 +1,25 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class ReplayPlayer : Player
|
||||
{
|
||||
public Replay Replay;
|
||||
private readonly Score score;
|
||||
|
||||
public ReplayPlayer(Replay replay)
|
||||
public ReplayPlayer(Score score)
|
||||
{
|
||||
Replay = replay;
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
RulesetContainer.SetReplay(Replay);
|
||||
RulesetContainer.SetReplay(score.Replay);
|
||||
}
|
||||
|
||||
protected override ScoreInfo CreateScoreInfo() => score.ScoreInfo;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user