1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 01:32:55 +08:00

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.IO;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Resources; using osu.Game.Tests.Resources;
using osu.Game.Users;
using SharpCompress.Archives; using SharpCompress.Archives;
using SharpCompress.Archives.Zip; using SharpCompress.Archives.Zip;
using SharpCompress.Common; using SharpCompress.Common;
@ -767,7 +768,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var osu = loadOsu(host); var osu = loadOsu(host);
var manager = osu.Dependencies.Get<BeatmapManager>(); 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); manager.Save(working.BeatmapInfo, working.Beatmap);
@ -794,7 +795,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var osu = loadOsu(host); var osu = loadOsu(host);
var manager = osu.Dependencies.Get<BeatmapManager>(); 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 }); ((Beatmap)working.Beatmap).HitObjects.Add(new HitCircle { StartTime = 5000 });

View File

@ -95,13 +95,13 @@ namespace osu.Game.Beatmaps
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osz"; 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 var metadata = new BeatmapMetadata
{ {
Artist = "artist", Artist = "artist",
Title = "title", Title = "title",
Author = User.SYSTEM_USER, Author = user,
}; };
var set = new BeatmapSetInfo var set = new BeatmapSetInfo

View File

@ -98,8 +98,7 @@ namespace osu.Game.Screens.Edit
if (Beatmap.Value is DummyWorkingBeatmap) if (Beatmap.Value is DummyWorkingBeatmap)
{ {
isNewBeatmap = true; isNewBeatmap = true;
Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value); Beatmap.Value = beatmapManager.CreateNew(Ruleset.Value, api.LocalUser.Value);
Beatmap.Value.BeatmapSetInfo.Metadata.Author = api.LocalUser.Value;
} }
try try