From 27ac7685e164dafd1c555a3f8b8667bf0d9cf7b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Sep 2018 22:12:37 +0900 Subject: [PATCH 01/15] Bring music controller in front of notification overlay --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6fcb948298..8610a8d74d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -355,7 +355,7 @@ namespace osu.Game loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add); loadComponentSingleFile(musicController = new MusicController { - Depth = -4, + Depth = -5, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, From 221a99d886cfe9aaacf6515dcd65c0c0673b90e1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 08:54:58 +0200 Subject: [PATCH 02/15] fix StatusPill not setting text when initially set with NONE --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index c7e97cef55..511ce9aa58 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -14,10 +14,10 @@ namespace osu.Game.Beatmaps.Drawables { private readonly OsuSpriteText statusText; - private BeatmapSetOnlineStatus status = BeatmapSetOnlineStatus.None; + private BeatmapSetOnlineStatus status; public BeatmapSetOnlineStatus Status { - get { return status; } + get => status; set { if (value == status) return; @@ -49,6 +49,8 @@ namespace osu.Game.Beatmaps.Drawables Padding = textPadding, }, }; + + Status = BeatmapSetOnlineStatus.None; } } } From 13b988053a116306855e48316bc00bbf62fa413c Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 10:10:58 +0200 Subject: [PATCH 03/15] add status column to BeatmapInfo + BeatmapSetInfo --- osu.Game/Beatmaps/BeatmapInfo.cs | 11 +- osu.Game/Beatmaps/BeatmapSetInfo.cs | 6 +- .../20180913080842_AddRankStatus.Designer.cs | 380 ++++++++++++++++++ .../20180913080842_AddRankStatus.cs | 33 ++ .../Migrations/OsuDbContextModelSnapshot.cs | 9 +- 5 files changed, 430 insertions(+), 9 deletions(-) create mode 100644 osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs create mode 100644 osu.Game/Migrations/20180913080842_AddRankStatus.cs diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 303a19aab3..5a5229e29f 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -27,13 +27,15 @@ namespace osu.Game.Beatmaps [JsonProperty("id")] public int? OnlineBeatmapID { - get { return onlineBeatmapID; } - set { onlineBeatmapID = value > 0 ? value : null; } + get => onlineBeatmapID; + set => onlineBeatmapID = value > 0 ? value : null; } [JsonIgnore] public int BeatmapSetInfoID { get; set; } + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; + [Required] public BeatmapSetInfo BeatmapSet { get; set; } @@ -82,7 +84,7 @@ namespace osu.Game.Beatmaps [JsonIgnore] public string StoredBookmarks { - get { return string.Join(",", Bookmarks); } + get => string.Join(",", Bookmarks); set { if (string.IsNullOrEmpty(value)) @@ -93,8 +95,7 @@ namespace osu.Game.Beatmaps Bookmarks = value.Split(',').Select(v => { - int val; - bool result = int.TryParse(v, out val); + bool result = int.TryParse(v, out int val); return new { result, val }; }).Where(p => p.result).Select(p => p.val).ToArray(); } diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index ebebe42097..e131be0b70 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -17,9 +17,11 @@ namespace osu.Game.Beatmaps public int? OnlineBeatmapSetID { - get { return onlineBeatmapSetID; } - set { onlineBeatmapSetID = value > 0 ? value : null; } + get => onlineBeatmapSetID; + set => onlineBeatmapSetID = value > 0 ? value : null; } + + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs new file mode 100644 index 0000000000..5ab43da046 --- /dev/null +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs @@ -0,0 +1,380 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20180913080842_AddRankStatus")] + partial class AddRankStatus + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntKey") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.cs new file mode 100644 index 0000000000..bba4944bb7 --- /dev/null +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class AddRankStatus : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Status", + table: "BeatmapSetInfo", + nullable: false, + defaultValue: -3); // NONE + + migrationBuilder.AddColumn( + name: "Status", + table: "BeatmapInfo", + nullable: false, + defaultValue: -3); // NONE + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Status", + table: "BeatmapSetInfo"); + + migrationBuilder.DropColumn( + name: "Status", + table: "BeatmapInfo"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 6dbeaed62f..fde5c9fd82 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,7 +1,8 @@ // - +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using osu.Game.Database; namespace osu.Game.Migrations @@ -13,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846"); + .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -78,6 +79,8 @@ namespace osu.Game.Migrations b.Property("StarDifficulty"); + b.Property("Status"); + b.Property("StoredBookmarks"); b.Property("TimelineZoom"); @@ -173,6 +176,8 @@ namespace osu.Game.Migrations b.Property("Protected"); + b.Property("Status"); + b.HasKey("ID"); b.HasIndex("DeletePending"); From 5414ce9932887b082b37f5e663d4b7e3653a8de7 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 10:18:20 +0200 Subject: [PATCH 04/15] add StatusPill to BeatmapInfoWedge and DrawabelCarouselBeatmapSet --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 19 ++++++++++++++++- .../Carousel/DrawableCarouselBeatmapSet.cs | 21 ++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d26702fcf9..febd136e25 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -127,6 +127,7 @@ namespace osu.Game.Screens.Select public OsuSpriteText VersionLabel { get; private set; } public OsuSpriteText TitleLabel { get; private set; } public OsuSpriteText ArtistLabel { get; private set; } + public BeatmapSetOnlineStatusPill StatusPill { get; private set; } public FillFlowContainer MapperContainer { get; private set; } public FillFlowContainer InfoLabelContainer { get; private set; } @@ -190,7 +191,7 @@ namespace osu.Game.Screens.Select }, new FillFlowContainer { - Name = "Top-aligned metadata", + Name = "Topleft-aligned metadata", Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, @@ -207,6 +208,22 @@ namespace osu.Game.Screens.Select } }, new FillFlowContainer + { + Name = "Topright-aligned metadata", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 14, Left = 10, Right = 18, Bottom = 20 }, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + { + Status = beatmapInfo.Status, + } + } + }, + new FillFlowContainer { Name = "Centre-aligned metadata", Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 23f338b530..52d34a935f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -78,11 +78,26 @@ namespace osu.Game.Screens.Select.Carousel TextSize = 17, Shadow = true, }, - new FillFlowContainer + new FillFlowContainer { - Margin = new MarginPadding { Top = 5 }, + Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() + Margin = new MarginPadding { Top = 5 }, + Children = new Drawable[] + { + new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Margin = new MarginPadding{ Right = 5 }, + Status = beatmapSet.Status + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() + }, + } } } } From 638a2e5ba84490663b576d9ed31980495fcbf692 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 11:57:33 +0200 Subject: [PATCH 05/15] populate Status for Beatmap + BeatmapSet also added Status to APIBeatmap + APIBeatmapSet --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- osu.Game/Beatmaps/BeatmapManager.cs | 17 +++++++++++------ osu.Game/Beatmaps/BeatmapSetInfo.cs | 2 +- .../Online/API/Requests/Responses/APIBeatmap.cs | 10 +++++++++- .../API/Requests/Responses/APIBeatmapSet.cs | 15 ++++++++------- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 5a5229e29f..1aa4818393 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps public int BeatmapSetInfoID { get; set; } public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; - + [Required] public BeatmapSetInfo BeatmapSet { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 21df9a6c68..aa653d88f9 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; @@ -104,7 +104,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet.Beatmaps); foreach (BeatmapInfo b in beatmapSet.Beatmaps) - fetchAndPopulateOnlineIDs(b, beatmapSet.Beatmaps); + fetchAndPopulateOnlineValues(b, beatmapSet.Beatmaps); // check if a set already exists with the same online id, delete if it does. if (beatmapSet.OnlineBeatmapSetID != null) @@ -388,21 +388,22 @@ namespace osu.Game.Beatmaps } /// - /// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties. + /// Query the API to populate missing values like OnlineBeatmapID / OnlineBeatmapSetID or (Rank-)Status. /// /// The beatmap to populate. /// The other beatmaps contained within this set. /// Whether to re-query if the provided beatmap already has populated values. /// True if population was successful. - private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) + private bool fetchAndPopulateOnlineValues(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { if (api?.State != APIState.Online) return false; - if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) + if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null + && beatmap.Status != BeatmapSetOnlineStatus.None && beatmap.BeatmapSet.Status != BeatmapSetOnlineStatus.None) return true; - Logger.Log("Attempting online lookup for IDs...", LoggingTarget.Database); + Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); try { @@ -414,6 +415,9 @@ namespace osu.Game.Beatmaps Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + beatmap.Status = res.Status; + beatmap.BeatmapSet.Status = res.BeatmapSet.Status; + if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID)) { Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database); @@ -422,6 +426,7 @@ namespace osu.Game.Beatmaps beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID; + return true; } catch (Exception e) diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index e131be0b70..7a7d010a31 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps get => onlineBeatmapSetID; set => onlineBeatmapSetID = value > 0 ? value : null; } - + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 99e4392374..193ccf1f6b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -15,6 +15,12 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmapset_id")] public int OnlineBeatmapSetID { get; set; } + [JsonProperty(@"status")] + public BeatmapSetOnlineStatus Status { get; set; } + + [JsonProperty(@"beatmapset")] + public APIBeatmapSet BeatmapSet { get; set; } + [JsonProperty(@"playcount")] private int playCount { get; set; } @@ -59,11 +65,13 @@ namespace osu.Game.Online.API.Requests.Responses Ruleset = rulesets.GetRuleset(ruleset), StarDifficulty = starDifficulty, OnlineBeatmapID = OnlineBeatmapID, + Version = version, + Status = Status, BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = OnlineBeatmapSetID, + Status = BeatmapSet?.Status ?? BeatmapSetOnlineStatus.None }, - Version = version, BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index bbaaa0c756..8446285070 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -20,10 +20,13 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"id")] public int? OnlineBeatmapSetID { - get { return onlineBeatmapSetID; } - set { onlineBeatmapSetID = value > 0 ? value : null; } + get => onlineBeatmapSetID; + set => onlineBeatmapSetID = value > 0 ? value : null; } + [JsonProperty(@"status")] + public BeatmapSetOnlineStatus Status { get; set; } + [JsonProperty(@"preview_url")] private string preview { get; set; } @@ -42,9 +45,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"storyboard")] private bool hasStoryboard { get; set; } - [JsonProperty(@"status")] - private BeatmapSetOnlineStatus status { get; set; } - [JsonProperty(@"submitted_date")] private DateTimeOffset submitted { get; set; } @@ -57,7 +57,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"user_id")] private long creatorId { - set { Author.Id = value; } + set => Author.Id = value; } [JsonProperty(@"beatmaps")] @@ -69,6 +69,7 @@ namespace osu.Game.Online.API.Requests.Responses { OnlineBeatmapSetID = OnlineBeatmapSetID, Metadata = this, + Status = Status, OnlineInfo = new BeatmapSetOnlineInfo { Covers = covers, @@ -76,7 +77,7 @@ namespace osu.Game.Online.API.Requests.Responses PlayCount = playCount, FavouriteCount = favouriteCount, BPM = bpm, - Status = status, + Status = Status, HasVideo = hasVideo, HasStoryboard = hasStoryboard, Submitted = submitted, From 04853b8c8366a20f605477cbd5cd60f1f8b46ac8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 13:49:57 +0200 Subject: [PATCH 06/15] don't show StatusPill without a difficulty --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index febd136e25..ae5134c0da 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -261,8 +261,11 @@ namespace osu.Game.Screens.Select } } }; - artistBinding.ValueChanged += value => setMetadata(metadata.Source); - artistBinding.TriggerChange(); + artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); + + // no difficulty means it can't have a status to show + if (beatmapInfo.Version == null) + StatusPill.Hide(); } private void setMetadata(string source) From 1c2cc3837a59d6023fa086db90ea1ccd50e9fdd6 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Thu, 13 Sep 2018 21:52:15 +0200 Subject: [PATCH 07/15] Compute combo for nested Objects. Display fruit depending on Combo for osu!catch --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 +- osu.Game/Beatmaps/BeatmapProcessor.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 621fc100c2..2346a55bbe 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Catch.Objects public int IndexInBeatmap { get; set; } - public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4); + public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(ComboIndex % 4); public virtual bool NewCombo { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 9d7cd673dc..84bf6ada18 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,6 +44,15 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { + foreach (var hitObject in Beatmap.HitObjects) + { + var objectComboInfo = (IHasComboInformation)hitObject; + foreach (var obj in hitObject.NestedHitObjects.OfType()) + { + obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo; + obj.ComboIndex = objectComboInfo.ComboIndex; + } + } } } } From 9f546bd48447d7d3b65f43088391b8ba318e37f5 Mon Sep 17 00:00:00 2001 From: LastExceed Date: Fri, 14 Sep 2018 13:50:35 +0200 Subject: [PATCH 08/15] close tab on Mclick --- osu.Game/Overlays/Chat/ChatTabControl.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 2e3c9f9c5f..6764b5e77b 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; using OpenTK; +using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using System; @@ -143,6 +144,13 @@ namespace osu.Game.Overlays.Chat textBold.FadeOut(transition_length, Easing.OutQuint); } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + if (args.Button == MouseButton.Middle) + closeButton.Action(); + return base.OnMouseUp(state, args); + } + protected override bool OnHover(InputState state) { if (IsRemovable) From 347cb0a1b5bdaf64f90a4dfc699a1dd2b30d5856 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:41:29 +0200 Subject: [PATCH 09/15] Check for type conversion, mais the update recursive --- osu.Game/Beatmaps/BeatmapProcessor.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 84bf6ada18..1a767942eb 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,13 +44,24 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { + void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + { + if (obj is IHasComboInformation) + { + var objectComboInfo = (IHasComboInformation)obj; + objectComboInfo.ComboIndex = comboIndex; + objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; + foreach (var nestedObjet in obj.NestedHitObjects) + UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + } + } foreach (var hitObject in Beatmap.HitObjects) { - var objectComboInfo = (IHasComboInformation)hitObject; - foreach (var obj in hitObject.NestedHitObjects.OfType()) + if (hitObject is IHasComboInformation) { - obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo; - obj.ComboIndex = objectComboInfo.ComboIndex; + var objectComboInfo = (IHasComboInformation)hitObject; + foreach (var nested in hitObject.NestedHitObjects) + UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } } } From c8d3776c79767b24b6772ee87014f5bd67008c8f Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:46:04 +0200 Subject: [PATCH 10/15] Remove uneeded brackets --- osu.Game/Beatmaps/BeatmapProcessor.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 1a767942eb..35420efa8e 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -56,14 +56,12 @@ namespace osu.Game.Beatmaps } } foreach (var hitObject in Beatmap.HitObjects) - { if (hitObject is IHasComboInformation) { var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } - } } } } From 3e7006ec1fe25a650b8ef33107d91b71dd3a4f7e Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:52:32 +0200 Subject: [PATCH 11/15] Fix fonction name --- osu.Game/Beatmaps/BeatmapProcessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 35420efa8e..7007c41402 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,7 +44,7 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { - void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + void updateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) { if (obj is IHasComboInformation) { @@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps objectComboInfo.ComboIndex = comboIndex; objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; foreach (var nestedObjet in obj.NestedHitObjects) - UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + updateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); } } foreach (var hitObject in Beatmap.HitObjects) @@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps { var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) - UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); + updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } } } From fce9740f2810468c58fd87b588831766c0664dfa Mon Sep 17 00:00:00 2001 From: LastExceed Date: Sat, 15 Sep 2018 18:00:47 +0200 Subject: [PATCH 12/15] return true since we are handling the action --- osu.Game/Overlays/Chat/ChatTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 6764b5e77b..048659746d 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat { if (args.Button == MouseButton.Middle) closeButton.Action(); - return base.OnMouseUp(state, args); + return true; } protected override bool OnHover(InputState state) From aba1de8b1ab1c29c85a126cbc065b9d52c884c30 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 18 Sep 2018 12:54:07 +0900 Subject: [PATCH 13/15] Cleanup --- osu.Game/Beatmaps/BeatmapProcessor.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 7007c41402..9db2c5f08e 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps @@ -44,24 +45,25 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { - void updateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + void updateNestedCombo(HitObject obj, int comboIndex, int indexInCurrentCombo) { - if (obj is IHasComboInformation) + if (obj is IHasComboInformation objectComboInfo) { - var objectComboInfo = (IHasComboInformation)obj; objectComboInfo.ComboIndex = comboIndex; objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; - foreach (var nestedObjet in obj.NestedHitObjects) - updateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + foreach (var nestedObject in obj.NestedHitObjects) + updateNestedCombo(nestedObject, comboIndex, indexInCurrentCombo); } } + foreach (var hitObject in Beatmap.HitObjects) - if (hitObject is IHasComboInformation) + { + if (hitObject is IHasComboInformation objectComboInfo) { - var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } + } } } } From 27ea6102bc5d38ce773f15d4260c69e99e01a3db Mon Sep 17 00:00:00 2001 From: LastExceed Date: Tue, 18 Sep 2018 08:07:19 +0200 Subject: [PATCH 14/15] only return true on Mclick --- osu.Game/Overlays/Chat/ChatTabControl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 048659746d..524cae5600 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -146,9 +146,10 @@ namespace osu.Game.Overlays.Chat protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - if (args.Button == MouseButton.Middle) + var isMclick = args.Button == MouseButton.Middle; + if (isMclick) closeButton.Action(); - return true; + return isMclick; } protected override bool OnHover(InputState state) From ad3196264307e2ee566972168dbd539b2f20c52e Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 18 Sep 2018 15:27:21 +0900 Subject: [PATCH 15/15] Cleanup, use similar code to everywhere else --- osu.Game/Overlays/Chat/ChatTabControl.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 524cae5600..d9327e73e8 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -146,10 +146,13 @@ namespace osu.Game.Overlays.Chat protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - var isMclick = args.Button == MouseButton.Middle; - if (isMclick) + if (args.Button == MouseButton.Middle) + { closeButton.Action(); - return isMclick; + return true; + } + + return false; } protected override bool OnHover(InputState state)