From 67806c4247ab83893bb14577a782a20d7f376f68 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Wed, 17 May 2017 21:16:53 +0200 Subject: [PATCH 01/33] add tab item --- osu.Game/Overlays/Chat/ChatTabControl.cs | 32 ++++++++++++++++++++++-- osu.Game/Overlays/ChatOverlay.cs | 12 +++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 57447f1913..9f38b81e68 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Chat { public class ChatTabControl : OsuTabControl { - protected override TabItem CreateTabItem(Channel value) => new ChannelTabItem(value); + protected override TabItem CreateTabItem(Channel value) => value.Id == -1 ? new ChannelTabItem.ChannelSelectorTabItem(value) : new ChannelTabItem(value); private const float shear_width = 10; @@ -37,6 +37,11 @@ namespace osu.Game.Overlays.Chat TextSize = 20, Padding = new MarginPadding(10), }); + + AddItem(new Channel + { + Id = ChatOverlay.CHANNEL_SELECTOR_ID, + }); } private class ChannelTabItem : TabItem @@ -49,6 +54,7 @@ namespace osu.Game.Overlays.Chat private readonly SpriteText textBold; private readonly Box box; private readonly Box highlightBox; + private readonly TextAwesome icon; public override bool Active { @@ -159,7 +165,7 @@ namespace osu.Game.Overlays.Chat RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new TextAwesome + icon = new TextAwesome { Icon = FontAwesome.fa_hashtag, Anchor = Anchor.CentreLeft, @@ -191,6 +197,28 @@ namespace osu.Game.Overlays.Chat } }; } + + public class ChannelSelectorTabItem : ChannelTabItem + { + public ChannelSelectorTabItem(Channel value) : base(value) + { + Depth = float.MaxValue; + Width = 60; + + icon.Icon = FontAwesome.fa_plus; + icon.X = 0; + } + + [BackgroundDependencyLoader] + private new void load(OsuColour colour) + { + backgroundActive = colour.Green; + backgroundInactive = colour.GreenDark; + backgroundHover = colour.Green; + + updateState(); + } + } } } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index a85af251c5..5e998bff51 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -44,6 +44,8 @@ namespace osu.Game.Overlays public const float TAB_AREA_HEIGHT = 50; + public const int CHANNEL_SELECTOR_ID = -1; + private GetMessagesRequest fetchReq; private readonly ChatTabControl channelTabs; @@ -262,6 +264,16 @@ namespace osu.Game.Overlays { if (currentChannel == value) return; + if(value.Id == CHANNEL_SELECTOR_ID) + { + //channel selector popout + currentChannel = value; + return; + }else if(currentChannel?.Id == CHANNEL_SELECTOR_ID) + { + //channel selector popin + } + if (currentChannel != null) currentChannelContainer.Clear(false); From 0e3fb55d5e84f149489449a36f94380482d79aec Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 18 May 2017 17:02:11 +0200 Subject: [PATCH 02/33] usage of constant and formatting --- osu.Game/Overlays/Chat/ChatTabControl.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 9f38b81e68..62d24289b1 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Chat { public class ChatTabControl : OsuTabControl { - protected override TabItem CreateTabItem(Channel value) => value.Id == -1 ? new ChannelTabItem.ChannelSelectorTabItem(value) : new ChannelTabItem(value); + protected override TabItem CreateTabItem(Channel value) => value.Id == ChatOverlay.CHANNEL_SELECTOR_ID ? new ChannelTabItem.ChannelSelectorTabItem(value) : new ChannelTabItem(value); private const float shear_width = 10; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 5e998bff51..57c7c2cd69 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -264,12 +264,13 @@ namespace osu.Game.Overlays { if (currentChannel == value) return; - if(value.Id == CHANNEL_SELECTOR_ID) + if (value.Id == CHANNEL_SELECTOR_ID) { //channel selector popout currentChannel = value; return; - }else if(currentChannel?.Id == CHANNEL_SELECTOR_ID) + } + else if (currentChannel?.Id == CHANNEL_SELECTOR_ID) { //channel selector popin } From 94484974f9e94066e1b6d18326cc246d7bbed58a Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 19 May 2017 11:59:23 +0200 Subject: [PATCH 03/33] use AddTabItem instead + Bindable for ChannelSelectorTabItem --- osu.Game/Overlays/Chat/ChatTabControl.cs | 27 ++++++++++++++++++------ osu.Game/Overlays/ChatOverlay.cs | 13 +----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 62d24289b1..800ed96025 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -14,15 +14,20 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; using OpenTK; using OpenTK.Graphics; +using osu.Framework.Configuration; namespace osu.Game.Overlays.Chat { public class ChatTabControl : OsuTabControl { - protected override TabItem CreateTabItem(Channel value) => value.Id == ChatOverlay.CHANNEL_SELECTOR_ID ? new ChannelTabItem.ChannelSelectorTabItem(value) : new ChannelTabItem(value); + protected override TabItem CreateTabItem(Channel value) => new ChannelTabItem(value); private const float shear_width = 10; + private Bindable channelSelectorActive = new Bindable(); + + public Bindable ChannelSelectorActive => channelSelectorActive; + public ChatTabControl() { TabContainer.Margin = new MarginPadding { Left = 50 }; @@ -38,10 +43,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding(10), }); - AddItem(new Channel - { - Id = ChatOverlay.CHANNEL_SELECTOR_ID, - }); + AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel(), channelSelectorActive)); } private class ChannelTabItem : TabItem @@ -200,8 +202,21 @@ namespace osu.Game.Overlays.Chat public class ChannelSelectorTabItem : ChannelTabItem { - public ChannelSelectorTabItem(Channel value) : base(value) + public override bool Active { + get { return base.Active; } + set + { + activeBindable.Value = value; + base.Active = value; + } + } + + private Bindable activeBindable; + + public ChannelSelectorTabItem(Channel value, Bindable active) : base(value) + { + activeBindable = active; Depth = float.MaxValue; Width = 60; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 57c7c2cd69..6c8c176861 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -44,8 +44,6 @@ namespace osu.Game.Overlays public const float TAB_AREA_HEIGHT = 50; - public const int CHANNEL_SELECTOR_ID = -1; - private GetMessagesRequest fetchReq; private readonly ChatTabControl channelTabs; @@ -264,16 +262,7 @@ namespace osu.Game.Overlays { if (currentChannel == value) return; - if (value.Id == CHANNEL_SELECTOR_ID) - { - //channel selector popout - currentChannel = value; - return; - } - else if (currentChannel?.Id == CHANNEL_SELECTOR_ID) - { - //channel selector popin - } + if (channelTabs.ChannelSelectorActive) return; if (currentChannel != null) currentChannelContainer.Clear(false); From 7d28290a4a26b3fe2521c801374a797cc7176717 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 23 May 2017 17:35:40 +0200 Subject: [PATCH 04/33] update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 42e26d49b9..79b335e9d4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 42e26d49b9046fcb96c123b0dfb48e06d741e162 +Subproject commit 79b335e9d4d6f8ff89524f06dbe324db3cf29513 From 320e7b358ee9e1dc95a66ed34e9531b6b8c94af9 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 23 May 2017 17:50:28 +0200 Subject: [PATCH 05/33] revert framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 79b335e9d4..89f8468e02 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 79b335e9d4d6f8ff89524f06dbe324db3cf29513 +Subproject commit 89f8468e02187aab5ad0625503252b488a1d571c From af9b02746ad86d15f5e2a2f14a267358a9a4683c Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 23 May 2017 18:19:01 +0200 Subject: [PATCH 06/33] make fields readonly --- osu.Game/Overlays/Chat/ChatTabControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 800ed96025..875c7c411d 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Chat private const float shear_width = 10; - private Bindable channelSelectorActive = new Bindable(); + private readonly Bindable channelSelectorActive = new Bindable(); public Bindable ChannelSelectorActive => channelSelectorActive; @@ -212,7 +212,7 @@ namespace osu.Game.Overlays.Chat } } - private Bindable activeBindable; + private readonly Bindable activeBindable; public ChannelSelectorTabItem(Channel value, Bindable active) : base(value) { From a9658ec66fbcc62e1b79214ffdda0a84ec3e44c0 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Thu, 25 May 2017 20:25:59 +0200 Subject: [PATCH 07/33] update colour, width, icon and text --- osu.Game/Overlays/Chat/ChatTabControl.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 875c7c411d..fdfda92214 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding(10), }); - AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel(), channelSelectorActive)); + AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }, channelSelectorActive)); } private class ChannelTabItem : TabItem @@ -218,18 +218,20 @@ namespace osu.Game.Overlays.Chat { activeBindable = active; Depth = float.MaxValue; - Width = 60; + Width = 45; - icon.Icon = FontAwesome.fa_plus; + icon.Icon = 0; icon.X = 0; + + text.TextSize = 45; + textBold.TextSize = 45; } [BackgroundDependencyLoader] private new void load(OsuColour colour) { - backgroundActive = colour.Green; - backgroundInactive = colour.GreenDark; - backgroundHover = colour.Green; + backgroundInactive = colour.Gray2; + backgroundActive = colour.Gray3; updateState(); } From 1e4bca90f08e10a89c09729027e65db672f9b3a1 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Fri, 26 May 2017 12:10:16 +0200 Subject: [PATCH 08/33] remove duplicate code --- osu.Game/Overlays/Chat/ChatTabControl.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index fdfda92214..9c26632a8b 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -24,9 +24,7 @@ namespace osu.Game.Overlays.Chat private const float shear_width = 10; - private readonly Bindable channelSelectorActive = new Bindable(); - - public Bindable ChannelSelectorActive => channelSelectorActive; + public readonly Bindable ChannelSelectorActive = new Bindable(); public ChatTabControl() { @@ -43,7 +41,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding(10), }); - AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }, channelSelectorActive)); + AddTabItem(new ChannelTabItem.ChannelSelectorTabItem(new Channel { Name = "+" }, ChannelSelectorActive)); } private class ChannelTabItem : TabItem @@ -122,6 +120,11 @@ namespace osu.Game.Overlays.Chat backgroundHover = colours.Gray7; highlightBox.Colour = colours.Yellow; + } + + protected override void LoadComplete() + { + base.LoadComplete(); updateState(); } @@ -232,8 +235,6 @@ namespace osu.Game.Overlays.Chat { backgroundInactive = colour.Gray2; backgroundActive = colour.Gray3; - - updateState(); } } } From 43a7923199fa4a4ff8b49b5a191ab90f131f7b01 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 19:22:17 +0900 Subject: [PATCH 09/33] Implement base mania judgement score. --- .../Judgements/ManiaJudgement.cs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs index 6e69da3da7..33083ca0f5 100644 --- a/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/ManiaJudgement.cs @@ -2,11 +2,37 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Judgements { public class ManiaJudgement : Judgement { + /// + /// The maximum possible hit result. + /// + public const ManiaHitResult MAX_HIT_RESULT = ManiaHitResult.Perfect; + + /// + /// The result value for the combo portion of the score. + /// + public int ResultValueForScore => Result == HitResult.Miss ? 0 : NumericResultForScore(ManiaResult); + + /// + /// The result value for the accuracy portion of the score. + /// + public int ResultValueForAccuracy => Result == HitResult.Miss ? 0 : NumericResultForAccuracy(ManiaResult); + + /// + /// The maximum result value for the combo portion of the score. + /// + public int MaxResultValueForScore => NumericResultForScore(MAX_HIT_RESULT); + + /// + /// The maximum result value for the accuracy portion of the score. + /// + public int MaxResultValueForAccuracy => NumericResultForAccuracy(MAX_HIT_RESULT); + public override string ResultString => string.Empty; public override string MaxResultString => string.Empty; @@ -15,5 +41,42 @@ namespace osu.Game.Rulesets.Mania.Judgements /// The hit result. /// public ManiaHitResult ManiaResult; + + public virtual int NumericResultForScore(ManiaHitResult result) + { + switch (result) + { + default: + return 0; + case ManiaHitResult.Bad: + return 50; + case ManiaHitResult.Ok: + return 100; + case ManiaHitResult.Good: + return 200; + case ManiaHitResult.Great: + case ManiaHitResult.Perfect: + return 300; + } + } + + public virtual int NumericResultForAccuracy(ManiaHitResult result) + { + switch (result) + { + default: + return 0; + case ManiaHitResult.Bad: + return 50; + case ManiaHitResult.Ok: + return 100; + case ManiaHitResult.Good: + return 200; + case ManiaHitResult.Great: + return 300; + case ManiaHitResult.Perfect: + return 305; + } + } } } From 4c67c13410f0b7567944672ac1ba29f66d91b84a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 19:28:14 +0900 Subject: [PATCH 10/33] Add hold note tail judgement. --- .../Judgements/HoldNoteTailJudgement.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs index df2f7e9e63..d5cf57a5da 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTailJudgement.cs @@ -9,5 +9,29 @@ namespace osu.Game.Rulesets.Mania.Judgements /// Whether the hold note has been released too early and shouldn't give full score for the release. /// public bool HasBroken; + + public override int NumericResultForScore(ManiaHitResult result) + { + switch (result) + { + default: + return base.NumericResultForScore(result); + case ManiaHitResult.Great: + case ManiaHitResult.Perfect: + return base.NumericResultForScore(HasBroken ? ManiaHitResult.Good : result); + } + } + + public override int NumericResultForAccuracy(ManiaHitResult result) + { + switch (result) + { + default: + return base.NumericResultForAccuracy(result); + case ManiaHitResult.Great: + case ManiaHitResult.Perfect: + return base.NumericResultForAccuracy(HasBroken ? ManiaHitResult.Good : result); + } + } } } \ No newline at end of file From 02f582a3f80993177dc06dbbc322679e23f99bd3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 19:29:47 +0900 Subject: [PATCH 11/33] Add hold note tick judgement. --- osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index bead455c13..d6a72c825a 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -5,5 +5,7 @@ namespace osu.Game.Rulesets.Mania.Judgements { public class HoldNoteTickJudgement : ManiaJudgement { + public override int NumericResultForScore(ManiaHitResult result) => 20; + public override int NumericResultForAccuracy(ManiaHitResult result) => 0; // Don't count ticks into accuracy } } \ No newline at end of file From 9ec6e0b692cf14b31e07079264aeceb736025d49 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 19:56:27 +0900 Subject: [PATCH 12/33] Fix hold note ticks changing combo. --- osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs index d6a72c825a..852f97b3f2 100644 --- a/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs +++ b/osu.Game.Rulesets.Mania/Judgements/HoldNoteTickJudgement.cs @@ -5,6 +5,8 @@ namespace osu.Game.Rulesets.Mania.Judgements { public class HoldNoteTickJudgement : ManiaJudgement { + public override bool AffectsCombo => false; + public override int NumericResultForScore(ManiaHitResult result) => 20; public override int NumericResultForAccuracy(ManiaHitResult result) => 0; // Don't count ticks into accuracy } From ab5e1bfc891e01f7a05c851591dae1cf4f9978e0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 19:56:50 +0900 Subject: [PATCH 13/33] Add basic score calculations. --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 6 + .../Scoring/ManiaScoreProcessor.cs | 148 ++++++++++++++++++ 2 files changed, 154 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index c241c4cf41..3550d561c1 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; @@ -60,6 +61,11 @@ namespace osu.Game.Rulesets.Mania.Objects tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate; } + /// + /// Total number of hold note ticks. + /// + public int TotalTicks => Ticks.Count(); + /// /// The scoring scoring ticks of the hold note. /// diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 7a9572a0c7..2f4ce075c3 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -1,8 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; @@ -10,6 +13,52 @@ namespace osu.Game.Rulesets.Mania.Scoring { internal class ManiaScoreProcessor : ScoreProcessor { + /// + /// The maximum score achievable. + /// Does _not_ include bonus score - for bonus score see . + /// + private const int max_score = 1000000; + + /// + /// The amount of the score attributed to combo. + /// + private const double combo_portion_max = max_score * 0.2; + + /// + /// The amount of the score attributed to accuracy. + /// + private const double accuracy_portion_max = max_score * 0.8; + + /// + /// The cumulative combo portion of the score. + /// + private double comboScore => combo_portion_max * comboPortion / maxComboPortion; + + /// + /// The cumulative accuracy portion of the score. + /// + private double accuracyScore => accuracy_portion_max * Math.Pow(Accuracy, 4) * totalHits / maxTotalHits; + + /// + /// The cumulative bonus score. + /// This is added on top of , thus the total score can exceed . + /// + private double bonusScore; + + private double maxComboPortion; + private double comboPortion; + private int maxTotalHits; + private int totalHits; + + private double hpIncreaseBad; + private double hpIncreaseOk; + private double hpIncreaseGood; + private double hpIncreaseGreat; + private double hpIncreasePerfect; + private double hpIncreaseTick; + private double hpIncreaseTickMiss; + private double hpIncreaseMiss; + public ManiaScoreProcessor() { } @@ -19,8 +68,107 @@ namespace osu.Game.Rulesets.Mania.Scoring { } + protected override void ComputeTargets(Beatmap beatmap) + { + foreach (var obj in beatmap.HitObjects) + { + if (obj is Note) + { + AddJudgement(new ManiaJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaHitResult.Perfect + }); + } + else if (obj is HoldNote) + { + // Head + AddJudgement(new ManiaJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaJudgement.MAX_HIT_RESULT + }); + + // Ticks + for (int i = 0; i < ((HoldNote)obj).TotalTicks; i++) + { + AddJudgement(new HoldNoteTickJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaJudgement.MAX_HIT_RESULT, + }); + } + + AddJudgement(new HoldNoteTailJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaJudgement.MAX_HIT_RESULT + }); + } + } + + maxTotalHits = totalHits; + maxComboPortion = comboPortion; + } + protected override void OnNewJudgement(ManiaJudgement judgement) { + bool isTick = judgement is HoldNoteTickJudgement; + + if (!isTick) + totalHits++; + + switch (judgement.Result) + { + case HitResult.Miss: + if (isTick) + Health.Value += hpIncreaseTickMiss; + else + Health.Value += hpIncreaseMiss; + break; + case HitResult.Hit: + if (isTick) + { + Health.Value += hpIncreaseTick; + bonusScore += judgement.ResultValueForScore; + } + else + { + switch (judgement.ManiaResult) + { + case ManiaHitResult.Bad: + Health.Value += hpIncreaseBad; + break; + case ManiaHitResult.Ok: + Health.Value += hpIncreaseOk; + break; + case ManiaHitResult.Good: + Health.Value += hpIncreaseGood; + break; + case ManiaHitResult.Great: + Health.Value += hpIncreaseGreat; + break; + case ManiaHitResult.Perfect: + Health.Value += hpIncreasePerfect; + break; + } + + comboPortion += judgement.ResultValueForScore; + } + break; + } + + int scoreForAccuracy = 0; + int maxScoreForAccuracy = 0; + + foreach (var j in Judgements) + { + scoreForAccuracy += j.ResultValueForAccuracy; + maxScoreForAccuracy += j.MaxResultValueForAccuracy; + } + + Accuracy.Value = (double)scoreForAccuracy / maxScoreForAccuracy; + TotalScore.Value = comboScore + accuracyScore + bonusScore; } protected override void Reset() From 10f62eb8da15bd22268fca9b84a71755d932af55 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 20:25:24 +0900 Subject: [PATCH 14/33] Fix incorrect combo score. --- .../Scoring/ManiaScoreProcessor.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 2f4ce075c3..4a5ab639b9 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -29,6 +29,16 @@ namespace osu.Game.Rulesets.Mania.Scoring /// private const double accuracy_portion_max = max_score * 0.8; + /// + /// The factor used to determine relevance of combos. + /// + private const double combo_base = 4; + + /// + /// The combo value at which hit objects result in the max score possible. + /// + private const int combo_relevance_cap = 400; + /// /// The cumulative combo portion of the score. /// @@ -153,7 +163,9 @@ namespace osu.Game.Rulesets.Mania.Scoring break; } - comboPortion += judgement.ResultValueForScore; + // A factor that is applied to make higher combos more relevant + double comboRelevance = Math.Min(Math.Max(0.5, Math.Log(Combo.Value, combo_base)), Math.Log(combo_relevance_cap, combo_base)); + comboPortion += judgement.ResultValueForScore * comboRelevance; } break; } From 95908af677aec6bf59bf1545233e3b4f8e35fa4d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 20:26:06 +0900 Subject: [PATCH 15/33] Fix resetting scoreprocessor. --- osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 4a5ab639b9..18df7888b6 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -188,6 +188,10 @@ namespace osu.Game.Rulesets.Mania.Scoring base.Reset(); Health.Value = 1; + + bonusScore = 0; + comboPortion = 0; + totalHits = 0; } } } From ca080117349bc78789a0f1e79c27818666f46e22 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 20:26:26 +0900 Subject: [PATCH 16/33] Add basic (new) hp calculations. --- .../Scoring/ManiaScoreProcessor.cs | 98 +++++++++++-------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 18df7888b6..fc2e8bec10 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -60,14 +60,17 @@ namespace osu.Game.Rulesets.Mania.Scoring private int maxTotalHits; private int totalHits; - private double hpIncreaseBad; - private double hpIncreaseOk; - private double hpIncreaseGood; - private double hpIncreaseGreat; - private double hpIncreasePerfect; - private double hpIncreaseTick; - private double hpIncreaseTickMiss; - private double hpIncreaseMiss; + private double hpMultiplier = 1; + private const double hp_increase_bad = 0.005; + private const double hp_increase_ok = 0.010; + private const double hp_increase_good = 0.035; + private const double hp_increase_tick = 0.040; + private const double hp_increase_great = 0.055; + private const double hp_increase_perfect = 0.065; + + private double hpMissMultiplier = 1; + private const double hp_increase_tick_miss = -0.025; + private const double hp_increase_miss = -0.125; public ManiaScoreProcessor() { @@ -80,41 +83,52 @@ namespace osu.Game.Rulesets.Mania.Scoring protected override void ComputeTargets(Beatmap beatmap) { - foreach (var obj in beatmap.HitObjects) + while (true) { - if (obj is Note) + foreach (var obj in beatmap.HitObjects) { - AddJudgement(new ManiaJudgement + if (obj is Note) { - Result = HitResult.Hit, - ManiaResult = ManiaHitResult.Perfect - }); - } - else if (obj is HoldNote) - { - // Head - AddJudgement(new ManiaJudgement - { - Result = HitResult.Hit, - ManiaResult = ManiaJudgement.MAX_HIT_RESULT - }); - - // Ticks - for (int i = 0; i < ((HoldNote)obj).TotalTicks; i++) - { - AddJudgement(new HoldNoteTickJudgement + AddJudgement(new ManiaJudgement { Result = HitResult.Hit, - ManiaResult = ManiaJudgement.MAX_HIT_RESULT, + ManiaResult = ManiaHitResult.Perfect }); } - - AddJudgement(new HoldNoteTailJudgement + else if (obj is HoldNote) { - Result = HitResult.Hit, - ManiaResult = ManiaJudgement.MAX_HIT_RESULT - }); + // Head + AddJudgement(new ManiaJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaJudgement.MAX_HIT_RESULT + }); + + // Ticks + for (int i = 0; i < ((HoldNote)obj).TotalTicks; i++) + { + AddJudgement(new HoldNoteTickJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaJudgement.MAX_HIT_RESULT, + }); + } + + AddJudgement(new HoldNoteTailJudgement + { + Result = HitResult.Hit, + ManiaResult = ManiaJudgement.MAX_HIT_RESULT + }); + } } + + if (!HasFailed) + break; + + hpMultiplier *= 1.01; + hpMissMultiplier *= 0.98; + + Reset(); } maxTotalHits = totalHits; @@ -132,14 +146,14 @@ namespace osu.Game.Rulesets.Mania.Scoring { case HitResult.Miss: if (isTick) - Health.Value += hpIncreaseTickMiss; + Health.Value += hpMissMultiplier * hp_increase_tick_miss; else - Health.Value += hpIncreaseMiss; + Health.Value += hpMissMultiplier * hp_increase_miss; break; case HitResult.Hit: if (isTick) { - Health.Value += hpIncreaseTick; + Health.Value += hpMultiplier * hp_increase_tick; bonusScore += judgement.ResultValueForScore; } else @@ -147,19 +161,19 @@ namespace osu.Game.Rulesets.Mania.Scoring switch (judgement.ManiaResult) { case ManiaHitResult.Bad: - Health.Value += hpIncreaseBad; + Health.Value += hpMultiplier * hp_increase_bad; break; case ManiaHitResult.Ok: - Health.Value += hpIncreaseOk; + Health.Value += hpMultiplier * hp_increase_ok; break; case ManiaHitResult.Good: - Health.Value += hpIncreaseGood; + Health.Value += hpMultiplier * hp_increase_good; break; case ManiaHitResult.Great: - Health.Value += hpIncreaseGreat; + Health.Value += hpMultiplier * hp_increase_great; break; case ManiaHitResult.Perfect: - Health.Value += hpIncreasePerfect; + Health.Value += hpMultiplier * hp_increase_perfect; break; } From 3715171948983a9f95fe246143f56ef14e245d65 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 20:32:21 +0900 Subject: [PATCH 17/33] Ticks can't be missed. --- osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index fc2e8bec10..1be92f6dc4 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -69,7 +69,6 @@ namespace osu.Game.Rulesets.Mania.Scoring private const double hp_increase_perfect = 0.065; private double hpMissMultiplier = 1; - private const double hp_increase_tick_miss = -0.025; private const double hp_increase_miss = -0.125; public ManiaScoreProcessor() @@ -145,9 +144,6 @@ namespace osu.Game.Rulesets.Mania.Scoring switch (judgement.Result) { case HitResult.Miss: - if (isTick) - Health.Value += hpMissMultiplier * hp_increase_tick_miss; - else Health.Value += hpMissMultiplier * hp_increase_miss; break; case HitResult.Hit: From b28b7af887261f8b67d8daba0aff7ff5876ec2a2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 26 May 2017 20:42:03 +0900 Subject: [PATCH 18/33] Scale HP with drain rate a bit. --- .../Scoring/ManiaScoreProcessor.cs | 102 ++++++++++++++++-- 1 file changed, 93 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 1be92f6dc4..12c8386ae7 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -3,6 +3,7 @@ using System; using osu.Game.Beatmaps; +using osu.Game.Database; using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects.Drawables; @@ -39,6 +40,71 @@ namespace osu.Game.Rulesets.Mania.Scoring /// private const int combo_relevance_cap = 400; + /// + /// The hit HP multiplier at OD = 0. + /// + private const double hp_multiplier_min = 0.75; + + /// + /// The hit HP multiplier at OD = 0. + /// + private const double hp_multiplier_mid = 0.85; + + /// + /// The hit HP multiplier at OD = 0. + /// + private const double hp_multiplier_max = 1; + + /// + /// The default BAD hit HP increase. + /// + private const double hp_increase_bad = 0.005; + + /// + /// The default OK hit HP increase. + /// + private const double hp_increase_ok = 0.010; + + /// + /// The default GOOD hit HP increase. + /// + private const double hp_increase_good = 0.035; + + /// + /// The default tick hit HP increase. + /// + private const double hp_increase_tick = 0.040; + + /// + /// The default GREAT hit HP increase. + /// + private const double hp_increase_great = 0.055; + + /// + /// The default PERFECT hit HP increase. + /// + private const double hp_increase_perfect = 0.065; + + /// + /// The MISS HP multiplier at OD = 0. + /// + private const double hp_multiplier_miss_min = 0.5; + + /// + /// The MISS HP multiplier at OD = 5. + /// + private const double hp_multiplier_miss_mid = 0.75; + + /// + /// The MISS HP multiplier at OD = 10. + /// + private const double hp_multiplier_miss_max = 1; + + /// + /// The default MISS HP increase. + /// + private const double hp_increase_miss = -0.125; + /// /// The cumulative combo portion of the score. /// @@ -55,21 +121,35 @@ namespace osu.Game.Rulesets.Mania.Scoring /// private double bonusScore; + /// + /// The achieved by a perfect playthrough. + /// private double maxComboPortion; + + /// + /// The portion of the score dedicated to combo. + /// private double comboPortion; + + /// + /// The achieved by a perfect playthrough. + /// private int maxTotalHits; + + /// + /// The total hits. + /// private int totalHits; - private double hpMultiplier = 1; - private const double hp_increase_bad = 0.005; - private const double hp_increase_ok = 0.010; - private const double hp_increase_good = 0.035; - private const double hp_increase_tick = 0.040; - private const double hp_increase_great = 0.055; - private const double hp_increase_perfect = 0.065; - + /// + /// The MISS HP multiplier. + /// private double hpMissMultiplier = 1; - private const double hp_increase_miss = -0.125; + + /// + /// The HIT HP multiplier. + /// + private double hpMultiplier = 1; public ManiaScoreProcessor() { @@ -82,6 +162,10 @@ namespace osu.Game.Rulesets.Mania.Scoring protected override void ComputeTargets(Beatmap beatmap) { + BeatmapDifficulty difficulty = beatmap.BeatmapInfo.Difficulty; + hpMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_min, hp_multiplier_mid, hp_multiplier_max); + hpMissMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.DrainRate, hp_multiplier_miss_min, hp_multiplier_miss_mid, hp_multiplier_miss_max); + while (true) { foreach (var obj in beatmap.HitObjects) From e5e73b31b61c932fc39408e5a650369a4ad3cd6d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 11:42:43 +0900 Subject: [PATCH 19/33] Cleanup + slight xmldoc improvements. --- .../Scoring/ManiaScoreProcessor.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 12c8386ae7..95c5c58d51 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -105,6 +105,16 @@ namespace osu.Game.Rulesets.Mania.Scoring /// private const double hp_increase_miss = -0.125; + /// + /// The MISS HP multiplier. This is multiplied to the miss hp increase. + /// + private double hpMissMultiplier = 1; + + /// + /// The HIT HP multiplier. This is multiplied to hit hp increases. + /// + private double hpMultiplier = 1; + /// /// The cumulative combo portion of the score. /// @@ -141,16 +151,6 @@ namespace osu.Game.Rulesets.Mania.Scoring /// private int totalHits; - /// - /// The MISS HP multiplier. - /// - private double hpMissMultiplier = 1; - - /// - /// The HIT HP multiplier. - /// - private double hpMultiplier = 1; - public ManiaScoreProcessor() { } From f17b8acd13d5afffc865f543761cfce2680702b3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 11:45:16 +0900 Subject: [PATCH 20/33] Remove erroneous tab. --- osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 95c5c58d51..ebf99206ee 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -228,7 +228,7 @@ namespace osu.Game.Rulesets.Mania.Scoring switch (judgement.Result) { case HitResult.Miss: - Health.Value += hpMissMultiplier * hp_increase_miss; + Health.Value += hpMissMultiplier * hp_increase_miss; break; case HitResult.Hit: if (isTick) From e63108bd75ecdf69169432aeb2bcfdc0e43b76b3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 11:56:31 +0900 Subject: [PATCH 21/33] Add base for bar lines. --- osu.Game.Rulesets.Mania/Objects/Barline.cs | 9 +++++++++ .../Objects/Drawables/DrawableBarline.cs | 7 +++++++ .../Objects/Drawables/DrawableMajorBarline.cs | 7 +++++++ osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 3 +++ 4 files changed, 26 insertions(+) create mode 100644 osu.Game.Rulesets.Mania/Objects/Barline.cs create mode 100644 osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs create mode 100644 osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs diff --git a/osu.Game.Rulesets.Mania/Objects/Barline.cs b/osu.Game.Rulesets.Mania/Objects/Barline.cs new file mode 100644 index 0000000000..a9ce0559dc --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/Barline.cs @@ -0,0 +1,9 @@ +using osu.Game.Rulesets.Objects; + +namespace osu.Game.Rulesets.Mania.Objects +{ + public class Barline : HitObject + { + public bool IsMajor; + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs new file mode 100644 index 0000000000..605b9f83df --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs @@ -0,0 +1,7 @@ +namespace osu.Game.Rulesets.Mania.Objects.Drawables +{ + public class DrawableBarline + { + + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs new file mode 100644 index 0000000000..607cc66012 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs @@ -0,0 +1,7 @@ +namespace osu.Game.Rulesets.Mania.Objects.Drawables +{ + public class DrawableMajorBarline + { + + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 7a8ec25fe4..b45ce3c5df 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -62,6 +62,8 @@ + + @@ -70,6 +72,7 @@ + From ee7158aa9514c47dce10209aee6d84aed8fbdf20 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 14:44:42 +0900 Subject: [PATCH 22/33] Implement bar lines. --- osu.Game.Rulesets.Mania/Objects/Barline.cs | 14 +++- .../Objects/Drawables/DrawableBarline.cs | 69 ++++++++++++++++++- .../Objects/Drawables/DrawableMajorBarline.cs | 7 -- .../UI/ManiaHitRenderer.cs | 29 ++++++++ osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 51 ++++++++++---- .../osu.Game.Rulesets.Mania.csproj | 1 - 6 files changed, 146 insertions(+), 25 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs diff --git a/osu.Game.Rulesets.Mania/Objects/Barline.cs b/osu.Game.Rulesets.Mania/Objects/Barline.cs index a9ce0559dc..9b229a8d52 100644 --- a/osu.Game.Rulesets.Mania/Objects/Barline.cs +++ b/osu.Game.Rulesets.Mania/Objects/Barline.cs @@ -1,9 +1,19 @@ +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Objects { - public class Barline : HitObject + public class Barline : ManiaHitObject { - public bool IsMajor; + /// + /// The control point which this bar line is part of. + /// + public TimingControlPoint ControlPoint; + + /// + /// The index of the beat which this bar line represents within the control point. + /// This is a "major" beat at % == 0. + /// + public int BeatIndex; } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs index 605b9f83df..eee32a9da3 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs @@ -1,7 +1,72 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK; +using OpenTK.Input; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Game.Rulesets.Objects.Drawables; + namespace osu.Game.Rulesets.Mania.Objects.Drawables { - public class DrawableBarline + /// + /// Visualises a . Although this derives DrawableManiaHitObject, + /// this does not handle input/sound like a normal hit object. + /// + public class DrawableBarline : DrawableManiaHitObject { - + public DrawableBarline(Barline hitObject) + : base(hitObject, null) + { + AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.X; + + Add(new Box + { + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.X, + Height = 1 + }); + + int signatureRelativeIndex = hitObject.BeatIndex % (int)hitObject.ControlPoint.TimeSignature; + + switch (signatureRelativeIndex) + { + case 0: + Add(new EquilateralTriangle + { + Name = "Left triangle", + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopCentre, + Size = new Vector2(12), + X = -9, + Rotation = 90, + BypassAutoSizeAxes = Axes.Both + }); + + Add(new EquilateralTriangle + { + Name = "Right triangle", + Anchor = Anchor.BottomRight, + Origin = Anchor.TopCentre, + Size = new Vector2(12), + X = 9, + Rotation = -90, + BypassAutoSizeAxes = Axes.Both, + }); + break; + case 1: + case 3: + Alpha = 0.2f; + break; + } + } + + protected override void UpdateState(ArmedState state) + { + } } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs deleted file mode 100644 index 607cc66012..0000000000 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableMajorBarline.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace osu.Game.Rulesets.Mania.Objects.Drawables -{ - public class DrawableMajorBarline - { - - } -} \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs index 95b7979e43..871306b98c 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs @@ -6,9 +6,11 @@ using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Input; +using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Lists; +using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Beatmaps; @@ -85,6 +87,33 @@ namespace osu.Game.Rulesets.Mania.UI }; } + [BackgroundDependencyLoader] + private void load() + { + var maniaPlayfield = (ManiaPlayfield)Playfield; + + double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; + + SortedList timingPoints = Beatmap.ControlPointInfo.TimingPoints; + for (int i = 0; i < timingPoints.Count; i++) + { + TimingControlPoint point = timingPoints[i]; + + double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - point.BeatLength : lastObjectTime + point.BeatLength * (int)point.TimeSignature; + + int index = 0; + for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++) + { + maniaPlayfield.Add(new DrawableBarline(new Barline + { + StartTime = t, + ControlPoint = point, + BeatIndex = index + })); + } + } + } + public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this); protected override BeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index ff763f87c4..dcf725e091 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -21,6 +21,7 @@ using osu.Game.Rulesets.Mania.Timing; using osu.Framework.Input; using osu.Framework.Graphics.Transforms; using osu.Framework.MathUtils; +using osu.Game.Rulesets.Mania.Objects.Drawables; namespace osu.Game.Rulesets.Mania.UI { @@ -77,27 +78,40 @@ namespace osu.Game.Rulesets.Mania.UI { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.Y, - AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { - new Box + new Container { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black - }, - columns = new FillFlowContainer - { - Name = "Columns", + Name = "Masked elements", + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Direction = FillDirection.Horizontal, - Padding = new MarginPadding { Left = 1, Right = 1 }, - Spacing = new Vector2(1, 0) + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black + }, + columns = new FillFlowContainer + { + Name = "Columns", + RelativeSizeAxes = Axes.Y, + AutoSizeAxes = Axes.X, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { Left = 1, Right = 1 }, + Spacing = new Vector2(1, 0) + } + } }, new Container { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = HIT_TARGET_POSITION }, Children = new[] @@ -105,7 +119,10 @@ namespace osu.Game.Rulesets.Mania.UI barlineContainer = new ControlPointContainer(timingChanges) { Name = "Bar lines", - RelativeSizeAxes = Axes.Both, + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Y + // Width is set in the Update method } } } @@ -190,6 +207,7 @@ namespace osu.Game.Rulesets.Mania.UI } public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h); + public void Add(DrawableBarline barline) => barlineContainer.Add(barline); protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { @@ -234,6 +252,13 @@ namespace osu.Game.Rulesets.Mania.UI TransformTo(() => TimeSpan, newTimeSpan, duration, easing, new TransformTimeSpan()); } + protected override void Update() + { + // Due to masking differences, it is not possible to get the width of the columns container automatically + // While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually + barlineContainer.Width = columns.Width; + } + private class TransformTimeSpan : Transform { public override double CurrentValue diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index b45ce3c5df..cc5e6dd81e 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -63,7 +63,6 @@ - From 44f1d906eac658aa586e1bc2ec326a8194f74f64 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 14:47:51 +0900 Subject: [PATCH 23/33] Store tick count locally, remove HoldNote TickCount. --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 5 ----- osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs | 8 ++++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 3550d561c1..3d988d9dda 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -61,11 +61,6 @@ namespace osu.Game.Rulesets.Mania.Objects tickSpacing = timingPoint.BeatLength / difficulty.SliderTickRate; } - /// - /// Total number of hold note ticks. - /// - public int TotalTicks => Ticks.Count(); - /// /// The scoring scoring ticks of the hold note. /// diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index ebf99206ee..798d4b8c5b 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -2,6 +2,7 @@ // 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.Database; using osu.Game.Rulesets.Mania.Judgements; @@ -170,6 +171,8 @@ namespace osu.Game.Rulesets.Mania.Scoring { foreach (var obj in beatmap.HitObjects) { + var holdNote = obj as HoldNote; + if (obj is Note) { AddJudgement(new ManiaJudgement @@ -178,7 +181,7 @@ namespace osu.Game.Rulesets.Mania.Scoring ManiaResult = ManiaHitResult.Perfect }); } - else if (obj is HoldNote) + else if (holdNote != null) { // Head AddJudgement(new ManiaJudgement @@ -188,7 +191,8 @@ namespace osu.Game.Rulesets.Mania.Scoring }); // Ticks - for (int i = 0; i < ((HoldNote)obj).TotalTicks; i++) + int tickCount = holdNote.Ticks.Count(); + for (int i = 0; i < tickCount; i++) { AddJudgement(new HoldNoteTickJudgement { From 4fce0c11891fdc8fbc7457391a8b9d406574e785 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 15:01:13 +0900 Subject: [PATCH 24/33] Rename Barline -> BarLine. --- osu.Game.Rulesets.Mania/Objects/{Barline.cs => BarLine.cs} | 2 +- .../Drawables/{DrawableBarline.cs => DrawableBarLine.cs} | 6 +++--- osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 2 +- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename osu.Game.Rulesets.Mania/Objects/{Barline.cs => BarLine.cs} (92%) rename osu.Game.Rulesets.Mania/Objects/Drawables/{DrawableBarline.cs => DrawableBarLine.cs} (92%) diff --git a/osu.Game.Rulesets.Mania/Objects/Barline.cs b/osu.Game.Rulesets.Mania/Objects/BarLine.cs similarity index 92% rename from osu.Game.Rulesets.Mania/Objects/Barline.cs rename to osu.Game.Rulesets.Mania/Objects/BarLine.cs index 9b229a8d52..b635977fd1 100644 --- a/osu.Game.Rulesets.Mania/Objects/Barline.cs +++ b/osu.Game.Rulesets.Mania/Objects/BarLine.cs @@ -3,7 +3,7 @@ using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Objects { - public class Barline : ManiaHitObject + public class BarLine : ManiaHitObject { /// /// The control point which this bar line is part of. diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs similarity index 92% rename from osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs rename to osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs index eee32a9da3..9b1e1e4e3d 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarline.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs @@ -12,12 +12,12 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.Objects.Drawables { /// - /// Visualises a . Although this derives DrawableManiaHitObject, + /// Visualises a . Although this derives DrawableManiaHitObject, /// this does not handle input/sound like a normal hit object. /// - public class DrawableBarline : DrawableManiaHitObject + public class DrawableBarLine : DrawableManiaHitObject { - public DrawableBarline(Barline hitObject) + public DrawableBarLine(BarLine hitObject) : base(hitObject, null) { AutoSizeAxes = Axes.Y; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs index 871306b98c..4ddb7ad42a 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Mania.UI int index = 0; for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++) { - maniaPlayfield.Add(new DrawableBarline(new Barline + maniaPlayfield.Add(new DrawableBarLine(new BarLine { StartTime = t, ControlPoint = point, diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index dcf725e091..d1b6fbaf7c 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -207,7 +207,7 @@ namespace osu.Game.Rulesets.Mania.UI } public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h); - public void Add(DrawableBarline barline) => barlineContainer.Add(barline); + public void Add(DrawableBarLine barline) => barlineContainer.Add(barline); protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index cc5e6dd81e..3d5614bd90 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -62,7 +62,7 @@ - + @@ -71,7 +71,7 @@ - + From 32550bda4f796c9b8f4694a77d7a3348fb967052 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 15:18:06 +0900 Subject: [PATCH 25/33] Make drawable bar line a bit more sane. --- .../Objects/Drawables/DrawableBarLine.cs | 57 +++++++++---------- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 10 ++-- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs index 9b1e1e4e3d..e253989ebc 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs @@ -17,8 +17,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// public class DrawableBarLine : DrawableManiaHitObject { - public DrawableBarLine(BarLine hitObject) - : base(hitObject, null) + public DrawableBarLine(BarLine barLine) + : base(barLine, null) { AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; @@ -31,38 +31,35 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Height = 1 }); - int signatureRelativeIndex = hitObject.BeatIndex % (int)hitObject.ControlPoint.TimeSignature; + bool isMajor = barLine.BeatIndex % (int)barLine.ControlPoint.TimeSignature == 0; - switch (signatureRelativeIndex) + if (isMajor) { - case 0: - Add(new EquilateralTriangle - { - Name = "Left triangle", - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopCentre, - Size = new Vector2(12), - X = -9, - Rotation = 90, - BypassAutoSizeAxes = Axes.Both - }); + Add(new EquilateralTriangle + { + Name = "Left triangle", + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopCentre, + Size = new Vector2(12), + X = -9, + Rotation = 90, + BypassAutoSizeAxes = Axes.Both + }); - Add(new EquilateralTriangle - { - Name = "Right triangle", - Anchor = Anchor.BottomRight, - Origin = Anchor.TopCentre, - Size = new Vector2(12), - X = 9, - Rotation = -90, - BypassAutoSizeAxes = Axes.Both, - }); - break; - case 1: - case 3: - Alpha = 0.2f; - break; + Add(new EquilateralTriangle + { + Name = "Right triangle", + Anchor = Anchor.BottomRight, + Origin = Anchor.TopCentre, + Size = new Vector2(12), + X = 9, + Rotation = -90, + BypassAutoSizeAxes = Axes.Both, + }); } + + if (!isMajor && barLine.BeatIndex % 2 == 1) + Alpha = 0.2f; } protected override void UpdateState(ArmedState state) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index d1b6fbaf7c..2e6b63579e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Mania.UI private readonly FlowContainer columns; public IEnumerable Columns => columns.Children; - private readonly ControlPointContainer barlineContainer; + private readonly ControlPointContainer barLineContainer; private List normalColumnColours = new List(); private Color4 specialColumnColour; @@ -116,7 +116,7 @@ namespace osu.Game.Rulesets.Mania.UI Padding = new MarginPadding { Top = HIT_TARGET_POSITION }, Children = new[] { - barlineContainer = new ControlPointContainer(timingChanges) + barLineContainer = new ControlPointContainer(timingChanges) { Name = "Bar lines", Anchor = Anchor.TopCentre, @@ -207,7 +207,7 @@ namespace osu.Game.Rulesets.Mania.UI } public override void Add(DrawableHitObject h) => Columns.ElementAt(h.HitObject.Column).Add(h); - public void Add(DrawableBarLine barline) => barlineContainer.Add(barline); + public void Add(DrawableBarLine barline) => barLineContainer.Add(barline); protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { @@ -242,7 +242,7 @@ namespace osu.Game.Rulesets.Mania.UI timeSpan = MathHelper.Clamp(timeSpan, time_span_min, time_span_max); - barlineContainer.TimeSpan = value; + barLineContainer.TimeSpan = value; Columns.ForEach(c => c.ControlPointContainer.TimeSpan = value); } } @@ -256,7 +256,7 @@ namespace osu.Game.Rulesets.Mania.UI { // Due to masking differences, it is not possible to get the width of the columns container automatically // While masking on effectively only the Y-axis, so we need to set the width of the bar line container manually - barlineContainer.Width = columns.Width; + barLineContainer.Width = columns.Width; } private class TransformTimeSpan : Transform From 4b6f2efa76a469cf039712fbaed361ad340697d3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 15:30:05 +0900 Subject: [PATCH 26/33] Cleanups. --- osu.Game.Rulesets.Mania/Objects/BarLine.cs | 3 +- .../Objects/Drawables/DrawableBarLine.cs | 35 +++++++++++-------- .../UI/ManiaHitRenderer.cs | 1 + 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/BarLine.cs b/osu.Game.Rulesets.Mania/Objects/BarLine.cs index b635977fd1..50e326086e 100644 --- a/osu.Game.Rulesets.Mania/Objects/BarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/BarLine.cs @@ -1,5 +1,4 @@ using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Objects { @@ -12,7 +11,7 @@ namespace osu.Game.Rulesets.Mania.Objects /// /// The index of the beat which this bar line represents within the control point. - /// This is a "major" beat at % == 0. + /// This is a "major" bar line if % == 0. /// public int BeatIndex; } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs index e253989ebc..7554472507 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs @@ -1,10 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; -using OpenTK.Input; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Rulesets.Objects.Drawables; @@ -17,18 +14,28 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// public class DrawableBarLine : DrawableManiaHitObject { + /// + /// Height of major bar line triangles. + /// + private const float triangle_height = 12; + + /// + /// Offset of the major bar line triangles from the sides of the bar line. + /// + private const float triangle_offset = 9; + public DrawableBarLine(BarLine barLine) - : base(barLine, null) + : base(barLine) { - AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; + Height = 1; Add(new Box { + Name = "Bar line", Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.X, - Height = 1 + RelativeSizeAxes = Axes.Both, }); bool isMajor = barLine.BeatIndex % (int)barLine.ControlPoint.TimeSignature == 0; @@ -40,10 +47,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Name = "Left triangle", Anchor = Anchor.BottomLeft, Origin = Anchor.TopCentre, - Size = new Vector2(12), - X = -9, - Rotation = 90, - BypassAutoSizeAxes = Axes.Both + Size = new Vector2(triangle_height), + X = -triangle_offset, + Rotation = 90 }); Add(new EquilateralTriangle @@ -51,10 +57,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables Name = "Right triangle", Anchor = Anchor.BottomRight, Origin = Anchor.TopCentre, - Size = new Vector2(12), - X = 9, - Rotation = -90, - BypassAutoSizeAxes = Axes.Both, + Size = new Vector2(triangle_height), + X = triangle_offset, + Rotation = -90 }); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs index 4ddb7ad42a..57477147d5 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaHitRenderer.cs @@ -99,6 +99,7 @@ namespace osu.Game.Rulesets.Mania.UI { TimingControlPoint point = timingPoints[i]; + // Stop on the beat before the next timing point, or if there is no next timing point stop slightly past the last object double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - point.BeatLength : lastObjectTime + point.BeatLength * (int)point.TimeSignature; int index = 0; From 0327adcba8e14c3caf78e9390289f7c54f72659d Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 29 May 2017 15:35:50 +0900 Subject: [PATCH 27/33] Update HoldNote.cs --- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 3d988d9dda..92f570476e 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -1,8 +1,7 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Database; using osu.Game.Rulesets.Objects.Types; From 586fc782cf5ec2da379f518d3924bafe50fd43d5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 29 May 2017 16:00:14 +0900 Subject: [PATCH 28/33] Fix line endings. --- osu.Game.Rulesets.Mania/Objects/BarLine.cs | 37 +++-- .../Objects/Drawables/DrawableBarLine.cs | 146 +++++++++--------- 2 files changed, 93 insertions(+), 90 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/BarLine.cs b/osu.Game.Rulesets.Mania/Objects/BarLine.cs index 50e326086e..76a3d3920d 100644 --- a/osu.Game.Rulesets.Mania/Objects/BarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/BarLine.cs @@ -1,18 +1,21 @@ -using osu.Game.Beatmaps.ControlPoints; - -namespace osu.Game.Rulesets.Mania.Objects -{ - public class BarLine : ManiaHitObject - { - /// - /// The control point which this bar line is part of. - /// - public TimingControlPoint ControlPoint; - - /// - /// The index of the beat which this bar line represents within the control point. - /// This is a "major" bar line if % == 0. - /// - public int BeatIndex; - } +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Beatmaps.ControlPoints; + +namespace osu.Game.Rulesets.Mania.Objects +{ + public class BarLine : ManiaHitObject + { + /// + /// The control point which this bar line is part of. + /// + public TimingControlPoint ControlPoint; + + /// + /// The index of the beat which this bar line represents within the control point. + /// This is a "major" bar line if % == 0. + /// + public int BeatIndex; + } } \ No newline at end of file diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs index 7554472507..0b4d8b2d4e 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableBarLine.cs @@ -1,74 +1,74 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Game.Rulesets.Objects.Drawables; - -namespace osu.Game.Rulesets.Mania.Objects.Drawables -{ - /// - /// Visualises a . Although this derives DrawableManiaHitObject, - /// this does not handle input/sound like a normal hit object. - /// - public class DrawableBarLine : DrawableManiaHitObject - { - /// - /// Height of major bar line triangles. - /// - private const float triangle_height = 12; - - /// - /// Offset of the major bar line triangles from the sides of the bar line. - /// - private const float triangle_offset = 9; - - public DrawableBarLine(BarLine barLine) - : base(barLine) - { - RelativeSizeAxes = Axes.X; - Height = 1; - - Add(new Box - { - Name = "Bar line", - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, - RelativeSizeAxes = Axes.Both, - }); - - bool isMajor = barLine.BeatIndex % (int)barLine.ControlPoint.TimeSignature == 0; - - if (isMajor) - { - Add(new EquilateralTriangle - { - Name = "Left triangle", - Anchor = Anchor.BottomLeft, - Origin = Anchor.TopCentre, - Size = new Vector2(triangle_height), - X = -triangle_offset, - Rotation = 90 - }); - - Add(new EquilateralTriangle - { - Name = "Right triangle", - Anchor = Anchor.BottomRight, - Origin = Anchor.TopCentre, - Size = new Vector2(triangle_height), - X = triangle_offset, - Rotation = -90 - }); - } - - if (!isMajor && barLine.BeatIndex % 2 == 1) - Alpha = 0.2f; - } - - protected override void UpdateState(ArmedState state) - { - } - } +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Game.Rulesets.Objects.Drawables; + +namespace osu.Game.Rulesets.Mania.Objects.Drawables +{ + /// + /// Visualises a . Although this derives DrawableManiaHitObject, + /// this does not handle input/sound like a normal hit object. + /// + public class DrawableBarLine : DrawableManiaHitObject + { + /// + /// Height of major bar line triangles. + /// + private const float triangle_height = 12; + + /// + /// Offset of the major bar line triangles from the sides of the bar line. + /// + private const float triangle_offset = 9; + + public DrawableBarLine(BarLine barLine) + : base(barLine) + { + RelativeSizeAxes = Axes.X; + Height = 1; + + Add(new Box + { + Name = "Bar line", + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + RelativeSizeAxes = Axes.Both, + }); + + bool isMajor = barLine.BeatIndex % (int)barLine.ControlPoint.TimeSignature == 0; + + if (isMajor) + { + Add(new EquilateralTriangle + { + Name = "Left triangle", + Anchor = Anchor.BottomLeft, + Origin = Anchor.TopCentre, + Size = new Vector2(triangle_height), + X = -triangle_offset, + Rotation = 90 + }); + + Add(new EquilateralTriangle + { + Name = "Right triangle", + Anchor = Anchor.BottomRight, + Origin = Anchor.TopCentre, + Size = new Vector2(triangle_height), + X = triangle_offset, + Rotation = -90 + }); + } + + if (!isMajor && barLine.BeatIndex % 2 == 1) + Alpha = 0.2f; + } + + protected override void UpdateState(ArmedState state) + { + } + } } \ No newline at end of file From 2f063ee41d8e80663a1b6bb316bc74c5ce8a1060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 29 May 2017 18:20:51 +0200 Subject: [PATCH 29/33] Make triangle edges smooth again --- osu.Game/Graphics/Backgrounds/Triangles.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 9a19819af8..2e4fb79079 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -24,6 +24,12 @@ namespace osu.Game.Graphics.Backgrounds { private const float triangle_size = 100; + /// + /// How many screen-space pixels are smoothed over. + /// Same behavior as Sprite's EdgeSmoothness. + /// + private const float edge_smoothness = 1; + public override bool HandleInput => false; public Color4 ColourLight = Color4.White; @@ -211,20 +217,28 @@ namespace osu.Game.Graphics.Backgrounds Shader.Bind(); Texture.TextureGL.Bind(); + Vector2 localInflationAmount = edge_smoothness * DrawInfo.MatrixInverse.ExtractScale().Xy; + foreach (TriangleParticle particle in Parts) { - var offset = new Vector2(particle.Scale * 0.5f, particle.Scale * 0.866f); + var offset = triangle_size * new Vector2(particle.Scale * 0.5f, particle.Scale * 0.866f); + var size = new Vector2(2 * offset.X, offset.Y); var triangle = new Triangle( particle.Position * Size * DrawInfo.Matrix, - (particle.Position * Size + offset * triangle_size) * DrawInfo.Matrix, - (particle.Position * Size + new Vector2(-offset.X, offset.Y) * triangle_size) * DrawInfo.Matrix + (particle.Position * Size + offset) * DrawInfo.Matrix, + (particle.Position * Size + new Vector2(-offset.X, offset.Y)) * DrawInfo.Matrix ); ColourInfo colourInfo = DrawInfo.Colour; colourInfo.ApplyChild(particle.Colour); - Texture.DrawTriangle(triangle, colourInfo, null, Shared.VertexBatch.Add); + Texture.DrawTriangle( + triangle, + colourInfo, + null, + Shared.VertexBatch.Add, + Vector2.Divide(localInflationAmount, size)); } Shader.Unbind(); From d3f2d480a8b8f637d7b8d65d55523ce338a3e6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 29 May 2017 18:24:17 +0200 Subject: [PATCH 30/33] Fix incorrect triangle state within the first frame --- osu.Game/Graphics/Backgrounds/Triangles.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 2e4fb79079..dd46713102 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -109,6 +109,8 @@ namespace osu.Game.Graphics.Backgrounds Invalidate(Invalidation.DrawNode, shallPropagate: false); + addTriangles(false); + for (int i = 0; i < parts.Count; i++) { TriangleParticle newParticle = parts[i]; @@ -118,7 +120,6 @@ namespace osu.Game.Graphics.Backgrounds (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : 1; - newParticle.Position += new Vector2(0, -(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); newParticle.Colour.A = adjustedAlpha; @@ -132,8 +133,6 @@ namespace osu.Game.Graphics.Backgrounds if (bottomPos < 0) parts.RemoveAt(i); } - - addTriangles(false); } private void addTriangles(bool randomY) From db444a61cb466269fa943cfbf69b62ceb857f7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 29 May 2017 18:30:49 +0200 Subject: [PATCH 31/33] Reduce per-triangle per-frame computation significantly --- osu.Game/Graphics/Backgrounds/Triangles.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index dd46713102..2ecaf9f7c7 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -109,27 +109,27 @@ namespace osu.Game.Graphics.Backgrounds Invalidate(Invalidation.DrawNode, shallPropagate: false); - addTriangles(false); + if (CreateNewTriangles) + addTriangles(false); + + float adjustedAlpha = HideAlphaDiscrepancies ? + // Cubically scale alpha to make it drop off more sharply. + (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : + 1; + + float movedDistance = ((float)Time.Elapsed / 950) * Velocity * (50 / DrawHeight) / triangleScale; for (int i = 0; i < parts.Count; i++) { TriangleParticle newParticle = parts[i]; - float adjustedAlpha = HideAlphaDiscrepancies ? - // Cubically scale alpha to make it drop off more sharply. - (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : - 1; - - newParticle.Position += new Vector2(0, -(parts[i].Scale * (50 / DrawHeight)) / triangleScale * Velocity) * ((float)Time.Elapsed / 950); + // Scale moved distance by the size of the triangle. Smaller triangles should move more slowly. + newParticle.Position.Y += -parts[i].Scale * movedDistance; newParticle.Colour.A = adjustedAlpha; parts[i] = newParticle; - if (!CreateNewTriangles) - continue; - float bottomPos = parts[i].Position.Y + triangle_size * parts[i].Scale * 0.866f / DrawHeight; - if (bottomPos < 0) parts.RemoveAt(i); } From 298c0f5757610b92c07ec6a2983c89ccc354a1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 29 May 2017 19:08:06 +0200 Subject: [PATCH 32/33] Structure velocity code more clearly and avoid redundant parenthesis --- osu.Game/Graphics/Backgrounds/Triangles.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 2ecaf9f7c7..7a2345a80c 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -23,6 +23,7 @@ namespace osu.Game.Graphics.Backgrounds public class Triangles : Drawable { private const float triangle_size = 100; + private const float base_velocity = 50; /// /// How many screen-space pixels are smoothed over. @@ -117,14 +118,18 @@ namespace osu.Game.Graphics.Backgrounds (float)Math.Pow(DrawInfo.Colour.AverageColour.Linear.A, 3) : 1; - float movedDistance = ((float)Time.Elapsed / 950) * Velocity * (50 / DrawHeight) / triangleScale; + float elapsedSeconds = (float)Time.Elapsed / 1000; + // Since position is relative, the velocity needs to scale inversely with DrawHeight. + // Since we will later multiply by the scale of individual triangles we normalize by + // dividing by triangleScale. + float movedDistance = -elapsedSeconds * Velocity * base_velocity / (DrawHeight * triangleScale); for (int i = 0; i < parts.Count; i++) { TriangleParticle newParticle = parts[i]; // Scale moved distance by the size of the triangle. Smaller triangles should move more slowly. - newParticle.Position.Y += -parts[i].Scale * movedDistance; + newParticle.Position.Y += parts[i].Scale * movedDistance; newParticle.Colour.A = adjustedAlpha; parts[i] = newParticle; From fde579262f085f8382157d197f854a04657406a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 30 May 2017 09:54:29 +0900 Subject: [PATCH 33/33] User a simpler method to hide the background icon --- osu.Game/Overlays/Chat/ChatTabControl.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 9c26632a8b..a281cff7db 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -223,8 +223,7 @@ namespace osu.Game.Overlays.Chat Depth = float.MaxValue; Width = 45; - icon.Icon = 0; - icon.X = 0; + icon.Alpha = 0; text.TextSize = 45; textBold.TextSize = 45;