mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Merge pull request #15779 from peppy/remaining-misc-fixes
Apply some various code quality fixes that don't fit elsewhere
This commit is contained in:
commit
5ff62a8e04
@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Database;
|
||||
@ -104,28 +103,6 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public int CountdownOffset { get; set; }
|
||||
|
||||
// Editor
|
||||
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
|
||||
[JsonIgnore]
|
||||
public string StoredBookmarks
|
||||
{
|
||||
get => string.Join(',', Bookmarks);
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
Bookmarks = Array.Empty<int>();
|
||||
return;
|
||||
}
|
||||
|
||||
Bookmarks = value.Split(',').Select(v =>
|
||||
{
|
||||
bool result = int.TryParse(v, out int val);
|
||||
return new { result, val };
|
||||
}).Where(p => p.result).Select(p => p.val).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public int[] Bookmarks { get; set; } = Array.Empty<int>();
|
||||
|
||||
|
@ -10,7 +10,6 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Mixing;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Platform;
|
||||
@ -40,7 +39,7 @@ namespace osu.Game.Beatmaps
|
||||
private readonly WorkingBeatmapCache workingBeatmapCache;
|
||||
private readonly BeatmapOnlineLookupQueue onlineBeatmapLookupQueue;
|
||||
|
||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false, AudioMixer mainTrackMixer = null)
|
||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost host = null, WorkingBeatmap defaultBeatmap = null, bool performOnlineLookups = false)
|
||||
{
|
||||
var userResources = new FileStore(contextFactory, storage).Store;
|
||||
|
||||
|
@ -201,7 +201,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
switch (pair.Key)
|
||||
{
|
||||
case @"Bookmarks":
|
||||
beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
||||
beatmap.BeatmapInfo.Bookmarks = pair.Value.Split(',').Select(v =>
|
||||
{
|
||||
bool result = int.TryParse(v, out int val);
|
||||
return new { result, val };
|
||||
}).Where(p => p.result).Select(p => p.val).ToArray();
|
||||
break;
|
||||
|
||||
case @"DistanceSpacing":
|
||||
|
@ -15,7 +15,6 @@ using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Screens.Ranking;
|
||||
@ -39,10 +38,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
private readonly BeatmapInfo beatmapInfo = new BeatmapInfo
|
||||
{
|
||||
BeatmapSet = new BeatmapSetInfo(),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Author = APIUser.SYSTEM_USER
|
||||
}
|
||||
Metadata = new BeatmapMetadata(),
|
||||
};
|
||||
|
||||
private readonly TestResourceStore userSkinResourceStore = new TestResourceStore();
|
||||
|
Loading…
Reference in New Issue
Block a user