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:
parent
01cc9bd7ef
commit
0fcae08d38
@ -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?)
|
||||
|
@ -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));
|
||||
|
||||
|
@ -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))]
|
||||
|
@ -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}.");
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user