1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Fix beatmap author being stored in two different places

This commit is contained in:
Dean Herbert 2017-10-13 20:25:27 +09:00
parent b82f3fc710
commit cd722e4abb
18 changed files with 48 additions and 47 deletions

View File

@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
{
Artist = @"Unknown",
Title = @"Sample Beatmap",
Author = @"peppy",
AuthorString = @"peppy",
},
},
ControlPointInfo = controlPointInfo

View File

@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps
{
Artist = @"Unknown",
Title = @"Unknown",
Author = @"Unknown Creator",
AuthorString = @"Unknown Creator",
},
Version = @"Normal",
Difficulty = new BeatmapDifficulty()

View File

@ -3,6 +3,7 @@
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Users;
using SQLite.Net.Attributes;
namespace osu.Game.Beatmaps
@ -19,8 +20,20 @@ namespace osu.Game.Beatmaps
public string Artist { get; set; }
public string ArtistUnicode { get; set; }
/// <summary>
/// Helper property to deserialize a username to <see cref="User"/>.
/// </summary>
[JsonProperty(@"creator")]
public string Author { get; set; }
[Column("Author")]
public string AuthorString
{
set { Author = new User { Username = value }; }
}
/// <summary>
/// The author of the beatmaps in this set.
/// </summary>
public User Author;
public string Source { get; set; }
@ -32,7 +45,7 @@ namespace osu.Game.Beatmaps
public string[] SearchableTerms => new[]
{
Author,
Author?.Username,
Artist,
ArtistUnicode,
Title,

View File

@ -3,7 +3,6 @@
using System;
using Newtonsoft.Json;
using osu.Game.Users;
namespace osu.Game.Beatmaps
{
@ -12,11 +11,6 @@ namespace osu.Game.Beatmaps
/// </summary>
public class BeatmapSetOnlineInfo
{
/// <summary>
/// The author of the beatmaps in this set.
/// </summary>
public User Author;
/// <summary>
/// The date this beatmap set was submitted to the online listing.
/// </summary>

View File

@ -22,7 +22,7 @@ namespace osu.Game.Beatmaps
{
Artist = "please load a beatmap!",
Title = "no beatmaps available!",
Author = "no one",
AuthorString = "no one",
},
BeatmapSet = new BeatmapSetInfo(),
Difficulty = new BeatmapDifficulty

View File

@ -171,7 +171,7 @@ namespace osu.Game.Beatmaps.Formats
metadata.ArtistUnicode = pair.Value;
break;
case @"Creator":
metadata.Author = pair.Value;
metadata.AuthorString = pair.Value;
break;
case @"Version":
beatmap.BeatmapInfo.Version = pair.Value;

View File

@ -6,7 +6,6 @@ using System.Linq;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Online.API.Requests
{
@ -27,11 +26,10 @@ namespace osu.Game.Online.API.Requests
[JsonProperty(@"id")]
private int onlineId { get; set; }
[JsonProperty(@"creator")]
private string creatorUsername { get; set; }
[JsonProperty(@"user_id")]
private long creatorId = 1;
private long creatorId {
set { Author.Id = value; }
}
[JsonProperty(@"beatmaps")]
private IEnumerable<GetBeatmapSetsBeatmapResponse> beatmaps { get; set; }
@ -44,11 +42,6 @@ namespace osu.Game.Online.API.Requests
Metadata = this,
OnlineInfo = new BeatmapSetOnlineInfo
{
Author = new User
{
Id = creatorId,
Username = creatorUsername,
},
Covers = covers,
Preview = preview,
PlayCount = playCount,

View File

@ -36,12 +36,12 @@ namespace osu.Game.Overlays.BeatmapSet
var i = BeatmapSet.OnlineInfo;
avatar.User = i.Author;
avatar.User = BeatmapSet.Metadata.Author;
clickableArea.Action = () => profile?.ShowUser(avatar.User);
fields.Children = new Drawable[]
{
new Field("made by", i.Author.Username, @"Exo2.0-RegularItalic"),
new Field("made by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"),
new Field("submitted on", i.Submitted.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold")
{
Margin = new MarginPadding { Top = 5 },

View File

@ -130,7 +130,7 @@ namespace osu.Game.Overlays.Direct
},
new OsuSpriteText
{
Text = SetInfo.Metadata.Author,
Text = SetInfo.Metadata.Author.Username,
TextSize = 14,
Font = @"Exo2.0-SemiBoldItalic",
Shadow = false,

View File

@ -128,7 +128,7 @@ namespace osu.Game.Overlays.Direct
},
new OsuSpriteText
{
Text = SetInfo.Metadata.Author,
Text = SetInfo.Metadata.Author.Username,
TextSize = 14,
Font = @"Exo2.0-SemiBoldItalic",
},

View File

@ -248,7 +248,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
new MetadataLine("Mapper", metadata.Author)
new MetadataLine("Mapper", metadata.Author.Username)
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,

View File

@ -210,7 +210,7 @@ namespace osu.Game.Screens.Select
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = metadata.Author,
Text = metadata.Author.Username,
TextSize = 15,
},
}

View File

@ -51,7 +51,7 @@ namespace osu.Game.Screens.Select
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Author:
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author.Username, y.BeatmapSet.Metadata.Author.Username, StringComparison.InvariantCultureIgnoreCase));
break;
case SortMode.Difficulty:
groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));

View File

@ -39,6 +39,11 @@ namespace osu.Game.Tests.Visual
Artist = @"Kaneko Chiharu",
Source = @"SOUND VOLTEX III GRAVITY WARS",
Tags = @"sdvx grace the 5th kac original song contest konami bemani",
Author = new User
{
Username = @"Fresh Chicken",
Id = 3984370,
},
},
OnlineInfo = new BeatmapSetOnlineInfo
{
@ -48,11 +53,6 @@ namespace osu.Game.Tests.Visual
Submitted = new DateTime(2016, 2, 10),
Ranked = new DateTime(2016, 6, 19),
BPM = 236,
Author = new User
{
Username = @"Fresh Chicken",
Id = 3984370,
},
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
@ -213,6 +213,11 @@ namespace osu.Game.Tests.Visual
Title = @"Soumatou Labyrinth",
Artist = @"Yunomi with Momobako&miko",
Tags = @"mmbk.com yuzu__rinrin charlotte",
Author = new User
{
Username = @"komasy",
Id = 1980256,
},
},
OnlineInfo = new BeatmapSetOnlineInfo
{
@ -222,11 +227,6 @@ namespace osu.Game.Tests.Visual
Submitted = new DateTime(2016, 6, 11),
Ranked = new DateTime(2016, 7, 12),
BPM = 160,
Author = new User
{
Username = @"komasy",
Id = 1980256,
},
Covers = new BeatmapSetOnlineCovers
{
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual
{
Title = @"OrVid",
Artist = @"An",
Author = @"RLC",
AuthorString = @"RLC",
Source = @"",
Tags = @"acuticnotes an-fillnote revid tear tearvid encrpted encryption axi axivid quad her hervid recoll",
},
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual
{
Title = @"tiny lamp",
Artist = @"fhana",
Author = @"Sotarks",
AuthorString = @"Sotarks",
Source = @"ぎんぎつね",
Tags = @"lantis junichi sato yuxuki waga kevin mitsunaga towana gingitsune opening op full ver version kalibe collab collaboration",
},
@ -110,7 +110,7 @@ namespace osu.Game.Tests.Visual
{
Title = @"At Gwanghwamun",
Artist = @"KYUHYUN",
Author = @"Cerulean Veyron",
AuthorString = @"Cerulean Veyron",
Source = @"",
Tags = @"soul ballad kh super junior sj suju 슈퍼주니어 kt뮤직 sm엔터테인먼트 s.m.entertainment kt music 1st mini album ep",
},
@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual
{
Title = @"RHAPSODY OF BLUE SKY",
Artist = @"fhana",
Author = @"[Kamiya]",
AuthorString = @"[Kamiya]",
Source = @"小林さんちのメイドラゴン",
Tags = @"kobayashi san chi no maidragon aozora no opening anime maid dragon oblivion karen dynamix imoutosan pata-mon gxytcgxytc",
},

View File

@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual
// Create random metadata, then we can check if sorting works based on these
Artist = "MONACA " + RNG.Next(0, 9),
Title = "Black Song " + RNG.Next(0, 9),
Author = "Some Guy " + RNG.Next(0, 9),
AuthorString = "Some Guy " + RNG.Next(0, 9),
},
Beatmaps = new List<BeatmapInfo>(new[]
{

View File

@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual
{
Title = @"Platina",
Artist = @"Maaya Sakamoto",
Author = @"uwutm8",
AuthorString = @"uwutm8",
},
BeatmapSet = new BeatmapSetInfo
{
@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual
{
Title = @"FREEDOM DIVE",
Artist = @"xi",
Author = @"Nakagawa-Kanon",
AuthorString = @"Nakagawa-Kanon",
},
BeatmapSet = new BeatmapSetInfo
{

View File

@ -645,6 +645,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-frame
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=NAMESPACE_005FALIAS/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>