From 6cf227a7af53014b2b5a5a14112e71537af68b7b Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 23 May 2018 03:24:18 +0200 Subject: [PATCH 01/61] Allow formatting for DrawableDate class --- osu.Game/Graphics/DrawableDate.cs | 60 +++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 763e57e397..c38deba007 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -13,6 +13,8 @@ namespace osu.Game.Graphics public class DrawableDate : OsuSpriteText, IHasTooltip { private readonly DateTimeOffset date; + private readonly String dateFormat; + private readonly String tooltipFormat; public DrawableDate(DateTimeOffset date) { @@ -20,6 +22,50 @@ namespace osu.Game.Graphics Font = "Exo2.0-RegularItalic"; this.date = date.ToLocalTime(); + // if date's format is not specified, set it to an empty string, + // so that later we will know to humanize it + dateFormat = ""; + // if tooltip's format is not specified, set it to an empty string + // so later we will know to default to a default time format + tooltipFormat = ""; + } + + public DrawableDate(string dateFormat, DateTimeOffset date) + { + AutoSizeAxes = Axes.Both; + Font = "Exo2.0-RegularItalic"; + + this.date = date.ToLocalTime(); + // set a date format for later from an argument + this.dateFormat = dateFormat; + // if tooltip's format is not specified, set it to an empty string, + // so later we will know to default to a default time format + tooltipFormat = ""; + } + + public DrawableDate(DateTimeOffset date, string tooltipFormat) + { + AutoSizeAxes = Axes.Both; + Font = "Exo2.0-RegularItalic"; + + this.date = date.ToLocalTime(); + // if date's format is not specified, set it to an empty string, + // so that later we will know to humanize it + dateFormat = ""; + // set a tooltip format for later from an argument + this.tooltipFormat = tooltipFormat; + } + + public DrawableDate(string dateFormat, DateTimeOffset date, string tooltipFormat) + { + AutoSizeAxes = Axes.Both; + Font = "Exo2.0-RegularItalic"; + + this.date = date.ToLocalTime(); + // set a date format for text generator from an argument + this.dateFormat = dateFormat; + // set a tooltip format for tooltip generator from an argument + this.tooltipFormat = tooltipFormat; } [BackgroundDependencyLoader] @@ -58,8 +104,18 @@ namespace osu.Game.Graphics public override bool HandleMouseInput => true; - private void updateTime() => Text = date.Humanize(); + // if date's format is specified + private void updateTime() => Text = dateFormat != "" ? + // format it as requested in a passed argument + String.Format(dateFormat, date) : + // otherwise, humanize it (for example: 2 hours ago) + date.Humanize(); - public string TooltipText => date.ToString(); + // if we know that the tooltip format exists + public string TooltipText => tooltipFormat != "" ? + // then we format the tooltip text using that format + String.Format(tooltipFormat, date) : + // but otherwise, simply convert the date to string + date.ToString(); } } From 8e9dde97ce15e8ba3ec1920849eb9777a635fca3 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 23 May 2018 03:24:37 +0200 Subject: [PATCH 02/61] Better match join and last seen texts and tooltips with osu-web --- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 4c411b3210..1b7335bf81 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -364,12 +364,12 @@ namespace osu.Game.Overlays.Profile else { infoTextLeft.AddText("Joined ", lightText); - infoTextLeft.AddText(new DrawableDate(user.JoinDate), boldItalic); + infoTextLeft.AddText(new DrawableDate("{0:MMMM yyyy}", user.JoinDate, "{0:d MMMM yyyy}"), boldItalic); } infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); - infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.LastVisit, "{0:d MMMM yyyy H:mm \"UTC\"z}"), boldItalic); infoTextLeft.NewParagraph(); if (user.PlayStyle?.Length > 0) From 10bc3917b531925a53c1bdadce68e8783f397aaf Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 23 May 2018 11:17:13 +0200 Subject: [PATCH 03/61] Apply suggested changes --- osu.Game/Graphics/DrawableDate.cs | 72 +++++----------------- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 +- 2 files changed, 16 insertions(+), 60 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index c38deba007..ede5213772 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -13,61 +13,23 @@ namespace osu.Game.Graphics public class DrawableDate : OsuSpriteText, IHasTooltip { private readonly DateTimeOffset date; - private readonly String dateFormat; - private readonly String tooltipFormat; + private readonly string dateFormat; + private readonly string tooltipFormat; - public DrawableDate(DateTimeOffset date) + public DrawableDate(DateTimeOffset date, string dateFormat = null, string tooltipFormat = null) { AutoSizeAxes = Axes.Both; Font = "Exo2.0-RegularItalic"; this.date = date.ToLocalTime(); - // if date's format is not specified, set it to an empty string, - // so that later we will know to humanize it - dateFormat = ""; - // if tooltip's format is not specified, set it to an empty string - // so later we will know to default to a default time format - tooltipFormat = ""; - } - - public DrawableDate(string dateFormat, DateTimeOffset date) - { - AutoSizeAxes = Axes.Both; - Font = "Exo2.0-RegularItalic"; - - this.date = date.ToLocalTime(); - // set a date format for later from an argument + // The string to format the date text with. + // May be null if the humanized format should be used. this.dateFormat = dateFormat; - // if tooltip's format is not specified, set it to an empty string, - // so later we will know to default to a default time format - tooltipFormat = ""; - } - - public DrawableDate(DateTimeOffset date, string tooltipFormat) - { - AutoSizeAxes = Axes.Both; - Font = "Exo2.0-RegularItalic"; - - this.date = date.ToLocalTime(); - // if date's format is not specified, set it to an empty string, - // so that later we will know to humanize it - dateFormat = ""; - // set a tooltip format for later from an argument + // The string to format the tooltip text with. + // May be null if the default format should be used. this.tooltipFormat = tooltipFormat; } - - public DrawableDate(string dateFormat, DateTimeOffset date, string tooltipFormat) - { - AutoSizeAxes = Axes.Both; - Font = "Exo2.0-RegularItalic"; - - this.date = date.ToLocalTime(); - // set a date format for text generator from an argument - this.dateFormat = dateFormat; - // set a tooltip format for tooltip generator from an argument - this.tooltipFormat = tooltipFormat; - } - + [BackgroundDependencyLoader] private void load() { @@ -104,18 +66,12 @@ namespace osu.Game.Graphics public override bool HandleMouseInput => true; - // if date's format is specified - private void updateTime() => Text = dateFormat != "" ? - // format it as requested in a passed argument - String.Format(dateFormat, date) : - // otherwise, humanize it (for example: 2 hours ago) - date.Humanize(); + private void updateTime() => Text = string.IsNullOrEmpty(dateFormat) ? + date.Humanize() : + string.Format(dateFormat, date); - // if we know that the tooltip format exists - public string TooltipText => tooltipFormat != "" ? - // then we format the tooltip text using that format - String.Format(tooltipFormat, date) : - // but otherwise, simply convert the date to string - date.ToString(); + public string TooltipText => string.IsNullOrEmpty(tooltipFormat) ? + date.ToString() : + string.Format(tooltipFormat, date); } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 1b7335bf81..dedfb294e2 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -364,12 +364,12 @@ namespace osu.Game.Overlays.Profile else { infoTextLeft.AddText("Joined ", lightText); - infoTextLeft.AddText(new DrawableDate("{0:MMMM yyyy}", user.JoinDate, "{0:d MMMM yyyy}"), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.JoinDate, "{0:MMMM yyyy}", "{0:d MMMM yyyy}"), boldItalic); } infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); - infoTextLeft.AddText(new DrawableDate(user.LastVisit, "{0:d MMMM yyyy H:mm \"UTC\"z}"), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.LastVisit, null, "{0:d MMMM yyyy H:mm \"UTC\"z}"), boldItalic); infoTextLeft.NewParagraph(); if (user.PlayStyle?.Length > 0) From cf5232586e4ab299b63f2de09888d9527a0649fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Zgierski?= Date: Wed, 23 May 2018 11:27:11 +0200 Subject: [PATCH 04/61] Trim whitespace that I couldn't remove in VS? --- osu.Game/Graphics/DrawableDate.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index ede5213772..0132a1b82c 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -29,7 +29,7 @@ namespace osu.Game.Graphics // May be null if the default format should be used. this.tooltipFormat = tooltipFormat; } - + [BackgroundDependencyLoader] private void load() { From 29de8e5e2d6a1384c8ffccefdc76939092ed04b0 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 23 May 2018 12:07:28 +0200 Subject: [PATCH 05/61] Document parameters more properly --- osu.Game/Graphics/DrawableDate.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index ede5213772..a2b811be92 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -16,20 +16,20 @@ namespace osu.Game.Graphics private readonly string dateFormat; private readonly string tooltipFormat; + /// The string to format the date text with. + /// May be null if the humanized format should be used. + /// The string to format the tooltip text with. + /// May be null if the default format should be used. public DrawableDate(DateTimeOffset date, string dateFormat = null, string tooltipFormat = null) { AutoSizeAxes = Axes.Both; Font = "Exo2.0-RegularItalic"; this.date = date.ToLocalTime(); - // The string to format the date text with. - // May be null if the humanized format should be used. this.dateFormat = dateFormat; - // The string to format the tooltip text with. - // May be null if the default format should be used. this.tooltipFormat = tooltipFormat; } - + [BackgroundDependencyLoader] private void load() { From 961702aadff5955ad1844278b96bf6ee4c206d33 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 13:05:41 +0200 Subject: [PATCH 06/61] Apply the format fix to the tooltip text across the board --- osu.Game/Graphics/DrawableDate.cs | 10 ++-------- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index a2b811be92..a6c2587397 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -14,20 +14,16 @@ namespace osu.Game.Graphics { private readonly DateTimeOffset date; private readonly string dateFormat; - private readonly string tooltipFormat; /// The string to format the date text with. /// May be null if the humanized format should be used. - /// The string to format the tooltip text with. - /// May be null if the default format should be used. - public DrawableDate(DateTimeOffset date, string dateFormat = null, string tooltipFormat = null) + public DrawableDate(DateTimeOffset date, string dateFormat = null) { AutoSizeAxes = Axes.Both; Font = "Exo2.0-RegularItalic"; this.date = date.ToLocalTime(); this.dateFormat = dateFormat; - this.tooltipFormat = tooltipFormat; } [BackgroundDependencyLoader] @@ -70,8 +66,6 @@ namespace osu.Game.Graphics date.Humanize() : string.Format(dateFormat, date); - public string TooltipText => string.IsNullOrEmpty(tooltipFormat) ? - date.ToString() : - string.Format(tooltipFormat, date); + public string TooltipText => string.Format("{0:d MMMM yyyy H:mm \"UTC\"z}", date); } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index dedfb294e2..e4739abcf4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -364,12 +364,12 @@ namespace osu.Game.Overlays.Profile else { infoTextLeft.AddText("Joined ", lightText); - infoTextLeft.AddText(new DrawableDate(user.JoinDate, "{0:MMMM yyyy}", "{0:d MMMM yyyy}"), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.JoinDate, "{0:MMMM yyyy}"), boldItalic); } infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); - infoTextLeft.AddText(new DrawableDate(user.LastVisit, null, "{0:d MMMM yyyy H:mm \"UTC\"z}"), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.LastVisit, null), boldItalic); infoTextLeft.NewParagraph(); if (user.PlayStyle?.Length > 0) From 05b0564381d110304b064667d7121ce726313f11 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 13:30:29 +0200 Subject: [PATCH 07/61] Create DrawableJoinDate somehow and remove dateFormat argument --- osu.Game/Graphics/DrawableDate.cs | 2 +- osu.Game/Graphics/DrawableJoinDate.cs | 14 ++++++++++++++ osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Graphics/DrawableJoinDate.cs diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index a6c2587397..387711c45a 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -17,7 +17,7 @@ namespace osu.Game.Graphics /// The string to format the date text with. /// May be null if the humanized format should be used. - public DrawableDate(DateTimeOffset date, string dateFormat = null) + public DrawableDate(DateTimeOffset date) { AutoSizeAxes = Axes.Both; Font = "Exo2.0-RegularItalic"; diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs new file mode 100644 index 0000000000..1921c9473d --- /dev/null +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace osu.Game.Graphics +{ + public class DrawableJoinDate : DrawableDate + { + public DrawableJoinDate(DateTimeOffset date) : base(date) + { + + } + } +} diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index e4739abcf4..4c411b3210 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -364,12 +364,12 @@ namespace osu.Game.Overlays.Profile else { infoTextLeft.AddText("Joined ", lightText); - infoTextLeft.AddText(new DrawableDate(user.JoinDate, "{0:MMMM yyyy}"), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.JoinDate), boldItalic); } infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); - infoTextLeft.AddText(new DrawableDate(user.LastVisit, null), boldItalic); + infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); infoTextLeft.NewParagraph(); if (user.PlayStyle?.Length > 0) From a446b627da0decbb477efefbb0e63be4c1aa686f Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 13:31:12 +0200 Subject: [PATCH 08/61] Make TooltipText virtual --- osu.Game/Graphics/DrawableDate.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 387711c45a..5ca28f17b9 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -66,6 +66,6 @@ namespace osu.Game.Graphics date.Humanize() : string.Format(dateFormat, date); - public string TooltipText => string.Format("{0:d MMMM yyyy H:mm \"UTC\"z}", date); + public virtual string TooltipText => string.Format("{0:d MMMM yyyy H:mm \"UTC\"z}", date); } } From 3efb51e4646c332cd8687081987d8093216b10cb Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 14:00:32 +0200 Subject: [PATCH 09/61] Create Format(), override TooltipText.. --- osu.Game/Graphics/DrawableDate.cs | 8 +++----- osu.Game/Graphics/DrawableJoinDate.cs | 8 +++++++- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 5ca28f17b9..7e16575ed5 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -13,7 +13,6 @@ namespace osu.Game.Graphics public class DrawableDate : OsuSpriteText, IHasTooltip { private readonly DateTimeOffset date; - private readonly string dateFormat; /// The string to format the date text with. /// May be null if the humanized format should be used. @@ -23,7 +22,6 @@ namespace osu.Game.Graphics Font = "Exo2.0-RegularItalic"; this.date = date.ToLocalTime(); - this.dateFormat = dateFormat; } [BackgroundDependencyLoader] @@ -62,9 +60,9 @@ namespace osu.Game.Graphics public override bool HandleMouseInput => true; - private void updateTime() => Text = string.IsNullOrEmpty(dateFormat) ? - date.Humanize() : - string.Format(dateFormat, date); + protected virtual string Format() => Text = date.Humanize(); + + private void updateTime() => Format(); public virtual string TooltipText => string.Format("{0:d MMMM yyyy H:mm \"UTC\"z}", date); } diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs index 1921c9473d..1472eddd8f 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -6,9 +6,15 @@ namespace osu.Game.Graphics { public class DrawableJoinDate : DrawableDate { + private readonly DateTimeOffset date; + public DrawableJoinDate(DateTimeOffset date) : base(date) { - + this.date = date; } + + protected override string Format() => Text = string.Format("{0:MMMM yyyy}", date); + + public override string TooltipText => string.Format("{0:d MMMM yyyy}", date); } } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 4c411b3210..996c6384c9 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -364,7 +364,7 @@ namespace osu.Game.Overlays.Profile else { infoTextLeft.AddText("Joined ", lightText); - infoTextLeft.AddText(new DrawableDate(user.JoinDate), boldItalic); + infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); } infoTextLeft.NewLine(); From e3ebc849c5a1be4005aba98568774c021292cbbe Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 14:04:12 +0200 Subject: [PATCH 10/61] Remove not removed comment --- osu.Game/Graphics/DrawableDate.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 7e16575ed5..43287202ae 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -13,9 +13,7 @@ namespace osu.Game.Graphics public class DrawableDate : OsuSpriteText, IHasTooltip { private readonly DateTimeOffset date; - - /// The string to format the date text with. - /// May be null if the humanized format should be used. + public DrawableDate(DateTimeOffset date) { AutoSizeAxes = Axes.Both; From 29fbdf4d926f6e6a3594a14276ed91a9f715d6ba Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 14:05:50 +0200 Subject: [PATCH 11/61] Remove horizontal white space --- osu.Game/Graphics/DrawableDate.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 43287202ae..7a264f58a5 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -13,7 +13,7 @@ namespace osu.Game.Graphics public class DrawableDate : OsuSpriteText, IHasTooltip { private readonly DateTimeOffset date; - + public DrawableDate(DateTimeOffset date) { AutoSizeAxes = Axes.Both; From 71c04f4605dac87271db2c5199a0fb397b976630 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 14:10:54 +0200 Subject: [PATCH 12/61] Add license header to the new file --- osu.Game/Graphics/DrawableJoinDate.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs index 1472eddd8f..7860774a69 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Collections.Generic; using System.Text; From 39224931f8f20fd4aedf3f8f435a970702d65cf5 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 14:25:12 +0200 Subject: [PATCH 13/61] Try satisfying AppVeyor --- osu.Game/Graphics/DrawableDate.cs | 2 +- osu.Game/Graphics/DrawableJoinDate.cs | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 7a264f58a5..df6aa72c37 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -62,6 +62,6 @@ namespace osu.Game.Graphics private void updateTime() => Format(); - public virtual string TooltipText => string.Format("{0:d MMMM yyyy H:mm \"UTC\"z}", date); + public virtual string TooltipText => string.Format($"{date:d MMMM yyyy H:mm \"UTC\"z}"); } } diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs index 7860774a69..713bd4e44f 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; -using System.Text; namespace osu.Game.Graphics { @@ -16,8 +14,8 @@ namespace osu.Game.Graphics this.date = date; } - protected override string Format() => Text = string.Format("{0:MMMM yyyy}", date); + protected override string Format() => Text = string.Format($"{date:MMMM yyyy}"); - public override string TooltipText => string.Format("{0:d MMMM yyyy}", date); + public override string TooltipText => string.Format($"{date:d MMMM yyyy}"); } } From f486bcfee1610cad4329f6910c1c8d4594175921 Mon Sep 17 00:00:00 2001 From: clayton Date: Sat, 9 Jun 2018 17:38:17 -0700 Subject: [PATCH 14/61] Add judgements to catch --- .../Judgements/CatchBananaJudgement.cs | 24 +++++++++++++++++ .../Judgements/CatchBananaShowerJudgement.cs | 20 ++++++++++++++ .../Judgements/CatchDropletJudgement.cs | 22 ++++++++++++++++ .../Judgements/CatchJudgement.cs | 19 +++++++++++++- .../Judgements/CatchTinyDropletJudgement.cs | 24 +++++++++++++++++ .../Objects/Drawable/DrawableBanana.cs | 25 ++++++++++++++++++ .../Objects/Drawable/DrawableBananaShower.cs | 4 +-- .../Drawable/DrawableCatchHitObject.cs | 8 +++--- .../Objects/Drawable/DrawableDroplet.cs | 10 +++++++ .../Objects/Drawable/DrawableTinyDroplet.cs | 26 +++++++++++++++++++ .../Scoring/CatchScoreProcessor.cs | 18 ++++++++++--- .../UI/CatchRulesetContainer.cs | 8 +++--- 12 files changed, 194 insertions(+), 14 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs create mode 100644 osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs create mode 100644 osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs create mode 100644 osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs create mode 100644 osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs create mode 100644 osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs new file mode 100644 index 0000000000..ea51de0118 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Catch.Judgements +{ + public class CatchBananaJudgement : CatchJudgement + { + public override bool AffectsCombo => false; + + protected override int NumericResultFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 1100; + } + } + } +} diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs new file mode 100644 index 0000000000..75c79d9a6a --- /dev/null +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Catch.Judgements +{ + public class CatchBananaShowerJudgement : CatchJudgement + { + public override bool AffectsCombo => false; + + public CatchBananaShowerJudgement() + { + Result = HitResult.Perfect; + } + + protected override int NumericResultFor(HitResult result) => 0; + } +} diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs new file mode 100644 index 0000000000..8464313300 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Catch.Judgements +{ + public class CatchDropletJudgement : CatchJudgement + { + protected override int NumericResultFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 30; + } + } + } +} diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index bb2786f14f..c6ad605f09 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -2,11 +2,28 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements { public class CatchJudgement : Judgement { - // todo: wangs + public override HitResult MaxResult => HitResult.Perfect; + + /// + /// The positional hit offset. + /// + public float PositionOffset; + + protected override int NumericResultFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 300; + } + } } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs new file mode 100644 index 0000000000..97a24cfc64 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Catch.Judgements +{ + public class CatchTinyDropletJudgement : CatchJudgement + { + public override bool AffectsCombo => false; + + protected override int NumericResultFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 10; + } + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs new file mode 100644 index 0000000000..6b7b5e0310 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Catch.Objects.Drawable +{ + public class DrawableBanana : DrawableFruit + { + public DrawableBanana(BananaShower.Banana h) + : base(h) + { + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (CheckPosition == null) return; + + if (timeOffset >= 0) + AddJudgement(new CatchBananaJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs index 739cc6a59b..546ded5a1a 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable protected override void CheckForJudgements(bool userTriggered, double timeOffset) { if (timeOffset >= 0) - AddJudgement(new Judgement { Result = NestedHitObjects.Cast().Any(n => n.Judgements.Any(j => j.IsHit)) ? HitResult.Perfect : HitResult.Miss }); + AddJudgement(new CatchBananaShowerJudgement()); } protected override void AddNested(DrawableHitObject h) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 3dbda708e5..7af1456015 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using OpenTK; +using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; -using OpenTK; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; -using OpenTK.Graphics; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable if (CheckPosition == null) return; if (timeOffset >= 0) - AddJudgement(new Judgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); + AddJudgement(new CatchJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); } protected override void SkinChanged(ISkinSource skin, bool allowFallback) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index a19d67ebbe..cb451c61c0 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -6,6 +6,8 @@ using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; using OpenTK.Graphics; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -21,6 +23,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Masking = false; } + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (CheckPosition == null) return; + + if (timeOffset >= 0) + AddJudgement(new CatchDropletJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); + } + [BackgroundDependencyLoader] private void load() { diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs new file mode 100644 index 0000000000..7a3972da51 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Game.Rulesets.Catch.Judgements; +using osu.Game.Rulesets.Scoring; + +namespace osu.Game.Rulesets.Catch.Objects.Drawable +{ + public class DrawableTinyDroplet : DrawableDroplet + { + public DrawableTinyDroplet(Droplet h) + : base(h) + { + Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 8; + } + + protected override void CheckForJudgements(bool userTriggered, double timeOffset) + { + if (CheckPosition == null) return; + + if (timeOffset >= 0) + AddJudgement(new CatchTinyDropletJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); + } + } +} diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index ce1aee5c34..1d7cd5cbc8 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -24,13 +24,23 @@ namespace osu.Game.Rulesets.Catch.Scoring switch (obj) { case JuiceStream stream: - foreach (var _ in stream.NestedHitObjects.Cast()) - AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); + foreach (var nestedObject in stream.NestedHitObjects) + switch (nestedObject) + { + case TinyDroplet _: + AddJudgement(new CatchTinyDropletJudgement { Result = HitResult.Perfect }); + break; + case Droplet _: + AddJudgement(new CatchDropletJudgement { Result = HitResult.Perfect }); + break; + case Fruit _: + AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); + break; + } break; case BananaShower shower: foreach (var _ in shower.NestedHitObjects.Cast()) - AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); - AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); + AddJudgement(new CatchBananaJudgement { Result = HitResult.Perfect }); break; case Fruit _: AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs index 52763e09af..c1cb0627e5 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs @@ -38,14 +38,16 @@ namespace osu.Game.Rulesets.Catch.UI { switch (h) { + case BananaShower.Banana banana: + return new DrawableBanana(banana); case Fruit fruit: return new DrawableFruit(fruit); case JuiceStream stream: return new DrawableJuiceStream(stream, GetVisualRepresentation); - case BananaShower banana: - return new DrawableBananaShower(banana, GetVisualRepresentation); + case BananaShower shower: + return new DrawableBananaShower(shower, GetVisualRepresentation); case TinyDroplet tiny: - return new DrawableDroplet(tiny) { Scale = new Vector2(0.5f) }; + return new DrawableTinyDroplet(tiny); case Droplet droplet: return new DrawableDroplet(droplet); } From 808118e4d422811393a6284021a86be26e64a62b Mon Sep 17 00:00:00 2001 From: clayton Date: Sat, 9 Jun 2018 17:39:17 -0700 Subject: [PATCH 15/61] Add health drain to catch --- .../Judgements/CatchBananaJudgement.cs | 11 +++++++++ .../Judgements/CatchBananaShowerJudgement.cs | 1 + .../Judgements/CatchDropletJudgement.cs | 11 +++++++++ .../Judgements/CatchJudgement.cs | 21 ++++++++++++++++ .../Judgements/CatchTinyDropletJudgement.cs | 11 +++++++++ .../Scoring/CatchScoreProcessor.cs | 24 ++++++++++++++++++- 6 files changed, 78 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index ea51de0118..f6d90df0a9 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -20,5 +20,16 @@ namespace osu.Game.Rulesets.Catch.Judgements return 1100; } } + + protected override float HealthIncreaseFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 8; + } + } } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs index 75c79d9a6a..7903aba7c1 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs @@ -16,5 +16,6 @@ namespace osu.Game.Rulesets.Catch.Judgements } protected override int NumericResultFor(HitResult result) => 0; + protected override float HealthIncreaseFor(HitResult result) => 0; } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs index 8464313300..5fce996f6e 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs @@ -18,5 +18,16 @@ namespace osu.Game.Rulesets.Catch.Judgements return 30; } } + + protected override float HealthIncreaseFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 7; + } + } } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index c6ad605f09..82d54c6095 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -25,5 +25,26 @@ namespace osu.Game.Rulesets.Catch.Judgements return 300; } } + + /// + /// The base health increase for the result achieved. + /// + public float HealthIncrease => HealthIncreaseFor(Result); + + /// + /// Convert a to a base health increase. + /// + /// The value to convert. + /// The base health increase. + protected virtual float HealthIncreaseFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 10.2f; + } + } } } diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs index 97a24cfc64..99ddb72f7e 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs @@ -20,5 +20,16 @@ namespace osu.Game.Rulesets.Catch.Judgements return 10; } } + + protected override float HealthIncreaseFor(HitResult result) + { + switch (result) + { + default: + return 0; + case HitResult.Perfect: + return 4; + } + } } } diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 1d7cd5cbc8..54263c2268 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -17,8 +19,12 @@ namespace osu.Game.Rulesets.Catch.Scoring { } + private float hpDrainRate; + protected override void SimulateAutoplay(Beatmap beatmap) { + hpDrainRate = beatmap.BeatmapInfo.BaseDifficulty.DrainRate; + foreach (var obj in beatmap.HitObjects) { switch (obj) @@ -47,8 +53,24 @@ namespace osu.Game.Rulesets.Catch.Scoring break; } } + } - base.SimulateAutoplay(beatmap); + private const double harshness = 0.01; + + protected override void OnNewJudgement(Judgement judgement) + { + base.OnNewJudgement(judgement); + + if (judgement.Result == HitResult.Miss) + { + if (judgement.AffectsCombo) + Health.Value -= hpDrainRate * (harshness * 2); + return; + } + + var catchJudgement = judgement as CatchJudgement; + + Health.Value += Math.Max(catchJudgement.HealthIncrease - hpDrainRate, 0) * harshness; } } } From fbc0cd6f5f2e363358922c97bfcff80e07d335e4 Mon Sep 17 00:00:00 2001 From: Crusensis Date: Sat, 9 Jun 2018 18:14:33 -0700 Subject: [PATCH 16/61] Split AffectsCombo into IsBonus --- .../Judgements/CatchBananaJudgement.cs | 1 + .../Judgements/CatchBananaShowerJudgement.cs | 1 + .../Judgements/HoldNoteJudgement.cs | 2 ++ .../Judgements/HoldNoteTickJudgement.cs | 1 + .../Judgements/OsuSliderTailJudgement.cs | 2 ++ .../Judgements/TaikoDrumRollTickJudgement.cs | 1 + .../Judgements/TaikoStrongHitJudgement.cs | 1 + osu.Game/Rulesets/Judgements/Judgement.cs | 6 +++- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 28 +++++++++++++------ 9 files changed, 33 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index f6d90df0a9..40696d4837 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Catch.Judgements public class CatchBananaJudgement : CatchJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) { diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs index 7903aba7c1..36a4fef80c 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs @@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Catch.Judgements public class CatchBananaShowerJudgement : CatchJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; public CatchBananaShowerJudgement() { diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs index 9630ba9273..9c78360911 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs @@ -8,6 +8,8 @@ namespace osu.Game.Rulesets.Mania.Judgements public class HoldNoteJudgement : ManiaJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; + protected override int NumericResultFor(HitResult result) => 0; } } diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index 6eb5a79200..5d38e70d01 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -8,6 +8,7 @@ namespace osu.Game.Rulesets.Mania.Judgements public class HoldNoteTickJudgement : ManiaJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) => 20; } diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs index c4e265aac9..fc85ec8764 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs @@ -8,6 +8,8 @@ namespace osu.Game.Rulesets.Osu.Judgements public class OsuSliderTailJudgement : OsuJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; + protected override int NumericResultFor(HitResult result) => 0; } } diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs index 446dd0d11b..17bd2d9608 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs @@ -8,6 +8,7 @@ namespace osu.Game.Rulesets.Taiko.Judgements public class TaikoDrumRollTickJudgement : TaikoJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) { diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs index 288ad236aa..dbfd38e6f9 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs @@ -6,6 +6,7 @@ namespace osu.Game.Rulesets.Taiko.Judgements public class TaikoStrongHitJudgement : TaikoJudgement { public override bool AffectsCombo => false; + public override bool IsBonus => true; public TaikoStrongHitJudgement() { diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 587f2c8d15..3d70b23773 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -46,10 +46,14 @@ namespace osu.Game.Rulesets.Judgements /// /// Whether the should affect the combo portion of the score. - /// If false, the will be considered for the bonus portion of the score. /// public virtual bool AffectsCombo => true; + /// + /// Whether the should be counted as base or bonus score. + /// + public virtual bool IsBonus => false; + /// /// The numeric representation for the result achieved. /// diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 345930ed04..1fba936032 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -256,13 +256,19 @@ namespace osu.Game.Rulesets.Scoring break; } - baseScore += judgement.NumericResult; - rollingMaxBaseScore += judgement.MaxNumericResult; - JudgedHits++; } - else if (judgement.IsHit) - bonusScore += judgement.NumericResult; + + if (judgement.IsBonus) + { + if (judgement.IsHit) + bonusScore += judgement.NumericResult; + } + else + { + baseScore += judgement.NumericResult; + rollingMaxBaseScore += judgement.MaxNumericResult; + } } /// @@ -275,14 +281,18 @@ namespace osu.Game.Rulesets.Scoring HighestCombo.Value = judgement.HighestComboAtJudgement; if (judgement.AffectsCombo) + JudgedHits--; + + if (judgement.IsBonus) + { + if (judgement.IsHit) + bonusScore -= judgement.NumericResult; + } + else { baseScore -= judgement.NumericResult; rollingMaxBaseScore -= judgement.MaxNumericResult; - - JudgedHits--; } - else if (judgement.IsHit) - bonusScore -= judgement.NumericResult; } private void updateScore() From 3e6e2ac09a41050cac7ea2a86c215c930beebdb2 Mon Sep 17 00:00:00 2001 From: clayton Date: Sat, 9 Jun 2018 18:23:05 -0700 Subject: [PATCH 17/61] Add CatchBananaShowerJudgements in simulated autoplays --- osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 54263c2268..386da17c59 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -47,6 +47,7 @@ namespace osu.Game.Rulesets.Catch.Scoring case BananaShower shower: foreach (var _ in shower.NestedHitObjects.Cast()) AddJudgement(new CatchBananaJudgement { Result = HitResult.Perfect }); + AddJudgement(new CatchBananaShowerJudgement()); break; case Fruit _: AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); From e44e08201beed3fda4c11a1e047280282d3a6add Mon Sep 17 00:00:00 2001 From: clayton Date: Mon, 11 Jun 2018 12:43:01 -0700 Subject: [PATCH 18/61] Remove unnecessary usings and move Banana out of BananaShower --- osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs | 2 +- .../Judgements/CatchBananaJudgement.cs | 1 - .../Judgements/CatchBananaShowerJudgement.cs | 1 - .../Judgements/CatchDropletJudgement.cs | 1 - .../Judgements/CatchTinyDropletJudgement.cs | 1 - osu.Game.Rulesets.Catch/Objects/Banana.cs | 10 ++++++++++ osu.Game.Rulesets.Catch/Objects/BananaShower.cs | 5 ----- .../Objects/Drawable/DrawableBanana.cs | 3 +-- .../Objects/Drawable/DrawableBananaShower.cs | 3 +-- osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs | 4 ++-- osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs | 2 +- 11 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Objects/Banana.cs diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs index e77dd76353..5c41e4136c 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseFruitObjects.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Catch.Tests private DrawableFruit createDrawable(int index) { Fruit fruit = index == 5 - ? new BananaShower.Banana + ? new Banana { StartTime = 1000000000000, IndexInBeatmap = index, diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index 40696d4837..393e3994a1 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs index 36a4fef80c..a3a9aa4f04 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs index 5fce996f6e..0df2305339 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchDropletJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs index 99ddb72f7e..8b77351027 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchTinyDropletJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements diff --git a/osu.Game.Rulesets.Catch/Objects/Banana.cs b/osu.Game.Rulesets.Catch/Objects/Banana.cs new file mode 100644 index 0000000000..f7c60a7a47 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Objects/Banana.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Catch.Objects +{ + public class Banana : Fruit + { + public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs index a6aba42f03..e4e5820e7e 100644 --- a/osu.Game.Rulesets.Catch/Objects/BananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/BananaShower.cs @@ -39,10 +39,5 @@ namespace osu.Game.Rulesets.Catch.Objects public double EndTime => StartTime + Duration; public double Duration { get; set; } - - public class Banana : Fruit - { - public override FruitVisualRepresentation VisualRepresentation => FruitVisualRepresentation.Banana; - } } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs index 6b7b5e0310..dc2fa18ad4 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Scoring; @@ -9,7 +8,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { public class DrawableBanana : DrawableFruit { - public DrawableBanana(BananaShower.Banana h) + public DrawableBanana(Banana h) : base(h) { } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs index 546ded5a1a..182adab6e1 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -24,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable InternalChild = bananaContainer = new Container { RelativeSizeAxes = Axes.Both }; - foreach (var b in s.NestedHitObjects.Cast()) + foreach (var b in s.NestedHitObjects.Cast()) AddNested(getVisualRepresentation?.Invoke(b)); } diff --git a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs index 936ab6a9d3..23b620248f 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchAutoGenerator.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Replays return; } - if (h is BananaShower.Banana) + if (h is Banana) { // auto bananas unrealistically warp to catch 100% combo. Replay.Frames.Add(new CatchReplayFrame(h.StartTime, h.X)); @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Catch.Replays { switch (nestedObj) { - case BananaShower.Banana _: + case Banana _: case TinyDroplet _: case Droplet _: case Fruit _: diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs index c1cb0627e5..1ac052de4d 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Catch.UI { switch (h) { - case BananaShower.Banana banana: + case Banana banana: return new DrawableBanana(banana); case Fruit fruit: return new DrawableFruit(fruit); From d3ada7914c908a1149205fe38ad510e67606433d Mon Sep 17 00:00:00 2001 From: clayton Date: Mon, 11 Jun 2018 13:29:36 -0700 Subject: [PATCH 19/61] Fix condition for dropping health on miss --- osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 386da17c59..3e548de2cf 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Catch.Scoring if (judgement.Result == HitResult.Miss) { - if (judgement.AffectsCombo) + if (!judgement.IsBonus) Health.Value -= hpDrainRate * (harshness * 2); return; } From 785c24b11ba650440c42938a9bd50dcd7a921281 Mon Sep 17 00:00:00 2001 From: clayton Date: Mon, 11 Jun 2018 13:30:30 -0700 Subject: [PATCH 20/61] Check for null CatchJudgement --- osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 3e548de2cf..dfe8bba184 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -69,9 +69,8 @@ namespace osu.Game.Rulesets.Catch.Scoring return; } - var catchJudgement = judgement as CatchJudgement; - - Health.Value += Math.Max(catchJudgement.HealthIncrease - hpDrainRate, 0) * harshness; + if (judgement is CatchJudgement catchJudgement) + Health.Value += Math.Max(catchJudgement.HealthIncrease - hpDrainRate, 0) * harshness; } } } From f0fbc04d92cbafae7a9a71a8f017cc4794448978 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 15 Jun 2018 14:11:21 +0200 Subject: [PATCH 21/61] Adjust formats to be EN-UK --- osu.Game/Graphics/DrawableDate.cs | 2 +- osu.Game/Graphics/DrawableJoinDate.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index df6aa72c37..d846ccbc4a 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -62,6 +62,6 @@ namespace osu.Game.Graphics private void updateTime() => Format(); - public virtual string TooltipText => string.Format($"{date:d MMMM yyyy H:mm \"UTC\"z}"); + public virtual string TooltipText => string.Format($"{date:MMMM d, yyyy h:mm tt \"UTC\"z}"); } } diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs index 713bd4e44f..46de28be8a 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -16,6 +16,6 @@ namespace osu.Game.Graphics protected override string Format() => Text = string.Format($"{date:MMMM yyyy}"); - public override string TooltipText => string.Format($"{date:d MMMM yyyy}"); + public override string TooltipText => string.Format($"{date:MMMM d, yyyy}"); } } From d122547c1ea1c97d9e9b2bc9312784fe37c74ad4 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 15 Jun 2018 14:28:49 +0200 Subject: [PATCH 22/61] DrawableJoinDate handles "Here since the beginning" text --- osu.Game/Graphics/DrawableJoinDate.cs | 4 +++- osu.Game/Overlays/Profile/ProfileHeader.cs | 9 +++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs index 46de28be8a..763aea60ba 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -14,7 +14,9 @@ namespace osu.Game.Graphics this.date = date; } - protected override string Format() => Text = string.Format($"{date:MMMM yyyy}"); + protected override string Format() => Text = date.ToUniversalTime().Year < 2008 ? + "Here since the beginning" : + string.Format($"{date:MMMM yyyy}"); public override string TooltipText => string.Format($"{date:MMMM d, yyyy}"); } diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 996c6384c9..43482c147f 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -357,16 +357,13 @@ namespace osu.Game.Overlays.Profile infoTextLeft.NewParagraph(); - if (user.JoinDate.ToUniversalTime().Year < 2008) - { - infoTextLeft.AddText("Here since the beginning", boldItalic); - } - else + if (user.JoinDate.ToUniversalTime().Year >= 2008) { infoTextLeft.AddText("Joined ", lightText); - infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); } + infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); + infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); From 38feb7651cf32af4e323eb190dd40b84b8c24532 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 15 Jun 2018 14:34:01 +0200 Subject: [PATCH 23/61] Set text at updateTime --- osu.Game/Graphics/DrawableDate.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index d846ccbc4a..b725f46e76 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -58,9 +58,9 @@ namespace osu.Game.Graphics public override bool HandleMouseInput => true; - protected virtual string Format() => Text = date.Humanize(); + protected virtual string Format() => date.Humanize(); - private void updateTime() => Format(); + private void updateTime() => Text = Format(); public virtual string TooltipText => string.Format($"{date:MMMM d, yyyy h:mm tt \"UTC\"z}"); } From 6938adc148c9a99e8fbc8e2a1399e4600cc6f15e Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 15 Jun 2018 15:00:41 +0200 Subject: [PATCH 24/61] Unify join time text's visual format with the web --- osu.Game/Overlays/Profile/ProfileHeader.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 43482c147f..29873b5a6a 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -357,12 +357,16 @@ namespace osu.Game.Overlays.Profile infoTextLeft.NewParagraph(); - if (user.JoinDate.ToUniversalTime().Year >= 2008) + if (user.JoinDate.ToUniversalTime().Year < 2008) + { + infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), lightText); + } + else { infoTextLeft.AddText("Joined ", lightText); + infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); } - infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); From faff7feef1e5491c07903935e9380d3cf735a135 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 15 Jun 2018 15:03:09 +0200 Subject: [PATCH 25/61] Remove unnecessary white space change --- osu.Game/Overlays/Profile/ProfileHeader.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 29873b5a6a..0db145f64a 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -367,7 +367,6 @@ namespace osu.Game.Overlays.Profile infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); } - infoTextLeft.NewLine(); infoTextLeft.AddText("Last seen ", lightText); infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); From a2fa55c4267f783459b855a58457ef77828a1eb8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Jun 2018 16:47:05 +0900 Subject: [PATCH 26/61] Fix dialog overlay playing double samples on show/hide --- .../Containers/OsuFocusedOverlayContainer.cs | 12 ++++++++---- osu.Game/Overlays/DialogOverlay.cs | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 0528f7b3ae..e270b5efbe 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -17,6 +17,8 @@ namespace osu.Game.Graphics.Containers private SampleChannel samplePopIn; private SampleChannel samplePopOut; + protected virtual bool PlaySamplesOnStateChange => true; + protected readonly Bindable OverlayActivationMode = new Bindable(OverlayActivation.All); [BackgroundDependencyLoader(true)] @@ -28,7 +30,7 @@ namespace osu.Game.Graphics.Containers samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in"); samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out"); - StateChanged += onStateChanged; + StateChanged += OnStateChanged; } /// @@ -51,18 +53,20 @@ namespace osu.Game.Graphics.Containers return base.OnClick(state); } - private void onStateChanged(Visibility visibility) + protected virtual void OnStateChanged(Visibility visibility) { switch (visibility) { case Visibility.Visible: if (OverlayActivationMode != OverlayActivation.Disabled) - samplePopIn?.Play(); + { + if (PlaySamplesOnStateChange) samplePopIn?.Play(); + } else State = Visibility.Hidden; break; case Visibility.Hidden: - samplePopOut?.Play(); + if (PlaySamplesOnStateChange) samplePopOut?.Play(); break; } } diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 7caab0dd6c..e26a3cba2f 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -30,6 +30,8 @@ namespace osu.Game.Overlays State = Visibility.Visible; } + protected override bool PlaySamplesOnStateChange => false; + private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v) { if (v != Visibility.Hidden) return; From eb6d6dc2de675c03b58a7ee5f538890ce019f95e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Jun 2018 12:30:40 +0900 Subject: [PATCH 27/61] Improve the visibility of the global loading animation Updates design to match new `osu-web` design. Adds TestCase for visual testing. --- .../Visual/TestCaseLoadingAnimation.cs | 63 +++++++++++++++++++ .../UserInterface/LoadingAnimation.cs | 27 ++++++-- 2 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs diff --git a/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs b/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs new file mode 100644 index 0000000000..ebbc673d36 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs @@ -0,0 +1,63 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Testing; +using osu.Game.Graphics.UserInterface; +using OpenTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseLoadingAnimation : GridTestCase + { + public TestCaseLoadingAnimation() + : base(2, 2) + { + LoadingAnimation loading; + + Cell(0).AddRange(new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both + }, + loading = new LoadingAnimation() + }); + + loading.Show(); + + Cell(1).AddRange(new Drawable[] + { + new Box + { + Colour = Color4.White, + RelativeSizeAxes = Axes.Both + }, + loading = new LoadingAnimation() + }); + + loading.Show(); + + Cell(2).AddRange(new Drawable[] + { + new Box + { + Colour = Color4.Gray, + RelativeSizeAxes = Axes.Both + }, + loading = new LoadingAnimation() + }); + + loading.Show(); + + Cell(3).AddRange(new Drawable[] + { + loading = new LoadingAnimation() + }); + + Scheduler.AddDelayed(() => loading.ToggleVisibility(), 200, true); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index 5ea6bce432..3d6c0a54d3 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -4,12 +4,17 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { public class LoadingAnimation : VisibilityContainer { private readonly SpriteIcon spinner; + private readonly SpriteIcon spinnerShadow; + + private const float spin_duration = 600; + private const float transition_duration = 200; public LoadingAnimation() { @@ -20,12 +25,22 @@ namespace osu.Game.Graphics.UserInterface Children = new Drawable[] { - spinner = new SpriteIcon + spinnerShadow = new SpriteIcon { - Size = new Vector2(20), + RelativeSizeAxes = Axes.Both, + Position = new Vector2(1, 1), Anchor = Anchor.Centre, Origin = Anchor.Centre, - Icon = FontAwesome.fa_spinner + Colour = Color4.Black, + Alpha = 0.4f, + Icon = FontAwesome.fa_circle_o_notch + }, + spinner = new SpriteIcon + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_circle_o_notch } }; } @@ -34,12 +49,12 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - spinner.Spin(2000, RotationDirection.Clockwise); + spinner.Spin(spin_duration, RotationDirection.Clockwise); + spinnerShadow.Spin(spin_duration, RotationDirection.Clockwise); } - private const float transition_duration = 500; - protected override void PopIn() => this.FadeIn(transition_duration * 5, Easing.OutQuint); + protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint); protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint); } From 3824354cb8797ff4d039ca8501a48aa31e7fa55f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Jun 2018 14:26:24 +0900 Subject: [PATCH 28/61] Lengthen PopIn transition slightly --- osu.Game/Graphics/UserInterface/LoadingAnimation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index 3d6c0a54d3..cd4aef051d 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -54,7 +54,7 @@ namespace osu.Game.Graphics.UserInterface } - protected override void PopIn() => this.FadeIn(transition_duration, Easing.OutQuint); + protected override void PopIn() => this.FadeIn(transition_duration * 2, Easing.OutQuint); protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint); } From 51600dd0ae7d25e8dfacd2ac64688ff002f72349 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Jun 2018 14:27:36 +0900 Subject: [PATCH 29/61] Improve PlayButton's loading --- osu.Game/Overlays/Direct/PlayButton.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 4b91a3d700..28cc484109 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -10,6 +10,7 @@ using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Overlays.Direct @@ -48,9 +49,15 @@ namespace osu.Game.Overlays.Direct set { if (value) + { + icon.FadeTo(0.5f, transition_duration, Easing.OutQuint); loadingAnimation.Show(); + } else + { + icon.FadeTo(1, transition_duration, Easing.OutQuint); loadingAnimation.Hide(); + } } } @@ -67,7 +74,10 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.Both, Icon = FontAwesome.fa_play, }, - loadingAnimation = new LoadingAnimation(), + loadingAnimation = new LoadingAnimation + { + Size = new Vector2(15), + }, }); Playing.ValueChanged += playingStateChanged; From f8acd9e4512dd5ec1efe7c62660517d55451c25b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Jun 2018 12:59:19 +0900 Subject: [PATCH 30/61] Cleanup --- osu.Game/Graphics/UserInterface/LoadingAnimation.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs index cd4aef051d..8d45b03a43 100644 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs @@ -27,19 +27,19 @@ namespace osu.Game.Graphics.UserInterface { spinnerShadow = new SpriteIcon { - RelativeSizeAxes = Axes.Both, - Position = new Vector2(1, 1), Anchor = Anchor.Centre, Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Position = new Vector2(1, 1), Colour = Color4.Black, Alpha = 0.4f, Icon = FontAwesome.fa_circle_o_notch }, spinner = new SpriteIcon { - RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, Icon = FontAwesome.fa_circle_o_notch } }; @@ -53,7 +53,6 @@ namespace osu.Game.Graphics.UserInterface spinnerShadow.Spin(spin_duration, RotationDirection.Clockwise); } - protected override void PopIn() => this.FadeIn(transition_duration * 2, Easing.OutQuint); protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint); From b88c4464cb7eee25ae7c6791b881df7ba192f898 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Jun 2018 16:02:49 +0900 Subject: [PATCH 31/61] Make virtual beatmap tracks approximate beatmap length --- .../Beatmaps/BeatmapManager_WorkingBeatmap.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 4 +- .../WorkingBeatmap_VirtualBeatmapTrack.cs | 46 +++++++++++++++++++ .../Timelines/Summary/Parts/MarkerPart.cs | 2 - .../Timelines/Summary/Parts/TimelinePart.cs | 3 +- .../Edit/Screens/Compose/Timeline/Timeline.cs | 10 ++-- 6 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs index 71406c6034..d086064425 100644 --- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs @@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps } catch { - return new TrackVirtual(); + return null; } } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 9b50aed077..1a65611a3d 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -19,7 +19,7 @@ using osu.Game.Skinning; namespace osu.Game.Beatmaps { - public abstract class WorkingBeatmap : IDisposable + public abstract partial class WorkingBeatmap : IDisposable { public readonly BeatmapInfo BeatmapInfo; @@ -145,7 +145,7 @@ namespace osu.Game.Beatmaps private Track populateTrack() { // we want to ensure that we always have a track, even if it's a fake one. - var t = GetTrack() ?? new TrackVirtual(); + var t = GetTrack() ?? new VirtualBeatmapTrack(Beatmap); applyRateAdjustments(t); return t; } diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs new file mode 100644 index 0000000000..1cadf9ee90 --- /dev/null +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Framework.Audio.Track; +using osu.Game.Rulesets.Objects.Types; + +namespace osu.Game.Beatmaps +{ + public partial class WorkingBeatmap + { + private class VirtualBeatmapTrack : TrackVirtual + { + private readonly IBeatmap beatmap; + + public VirtualBeatmapTrack(IBeatmap beatmap) + { + this.beatmap = beatmap; + } + + protected override void UpdateState() + { + updateVirtualLength(); + base.UpdateState(); + } + + private void updateVirtualLength() + { + var lastObject = beatmap.HitObjects.LastOrDefault(); + + switch (lastObject) + { + case null: + Length = 1000; + break; + case IHasEndTime endTime: + Length = endTime.EndTime + 1000; + break; + default: + Length = lastObject.StartTime + 1000; + break; + } + } + } + } +} diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index d1fc8be005..0dc110951b 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -52,8 +52,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts if (Beatmap.Value == null) return; - if (Beatmap.Value.Track.Length == double.PositiveInfinity) return; - float markerPos = MathHelper.Clamp(ToLocalSpace(screenPosition).X, 0, DrawWidth); adjustableClock.Seek(markerPos / DrawWidth * Beatmap.Value.Track.Length); } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs index 07d9398d38..5628630d0e 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs @@ -47,8 +47,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts return; } - // Todo: This should be handled more gracefully - timeline.RelativeChildSize = Beatmap.Value.Track.Length == double.PositiveInfinity ? Vector2.One : new Vector2((float)Math.Max(1, Beatmap.Value.Track.Length), 1); + timeline.RelativeChildSize = new Vector2((float)Math.Max(1, Beatmap.Value.Track.Length), 1); } protected void Add(Drawable visualisation) => timeline.Add(visualisation); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index e6a04bf1e7..d9b827ffec 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -118,18 +117,15 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline private void seekTrackToCurrent() { - var track = Beatmap.Value.Track; - if (track is TrackVirtual || !track.IsLoaded) + if (!Beatmap.Value.TrackLoaded) return; - if (!(Beatmap.Value.Track is TrackVirtual)) - adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length); + adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length); } private void scrollToTrackTime() { - var track = Beatmap.Value.Track; - if (track is TrackVirtual || !track.IsLoaded) + if (!Beatmap.Value.TrackLoaded) return; ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false); From b4b28f8ae805bdb520420cb9ebf49909a50aa5bc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Jun 2018 16:07:18 +0900 Subject: [PATCH 32/61] Make GetWaveform() not hard bail if errors occur --- osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs index d086064425..43ae30f780 100644 --- a/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/BeatmapManager_WorkingBeatmap.cs @@ -73,7 +73,18 @@ namespace osu.Game.Beatmaps } } - protected override Waveform GetWaveform() => new Waveform(store.GetStream(getPathForFile(Metadata.AudioFile))); + protected override Waveform GetWaveform() + { + try + { + var trackData = store.GetStream(getPathForFile(Metadata.AudioFile)); + return trackData == null ? null : new Waveform(trackData); + } + catch + { + return null; + } + } protected override Storyboard GetStoryboard() { From 5640385f480c6bdbca0ba1bbb0fc030c1a552c60 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Jun 2018 16:12:49 +0900 Subject: [PATCH 33/61] Update the length once during construction --- osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs index 1cadf9ee90..fb3c0027f7 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -9,6 +9,9 @@ namespace osu.Game.Beatmaps { public partial class WorkingBeatmap { + /// + /// A type of which provides a valid length based on the s of an . + /// private class VirtualBeatmapTrack : TrackVirtual { private readonly IBeatmap beatmap; @@ -16,6 +19,7 @@ namespace osu.Game.Beatmaps public VirtualBeatmapTrack(IBeatmap beatmap) { this.beatmap = beatmap; + updateVirtualLength(); } protected override void UpdateState() From e197ebe4c52a91cd9ff58a7cdbc367172efae2c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 01:55:09 +0900 Subject: [PATCH 34/61] Fix slider heads displaying in incorrect colour --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index dfab123038..678ecd8461 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -93,6 +93,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables base.AccentColour = value; Body.AccentColour = AccentColour; Ball.AccentColour = AccentColour; + foreach (var drawableHitObject in NestedHitObjects) + drawableHitObject.AccentColour = AccentColour; } } From 8518fce4a9e3a636931dc0f5cfaf72e4ffa43f03 Mon Sep 17 00:00:00 2001 From: Joehu Date: Wed, 27 Jun 2018 17:57:55 -0700 Subject: [PATCH 35/61] Fix osu!supporter naming --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- .../Profile/Sections/Recent/DrawableRecentActivity.cs | 4 ++-- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 50428cc5e6..e488dacf80 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -138,7 +138,7 @@ namespace osu.Game.Beatmaps PostNotification?.Invoke(new SimpleNotification { Icon = FontAwesome.fa_superpowers, - Text = "You gotta be a supporter to download for now 'yo" + Text = "You gotta be an osu!supporter to download for now 'yo" }); return; } diff --git a/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs b/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs index 046c1b1a33..fefb289d17 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs @@ -141,11 +141,11 @@ namespace osu.Game.Overlays.Profile.Sections.Recent break; case RecentActivityType.UserSupportFirst: - message = $"{userLinkTemplate()} has become an osu! supporter - thanks for your generosity!"; + message = $"{userLinkTemplate()} has become an osu!supporter - thanks for your generosity!"; break; case RecentActivityType.UserSupportGift: - message = $"{userLinkTemplate()} has received the gift of osu! supporter!"; + message = $"{userLinkTemplate()} has received the gift of osu!supporter!"; break; case RecentActivityType.UsernameChange: diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 9dae8fb273..cfb7104e16 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -146,7 +146,7 @@ namespace osu.Game.Screens.Select.Leaderboards replacePlaceholder(new MessagePlaceholder(@"Please sign in to view online leaderboards!")); break; case PlaceholderState.NotSupporter: - replacePlaceholder(new MessagePlaceholder(@"Please invest in a supporter tag to view this leaderboard!")); + replacePlaceholder(new MessagePlaceholder(@"Please invest in an osu!supporter tag to view this leaderboard!")); break; default: replacePlaceholder(null); From 5ad122bfec900566a9d3ec1ad5f910d5e77c3528 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 10:28:35 +0900 Subject: [PATCH 36/61] Fix beatmaps importing with -1 as online set ID --- osu.Game/Beatmaps/BeatmapSetInfo.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index ed8fbdbb26..ebebe42097 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -13,7 +13,13 @@ namespace osu.Game.Beatmaps [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ID { get; set; } - public int? OnlineBeatmapSetID { get; set; } + private int? onlineBeatmapSetID; + + public int? OnlineBeatmapSetID + { + get { return onlineBeatmapSetID; } + set { onlineBeatmapSetID = value > 0 ? value : null; } + } public BeatmapMetadata Metadata { get; set; } From ac7ee59d50f133f8ec4b49d464b4bb0c0c63fb96 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 10:48:01 +0900 Subject: [PATCH 37/61] Add migration for previous incorrectly imported beatmaps --- ...628011956_RemoveNegativeSetIDs.Designer.cs | 376 ++++++++++++++++++ .../20180628011956_RemoveNegativeSetIDs.cs | 19 + 2 files changed, 395 insertions(+) create mode 100644 osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs create mode 100644 osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs new file mode 100644 index 0000000000..7eeacd56d7 --- /dev/null +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.Designer.cs @@ -0,0 +1,376 @@ +// +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("20180628011956_RemoveNegativeSetIDs")] + partial class RemoveNegativeSetIDs + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.1-rtm-30846"); + + 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("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.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/20180628011956_RemoveNegativeSetIDs.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs new file mode 100644 index 0000000000..c52288e598 --- /dev/null +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs @@ -0,0 +1,19 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class RemoveNegativeSetIDs : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + // There was a change that baetmaps were being loaded with "-1" online IDs, which is completely incorrect. + // This ensures there will not be unique key conflicts as a result of these incorrectly imported beatmaps. + migrationBuilder.Sql("UPDATE BeatmapSetInfo SET OnlineBeatmapSetID = null WHERE OnlineBeatmapSetID < 0"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} From c0c94e24b9e5172f693b57514b6120dd3274b641 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 11:45:48 +0900 Subject: [PATCH 38/61] Use VirtualBeatmapTrack in testcases --- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- .../WorkingBeatmap_VirtualBeatmapTrack.cs | 2 +- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 19 +------------------ 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 265c6832b2..25a76b52a7 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4"); - protected override Track GetTrack() => new TrackVirtual(); + protected override Track GetTrack() => new TrackVirtual { Length = 1000 }; private class DummyRulesetInfo : RulesetInfo { diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs index fb3c0027f7..b3b3562dc4 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps /// /// A type of which provides a valid length based on the s of an . /// - private class VirtualBeatmapTrack : TrackVirtual + protected class VirtualBeatmapTrack : TrackVirtual { private readonly IBeatmap beatmap; diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index 37693c99e8..2f5c887726 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -1,12 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; using osu.Game.Rulesets; -using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Tests.Beatmaps { @@ -26,21 +24,6 @@ namespace osu.Game.Tests.Beatmaps private readonly IBeatmap beatmap; protected override IBeatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; - - protected override Track GetTrack() - { - var lastObject = beatmap.HitObjects.LastOrDefault(); - if (lastObject != null) - return new TestTrack(((lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime) + 1000); - return new TrackVirtual(); - } - - private class TestTrack : TrackVirtual - { - public TestTrack(double length) - { - Length = length; - } - } + protected override Track GetTrack() => null; } } From 87e8074cd267f9f8676fa7f7f5ecc18ae3a56029 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 11:46:56 +0900 Subject: [PATCH 39/61] Use a const for excess length --- osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs index b3b3562dc4..4c37c0c4a0 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -14,6 +14,8 @@ namespace osu.Game.Beatmaps /// protected class VirtualBeatmapTrack : TrackVirtual { + private const double excess_length = 1000; + private readonly IBeatmap beatmap; public VirtualBeatmapTrack(IBeatmap beatmap) @@ -35,13 +37,13 @@ namespace osu.Game.Beatmaps switch (lastObject) { case null: - Length = 1000; + Length = excess_length; break; case IHasEndTime endTime: - Length = endTime.EndTime + 1000; + Length = endTime.EndTime + excess_length; break; default: - Length = lastObject.StartTime + 1000; + Length = lastObject.StartTime + excess_length; break; } } From 2f2bd59844e65fa6a57ab05d81dc39907a3aeb23 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 11:47:41 +0900 Subject: [PATCH 40/61] Remove editor functionality from VirtualBeatmapTrack /shrug --- .../Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs index 4c37c0c4a0..0e0a9a3bb9 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -16,21 +16,7 @@ namespace osu.Game.Beatmaps { private const double excess_length = 1000; - private readonly IBeatmap beatmap; - public VirtualBeatmapTrack(IBeatmap beatmap) - { - this.beatmap = beatmap; - updateVirtualLength(); - } - - protected override void UpdateState() - { - updateVirtualLength(); - base.UpdateState(); - } - - private void updateVirtualLength() { var lastObject = beatmap.HitObjects.LastOrDefault(); From 01b90aaffe7affde478e989d15c0542d0fec06a7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 11:58:06 +0900 Subject: [PATCH 41/61] Fix CI not passing --- osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index d9b827ffec..28239533c8 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -117,7 +117,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline private void seekTrackToCurrent() { - if (!Beatmap.Value.TrackLoaded) + if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.Track.IsLoaded) return; adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length); @@ -125,7 +125,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline private void scrollToTrackTime() { - if (!Beatmap.Value.TrackLoaded) + if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.Track.IsLoaded) return; ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false); From c44a81bdf569be9b793c6f649a6c90b4aac6509a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 13:04:39 +0900 Subject: [PATCH 42/61] Add word wrap support --- osu.Game.Tests/Visual/TestCaseLeaderboard.cs | 8 +++++ .../Containers/OsuTextFlowContainer.cs | 3 ++ .../Select/Leaderboards/Leaderboard.cs | 19 ------------ .../Select/Leaderboards/LeaderboardScope.cs | 10 ++++++ .../Select/Leaderboards/MessagePlaceholder.cs | 24 ++++---------- .../Select/Leaderboards/Placeholder.cs | 15 +++++++-- .../Select/Leaderboards/PlaceholderState.cs | 13 ++++++++ .../RetrievalFailurePlaceholder.cs | 31 ++++++------------- 8 files changed, 62 insertions(+), 61 deletions(-) create mode 100644 osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs create mode 100644 osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs diff --git a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs index 7f5bce3b84..e8ac19e7fc 100644 --- a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs +++ b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Graphics; using osu.Game.Rulesets.Scoring; @@ -17,6 +19,12 @@ namespace osu.Game.Tests.Visual [Description("PlaySongSelect leaderboard")] public class TestCaseLeaderboard : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] { + typeof(Placeholder), + typeof(MessagePlaceholder), + typeof(RetrievalFailurePlaceholder), + }; + private RulesetStore rulesets; private readonly FailableLeaderboard leaderboard; diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs index 119af4d762..e77e075fe2 100644 --- a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; @@ -16,6 +17,8 @@ namespace osu.Game.Graphics.Containers protected override SpriteText CreateSpriteText() => new OsuSpriteText(); + public void AddArbitraryDrawable(Drawable drawable) => AddInternal(drawable); + public void AddIcon(FontAwesome icon, Action creationParameters = null) => AddText(((char)icon).ToString(), creationParameters); } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index cfb7104e16..9eca3802ae 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -331,23 +331,4 @@ namespace osu.Game.Screens.Select.Leaderboards } } } - - public enum LeaderboardScope - { - Local, - Country, - Global, - Friend, - } - - public enum PlaceholderState - { - Successful, - Retrieving, - NetworkFailure, - Unavailable, - NoScores, - NotLoggedIn, - NotSupporter, - } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs new file mode 100644 index 0000000000..4280f85473 --- /dev/null +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs @@ -0,0 +1,10 @@ +namespace osu.Game.Screens.Select.Leaderboards +{ + public enum LeaderboardScope + { + Local, + Country, + Global, + Friend, + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/Leaderboards/MessagePlaceholder.cs b/osu.Game/Screens/Select/Leaderboards/MessagePlaceholder.cs index ac2ac818d8..f01a55b662 100644 --- a/osu.Game/Screens/Select/Leaderboards/MessagePlaceholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/MessagePlaceholder.cs @@ -2,10 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using OpenTK; namespace osu.Game.Screens.Select.Leaderboards { @@ -15,22 +12,13 @@ namespace osu.Game.Screens.Select.Leaderboards public MessagePlaceholder(string message) { - Direction = FillDirection.Horizontal; - AutoSizeAxes = Axes.Both; - Children = new Drawable[] + AddIcon(FontAwesome.fa_exclamation_circle, cp => { - new SpriteIcon - { - Icon = FontAwesome.fa_exclamation_circle, - Size = new Vector2(26), - Margin = new MarginPadding { Right = 10 }, - }, - new OsuSpriteText - { - Text = this.message = message, - TextSize = 22, - }, - }; + cp.TextSize = TEXT_SIZE; + cp.Padding = new MarginPadding { Right = 10 }; + }); + + AddText(this.message = message); } public override bool Equals(Placeholder other) => (other as MessagePlaceholder)?.message == message; diff --git a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs index c56d279e6c..307986a299 100644 --- a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs @@ -3,16 +3,27 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select.Leaderboards { - public abstract class Placeholder : FillFlowContainer, IEquatable + public abstract class Placeholder : OsuTextFlowContainer, IEquatable { + protected const float TEXT_SIZE = 22; + + public override bool HandleMouseInput => true; + protected Placeholder() + : base(cp => cp.TextSize = TEXT_SIZE) { Anchor = Anchor.Centre; Origin = Anchor.Centre; + TextAnchor = Anchor.TopCentre; + + Padding = new MarginPadding(20); + + AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.X; } public virtual bool Equals(Placeholder other) => GetType() == other?.GetType(); diff --git a/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs b/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs new file mode 100644 index 0000000000..e98e094a96 --- /dev/null +++ b/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs @@ -0,0 +1,13 @@ +namespace osu.Game.Screens.Select.Leaderboards +{ + public enum PlaceholderState + { + Successful, + Retrieving, + NetworkFailure, + Unavailable, + NoScores, + NotLoggedIn, + NotSupporter, + } +} \ No newline at end of file diff --git a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs index 174fbac120..99b0c53835 100644 --- a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs @@ -3,11 +3,9 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; using OpenTK; namespace osu.Game.Screens.Select.Leaderboards @@ -18,22 +16,13 @@ namespace osu.Game.Screens.Select.Leaderboards public RetrievalFailurePlaceholder() { - Direction = FillDirection.Horizontal; - AutoSizeAxes = Axes.Both; - Children = new Drawable[] + AddArbitraryDrawable(new RetryButton { - new RetryButton - { - Action = () => OnRetry?.Invoke(), - Margin = new MarginPadding { Right = 10 }, - }, - new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Text = @"Couldn't retrieve scores!", - TextSize = 22, - }, - }; + Action = () => OnRetry?.Invoke(), + Padding = new MarginPadding { Right = 10 } + }); + + AddText(@"Couldn't retrieve scores!"); } public class RetryButton : OsuHoverContainer @@ -44,18 +33,16 @@ namespace osu.Game.Screens.Select.Leaderboards public RetryButton() { - Height = 26; - Width = 26; + AutoSizeAxes = Axes.Both; + Child = new OsuClickableContainer { AutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, Action = () => Action?.Invoke(), Child = icon = new SpriteIcon { Icon = FontAwesome.fa_refresh, - Size = new Vector2(26), + Size = new Vector2(TEXT_SIZE), Shadow = true, }, }; From 3b0c4ff16b39a93b8dbe842aca781178ded7dbb9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 14:08:15 +0900 Subject: [PATCH 43/61] Tidy code --- .../Edit/Screens/Compose/Timeline/Timeline.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index 28239533c8..8cb0fdd908 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -51,13 +52,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint); Beatmap.BindTo(beatmap); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - Beatmap.BindValueChanged(b => waveform.Waveform = b.Waveform); - waveform.Waveform = Beatmap.Value.Waveform; + Beatmap.BindValueChanged(b => + { + waveform.Waveform = b.Waveform; + track = b.Track; + }, true); } /// @@ -80,6 +79,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline /// private bool trackWasPlaying; + private Track track; + protected override void Update() { base.Update(); @@ -117,18 +118,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline private void seekTrackToCurrent() { - if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.Track.IsLoaded) + if (!track.IsLoaded) return; - adjustableClock.Seek(Current / Content.DrawWidth * Beatmap.Value.Track.Length); + adjustableClock.Seek(Current / Content.DrawWidth * track.Length); } private void scrollToTrackTime() { - if (!Beatmap.Value.TrackLoaded || !Beatmap.Value.Track.IsLoaded) + if (!track.IsLoaded) return; - ScrollTo((float)(adjustableClock.CurrentTime / Beatmap.Value.Track.Length) * Content.DrawWidth, false); + ScrollTo((float)(adjustableClock.CurrentTime / track.Length) * Content.DrawWidth, false); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From b1a3f012125a57be44cf3cd3ae2e096a6cab8458 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 16:36:42 +0900 Subject: [PATCH 44/61] Fix mania maps not being treated as mania maps in release builds --- osu.Game/Rulesets/RulesetStore.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 8d267f48e9..a7a9fea5f2 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -84,10 +84,11 @@ namespace osu.Game.Rulesets { try { - var instance = r.CreateInstance(); + var instanceInfo = ((Ruleset)Activator.CreateInstance(Type.GetType(r.InstantiationInfo), (RulesetInfo)null)).RulesetInfo; - r.Name = instance.Description; - r.ShortName = instance.ShortName; + r.Name = instanceInfo.Name; + r.ShortName = instanceInfo.ShortName; + r.InstantiationInfo = instanceInfo.InstantiationInfo; r.Available = true; } From a377e87bf61c2b4fe33ee715db7fa489c9674ceb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 17:34:04 +0900 Subject: [PATCH 45/61] Add missing licence headers --- osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs | 7 +++++-- osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs index 4280f85473..761f53a5e8 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScope.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Screens.Select.Leaderboards +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Select.Leaderboards { public enum LeaderboardScope { @@ -7,4 +10,4 @@ Global, Friend, } -} \ No newline at end of file +} diff --git a/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs b/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs index e98e094a96..33a56540f3 100644 --- a/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs +++ b/osu.Game/Screens/Select/Leaderboards/PlaceholderState.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Screens.Select.Leaderboards +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Select.Leaderboards { public enum PlaceholderState { @@ -10,4 +13,4 @@ NotLoggedIn, NotSupporter, } -} \ No newline at end of file +} From 0ef5b8f464697d6bed9648acbeab67b2f3f0c4b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 19:19:00 +0900 Subject: [PATCH 46/61] Tidy up code, remove unnecessary string.Formats --- osu.Game/Graphics/DrawableDate.cs | 10 +++++----- osu.Game/Graphics/DrawableJoinDate.cs | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index b725f46e76..cf0a0fee37 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -12,14 +12,14 @@ namespace osu.Game.Graphics { public class DrawableDate : OsuSpriteText, IHasTooltip { - private readonly DateTimeOffset date; + protected readonly DateTimeOffset Date; public DrawableDate(DateTimeOffset date) { AutoSizeAxes = Axes.Both; Font = "Exo2.0-RegularItalic"; - this.date = date.ToLocalTime(); + this.Date = date.ToLocalTime(); } [BackgroundDependencyLoader] @@ -38,7 +38,7 @@ namespace osu.Game.Graphics { updateTime(); - var diffToNow = DateTimeOffset.Now.Subtract(date); + var diffToNow = DateTimeOffset.Now.Subtract(Date); double timeUntilNextUpdate = 1000; if (diffToNow.TotalSeconds > 60) @@ -58,10 +58,10 @@ namespace osu.Game.Graphics public override bool HandleMouseInput => true; - protected virtual string Format() => date.Humanize(); + protected virtual string Format() => Date.Humanize(); private void updateTime() => Text = Format(); - public virtual string TooltipText => string.Format($"{date:MMMM d, yyyy h:mm tt \"UTC\"z}"); + public virtual string TooltipText => string.Format($"{Date:MMMM d, yyyy h:mm tt \"UTC\"z}"); } } diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Graphics/DrawableJoinDate.cs index 763aea60ba..a0d28406d3 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Graphics/DrawableJoinDate.cs @@ -7,17 +7,13 @@ namespace osu.Game.Graphics { public class DrawableJoinDate : DrawableDate { - private readonly DateTimeOffset date; - - public DrawableJoinDate(DateTimeOffset date) : base(date) + public DrawableJoinDate(DateTimeOffset date) + : base(date) { - this.date = date; } - protected override string Format() => Text = date.ToUniversalTime().Year < 2008 ? - "Here since the beginning" : - string.Format($"{date:MMMM yyyy}"); + protected override string Format() => Text = Date.ToUniversalTime().Year < 2008 ? "Here since the beginning" : $"{Date:MMMM yyyy}"; - public override string TooltipText => string.Format($"{date:MMMM d, yyyy}"); + public override string TooltipText => $"{Date:MMMM d, yyyy}"; } } From 8ba2ac922f42d95b98d60b28cd5454eda674558d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 19:23:56 +0900 Subject: [PATCH 47/61] Move to local components namespace --- osu.Game/Graphics/DrawableDate.cs | 2 +- .../Profile/Components}/DrawableJoinDate.cs | 3 +- .../Overlays/Profile/Components/GradeBadge.cs | 50 +++++++++++++++++++ osu.Game/Overlays/Profile/ProfileHeader.cs | 39 +-------------- 4 files changed, 54 insertions(+), 40 deletions(-) rename osu.Game/{Graphics => Overlays/Profile/Components}/DrawableJoinDate.cs (88%) create mode 100644 osu.Game/Overlays/Profile/Components/GradeBadge.cs diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index cf0a0fee37..406fc2ffd2 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics AutoSizeAxes = Axes.Both; Font = "Exo2.0-RegularItalic"; - this.Date = date.ToLocalTime(); + Date = date.ToLocalTime(); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/DrawableJoinDate.cs b/osu.Game/Overlays/Profile/Components/DrawableJoinDate.cs similarity index 88% rename from osu.Game/Graphics/DrawableJoinDate.cs rename to osu.Game/Overlays/Profile/Components/DrawableJoinDate.cs index a0d28406d3..11ee329f33 100644 --- a/osu.Game/Graphics/DrawableJoinDate.cs +++ b/osu.Game/Overlays/Profile/Components/DrawableJoinDate.cs @@ -2,8 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using osu.Game.Graphics; -namespace osu.Game.Graphics +namespace osu.Game.Overlays.Profile.Components { public class DrawableJoinDate : DrawableDate { diff --git a/osu.Game/Overlays/Profile/Components/GradeBadge.cs b/osu.Game/Overlays/Profile/Components/GradeBadge.cs new file mode 100644 index 0000000000..14a47e8d03 --- /dev/null +++ b/osu.Game/Overlays/Profile/Components/GradeBadge.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Overlays.Profile.Components +{ + public class GradeBadge : Container + { + private const float width = 50; + private readonly string grade; + private readonly Sprite badge; + private readonly SpriteText numberText; + + public int DisplayCount + { + set => numberText.Text = value.ToString(@"#,0"); + } + + public GradeBadge(string grade) + { + this.grade = grade; + Width = width; + Height = 41; + Add(badge = new Sprite + { + Width = width, + Height = 26 + }); + Add(numberText = new OsuSpriteText + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + TextSize = 14, + Font = @"Exo2.0-Bold" + }); + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + badge.Texture = textures.Get($"Grades/{grade}"); + } + } +} diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 47763d4773..c72ff6131b 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -16,6 +16,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Profile.Components; using osu.Game.Overlays.Profile.Header; using osu.Game.Users; @@ -470,43 +471,5 @@ namespace osu.Game.Overlays.Profile infoTextRight.NewLine(); } - - private class GradeBadge : Container - { - private const float width = 50; - private readonly string grade; - private readonly Sprite badge; - private readonly SpriteText numberText; - - public int DisplayCount - { - set { numberText.Text = value.ToString(@"#,0"); } - } - - public GradeBadge(string grade) - { - this.grade = grade; - Width = width; - Height = 41; - Add(badge = new Sprite - { - Width = width, - Height = 26 - }); - Add(numberText = new OsuSpriteText - { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - TextSize = 14, - Font = @"Exo2.0-Bold" - }); - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - badge.Texture = textures.Get($"Grades/{grade}"); - } - } } } From 0a945e47092f9b48517ee35a4f4c0cd16b7705bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Jun 2018 22:44:40 +0900 Subject: [PATCH 48/61] Check whether initialised first --- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 678ecd8461..c8544d9cc1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -93,8 +93,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables base.AccentColour = value; Body.AccentColour = AccentColour; Ball.AccentColour = AccentColour; - foreach (var drawableHitObject in NestedHitObjects) - drawableHitObject.AccentColour = AccentColour; + if (HasNestedHitObjects) + foreach (var drawableHitObject in NestedHitObjects) + drawableHitObject.AccentColour = AccentColour; } } From 9d4bc7b63009460d8acde052781cf5a5a017c2f5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 01:34:47 +0900 Subject: [PATCH 49/61] Fix combo index being wrong --- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 4 +-- osu.Game.Rulesets.Osu/Objects/Slider.cs | 25 ++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 54126b934f..befbc01f3c 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -54,9 +54,9 @@ namespace osu.Game.Rulesets.Osu.Objects public virtual bool NewCombo { get; set; } - public int IndexInCurrentCombo { get; set; } + public virtual int IndexInCurrentCombo { get; set; } - public int ComboIndex { get; set; } + public virtual int ComboIndex { get; set; } public bool LastInCombo { get; set; } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index 2ebe5efd0f..698f9de787 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -26,6 +26,28 @@ namespace osu.Game.Rulesets.Osu.Objects public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t); public override Vector2 EndPosition => Position + this.CurvePositionAt(1); + public override int ComboIndex + { + get => base.ComboIndex; + set + { + base.ComboIndex = value; + foreach (var n in NestedHitObjects.OfType()) + n.ComboIndex = value; + } + } + + public override int IndexInCurrentCombo + { + get => base.IndexInCurrentCombo; + set + { + base.IndexInCurrentCombo = value; + foreach (var n in NestedHitObjects.OfType()) + n.IndexInCurrentCombo = value; + } + } + public SliderCurve Curve { get; } = new SliderCurve(); public List ControlPoints @@ -147,7 +169,8 @@ namespace osu.Game.Rulesets.Osu.Objects var distanceProgress = d / length; var timeProgress = reversed ? 1 - distanceProgress : distanceProgress; - var firstSample = Samples.FirstOrDefault(s => s.Name == SampleInfo.HIT_NORMAL) ?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933) + var firstSample = Samples.FirstOrDefault(s => s.Name == SampleInfo.HIT_NORMAL) + ?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933) var sampleList = new List(); if (firstSample != null) From b0739023ce3353b3443997a5376be5d99911df27 Mon Sep 17 00:00:00 2001 From: tgi74000 Date: Thu, 28 Jun 2018 19:02:38 +0200 Subject: [PATCH 50/61] Add BeatmapInfo's stable defaults to fix compatibility with old maps --- osu.Game/Beatmaps/BeatmapInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 3afc3c4d32..303a19aab3 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -66,8 +66,8 @@ namespace osu.Game.Beatmaps // General public int AudioLeadIn { get; set; } - public bool Countdown { get; set; } - public float StackLeniency { get; set; } + public bool Countdown { get; set; } = true; + public float StackLeniency { get; set; } = 0.7f; public bool SpecialStyle { get; set; } public int RulesetID { get; set; } From 8742f41b7d492fba91c3425bca6d31803ff2bf80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 11:34:33 +0900 Subject: [PATCH 51/61] Revert SharpCompress library to fix delta patching regression --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9668d40fd5..b4fccf0898 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -19,7 +19,7 @@ - + From 70a119dde7ee2a7b07c01fad9b10ac7bb091fe49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 12:20:53 +0900 Subject: [PATCH 52/61] Remove unused/duplicate interface --- .../Rulesets/Objects/Types/IHasComboIndex.cs | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 osu.Game/Rulesets/Objects/Types/IHasComboIndex.cs diff --git a/osu.Game/Rulesets/Objects/Types/IHasComboIndex.cs b/osu.Game/Rulesets/Objects/Types/IHasComboIndex.cs deleted file mode 100644 index c5d0152ae7..0000000000 --- a/osu.Game/Rulesets/Objects/Types/IHasComboIndex.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Rulesets.Objects.Types -{ - /// - /// A HitObject that is part of a combo and has extended information about its position relative to other combo objects. - /// - public interface IHasComboIndex : IHasCombo - { - /// - /// The offset of this hitobject in the current combo. - /// - int IndexInCurrentCombo { get; set; } - - /// - /// The offset of this hitobject in the current combo. - /// - int ComboIndex { get; set; } - - /// - /// Whether this is the last object in the current combo. - /// - bool LastInCombo { get; set; } - } -} From 3b262e0d1640eacf7f50b796bdd10b9272052fd3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 15:01:33 +0900 Subject: [PATCH 53/61] Use better casting --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 8473f5a36c..33fc838d35 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Catch.Beatmaps switch (obj) { case BananaShower bananaShower: - foreach (var nested in bananaShower.NestedHitObjects) + foreach (var banana in bananaShower.NestedHitObjects.OfType()) { - ((BananaShower.Banana)nested).X = (float)rng.NextDouble(); + banana.X = (float)rng.NextDouble(); rng.Next(); // osu!stable retrieved a random banana type rng.Next(); // osu!stable retrieved a random banana rotation rng.Next(); // osu!stable retrieved a random banana colour From f7fbf6130624c4bde66c84895c415bbe38ef0ce9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 15:27:02 +0900 Subject: [PATCH 54/61] Centralise judgement logic --- .../Objects/Drawable/DrawableBanana.cs | 9 +-------- .../Objects/Drawable/DrawableCatchHitObject.cs | 8 +++++++- .../Objects/Drawable/DrawableDroplet.cs | 9 +-------- .../Objects/Drawable/DrawableTinyDroplet.cs | 9 +-------- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs index dc2fa18ad4..dd027abbe0 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBanana.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Catch.Judgements; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -13,12 +12,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable { } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (CheckPosition == null) return; - - if (timeOffset >= 0) - AddJudgement(new CatchBananaJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); - } + protected override CatchJudgement CreateJudgement() => new CatchBananaJudgement(); } } diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs index 2f3e5f823e..6ce2e6a2ae 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableCatchHitObject.cs @@ -58,9 +58,15 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable if (CheckPosition == null) return; if (timeOffset >= 0) - AddJudgement(new CatchJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); + { + var judgement = CreateJudgement(); + judgement.Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss; + AddJudgement(judgement); + } } + protected virtual CatchJudgement CreateJudgement() => new CatchJudgement(); + protected override void SkinChanged(ISkinSource skin, bool allowFallback) { base.SkinChanged(skin, allowFallback); diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index b4f914d21c..11d5ed1f92 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -7,7 +7,6 @@ using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces; using OpenTK; using OpenTK.Graphics; using osu.Game.Rulesets.Catch.Judgements; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -25,13 +24,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Masking = false; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (CheckPosition == null) return; - - if (timeOffset >= 0) - AddJudgement(new CatchDropletJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); - } + protected override CatchJudgement CreateJudgement() => new CatchDropletJudgement(); [BackgroundDependencyLoader] private void load() diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs index 7a3972da51..2232bb81a7 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableTinyDroplet.cs @@ -3,7 +3,6 @@ using OpenTK; using osu.Game.Rulesets.Catch.Judgements; -using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Objects.Drawable { @@ -15,12 +14,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 8; } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (CheckPosition == null) return; - - if (timeOffset >= 0) - AddJudgement(new CatchTinyDropletJudgement { Result = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss }); - } + protected override CatchJudgement CreateJudgement() => new CatchTinyDropletJudgement(); } } From f1a35f77d2581678eb6bf3ef3a3608c261f76eba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 16:49:01 +0900 Subject: [PATCH 55/61] Make bananas explode even on miss --- .../Judgements/CatchBananaJudgement.cs | 2 ++ .../Judgements/CatchBananaShowerJudgement.cs | 21 ------------------- .../Judgements/CatchJudgement.cs | 7 +++++++ .../Objects/Drawable/DrawableBananaShower.cs | 7 +------ .../Scoring/CatchScoreProcessor.cs | 1 - osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 4 ++-- 6 files changed, 12 insertions(+), 30 deletions(-) delete mode 100644 osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index 393e3994a1..b0b00d8a42 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -10,6 +10,8 @@ namespace osu.Game.Rulesets.Catch.Judgements public override bool AffectsCombo => false; public override bool IsBonus => true; + public override bool ShouldExplode => true; + protected override int NumericResultFor(HitResult result) { switch (result) diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs deleted file mode 100644 index a3a9aa4f04..0000000000 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaShowerJudgement.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Scoring; - -namespace osu.Game.Rulesets.Catch.Judgements -{ - public class CatchBananaShowerJudgement : CatchJudgement - { - public override bool AffectsCombo => false; - public override bool IsBonus => true; - - public CatchBananaShowerJudgement() - { - Result = HitResult.Perfect; - } - - protected override int NumericResultFor(HitResult result) => 0; - protected override float HealthIncreaseFor(HitResult result) => 0; - } -} diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index 82d54c6095..922471137c 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Catch.Judgements @@ -31,6 +32,12 @@ namespace osu.Game.Rulesets.Catch.Judgements /// public float HealthIncrease => HealthIncreaseFor(Result); + /// + /// Whether fruit on the platter should explode or drop. + /// Note that this is only checked if the owning object is also + /// + public virtual bool ShouldExplode => IsHit; + /// /// Convert a to a base health increase. /// diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs index 182adab6e1..f039504600 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableBananaShower.cs @@ -5,7 +5,6 @@ using System; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Catch.Objects.Drawable @@ -27,11 +26,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable AddNested(getVisualRepresentation?.Invoke(b)); } - protected override void CheckForJudgements(bool userTriggered, double timeOffset) - { - if (timeOffset >= 0) - AddJudgement(new CatchBananaShowerJudgement()); - } + protected override bool ProvidesJudgement => false; protected override void AddNested(DrawableHitObject h) { diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index dfe8bba184..5b69d836a3 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -47,7 +47,6 @@ namespace osu.Game.Rulesets.Catch.Scoring case BananaShower shower: foreach (var _ in shower.NestedHitObjects.Cast()) AddJudgement(new CatchBananaJudgement { Result = HitResult.Perfect }); - AddJudgement(new CatchBananaShowerJudgement()); break; case Fruit _: AddJudgement(new CatchJudgement { Result = HitResult.Perfect }); diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index ceb05d349f..9c376f340a 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Input.Bindings; using osu.Framework.MathUtils; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Catch.Judgements; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Replays; @@ -78,12 +79,11 @@ namespace osu.Game.Rulesets.Catch.UI if (!fruit.StaysOnPlate) runAfterLoaded(() => MovableCatcher.Explode(caughtFruit)); - } if (fruit.HitObject.LastInCombo) { - if (judgement.IsHit) + if (((CatchJudgement)judgement).ShouldExplode) runAfterLoaded(() => MovableCatcher.Explode()); else MovableCatcher.Drop(); From 750f5a86c34cd49606ab7aeb9eaf4bf24d8d0357 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 16:49:11 +0900 Subject: [PATCH 56/61] Fix catch test failing due to disabled bindable --- osu.Game/Screens/Play/Player.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a2ed01f5a7..a993b61e7b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -158,7 +158,8 @@ namespace osu.Game.Screens.Play userAudioOffset.TriggerChange(); ScoreProcessor = RulesetContainer.CreateScoreProcessor(); - config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); + if (!ScoreProcessor.Mode.Disabled) + config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); Children = new Drawable[] { From cacabeb67e9d584688c014fa8bba3e9071aae80d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 17:00:41 +0900 Subject: [PATCH 57/61] Remove unused field --- osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs | 5 ----- osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs | 6 ------ .../Objects/Drawables/DrawableHitCircle.cs | 1 - osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 3 +-- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs index 922471137c..51d7d3b5cd 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchJudgement.cs @@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Catch.Judgements { public override HitResult MaxResult => HitResult.Perfect; - /// - /// The positional hit offset. - /// - public float PositionOffset; - protected override int NumericResultFor(HitResult result) { switch (result) diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs index b7c4470592..26becfdec9 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Scoring; @@ -12,11 +11,6 @@ namespace osu.Game.Rulesets.Osu.Judgements { public override HitResult MaxResult => HitResult.Great; - /// - /// The positional hit offset. - /// - public Vector2 PositionOffset; - protected override int NumericResultFor(HitResult result) { switch (result) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 9fe6dcd46c..421c93d485 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -93,7 +93,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AddJudgement(new OsuJudgement { Result = result, - PositionOffset = Vector2.Zero //todo: set to correct value }); } diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index f2d5631e93..04724931ae 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -11,7 +11,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Connections; using osu.Game.Rulesets.UI; using System.Linq; using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Osu.Judgements; namespace osu.Game.Rulesets.Osu.UI { @@ -75,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.UI DrawableOsuJudgement explosion = new DrawableOsuJudgement(judgement, judgedObject) { Origin = Anchor.Centre, - Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition + ((OsuJudgement)judgement).PositionOffset + Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition }; judgementLayer.Add(explosion); From c0b65a6a73c694825cbd6ec770ca01068c8da436 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 17:07:08 +0900 Subject: [PATCH 58/61] Change default IsBonus definition and remove unnecessary overrides --- osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs | 1 - osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs | 1 - osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs | 1 - osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs | 1 - .../Judgements/TaikoDrumRollTickJudgement.cs | 1 - osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs | 1 - osu.Game/Rulesets/Judgements/Judgement.cs | 2 +- 7 files changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs index b0b00d8a42..c39e663d75 100644 --- a/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs +++ b/osu.Game.Rulesets.Catch/Judgements/CatchBananaJudgement.cs @@ -8,7 +8,6 @@ namespace osu.Game.Rulesets.Catch.Judgements public class CatchBananaJudgement : CatchJudgement { public override bool AffectsCombo => false; - public override bool IsBonus => true; public override bool ShouldExplode => true; diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs index 9c78360911..9055e48a4c 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteJudgement.cs @@ -8,7 +8,6 @@ namespace osu.Game.Rulesets.Mania.Judgements public class HoldNoteJudgement : ManiaJudgement { public override bool AffectsCombo => false; - public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) => 0; } diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index 5d38e70d01..6eb5a79200 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -8,7 +8,6 @@ namespace osu.Game.Rulesets.Mania.Judgements public class HoldNoteTickJudgement : ManiaJudgement { public override bool AffectsCombo => false; - public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) => 20; } diff --git a/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs b/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs index fc85ec8764..d52de9f971 100644 --- a/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs +++ b/osu.Game.Rulesets.Osu/Judgements/OsuSliderTailJudgement.cs @@ -8,7 +8,6 @@ namespace osu.Game.Rulesets.Osu.Judgements public class OsuSliderTailJudgement : OsuJudgement { public override bool AffectsCombo => false; - public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) => 0; } diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs index 17bd2d9608..446dd0d11b 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoDrumRollTickJudgement.cs @@ -8,7 +8,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements public class TaikoDrumRollTickJudgement : TaikoJudgement { public override bool AffectsCombo => false; - public override bool IsBonus => true; protected override int NumericResultFor(HitResult result) { diff --git a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs index dbfd38e6f9..288ad236aa 100644 --- a/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs +++ b/osu.Game.Rulesets.Taiko/Judgements/TaikoStrongHitJudgement.cs @@ -6,7 +6,6 @@ namespace osu.Game.Rulesets.Taiko.Judgements public class TaikoStrongHitJudgement : TaikoJudgement { public override bool AffectsCombo => false; - public override bool IsBonus => true; public TaikoStrongHitJudgement() { diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 3d70b23773..0937757981 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Judgements /// /// Whether the should be counted as base or bonus score. /// - public virtual bool IsBonus => false; + public virtual bool IsBonus => !AffectsCombo; /// /// The numeric representation for the result achieved. From e12ce3c2a8351ddc8bed9c94c33f34c0008b80d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 17:21:19 +0900 Subject: [PATCH 59/61] Adjust xmldoc --- osu.Game/Rulesets/Judgements/Judgement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 0937757981..129dd07c3e 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -45,12 +45,12 @@ namespace osu.Game.Rulesets.Judgements public double TimeOffset { get; set; } /// - /// Whether the should affect the combo portion of the score. + /// Whether the should affect the current combo. /// public virtual bool AffectsCombo => true; /// - /// Whether the should be counted as base or bonus score. + /// Whether the should be counted as base (combo) or bonus score. /// public virtual bool IsBonus => !AffectsCombo; From 4212a9d0d765efd1527701cd9e90559e62ffe131 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 29 Jun 2018 18:23:53 +0900 Subject: [PATCH 60/61] Fix incorrect migration conditional --- osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs index c52288e598..c38cd19b42 100644 --- a/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs +++ b/osu.Game/Migrations/20180628011956_RemoveNegativeSetIDs.cs @@ -8,7 +8,7 @@ namespace osu.Game.Migrations { // There was a change that baetmaps were being loaded with "-1" online IDs, which is completely incorrect. // This ensures there will not be unique key conflicts as a result of these incorrectly imported beatmaps. - migrationBuilder.Sql("UPDATE BeatmapSetInfo SET OnlineBeatmapSetID = null WHERE OnlineBeatmapSetID < 0"); + migrationBuilder.Sql("UPDATE BeatmapSetInfo SET OnlineBeatmapSetID = null WHERE OnlineBeatmapSetID <= 0"); } protected override void Down(MigrationBuilder migrationBuilder) From 1e696d247e84d8f94d3122e55f67dffd6170b143 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 29 Jun 2018 18:33:28 +0900 Subject: [PATCH 61/61] Re-privatise --- osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 5f0190e7d7..323046f758 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -42,7 +42,7 @@ namespace osu.Game.Graphics.Containers samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in"); samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out"); - StateChanged += OnStateChanged; + StateChanged += onStateChanged; } /// @@ -65,7 +65,7 @@ namespace osu.Game.Graphics.Containers return base.OnClick(state); } - protected virtual void OnStateChanged(Visibility visibility) + private void onStateChanged(Visibility visibility) { switch (visibility) {