Take user argument in CreateNew method parameters

This commit is contained in:
Dean Herbert 2020-09-04 13:17:43 +09:00
parent d3fbc7cc53
commit fba253f131
3 changed files with 6 additions and 6 deletions

View File

@ -18,6 +18,7 @@
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Resources;
using osu.Game.Users;
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
using SharpCompress.Common;
@ -767,7 +768,7 @@ public void TestCreateNewEmptyBeatmap()
var osu = loadOsu(host);
var manager = osu.Dependencies.Get<BeatmapManager>();
var working = manager.CreateNew(new OsuRuleset().RulesetInfo);
var working = manager.CreateNew(new OsuRuleset().RulesetInfo, User.SYSTEM_USER);
manager.Save(working.BeatmapInfo, working.Beatmap);
@ -794,7 +795,7 @@ public void TestCreateNewBeatmapWithObject()
var osu = loadOsu(host);
var manager = osu.Dependencies.Get<BeatmapManager>();
var working = manager.CreateNew(new OsuRuleset().RulesetInfo);
var working = manager.CreateNew(new OsuRuleset().RulesetInfo, User.SYSTEM_USER);
((Beatmap)working.Beatmap).HitObjects.Add(new HitCircle { StartTime = 5000 });

View File

@ -95,13 +95,13 @@ protected override ArchiveDownloadRequest<BeatmapSetInfo> CreateDownloadRequest(
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osz";
public WorkingBeatmap CreateNew(RulesetInfo ruleset)
public WorkingBeatmap CreateNew(RulesetInfo ruleset, User user)
{
var metadata = new BeatmapMetadata
{
Artist = "artist",
Title = "title",
Author = User.SYSTEM_USER,
Author = user,
};
var set = new BeatmapSetInfo

View File

@ -98,8 +98,7 @@ private void load(OsuColour colours, GameHost host)
if (Beatmap.Value is DummyWorkingBeatmap)
{
isNewBeatmap = true;
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value);
Beatmap.Value.BeatmapSetInfo.Metadata.Author = api.LocalUser.Value;
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
}
try