mirror of
https://github.com/osukey/osukey.git
synced 2025-06-28 22:58:10 +09:00
Fix cases of dynamically assigning Beatmap
s to BeatmapSetInfo
using list assignment
This commit is contained in:
parent
49c2cb9125
commit
8c60f37508
@ -584,7 +584,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
OnlineID = 1,
|
OnlineID = 1,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -143,8 +143,11 @@ namespace osu.Game.Tests.Online
|
|||||||
var beatmap = decoder.Decode(reader);
|
var beatmap = decoder.Decode(reader);
|
||||||
|
|
||||||
info = beatmap.BeatmapInfo;
|
info = beatmap.BeatmapInfo;
|
||||||
info.BeatmapSet.Beatmaps = new List<BeatmapInfo> { info };
|
info.Metadata = info.Metadata;
|
||||||
info.BeatmapSet.Metadata = info.Metadata;
|
|
||||||
|
Debug.Assert(info.BeatmapSet != null);
|
||||||
|
|
||||||
|
info.BeatmapSet.Beatmaps.Add(info);
|
||||||
info.MD5Hash = stream.ComputeMD5Hash();
|
info.MD5Hash = stream.ComputeMD5Hash();
|
||||||
info.Hash = stream.ComputeSHA2Hash();
|
info.Hash = stream.ComputeSHA2Hash();
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
// ensure we have at least two beatmaps available to identify the direction the music controller navigated to.
|
||||||
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(new BeatmapSetInfo
|
AddRepeatStep("import beatmap", () => Game.BeatmapManager.Import(new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -47,6 +47,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
beatmaps = new List<BeatmapInfo>();
|
beatmaps = new List<BeatmapInfo>();
|
||||||
|
|
||||||
|
var beatmapSetInfo = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineID = 10,
|
||||||
|
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
||||||
|
DateAdded = DateTimeOffset.UtcNow
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
int beatmapId = 10 * 10 + i;
|
int beatmapId = 10 * 10 + i;
|
||||||
@ -54,29 +61,28 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
int length = RNG.Next(30000, 200000);
|
int length = RNG.Next(30000, 200000);
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
double bpm = RNG.NextSingle(80, 200);
|
||||||
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "Some Artist",
|
||||||
|
Title = "Some Beatmap",
|
||||||
|
AuthorString = "Some Author"
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmap = new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = rulesets.GetRuleset(i % 4),
|
Ruleset = rulesets.GetRuleset(i % 4),
|
||||||
OnlineID = beatmapId,
|
OnlineID = beatmapId,
|
||||||
Length = length,
|
Length = length,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty()
|
BaseDifficulty = new BeatmapDifficulty()
|
||||||
});
|
};
|
||||||
|
|
||||||
|
beatmaps.Add(beatmap);
|
||||||
|
beatmapSetInfo.Beatmaps.Add(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.Import(new BeatmapSetInfo
|
manager.Import(beatmapSetInfo).Wait();
|
||||||
{
|
|
||||||
OnlineID = 10,
|
|
||||||
Hash = Guid.NewGuid().ToString().ComputeMD5Hash(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Artist = "Some Artist",
|
|
||||||
Title = "Some Beatmap",
|
|
||||||
AuthorString = "Some Author"
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
DateAdded = DateTimeOffset.UtcNow
|
|
||||||
}).Wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -42,7 +41,20 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
Dependencies.Cache(rulesets = new RulesetStore(ContextFactory));
|
||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default));
|
||||||
|
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = "Some Artist " + RNG.Next(0, 9),
|
||||||
|
Title = "Some Song (set id 10)",
|
||||||
|
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineID = 10,
|
||||||
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
|
DateAdded = DateTimeOffset.UtcNow,
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
@ -51,12 +63,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
int length = RNG.Next(30000, 200000);
|
int length = RNG.Next(30000, 200000);
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
double bpm = RNG.NextSingle(80, 200);
|
||||||
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
beatmapSet.Beatmaps.Add(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
OnlineID = beatmapId,
|
OnlineID = beatmapId,
|
||||||
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
||||||
Length = length,
|
Length = length,
|
||||||
|
Metadata = metadata,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
@ -65,20 +78,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.Import(new BeatmapSetInfo
|
manager.Import(beatmapSet).Wait();
|
||||||
{
|
|
||||||
OnlineID = 10,
|
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = "Some Artist " + RNG.Next(0, 9),
|
|
||||||
Title = $"Some Song (set id 10), max bpm {beatmaps.Max(b => b.BPM):0.#})",
|
|
||||||
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
DateAdded = DateTimeOffset.UtcNow,
|
|
||||||
}).Wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -110,7 +109,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineID = i,
|
OnlineID = i,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -41,7 +40,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineID = 1,
|
OnlineID = 1,
|
||||||
Metadata = metadata,
|
Metadata = metadata,
|
||||||
Beatmaps = new List<BeatmapInfo>
|
Beatmaps =
|
||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
|
@ -836,23 +836,27 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private BeatmapSetInfo createTestBeatmapSet(int id, bool randomDifficultyCount = false)
|
private BeatmapSetInfo createTestBeatmapSet(int id, bool randomDifficultyCount = false)
|
||||||
{
|
{
|
||||||
return new BeatmapSetInfo
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
||||||
|
Title = $"test set #{id}!",
|
||||||
|
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
||||||
|
};
|
||||||
|
|
||||||
|
var beatmapSet = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
ID = id,
|
|
||||||
OnlineID = id,
|
OnlineID = id,
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
|
||||||
Title = $"test set #{id}!",
|
|
||||||
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
|
||||||
},
|
|
||||||
Beatmaps = getBeatmaps(randomDifficultyCount ? RNG.Next(1, 20) : 3).ToList()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
foreach (var b in getBeatmaps(randomDifficultyCount ? RNG.Next(1, 20) : 3, metadata))
|
||||||
|
beatmapSet.Beatmaps.Add(b);
|
||||||
|
|
||||||
|
return beatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<BeatmapInfo> getBeatmaps(int count)
|
private IEnumerable<BeatmapInfo> getBeatmaps(int count, BeatmapMetadata metadata)
|
||||||
{
|
{
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
||||||
@ -872,6 +876,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
DifficultyName = version,
|
DifficultyName = version,
|
||||||
StarRating = diff,
|
StarRating = diff,
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
OverallDifficulty = diff,
|
OverallDifficulty = diff,
|
||||||
@ -882,19 +887,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private BeatmapSetInfo createTestBeatmapSetWithManyDifficulties(int id)
|
private BeatmapSetInfo createTestBeatmapSetWithManyDifficulties(int id)
|
||||||
{
|
{
|
||||||
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
||||||
|
Title = $"test set #{id}!",
|
||||||
|
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
||||||
|
};
|
||||||
|
|
||||||
var toReturn = new BeatmapSetInfo
|
var toReturn = new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
ID = id,
|
|
||||||
OnlineID = id,
|
OnlineID = id,
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = $"peppy{id.ToString().PadLeft(6, '0')}",
|
|
||||||
Title = $"test set #{id}!",
|
|
||||||
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
|
||||||
},
|
|
||||||
Beatmaps = new List<BeatmapInfo>(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int b = 1; b < 101; b++)
|
for (int b = 1; b < 101; b++)
|
||||||
@ -902,10 +906,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
toReturn.Beatmaps.Add(new BeatmapInfo
|
toReturn.Beatmaps.Add(new BeatmapInfo
|
||||||
{
|
{
|
||||||
OnlineID = b * 10,
|
OnlineID = b * 10,
|
||||||
Path = $"extra{b}.osu",
|
|
||||||
DifficultyName = $"Extra {b}",
|
DifficultyName = $"Extra {b}",
|
||||||
Ruleset = rulesets.GetRuleset((b - 1) % 4),
|
Ruleset = rulesets.GetRuleset((b - 1) % 4),
|
||||||
StarRating = 2,
|
StarRating = 2,
|
||||||
|
Metadata = metadata,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
OverallDifficulty = 3.5f,
|
OverallDifficulty = 3.5f,
|
||||||
|
@ -182,18 +182,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineID = importID,
|
OnlineID = importID,
|
||||||
Metadata = metadata,
|
|
||||||
Beatmaps = difficultyRulesets.Select((ruleset, difficultyIndex) => new BeatmapInfo
|
|
||||||
{
|
|
||||||
OnlineID = importID * 1024 + difficultyIndex,
|
|
||||||
Metadata = metadata,
|
|
||||||
BaseDifficulty = new BeatmapDifficulty(),
|
|
||||||
Ruleset = ruleset,
|
|
||||||
StarRating = difficultyIndex + 1,
|
|
||||||
DifficultyName = $"SR{difficultyIndex + 1}"
|
|
||||||
}).ToList()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beatmapSet.Beatmaps.AddRange(difficultyRulesets.Select((ruleset, difficultyIndex) => new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineID = importID * 1024 + difficultyIndex,
|
||||||
|
Metadata = metadata,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty(),
|
||||||
|
Ruleset = ruleset,
|
||||||
|
StarRating = difficultyIndex + 1,
|
||||||
|
DifficultyName = $"SR{difficultyIndex + 1}"
|
||||||
|
}));
|
||||||
|
|
||||||
return Game.BeatmapManager.Import(beatmapSet).Result.Value;
|
return Game.BeatmapManager.Import(beatmapSet).Result.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,7 +907,20 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
int setId = getImportId();
|
int setId = getImportId();
|
||||||
|
|
||||||
var beatmaps = new List<BeatmapInfo>();
|
var beatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineID = setId,
|
||||||
|
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
||||||
|
DateAdded = DateTimeOffset.UtcNow,
|
||||||
|
};
|
||||||
|
|
||||||
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
// Create random metadata, then we can check if sorting works based on these
|
||||||
|
Artist = "Some Artist " + RNG.Next(0, 9),
|
||||||
|
Title = $"Some Song (set id {setId})",
|
||||||
|
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
||||||
|
};
|
||||||
|
|
||||||
for (int i = 0; i < countPerRuleset; i++)
|
for (int i = 0; i < countPerRuleset; i++)
|
||||||
{
|
{
|
||||||
@ -916,12 +929,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
int length = RNG.Next(30000, 200000);
|
int length = RNG.Next(30000, 200000);
|
||||||
double bpm = RNG.NextSingle(80, 200);
|
double bpm = RNG.NextSingle(80, 200);
|
||||||
|
|
||||||
beatmaps.Add(new BeatmapInfo
|
beatmapSet.Beatmaps.Add(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = getRuleset(),
|
Ruleset = getRuleset(),
|
||||||
OnlineID = beatmapId,
|
OnlineID = beatmapId,
|
||||||
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
DifficultyName = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
|
||||||
Length = length,
|
Length = length,
|
||||||
|
Metadata = metadata,
|
||||||
BPM = bpm,
|
BPM = bpm,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
@ -930,20 +944,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BeatmapSetInfo
|
return beatmapSet;
|
||||||
{
|
|
||||||
OnlineID = setId,
|
|
||||||
Hash = new MemoryStream(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())).ComputeMD5Hash(),
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
// Create random metadata, then we can check if sorting works based on these
|
|
||||||
Artist = "Some Artist " + RNG.Next(0, 9),
|
|
||||||
Title = $"Some Song (set id {setId}, max bpm {beatmaps.Max(b => b.BPM):0.#})",
|
|
||||||
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
|
||||||
},
|
|
||||||
Beatmaps = beatmaps,
|
|
||||||
DateAdded = DateTimeOffset.UtcNow,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Beatmaps
|
|||||||
protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
protected override async Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (archive != null)
|
if (archive != null)
|
||||||
beatmapSet.Beatmaps = createBeatmapDifficulties(beatmapSet.Files);
|
beatmapSet.Beatmaps.AddRange(createBeatmapDifficulties(beatmapSet.Files));
|
||||||
|
|
||||||
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -33,12 +33,16 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
|
|
||||||
BeatmapInfo.Ruleset = ruleset;
|
BeatmapInfo.Ruleset = ruleset;
|
||||||
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
||||||
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
BeatmapInfo.Metadata = BeatmapInfo.Metadata;
|
||||||
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
|
|
||||||
BeatmapInfo.BeatmapSet.OnlineID = Interlocked.Increment(ref onlineSetID);
|
|
||||||
BeatmapInfo.Length = 75000;
|
BeatmapInfo.Length = 75000;
|
||||||
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
BeatmapInfo.OnlineInfo = new APIBeatmap();
|
||||||
BeatmapInfo.OnlineID = Interlocked.Increment(ref onlineBeatmapID);
|
BeatmapInfo.OnlineID = Interlocked.Increment(ref onlineBeatmapID);
|
||||||
|
|
||||||
|
Debug.Assert(BeatmapInfo.BeatmapSet != null);
|
||||||
|
|
||||||
|
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
||||||
|
BeatmapInfo.BeatmapSet.Beatmaps.Add(BeatmapInfo);
|
||||||
|
BeatmapInfo.BeatmapSet.OnlineID = Interlocked.Increment(ref onlineSetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Beatmap CreateBeatmap() => createTestBeatmap();
|
protected virtual Beatmap CreateBeatmap() => createTestBeatmap();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -220,6 +221,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
var beatmap = CreateBeatmap(ruleset ?? Ruleset.Value).BeatmapInfo;
|
var beatmap = CreateBeatmap(ruleset ?? Ruleset.Value).BeatmapInfo;
|
||||||
|
|
||||||
|
Debug.Assert(beatmap.BeatmapSet != null);
|
||||||
|
|
||||||
return new APIBeatmapSet
|
return new APIBeatmapSet
|
||||||
{
|
{
|
||||||
OnlineID = ((IBeatmapSetInfo)beatmap.BeatmapSet).OnlineID,
|
OnlineID = ((IBeatmapSetInfo)beatmap.BeatmapSet).OnlineID,
|
||||||
@ -230,13 +233,17 @@ namespace osu.Game.Tests.Visual
|
|||||||
Card = "https://assets.ppy.sh/beatmaps/163112/covers/card.jpg",
|
Card = "https://assets.ppy.sh/beatmaps/163112/covers/card.jpg",
|
||||||
List = "https://assets.ppy.sh/beatmaps/163112/covers/list.jpg"
|
List = "https://assets.ppy.sh/beatmaps/163112/covers/list.jpg"
|
||||||
},
|
},
|
||||||
Title = beatmap.BeatmapSet.Metadata.Title,
|
Title = beatmap.Metadata.Title,
|
||||||
TitleUnicode = beatmap.BeatmapSet.Metadata.TitleUnicode,
|
TitleUnicode = beatmap.Metadata.TitleUnicode,
|
||||||
Artist = beatmap.BeatmapSet.Metadata.Artist,
|
Artist = beatmap.Metadata.Artist,
|
||||||
ArtistUnicode = beatmap.BeatmapSet.Metadata.ArtistUnicode,
|
ArtistUnicode = beatmap.Metadata.ArtistUnicode,
|
||||||
Author = beatmap.BeatmapSet.Metadata.Author,
|
Author = new APIUser
|
||||||
Source = beatmap.BeatmapSet.Metadata.Source,
|
{
|
||||||
Tags = beatmap.BeatmapSet.Metadata.Tags,
|
Username = beatmap.Metadata.Author.Username,
|
||||||
|
Id = beatmap.Metadata.Author.OnlineID
|
||||||
|
},
|
||||||
|
Source = beatmap.Metadata.Source,
|
||||||
|
Tags = beatmap.Metadata.Tags,
|
||||||
Beatmaps = new[]
|
Beatmaps = new[]
|
||||||
{
|
{
|
||||||
new APIBeatmap
|
new APIBeatmap
|
||||||
|
Loading…
x
Reference in New Issue
Block a user