1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 17:53:53 +08:00

Show "locally modified" pill when local modifications have been made

This commit is contained in:
Dean Herbert 2022-08-01 23:57:46 +09:00
parent 01cc9bd7ef
commit 0fcae08d38
5 changed files with 23 additions and 9 deletions

View File

@ -121,7 +121,8 @@ namespace osu.Game.Beatmaps
OnlineID = -1;
LastOnlineUpdate = null;
OnlineMD5Hash = string.Empty;
Status = BeatmapOnlineStatus.None;
if (Status != BeatmapOnlineStatus.LocallyModified)
Status = BeatmapOnlineStatus.None;
}
#region Properties we may not want persisted (but also maybe no harm?)

View File

@ -312,6 +312,10 @@ namespace osu.Game.Beatmaps
beatmapInfo.MD5Hash = stream.ComputeMD5Hash();
beatmapInfo.Hash = stream.ComputeSHA2Hash();
beatmapInfo.Status = BeatmapOnlineStatus.LocallyModified;
if (setInfo.Beatmaps.All(b => b.Status == BeatmapOnlineStatus.LocallyModified))
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));

View File

@ -3,6 +3,7 @@
#nullable disable
using System.ComponentModel;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
@ -10,6 +11,9 @@ namespace osu.Game.Beatmaps
{
public enum BeatmapOnlineStatus
{
[Description("Local")]
LocallyModified = -4,
None = -3,
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowStatusGraveyard))]

View File

@ -89,7 +89,16 @@ namespace osu.Game.Beatmaps
if (res != null)
{
beatmapInfo.Status = res.Status;
beatmapInfo.OnlineID = res.OnlineID;
beatmapInfo.OnlineMD5Hash = res.MD5Hash;
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
// In the case local changes have been applied, don't reset the status.
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
{
beatmapInfo.Status = res.Status;
}
Debug.Assert(beatmapInfo.BeatmapSet != null);
@ -98,13 +107,6 @@ namespace osu.Game.Beatmaps
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;
beatmapInfo.OnlineMD5Hash = res.MD5Hash;
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
beatmapInfo.OnlineID = res.OnlineID;
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
logForModel(set, $"Online retrieval mapped {beatmapInfo} to {res.OnlineBeatmapSetID} / {res.OnlineID}.");
}
}

View File

@ -137,6 +137,9 @@ namespace osu.Game.Graphics
{
switch (status)
{
case BeatmapOnlineStatus.LocallyModified:
return Color4.OrangeRed;
case BeatmapOnlineStatus.Ranked:
case BeatmapOnlineStatus.Approved:
return Color4Extensions.FromHex(@"b3ff66");