mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:33:21 +08:00
Move bookmark parsing logic into LegacyBeatmapDecoder
This commit is contained in:
parent
9c61ec217b
commit
3e0e01abdb
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -104,28 +103,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int CountdownOffset { get; set; }
|
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]
|
[NotMapped]
|
||||||
public int[] Bookmarks { get; set; } = Array.Empty<int>();
|
public int[] Bookmarks { get; set; } = Array.Empty<int>();
|
||||||
|
|
||||||
|
@ -201,7 +201,11 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"Bookmarks":
|
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;
|
break;
|
||||||
|
|
||||||
case @"DistanceSpacing":
|
case @"DistanceSpacing":
|
||||||
|
Loading…
Reference in New Issue
Block a user