mirror of
https://github.com/osukey/osukey.git
synced 2025-06-22 19:57:56 +09:00
Add required properties to make realm models backwards compatible
This commit is contained in:
parent
618903c217
commit
c3df58e01c
@ -12,6 +12,11 @@ namespace osu.Game.Beatmaps
|
|||||||
[MapTo("BeatmapDifficulty")]
|
[MapTo("BeatmapDifficulty")]
|
||||||
public class BeatmapDifficulty : EmbeddedObject, IBeatmapDifficultyInfo
|
public class BeatmapDifficulty : EmbeddedObject, IBeatmapDifficultyInfo
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
|
||||||
|
/// </summary>
|
||||||
|
public const float DEFAULT_DIFFICULTY = 5;
|
||||||
|
|
||||||
public float DrainRate { get; set; } = IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY;
|
public float DrainRate { get; set; } = IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY;
|
||||||
public float CircleSize { get; set; } = IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY;
|
public float CircleSize { get; set; } = IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY;
|
||||||
public float OverallDifficulty { get; set; } = IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY;
|
public float OverallDifficulty { get; set; } = IBeatmapDifficultyInfo.DEFAULT_DIFFICULTY;
|
||||||
@ -20,6 +25,15 @@ namespace osu.Game.Beatmaps
|
|||||||
public double SliderMultiplier { get; set; } = 1;
|
public double SliderMultiplier { get; set; } = 1;
|
||||||
public double SliderTickRate { get; set; } = 1;
|
public double SliderTickRate { get; set; } = 1;
|
||||||
|
|
||||||
|
public BeatmapDifficulty()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapDifficulty(IBeatmapDifficultyInfo source)
|
||||||
|
{
|
||||||
|
CopyFrom(source);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a shallow-clone of this <see cref="BeatmapDifficulty"/>.
|
/// Returns a shallow-clone of this <see cref="BeatmapDifficulty"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -30,7 +44,7 @@ namespace osu.Game.Beatmaps
|
|||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CopyTo(BeatmapDifficulty difficulty)
|
public virtual void CopyTo(BeatmapDifficulty difficulty)
|
||||||
{
|
{
|
||||||
difficulty.ApproachRate = ApproachRate;
|
difficulty.ApproachRate = ApproachRate;
|
||||||
difficulty.DrainRate = DrainRate;
|
difficulty.DrainRate = DrainRate;
|
||||||
@ -40,5 +54,16 @@ namespace osu.Game.Beatmaps
|
|||||||
difficulty.SliderMultiplier = SliderMultiplier;
|
difficulty.SliderMultiplier = SliderMultiplier;
|
||||||
difficulty.SliderTickRate = SliderTickRate;
|
difficulty.SliderTickRate = SliderTickRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void CopyFrom(IBeatmapDifficultyInfo other)
|
||||||
|
{
|
||||||
|
ApproachRate = other.ApproachRate;
|
||||||
|
DrainRate = other.DrainRate;
|
||||||
|
CircleSize = other.CircleSize;
|
||||||
|
OverallDifficulty = other.OverallDifficulty;
|
||||||
|
|
||||||
|
SliderMultiplier = other.SliderMultiplier;
|
||||||
|
SliderTickRate = other.SliderTickRate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Models;
|
using osu.Game.Models;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using Realms;
|
using Realms;
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
private BeatmapInfo()
|
public BeatmapInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,13 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public double TimelineZoom { get; set; }
|
public double TimelineZoom { get; set; }
|
||||||
|
|
||||||
|
public CountdownType Countdown { get; set; } = CountdownType.Normal;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The number of beats to move the countdown backwards (compared to its default location).
|
||||||
|
/// </summary>
|
||||||
|
public int CountdownOffset { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool Equals(BeatmapInfo? other)
|
public bool Equals(BeatmapInfo? other)
|
||||||
@ -113,20 +121,53 @@ namespace osu.Game.Beatmaps
|
|||||||
public bool Equals(IBeatmapInfo? other) => other is BeatmapInfo b && Equals(b);
|
public bool Equals(IBeatmapInfo? other) => other is BeatmapInfo b && Equals(b);
|
||||||
|
|
||||||
public bool AudioEquals(BeatmapInfo? other) => other != null
|
public bool AudioEquals(BeatmapInfo? other) => other != null
|
||||||
&& BeatmapSet != null
|
&& BeatmapSet != null
|
||||||
&& other.BeatmapSet != null
|
&& other.BeatmapSet != null
|
||||||
&& BeatmapSet.Hash == other.BeatmapSet.Hash
|
&& BeatmapSet.Hash == other.BeatmapSet.Hash
|
||||||
&& Metadata.AudioFile == other.Metadata.AudioFile;
|
&& Metadata.AudioFile == other.Metadata.AudioFile;
|
||||||
|
|
||||||
public bool BackgroundEquals(BeatmapInfo? other) => other != null
|
public bool BackgroundEquals(BeatmapInfo? other) => other != null
|
||||||
&& BeatmapSet != null
|
&& BeatmapSet != null
|
||||||
&& other.BeatmapSet != null
|
&& other.BeatmapSet != null
|
||||||
&& BeatmapSet.Hash == other.BeatmapSet.Hash
|
&& BeatmapSet.Hash == other.BeatmapSet.Hash
|
||||||
&& Metadata.BackgroundFile == other.Metadata.BackgroundFile;
|
&& Metadata.BackgroundFile == other.Metadata.BackgroundFile;
|
||||||
|
|
||||||
IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata;
|
IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata;
|
||||||
IBeatmapSetInfo? IBeatmapInfo.BeatmapSet => BeatmapSet;
|
IBeatmapSetInfo? IBeatmapInfo.BeatmapSet => BeatmapSet;
|
||||||
IRulesetInfo IBeatmapInfo.Ruleset => Ruleset;
|
IRulesetInfo IBeatmapInfo.Ruleset => Ruleset;
|
||||||
IBeatmapDifficultyInfo IBeatmapInfo.Difficulty => Difficulty;
|
IBeatmapDifficultyInfo IBeatmapInfo.Difficulty => Difficulty;
|
||||||
|
|
||||||
|
#region Compatibility properties
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public int RulesetID => Ruleset.OnlineID;
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public Guid BeatmapSetInfoID => BeatmapSet?.ID ?? Guid.Empty;
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public BeatmapDifficulty BaseDifficulty
|
||||||
|
{
|
||||||
|
get => Difficulty;
|
||||||
|
set => Difficulty = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public string? Path => File?.Filename;
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public APIBeatmap? OnlineInfo { get; set; }
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public int? MaxCombo { get; set; }
|
||||||
|
|
||||||
|
[Ignored]
|
||||||
|
public int[] Bookmarks { get; set; } = Array.Empty<int>();
|
||||||
|
|
||||||
|
public int BeatmapVersion;
|
||||||
|
|
||||||
|
public BeatmapInfo Clone() => this.Detach();
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,5 +44,15 @@ namespace osu.Game.Beatmaps
|
|||||||
public string BackgroundFile { get; set; } = string.Empty;
|
public string BackgroundFile { get; set; } = string.Empty;
|
||||||
|
|
||||||
IUser IBeatmapMetadataInfo.Author => Author;
|
IUser IBeatmapMetadataInfo.Author => Author;
|
||||||
|
|
||||||
|
#region Compatibility properties
|
||||||
|
|
||||||
|
public string AuthorString
|
||||||
|
{
|
||||||
|
get => Author.Username;
|
||||||
|
set => Author.Username = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,15 @@ namespace osu.Game.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
IFileInfo INamedFileUsage.File => File;
|
IFileInfo INamedFileUsage.File => File;
|
||||||
|
|
||||||
|
#region Compatibility properties
|
||||||
|
|
||||||
|
public RealmFile FileInfo
|
||||||
|
{
|
||||||
|
get => File;
|
||||||
|
set => File = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
private RulesetInfo()
|
public RulesetInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,5 +83,11 @@ namespace osu.Game.Rulesets
|
|||||||
|
|
||||||
return ruleset;
|
return ruleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Compatibility properties
|
||||||
|
|
||||||
|
public int ID => OnlineID;
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user