New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to create new difficulties from within the editor #16754
Changes from 16 commits
e2fcdc3
3386f03
b613aed
dc96c48
0d51c01
54bb6ad
87e2e83
4f1aac9
afc48d8
47429fb
a8ffc4f
b94fe84
ad47649
bef0a2d
b7d7e66
6dc0f3f
ee1feae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
using osu.Framework.Testing; | ||
using osu.Game.Models; | ||
using osu.Game.Users; | ||
using osu.Game.Utils; | ||
using Realms; | ||
|
||
#nullable enable | ||
|
@@ -16,7 +17,7 @@ namespace osu.Game.Beatmaps | |
[ExcludeFromDynamicCompile] | ||
[Serializable] | ||
[MapTo("BeatmapMetadata")] | ||
public class BeatmapMetadata : RealmObject, IBeatmapMetadataInfo | ||
public class BeatmapMetadata : RealmObject, IBeatmapMetadataInfo, IDeepCloneable<BeatmapMetadata> | ||
{ | ||
public string Title { get; set; } = string.Empty; | ||
|
||
|
@@ -57,5 +58,18 @@ private BeatmapMetadata() | |
IUser IBeatmapMetadataInfo.Author => Author; | ||
|
||
public override string ToString() => this.GetDisplayTitle(); | ||
|
||
public BeatmapMetadata DeepClone() => new BeatmapMetadata(Author.DeepClone()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not confident on us implementing these manually all over the place. One of the things I wanted to look at is replacing That said, I think this is fine for the time being to get things working. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the fact that I've messed up writing these clones no less than twice in this pull alone, you won't hear me protest against using automapper for these for sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to confirm, the clones are to avoid reference issues at the detached side correct? And have nothing to do with realm. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The metadata clone was originally to ensure 1:1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's not required I'd argue we omit it to keep things as simple as possible... not sure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll also note that the metadata directly associated with the I'll try removing but I feel somewhat safer with it. |
||
{ | ||
Title = Title, | ||
TitleUnicode = TitleUnicode, | ||
Artist = Artist, | ||
ArtistUnicode = ArtistUnicode, | ||
Source = Source, | ||
Tags = Tags, | ||
PreviewTime = PreviewTime, | ||
AudioFile = AudioFile, | ||
BackgroundFile = BackgroundFile | ||
}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case states that creating a new beatmap fails with blank difficulty name, but I think this is missing an
Editor.Save()
step here to confirm that it would fail? (or was the test case intended to ensureCreateNewDifficulty
doesn't affect the databased beatmap set whenSave
is not performed?)