From f26cf7bf68599f2ea84c8b020df832c6a5a8c694 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 16:55:57 +0900 Subject: [PATCH 001/348] Add basic DrawableHit (no graphics yet, just input). --- .../Objects/Drawable/DrawableHit.cs | 82 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 2 files changed, 83 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs new file mode 100644 index 0000000000..caf4fee335 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -0,0 +1,82 @@ +using OpenTK.Input; +using osu.Framework.Input; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; +using System; +using System.Collections.Generic; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public abstract class DrawableHit : DrawableTaikoHitObject + { + /// + /// A list of keys which can result in hits for this HitObject. + /// + protected abstract List HitKeys { get; } + + /// + /// A list of keys which this hit object will accept. These are the standard Taiko keys for now. + /// These should be moved to bindings later. + /// + private List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); + + /// + /// Whether the last key pressed is a valid hit key. + /// + private bool validKeyPressed; + + protected DrawableHit(TaikoHitObject hitObject) + : base(hitObject) + { + } + + protected override void CheckJudgement(bool userTriggered) + { + if (!userTriggered) + { + if (Judgement.TimeOffset > HitObject.HitWindowGood) + Judgement.Result = HitResult.Miss; + return; + } + + double hitOffset = Math.Abs(Judgement.TimeOffset); + + if (hitOffset > HitObject.HitWindowMiss) + return; + + if (!validKeyPressed) + Judgement.Result = HitResult.Miss; + else if (hitOffset < HitObject.HitWindowGood) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = hitOffset < HitObject.HitWindowGreat ? TaikoScoreResult.Great : TaikoScoreResult.Good; + } + else + Judgement.Result = HitResult.Miss; + } + + protected virtual bool HandleKeyPress(Key key) + { + if (Judgement.Result.HasValue) + return false; + + validKeyPressed = HitKeys.Contains(key); + + return UpdateJudgement(true); + } + + protected sealed override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + // Make sure we don't handle held-down keys + if (args.Repeat) + return false; + + // Check if we've pressed a valid taiko key + if (!validKeys.Contains(args.Key)) + return false; + + // Handle it! + return HandleKeyPress(args.Key); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index aab9a17276..dbd58d4666 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,6 +50,7 @@ + From 863d4959af1f4c7153b2c4f4763446cfc7aea845 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 17:38:24 +0900 Subject: [PATCH 002/348] Make OnKeyDown non-sealed. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index caf4fee335..46cf9e5f87 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -65,7 +65,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable return UpdateJudgement(true); } - protected sealed override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { // Make sure we don't handle held-down keys if (args.Repeat) From 1892d869215b5a525e734adc220a8e69b0672bf6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 17:38:49 +0900 Subject: [PATCH 003/348] Add basic DrawableHitFinisher (no graphics yet, just input). --- .../Objects/Drawable/DrawableHitFinisher.cs | 80 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 2 files changed, 81 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs new file mode 100644 index 0000000000..22fc83874b --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs @@ -0,0 +1,80 @@ +using OpenTK.Input; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework.Input; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public abstract class DrawableHitFinisher : DrawableHit + { + /// + /// The lenience for the second key press. + /// This does not adjust by map difficulty in ScoreV2 yet. + /// + private const double second_hit_window = 30; + + private double firstHitTime; + private Key firstHitKey; + + protected DrawableHitFinisher(TaikoHitObject hitObject) + : base(hitObject) + { + } + + protected override void CheckJudgement(bool userTriggered) + { + if (!Judgement.Result.HasValue) + { + base.CheckJudgement(userTriggered); + return; + } + + if (!userTriggered) + return; + + // If we get here, we're assured that the key pressed is the correct secondary key + + if (Math.Abs(firstHitTime - Time.Current) < second_hit_window) + Judgement.SecondHit = true; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + // Check if we've handled the initial key + if (!Judgement.Result.HasValue) + { + bool result = base.OnKeyDown(state, args); + + if (result) + { + firstHitTime = Time.Current; + firstHitKey = args.Key; + } + + return result; + } + + // If we've already hit the second key, don't handle this object any further + if (Judgement.SecondHit) + return false; + + // Don't handle represses of the same key + if (firstHitKey == args.Key) + return false; + + // Don't handle invalid hit key presses + if (!HitKeys.Contains(args.Key)) + return false; + + // If we're not holding the first key down still, assume the intention + // was not to hit the finisher with both keys simultaneously + if (!state.Keyboard.Keys.Contains(firstHitKey)) + return false; + + return UpdateJudgement(true); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 3a79d721c6..5b8a1fd2b8 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,6 +52,7 @@ + From 891bd011c6fe86e9d7380544470b64c32de2ffa7 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 18:54:44 +0900 Subject: [PATCH 004/348] Add basic DrawableBash (no graphics yet, just input). --- .../Objects/Drawable/DrawableBash.cs | 79 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 2 files changed, 80 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs new file mode 100644 index 0000000000..b69546e1aa --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Input; +using System.Collections.Generic; +using osu.Framework.Input; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; +using System; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableBash : DrawableTaikoHitObject + { + /// + /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. + /// These should be moved to bindings later. + /// + private List validKeys { get; } = new List(new[] { Key.D, Key.F, Key.J, Key.K }); + + /// + /// The amount of times the user has hit this bash. + /// + private int userHits; + + public DrawableBash(TaikoHitObject hitObject) + : base(hitObject) + { + } + + protected override void CheckJudgement(bool userTriggered) + { + if (userTriggered) + { + if (Time.Current < HitObject.StartTime) + return; + + userHits++; + + if (userHits == HitObject.RequiredHits) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = TaikoScoreResult.Great; + } + } + else + { + if (Judgement.TimeOffset < 0) + return; + + if (userHits > HitObject.RequiredHits / 2) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = TaikoScoreResult.Good; + } + else + Judgement.Result = HitResult.Miss; + } + } + + protected override void Update() + { + UpdateScrollPosition(Math.Min(Time.Current, HitObject.StartTime)); + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (Judgement.Result.HasValue) + return false; + + if (!validKeys.Contains(args.Key)) + return false; + + UpdateJudgement(true); + + return true; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index bdc8edb62e..73963a828c 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -51,6 +51,7 @@ + From 938da01540c5b836baadb8fd06efae3c070d7859 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 18:56:58 +0900 Subject: [PATCH 005/348] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index 46cf9e5f87..dc5d846ebc 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public abstract class DrawableHit : DrawableTaikoHitObject + public abstract class DrawableHit : DrawableTaikoHitObject { /// /// A list of keys which can result in hits for this HitObject. From a2d07acb4b6089d67852b00d2cb28c6c27439c16 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 18:59:21 +0900 Subject: [PATCH 006/348] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index b69546e1aa..4e848c76c3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableBash : DrawableTaikoHitObject + public class DrawableBash : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -23,8 +23,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private int userHits; - public DrawableBash(TaikoHitObject hitObject) - : base(hitObject) + public DrawableBash(Bash bash) + : base(bash) { } From 1ede12d847468d9b5e2826df79b17dc8d906c2db Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:08:50 +0900 Subject: [PATCH 007/348] Add basic DrawableDrumRollTick (no graphics yet, just input). --- .../TaikoDrumRollTickJudgementInfo.cs | 21 +++++++ .../Objects/Drawable/DrawableDrumRollTick.cs | 60 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 2 + 3 files changed, 83 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgementInfo.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgementInfo.cs b/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgementInfo.cs new file mode 100644 index 0000000000..ff9c4c4512 --- /dev/null +++ b/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgementInfo.cs @@ -0,0 +1,21 @@ +namespace osu.Game.Modes.Taiko.Judgements +{ + public class TaikoDrumRollTickJudgementInfo : TaikoJudgementInfo + { + protected override int ScoreToInt(TaikoScoreResult result) + { + switch (result) + { + default: + return 0; + case TaikoScoreResult.Great: + return 200; + } + } + + protected override int AccuracyScoreToInt(TaikoScoreResult result) + { + return 0; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs new file mode 100644 index 0000000000..3bd121321b --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -0,0 +1,60 @@ +using OpenTK.Input; +using System.Collections.Generic; +using osu.Game.Modes.Taiko.Judgements; +using System; +using osu.Game.Modes.Objects.Drawables; +using osu.Framework.Input; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableDrumRollTick : DrawableTaikoHitObject + { + /// + /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. + /// These should be moved to bindings later. + /// + private List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); + + public DrawableDrumRollTick(DrumRollTick tick) + : base(tick) + { + } + + protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoDrumRollTickJudgementInfo(); + + protected override void CheckJudgement(bool userTriggered) + { + if (!userTriggered) + { + if (Judgement.TimeOffset > HitObject.TickTimeDistance / 2) + Judgement.Result = Modes.Objects.Drawables.HitResult.Miss; + return; + } + + if (Math.Abs(Judgement.TimeOffset) < HitObject.TickTimeDistance / 2) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = TaikoScoreResult.Great; + } + } + + protected override void Update() + { + // Drum roll ticks shouldn't move + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) + return false; + + if (Judgement.Result.HasValue) + return false; + + if (!validKeys.Contains(args.Key)) + return false; + + return UpdateJudgement(true); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index d8cd0d4ebb..61c3d460c0 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -49,8 +49,10 @@ + + From ad396c65ee6e9c6774d15e5bc4abdb52394c1375 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:24:39 +0900 Subject: [PATCH 008/348] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index dc5d846ebc..46cf9e5f87 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public abstract class DrawableHit : DrawableTaikoHitObject + public abstract class DrawableHit : DrawableTaikoHitObject { /// /// A list of keys which can result in hits for this HitObject. From e3afa9bf715603a6ecd5f8e5decf82ea2507eab0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:25:55 +0900 Subject: [PATCH 009/348] Fix post-merge errors. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs index 4e848c76c3..00abd3017d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableBash : DrawableTaikoHitObject + public class DrawableBash : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -23,9 +23,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private int userHits; + private Bash bash; + public DrawableBash(Bash bash) : base(bash) { + this.bash = bash; } protected override void CheckJudgement(bool userTriggered) @@ -37,7 +40,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable userHits++; - if (userHits == HitObject.RequiredHits) + if (userHits == bash.RequiredHits) { Judgement.Result = HitResult.Hit; Judgement.Score = TaikoScoreResult.Great; @@ -48,7 +51,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (Judgement.TimeOffset < 0) return; - if (userHits > HitObject.RequiredHits / 2) + if (userHits > bash.RequiredHits / 2) { Judgement.Result = HitResult.Hit; Judgement.Score = TaikoScoreResult.Good; From 7860199fbda8360182d15019d41e7efb488bde74 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:27:06 +0900 Subject: [PATCH 010/348] Fix post-merge errors. --- .../Objects/Drawable/DrawableDrumRollTick.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index 3bd121321b..043fe32dca 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -7,7 +7,7 @@ using osu.Framework.Input; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableDrumRollTick : DrawableTaikoHitObject + public class DrawableDrumRollTick : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -15,9 +15,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); + private DrumRollTick tick; + public DrawableDrumRollTick(DrumRollTick tick) : base(tick) { + this.tick = tick; } protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoDrumRollTickJudgementInfo(); @@ -26,12 +29,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { if (!userTriggered) { - if (Judgement.TimeOffset > HitObject.TickTimeDistance / 2) + if (Judgement.TimeOffset > tick.TickTimeDistance / 2) Judgement.Result = Modes.Objects.Drawables.HitResult.Miss; return; } - if (Math.Abs(Judgement.TimeOffset) < HitObject.TickTimeDistance / 2) + if (Math.Abs(Judgement.TimeOffset) < tick.TickTimeDistance / 2) { Judgement.Result = HitResult.Hit; Judgement.Score = TaikoScoreResult.Great; From ecd6958eeae12a7a5a608d49ed1165a2f3a8e5b9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:30:22 +0900 Subject: [PATCH 011/348] Add basic DrawableDrumRoll (no graphics yet, just input). --- .../Objects/Drawable/DrawableDrumRoll.cs | 50 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 2 files changed, 51 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs new file mode 100644 index 0000000000..70790d2ded --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -0,0 +1,50 @@ +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; +using System.Linq; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableDrumRoll : DrawableTaikoHitObject + { + private DrumRoll drumRoll; + + public DrawableDrumRoll(DrumRoll drumRoll) + : base(drumRoll) + { + this.drumRoll = drumRoll; + + int tickIndex = 0; + foreach (var tick in drumRoll.Ticks) + { + var newTick = new DrawableDrumRollTick(tick) + { + Depth = tickIndex, + X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration) + }; + + AddNested(newTick); + + tickIndex++; + } + } + + protected override void CheckJudgement(bool userTriggered) + { + if (userTriggered) + return; + + if (Judgement.TimeOffset < 0) + return; + + int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); + + if (countHit > drumRoll.RequiredGoodHits) + { + Judgement.Result = HitResult.Hit; + Judgement.Score = countHit >= drumRoll.RequiredGreatHits ? TaikoScoreResult.Great : TaikoScoreResult.Good; + } + else + Judgement.Result = HitResult.Miss; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 61c3d460c0..b37bc61c17 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,6 +52,7 @@ + From b629766892dda93751102a8f51defc90b5d993f3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 22:01:06 +0900 Subject: [PATCH 012/348] Add initial taiko note circles. --- .../Tests/TestCaseTaikoHitObjects.cs | 348 ++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 3 +- .../osu.Game.Modes.Taiko.csproj | 3 + 3 files changed, 353 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs new file mode 100644 index 0000000000..8dc82c4416 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -0,0 +1,348 @@ +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Screens.Testing; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseTaikoHitObjects : TestCase + { + public override string Description => "Taiko hit objects"; + + public override void Reset() + { + base.Reset(); + + Add(new CentreHitCirclePiece + { + Position = new Vector2(100, 100), + AccentColour = Color4.Red + }); + + Add(new RimHitCirclePiece + { + Position = new Vector2(100, 250), + AccentColour = Color4.Blue + }); + + Add(new BashCirclePiece + { + Position = new Vector2(100, 400), + AccentColour = Color4.Orange + }); + + Add(new DrumRollCirclePiece + { + Width = 256, + Position = new Vector2(100, 550), + AccentColour = Color4.Yellow + }); + } + } + + class FinisherCirclePiece : Container + { + public FinisherCirclePiece() + { + Anchor = Anchor.CentreLeft; + + } + } + + /// + /// A circle piece which is used to visualise RimHit objects. + /// + class RimHitCirclePiece : CirclePiece + { + public RimHitCirclePiece() + { + Height = 128; + } + + protected override Drawable CreateIcon() + { + return new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(61f), + + BorderThickness = 8, + BorderColour = Color4.White, + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }; + } + } + + /// + /// A circle piece which is used to visualise CentreHit objects. + /// + class CentreHitCirclePiece : CirclePiece + { + public CentreHitCirclePiece() + { + Height = 128; + } + + protected override Drawable CreateIcon() + { + return new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(45f), + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 1 + } + } + }; + } + } + + /// + /// A circle piece which is used to visualise Bash objects. + /// + class BashCirclePiece : CirclePiece + { + public BashCirclePiece() + { + Height = 128; + } + + protected override Drawable CreateIcon() + { + return new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + TextSize = 45f, + Icon = FontAwesome.fa_asterisk + }; + } + } + + /// + /// A circle piece which is used to visualise DrumRoll objects. + /// + class DrumRollCirclePiece : CirclePiece + { + public DrumRollCirclePiece() + { + Height = 128; + } + } + + /// + /// A circle piece which is used uniformly through osu!taiko to visualise hitobjects. + /// This is used uniformly throughout all osu!taiko hitobjects. + /// + /// The contents of this piece will overshoot it by 64px on both sides on the X-axis, such that + /// a regular "circle" is created by setting the width of this piece to 0px (resulting in a 64px radius circle). + /// + /// + abstract class CirclePiece : Container + { + private bool kiaiMode; + /// + /// Whether Kiai mode is active for this object. + /// + public bool KiaiMode + { + get { return kiaiMode; } + set + { + kiaiMode = value; + + if (innerCircleContainer != null) + innerCircleContainer.EdgeEffect = value ? createKiaiEdgeEffect() : default(EdgeEffect); + } + } + + /// + /// The colour of the inner circle and outer glows. + /// + public Color4 AccentColour; + + private Container innerLayer; + private Container backingGlowContainer; + private Container innerCircleContainer; + + public CirclePiece() + { + Container iconContainer; + + Origin = Anchor.CentreLeft; + + Children = new Drawable[] + { + // The "inner layer" overshoots the ObjectPiece by 64px on both sides + innerLayer = new Container + { + Name = "Inner Layer", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Y, + + Children = new Drawable[] + { + backingGlowContainer = new CircularContainer + { + Name = "Backing Glow", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }, + innerCircleContainer = new CircularContainer + { + Name = "Inner Circle", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Children = new Drawable[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + }, + new Triangles + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Alpha = 0.75f + } + } + }, + new CircularContainer + { + Name = "Ring", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + BorderThickness = 8, + BorderColour = Color4.White, + + Children = new[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }, + iconContainer = new Container + { + Name = "Icon Container", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + } + } + }, + }; + + Drawable icon = CreateIcon(); + + if (icon != null) + iconContainer.Add(icon); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + backingGlowContainer.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = AccentColour, + Radius = 8 + }; + + if (KiaiMode) + innerCircleContainer.EdgeEffect = createKiaiEdgeEffect(); + + innerCircleContainer.Colour = AccentColour; + } + + protected override void Update() + { + innerLayer.Width = DrawWidth + 128; + } + + private EdgeEffect createKiaiEdgeEffect() + { + return new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = AccentColour, + Radius = 50 + }; + } + + /// + /// Creates the icon that's shown in the middle of this object piece. + /// + /// The icon. + protected virtual Drawable CreateIcon() => null; + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 68aed38b34..28ca0655cc 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -23,7 +23,7 @@ false LocalIntranet v4.5 - true + true publish\ true Disk @@ -194,6 +194,7 @@ + diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index bc38781b01..e4c56621fb 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -81,6 +81,9 @@ osu.Game + + + - \ No newline at end of file + From be4ab13f4d567190d0d614021b64fb92665a24b9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 20:30:26 +0900 Subject: [PATCH 083/348] Rename finisher -> accented. --- .../{DrawableHitFinisher.cs => DrawableAccentedHit.cs} | 6 +++--- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename osu.Game.Modes.Taiko/Objects/Drawable/{DrawableHitFinisher.cs => DrawableAccentedHit.cs} (89%) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs similarity index 89% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs rename to osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs index 3f7361b62c..e251daae7d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHitFinisher.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs @@ -8,7 +8,7 @@ using osu.Framework.Input; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public abstract class DrawableHitFinisher : DrawableHit + public abstract class DrawableAccentedHit : DrawableHit { /// /// The lenience for the second key press. @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private double firstHitTime; private Key firstHitKey; - protected DrawableHitFinisher(Hit hit) + protected DrawableAccentedHit(Hit hit) : base(hit) { } @@ -70,7 +70,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable return false; // If we're not holding the first key down still, assume the intention - // was not to hit the finisher with both keys simultaneously + // was not to hit the accented hit with both keys simultaneously if (!state.Keyboard.Keys.Contains(firstHitKey)) return false; diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index fcabccc9ca..d6b2fb6364 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -53,7 +53,7 @@ - + From 5bd9147661c4cace5dfa61bbf1756b3ac94307cf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 20:53:28 +0900 Subject: [PATCH 084/348] Remove CreateCircle() - hitobjects should handle the addition of this to their hierarchy themselves. CreateCircle() lends itself to a few issues: - It can't be used for drum roll ticks unless it returned a Container instead, at which point the method loses its meaning, and I would rather that constructed in the ctor. - Writing `return Accented ? new AccentedCirclePiece() : new CirclePiece()` in two places as the body of this method feels wrong - it's something I would expect to be taken care of in the base DrawableTaikoHitObject, but that leads back to #1. - Swells don't have an AccentedCirclePiece, so #2 becomes more problematic. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index e165f40442..c77c7762e3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -17,11 +16,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Origin = Anchor.Centre; RelativePositionAxes = Axes.X; - - Children = new[] - { - CreateCircle() - }; } protected override void LoadComplete() @@ -48,7 +42,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { UpdateScrollPosition(Time.Current); } - - protected abstract CirclePiece CreateCircle(); } } From e7941859e4ef1b5b102d047ffafc7968c9057545 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 20:57:49 +0900 Subject: [PATCH 085/348] Rename bash -> swell. --- .../Beatmaps/TaikoBeatmapConverter.cs | 2 +- .../{DrawableBash.cs => DrawableSwell.cs} | 16 ++++++++-------- .../Objects/{Bash.cs => Swell.cs} | 4 ++-- .../Scoring/TaikoScoreProcessor.cs | 2 +- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) rename osu.Game.Modes.Taiko/Objects/Drawable/{DrawableBash.cs => DrawableSwell.cs} (82%) rename osu.Game.Modes.Taiko/Objects/{Bash.cs => Swell.cs} (84%) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index b2676bf28a..9b143e9fde 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -61,7 +61,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (endTimeData != null) { // We compute the end time manually to add in the Bash convert factor - return new Bash + return new Swell { StartTime = original.StartTime, Sample = original.Sample, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs similarity index 82% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs rename to osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 1aa962be12..9d0e23553d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBash.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -10,7 +10,7 @@ using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableBash : DrawableTaikoHitObject + public class DrawableSwell : DrawableTaikoHitObject { /// /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. @@ -19,16 +19,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private List validKeys { get; } = new List(new[] { Key.D, Key.F, Key.J, Key.K }); /// - /// The amount of times the user has hit this bash. + /// The amount of times the user has hit this swell. /// private int userHits; - private readonly Bash bash; + private readonly Swell swell; - public DrawableBash(Bash bash) - : base(bash) + public DrawableSwell(Swell swell) + : base(swell) { - this.bash = bash; + this.swell = swell; } protected override void CheckJudgement(bool userTriggered) @@ -40,7 +40,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable userHits++; - if (userHits == bash.RequiredHits) + if (userHits == swell.RequiredHits) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Great; @@ -51,7 +51,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (Judgement.TimeOffset < 0) return; - if (userHits > bash.RequiredHits / 2) + if (userHits > swell.RequiredHits / 2) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Good; diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs similarity index 84% rename from osu.Game.Modes.Taiko/Objects/Bash.cs rename to osu.Game.Modes.Taiko/Objects/Swell.cs index b8b4eea6a9..20b9a6effb 100644 --- a/osu.Game.Modes.Taiko/Objects/Bash.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -8,14 +8,14 @@ using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Taiko.Objects { - public class Bash : TaikoHitObject, IHasEndTime + public class Swell : TaikoHitObject, IHasEndTime { public double EndTime { get; set; } public double Duration => EndTime - StartTime; /// - /// The number of hits required to complete the bash successfully. + /// The number of hits required to complete the swell successfully. /// public int RequiredHits { get; protected set; } diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index 3007411230..a3759d9c81 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -165,7 +165,7 @@ namespace osu.Game.Modes.Taiko.Scoring SecondHit = obj.Accented }); } - else if (obj is Bash) + else if (obj is Swell) { AddJudgement(new TaikoJudgement { diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index b1f47832c0..7780230ede 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,9 +52,9 @@ - + - + From cbb6930f76991bc23dbf551043d98fa0e40b8c46 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 20:53:28 +0900 Subject: [PATCH 086/348] Remove CreateCircle() - hitobjects should handle the addition of this to their hierarchy themselves. CreateCircle() lends itself to a few issues: - It can't be used for drum roll ticks unless it returned a Container instead, at which point the method loses its meaning, and I would rather that constructed in the ctor. - Writing `return Accented ? new AccentedCirclePiece() : new CirclePiece()` in two places as the body of this method feels wrong - it's something I would expect to be taken care of in the base DrawableTaikoHitObject, but that leads back to #1. - Swells don't have an AccentedCirclePiece, so #2 becomes more problematic. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index e165f40442..c77c7762e3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -17,11 +16,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Origin = Anchor.Centre; RelativePositionAxes = Axes.X; - - Children = new[] - { - CreateCircle() - }; } protected override void LoadComplete() @@ -48,7 +42,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { UpdateScrollPosition(Time.Current); } - - protected abstract CirclePiece CreateCircle(); } } From 989a6ab02be514a04c270c07247652b1065e6866 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 23:43:41 +0900 Subject: [PATCH 087/348] Move validKeys to DrawableTaikoHitObject. Cleanup + reword comments. --- .../Objects/Drawable/DrawableAccentedHit.cs | 33 +++++++++++-------- .../Objects/Drawable/DrawableHit.cs | 23 +------------ .../Drawable/DrawableTaikoHitObject.cs | 25 ++++++++++++++ 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs index e251daae7d..9d9c67a7f4 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs @@ -17,6 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private const double second_hit_window = 30; private double firstHitTime; + private bool firstKeyHeld; private Key firstHitKey; protected DrawableAccentedHit(Hit hit) @@ -41,40 +42,44 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Judgement.SecondHit = true; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool HandleKeyPress(Key key) { - // Check if we've handled the initial key + // Check if we've handled the first key if (!Judgement.Result.HasValue) { - bool result = base.OnKeyDown(state, args); + // First key hasn't been handled yet, attempt to handle it + bool handled = base.HandleKeyPress(key); - if (result) + if (handled) { firstHitTime = Time.Current; - firstHitKey = args.Key; + firstHitKey = key; } - return result; + return handled; } // If we've already hit the second key, don't handle this object any further if (Judgement.SecondHit) return false; - // Don't handle represses of the same key - if (firstHitKey == args.Key) + // Don't handle represses of the first key + if (firstHitKey == key) return false; // Don't handle invalid hit key presses - if (!HitKeys.Contains(args.Key)) + if (!HitKeys.Contains(key)) return false; - // If we're not holding the first key down still, assume the intention - // was not to hit the accented hit with both keys simultaneously - if (!state.Keyboard.Keys.Contains(firstHitKey)) - return false; + // Assume the intention was to hit the accented hit with both keys only if the first key is still being held down + return firstKeyHeld && UpdateJudgement(true); + } - return UpdateJudgement(true); + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + firstKeyHeld = state.Keyboard.Keys.Contains(firstHitKey); + + return base.OnKeyDown(state, args); } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index cc017ab376..a3ea9e36b9 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Input; -using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; @@ -17,12 +16,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// protected abstract List HitKeys { get; } - /// - /// A list of keys which this hit object will accept. These are the standard Taiko keys for now. - /// These should be moved to bindings later. - /// - private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - private readonly Hit hit; /// @@ -61,7 +54,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Judgement.Result = HitResult.Miss; } - protected virtual bool HandleKeyPress(Key key) + protected override bool HandleKeyPress(Key key) { if (Judgement.Result.HasValue) return false; @@ -70,19 +63,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable return UpdateJudgement(true); } - - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - // Make sure we don't handle held-down keys - if (args.Repeat) - return false; - - // Check if we've pressed a valid taiko key - if (!validKeys.Contains(args.Key)) - return false; - - // Handle it! - return HandleKeyPress(args.Key); - } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index e165f40442..bb6ca627da 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -1,15 +1,24 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Input; using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using System.Collections.Generic; +using osu.Framework.Input; namespace osu.Game.Modes.Taiko.Objects.Drawable { public abstract class DrawableTaikoHitObject : DrawableHitObject { + /// + /// A list of keys which this hit object will accept. These are the standard Taiko keys for now. + /// These should be moved to bindings later. + /// + private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); + protected DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { @@ -49,6 +58,22 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable UpdateScrollPosition(Time.Current); } + protected virtual bool HandleKeyPress(Key key) { return false; } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + // Make sure we don't handle held-down keys + if (args.Repeat) + return false; + + // Check if we've pressed a valid taiko key + if (!validKeys.Contains(args.Key)) + return false; + + // Handle it! + return HandleKeyPress(args.Key); + } + protected abstract CirclePiece CreateCircle(); } } From 9b0a15cd6ccf83b977c32def44c14e69e254969f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 23:48:00 +0900 Subject: [PATCH 088/348] Fix post-merge errors. --- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index f11b9c24d1..b32288c2d9 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,11 +54,9 @@ - - From d9ecb430ede96463a314fc2637e7f27f179867c1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 23:48:13 +0900 Subject: [PATCH 089/348] Remove validKeys (now in DrawableTaikoHitObject). --- .../Objects/Drawable/DrawableSwell.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 9d0e23553d..15584ac73f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -2,8 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Input; -using System.Collections.Generic; -using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; @@ -12,12 +10,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableSwell : DrawableTaikoHitObject { - /// - /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. - /// These should be moved to bindings later. - /// - private List validKeys { get; } = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - /// /// The amount of times the user has hit this swell. /// @@ -70,14 +62,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable base.UpdateScrollPosition(Math.Min(time, HitObject.StartTime)); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool HandleKeyPress(Key key) { if (Judgement.Result.HasValue) return false; - if (!validKeys.Contains(args.Key)) - return false; - UpdateJudgement(true); return true; From 7c9900376f952035828193e3febee6f7310b9c31 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 25 Mar 2017 23:54:50 +0900 Subject: [PATCH 090/348] Remove validKeys (now in DrawableTaikoHitObject). --- .../Objects/Drawable/DrawableDrumRollTick.cs | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index 360cccd6ca..fe7ed855f5 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -2,22 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Input; -using System.Collections.Generic; using osu.Game.Modes.Taiko.Judgements; using System; using osu.Game.Modes.Objects.Drawables; -using osu.Framework.Input; namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableDrumRollTick : DrawableTaikoHitObject { - /// - /// A list of keys which this HitObject will accept. These are the standard Taiko keys for now. - /// These should be moved to bindings later. - /// - private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - private readonly DrumRollTick tick; public DrawableDrumRollTick(DrumRollTick tick) @@ -53,18 +45,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable // Drum roll ticks shouldn't move } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool HandleKeyPress(Key key) { - if (args.Repeat) - return false; - - if (Judgement.Result.HasValue) - return false; - - if (!validKeys.Contains(args.Key)) - return false; - - return UpdateJudgement(true); + return !Judgement.Result.HasValue && UpdateJudgement(true); } } } From bcaf2f97582d03c36904937c47ed6af31f293706 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sun, 26 Mar 2017 00:01:00 +0900 Subject: [PATCH 091/348] Use lambda expression. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index bb6ca627da..5f63a956e1 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -58,7 +58,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable UpdateScrollPosition(Time.Current); } - protected virtual bool HandleKeyPress(Key key) { return false; } + protected virtual bool HandleKeyPress(Key key) => false; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { From d0b1fda24f4e48cabca2febe3d4ecc09d84a5851 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Mar 2017 12:33:15 +0900 Subject: [PATCH 092/348] Fix merge fail. --- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 50ec2002fb..a7b382b24c 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -56,7 +56,6 @@ - @@ -103,4 +102,4 @@ --> - \ No newline at end of file + From b8c8ca2f0e63ae08c78c6897a4237cd32c7a3950 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Mar 2017 15:49:32 +0900 Subject: [PATCH 093/348] Adjust input drum transition slightly. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 1787670c7a..2e4c2232fa 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -139,7 +139,7 @@ namespace osu.Game.Modes.Taiko.UI { target.FadeTo(Math.Min(target.Alpha + 0.4f, 1), 40, EasingTypes.OutQuint); target.Delay(40); - target.FadeOut(600, EasingTypes.OutQuint); + target.FadeOut(1000, EasingTypes.OutQuint); } return false; From cc5154dd12bee125b5d0371dd0babbce7de0e6aa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Mar 2017 17:48:18 +0900 Subject: [PATCH 094/348] Fix regression in mouse dragging behaviour. --- osu.Game/Graphics/Cursor/MenuCursor.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 3ab6fa7093..39d0cf181c 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -20,9 +20,11 @@ namespace osu.Game.Graphics.Cursor { protected override Drawable CreateCursor() => new Cursor(); + private bool dragging; + protected override bool OnMouseMove(InputState state) { - if (state.Mouse.HasMainButtonPressed) + if (dragging) { Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown ?? state.Mouse.Delta; float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; @@ -39,6 +41,12 @@ namespace osu.Game.Graphics.Cursor return base.OnMouseMove(state); } + protected override bool OnDragStart(InputState state) + { + dragging = true; + return base.OnDragStart(state); + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { ActiveCursor.Scale = new Vector2(1); @@ -53,6 +61,8 @@ namespace osu.Game.Graphics.Cursor { if (!state.Mouse.HasMainButtonPressed) { + dragging = false; + ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, EasingTypes.OutQuint); ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), EasingTypes.OutElasticHalf); ActiveCursor.ScaleTo(1, 500, EasingTypes.OutElastic); From 0ad070c2d83101d4d820c31755f21d794f598723 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 27 Mar 2017 22:22:34 +0900 Subject: [PATCH 095/348] Update grade textures. --- osu-resources | 2 +- osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/osu-resources b/osu-resources index 2d8a6c1699..e674531595 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 2d8a6c1699ff1acd3915fc28e8906dabf1b145a3 +Subproject commit e67453159540f5008b5efadfbc12dfb3f4bee1f7 diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 6b59af0bb4..fd8a24f213 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -13,14 +13,14 @@ namespace osu.Game.Screens.Select.Leaderboards { public class DrawableRank : Container { - private readonly Sprite sprite; + private readonly Sprite rankSprite; public ScoreRank Rank { get; private set; } [BackgroundDependencyLoader] private void load(TextureStore textures) { - sprite.Texture = textures.Get($@"Badges/ScoreRanks/{Rank.GetDescription()}"); + rankSprite.Texture = textures.Get($@"Grades/{Rank.GetDescription()}"); } public DrawableRank(ScoreRank rank) @@ -29,10 +29,7 @@ namespace osu.Game.Screens.Select.Leaderboards Children = new Drawable[] { - sprite = new Sprite - { - RelativeSizeAxes = Axes.Both, - }, + rankSprite = new Sprite { FillMode = FillMode.Fill }, }; } } From 55df07a8720da80706fb32d8a993db0cdcc3d8c4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 00:03:09 +0900 Subject: [PATCH 096/348] Fix username being cleared when it shouldn't be. --- osu.Game/Online/API/APIAccess.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index f39dec47e1..087bae3071 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -118,7 +118,7 @@ namespace osu.Game.Online.API //todo: this fails even on network-related issues. we should probably handle those differently. //NotificationManager.ShowMessage("Login failed!"); log.Add(@"Login failed!"); - clearCredentials(); + Password = null; continue; } From 039f4a65dc5b83c2f437b00ecec3a14e263ebd4b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 00:04:07 +0900 Subject: [PATCH 097/348] Combine user models. --- osu.Game/Online/API/APIAccess.cs | 1 + .../Online/API/Requests/GetUserRequest.cs | 2 ++ osu.Game/Online/Chat/Drawables/ChatLine.cs | 2 +- osu.Game/Online/Chat/Message.cs | 1 + osu.Game/Online/User.cs | 19 ------------------- osu.Game/Users/User.cs | 12 +++++++++++- osu.Game/osu.Game.csproj | 3 +-- 7 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 osu.Game/Online/User.cs diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 087bae3071..c4b679fc92 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -12,6 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Online.API.Requests; +using osu.Game.Users; namespace osu.Game.Online.API { diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index e396c56b53..2fd1ee5efc 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Users; + namespace osu.Game.Online.API.Requests { public class GetUserRequest : APIRequest diff --git a/osu.Game/Online/Chat/Drawables/ChatLine.cs b/osu.Game/Online/Chat/Drawables/ChatLine.cs index 9f78be92d1..bfbcf3d707 100644 --- a/osu.Game/Online/Chat/Drawables/ChatLine.cs +++ b/osu.Game/Online/Chat/Drawables/ChatLine.cs @@ -91,7 +91,7 @@ namespace osu.Game.Online.Chat.Drawables new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Text = $@"{Message.User.Name}:", + Text = $@"{Message.User.Username}:", Colour = getUsernameColour(Message), TextSize = text_size, Origin = Anchor.TopRight, diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 3081653c34..b267cf63ac 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -3,6 +3,7 @@ using System; using Newtonsoft.Json; +using osu.Game.Users; namespace osu.Game.Online.Chat { diff --git a/osu.Game/Online/User.cs b/osu.Game/Online/User.cs deleted file mode 100644 index 0059f940a5..0000000000 --- a/osu.Game/Online/User.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using Newtonsoft.Json; - -namespace osu.Game.Online -{ - public class User - { - [JsonProperty(@"username")] - public string Name; - - [JsonProperty(@"id")] - public int Id; - - [JsonProperty(@"colour")] - public string Colour; - } -} diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 2763b3100f..6e1de7e3ac 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -1,13 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; + namespace osu.Game.Users { public class User { - public int Id; + [JsonProperty(@"id")] + public long Id = 1; + + [JsonProperty(@"username")] public string Username; + public Country Country; + public Team Team; + + [JsonProperty(@"colour")] + public string Colour; } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 32dd814fdc..7cb55aaa89 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -247,7 +247,6 @@ - @@ -396,4 +395,4 @@ --> - + \ No newline at end of file From 13272e699575203fdbc87c4367886d7dd7995ff9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 00:04:51 +0900 Subject: [PATCH 098/348] Make Avatar accept a user. Add UpdateableAvatar to handle the toolbar use-case. --- .../Overlays/Toolbar/ToolbarUserButton.cs | 8 +- .../Select/Leaderboards/LeaderboardScore.cs | 3 +- osu.Game/Users/Avatar.cs | 103 +++++++----------- osu.Game/Users/UpdateableAvatar.cs | 43 ++++++++ osu.Game/osu.Game.csproj | 1 + 5 files changed, 87 insertions(+), 71 deletions(-) create mode 100644 osu.Game/Users/UpdateableAvatar.cs diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 7e266a2b43..4e59f87bee 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Toolbar { internal class ToolbarUserButton : ToolbarButton, IOnlineComponent { - private readonly Avatar avatar; + private readonly UpdateableAvatar avatar; public ToolbarUserButton() { @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar Add(new OpaqueBackground { Depth = 1 }); - Flow.Add(avatar = new Avatar + Flow.Add(avatar = new UpdateableAvatar { Masking = true, Size = new Vector2(32), @@ -52,11 +52,11 @@ namespace osu.Game.Overlays.Toolbar { default: Text = @"Guest"; - avatar.UserId = 1; + avatar.User = new User(); break; case APIState.Online: Text = api.Username; - avatar.UserId = api.LocalUser.Value.Id; + avatar.User = api.LocalUser; break; } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 1df6d2b55c..c31ebc6095 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Leaderboards Padding = new MarginPadding(edge_margin), Children = new Drawable[] { - avatar = new Avatar + avatar = new Avatar(Score.User ?? new User { Id = Score.UserID }) { Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), CornerRadius = corner_radius, @@ -153,7 +153,6 @@ namespace osu.Game.Screens.Select.Leaderboards Radius = 1, Colour = Color4.Black.Opacity(0.2f), }, - UserId = Score.User?.Id ?? Score.UserID, }, new Container { diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index a6ce9f1e41..2ac17cd23f 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Diagnostics; +using System; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -13,68 +13,60 @@ namespace osu.Game.Users { public class Avatar : Container { - public Drawable Sprite; + private const int time_before_load = 500; - private long userId; - private OsuGameBase game; - private Texture guestTexture; + private Drawable sprite; + private readonly User user; + private readonly bool delayedLoad; - [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuGameBase game, TextureStore textures) + /// + /// An avatar for specified user. + /// + /// The user. A null value will get a placeholder avatar. + /// Whether we should delay the load of the avatar until it has been on-screen for a specified duration. + public Avatar(User user = null, bool delayedLoad = true) { - this.game = game; - guestTexture = textures.Get(@"Online/avatar-guest"); - } - - public long UserId - { - get { return userId; } - set - { - if (userId == value) - return; - - userId = value; - invalidateSprite(); - } + this.user = user; + this.delayedLoad = delayedLoad; } + private Action performLoad; private Task loadTask; - private void invalidateSprite() + [BackgroundDependencyLoader(permitNulls: true)] + private void load(TextureStore textures) { - Sprite?.FadeOut(100); - Sprite?.Expire(); - Sprite = null; - } - - private void updateSprite() - { - if (loadTask != null || Sprite != null) return; - - var newSprite = userId > 1 ? new OnlineSprite($@"https://a.ppy.sh/{userId}", guestTexture) : new Sprite { Texture = guestTexture }; - - newSprite.FillMode = FillMode.Fill; - - loadTask = newSprite.LoadAsync(game, s => + performLoad = () => { - Sprite = s; - Add(Sprite); + Texture texture = null; + if (user?.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); + if (texture == null) texture = textures.Get(@"Online/avatar-guest"); - Sprite.FadeInFromZero(200); - loadTask = null; - }); + sprite = new Sprite + { + Texture = texture, + FillMode = FillMode.Fit, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }; + + Schedule(() => + { + Add(sprite); + sprite.FadeInFromZero(150); + }); + }; } private double timeVisible; - private bool shouldUpdate => Sprite != null || timeVisible > 500; + private bool shouldLoad => !delayedLoad || timeVisible > time_before_load; protected override void Update() { base.Update(); - if (!shouldUpdate) + if (!shouldLoad) { //Special optimisation to not start loading until we are within bounds of our closest ScrollContainer parent. ScrollContainer scroll = null; @@ -88,27 +80,8 @@ namespace osu.Game.Users timeVisible = 0; } - if (shouldUpdate) - updateSprite(); - } - - public class OnlineSprite : Sprite - { - private readonly string url; - private readonly Texture fallbackTexture; - - public OnlineSprite(string url, Texture fallbackTexture = null) - { - Debug.Assert(url != null); - this.url = url; - this.fallbackTexture = fallbackTexture; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - Texture = textures.Get(url) ?? fallbackTexture; - } + if (shouldLoad && loadTask == null) + (loadTask = Task.Factory.StartNew(performLoad, TaskCreationOptions.LongRunning)).ConfigureAwait(false); } } } diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs new file mode 100644 index 0000000000..cf6448dac7 --- /dev/null +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -0,0 +1,43 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Users +{ + /// + /// An avatar which can update to a new user when needed. + /// + public class UpdateableAvatar : Container + { + private Avatar displayedAvatar; + + private User user; + + public User User + { + get { return user; } + set + { + if (user?.Id == value?.Id) + return; + + user = value; + + if (IsLoaded) + updateAvatar(); + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + updateAvatar(); + } + + private void updateAvatar() + { + displayedAvatar?.FadeOut(300); + displayedAvatar?.Expire(); + Add(displayedAvatar = new Avatar(user, false) { RelativeSizeAxes = Axes.Both }); + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 7cb55aaa89..a5bdf1df69 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -266,6 +266,7 @@ + From 768b3c4b4b554a5cbd6dc8d2fc1267921d422abd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 00:05:11 +0900 Subject: [PATCH 099/348] Add better focus handling in the login form. --- osu.Game/Overlays/LoginOverlay.cs | 2 ++ .../Options/Sections/General/LoginOptions.cs | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/LoginOverlay.cs b/osu.Game/Overlays/LoginOverlay.cs index fec1c5ec6e..4ceb8092a1 100644 --- a/osu.Game/Overlays/LoginOverlay.cs +++ b/osu.Game/Overlays/LoginOverlay.cs @@ -67,6 +67,8 @@ namespace osu.Game.Overlays optionsSection.Bounding = true; FadeIn(transition_time, EasingTypes.OutQuint); + + optionsSection.TriggerFocus(); } protected override void PopOut() diff --git a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs index f95d3a026e..a5e38dd284 100644 --- a/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LoginOptions.cs @@ -11,12 +11,14 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using OpenTK; +using osu.Framework.Input; namespace osu.Game.Overlays.Options.Sections.General { public class LoginOptions : OptionsSubsection, IOnlineComponent { private bool bounding = true; + private LoginForm form; protected override string Header => "Account"; @@ -40,12 +42,14 @@ namespace osu.Game.Overlays.Options.Sections.General public void APIStateChanged(APIAccess api, APIState state) { + form = null; + switch (state) { case APIState.Offline: Children = new Drawable[] { - new LoginForm() + form = new LoginForm() }; break; case APIState.Failing: @@ -82,6 +86,14 @@ namespace osu.Game.Overlays.Options.Sections.General }; break; } + + form?.TriggerFocus(); + } + + protected override bool OnFocus(InputState state) + { + form?.TriggerFocus(); + return base.OnFocus(state); } private class LoginForm : FillFlowContainer @@ -144,6 +156,19 @@ namespace osu.Game.Overlays.Options.Sections.General } }; } + + protected override bool OnFocus(InputState state) + { + Schedule(() => + { + if (string.IsNullOrEmpty(username.Text)) + username.TriggerFocus(); + else + password.TriggerFocus(); + }); + + return base.OnFocus(state); + } } } } From 36af868f447d72f29641b61fbac609df837e26b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 00:13:38 +0900 Subject: [PATCH 100/348] Add missing licence header. --- osu.Game/Users/UpdateableAvatar.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index cf6448dac7..265c177ced 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -1,4 +1,7 @@ -using osu.Framework.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; namespace osu.Game.Users From 4bb60607e16498bc6b5527faeab2deb87c06d3ff Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 09:50:43 +0900 Subject: [PATCH 101/348] Add property to make the div2 internal. --- .../Objects/Drawable/DrawableDrumRollTick.cs | 4 ++-- osu.Game.Modes.Taiko/Objects/DrumRollTick.cs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index fe7ed855f5..1e270c6751 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -24,12 +24,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { if (!userTriggered) { - if (Judgement.TimeOffset > tick.TickTimeDistance / 2) + if (Judgement.TimeOffset > tick.HitWindow) Judgement.Result = HitResult.Miss; return; } - if (Math.Abs(Judgement.TimeOffset) < tick.TickTimeDistance / 2) + if (Math.Abs(Judgement.TimeOffset) < tick.HitWindow) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Great; diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs index 66a2d16fe1..2ca0d71fc1 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs @@ -15,5 +15,10 @@ namespace osu.Game.Modes.Taiko.Objects /// Half of this value is the hit window of the tick. /// public double TickTimeDistance; + + /// + /// The time allowed to hit this tick. + /// + public double HitWindow => TickTimeDistance / 2; } } \ No newline at end of file From 4c7e523d1870c3691cdff4c06a3f617cd5a9c294 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:02:41 +0900 Subject: [PATCH 102/348] Rename Accented to Strong. --- .../Tests/TestCaseTaikoHitObjects.cs | 8 ++++---- .../Beatmaps/TaikoBeatmapConverter.cs | 8 ++++---- ...DrawableAccentedHit.cs => DrawableStrongHit.cs} | 6 +++--- ...AccentedCirclePiece.cs => StrongCirclePiece.cs} | 14 +++++++------- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 6 +++--- .../Scoring/TaikoScoreProcessor.cs | 8 ++++---- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 4 ++-- 7 files changed, 27 insertions(+), 27 deletions(-) rename osu.Game.Modes.Taiko/Objects/Drawable/{DrawableAccentedHit.cs => DrawableStrongHit.cs} (88%) rename osu.Game.Modes.Taiko/Objects/Drawable/Pieces/{AccentedCirclePiece.cs => StrongCirclePiece.cs} (64%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index edd9c74485..0204058b8a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -38,7 +38,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 100) }); - Add(new CentreHitCircle(new AccentedCirclePiece() + Add(new CentreHitCircle(new StrongCirclePiece() { KiaiMode = kiai }) @@ -54,7 +54,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 300) }); - Add(new RimHitCircle(new AccentedCirclePiece() + Add(new RimHitCircle(new StrongCirclePiece() { KiaiMode = kiai }) @@ -70,7 +70,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 500) }); - Add(new SwellCircle(new AccentedCirclePiece() + Add(new SwellCircle(new StrongCirclePiece() { KiaiMode = kiai }) @@ -87,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(575, 100) }); - Add(new DrumRollCircle(new AccentedCirclePiece() + Add(new DrumRollCircle(new StrongCirclePiece() { KiaiMode = kiai }) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 9b143e9fde..1fc2db53fa 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -44,7 +44,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps IHasRepeats repeatsData = original as IHasRepeats; IHasEndTime endTimeData = original as IHasEndTime; - bool accented = ((original.Sample?.Type ?? SampleType.None) & SampleType.Finish) > 0; + bool strong = ((original.Sample?.Type ?? SampleType.None) & SampleType.Finish) > 0; if (distanceData != null) { @@ -52,7 +52,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { StartTime = original.StartTime, Sample = original.Sample, - Accented = accented, + IsStrong = strong, Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) }; @@ -65,7 +65,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { StartTime = original.StartTime, Sample = original.Sample, - Accented = accented, + IsStrong = strong, EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor }; @@ -75,7 +75,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { StartTime = original.StartTime, Sample = original.Sample, - Accented = accented + IsStrong = strong }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs similarity index 88% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs index 9d9c67a7f4..5e225e1dce 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableAccentedHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs @@ -8,7 +8,7 @@ using osu.Framework.Input; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public abstract class DrawableAccentedHit : DrawableHit + public abstract class DrawableStrongHit : DrawableHit { /// /// The lenience for the second key press. @@ -20,7 +20,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private bool firstKeyHeld; private Key firstHitKey; - protected DrawableAccentedHit(Hit hit) + protected DrawableStrongHit(Hit hit) : base(hit) { } @@ -71,7 +71,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (!HitKeys.Contains(key)) return false; - // Assume the intention was to hit the accented hit with both keys only if the first key is still being held down + // Assume the intention was to hit the strong hit with both keys only if the first key is still being held down return firstKeyHeld && UpdateJudgement(true); } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/AccentedCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs similarity index 64% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/AccentedCirclePiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs index c02cbc572a..319ca17cb8 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/AccentedCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs @@ -6,20 +6,20 @@ using OpenTK; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { /// - /// A type of circle piece which is drawn at a higher scale as an "accent". + /// A type of circle piece which is drawn at a higher scale to represent a "strong" piece. /// - public class AccentedCirclePiece : CirclePiece + public class StrongCirclePiece : CirclePiece { /// - /// The amount to scale up the base circle to show it as an "accented" piece. + /// The amount to scale up the base circle to show it as a "strong" piece. /// - private const float accent_scale = 1.5f; + private const float strong_scale = 1.5f; - public AccentedCirclePiece() + public StrongCirclePiece() { - SymbolContainer.Scale = new Vector2(accent_scale); + SymbolContainer.Scale = new Vector2(strong_scale); } - public override Vector2 Size => new Vector2(base.Size.X, base.Size.Y * accent_scale); + public override Vector2 Size => new Vector2(base.Size.X, base.Size.Y * strong_scale); } } diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 0ec1c2b93c..28077db1ba 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -20,10 +20,10 @@ namespace osu.Game.Modes.Taiko.Objects public double PreEmpt; /// - /// Whether this HitObject is accented. - /// Accented hit objects give more points for hitting the hit object with both keys. + /// Whether this HitObject is a "strong" type. + /// Strong hit objects give more points for hitting the hit object with both keys. /// - public bool Accented; + public bool IsStrong; /// /// Whether this HitObject is in Kiai time. diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index a3759d9c81..2ab31c5efb 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -128,7 +128,7 @@ namespace osu.Game.Modes.Taiko.Scoring hpIncreaseGood = hpMultiplierNormal * hp_hit_good; hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max); - var accentedHits = beatmap.HitObjects.FindAll(o => o is Hit && o.Accented); + var accentedHits = beatmap.HitObjects.FindAll(o => o is Hit && o.IsStrong); // This is a linear function that awards: // 10 times bonus points for hitting an accented hit object with both keys with 30 accented hit objects in the map @@ -143,7 +143,7 @@ namespace osu.Game.Modes.Taiko.Scoring { Result = HitResult.Hit, TaikoResult = TaikoHitResult.Great, - SecondHit = obj.Accented + SecondHit = obj.IsStrong }); } else if (obj is DrumRoll) @@ -154,7 +154,7 @@ namespace osu.Game.Modes.Taiko.Scoring { Result = HitResult.Hit, TaikoResult = TaikoHitResult.Great, - SecondHit = obj.Accented + SecondHit = obj.IsStrong }); } @@ -162,7 +162,7 @@ namespace osu.Game.Modes.Taiko.Scoring { Result = HitResult.Hit, TaikoResult = TaikoHitResult.Great, - SecondHit = obj.Accented + SecondHit = obj.IsStrong }); } else if (obj is Swell) diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index b32288c2d9..fa09ae2c82 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -53,8 +53,8 @@ - - + + From 542cff0976fdbc5e0a8e8d9edcc2ada87599bd25 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:32:01 +0900 Subject: [PATCH 103/348] Move consts to CirclePiece. --- osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index 453ab7a05d..ec98feddae 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -20,6 +20,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// public class CirclePiece : Container { + public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; + public const float SYMBOL_BORDER = 8; + public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; + private Color4 accentColour; /// /// The colour of the inner circle and outer glows. From 2211c084416802a9b98af717a0e356de3170cb2d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:32:27 +0900 Subject: [PATCH 104/348] Properly set playfield scale. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index b7fac507d6..d4abdb5ead 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -173,6 +173,7 @@ namespace osu.Game.Modes.Taiko.UI public override void Add(DrawableHitObject h) { h.Depth = (float)h.HitObject.StartTime; + h.Scale = new Vector2(PLAYFIELD_SCALE); base.Add(h); } From 621bcaed59ac9257d4e85cc1a586a7db6e3ff7f5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:33:23 +0900 Subject: [PATCH 105/348] Add drawable Hits/StrongHits. --- .../Tests/TestCaseTaikoHitObjects.cs | 43 +++------------- .../Tests/TestCaseTaikoPlayfield.cs | 10 ++++ .../Objects/Drawable/CentreHitCirclePiece.cs | 49 +++++++++++++++++++ .../Objects/Drawable/DrawableCentreHit.cs | 17 +++++++ .../Objects/Drawable/DrawableHit.cs | 34 +++++++++++++ .../Drawable/DrawableStrongCentreHit.cs | 17 +++++++ .../osu.Game.Modes.Taiko.csproj | 3 ++ 7 files changed, 136 insertions(+), 37 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 0204058b8a..48d7017f78 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Screens.Testing; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Desktop.VisualTests.Tests @@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests Reset(); }); - Add(new CentreHitCircle(new CirclePiece() + Add(new CentreHitCirclePiece(new CirclePiece() { KiaiMode = kiai }) @@ -38,7 +39,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 100) }); - Add(new CentreHitCircle(new StrongCirclePiece() + Add(new CentreHitCirclePiece(new StrongCirclePiece() { KiaiMode = kiai }) @@ -106,7 +107,7 @@ namespace osu.Desktop.VisualTests.Tests { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = SYMBOL_INNER_SIZE, + TextSize = CirclePiece.SYMBOL_INNER_SIZE, Icon = FontAwesome.fa_asterisk, Shadow = false }); @@ -133,34 +134,6 @@ namespace osu.Desktop.VisualTests.Tests } } - private class CentreHitCircle : BaseCircle - { - public CentreHitCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_INNER_SIZE), - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.PinkDarker; - } - } - private class RimHitCircle : BaseCircle { public RimHitCircle(CirclePiece piece) @@ -170,8 +143,8 @@ namespace osu.Desktop.VisualTests.Tests { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_SIZE), - BorderThickness = SYMBOL_BORDER, + Size = new Vector2(CirclePiece.SYMBOL_SIZE), + BorderThickness = CirclePiece.SYMBOL_BORDER, BorderColour = Color4.White, Masking = true, Children = new[] @@ -195,10 +168,6 @@ namespace osu.Desktop.VisualTests.Tests private abstract class BaseCircle : Container { - protected const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; - protected const float SYMBOL_BORDER = 8; - protected const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; - protected readonly CirclePiece Piece; protected BaseCircle(CirclePiece piece) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 395a0cab13..483c156ea5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -6,6 +6,7 @@ using osu.Framework.Screens.Testing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.UI; namespace osu.Desktop.VisualTests.Tests @@ -22,6 +23,15 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); + AddButton("Centre", () => + { + playfield.Add(new DrawableCentreHit(new Hit + { + StartTime = Time.Current + 1000, + PreEmpt = 1000, + IsStrong = false + })); + }); Add(playfield = new TaikoPlayfield { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs new file mode 100644 index 0000000000..e476430aab --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs @@ -0,0 +1,49 @@ +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + /// + /// A circle piece used for centre hits. + /// + public class CentreHitCirclePiece : Container + { + private CirclePiece circle; + + public CentreHitCirclePiece(CirclePiece piece) + { + Add(circle = piece); + + circle.Add(new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(CirclePiece.SYMBOL_INNER_SIZE), + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both + } + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.AccentColour = colours.PinkDarker; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs new file mode 100644 index 0000000000..363ffdd451 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableCentreHit : DrawableHit + { + protected override List HitKeys { get; } = new List(new Key[] { Key.F, Key.J }); + + public DrawableCentreHit(Hit hit) + : base(hit) + { + Add(new CentreHitCirclePiece(new CirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index a3ea9e36b9..f455fc8d5b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -2,6 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Input; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; @@ -16,6 +19,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// protected abstract List HitKeys { get; } + protected override Container Content => bodyContainer; + private readonly Hit hit; /// @@ -23,10 +28,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private bool validKeyPressed; + private Container bodyContainer; + protected DrawableHit(Hit hit) : base(hit) { this.hit = hit; + + AddInternal(bodyContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }); } protected override void CheckJudgement(bool userTriggered) @@ -63,5 +76,26 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable return UpdateJudgement(true); } + + protected override void UpdateState(ArmedState state) + { + switch (State) + { + case ArmedState.Idle: + break; + case ArmedState.Miss: + bodyContainer.FadeOut(100); + break; + case ArmedState.Hit: + bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); + bodyContainer.FadeOut(600, EasingTypes.OutQuint); + bodyContainer.MoveToY(-200, 250, EasingTypes.Out); + + bodyContainer.Delay(250); + + bodyContainer.MoveToY(0, 500, EasingTypes.In); + break; + } + } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs new file mode 100644 index 0000000000..19a1eec618 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableStrongCentreHit : DrawableStrongHit + { + protected override List HitKeys { get; } = new List(new Key[] { Key.F, Key.J }); + + public DrawableStrongCentreHit(Hit hit) + : base(hit) + { + Add(new CentreHitCirclePiece(new StrongCirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index fa09ae2c82..1272c7b079 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,7 +52,10 @@ + + + From 3f1e8ddcd16324558cd7e553861eae3015a1afca Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 10:51:22 +0900 Subject: [PATCH 106/348] License headers + general fixes. --- .../Tests/TestCaseTaikoHitObjects.cs | 1 - .../Objects/Drawable/CentreHitCirclePiece.cs | 12 +++++------- .../Objects/Drawable/DrawableCentreHit.cs | 7 +++++-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 2 +- .../Objects/Drawable/DrawableStrongCentreHit.cs | 7 +++++-- osu.Game.Modes.Taiko/packages.config | 1 - 6 files changed, 16 insertions(+), 14 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 48d7017f78..96d5ece693 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens.Testing; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs index e476430aab..580541546f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs @@ -1,15 +1,13 @@ -using OpenTK; +// 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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -18,7 +16,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// public class CentreHitCirclePiece : Container { - private CirclePiece circle; + private readonly CirclePiece circle; public CentreHitCirclePiece(CirclePiece piece) { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index 363ffdd451..b3f9974c15 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// 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 OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; @@ -6,7 +9,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableCentreHit : DrawableHit { - protected override List HitKeys { get; } = new List(new Key[] { Key.F, Key.J }); + protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); public DrawableCentreHit(Hit hit) : base(hit) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index f455fc8d5b..f48993fd45 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -28,7 +28,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// private bool validKeyPressed; - private Container bodyContainer; + private readonly Container bodyContainer; protected DrawableHit(Hit hit) : base(hit) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index 19a1eec618..2ad4537bce 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// 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 OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; @@ -6,7 +9,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableStrongCentreHit : DrawableStrongHit { - protected override List HitKeys { get; } = new List(new Key[] { Key.F, Key.J }); + protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); public DrawableStrongCentreHit(Hit hit) : base(hit) diff --git a/osu.Game.Modes.Taiko/packages.config b/osu.Game.Modes.Taiko/packages.config index 08fca09c35..4031dd62a8 100644 --- a/osu.Game.Modes.Taiko/packages.config +++ b/osu.Game.Modes.Taiko/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file From 457f5c6a890a037dfb3b8b05da6e99146689953e Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 04:58:30 +0300 Subject: [PATCH 109/348] Removed unised using statement --- osu.Game/Screens/Play/Pause/PauseButton.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Pause/PauseButton.cs b/osu.Game/Screens/Play/Pause/PauseButton.cs index 06e1308c43..a6ae5ebe39 100644 --- a/osu.Game/Screens/Play/Pause/PauseButton.cs +++ b/osu.Game/Screens/Play/Pause/PauseButton.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Game.Graphics; From 1faff828d18a23ad6e4cf86ee631068984197942 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 11:01:35 +0900 Subject: [PATCH 110/348] Move piece to Pieces/. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 1 - .../Objects/Drawable/{ => Pieces}/CentreHitCirclePiece.cs | 5 ++--- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) rename osu.Game.Modes.Taiko/Objects/Drawable/{ => Pieces}/CentreHitCirclePiece.cs (89%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 96d5ece693..483d4b5bf2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens.Testing; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs similarity index 89% rename from osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs index 580541546f..78c3aaec01 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/CentreHitCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitCirclePiece.cs @@ -1,15 +1,14 @@ // 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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { /// /// A circle piece used for centre hits. diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 1272c7b079..2fb3ec631c 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,7 +52,7 @@ - + From 110d43bc25f6c4f451b3c749d025ef8cd69511c0 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 05:12:04 +0300 Subject: [PATCH 111/348] fixes --- osu.Game/Screens/Play/FailOverlay.cs | 10 ---------- osu.Game/Screens/Play/Pause/PauseButton.cs | 2 +- osu.Game/Screens/Play/PauseOverlay.cs | 2 -- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index cf0deb21c7..2799954a8b 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -2,18 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Screens.Play.Pause; -using OpenTK; -using OpenTK.Graphics; using OpenTK.Input; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/Pause/PauseButton.cs b/osu.Game/Screens/Play/Pause/PauseButton.cs index a6ae5ebe39..afe06edb2e 100644 --- a/osu.Game/Screens/Play/Pause/PauseButton.cs +++ b/osu.Game/Screens/Play/Pause/PauseButton.cs @@ -11,7 +11,7 @@ namespace osu.Game.Screens.Play.Pause public class PauseButton : DialogButton { [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuColour colours) + private void load(AudioManager audio) { SampleHover = audio.Sample.Get(@"Menu/menuclick"); SampleClick = audio.Sample.Get(@"Menu/menuback"); diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index e79f9362b2..f11a0ef957 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -2,14 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Play.Pause; using OpenTK; From b7d9de57a2b2562d439c0e0c58633ec921697fa0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 11:18:12 +0900 Subject: [PATCH 112/348] Add rim hits. --- .../Tests/TestCaseTaikoHitObjects.cs | 50 +++---------------- .../Tests/TestCaseTaikoPlayfield.cs | 50 +++++++++++++++---- .../Objects/Drawable/DrawableRimHit.cs | 20 ++++++++ .../Objects/Drawable/DrawableStrongRimHit.cs | 20 ++++++++ .../Drawable/Pieces/RimHitCirclePiece.cs | 48 ++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 3 ++ 6 files changed, 138 insertions(+), 53 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 483d4b5bf2..db7f9a2f6a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -2,11 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Screens.Testing; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; @@ -29,7 +27,7 @@ namespace osu.Desktop.VisualTests.Tests Reset(); }); - Add(new CentreHitCirclePiece(new CirclePiece() + Add(new CentreHitCirclePiece(new CirclePiece { KiaiMode = kiai }) @@ -37,7 +35,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 100) }); - Add(new CentreHitCirclePiece(new StrongCirclePiece() + Add(new CentreHitCirclePiece(new StrongCirclePiece { KiaiMode = kiai }) @@ -45,7 +43,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(350, 100) }); - Add(new RimHitCircle(new CirclePiece() + Add(new RimHitCirclePiece(new CirclePiece { KiaiMode = kiai }) @@ -53,7 +51,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 300) }); - Add(new RimHitCircle(new StrongCirclePiece() + Add(new RimHitCirclePiece(new StrongCirclePiece { KiaiMode = kiai }) @@ -61,7 +59,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(350, 300) }); - Add(new SwellCircle(new CirclePiece() + Add(new SwellCircle(new CirclePiece { KiaiMode = kiai }) @@ -69,7 +67,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 500) }); - Add(new SwellCircle(new StrongCirclePiece() + Add(new SwellCircle(new StrongCirclePiece { KiaiMode = kiai }) @@ -77,7 +75,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(350, 500) }); - Add(new DrumRollCircle(new CirclePiece() + Add(new DrumRollCircle(new CirclePiece { KiaiMode = kiai }) @@ -86,7 +84,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(575, 100) }); - Add(new DrumRollCircle(new StrongCirclePiece() + Add(new DrumRollCircle(new StrongCirclePiece { KiaiMode = kiai }) @@ -132,38 +130,6 @@ namespace osu.Desktop.VisualTests.Tests } } - private class RimHitCircle : BaseCircle - { - public RimHitCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(CirclePiece.SYMBOL_SIZE), - BorderThickness = CirclePiece.SYMBOL_BORDER, - BorderColour = Color4.White, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.BlueDarker; - } - } - private abstract class BaseCircle : Container { protected readonly CirclePiece Piece; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 483c156ea5..0636512868 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Screens.Testing; using osu.Game.Modes.Objects.Drawables; @@ -23,19 +26,16 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); - AddButton("Centre", () => - { - playfield.Add(new DrawableCentreHit(new Hit - { - StartTime = Time.Current + 1000, - PreEmpt = 1000, - IsStrong = false - })); - }); - Add(playfield = new TaikoPlayfield + Add(new Container { - Y = 200 + RelativeSizeAxes = Axes.X, + Y = 200, + Padding = new MarginPadding { Left = 200 }, + Children = new[] + { + playfield = new TaikoPlayfield() + } }); } @@ -70,6 +70,34 @@ namespace osu.Desktop.VisualTests.Tests }); } + private void addCentreHit(bool strong) + { + Hit h = new Hit + { + StartTime = Time.Current + 1000, + PreEmpt = 1000 + }; + + if (strong) + playfield.Add(new DrawableStrongCentreHit(h)); + else + playfield.Add(new DrawableCentreHit(h)); + } + + private void addRimHit(bool strong) + { + Hit h = new Hit + { + StartTime = Time.Current + 1000, + PreEmpt = 1000 + }; + + if (strong) + playfield.Add(new DrawableStrongRimHit(h)); + else + playfield.Add(new DrawableRimHit(h)); + } + private class DrawableTestHit : DrawableHitObject { public DrawableTestHit(TaikoHitObject hitObject) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs new file mode 100644 index 0000000000..983471d70a --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -0,0 +1,20 @@ +// 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 OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableRimHit : DrawableHit + { + protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + + public DrawableRimHit(Hit hit) + : base(hit) + { + Add(new RimHitCirclePiece(new CirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs new file mode 100644 index 0000000000..c25030b634 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -0,0 +1,20 @@ +// 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 OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableStrongRimHit : DrawableStrongHit + { + protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + + public DrawableStrongRimHit(Hit hit) + : base(hit) + { + Add(new RimHitCirclePiece(new StrongCirclePiece())); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs new file mode 100644 index 0000000000..d2b3833346 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitCirclePiece.cs @@ -0,0 +1,48 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + public class RimHitCirclePiece : Container + { + private readonly CirclePiece circle; + + public RimHitCirclePiece(CirclePiece piece) + { + Add(circle = piece); + + circle.Add(new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(CirclePiece.SYMBOL_SIZE), + BorderThickness = CirclePiece.SYMBOL_BORDER, + BorderColour = Color4.White, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.AccentColour = colours.BlueDarker; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 2fb3ec631c..d9a97d1ed7 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,11 +52,14 @@ + + + From c4500fa270ca3f5cf99c49d89a9a190aaa9c43f5 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 05:19:32 +0300 Subject: [PATCH 113/348] fixes --- .../Tests/TestCasePauseOverlay.cs | 1 - osu.Game/Screens/Play/FailOverlay.cs | 4 ++-- osu.Game/Screens/Play/Pause/PauseButton.cs | 1 - osu.Game/Screens/Play/PauseOverlay.cs | 12 ++++++------ 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 32f3380086..ebb651adb5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -4,7 +4,6 @@ using OpenTK.Graphics; using osu.Framework.Logging; using osu.Framework.Screens.Testing; -using osu.Game.Graphics; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 2799954a8b..b722d9d338 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -32,8 +32,8 @@ namespace osu.Game.Screens.Play public FailOverlay() { - title.Text = @"failed"; - description.Text = @"you're dead, try again?"; + Title.Text = @"failed"; + Description.Text = @"you're dead, try again?"; } } } diff --git a/osu.Game/Screens/Play/Pause/PauseButton.cs b/osu.Game/Screens/Play/Pause/PauseButton.cs index afe06edb2e..7698913ea5 100644 --- a/osu.Game/Screens/Play/Pause/PauseButton.cs +++ b/osu.Game/Screens/Play/Pause/PauseButton.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Play.Pause diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index f11a0ef957..dec59fb63b 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -26,10 +26,10 @@ namespace osu.Game.Screens.Play public Action OnResume; - protected OsuSpriteText title; - protected OsuSpriteText description; + protected OsuSpriteText Title; + protected OsuSpriteText Description; - private FillFlowContainer buttons; + private readonly FillFlowContainer buttons; public int Retries { @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Play } } - private FillFlowContainer retryCounterContainer; + private readonly FillFlowContainer retryCounterContainer; public override bool HandleInput => State == Visibility.Visible; @@ -148,7 +148,7 @@ namespace osu.Game.Screens.Play Spacing = new Vector2(0, 20), Children = new Drawable[] { - title = new OsuSpriteText + Title = new OsuSpriteText { Text = @"paused", Font = @"Exo2.0-Medium", @@ -160,7 +160,7 @@ namespace osu.Game.Screens.Play Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f) }, - description = new OsuSpriteText + Description = new OsuSpriteText { Text = @"you're not going to do what i think you're going to do, are ya?", Origin = Anchor.TopCentre, From ec9a027b599c7faf09d00c54f9d178087372e34b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 11:21:01 +0900 Subject: [PATCH 114/348] ZZZZZZZzzzzzzzz. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 0636512868..6a221b6ee6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -26,6 +26,10 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); + AddButton("Centre", () => addCentreHit(false)); + AddButton("Strong Centre", () => addCentreHit(true)); + AddButton("Rim", () => addRimHit(false)); + AddButton("Strong Rim", () => addRimHit(true)); Add(new Container { From 9774f826abae909f30598d8115179c1693658db2 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 06:08:31 +0300 Subject: [PATCH 115/348] Pause and fail overlays -> StopOverlay --- .../Tests/TestCasePauseOverlay.cs | 8 ++-- osu.Game/Screens/Play/FailOverlay.cs | 39 ------------------- osu.Game/Screens/Play/Player.cs | 16 +++++--- .../Play/{PauseOverlay.cs => StopOverlay.cs} | 36 +++++++++++------ osu.Game/osu.Game.csproj | 3 +- 5 files changed, 40 insertions(+), 62 deletions(-) delete mode 100644 osu.Game/Screens/Play/FailOverlay.cs rename osu.Game/Screens/Play/{PauseOverlay.cs => StopOverlay.cs} (88%) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index ebb651adb5..34c0d875b4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -12,17 +12,19 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests the pause overlay"; - private PauseOverlay pauseOverlay; + private StopOverlay pauseOverlay; private int retryCount; public override void Reset() { base.Reset(); - Add(pauseOverlay = new PauseOverlay + Add(pauseOverlay = new StopOverlay { Depth = -1, - OnResume = () => Logger.Log(@"Resume"), + OnEscPressed = () => Logger.Log(@"Resume"), + Title = @"paused", + Description = @"you're not going to do what i think you're going to do, are ya?", }); pauseOverlay.AddButton(@"Continue", Color4.Green, delegate { Logger.Log(@"Resume"); }); diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs deleted file mode 100644 index b722d9d338..0000000000 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using osu.Framework.Graphics.Containers; -using osu.Framework.Input; -using OpenTK.Input; - -namespace osu.Game.Screens.Play -{ - public class FailOverlay : PauseOverlay - { - public Action OnQuit; - - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Key == Key.Escape) - { - if (State == Visibility.Hidden) return false; - quit(); - return true; - } - - return base.OnKeyDown(state, args); - } - - private void quit() - { - OnQuit?.Invoke(); - Hide(); - } - - public FailOverlay() - { - Title.Text = @"failed"; - Description.Text = @"you're dead, try again?"; - } - } -} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c4b37647cb..b6c185853a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -62,8 +62,8 @@ namespace osu.Game.Screens.Play private SkipButton skipButton; private HudOverlay hudOverlay; - private PauseOverlay pauseOverlay; - private FailOverlay failOverlay; + private StopOverlay pauseOverlay; + private StopOverlay failOverlay; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuColour colours) @@ -125,24 +125,28 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); - pauseOverlay = new PauseOverlay + pauseOverlay = new StopOverlay { Depth = -1, - OnResume = delegate + OnEscPressed = delegate { Delay(400); Schedule(Resume); }, + Title = @"paused", + Description = @"you're not going to do what i think you're going to do, are ya?", }; pauseOverlay.AddButton(@"Continue", colours.Green, delegate { Delay(400); Schedule(Resume); }); pauseOverlay.AddButton(@"Retry", colours.YellowDark, Restart); pauseOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit); - failOverlay = new FailOverlay + failOverlay = new StopOverlay { Depth = -1, - OnQuit = Exit, + OnEscPressed = Exit, + Title = @"failed", + Description = @"you're dead, try again?", }; failOverlay.AddButton(@"Retry", colours.YellowDark, Restart); failOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit); diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/StopOverlay.cs similarity index 88% rename from osu.Game/Screens/Play/PauseOverlay.cs rename to osu.Game/Screens/Play/StopOverlay.cs index dec59fb63b..dd5986b9c8 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/StopOverlay.cs @@ -16,7 +16,7 @@ using OpenTK.Input; namespace osu.Game.Screens.Play { - public class PauseOverlay : OverlayContainer + public class StopOverlay : OverlayContainer { private const int transition_duration = 200; private const int button_height = 70; @@ -24,10 +24,22 @@ namespace osu.Game.Screens.Play protected override bool HideOnEscape => false; - public Action OnResume; + public Action OnEscPressed; - protected OsuSpriteText Title; - protected OsuSpriteText Description; + private string title; + private string description; + + public string Title + { + get { return title; } + set { title = value; } + } + + public string Description + { + get { return description; } + set { description = value; } + } private readonly FillFlowContainer buttons; @@ -86,16 +98,16 @@ namespace osu.Game.Screens.Play if (args.Key == Key.Escape) { if (State == Visibility.Hidden) return false; - resume(); + onEscPressed(); return true; } return base.OnKeyDown(state, args); } - private void resume() + private void onEscPressed() { - OnResume?.Invoke(); + OnEscPressed?.Invoke(); Hide(); } @@ -115,7 +127,7 @@ namespace osu.Game.Screens.Play }); } - public PauseOverlay() + public StopOverlay() { AlwaysReceiveInput = true; @@ -148,9 +160,9 @@ namespace osu.Game.Screens.Play Spacing = new Vector2(0, 20), Children = new Drawable[] { - Title = new OsuSpriteText + new OsuSpriteText { - Text = @"paused", + Text = Title, Font = @"Exo2.0-Medium", Spacing = new Vector2(5, 0), Origin = Anchor.TopCentre, @@ -160,9 +172,9 @@ namespace osu.Game.Screens.Play Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f) }, - Description = new OsuSpriteText + new OsuSpriteText { - Text = @"you're not going to do what i think you're going to do, are ya?", + Text = Description, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Shadow = true, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da69e85cab..c81ea4b5d1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -194,14 +194,13 @@ - - + From f690e1d0c4e25fbb23b6d4992ecdb7601e099aea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 14:24:21 +0900 Subject: [PATCH 116/348] Move async logic to framework. --- .../Select/Leaderboards/LeaderboardScore.cs | 24 ++++--- osu.Game/Users/Avatar.cs | 70 ++++--------------- osu.Game/Users/UpdateableAvatar.cs | 11 ++- 3 files changed, 37 insertions(+), 68 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index c31ebc6095..4ea1be3674 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -142,17 +142,25 @@ namespace osu.Game.Screens.Select.Leaderboards Padding = new MarginPadding(edge_margin), Children = new Drawable[] { - avatar = new Avatar(Score.User ?? new User { Id = Score.UserID }) + avatar = new DelayedLoadContainer { + TimeBeforeLoad = 500, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), - CornerRadius = corner_radius, - Masking = true, - EdgeEffect = new EdgeEffect + Children = new Drawable[] { - Type = EdgeEffectType.Shadow, - Radius = 1, - Colour = Color4.Black.Opacity(0.2f), - }, + new Avatar(Score.User ?? new User { Id = Score.UserID }) + { + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Radius = 1, + Colour = Color4.Black.Opacity(0.2f), + }, + }, + } }, new Container { diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 2ac17cd23f..b032187624 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -13,75 +11,31 @@ namespace osu.Game.Users { public class Avatar : Container { - private const int time_before_load = 500; - - private Drawable sprite; private readonly User user; - private readonly bool delayedLoad; /// /// An avatar for specified user. /// /// The user. A null value will get a placeholder avatar. - /// Whether we should delay the load of the avatar until it has been on-screen for a specified duration. - public Avatar(User user = null, bool delayedLoad = true) + public Avatar(User user = null) { this.user = user; - this.delayedLoad = delayedLoad; } - private Action performLoad; - private Task loadTask; - - [BackgroundDependencyLoader(permitNulls: true)] + [BackgroundDependencyLoader] private void load(TextureStore textures) { - performLoad = () => + Texture texture = null; + if (user?.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); + if (texture == null) texture = textures.Get(@"Online/avatar-guest"); + + Add(new Sprite { - Texture texture = null; - if (user?.Id > 1) texture = textures.Get($@"https://a.ppy.sh/{user.Id}"); - if (texture == null) texture = textures.Get(@"Online/avatar-guest"); - - sprite = new Sprite - { - Texture = texture, - FillMode = FillMode.Fit, - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }; - - Schedule(() => - { - Add(sprite); - sprite.FadeInFromZero(150); - }); - }; - } - - private double timeVisible; - - private bool shouldLoad => !delayedLoad || timeVisible > time_before_load; - - protected override void Update() - { - base.Update(); - - if (!shouldLoad) - { - //Special optimisation to not start loading until we are within bounds of our closest ScrollContainer parent. - ScrollContainer scroll = null; - IContainer cursor = this; - while (scroll == null && (cursor = cursor.Parent) != null) - scroll = cursor as ScrollContainer; - - if (scroll?.ScreenSpaceDrawQuad.Intersects(ScreenSpaceDrawQuad) ?? true) - timeVisible += Time.Elapsed; - else - timeVisible = 0; - } - - if (shouldLoad && loadTask == null) - (loadTask = Task.Factory.StartNew(performLoad, TaskCreationOptions.LongRunning)).ConfigureAwait(false); + Texture = texture, + FillMode = FillMode.Fit, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); } } } diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 265c177ced..3ffb2a1dfd 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -11,7 +11,7 @@ namespace osu.Game.Users /// public class UpdateableAvatar : Container { - private Avatar displayedAvatar; + private Container displayedAvatar; private User user; @@ -40,7 +40,14 @@ namespace osu.Game.Users { displayedAvatar?.FadeOut(300); displayedAvatar?.Expire(); - Add(displayedAvatar = new Avatar(user, false) { RelativeSizeAxes = Axes.Both }); + Add(displayedAvatar = new AsyncLoadContainer + { + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new Avatar(user) { RelativeSizeAxes = Axes.Both } + } + }); } } } \ No newline at end of file From 3f6b17c0bf463945337e13b630ecd6d0b09d5900 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 15:05:45 +0900 Subject: [PATCH 117/348] Add drawable Swell. --- .../Tests/TestCaseTaikoHitObjects.cs | 26 +--- .../Tests/TestCaseTaikoPlayfield.cs | 12 ++ .../Objects/Drawable/DrawableSwell.cs | 115 ++++++++++++++++++ .../Drawable/Pieces/SwellCirclePiece.cs | 35 ++++++ osu.Game.Modes.Taiko/Objects/Swell.cs | 2 +- .../osu.Game.Modes.Taiko.csproj | 1 + 6 files changed, 166 insertions(+), 25 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellCirclePiece.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 0204058b8a..82fbb27d15 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -62,7 +62,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(350, 300) }); - Add(new SwellCircle(new CirclePiece() + Add(new SwellCirclePiece(new CirclePiece { KiaiMode = kiai }) @@ -70,7 +70,7 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(100, 500) }); - Add(new SwellCircle(new StrongCirclePiece() + Add(new SwellCirclePiece(new StrongCirclePiece { KiaiMode = kiai }) @@ -97,28 +97,6 @@ namespace osu.Desktop.VisualTests.Tests }); } - private class SwellCircle : BaseCircle - { - public SwellCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new TextAwesome - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - TextSize = SYMBOL_INNER_SIZE, - Icon = FontAwesome.fa_asterisk, - Shadow = false - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.YellowDark; - } - } - private class DrumRollCircle : BaseCircle { public DrumRollCircle(CirclePiece piece) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 395a0cab13..2cef59238d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -6,6 +6,7 @@ using osu.Framework.Screens.Testing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.UI; namespace osu.Desktop.VisualTests.Tests @@ -22,6 +23,7 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); + AddButton("Swell", addSwell); Add(playfield = new TaikoPlayfield { @@ -60,6 +62,16 @@ namespace osu.Desktop.VisualTests.Tests }); } + private void addSwell() + { + playfield.Add(new DrawableSwell(new Swell + { + StartTime = Time.Current + 1000, + EndTime = Time.Current + 5000, + PreEmpt = 1000 + })); + } + private class DrawableTestHit : DrawableHitObject { public DrawableTestHit(TaikoHitObject hitObject) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 15584ac73f..405fc48f3e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -1,15 +1,30 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; +using OpenTK.Graphics; using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using System; namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableSwell : DrawableTaikoHitObject { + private const float target_ring_thick_border = 4f; + private const float target_ring_thin_border = 1f; + private const float target_ring_scale = 5f; + private const float inner_ring_alpha = 0.35f; + /// /// The amount of times the user has hit this swell. /// @@ -17,10 +32,94 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private readonly Swell swell; + private readonly Container bodyContainer; + private readonly CircularContainer targetRing; + private readonly CircularContainer innerRing; + public DrawableSwell(Swell swell) : base(swell) { this.swell = swell; + + Children = new Framework.Graphics.Drawable[] + { + bodyContainer = new Container + { + Children = new Framework.Graphics.Drawable[] + { + innerRing = new CircularContainer + { + Name = "Inner ring", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Masking = true, + Children = new [] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = inner_ring_alpha, + } + } + }, + targetRing = new CircularContainer + { + Name = "Target ring (thick border)", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Masking = true, + BorderThickness = target_ring_thick_border, + Children = new Framework.Graphics.Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + }, + new CircularContainer + { + Name = "Target ring (thin border)", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = target_ring_thin_border, + BorderColour = Color4.White, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + } + } + }, + new SwellCirclePiece(new CirclePiece()) + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + innerRing.Colour = colours.YellowDark; + targetRing.BorderColour = colours.YellowDark.Opacity(0.25f); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + LifetimeEnd = swell.EndTime + HitObject.PreEmpt; + + targetRing.Delay(HitObject.StartTime - Time.Current).ScaleTo(target_ring_scale, 600, EasingTypes.OutQuint); } protected override void CheckJudgement(bool userTriggered) @@ -32,6 +131,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable userHits++; + innerRing.FadeTo(1); + innerRing.FadeTo(inner_ring_alpha, 500, EasingTypes.OutQuint); + innerRing.ScaleTo(1f + (target_ring_scale - 1) * userHits / swell.RequiredHits, 1200, EasingTypes.OutElastic); + if (userHits == swell.RequiredHits) { Judgement.Result = HitResult.Hit; @@ -55,6 +158,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void UpdateState(ArmedState state) { + switch (state) + { + case ArmedState.Idle: + break; + case ArmedState.Miss: + bodyContainer.FadeOut(100); + break; + case ArmedState.Hit: + bodyContainer.ScaleTo(1.2f, 400, EasingTypes.OutQuad); + bodyContainer.FadeOut(600, EasingTypes.OutQuint); + break; + } } protected override void UpdateScrollPosition(double time) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellCirclePiece.cs new file mode 100644 index 0000000000..8274a2bff0 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellCirclePiece.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + public class SwellCirclePiece : Container + { + private readonly CirclePiece circle; + + public SwellCirclePiece(CirclePiece piece) + { + Add(circle = piece); + + circle.Add(new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + TextSize = CirclePiece.SYMBOL_INNER_SIZE, + Icon = FontAwesome.fa_asterisk, + Shadow = false + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.AccentColour = colours.YellowDark; + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs index 20b9a6effb..4cbb5904c7 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -17,7 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// The number of hits required to complete the swell successfully. /// - public int RequiredHits { get; protected set; } + public int RequiredHits { get; protected set; } = 10; public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index fa09ae2c82..7cec1bfa7f 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -57,6 +57,7 @@ + From 4042b94e018379236cbad2282eddfd6843ca9328 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 14:35:18 +0900 Subject: [PATCH 118/348] Use DelayedLoadContainer in more places. --- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 27 +-- osu.Game/Overlays/MusicController.cs | 57 +++--- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 163 +++++++++--------- .../Select/Leaderboards/LeaderboardScore.cs | 1 + osu.Game/Users/UpdateableAvatar.cs | 1 + 5 files changed, 124 insertions(+), 125 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 2d032f0ea4..f8986b2ecd 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -33,12 +33,25 @@ namespace osu.Game.Beatmaps.Drawables Children = new Drawable[] { + new DelayedLoadContainer + { + RelativeSizeAxes = Axes.Both, + TimeBeforeLoad = 100, + Children = new[] + { + new PanelBackground(beatmap) + { + RelativeSizeAxes = Axes.Both, + Depth = 1, + } + } + }, new FillFlowContainer { Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both, - Children = new[] + Children = new Drawable[] { title = new OsuSpriteText { @@ -71,23 +84,13 @@ namespace osu.Game.Beatmaps.Drawables } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, OsuGameBase game) + private void load(OsuConfigManager config) { this.config = config; preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); preferUnicode.ValueChanged += preferUnicode_changed; preferUnicode_changed(preferUnicode, null); - - new PanelBackground(beatmap) - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - }.LoadAsync(game, b => - { - Add(b); - b.FadeInFromZero(200); - }); } private void preferUnicode_changed(object sender, EventArgs e) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a45dcaacb8..ad115d32cc 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays { public class MusicController : FocusedOverlayContainer { - private MusicControllerBackground backgroundSprite; + private Drawable currentBackground; private DragBar progress; private TextAwesome playButton; private SpriteText title, artist; @@ -44,7 +44,6 @@ namespace osu.Game.Overlays private Bindable preferUnicode; private WorkingBeatmap current; private BeatmapDatabase beatmaps; - private Framework.Game game; private Container dragContainer; @@ -78,10 +77,8 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuGameBase osuGame, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) + private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) { - game = osuGame; - unicodeString = config.GetUnicodeString; Children = new Drawable[] @@ -212,15 +209,15 @@ namespace osu.Game.Overlays }; this.beatmaps = beatmaps; - trackManager = osuGame.Audio.Track; + trackManager = game.Audio.Track; preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); preferUnicode.ValueChanged += preferUnicode_changed; - beatmapSource = osuGame.Beatmap ?? new Bindable(); + beatmapSource = game.Beatmap ?? new Bindable(); playList = beatmaps.GetAllWithChildren(); - backgroundSprite = new MusicControllerBackground(); - dragContainer.Add(backgroundSprite); + currentBackground = new MusicControllerBackground(); + dragContainer.Add(currentBackground); } protected override void LoadComplete() @@ -351,29 +348,29 @@ namespace osu.Game.Overlays } }); - MusicControllerBackground newBackground; - - (newBackground = new MusicControllerBackground(beatmap)).LoadAsync(game, delegate + dragContainer.Add(new AsyncLoadContainer { - - dragContainer.Add(newBackground); - - switch (direction) + RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue, + Children = new[] { new MusicControllerBackground(beatmap) }, + FinishedLoading = d => { - case TransformDirection.Next: - newBackground.Position = new Vector2(400, 0); - newBackground.MoveToX(0, 500, EasingTypes.OutCubic); - backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic); - break; - case TransformDirection.Prev: - newBackground.Position = new Vector2(-400, 0); - newBackground.MoveToX(0, 500, EasingTypes.OutCubic); - backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic); - break; + switch (direction) + { + case TransformDirection.Next: + d.Position = new Vector2(400, 0); + d.MoveToX(0, 500, EasingTypes.OutCubic); + currentBackground.MoveToX(-400, 500, EasingTypes.OutCubic); + break; + case TransformDirection.Prev: + d.Position = new Vector2(-400, 0); + d.MoveToX(0, 500, EasingTypes.OutCubic); + currentBackground.MoveToX(400, 500, EasingTypes.OutCubic); + break; + } + currentBackground.Expire(); + currentBackground = d; } - - backgroundSprite.Expire(); - backgroundSprite = newBackground; }); }; } @@ -422,8 +419,8 @@ namespace osu.Game.Overlays { this.beatmap = beatmap; CacheDrawnFrameBuffer = true; - RelativeSizeAxes = Axes.Both; Depth = float.MaxValue; + RelativeSizeAxes = Axes.Both; Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d0805c19bd..e932b6faf1 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -30,9 +29,7 @@ namespace osu.Game.Screens.Select { private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); - private BufferedContainer beatmapInfoContainer; - - private OsuGameBase game; + private Drawable beatmapInfoContainer; public BeatmapInfoWedge() { @@ -49,12 +46,6 @@ namespace osu.Game.Screens.Select }; } - [BackgroundDependencyLoader] - private void load(OsuGameBase game) - { - this.game = game; - } - protected override bool HideOnEscape => false; protected override void PopIn() @@ -113,105 +104,111 @@ namespace osu.Game.Screens.Select labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } - (beatmapInfoContainer = new BufferedContainer + Add(beatmapInfoContainer = new AsyncLoadContainer { - Depth = newDepth, - PixelSnapping = true, - CacheDrawnFrameBuffer = true, - Shear = -Shear, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + FinishedLoading = d => { - // We will create the white-to-black gradient by modulating transparency and having - // a black backdrop. This results in an sRGB-space gradient and not linear space, - // transitioning from white to black more perceptually uniformly. - new Box + FadeIn(250); + + lastContainer?.FadeOut(250); + lastContainer?.Expire(); + }, + Depth = newDepth, + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new BufferedContainer { + PixelSnapping = true, + CacheDrawnFrameBuffer = true, + Shear = -Shear, RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - // We use a container, such that we can set the colour gradient to go across the - // vertices of the masked container instead of the vertices of the (larger) sprite. - new Container - { - RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), - Children = new [] - { - // Zoomed-in and cropped beatmap background - new BeatmapBackgroundSprite(beatmap) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - }, - }, - }, - // Text for beatmap info - new FillFlowContainer - { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, - AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new OsuSpriteText + // We will create the white-to-black gradient by modulating transparency and having + // a black backdrop. This results in an sRGB-space gradient and not linear space, + // transitioning from white to black more perceptually uniformly. + new Box { - Font = @"Exo2.0-MediumItalic", - Text = metadata.Artist + " -- " + metadata.Title, - TextSize = 28, - Shadow = true, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, }, - new OsuSpriteText + // We use a container, such that we can set the colour gradient to go across the + // vertices of the masked container instead of the vertices of the (larger) sprite. + new Container { - Font = @"Exo2.0-MediumItalic", - Text = beatmapInfo.Version, - TextSize = 17, - Shadow = true, + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), + Children = new[] + { + // Zoomed-in and cropped beatmap background + new BeatmapBackgroundSprite(beatmap) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + }, + }, }, + // Text for beatmap info new FillFlowContainer { - Margin = new MarginPadding { Top = 10 }, - Direction = FillDirection.Horizontal, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, - Children = new [] + Children = new Drawable[] { new OsuSpriteText { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, + Font = @"Exo2.0-MediumItalic", + Text = metadata.Artist + " -- " + metadata.Title, + TextSize = 28, Shadow = true, }, new OsuSpriteText { - Font = @"Exo2.0-Bold", - Text = metadata.Author, - TextSize = 15, + Font = @"Exo2.0-MediumItalic", + Text = beatmapInfo.Version, + TextSize = 17, Shadow = true, }, + new FillFlowContainer + { + Margin = new MarginPadding { Top = 10 }, + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new OsuSpriteText + { + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + Shadow = true, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author, + TextSize = 15, + Shadow = true, + }, + } + }, + new FillFlowContainer + { + Margin = new MarginPadding { Top = 20 }, + Spacing = new Vector2(40, 0), + AutoSizeAxes = Axes.Both, + Children = labels + }, } }, - new FillFlowContainer - { - Margin = new MarginPadding { Top = 20 }, - Spacing = new Vector2(40, 0), - AutoSizeAxes = Axes.Both, - Children = labels - }, } - }, + } } - }).LoadAsync(game, delegate (Drawable d) - { - FadeIn(250); - - lastContainer?.FadeOut(250); - lastContainer?.Expire(); - - Add(d); }); } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 4ea1be3674..d98744aa50 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -145,6 +145,7 @@ namespace osu.Game.Screens.Select.Leaderboards avatar = new DelayedLoadContainer { TimeBeforeLoad = 500, + FinishedLoading = d => d.FadeInFromZero(200), Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), Children = new Drawable[] { diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 3ffb2a1dfd..4fc2298525 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -43,6 +43,7 @@ namespace osu.Game.Users Add(displayedAvatar = new AsyncLoadContainer { RelativeSizeAxes = Axes.Both, + FinishedLoading = d => d.FadeInFromZero(200), Children = new[] { new Avatar(user) { RelativeSizeAxes = Axes.Both } From ae4cabccefe7695787ad572e5bffd1de1c284eba Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 16:00:39 +0900 Subject: [PATCH 119/348] Adjust comment. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index d4abdb5ead..9bc75a55f5 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -26,6 +26,7 @@ namespace osu.Game.Modes.Taiko.UI /// /// The play field height scale. + /// This also uniformly scales the notes to match the new playfield height. /// public const float PLAYFIELD_SCALE = 0.65f; From d1f686b1a8ee3565ff9f6f6b9962ba5344acd262 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 16:38:58 +0900 Subject: [PATCH 120/348] Fix DrawableTaikoHitObject origins. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index c14dc6d7b0..609fac70ea 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable : base(hitObject) { Anchor = Anchor.CentreLeft; - Origin = Anchor.Centre; + Origin = Anchor.CentreLeft; RelativePositionAxes = Axes.X; } From 1615db386a8eff9204b217f4cbe4bf81f834ec1d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 16:47:13 +0900 Subject: [PATCH 121/348] Give DrumRoll some sane velocity/tickdistance defaults. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 1f9241268b..7dba605213 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -25,13 +25,13 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Velocity of the drum roll in positional length units per millisecond. /// - public double Velocity { get; protected set; } + public double Velocity { get; protected set; } = 5; /// /// The distance between ticks of this drumroll. /// Half of this value is the hit window of the ticks. /// - public double TickTimeDistance { get; protected set; } + public double TickTimeDistance { get; protected set; } = 200; /// /// Number of drum roll ticks required for a "Good" hit. From 1220972170a98eeaec35213b11f4dd2f8dffff4b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 16:47:25 +0900 Subject: [PATCH 122/348] Fix ticks not being passed IsStrong. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 7dba605213..ff73c40d2f 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -88,6 +88,7 @@ namespace osu.Game.Modes.Taiko.Objects PreEmpt = PreEmpt, TickTimeDistance = TickTimeDistance, StartTime = t, + IsStrong = IsStrong, Sample = new HitSampleInfo { Type = SampleType.None, From 2e8607687c1dccb4cb23c6675193769fff947401 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 16:49:39 +0900 Subject: [PATCH 123/348] Implement DrumRollTick drawing. --- .../Objects/Drawable/DrawableDrumRollTick.cs | 57 ++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index 1e270c6751..da460e5cfc 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -5,20 +5,67 @@ using OpenTK.Input; using osu.Game.Modes.Taiko.Judgements; using System; using osu.Game.Modes.Objects.Drawables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableDrumRollTick : DrawableTaikoHitObject { + /// + /// The size of a tick. + /// + private const float tick_size = 24; + + /// + /// Any tick that is not the first is not filled, but is displayed + /// as a circle instead. This is what controls the stroke width of that circle. + /// + private const float tick_border_width = 6; + private readonly DrumRollTick tick; + private readonly CircularContainer bodyContainer; + public DrawableDrumRollTick(DrumRollTick tick) : base(tick) { this.tick = tick; + + Anchor = Anchor.CentreLeft; + Origin = Anchor.Centre; + + RelativePositionAxes = Axes.X; + Size = new Vector2(tick_size); + + Children = new[] + { + bodyContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = tick_border_width, + BorderColour = Color4.White, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = tick.FirstTick ? 1 : 0, + AlwaysPresent = true + } + } + } + }; } - protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement(); + protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = tick.IsStrong }; protected override void CheckJudgement(bool userTriggered) { @@ -38,11 +85,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void UpdateState(ArmedState state) { + switch (state) + { + case ArmedState.Hit: + bodyContainer.ScaleTo(0, 100, EasingTypes.OutQuint); + break; + } } protected override void UpdateScrollPosition(double time) { - // Drum roll ticks shouldn't move + // Ticks don't move } protected override bool HandleKeyPress(Key key) From 62693a6a59de583006fd2f9f8cd462b158fef14e Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 10:49:58 +0300 Subject: [PATCH 124/348] Again separate classes --- .../Tests/TestCasePauseOverlay.cs | 12 +++---- .../Play/{StopOverlay.cs => FailOverlay.cs} | 19 +++++----- osu.Game/Screens/Play/PauseOverlay.cs | 35 +++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 21 +++++------ osu.Game/osu.Game.csproj | 3 +- 5 files changed, 60 insertions(+), 30 deletions(-) rename osu.Game/Screens/Play/{StopOverlay.cs => FailOverlay.cs} (93%) create mode 100644 osu.Game/Screens/Play/PauseOverlay.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 34c0d875b4..5b8bcf3d1b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -12,25 +12,23 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests the pause overlay"; - private StopOverlay pauseOverlay; + private PauseOverlay pauseOverlay; private int retryCount; public override void Reset() { base.Reset(); - Add(pauseOverlay = new StopOverlay + Add(pauseOverlay = new PauseOverlay { Depth = -1, - OnEscPressed = () => Logger.Log(@"Resume"), + OnResume = () => Logger.Log(@"Resume"), + OnRetry = () => Logger.Log(@"Retry"), + OnQuit = () => Logger.Log(@"Quit"), Title = @"paused", Description = @"you're not going to do what i think you're going to do, are ya?", }); - pauseOverlay.AddButton(@"Continue", Color4.Green, delegate { Logger.Log(@"Resume"); }); - pauseOverlay.AddButton(@"Retry", Color4.Yellow, delegate { Logger.Log(@"Retry"); }); - pauseOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), delegate { Logger.Log(@"Quit"); }); - AddButton("Pause", pauseOverlay.Show); AddButton("Add Retry", delegate { diff --git a/osu.Game/Screens/Play/StopOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs similarity index 93% rename from osu.Game/Screens/Play/StopOverlay.cs rename to osu.Game/Screens/Play/FailOverlay.cs index dd5986b9c8..35a25c5207 100644 --- a/osu.Game/Screens/Play/StopOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -13,10 +13,11 @@ using osu.Game.Screens.Play.Pause; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; +using osu.Game.Graphics; namespace osu.Game.Screens.Play { - public class StopOverlay : OverlayContainer + public class FailOverlay : OverlayContainer { private const int transition_duration = 200; private const int button_height = 70; @@ -24,7 +25,8 @@ namespace osu.Game.Screens.Play protected override bool HideOnEscape => false; - public Action OnEscPressed; + public Action OnRetry; + public Action OnQuit; private string title; private string description; @@ -98,19 +100,13 @@ namespace osu.Game.Screens.Play if (args.Key == Key.Escape) { if (State == Visibility.Hidden) return false; - onEscPressed(); + OnQuit(); return true; } return base.OnKeyDown(state, args); } - private void onEscPressed() - { - OnEscPressed?.Invoke(); - Hide(); - } - public void AddButton(string text, Color4 colour, Action action) { buttons.Add(new PauseButton @@ -127,7 +123,7 @@ namespace osu.Game.Screens.Play }); } - public StopOverlay() + public FailOverlay() { AlwaysReceiveInput = true; @@ -214,6 +210,9 @@ namespace osu.Game.Screens.Play }; Retries = 0; + + AddButton(@"Retry", Color4.Yellow, OnRetry); + AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } } } diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs new file mode 100644 index 0000000000..a1564c6aac --- /dev/null +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Input; +using osu.Game.Graphics; +using OpenTK.Input; +using osu.Framework.Graphics.Containers; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Play +{ + public class PauseOverlay : FailOverlay + { + public Action OnResume; + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Key == Key.Escape) + { + if (State == Visibility.Hidden) return false; + OnResume(); + return true; + } + + return base.OnKeyDown(state, args); + } + + public PauseOverlay() + { + AddButton(@"Continue", Color4.Green, OnResume); + } + } +} + \ No newline at end of file diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b6c185853a..51faa135f7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -62,8 +62,8 @@ namespace osu.Game.Screens.Play private SkipButton skipButton; private HudOverlay hudOverlay; - private StopOverlay pauseOverlay; - private StopOverlay failOverlay; + private PauseOverlay pauseOverlay; + private FailOverlay failOverlay; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuColour colours) @@ -125,31 +125,28 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); - pauseOverlay = new StopOverlay + pauseOverlay = new PauseOverlay { Depth = -1, - OnEscPressed = delegate + OnResume = delegate { Delay(400); Schedule(Resume); }, + OnRetry = Restart, + OnQuit = Exit, Title = @"paused", Description = @"you're not going to do what i think you're going to do, are ya?", }; - pauseOverlay.AddButton(@"Continue", colours.Green, delegate { Delay(400); Schedule(Resume); }); - pauseOverlay.AddButton(@"Retry", colours.YellowDark, Restart); - pauseOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit); - - failOverlay = new StopOverlay + failOverlay = new FailOverlay { Depth = -1, - OnEscPressed = Exit, + OnRetry = Restart, + OnQuit = Exit, Title = @"failed", Description = @"you're dead, try again?", }; - failOverlay.AddButton(@"Retry", colours.YellowDark, Restart); - failOverlay.AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), Exit); if (ReplayInputHandler != null) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c81ea4b5d1..e3faa6544f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -194,13 +194,14 @@ + + - From 6b1dab5b834dad53f8c71d7f67c9efbf4e966789 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 16:50:06 +0900 Subject: [PATCH 125/348] Implement drawable drumroll. --- .../Tests/TestCaseTaikoPlayfield.cs | 18 ++++++++++++ .../Objects/Drawable/DrawableDrumRoll.cs | 22 +++++++++------ .../Drawable/DrawableStrongDrumRoll.cs | 20 +++++++++++++ .../Drawable/Pieces/DrumRollCirclePiece.cs | 28 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 4 ++- 5 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 395a0cab13..ef9c3006f1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -6,6 +6,7 @@ using osu.Framework.Screens.Testing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.UI; namespace osu.Desktop.VisualTests.Tests @@ -22,6 +23,8 @@ namespace osu.Desktop.VisualTests.Tests AddButton("Hit!", addHitJudgement); AddButton("Miss :(", addMissJudgement); + AddButton("DrumRoll", () => addDrumRoll(false)); + AddButton("Strong DrumRoll", () => addDrumRoll(true)); Add(playfield = new TaikoPlayfield { @@ -60,6 +63,21 @@ namespace osu.Desktop.VisualTests.Tests }); } + private void addDrumRoll(bool strong) + { + var d = new DrumRoll + { + StartTime = Time.Current + 1000, + Distance = 2000, + PreEmpt = 1000, + }; + + if (strong) + playfield.Add(new DrawableStrongDrumRoll(d)); + else + playfield.Add(new DrawableDrumRoll(d)); + } + private class DrawableTestHit : DrawableHitObject { public DrawableTestHit(TaikoHitObject hitObject) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index 3551538fe7..7915599c3e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -1,8 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using System.Linq; namespace osu.Game.Modes.Taiko.Objects.Drawable @@ -16,25 +18,23 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { this.drumRoll = drumRoll; - int tickIndex = 0; + RelativeSizeAxes = Axes.X; + Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); + + Add(new DrumRollCirclePiece(CreateCirclePiece())); + foreach (var tick in drumRoll.Ticks) { var newTick = new DrawableDrumRollTick(tick) { - Depth = tickIndex, X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration) }; AddNested(newTick); - - tickIndex++; + Add(newTick); } } - protected override void UpdateState(ArmedState state) - { - } - protected override void CheckJudgement(bool userTriggered) { if (userTriggered) @@ -53,5 +53,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable else Judgement.Result = HitResult.Miss; } + + protected override void UpdateState(ArmedState state) + { + } + + protected virtual CirclePiece CreateCirclePiece() => new CirclePiece(); } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs new file mode 100644 index 0000000000..e9723a0162 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableStrongDrumRoll : DrawableDrumRoll + { + public DrawableStrongDrumRoll(DrumRoll drumRoll) + : base(drumRoll) + { + } + + protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = true }; + + protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece(); + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs new file mode 100644 index 0000000000..d462f4eeb8 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2017 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.Game.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +{ + public class DrumRollCirclePiece : Container + { + private readonly CirclePiece circle; + + public DrumRollCirclePiece(CirclePiece piece) + { + RelativeSizeAxes = Axes.X; + + Add(circle = piece); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + circle.AccentColour = colours.YellowDark; + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index d2aecc8d2e..3e26bf7ef2 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -53,11 +53,13 @@ + + @@ -102,4 +104,4 @@ --> - + \ No newline at end of file From 6f66558e299e14091321ee2b167289caef8d7276 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:10:01 +0900 Subject: [PATCH 126/348] Use relative size for ticks. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index da460e5cfc..74ffc59548 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -19,13 +19,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// /// The size of a tick. /// - private const float tick_size = 24; + private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2; /// /// Any tick that is not the first is not filled, but is displayed /// as a circle instead. This is what controls the stroke width of that circle. /// - private const float tick_border_width = 6; + private const float tick_border_width = tick_size / 4; private readonly DrumRollTick tick; From adf255081110638ea78142e3f38ec7c09853093b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:13:05 +0900 Subject: [PATCH 127/348] Base playfield height + hit target offset on hit object height. --- .../Objects/TaikoHitObject.cs | 2 +- osu.Game.Modes.Taiko/UI/HitTarget.cs | 6 ++--- osu.Game.Modes.Taiko/UI/InputDrum.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 24 +++++-------------- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 28077db1ba..f3010e0c59 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -12,7 +12,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// HitCircle radius. /// - public const float CIRCLE_RADIUS = 64; + public const float CIRCLE_RADIUS = 51; /// /// The time to scroll in the HitObject. diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index d38af3390e..32b2877545 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Taiko.UI /// /// Diameter of normal hit object circles. /// - private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; + private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2; /// /// Diameter of finisher hit object circles. @@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, new CircularContainer @@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, }; diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 2e4c2232fa..2c21d48960 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.UI { public InputDrum() { - Size = new Vector2(TaikoPlayfield.PlayfieldHeight); + Size = new Vector2(TaikoPlayfield.PLAYFIELD_HEIGHT); const float middle_split = 10; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 9bc75a55f5..eaa8863039 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -20,25 +20,15 @@ namespace osu.Game.Modes.Taiko.UI public class TaikoPlayfield : Playfield { /// - /// The default play field height. + /// The play field height. This is relative to the size of hit objects + /// such that the playfield is just a bit larger than finishers. /// - public const float PLAYFIELD_BASE_HEIGHT = 242; - - /// - /// The play field height scale. - /// This also uniformly scales the notes to match the new playfield height. - /// - public const float PLAYFIELD_SCALE = 0.65f; - - /// - /// The play field height after scaling. - /// - public static float PlayfieldHeight => PLAYFIELD_BASE_HEIGHT * PLAYFIELD_SCALE; + public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; /// /// The offset from which the center of the hit target lies at. /// - private const float hit_target_offset = 80; + private const float hit_target_offset = TaikoHitObject.CIRCLE_RADIUS * 1.5f + 40; /// /// The size of the left area of the playfield. This area contains the input drum. @@ -61,7 +51,7 @@ namespace osu.Game.Modes.Taiko.UI public TaikoPlayfield() { RelativeSizeAxes = Axes.X; - Height = PlayfieldHeight; + Height = PLAYFIELD_HEIGHT; AddInternal(new Drawable[] { @@ -102,7 +92,6 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), - Scale = new Vector2(PLAYFIELD_SCALE), BlendingMode = BlendingMode.Additive }, //barLineContainer = new Container @@ -129,7 +118,7 @@ namespace osu.Game.Modes.Taiko.UI }, leftBackgroundContainer = new Container { - Size = new Vector2(left_area_size, PlayfieldHeight), + Size = new Vector2(left_area_size, PLAYFIELD_HEIGHT), BorderThickness = 1, Children = new Drawable[] { @@ -174,7 +163,6 @@ namespace osu.Game.Modes.Taiko.UI public override void Add(DrawableHitObject h) { h.Depth = (float)h.HitObject.StartTime; - h.Scale = new Vector2(PLAYFIELD_SCALE); base.Add(h); } From efa7e5cb7d8b22f73e3bbf44b12d92faa3c45c01 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:14:06 +0900 Subject: [PATCH 128/348] Adjust radius. --- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index f3010e0c59..ac47a3bc88 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -12,7 +12,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// HitCircle radius. /// - public const float CIRCLE_RADIUS = 51; + public const float CIRCLE_RADIUS = 42f; /// /// The time to scroll in the HitObject. From 79764603d7b2102a414ada8e160c871f4b105856 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:18:58 +0900 Subject: [PATCH 129/348] Adjust comment. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index 74ffc59548..b6a20bab8d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -22,8 +22,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2; /// - /// Any tick that is not the first is not filled, but is displayed - /// as a circle instead. This is what controls the stroke width of that circle. + /// Any tick that is not the first for a drumroll is not filled, but is instead displayed + /// as a hollow circle. This is what controls the border width of that circle. /// private const float tick_border_width = tick_size / 4; From 2ff213d2c8f47b37b0420704cdef00aad2a1cf06 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:19:27 +0900 Subject: [PATCH 130/348] Fix resharper warning. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index ef9c3006f1..a318ec570f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -72,10 +72,7 @@ namespace osu.Desktop.VisualTests.Tests PreEmpt = 1000, }; - if (strong) - playfield.Add(new DrawableStrongDrumRoll(d)); - else - playfield.Add(new DrawableDrumRoll(d)); + playfield.Add(strong ? new DrawableStrongDrumRoll(d) : new DrawableDrumRoll(d)); } private class DrawableTestHit : DrawableHitObject From c14759ebadd04d933f013b3c246ba593d993444b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:24:14 +0900 Subject: [PATCH 131/348] Use new circle piece in test case. --- .../Tests/TestCaseTaikoHitObjects.cs | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 0204058b8a..5e8d28e192 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -78,21 +78,21 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(350, 500) }); - Add(new DrumRollCircle(new CirclePiece() + Add(new DrumRollCirclePiece(new CirclePiece { KiaiMode = kiai }) { - Width = 250, + Width = 0.25f, Position = new Vector2(575, 100) }); - Add(new DrumRollCircle(new StrongCirclePiece() + Add(new DrumRollCirclePiece(new StrongCirclePiece { KiaiMode = kiai }) { - Width = 250, + Width = 0.25f, Position = new Vector2(575, 300) }); } @@ -119,20 +119,6 @@ namespace osu.Desktop.VisualTests.Tests } } - private class DrumRollCircle : BaseCircle - { - public DrumRollCircle(CirclePiece piece) - : base(piece) - { - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.YellowDark; - } - } - private class CentreHitCircle : BaseCircle { public CentreHitCircle(CirclePiece piece) From 714c280531bad47c8b93c220c609db155a746f49 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 28 Mar 2017 17:26:30 +0900 Subject: [PATCH 132/348] One more xmldoc. --- .../Objects/Drawable/Pieces/DrumRollCirclePiece.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs index d462f4eeb8..076ac5d03a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs @@ -8,6 +8,9 @@ using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { + /// + /// A circle piece used for drumrolls. + /// public class DrumRollCirclePiece : Container { private readonly CirclePiece circle; From 85c2184170da10efc9d97cddc9e99fa6afb1b1ae Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 11:33:56 +0300 Subject: [PATCH 133/348] Fixes --- osu.Game/Screens/Play/FailOverlay.cs | 24 +++++++++++++++++------- osu.Game/Screens/Play/PauseOverlay.cs | 6 ++++-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 35a25c5207..4ff6c4c18d 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -14,6 +14,7 @@ using OpenTK; using OpenTK.Graphics; using OpenTK.Input; using osu.Game.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Screens.Play { @@ -43,7 +44,7 @@ namespace osu.Game.Screens.Play set { description = value; } } - private readonly FillFlowContainer buttons; + private FillFlowContainer buttons; public int Retries { @@ -83,7 +84,7 @@ namespace osu.Game.Screens.Play } } - private readonly FillFlowContainer retryCounterContainer; + private FillFlowContainer retryCounterContainer; public override bool HandleInput => State == Visibility.Visible; @@ -123,11 +124,9 @@ namespace osu.Game.Screens.Play }); } - public FailOverlay() + [BackgroundDependencyLoader] + private void load(OsuColour colours) { - AlwaysReceiveInput = true; - - RelativeSizeAxes = Axes.Both; Children = new Drawable[] { new Box @@ -211,8 +210,19 @@ namespace osu.Game.Screens.Play Retries = 0; - AddButton(@"Retry", Color4.Yellow, OnRetry); + AddButtons(colours); + } + + protected virtual void AddButtons(OsuColour colours) + { + AddButton(@"Retry", colours.YellowDark, OnRetry); AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } + + public FailOverlay() + { + AlwaysReceiveInput = true; + RelativeSizeAxes = Axes.Both; + } } } diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index a1564c6aac..bad7050d7a 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -26,9 +26,11 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } - public PauseOverlay() + protected override void AddButtons(OsuColour colours) { - AddButton(@"Continue", Color4.Green, OnResume); + AddButton(@"Continue", colours.Green, OnResume); + AddButton(@"Retry", colours.YellowDark, OnRetry); + AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } } } From 60be69d3b08c700c5a1f8a14ebbfb756bb237a1b Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 11:41:08 +0300 Subject: [PATCH 134/348] Fixes --- osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs | 1 - osu.Game/Screens/Play/Player.cs | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 5b8bcf3d1b..f6af0acaf8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Framework.Logging; using osu.Framework.Screens.Testing; using osu.Game.Screens.Play; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 51faa135f7..46e5902459 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; @@ -66,7 +65,7 @@ namespace osu.Game.Screens.Play private FailOverlay failOverlay; [BackgroundDependencyLoader] - private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuColour colours) + private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { var beatmap = Beatmap.Beatmap; From 687f71e41040a8bf61f7d6b72d8e90195a3a1afa Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 11:45:48 +0300 Subject: [PATCH 135/348] Fixes --- osu.Game/Screens/Play/FailOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 4ff6c4c18d..86af45be76 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, TextSize = 30, - Colour = Color4.Yellow, + Colour = colours.Yellow, Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f) }, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 46e5902459..6ae041710d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -23,7 +23,6 @@ using osu.Game.Screens.Ranking; using System; using System.Linq; using osu.Game.Modes.Scoring; -using osu.Game.Graphics; namespace osu.Game.Screens.Play { From cf3db49631cc2bece295676ac7b25175c8fb67aa Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 12:09:26 +0300 Subject: [PATCH 136/348] Inherit Pause/Fail overlay from InGameOverlay --- osu.Game/Screens/Play/FailOverlay.cs | 195 +--------------------- osu.Game/Screens/Play/InGameOverlay.cs | 216 +++++++++++++++++++++++++ osu.Game/Screens/Play/PauseOverlay.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 4 files changed, 219 insertions(+), 195 deletions(-) create mode 100644 osu.Game/Screens/Play/InGameOverlay.cs diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 86af45be76..9fa95b008e 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -18,84 +18,8 @@ using osu.Framework.Allocation; namespace osu.Game.Screens.Play { - public class FailOverlay : OverlayContainer + public class FailOverlay : InGameOverlay { - private const int transition_duration = 200; - private const int button_height = 70; - private const float background_alpha = 0.75f; - - protected override bool HideOnEscape => false; - - public Action OnRetry; - public Action OnQuit; - - private string title; - private string description; - - public string Title - { - get { return title; } - set { title = value; } - } - - public string Description - { - get { return description; } - set { description = value; } - } - - private FillFlowContainer buttons; - - public int Retries - { - set - { - if (retryCounterContainer != null) - { - // "You've retried 1,065 times in this session" - // "You've retried 1 time in this session" - - retryCounterContainer.Children = new Drawable[] - { - new OsuSpriteText - { - Text = "You've retried ", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - }, - new OsuSpriteText - { - Text = $"{value:n0}", - Font = @"Exo2.0-Bold", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - }, - new OsuSpriteText - { - Text = $" time{(value == 1 ? "" : "s")} in this session", - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 - } - }; - } - } - } - - private FillFlowContainer retryCounterContainer; - - public override bool HandleInput => State == Visibility.Visible; - - protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In); - protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In); - - // Don't let mouse down events through the overlay or people can click circles while paused. - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; - - protected override bool OnMouseMove(InputState state) => true; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (args.Key == Key.Escape) @@ -107,122 +31,5 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } - - public void AddButton(string text, Color4 colour, Action action) - { - buttons.Add(new PauseButton - { - Text = text, - ButtonColour = colour, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Height = button_height, - Action = delegate { - action?.Invoke(); - Hide(); - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - Alpha = background_alpha, - }, - new FillFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 50), - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Children = new Drawable[] - { - new FillFlowContainer - { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 20), - Children = new Drawable[] - { - new OsuSpriteText - { - Text = Title, - Font = @"Exo2.0-Medium", - Spacing = new Vector2(5, 0), - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - TextSize = 30, - Colour = colours.Yellow, - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f) - }, - new OsuSpriteText - { - Text = Description, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Shadow = true, - ShadowColour = new Color4(0, 0, 0, 0.25f) - } - } - }, - buttons = new FillFlowContainer - { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Masking = true, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Colour = Color4.Black.Opacity(0.6f), - Radius = 50 - }, - }, - retryCounterContainer = new FillFlowContainer - { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - AutoSizeAxes = Axes.Both, - } - } - }, - new PauseProgressBar - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, - Width = 1f - } - }; - - Retries = 0; - - AddButtons(colours); - } - - protected virtual void AddButtons(OsuColour colours) - { - AddButton(@"Retry", colours.YellowDark, OnRetry); - AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); - } - - public FailOverlay() - { - AlwaysReceiveInput = true; - RelativeSizeAxes = Axes.Both; - } } } diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs new file mode 100644 index 0000000000..b4efe47399 --- /dev/null +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -0,0 +1,216 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Input; +using osu.Game.Graphics.Sprites; +using osu.Game.Screens.Play.Pause; +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; +using osu.Game.Graphics; +using osu.Framework.Allocation; + +namespace osu.Game.Screens.Play +{ + public class InGameOverlay : OverlayContainer + { + private const int transition_duration = 200; + private const int button_height = 70; + private const float background_alpha = 0.75f; + + protected override bool HideOnEscape => false; + + public Action OnRetry; + public Action OnQuit; + + private string title; + private string description; + + public string Title + { + get { return title; } + set { title = value; } + } + + public string Description + { + get { return description; } + set { description = value; } + } + + private FillFlowContainer buttons; + + public int Retries + { + set + { + if (retryCounterContainer != null) + { + // "You've retried 1,065 times in this session" + // "You've retried 1 time in this session" + + retryCounterContainer.Children = new Drawable[] + { + new OsuSpriteText + { + Text = "You've retried ", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + }, + new OsuSpriteText + { + Text = $"{value:n0}", + Font = @"Exo2.0-Bold", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + }, + new OsuSpriteText + { + Text = $" time{(value == 1 ? "" : "s")} in this session", + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f), + TextSize = 18 + } + }; + } + } + } + + private FillFlowContainer retryCounterContainer; + + public override bool HandleInput => State == Visibility.Visible; + + protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In); + protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In); + + // Don't let mouse down events through the overlay or people can click circles while paused. + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + + protected override bool OnMouseMove(InputState state) => true; + + public void AddButton(string text, Color4 colour, Action action) + { + buttons.Add(new PauseButton + { + Text = text, + ButtonColour = colour, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Height = button_height, + Action = delegate { + action?.Invoke(); + Hide(); + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Alpha = background_alpha, + }, + new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 50), + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Children = new Drawable[] + { + new FillFlowContainer + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 20), + Children = new Drawable[] + { + new OsuSpriteText + { + Text = Title, + Font = @"Exo2.0-Medium", + Spacing = new Vector2(5, 0), + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + TextSize = 30, + Colour = colours.Yellow, + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f) + }, + new OsuSpriteText + { + Text = Description, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Shadow = true, + ShadowColour = new Color4(0, 0, 0, 0.25f) + } + } + }, + buttons = new FillFlowContainer + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.6f), + Radius = 50 + }, + }, + retryCounterContainer = new FillFlowContainer + { + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + AutoSizeAxes = Axes.Both, + } + } + }, + new PauseProgressBar + { + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + Width = 1f + } + }; + + Retries = 0; + + AddButtons(colours); + } + + protected virtual void AddButtons(OsuColour colours) + { + AddButton(@"Retry", colours.YellowDark, OnRetry); + AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); + } + + public InGameOverlay() + { + AlwaysReceiveInput = true; + RelativeSizeAxes = Axes.Both; + } + } +} diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index bad7050d7a..f359fc3a78 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -10,7 +10,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Play { - public class PauseOverlay : FailOverlay + public class PauseOverlay : InGameOverlay { public Action OnResume; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e3faa6544f..c049b810f0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -195,6 +195,7 @@ + From 91e18cc63e673e8bd865c811b892dc66cf9a2053 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 12:12:35 +0300 Subject: [PATCH 137/348] Fix usings --- osu.Game/Screens/Play/FailOverlay.cs | 11 ----------- osu.Game/Screens/Play/InGameOverlay.cs | 1 - 2 files changed, 12 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 9fa95b008e..906e25d14f 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -1,20 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; -using osu.Game.Graphics.Sprites; -using osu.Game.Screens.Play.Pause; -using OpenTK; -using OpenTK.Graphics; using OpenTK.Input; -using osu.Game.Graphics; -using osu.Framework.Allocation; namespace osu.Game.Screens.Play { diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index b4efe47399..ba2027b4d5 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -12,7 +12,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Screens.Play.Pause; using OpenTK; using OpenTK.Graphics; -using OpenTK.Input; using osu.Game.Graphics; using osu.Framework.Allocation; From 24a105704a1899ea61d3958b9aecf30791470c10 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 20:39:08 +0900 Subject: [PATCH 138/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 51737ec132..1ade9b9e6d 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 51737ec1320b4ea9dce4978f24e1d77a28f0a98e +Subproject commit 1ade9b9e6dc03cfad30f5d08865310babf67404f From 1c166bdf32da0d0741b367ac335788ccea5aaed5 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 28 Mar 2017 15:03:12 +0300 Subject: [PATCH 139/348] Edited pause visual test --- ...seOverlay.cs => TestCaseInGameOverlays.cs} | 30 +++++++++++++++++-- .../osu.Desktop.VisualTests.csproj | 6 ++-- 2 files changed, 29 insertions(+), 7 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCasePauseOverlay.cs => TestCaseInGameOverlays.cs} (51%) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs similarity index 51% rename from osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs rename to osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs index f6af0acaf8..e0512f4747 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs @@ -1,17 +1,19 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Screens.Testing; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { - internal class TestCasePauseOverlay : TestCase + internal class TestCaseInGameOverlays : TestCase { - public override string Description => @"Tests the pause overlay"; + public override string Description => @"Tests the pause and fail overlays"; private PauseOverlay pauseOverlay; + private FailOverlay failOverlay; private int retryCount; public override void Reset() @@ -27,12 +29,34 @@ namespace osu.Desktop.VisualTests.Tests Title = @"paused", Description = @"you're not going to do what i think you're going to do, are ya?", }); + Add(failOverlay = new FailOverlay + { + Depth = -1, + OnRetry = () => Logger.Log(@"Retry"), + OnQuit = () => Logger.Log(@"Quit"), + Title = @"failed", + Description = @"you're dead, try again?", + }); - AddButton("Pause", pauseOverlay.Show); + AddButton("Pause", delegate { + if(failOverlay.State == Visibility.Visible) + { + failOverlay.Hide(); + } + pauseOverlay.Show(); + }); + AddButton("Fail", delegate { + if (pauseOverlay.State == Visibility.Visible) + { + pauseOverlay.Hide(); + } + failOverlay.Show(); + }); AddButton("Add Retry", delegate { retryCount++; pauseOverlay.Retries = retryCount; + failOverlay.Retries = retryCount; }); retryCount = 0; diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index f1b4a99510..f52fea22c9 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -185,6 +185,7 @@ + @@ -202,7 +203,6 @@ - @@ -212,9 +212,7 @@ - - - + - + \ No newline at end of file From e518508f2d0e86a28dd466e01fcf08b0e49b811b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 09:11:07 +0900 Subject: [PATCH 147/348] Better life time ends. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 9 +++++---- .../Objects/Drawable/DrawableTaikoHitObject.cs | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index 56e2f329bf..504e3c7c19 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -83,16 +83,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable case ArmedState.Idle: break; case ArmedState.Miss: - bodyContainer.FadeOut(100); + FadeOut(100); + Expire(); break; case ArmedState.Hit: bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); - bodyContainer.FadeOut(600, EasingTypes.OutQuint); bodyContainer.MoveToY(-200, 250, EasingTypes.Out); - bodyContainer.Delay(250); - bodyContainer.MoveToY(0, 500, EasingTypes.In); + + FadeOut(600); + Expire(); break; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index c14dc6d7b0..5d6d669dc1 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -30,7 +30,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void LoadComplete() { LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; - LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; base.LoadComplete(); } From d74454141bc903aeb37de8404a076542cac8c16c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 09:12:21 +0900 Subject: [PATCH 148/348] Remove explicit life time end. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs | 2 -- osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 862b81c5dc..b5246321da 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -124,8 +124,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { base.LoadComplete(); - LifetimeEnd = double.MaxValue; - targetRing.Delay(HitObject.StartTime - Time.Current).ScaleTo(target_ring_scale, 600, EasingTypes.OutQuint); } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index c14dc6d7b0..5d6d669dc1 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -30,7 +30,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void LoadComplete() { LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; - LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; base.LoadComplete(); } From 2a018e708de0879934c118cef37130923cc9a00b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 09:36:07 +0900 Subject: [PATCH 149/348] Better life time end. --- .../Objects/Drawable/DrawableDrumRoll.cs | 11 +++++++++++ .../Objects/Drawable/DrawableTaikoHitObject.cs | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index 7915599c3e..b599fea57d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -35,6 +35,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable } } + protected override void LoadComplete() + { + base.LoadComplete(); + + // This is naive, however it's based on the reasoning that the hit target + // is further than mid point of the play field, so the time taken to scroll in should always + // be greater than the time taken to scroll out to the left of the screen. + // Thus, using PreEmpt here is enough for the drum roll to completely scroll out. + LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt; + } + protected override void CheckJudgement(bool userTriggered) { if (userTriggered) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 609fac70ea..8da05d8bed 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -30,7 +30,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void LoadComplete() { LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; - LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; base.LoadComplete(); } From 1b291ec1a1d1db0b95f8e12006dcfc6a394a982a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 09:38:24 +0900 Subject: [PATCH 150/348] Make drumroll body colour depending on completion. --- .../Objects/Drawable/DrawableDrumRoll.cs | 12 +++++++- .../Objects/Drawable/Pieces/CirclePiece.cs | 6 ++-- .../Drawable/Pieces/DrumRollCirclePiece.cs | 28 ++++++++++++++++++- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index b599fea57d..f1e2ecef7e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -13,6 +13,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { private readonly DrumRoll drumRoll; + private readonly DrumRollCirclePiece circle; + public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) { @@ -21,7 +23,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable RelativeSizeAxes = Axes.X; Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); - Add(new DrumRollCirclePiece(CreateCirclePiece())); + Add(circle = new DrumRollCirclePiece(CreateCirclePiece())); foreach (var tick in drumRoll.Ticks) { @@ -30,11 +32,19 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration) }; + newTick.OnJudgement += onTickJudgement; + AddNested(newTick); Add(newTick); } } + private void onTickJudgement(DrawableHitObject obj) + { + int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); + circle.Completion = (float)countHit / NestedHitObjects.Count(); + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index ec98feddae..2af469d05f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -36,9 +36,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces accentColour = value; innerBackground.Colour = AccentColour; - - triangles.ColourLight = AccentColour; - triangles.ColourDark = AccentColour.Darken(0.1f); + triangles.Colour = AccentColour; resetEdgeEffects(); } @@ -107,6 +105,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, + ColourLight = Color4.White, + ColourDark = Color4.White.Darken(0.1f) } } }, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs index 076ac5d03a..3be99ab161 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs @@ -1,9 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.MathUtils; using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces @@ -13,8 +16,30 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// public class DrumRollCirclePiece : Container { + private float completion; + /// + /// The amount of the drumroll that has been completed, as a percentage of the number + /// of ticks in the drumroll. This determines the internal colour of the drumroll. + /// + public float Completion + { + get { return completion; } + set + { + completion = MathHelper.Clamp(value, 0, 1); + + if (!IsLoaded) + return; + + circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1); + } + } + private readonly CirclePiece circle; + private Color4 baseColour; + private Color4 finalColour; + public DrumRollCirclePiece(CirclePiece piece) { RelativeSizeAxes = Axes.X; @@ -25,7 +50,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces [BackgroundDependencyLoader] private void load(OsuColour colours) { - circle.AccentColour = colours.YellowDark; + circle.AccentColour = baseColour = colours.YellowDark; + finalColour = colours.YellowDarker; } } } From ab97967237ae3fbe10fca376fa59a42892b070da Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 28 Mar 2017 21:03:34 +0900 Subject: [PATCH 151/348] Update references and framework. --- osu.Desktop.VisualTests/Benchmark.cs | 2 +- .../Tests/TestCaseBeatmapDetailArea.cs | 2 +- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 2 +- .../Tests/TestCaseChatDisplay.cs | 2 +- .../Tests/TestCaseDialogOverlay.cs | 2 +- .../Tests/TestCaseDrawings.cs | 2 +- .../Tests/TestCaseGamefield.cs | 2 +- .../Tests/TestCaseHitObjects.cs | 2 +- .../Tests/TestCaseKeyCounter.cs | 2 +- .../Tests/TestCaseLeaderboard.cs | 2 +- .../Tests/TestCaseMenuButtonSystem.cs | 2 +- .../Tests/TestCaseModSelectOverlay.cs | 2 +- .../Tests/TestCaseMusicController.cs | 2 +- .../Tests/TestCaseNotificationManager.cs | 2 +- .../Tests/TestCaseOptions.cs | 2 +- .../Tests/TestCasePauseOverlay.cs | 2 +- .../Tests/TestCasePlaySongSelect.cs | 2 +- .../Tests/TestCasePlayer.cs | 2 +- .../Tests/TestCaseScoreCounter.cs | 2 +- .../Tests/TestCaseTabControl.cs | 2 +- .../Tests/TestCaseTaikoHitObjects.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- .../Tests/TestCaseTextAwesome.cs | 2 +- .../Tests/TestCaseTwoLayerButton.cs | 2 +- osu.Desktop.VisualTests/VisualTestGame.cs | 2 +- .../osu.Desktop.VisualTests.csproj | 8 +++++--- osu.Game/Screens/Menu/MainMenu.cs | 2 -- osu.sln | 19 ++++++++++++++----- 28 files changed, 44 insertions(+), 35 deletions(-) diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs index 0a15b38fc2..884dff9f7a 100644 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ b/osu.Desktop.VisualTests/Benchmark.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game; namespace osu.Desktop.VisualTests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs index bb7df19202..e755924a15 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -3,7 +3,7 @@ using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Screens.Select; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index a13f6005bf..3fc6ce10e7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -3,7 +3,7 @@ using OpenTK.Graphics; using OpenTK.Input; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Screens.Select.Options; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 08765a9b0f..2cb63ba7a0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; using osu.Game.Overlays; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index c9edcb8a54..3ae5929ecc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index 00e41de254..a0463516de 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; using osu.Game.Users; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index e876c21a12..3129cade63 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -5,7 +5,7 @@ using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Database; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 2a20cad2db..8818240b2d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 83ad49fcd2..051db489e9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Graphics; using OpenTK.Input; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index 329d5c5687..c985375873 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -3,7 +3,7 @@ using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Modes.Mods; using osu.Game.Modes.Osu.Mods; using osu.Game.Modes.Scoring; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index 36dc3945e2..ddb62598cf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Menu; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index eaaa531691..73f8ed6242 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics; using osu.Game.Overlays.Mods; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Modes; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index f44f662321..305aa24252 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Framework.Timing; using osu.Game.Overlays; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 13f89153e9..990052012f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Overlays; using System.Linq; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs index 1b4ecd726a..ff6bdc8a5a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index ad8039bc66..09e2dc38aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Logging; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index c97ea929f3..16f7881dcd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using osu.Desktop.VisualTests.Platform; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.MathUtils; using osu.Game.Database; using osu.Game.Modes; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index a08cb3e97e..f36889b02a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Beatmaps; using OpenTK; using osu.Framework.Graphics.Sprites; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index be313efed3..cca87cd12b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Modes.UI; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index da807d5e53..23e7f8a74d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -3,7 +3,7 @@ using OpenTK; using osu.Framework.Graphics.Primitives; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index edd9c74485..e406fe3a60 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 395a0cab13..5a988c54e1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.MathUtils; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index 3ba657d60a..7182ee7c06 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index 4694a6c6ea..2427b6d12c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index c41bdeef66..bdce72b3f5 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Platform; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game; using osu.Game.Screens.Backgrounds; diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index f1b4a99510..9f3cd6b3c4 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -150,6 +150,10 @@ {65dc628f-a640-4111-ab35-3a5652bc1e17} osu.Framework.Desktop + + {007b2356-ab6f-4bd9-96d5-116fc2dce69a} + osu.Framework.Testing + {c76bf5b3-985e-4d39-95fe-97c9c879b83a} osu.Framework @@ -212,9 +216,7 @@ - - - + - + \ No newline at end of file From 982fcbbf5334583f4b94b8110af4ac5892f7d269 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 15:20:20 +0900 Subject: [PATCH 168/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 4d131fd0d9..54830759f8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4d131fd0d997bee313de3fa33a45900637570ff0 +Subproject commit 54830759f8a9a248585684de6faf3d9f1976b335 From 7ba7bc18f8468aeba9c6875f15eded270954f363 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 15:35:22 +0900 Subject: [PATCH 169/348] Don't use a List for HitKeys. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 1 - osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs | 3 +-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 4 ++-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs | 3 +-- .../Objects/Drawable/DrawableStrongCentreHit.cs | 3 +-- osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs | 3 +-- 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 94f09e12a6..5d6ab9bd1a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -6,7 +6,6 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index a3fcf26f6d..683d48df10 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -1,7 +1,6 @@ // 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 OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Game.Graphics; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableCentreHit : DrawableHit { - protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + protected override Key[] HitKeys { get; } = { Key.F, Key.J }; private readonly CirclePiece circlePiece; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index 94c5f63deb..ae328fe9ca 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using System; -using System.Collections.Generic; +using System.Linq; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -16,7 +16,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// /// A list of keys which can result in hits for this HitObject. /// - protected abstract List HitKeys { get; } + protected abstract Key[] HitKeys { get; } protected override Container Content => bodyContainer; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs index 029cdfb7e7..cab6819300 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -1,7 +1,6 @@ // 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 osu.Framework.Allocation; using osu.Game.Graphics; using OpenTK.Input; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableRimHit : DrawableHit { - protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + protected override Key[] HitKeys { get; } = { Key.D, Key.K }; private readonly CirclePiece circlePiece; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index 7b21924868..b4ec0b108a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -1,7 +1,6 @@ // 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 OpenTK.Input; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Framework.Allocation; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableStrongCentreHit : DrawableStrongHit { - protected override List HitKeys { get; } = new List(new[] { Key.F, Key.J }); + protected override Key[] HitKeys { get; } = { Key.F, Key.J }; private readonly CirclePiece circlePiece; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs index 74d8cdfd49..1f77ad0409 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -1,7 +1,6 @@ // 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 osu.Framework.Allocation; using osu.Game.Graphics; using OpenTK.Input; @@ -11,7 +10,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableStrongRimHit : DrawableStrongHit { - protected override List HitKeys { get; } = new List(new[] { Key.D, Key.K }); + protected override Key[] HitKeys { get; } = { Key.D, Key.K }; private readonly CirclePiece circlePiece; From 3d2c8f19ae0a13c9f85c4994bf8095d52115ea3d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 15:59:12 +0900 Subject: [PATCH 170/348] Make Swells require alternating key hits. --- .../Objects/Drawable/DrawableSwell.cs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 291e1df837..d1a9760691 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -14,6 +14,7 @@ using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using System; +using System.Linq; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -30,11 +31,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private const float target_ring_scale = 5f; private const float inner_ring_alpha = 0.35f; - /// - /// The amount of times the user has hit this swell. - /// - private int userHits; - private readonly Swell swell; private readonly Container bodyContainer; @@ -43,6 +39,15 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private readonly CirclePiece circlePiece; + private readonly Key[] rimKeys = { Key.D, Key.K }; + private readonly Key[] centreKeys = { Key.F, Key.J }; + private Key[] lastKeySet; + + /// + /// The amount of times the user has hit this swell. + /// + private int userHits; + private bool hasStarted; public DrawableSwell(Swell swell) @@ -206,6 +211,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (Judgement.Result.HasValue) return false; + // Find the keyset which this key corresponds to + var keySet = rimKeys.Contains(key) ? rimKeys : centreKeys; + + // Ensure alternating keysets + if (keySet == lastKeySet) + return false; + lastKeySet = keySet; + UpdateJudgement(true); return true; From 1b3e908565161f814ba884d3c66bf0ac19848592 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 16:02:12 +0900 Subject: [PATCH 171/348] Fix notelocking by pressing a key before the swell's start time. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index d1a9760691..0462880f3e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -138,9 +138,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { if (userTriggered) { - if (Time.Current < HitObject.StartTime) - return; - userHits++; innerRing.FadeTo(1); @@ -211,6 +208,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable if (Judgement.Result.HasValue) return false; + // Don't handle keys before the swell starts + if (Time.Current < HitObject.StartTime) + return false; + // Find the keyset which this key corresponds to var keySet = rimKeys.Contains(key) ? rimKeys : centreKeys; From c5f9c4cac95ed4e70d7f844651fcffaef3f1deeb Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 16:20:54 +0900 Subject: [PATCH 172/348] Fix possible nullref. --- osu.Game.Modes.Taiko/TaikoAutoReplay.cs | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/osu.Game.Modes.Taiko/TaikoAutoReplay.cs b/osu.Game.Modes.Taiko/TaikoAutoReplay.cs index ba121e0968..04f634be05 100644 --- a/osu.Game.Modes.Taiko/TaikoAutoReplay.cs +++ b/osu.Game.Modes.Taiko/TaikoAutoReplay.cs @@ -4,6 +4,7 @@ using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Objects.Types; using osu.Game.Beatmaps; +using System; namespace osu.Game.Modes.Taiko { @@ -34,13 +35,16 @@ namespace osu.Game.Modes.Taiko IHasEndTime endTimeData = h as IHasEndTime; double endTime = endTimeData?.EndTime ?? h.StartTime; - Swell sp = h as Swell; - if (sp != null) + Swell swell = h as Swell; + DrumRoll drumRoll = h as DrumRoll; + Hit hit = h as Hit; + + if (swell != null) { int d = 0; int count = 0; - int req = sp.RequiredHits; - double hitRate = sp.Duration / req; + int req = swell.RequiredHits; + double hitRate = swell.Duration / req; for (double j = h.StartTime; j < endTime; j += hitRate) { switch (d) @@ -65,25 +69,21 @@ namespace osu.Game.Modes.Taiko break; } } - else if (h is DrumRoll) + else if (drumRoll != null) { - DrumRoll d = h as DrumRoll; + double delay = drumRoll.TickTimeDistance; - double delay = d.TickTimeDistance; + double time = drumRoll.StartTime; - double time = d.StartTime; - - for (int j = 0; j < d.TotalTicks; j++) + for (int j = 0; j < drumRoll.TotalTicks; j++) { Frames.Add(new LegacyReplayFrame((int)time, 0, 0, hitButton ? LegacyButtonState.Left1 : LegacyButtonState.Left2)); time += delay; hitButton = !hitButton; } } - else + else if (hit != null) { - Hit hit = h as Hit; - if (hit.Type == HitType.Centre) { if (h.IsStrong) @@ -101,6 +101,8 @@ namespace osu.Game.Modes.Taiko Frames.Add(new LegacyReplayFrame(h.StartTime, 0, 0, button)); } + else + throw new Exception("Unknown hit object type."); Frames.Add(new LegacyReplayFrame(endTime + 1, 0, 0, LegacyButtonState.None)); @@ -113,9 +115,6 @@ namespace osu.Game.Modes.Taiko hitButton = !hitButton; } - - //Player.currentScore.Replay = InputManager.ReplayScore.Replay; - //Player.currentScore.PlayerName = "mekkadosu!"; } } } \ No newline at end of file From 2967000839b83f5e045c143ba307a0fda8978184 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 16:22:08 +0900 Subject: [PATCH 173/348] Taiko autoplay username :D. --- osu.Game.Modes.Taiko/Mods/TaikoMod.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Modes.Taiko/Mods/TaikoMod.cs b/osu.Game.Modes.Taiko/Mods/TaikoMod.cs index 007187d81b..79370f58ee 100644 --- a/osu.Game.Modes.Taiko/Mods/TaikoMod.cs +++ b/osu.Game.Modes.Taiko/Mods/TaikoMod.cs @@ -5,6 +5,7 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Mods; using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Users; namespace osu.Game.Modes.Taiko.Mods { @@ -69,6 +70,7 @@ namespace osu.Game.Modes.Taiko.Mods { protected override Score CreateReplayScore(Beatmap beatmap) => new Score { + User = new User { Username = "mekkadosu!" }, Replay = new TaikoAutoReplay(beatmap) }; } From bae0ac490124fe2d6c96a71d9796e07a03f4f25d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 18:21:45 +0900 Subject: [PATCH 174/348] Fix missing base call that may result in invalid ScoreProcessor state. --- osu.Game/Modes/Scoring/ScoreProcessor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Modes/Scoring/ScoreProcessor.cs index f14b306e18..393d651dbf 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Modes/Scoring/ScoreProcessor.cs @@ -152,6 +152,8 @@ namespace osu.Game.Modes.Scoring protected override void Reset() { + base.Reset(); + Judgements.Clear(); } From 305003997279cc9a17797487943afb702c61e995 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 17:57:36 +0900 Subject: [PATCH 175/348] Implement partial judgements + make Result non-nullable. --- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawable/DrawableDrumRollTick.cs | 2 +- .../Objects/Drawable/DrawableHit.cs | 2 +- .../Objects/Drawable/DrawableStrongHit.cs | 5 ++-- .../Objects/Drawable/DrawableSwell.cs | 2 +- .../Modes/Judgements/IPartialJudgement.cs | 26 +++++++++++++++++++ osu.Game/Modes/Judgements/Judgement.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 19 +++++++++++--- osu.Game/Modes/Objects/Drawables/HitResult.cs | 11 ++++++++ osu.Game/Modes/UI/HitRenderer.cs | 2 +- osu.Game/osu.Game.csproj | 1 + 11 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Modes/Judgements/IPartialJudgement.cs diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index dcc25a997a..68c5ec0a45 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -38,7 +38,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Colour = AccentColour, Hit = () => { - if (Judgement.Result.HasValue) return false; + if (Judgement.Result != HitResult.None) return false; Judgement.PositionOffset = Vector2.Zero; //todo: set to correct value UpdateJudgement(true); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs index 1e270c6751..5217fd9085 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs @@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override bool HandleKeyPress(Key key) { - return !Judgement.Result.HasValue && UpdateJudgement(true); + return Judgement.Result == HitResult.None && UpdateJudgement(true); } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index ae328fe9ca..c8a7355e3c 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -68,7 +68,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override bool HandleKeyPress(Key key) { - if (Judgement.Result.HasValue) + if (Judgement.Result != HitResult.None) return false; validKeyPressed = HitKeys.Contains(key); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs index 5e225e1dce..a77fd1d6be 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs @@ -5,6 +5,7 @@ using OpenTK.Input; using System; using System.Linq; using osu.Framework.Input; +using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -27,7 +28,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void CheckJudgement(bool userTriggered) { - if (!Judgement.Result.HasValue) + if (Judgement.Result == HitResult.None) { base.CheckJudgement(userTriggered); return; @@ -45,7 +46,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override bool HandleKeyPress(Key key) { // Check if we've handled the first key - if (!Judgement.Result.HasValue) + if (Judgement.Result == HitResult.None) { // First key hasn't been handled yet, attempt to handle it bool handled = base.HandleKeyPress(key); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 15584ac73f..22fa4dea6f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -64,7 +64,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override bool HandleKeyPress(Key key) { - if (Judgement.Result.HasValue) + if (Judgement.Result != HitResult.None) return false; UpdateJudgement(true); diff --git a/osu.Game/Modes/Judgements/IPartialJudgement.cs b/osu.Game/Modes/Judgements/IPartialJudgement.cs new file mode 100644 index 0000000000..2ca1ffce4d --- /dev/null +++ b/osu.Game/Modes/Judgements/IPartialJudgement.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Scoring; + +namespace osu.Game.Modes.Judgements +{ + /// + /// Inidicates that the judgement this is attached to is a partial judgement and the scoring value may change. + /// + /// This judgement will be continually processed by + /// unless the result is a miss and will trigger a full re-process of the when changed. + /// + /// + public interface IPartialJudgement + { + /// + /// Indicates that this partial judgement has changed and requires a full re-process of the . + /// + /// This is set to false once the judgement has been re-processed. + /// + /// + bool Changed { get; set; } + } +} diff --git a/osu.Game/Modes/Judgements/Judgement.cs b/osu.Game/Modes/Judgements/Judgement.cs index d916fc15de..5b1e4ddac6 100644 --- a/osu.Game/Modes/Judgements/Judgement.cs +++ b/osu.Game/Modes/Judgements/Judgement.cs @@ -10,7 +10,7 @@ namespace osu.Game.Modes.Judgements /// /// Whether this judgement is the result of a hit or a miss. /// - public HitResult? Result; + public HitResult Result; /// /// The offset at which this judgement occurred. diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 3998a3e385..2939980ac6 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -93,16 +93,26 @@ namespace osu.Game.Modes.Objects.Drawables /// Whether a hit was processed. protected bool UpdateJudgement(bool userTriggered) { - if (Judgement.Result != null) + IPartialJudgement partial = Judgement as IPartialJudgement; + + // Never re-process non-partial hits, or partial judgements that were previously judged as misses + if (Judgement.Result != HitResult.None && (partial == null || Judgement.Result == HitResult.Miss)) return false; + // Update the judgement state double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; - Judgement.TimeOffset = Time.Current - endTime; + // Update the judgement state + bool hadResult = Judgement.Result != HitResult.None; CheckJudgement(userTriggered); - if (Judgement.Result == null) + // Don't process judgements with no result + if (Judgement.Result == HitResult.None) + return false; + + // Don't process judgements that previously had results but the results were unchanged + if (hadResult && partial?.Changed != true) return false; switch (Judgement.Result) @@ -117,6 +127,9 @@ namespace osu.Game.Modes.Objects.Drawables OnJudgement?.Invoke(this); + if (partial != null) + partial.Changed = false; + return true; } diff --git a/osu.Game/Modes/Objects/Drawables/HitResult.cs b/osu.Game/Modes/Objects/Drawables/HitResult.cs index 1bbf9269bb..e036610ae2 100644 --- a/osu.Game/Modes/Objects/Drawables/HitResult.cs +++ b/osu.Game/Modes/Objects/Drawables/HitResult.cs @@ -7,8 +7,19 @@ namespace osu.Game.Modes.Objects.Drawables { public enum HitResult { + /// + /// Indicates that the object has not been judged yet. + /// + [Description("")] + None, + /// + /// Indicates that the object has been judged as a miss. + /// [Description(@"Miss")] Miss, + /// + /// Indicates that the object has been judged as a hit. + /// [Description(@"Hit")] Hit, } diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 3d108b895d..1681da2ba9 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -149,7 +149,7 @@ namespace osu.Game.Modes.UI public event Action OnJudgement; protected override Container Content => content; - protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result.HasValue); + protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None); /// /// The playfield. diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a5bdf1df69..fcb45f91fd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -97,6 +97,7 @@ + From c0dae89844d603fb6bd486f76d3a2235bafefbe1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 29 Mar 2017 18:16:26 +0900 Subject: [PATCH 176/348] Implement partial strong hit judgements. --- .../Judgements/TaikoJudgement.cs | 6 ++--- .../Judgements/TaikoStrongHitJudgement.cs | 25 +++++++++++++++++++ .../Objects/Drawable/DrawableStrongHit.cs | 3 +++ .../osu.Game.Modes.Taiko.csproj | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs index e50a685e24..f4745730db 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs @@ -22,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Judgements /// The result value for the combo portion of the score. /// public int ResultValueForScore => NumericResultForScore(TaikoResult); - + /// /// The result value for the accuracy portion of the score. /// @@ -32,7 +32,7 @@ namespace osu.Game.Modes.Taiko.Judgements /// 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. /// @@ -45,7 +45,7 @@ namespace osu.Game.Modes.Taiko.Judgements /// /// Whether this Judgement has a secondary hit in the case of finishers. /// - public bool SecondHit; + public virtual bool SecondHit { get; set; } /// /// Computes the numeric result value for the combo portion of the score. diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs b/osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs new file mode 100644 index 0000000000..ee978d0026 --- /dev/null +++ b/osu.Game.Modes.Taiko/Judgements/TaikoStrongHitJudgement.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Judgements; + +namespace osu.Game.Modes.Taiko.Judgements +{ + public class TaikoStrongHitJudgement : TaikoJudgement, IPartialJudgement + { + public bool Changed { get; set; } + + public override bool SecondHit + { + get { return base.SecondHit; } + set + { + if (base.SecondHit == value) + return; + base.SecondHit = value; + + Changed = true; + } + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs index a77fd1d6be..a6cb6ae7fa 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs @@ -6,6 +6,7 @@ using System; using System.Linq; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; namespace osu.Game.Modes.Taiko.Objects.Drawable { @@ -26,6 +27,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { } + protected override TaikoJudgement CreateJudgement() => new TaikoStrongHitJudgement(); + protected override void CheckJudgement(bool userTriggered) { if (Judgement.Result == HitResult.None) diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 07f9a5d4e6..60fe8cb51f 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,6 +50,7 @@ + From fa7fd6efe30a738675bfd438da53a989a6284caa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Mar 2017 19:47:53 +0900 Subject: [PATCH 177/348] Fix mode selector not invoking a re-filter. --- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs | 5 ++--- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 ++- osu.Game/Screens/Select/FilterControl.cs | 1 + osu.Game/Screens/Select/SongSelect.cs | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index fdcc250d0f..66196670b8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -199,7 +199,7 @@ namespace osu.Game { Depth = -3, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, - OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; }, + OnPlayModeChange = m => PlayMode.Value = m, }).LoadAsync(this, t => { PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index be28857de6..d20564bd03 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -65,14 +65,13 @@ namespace osu.Game.Overlays.Toolbar foreach (PlayMode m in Ruleset.PlayModes) { - var localMode = m; modeButtons.Add(new ToolbarModeButton { Mode = m, Action = delegate { - SetGameMode(localMode); - OnPlayModeChange?.Invoke(localMode); + SetGameMode(m); + OnPlayModeChange?.Invoke(m); } }); } diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index e947d12f22..24251439ce 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -181,7 +181,8 @@ namespace osu.Game.Screens.Select { if (!IsLoaded) return; - criteria = newCriteria ?? criteria ?? new FilterCriteria(); + if (newCriteria != null) + criteria = newCriteria; Action perform = delegate { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index d6537ca0d6..5445847da5 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -175,6 +175,7 @@ namespace osu.Game.Screens.Select if (osu != null) playMode.BindTo(osu.PlayMode); + playMode.ValueChanged += (s, e) => FilterChanged?.Invoke(CreateCriteria()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6eb26d22cb..656adf0d62 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -276,7 +276,7 @@ namespace osu.Game.Screens.Select initialAddSetsTask.Cancel(); } - private void playMode_ValueChanged(object sender, EventArgs e) => carousel.Filter(); + private void playMode_ValueChanged(object sender, EventArgs e) => Beatmap.PreferredPlayMode = playMode; private void changeBackground(WorkingBeatmap beatmap) { From a6c8be363782605543f9bcdfbbeed3ef33316e23 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Mar 2017 19:52:16 +0900 Subject: [PATCH 178/348] Increase load delay on panel backgrounds; add back missing fade. --- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index f8986b2ecd..e26dcac16b 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -36,7 +36,8 @@ namespace osu.Game.Beatmaps.Drawables new DelayedLoadContainer { RelativeSizeAxes = Axes.Both, - TimeBeforeLoad = 100, + TimeBeforeLoad = 300, + FinishedLoading = d => d.FadeInFromZero(400, EasingTypes.Out), Children = new[] { new PanelBackground(beatmap) From 6afa6f30cc19ac5bce67428eaa548346e2425675 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 29 Mar 2017 20:01:46 +0900 Subject: [PATCH 179/348] Keep selected beatmap in centre of screen post-filter. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 24251439ce..7443603c8b 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -203,6 +203,8 @@ namespace osu.Game.Screens.Select if (selectedGroup == null || selectedGroup.State == BeatmapGroupState.Hidden) SelectNext(); + else + selectGroup(selectedGroup); }; filterTask?.Cancel(); From c2d6faa7c25a1e22640fb50b3f10e9fe5e595537 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 10:34:37 +0900 Subject: [PATCH 180/348] Change Judgements into HashSet to prevent duplicates. --- osu.Game/Modes/Scoring/ScoreProcessor.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Modes/Scoring/ScoreProcessor.cs index f14b306e18..b24ab090b3 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Modes/Scoring/ScoreProcessor.cs @@ -110,7 +110,7 @@ namespace osu.Game.Modes.Scoring /// /// All judgements held by this ScoreProcessor. /// - protected readonly List Judgements = new List(); + protected readonly HashSet Judgements = new HashSet(); public override bool HasFailed => Health.Value == Health.MinValue; @@ -120,8 +120,6 @@ namespace osu.Game.Modes.Scoring protected ScoreProcessor(HitRenderer hitRenderer) { - Judgements.Capacity = hitRenderer.Beatmap.HitObjects.Count; - hitRenderer.OnJudgement += AddJudgement; ComputeTargets(hitRenderer.Beatmap); From 6287ba321da555faf353d801a855179ac58fc8ce Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 10:51:14 +0900 Subject: [PATCH 181/348] Rewrite ScoreProcessor to have a new method for when existing judgements are changed. - OnNewJudgement: Keeps its previous functionality. It is now only invoked when a _new_ judgement has been added to the Judgements hashset. - OnJudgementChanged: Has a similar funcitonality to OnNewJudgement, but is only invoked whenever a judgement that was _previously_ in the Judgements hashset is changed. --- .../Tests/TestCaseTaikoPlayfield.cs | 4 +- .../Scoring/CatchScoreProcessor.cs | 2 +- .../Scoring/ManiaScoreProcessor.cs | 2 +- .../Scoring/OsuScoreProcessor.cs | 2 +- .../Scoring/TaikoScoreProcessor.cs | 79 ++++++++++++------- osu.Game/Modes/Judgements/Judgement.cs | 2 +- osu.Game/Modes/Scoring/ScoreProcessor.cs | 28 +++++-- 7 files changed, 75 insertions(+), 44 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index a6491bd07b..ca4fee1b4d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -55,7 +55,6 @@ namespace osu.Desktop.VisualTests.Tests Result = HitResult.Hit, TaikoResult = hitResult, TimeOffset = 0, - ComboAtHit = 1, SecondHit = RNG.Next(10) == 0 } }); @@ -68,8 +67,7 @@ namespace osu.Desktop.VisualTests.Tests Judgement = new TaikoJudgement { Result = HitResult.Miss, - TimeOffset = 0, - ComboAtHit = 0 + TimeOffset = 0 } }); } diff --git a/osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs index 766a492bf4..1b9bedf7fb 100644 --- a/osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Modes.Catch/Scoring/CatchScoreProcessor.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Catch.Scoring { } - protected override void OnNewJugement(CatchJudgement judgement) + protected override void OnNewJudgement(CatchJudgement judgement) { } } diff --git a/osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs index c6b223af6d..0f87030e25 100644 --- a/osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Modes.Mania/Scoring/ManiaScoreProcessor.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Mania.Scoring { } - protected override void OnNewJugement(ManiaJudgement judgement) + protected override void OnNewJudgement(ManiaJudgement judgement) { } } diff --git a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs index b71e7dbadd..0bd587e8ea 100644 --- a/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Modes.Osu/Scoring/OsuScoreProcessor.cs @@ -28,7 +28,7 @@ namespace osu.Game.Modes.Osu.Scoring Accuracy.Value = 1; } - protected override void OnNewJugement(OsuJudgement judgement) + protected override void OnNewJudgement(OsuJudgement judgement) { if (judgement != null) { diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index 2ab31c5efb..fa7e18cadb 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -96,9 +96,9 @@ namespace osu.Game.Modes.Taiko.Scoring /// /// The multiple of the original score added to the combo portion of the score - /// for correctly hitting an accented hit object with both keys. + /// for correctly hitting a strong hit object with both keys. /// - private double accentedHitScale; + private double strongHitScale; private double hpIncreaseTick; private double hpIncreaseGreat; @@ -128,12 +128,12 @@ namespace osu.Game.Modes.Taiko.Scoring hpIncreaseGood = hpMultiplierNormal * hp_hit_good; hpIncreaseMiss = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, hp_miss_min, hp_miss_mid, hp_miss_max); - var accentedHits = beatmap.HitObjects.FindAll(o => o is Hit && o.IsStrong); + var strongHits = beatmap.HitObjects.FindAll(o => o is Hit && o.IsStrong); // This is a linear function that awards: - // 10 times bonus points for hitting an accented hit object with both keys with 30 accented hit objects in the map - // 3 times bonus points for hitting an accented hit object with both keys with 120 accented hit objects in the map - accentedHitScale = -7d / 90d * MathHelper.Clamp(accentedHits.Count, 30, 120) + 111d / 9d; + // 10 times bonus points for hitting a strong hit object with both keys with 30 strong hit objects in the map + // 3 times bonus points for hitting a strong hit object with both keys with 120 strong hit objects in the map + strongHitScale = -7d / 90d * MathHelper.Clamp(strongHits.Count, 30, 120) + 111d / 9d; foreach (var obj in beatmap.HitObjects) { @@ -179,7 +179,7 @@ namespace osu.Game.Modes.Taiko.Scoring maxComboPortion = comboPortion; } - protected override void OnNewJugement(TaikoJudgement judgement) + protected override void OnNewJudgement(TaikoJudgement judgement) { bool isTick = judgement is TaikoDrumRollTickJudgement; @@ -187,29 +187,12 @@ namespace osu.Game.Modes.Taiko.Scoring if (!isTick) totalHits++; + // Apply combo changes, must be done before the hit score is added + if (!isTick && judgement.Result == HitResult.Hit) + Combo.Value++; + // Apply score changes - if (judgement.Result == HitResult.Hit) - { - double baseValue = judgement.ResultValueForScore; - - // Add bonus points for hitting an accented hit object with the second key - if (judgement.SecondHit) - baseValue += baseValue * accentedHitScale; - - // Add score to portions - if (isTick) - bonusScore += baseValue; - else - { - Combo.Value++; - - // A relevance factor that needs to be applied to make higher combos more relevant - // Value is capped at 400 combo - double comboRelevance = Math.Min(Math.Log(400, combo_base), Math.Max(0.5, Math.Log(Combo.Value, combo_base))); - - comboPortion += baseValue * comboRelevance; - } - } + addHitScore(judgement); // Apply HP changes switch (judgement.Result) @@ -235,7 +218,43 @@ namespace osu.Game.Modes.Taiko.Scoring break; } - // Compute the new score + accuracy + calculateScore(); + } + + protected override void OnJudgementChanged(TaikoJudgement judgement) + { + // Apply score changes + addHitScore(judgement); + + calculateScore(); + } + + private void addHitScore(TaikoJudgement judgement) + { + if (judgement.Result != HitResult.Hit) + return; + + double baseValue = judgement.ResultValueForScore; + + // Add increased score for hitting a strong hit object with the second key + if (judgement.SecondHit) + baseValue *= strongHitScale; + + // Add score to portions + if (judgement is TaikoDrumRollTickJudgement) + bonusScore += baseValue; + else + { + // A relevance factor that needs to be applied to make higher combos more relevant + // Value is capped at 400 combo + double comboRelevance = Math.Min(Math.Log(400, combo_base), Math.Max(0.5, Math.Log(Combo.Value, combo_base))); + + comboPortion += baseValue * comboRelevance; + } + } + + private void calculateScore() + { int scoreForAccuracy = 0; int maxScoreForAccuracy = 0; diff --git a/osu.Game/Modes/Judgements/Judgement.cs b/osu.Game/Modes/Judgements/Judgement.cs index 5b1e4ddac6..677ec8bca9 100644 --- a/osu.Game/Modes/Judgements/Judgement.cs +++ b/osu.Game/Modes/Judgements/Judgement.cs @@ -20,7 +20,7 @@ namespace osu.Game.Modes.Judgements /// /// The combo after this judgement was processed. /// - public ulong? ComboAtHit; + public int ComboAtHit; /// /// The string representation for the result achieved. diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Modes/Scoring/ScoreProcessor.cs index b24ab090b3..4e902596ce 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Modes/Scoring/ScoreProcessor.cs @@ -139,11 +139,13 @@ namespace osu.Game.Modes.Scoring /// The judgement to add. protected void AddJudgement(TJudgement judgement) { - Judgements.Add(judgement); - - OnNewJugement(judgement); - - judgement.ComboAtHit = (ulong)Combo.Value; + if (Judgements.Add(judgement)) + { + OnNewJudgement(judgement); + judgement.ComboAtHit = Combo.Value; + } + else + OnJudgementChanged(judgement); UpdateFailed(); } @@ -154,9 +156,21 @@ namespace osu.Game.Modes.Scoring } /// - /// Update any values that potentially need post-processing on a judgement change. + /// Updates any values that need post-processing. Invoked when a new judgement has occurred. + /// + /// This is not triggered when existing judgements are changed - for that see . + /// /// /// The judgement that triggered this calculation. - protected abstract void OnNewJugement(TJudgement judgement); + protected abstract void OnNewJudgement(TJudgement judgement); + + /// + /// Updates any values that need post-processing. Invoked when an existing judgement has changed. + /// + /// This is not triggered when a new judgement has occurred - for that see . + /// + /// + /// The judgement that triggered this calculation. + protected virtual void OnJudgementChanged(TJudgement judgement) { } } } \ No newline at end of file From 71baf916d159634f6af4c741c3dd491eb8a64365 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 14:15:42 +0900 Subject: [PATCH 182/348] Fix post-merge errors. --- .../Tests/TestCaseTaikoHitObjects.cs | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 4b6302b489..cd79beadb1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -133,66 +133,6 @@ namespace osu.Desktop.VisualTests.Tests } } - private class CentreHitCircle : BaseCircle - { - public CentreHitCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_INNER_SIZE), - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.PinkDarker; - } - } - - private class RimHitCircle : BaseCircle - { - public RimHitCircle(CirclePiece piece) - : base(piece) - { - Piece.Add(new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(SYMBOL_SIZE), - BorderThickness = SYMBOL_BORDER, - BorderColour = Color4.White, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } - } - }); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Piece.AccentColour = colours.BlueDarker; - } - } - private abstract class BaseCircle : Container { protected readonly CirclePiece Piece; From cf4d11c51c3d71abcdcd48798a3b19ad6437aada Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 15:51:16 +0900 Subject: [PATCH 183/348] Add explicit CentreHit/RimHit classes. --- .../Beatmaps/TaikoBeatmapConverter.cs | 15 ++++++++++++--- .../Objects/{HitType.cs => CentreHit.cs} | 7 +------ osu.Game.Modes.Taiko/Objects/Hit.cs | 5 ----- osu.Game.Modes.Taiko/Objects/RimHit.cs | 9 +++++++++ osu.Game.Modes.Taiko/TaikoAutoReplay.cs | 2 +- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 3 ++- 6 files changed, 25 insertions(+), 16 deletions(-) rename osu.Game.Modes.Taiko/Objects/{HitType.cs => CentreHit.cs} (55%) create mode 100644 osu.Game.Modes.Taiko/Objects/RimHit.cs diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index aa095a1dda..cc361628a3 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -74,14 +74,23 @@ namespace osu.Game.Modes.Taiko.Beatmaps }; } - HitType type = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0 ? HitType.Centre : HitType.Rim; + bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0; - return new Hit + if (isCentre) + { + return new CentreHit + { + StartTime = original.StartTime, + Sample = original.Sample, + IsStrong = strong + }; + } + + return new RimHit { StartTime = original.StartTime, Sample = original.Sample, IsStrong = strong, - Type = type }; } } diff --git a/osu.Game.Modes.Taiko/Objects/HitType.cs b/osu.Game.Modes.Taiko/Objects/CentreHit.cs similarity index 55% rename from osu.Game.Modes.Taiko/Objects/HitType.cs rename to osu.Game.Modes.Taiko/Objects/CentreHit.cs index 6e8e147d75..258112f045 100644 --- a/osu.Game.Modes.Taiko/Objects/HitType.cs +++ b/osu.Game.Modes.Taiko/Objects/CentreHit.cs @@ -3,12 +3,7 @@ namespace osu.Game.Modes.Taiko.Objects { - /// - /// Describes whether a hit is a centre-hit or a rim-hit. - /// - public enum HitType + public class CentreHit : Hit { - Centre, - Rim } } diff --git a/osu.Game.Modes.Taiko/Objects/Hit.cs b/osu.Game.Modes.Taiko/Objects/Hit.cs index 0ba07028fd..ad8d07d901 100644 --- a/osu.Game.Modes.Taiko/Objects/Hit.cs +++ b/osu.Game.Modes.Taiko/Objects/Hit.cs @@ -8,11 +8,6 @@ namespace osu.Game.Modes.Taiko.Objects { public class Hit : TaikoHitObject { - /// - /// Whether this hit is a centre-hit or a rim-hit. - /// - public HitType Type; - /// /// The hit window that results in a "GREAT" hit. /// diff --git a/osu.Game.Modes.Taiko/Objects/RimHit.cs b/osu.Game.Modes.Taiko/Objects/RimHit.cs new file mode 100644 index 0000000000..aae93ec10d --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/RimHit.cs @@ -0,0 +1,9 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Modes.Taiko.Objects +{ + public class RimHit : Hit + { + } +} diff --git a/osu.Game.Modes.Taiko/TaikoAutoReplay.cs b/osu.Game.Modes.Taiko/TaikoAutoReplay.cs index 04f634be05..b30f26a9d3 100644 --- a/osu.Game.Modes.Taiko/TaikoAutoReplay.cs +++ b/osu.Game.Modes.Taiko/TaikoAutoReplay.cs @@ -84,7 +84,7 @@ namespace osu.Game.Modes.Taiko } else if (hit != null) { - if (hit.Type == HitType.Centre) + if (hit is CentreHit) { if (h.IsStrong) button = LegacyButtonState.Right1 | LegacyButtonState.Right2; diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 9ff16989af..a892cedf22 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -53,6 +53,7 @@ + @@ -70,7 +71,7 @@ - + From f3599b080ccbf60454ec73435fab938eb8e5014d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 16:12:21 +0900 Subject: [PATCH 184/348] Fix using. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 5bf12ce586..e8e32ebf3d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -4,7 +4,6 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Graphics; From 76d0beb64f12dc2a3adbb3436ff4a634a56656b9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 19:03:16 +0900 Subject: [PATCH 185/348] Fix custom transform. --- osu-framework | 2 +- osu.Game/Screens/Tournament/ScrollingTeamContainer.cs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index 4d131fd0d9..269a1fd192 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 4d131fd0d997bee313de3fa33a45900637570ff0 +Subproject commit 269a1fd192c573d558a5ab0ff990a8b462947287 diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index 4d965bf3a5..b80f76d281 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -298,9 +298,7 @@ namespace osu.Game.Screens.Tournament private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None) { DelayReset(); - - UpdateTransformsOfType(typeof(TransformScrollSpeed)); - TransformFloatTo(speed, value, duration, easing, new TransformScrollSpeed()); + TransformTo(speed, value, duration, easing, new TransformScrollSpeed()); } private enum ScrollState From e57de373a8c372bc211ab0b2eff2bc3693789a41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 09:02:55 +0900 Subject: [PATCH 186/348] Add opentk to osu.Desktop's packages. --- osu.Desktop/OpenTK.dll.config | 29 +++++++++++++++++++++++++++++ osu.Desktop/osu.Desktop.csproj | 3 ++- osu.Desktop/packages.config | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop/OpenTK.dll.config diff --git a/osu.Desktop/OpenTK.dll.config b/osu.Desktop/OpenTK.dll.config new file mode 100644 index 0000000000..627e9f6009 --- /dev/null +++ b/osu.Desktop/OpenTK.dll.config @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index b02032cbb1..fbc342d695 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -153,6 +153,7 @@ osu.licenseheader + @@ -248,4 +249,4 @@ - + \ No newline at end of file diff --git a/osu.Desktop/packages.config b/osu.Desktop/packages.config index bdeaf1de89..be9b65f0c6 100644 --- a/osu.Desktop/packages.config +++ b/osu.Desktop/packages.config @@ -7,6 +7,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + \ No newline at end of file From 41aaf42183a1780992990f5c75800a0c7ffd9057 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 30 Mar 2017 18:59:00 +0900 Subject: [PATCH 187/348] Remove DrumRollCirclePiece, cleanup CirclePiece a bit. --- .../Tests/TestCaseTaikoHitObjects.cs | 18 +++--- .../Objects/Drawable/DrawableDrumRoll.cs | 26 +++++++-- .../Objects/Drawable/Pieces/CirclePiece.cs | 17 +++--- .../Drawable/Pieces/DrumRollCirclePiece.cs | 57 ------------------- .../osu.Game.Modes.Taiko.csproj | 1 - 5 files changed, 36 insertions(+), 83 deletions(-) delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index cd79beadb1..ce395fd492 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -92,22 +92,20 @@ namespace osu.Desktop.VisualTests.Tests Position = new Vector2(350, 500) }); - Add(new DrumRollCirclePiece(new CirclePiece - { - KiaiMode = kiai - }) + Add(new CirclePiece { + Position = new Vector2(575, 100), Width = 0.25f, - Position = new Vector2(575, 100) + AccentColour = Color4.Orange, + KiaiMode = kiai, }); - Add(new DrumRollCirclePiece(new StrongCirclePiece - { - KiaiMode = kiai - }) + Add(new StrongCirclePiece { + Position = new Vector2(575, 300), Width = 0.25f, - Position = new Vector2(575, 300) + AccentColour = Color4.Orange, + KiaiMode = kiai }); } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index f1e2ecef7e..f50cab33b0 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -1,7 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; @@ -13,7 +17,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { private readonly DrumRoll drumRoll; - private readonly DrumRollCirclePiece circle; + private readonly CirclePiece circle; + + private Color4 baseColour; + private Color4 finalColour; public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) @@ -23,7 +30,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable RelativeSizeAxes = Axes.X; Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); - Add(circle = new DrumRollCirclePiece(CreateCirclePiece())); + Add(circle = CreateCirclePiece()); foreach (var tick in drumRoll.Ticks) { @@ -39,10 +46,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable } } - private void onTickJudgement(DrawableHitObject obj) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { - int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); - circle.Completion = (float)countHit / NestedHitObjects.Count(); + circle.Background.Colour = baseColour = colours.YellowDark; + finalColour = colours.YellowDarker; } protected override void LoadComplete() @@ -56,6 +64,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt; } + private void onTickJudgement(DrawableHitObject obj) + { + int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); + float completion = (float)countHit / NestedHitObjects.Count(); + + circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1); + } + protected override void CheckJudgement(bool userTriggered) { if (userTriggered) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index 2af469d05f..59eebce28e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -35,8 +35,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { accentColour = value; - innerBackground.Colour = AccentColour; - triangles.Colour = AccentColour; + background.Colour = AccentColour; resetEdgeEffects(); } @@ -66,10 +65,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces protected override Container Content => SymbolContainer; protected readonly Container SymbolContainer; + private readonly Container background; private readonly Container innerLayer; - private readonly Container innerCircleContainer; - private readonly Box innerBackground; - private readonly Triangles triangles; public CirclePiece() { @@ -85,22 +82,22 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces RelativeSizeAxes = Axes.Y, Children = new Framework.Graphics.Drawable[] { - innerCircleContainer = new CircularContainer + background = new CircularContainer { - Name = "Inner Circle", + Name = "Background", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Masking = true, Children = new Framework.Graphics.Drawable[] { - innerBackground = new Box + new Box { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, }, - triangles = new Triangles + new Triangles { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -149,7 +146,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces private void resetEdgeEffects() { - innerCircleContainer.EdgeEffect = new EdgeEffect + background.EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, Colour = AccentColour, diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs deleted file mode 100644 index 3be99ab161..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/DrumRollCirclePiece.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.MathUtils; -using osu.Game.Graphics; - -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces -{ - /// - /// A circle piece used for drumrolls. - /// - public class DrumRollCirclePiece : Container - { - private float completion; - /// - /// The amount of the drumroll that has been completed, as a percentage of the number - /// of ticks in the drumroll. This determines the internal colour of the drumroll. - /// - public float Completion - { - get { return completion; } - set - { - completion = MathHelper.Clamp(value, 0, 1); - - if (!IsLoaded) - return; - - circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1); - } - } - - private readonly CirclePiece circle; - - private Color4 baseColour; - private Color4 finalColour; - - public DrumRollCirclePiece(CirclePiece piece) - { - RelativeSizeAxes = Axes.X; - - Add(circle = piece); - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - circle.AccentColour = baseColour = colours.YellowDark; - finalColour = colours.YellowDarker; - } - } -} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 8865e65228..232d108f57 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -64,7 +64,6 @@ - From d944b8c1922bbc88098223159a2291048c8cd753 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:01:42 +0900 Subject: [PATCH 188/348] Implement IAccented interface + transform. --- osu-framework | 2 +- osu.Game/Graphics/IAccented.cs | 36 ++++++++++++++++++ .../Graphics/Transforms/TransformAccent.cs | 37 +++++++++++++++++++ .../UserInterface/PercentageCounter.cs | 2 +- .../Graphics/UserInterface/ScoreCounter.cs | 2 +- osu.Game/Modes/UI/ComboCounter.cs | 2 +- osu.Game/Modes/UI/ComboResultCounter.cs | 2 +- osu.Game/osu.Game.csproj | 2 + 8 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Graphics/IAccented.cs create mode 100644 osu.Game/Graphics/Transforms/TransformAccent.cs diff --git a/osu-framework b/osu-framework index 269a1fd192..3931f8e358 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 269a1fd192c573d558a5ab0ff990a8b462947287 +Subproject commit 3931f8e358365b1853a76e1d141fcf4c929a2143 diff --git a/osu.Game/Graphics/IAccented.cs b/osu.Game/Graphics/IAccented.cs new file mode 100644 index 0000000000..6f0f107f3c --- /dev/null +++ b/osu.Game/Graphics/IAccented.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics.Transforms; + +namespace osu.Game.Graphics +{ + /// + /// A type of drawable that has an accent colour. + /// The accent colour is used to colorize various objects inside a drawable + /// without colorizing the drawable itself. + /// + public interface IAccented : IDrawable + { + Color4 AccentColour { get; set; } + } + + public static class AccentedExtensions + { + /// + /// Tweens the accent colour of a drawable to another colour. + /// + /// The type of drawable. + /// The drawable to apply the accent colour to. + /// The new accent colour. + /// The tween duration. + /// The tween easing. + public static void FadeAccent(this TDrawable drawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) + where TDrawable : Drawable, IAccented + { + drawable.TransformTo(drawable.AccentColour, newColour, duration, easing, new TransformAccent()); + } + } +} diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs new file mode 100644 index 0000000000..7f40a0a016 --- /dev/null +++ b/osu.Game/Graphics/Transforms/TransformAccent.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; +using osu.Framework.MathUtils; + +namespace osu.Game.Graphics.Transforms +{ + public class TransformAccent : Transform + { + /// + /// Current value of the transformed colour in linear colour space. + /// + public override Color4 CurrentValue + { + get + { + double time = Time?.Current ?? 0; + if (time < StartTime) return StartValue; + if (time >= EndTime) return EndValue; + + return Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing); + } + } + + public override void Apply(Drawable d) + { + base.Apply(d); + + var accented = d as IAccented; + if (accented != null) + accented.AccentColour = CurrentValue; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 66c9e7d461..c32b654840 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -47,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface protected class TransformAccuracy : Transform { - protected override double CurrentValue + public override double CurrentValue { get { diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index c9a1040185..c2b1b026b6 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface protected class TransformScore : Transform { - protected override double CurrentValue + public override double CurrentValue { get { diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index f831677e44..3629634889 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -213,7 +213,7 @@ namespace osu.Game.Modes.UI protected class TransformComboRoll : Transform { - protected override int CurrentValue + public override int CurrentValue { get { diff --git a/osu.Game/Modes/UI/ComboResultCounter.cs b/osu.Game/Modes/UI/ComboResultCounter.cs index 957a720c94..63009c5351 100644 --- a/osu.Game/Modes/UI/ComboResultCounter.cs +++ b/osu.Game/Modes/UI/ComboResultCounter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Modes.UI protected class TransformComboResult : Transform { - protected override ulong CurrentValue + public override ulong CurrentValue { get { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a5bdf1df69..00c189d01c 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -82,7 +82,9 @@ + + From b54201cbe388603c5349eaf81dd4fd8a95779d23 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:09:02 +0900 Subject: [PATCH 189/348] Appease resharpoo. --- osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index ec98feddae..20e16ae03c 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; using System; +using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { @@ -18,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0. /// /// - public class CirclePiece : Container + public class CirclePiece : Container, IAccented { public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; public const float SYMBOL_BORDER = 8; From b48def16275378e131ce2ed9157796a7c687eaab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 11:19:33 +0900 Subject: [PATCH 190/348] Align SwellSymbolPiece better for rotation. --- osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs index ba7f5b8df9..2bd86406a7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs @@ -15,6 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces { Anchor = Anchor.Centre; Origin = Anchor.Centre; + UseFullGlyphHeight = true; TextSize = CirclePiece.SYMBOL_INNER_SIZE; Icon = FontAwesome.fa_asterisk; Shadow = false; From bcd7e41bf78956e2a3ed643cece478f0471834db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 11:20:04 +0900 Subject: [PATCH 191/348] Visual adjustments to DrawableSwell. --- .../Objects/Drawable/DrawableSwell.cs | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index 0462880f3e..d789d12c90 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -26,16 +26,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// public event Action OnStart; - private const float target_ring_thick_border = 4f; + private const float target_ring_thick_border = 1.4f; private const float target_ring_thin_border = 1f; private const float target_ring_scale = 5f; - private const float inner_ring_alpha = 0.35f; + private const float inner_ring_alpha = 0.65f; private readonly Swell swell; private readonly Container bodyContainer; private readonly CircularContainer targetRing; - private readonly CircularContainer innerRing; + private readonly CircularContainer expandingRing; private readonly CirclePiece circlePiece; @@ -49,6 +49,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private int userHits; private bool hasStarted; + private readonly SwellSymbolPiece symbol; public DrawableSwell(Swell swell) : base(swell) @@ -61,12 +62,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { Children = new Framework.Graphics.Drawable[] { - innerRing = new CircularContainer + expandingRing = new CircularContainer { - Name = "Inner ring", + Name = "Expanding ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, + Alpha = 0, Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + BlendingMode = BlendingMode.Additive, Masking = true, Children = new [] { @@ -85,6 +88,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), Masking = true, BorderThickness = target_ring_thick_border, + BlendingMode = BlendingMode.Additive, Children = new Framework.Graphics.Drawable[] { new Box @@ -118,7 +122,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { Children = new [] { - new SwellSymbolPiece() + symbol = new SwellSymbolPiece() } } } @@ -130,7 +134,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private void load(OsuColour colours) { circlePiece.AccentColour = colours.YellowDark; - innerRing.Colour = colours.YellowDark; + expandingRing.Colour = colours.YellowLight; targetRing.BorderColour = colours.YellowDark.Opacity(0.25f); } @@ -140,9 +144,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { userHits++; - innerRing.FadeTo(1); - innerRing.FadeTo(inner_ring_alpha, 500, EasingTypes.OutQuint); - innerRing.ScaleTo(1f + (target_ring_scale - 1) * userHits / swell.RequiredHits, 1200, EasingTypes.OutElastic); + var completion = (float)userHits / swell.RequiredHits; + + expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50); + expandingRing.Delay(50); + expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); + expandingRing.DelayReset(); + + symbol.RotateTo((float)(completion * swell.Duration / 8), 4000, EasingTypes.OutQuint); + + expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, EasingTypes.OutQuint); if (userHits == swell.RequiredHits) { @@ -168,23 +179,26 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override void UpdateState(ArmedState state) { - const float preempt = 300; + const float preempt = 100; Delay(HitObject.StartTime - Time.Current - preempt, true); - targetRing.ScaleTo(target_ring_scale, preempt, EasingTypes.Out); + targetRing.ScaleTo(target_ring_scale, preempt * 4, EasingTypes.OutQuint); + Delay(preempt, true); Delay(Judgement.TimeOffset + swell.Duration, true); + const float out_transition_time = 300; + switch (state) { case ArmedState.Hit: - bodyContainer.ScaleTo(1.2f, 400, EasingTypes.OutQuad); + bodyContainer.ScaleTo(1.4f, out_transition_time); break; } - FadeOut(600); + FadeOut(out_transition_time, EasingTypes.Out); Expire(); } From 0e2f72542507f2fcd0214c88f805407614fad16e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:41:06 +0900 Subject: [PATCH 192/348] Fade the accent colour instead of stepping. --- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- .../Objects/Drawable/DrawableDrumRoll.cs | 29 ++++++++++++++----- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 2 +- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 56d41027f6..e7702bc032 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -81,7 +81,7 @@ namespace osu.Desktop.VisualTests.Tests var d = new DrumRoll { StartTime = Time.Current + 1000, - Distance = 2000, + Distance = 20000, PreEmpt = 1000, }; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index f50cab33b0..6b1c4f546b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -15,12 +16,21 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableDrumRoll : DrawableTaikoHitObject { + /// + /// Number of consecutive hits required to reach the dark/final accent colour. + /// + private const int consecutive_hits_for_dark_accent = 5; + private readonly DrumRoll drumRoll; private readonly CirclePiece circle; - private Color4 baseColour; - private Color4 finalColour; + private Color4 accentDarkColour; + + /// + /// Number of consecutive tick hits. + /// + private int consecutiveHits; public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) @@ -49,8 +59,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable [BackgroundDependencyLoader] private void load(OsuColour colours) { - circle.Background.Colour = baseColour = colours.YellowDark; - finalColour = colours.YellowDarker; + circle.AccentColour = AccentColour = colours.YellowDark; + accentDarkColour = colours.YellowDarker; } protected override void LoadComplete() @@ -66,10 +76,15 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private void onTickJudgement(DrawableHitObject obj) { - int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); - float completion = (float)countHit / NestedHitObjects.Count(); + if (obj.Judgement.Result == HitResult.Hit) + consecutiveHits++; + else + consecutiveHits--; - circle.AccentColour = Interpolation.ValueAt(completion, baseColour, finalColour, 0, 1); + consecutiveHits = MathHelper.Clamp(consecutiveHits, 0, consecutive_hits_for_dark_accent); + + Color4 newAccent = Interpolation.ValueAt((float)consecutiveHits / consecutive_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1); + circle.FadeAccent(newAccent, 100); } protected override void CheckJudgement(bool userTriggered) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ff73c40d2f..df8870ab97 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -31,7 +31,7 @@ namespace osu.Game.Modes.Taiko.Objects /// The distance between ticks of this drumroll. /// Half of this value is the hit window of the ticks. /// - public double TickTimeDistance { get; protected set; } = 200; + public double TickTimeDistance { get; protected set; } = 100; /// /// Number of drum roll ticks required for a "Good" hit. From 591ecc0ef4087899f69068b25a07d3e4ca578983 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 11:48:54 +0900 Subject: [PATCH 193/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 3931f8e358..591b799f95 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 3931f8e358365b1853a76e1d141fcf4c929a2143 +Subproject commit 591b799f95a47e5da893c82d024e01311c9c37c6 From c2dbbc608a85e430ad19ac21e63757ab52a828b9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:50:31 +0900 Subject: [PATCH 194/348] General fixes. --- osu.Game.Modes.Taiko/LegacyTaikoReplay.cs | 27 ++++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs b/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs index 0b59c9ddd4..38a28270b3 100644 --- a/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs +++ b/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs @@ -29,19 +29,24 @@ namespace osu.Game.Modes.Taiko { } - public override List GetPendingStates() => new List + public override List GetPendingStates() { - new InputState + var keys = new List(); + + if (CurrentFrame?.MouseRight1 == true) + keys.Add(Key.F); + if (CurrentFrame?.MouseRight2 == true) + keys.Add(Key.J); + if (CurrentFrame?.MouseLeft1 == true) + keys.Add(Key.D); + if (CurrentFrame?.MouseLeft2 == true) + keys.Add(Key.K); + + return new List { - Keyboard = new ReplayKeyboardState(new List(new[] - { - CurrentFrame?.MouseRight1 == true ? Key.F : Key.Unknown, - CurrentFrame?.MouseRight2 == true ? Key.J : Key.Unknown, - CurrentFrame?.MouseLeft1 == true ? Key.D : Key.Unknown, - CurrentFrame?.MouseLeft2 == true ? Key.K : Key.Unknown - })) - } - }; + new InputState { Keyboard = new ReplayKeyboardState(keys) } + }; + } } } } From 49575c34476adb06e3d81789bfbac8cd2b733304 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:54:12 +0900 Subject: [PATCH 195/348] Special case not needed. --- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 2939980ac6..ed8269876e 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -95,8 +95,8 @@ namespace osu.Game.Modes.Objects.Drawables { IPartialJudgement partial = Judgement as IPartialJudgement; - // Never re-process non-partial hits, or partial judgements that were previously judged as misses - if (Judgement.Result != HitResult.None && (partial == null || Judgement.Result == HitResult.Miss)) + // Never re-process non-partial hits + if (Judgement.Result != HitResult.None && partial == null) return false; // Update the judgement state From cd915a32bef6b2f8bead9b4d6007528c21011b93 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 11:58:24 +0900 Subject: [PATCH 196/348] Let's use a List for now. --- osu.Game/Modes/Scoring/ScoreProcessor.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Modes/Scoring/ScoreProcessor.cs index 314d4fa194..4c42f2a384 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Modes/Scoring/ScoreProcessor.cs @@ -110,7 +110,7 @@ namespace osu.Game.Modes.Scoring /// /// All judgements held by this ScoreProcessor. /// - protected readonly HashSet Judgements = new HashSet(); + protected readonly List Judgements = new List(); public override bool HasFailed => Health.Value == Health.MinValue; @@ -139,9 +139,13 @@ namespace osu.Game.Modes.Scoring /// The judgement to add. protected void AddJudgement(TJudgement judgement) { - if (Judgements.Add(judgement)) + bool exists = Judgements.Contains(judgement); + + if (!exists) { + Judgements.Add(judgement); OnNewJudgement(judgement); + judgement.ComboAtHit = Combo.Value; } else From e7ecc479c9bad2681f9b2c6211efd54c9f5bc2d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 12:43:42 +0900 Subject: [PATCH 197/348] Add FramedReplay and use where legacy is not needed. --- osu.Game.Modes.Osu/OsuAutoReplay.cs | 63 ++++---- .../FramedReplay.cs} | 134 ++---------------- osu.Game/Modes/Replays/LegacyFramedReplay.cs | 70 +++++++++ osu.Game/Modes/{ => Replays}/Replay.cs | 2 +- osu.Game/Modes/Replays/ReplayButtonState.cs | 18 +++ osu.Game/Modes/Replays/ReplayFrame.cs | 71 ++++++++++ osu.Game/Modes/Scoring/Score.cs | 1 + osu.Game/osu.Game.csproj | 7 +- 8 files changed, 209 insertions(+), 157 deletions(-) rename osu.Game/Modes/{LegacyReplay.cs => Replays/FramedReplay.cs} (53%) create mode 100644 osu.Game/Modes/Replays/LegacyFramedReplay.cs rename osu.Game/Modes/{ => Replays}/Replay.cs (87%) create mode 100644 osu.Game/Modes/Replays/ReplayButtonState.cs create mode 100644 osu.Game/Modes/Replays/ReplayFrame.cs diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index 86985c834a..2ac5f771c3 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -11,10 +11,11 @@ using System.Collections.Generic; using System.Diagnostics; using osu.Framework.Graphics; using osu.Game.Modes.Objects.Types; +using osu.Game.Modes.Replays; namespace osu.Game.Modes.Osu { - public class OsuAutoReplay : LegacyReplay + public class OsuAutoReplay : FramedReplay { private static readonly Vector2 spinner_centre = new Vector2(256, 192); @@ -29,17 +30,17 @@ namespace osu.Game.Modes.Osu createAutoReplay(); } - private class LegacyReplayFrameComparer : IComparer + private class ReplayFrameComparer : IComparer { - public int Compare(LegacyReplayFrame f1, LegacyReplayFrame f2) + public int Compare(ReplayFrame f1, ReplayFrame f2) { return f1.Time.CompareTo(f2.Time); } } - private static readonly IComparer replay_frame_comparer = new LegacyReplayFrameComparer(); + private static readonly IComparer replay_frame_comparer = new ReplayFrameComparer(); - private int findInsertionIndex(LegacyReplayFrame frame) + private int findInsertionIndex(ReplayFrame frame) { int index = Frames.BinarySearch(frame, replay_frame_comparer); @@ -59,7 +60,7 @@ namespace osu.Game.Modes.Osu return index; } - private void addFrameToReplay(LegacyReplayFrame frame) => Frames.Insert(findInsertionIndex(frame), frame); + private void addFrameToReplay(ReplayFrame frame) => Frames.Insert(findInsertionIndex(frame), frame); private static Vector2 circlePosition(double t, double radius) => new Vector2((float)(Math.Cos(t) * radius), (float)(Math.Sin(t) * radius)); @@ -74,9 +75,9 @@ namespace osu.Game.Modes.Osu EasingTypes preferredEasing = DelayedMovements ? EasingTypes.InOutCubic : EasingTypes.Out; - addFrameToReplay(new LegacyReplayFrame(-100000, 256, 500, LegacyButtonState.None)); - addFrameToReplay(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1500, 256, 500, LegacyButtonState.None)); - addFrameToReplay(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 256, 192, LegacyButtonState.None)); + addFrameToReplay(new ReplayFrame(-100000, 256, 500, ReplayButtonState.None)); + addFrameToReplay(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1500, 256, 500, ReplayButtonState.None)); + addFrameToReplay(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 256, 192, ReplayButtonState.None)); // We are using ApplyModsToRate and not ApplyModsToTime to counteract the speed up / slow down from HalfTime / DoubleTime so that we remain at a constant framerate of 60 fps. float frameDelay = (float)applyModsToRate(1000.0 / 60.0); @@ -106,18 +107,18 @@ namespace osu.Game.Modes.Osu //Make the cursor stay at a hitObject as long as possible (mainly for autopilot). if (h.StartTime - h.HitWindowFor(OsuScoreResult.Miss) > endTime + h.HitWindowFor(OsuScoreResult.Hit50) + 50) { - if (!(last is Spinner) && h.StartTime - endTime < 1000) addFrameToReplay(new LegacyReplayFrame(endTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Miss), h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - endTime < 1000) addFrameToReplay(new ReplayFrame(endTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, ReplayButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new ReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Miss), h.Position.X, h.Position.Y, ReplayButtonState.None)); } else if (h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50) > endTime + h.HitWindowFor(OsuScoreResult.Hit50) + 50) { - if (!(last is Spinner) && h.StartTime - endTime < 1000) addFrameToReplay(new LegacyReplayFrame(endTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50), h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - endTime < 1000) addFrameToReplay(new ReplayFrame(endTime + h.HitWindowFor(OsuScoreResult.Hit50), last.EndPosition.X, last.EndPosition.Y, ReplayButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new ReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit50), h.Position.X, h.Position.Y, ReplayButtonState.None)); } else if (h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100) > endTime + h.HitWindowFor(OsuScoreResult.Hit100) + 50) { - if (!(last is Spinner) && h.StartTime - endTime < 1000) addFrameToReplay(new LegacyReplayFrame(endTime + h.HitWindowFor(OsuScoreResult.Hit100), last.EndPosition.X, last.EndPosition.Y, LegacyButtonState.None)); - if (!(h is Spinner)) addFrameToReplay(new LegacyReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100), h.Position.X, h.Position.Y, LegacyButtonState.None)); + if (!(last is Spinner) && h.StartTime - endTime < 1000) addFrameToReplay(new ReplayFrame(endTime + h.HitWindowFor(OsuScoreResult.Hit100), last.EndPosition.X, last.EndPosition.Y, ReplayButtonState.None)); + if (!(h is Spinner)) addFrameToReplay(new ReplayFrame(h.StartTime - h.HitWindowFor(OsuScoreResult.Hit100), h.Position.X, h.Position.Y, ReplayButtonState.None)); } } @@ -173,13 +174,13 @@ namespace osu.Game.Modes.Osu // Do some nice easing for cursor movements if (Frames.Count > 0) { - LegacyReplayFrame lastFrame = Frames[Frames.Count - 1]; + ReplayFrame lastFrame = Frames[Frames.Count - 1]; // Wait until Auto could "see and react" to the next note. double waitTime = h.StartTime - Math.Max(0.0, DrawableOsuHitObject.TIME_PREEMPT - reactionTime); if (waitTime > lastFrame.Time) { - lastFrame = new LegacyReplayFrame(waitTime, lastFrame.MouseX, lastFrame.MouseY, lastFrame.ButtonState); + lastFrame = new ReplayFrame(waitTime, lastFrame.MouseX, lastFrame.MouseY, lastFrame.ButtonState); addFrameToReplay(lastFrame); } @@ -196,7 +197,7 @@ namespace osu.Game.Modes.Osu for (double time = lastFrame.Time + frameDelay; time < h.StartTime; time += frameDelay) { Vector2 currentPosition = Interpolation.ValueAt(time, lastPosition, targetPosition, lastFrame.Time, h.StartTime, easing); - addFrameToReplay(new LegacyReplayFrame((int)time, currentPosition.X, currentPosition.Y, lastFrame.ButtonState)); + addFrameToReplay(new ReplayFrame((int)time, currentPosition.X, currentPosition.Y, lastFrame.ButtonState)); } buttonIndex = 0; @@ -207,12 +208,12 @@ namespace osu.Game.Modes.Osu } } - LegacyButtonState button = buttonIndex % 2 == 0 ? LegacyButtonState.Left1 : LegacyButtonState.Right1; + ReplayButtonState button = buttonIndex % 2 == 0 ? ReplayButtonState.Left1 : ReplayButtonState.Right1; double hEndTime = (h as IHasEndTime)?.EndTime ?? h.StartTime; - LegacyReplayFrame newFrame = new LegacyReplayFrame(h.StartTime, targetPosition.X, targetPosition.Y, button); - LegacyReplayFrame endFrame = new LegacyReplayFrame(hEndTime + endDelay, h.EndPosition.X, h.EndPosition.Y, LegacyButtonState.None); + ReplayFrame newFrame = new ReplayFrame(h.StartTime, targetPosition.X, targetPosition.Y, button); + ReplayFrame endFrame = new ReplayFrame(hEndTime + endDelay, h.EndPosition.X, h.EndPosition.Y, ReplayButtonState.None); // Decrement because we want the previous frame, not the next one int index = findInsertionIndex(newFrame) - 1; @@ -220,19 +221,19 @@ namespace osu.Game.Modes.Osu // Do we have a previous frame? No need to check for < replay.Count since we decremented! if (index >= 0) { - LegacyReplayFrame previousFrame = Frames[index]; + ReplayFrame previousFrame = Frames[index]; var previousButton = previousFrame.ButtonState; // If a button is already held, then we simply alternate - if (previousButton != LegacyButtonState.None) + if (previousButton != ReplayButtonState.None) { - Debug.Assert(previousButton != (LegacyButtonState.Left1 | LegacyButtonState.Right1)); + Debug.Assert(previousButton != (ReplayButtonState.Left1 | ReplayButtonState.Right1)); // Force alternation if we have the same button. Otherwise we can just keep the naturally to us assigned button. if (previousButton == button) { - button = (LegacyButtonState.Left1 | LegacyButtonState.Right1) & ~button; - newFrame.SetButtonStates(button); + button = (ReplayButtonState.Left1 | ReplayButtonState.Right1) & ~button; + newFrame.ButtonState = button; } // We always follow the most recent slider / spinner, so remove any other frames that occur while it exists. @@ -246,7 +247,7 @@ namespace osu.Game.Modes.Osu { // Don't affect frames which stop pressing a button! if (j < Frames.Count - 1 || Frames[j].ButtonState == previousButton) - Frames[j].SetButtonStates(button); + Frames[j].ButtonState = button; } } } @@ -270,13 +271,13 @@ namespace osu.Game.Modes.Osu t = applyModsToTime(j - h.StartTime) * spinnerDirection; Vector2 pos = spinner_centre + circlePosition(t / 20 + angle, spin_radius); - addFrameToReplay(new LegacyReplayFrame((int)j, pos.X, pos.Y, button)); + addFrameToReplay(new ReplayFrame((int)j, pos.X, pos.Y, button)); } t = applyModsToTime(s.EndTime - h.StartTime) * spinnerDirection; Vector2 endPosition = spinner_centre + circlePosition(t / 20 + angle, spin_radius); - addFrameToReplay(new LegacyReplayFrame(s.EndTime, endPosition.X, endPosition.Y, button)); + addFrameToReplay(new ReplayFrame(s.EndTime, endPosition.X, endPosition.Y, button)); endFrame.MouseX = endPosition.X; endFrame.MouseY = endPosition.Y; @@ -288,10 +289,10 @@ namespace osu.Game.Modes.Osu for (double j = frameDelay; j < s.Duration; j += frameDelay) { Vector2 pos = s.PositionAt(j / s.Duration); - addFrameToReplay(new LegacyReplayFrame(h.StartTime + j, pos.X, pos.Y, button)); + addFrameToReplay(new ReplayFrame(h.StartTime + j, pos.X, pos.Y, button)); } - addFrameToReplay(new LegacyReplayFrame(s.EndTime, s.EndPosition.X, s.EndPosition.Y, button)); + addFrameToReplay(new ReplayFrame(s.EndTime, s.EndPosition.X, s.EndPosition.Y, button)); } // We only want to let go of our button if we are at the end of the current replay. Otherwise something is still going on after us so we need to keep the button pressed! diff --git a/osu.Game/Modes/LegacyReplay.cs b/osu.Game/Modes/Replays/FramedReplay.cs similarity index 53% rename from osu.Game/Modes/LegacyReplay.cs rename to osu.Game/Modes/Replays/FramedReplay.cs index d57d4a15d2..26144d1ed7 100644 --- a/osu.Game/Modes/LegacyReplay.cs +++ b/osu.Game/Modes/Replays/FramedReplay.cs @@ -3,67 +3,39 @@ using System; using System.Collections.Generic; -using System.IO; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input; using osu.Framework.MathUtils; using osu.Game.Input.Handlers; -using osu.Game.IO.Legacy; using OpenTK; using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; using MouseState = osu.Framework.Input.MouseState; -namespace osu.Game.Modes +namespace osu.Game.Modes.Replays { - public class LegacyReplay : Replay + public abstract class FramedReplay : Replay { - protected List Frames = new List(); + protected List Frames = new List(); - protected LegacyReplay() - { - - } - - public LegacyReplay(StreamReader reader) - { - float lastTime = 0; - - foreach (var l in reader.ReadToEnd().Split(',')) - { - var split = l.Split('|'); - - if (split.Length < 4 || float.Parse(split[0]) < 0) continue; - - lastTime += float.Parse(split[0]); - - Frames.Add(new LegacyReplayFrame( - lastTime, - float.Parse(split[1]), - 384 - float.Parse(split[2]), - (LegacyButtonState)int.Parse(split[3]) - )); - } - } - - public override ReplayInputHandler CreateInputHandler() => new LegacyReplayInputHandler(Frames); + public override ReplayInputHandler CreateInputHandler() => new FramedReplayInputHandler(Frames); /// /// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. /// It handles logic of any frames which *must* be executed. /// - protected class LegacyReplayInputHandler : ReplayInputHandler + public class FramedReplayInputHandler : ReplayInputHandler { - private readonly List replayContent; + private readonly List replayContent; - public LegacyReplayFrame CurrentFrame => !hasFrames ? null : replayContent[currentFrameIndex]; - public LegacyReplayFrame NextFrame => !hasFrames ? null : replayContent[nextFrameIndex]; + public ReplayFrame CurrentFrame => !hasFrames ? null : replayContent[currentFrameIndex]; + public ReplayFrame NextFrame => !hasFrames ? null : replayContent[nextFrameIndex]; private int currentFrameIndex; private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, replayContent.Count - 1); - public LegacyReplayInputHandler(List replayContent) + public FramedReplayInputHandler(List replayContent) { this.replayContent = replayContent; } @@ -133,7 +105,7 @@ namespace osu.Game.Modes private bool inImportantSection => FrameAccuratePlayback && //a button is in a pressed state - (currentDirection > 0 ? CurrentFrame : NextFrame)?.ButtonState > LegacyButtonState.None && + ((currentDirection > 0 ? CurrentFrame : NextFrame)?.IsImportant ?? false) && //the next frame is within an allowable time span Math.Abs(currentTime - NextFrame?.Time ?? 0) <= sixty_frame_time * 1.2; @@ -180,89 +152,5 @@ namespace osu.Game.Modes } } } - - [Flags] - protected enum LegacyButtonState - { - None = 0, - Left1 = 1, - Right1 = 2, - Left2 = 4, - Right2 = 8, - Smoke = 16 - } - - protected class LegacyReplayFrame - { - public Vector2 Position => new Vector2(MouseX, MouseY); - - public float MouseX; - public float MouseY; - public bool MouseLeft; - public bool MouseRight; - public bool MouseLeft1; - public bool MouseRight1; - public bool MouseLeft2; - public bool MouseRight2; - public LegacyButtonState ButtonState; - public double Time; - - public LegacyReplayFrame(double time, float posX, float posY, LegacyButtonState buttonState) - { - MouseX = posX; - MouseY = posY; - ButtonState = buttonState; - SetButtonStates(buttonState); - Time = time; - } - - public void SetButtonStates(LegacyButtonState buttonState) - { - ButtonState = buttonState; - MouseLeft = (buttonState & (LegacyButtonState.Left1 | LegacyButtonState.Left2)) > 0; - MouseLeft1 = (buttonState & LegacyButtonState.Left1) > 0; - MouseLeft2 = (buttonState & LegacyButtonState.Left2) > 0; - MouseRight = (buttonState & (LegacyButtonState.Right1 | LegacyButtonState.Right2)) > 0; - MouseRight1 = (buttonState & LegacyButtonState.Right1) > 0; - MouseRight2 = (buttonState & LegacyButtonState.Right2) > 0; - } - - public LegacyReplayFrame(Stream s) : this(new SerializationReader(s)) - { - } - - public LegacyReplayFrame(SerializationReader sr) - { - ButtonState = (LegacyButtonState)sr.ReadByte(); - SetButtonStates(ButtonState); - - byte bt = sr.ReadByte(); - if (bt > 0)//Handle Pre-Taiko compatible replays. - SetButtonStates(LegacyButtonState.Right1); - - MouseX = sr.ReadSingle(); - MouseY = sr.ReadSingle(); - Time = sr.ReadInt32(); - } - - public void ReadFromStream(SerializationReader sr) - { - throw new NotImplementedException(); - } - - public void WriteToStream(SerializationWriter sw) - { - sw.Write((byte)ButtonState); - sw.Write((byte)0); - sw.Write(MouseX); - sw.Write(MouseY); - sw.Write(Time); - } - - public override string ToString() - { - return $"{Time}\t({MouseX},{MouseY})\t{MouseLeft}\t{MouseRight}\t{MouseLeft1}\t{MouseRight1}\t{MouseLeft2}\t{MouseRight2}\t{ButtonState}"; - } - } } -} +} \ No newline at end of file diff --git a/osu.Game/Modes/Replays/LegacyFramedReplay.cs b/osu.Game/Modes/Replays/LegacyFramedReplay.cs new file mode 100644 index 0000000000..3e93751e09 --- /dev/null +++ b/osu.Game/Modes/Replays/LegacyFramedReplay.cs @@ -0,0 +1,70 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.IO; +using osu.Game.IO.Legacy; + +namespace osu.Game.Modes.Replays +{ + /// + /// Reads a replay from a legacy replay file (.osr v1) + /// + public class LegacyReplay : FramedReplay + { + public LegacyReplay(StreamReader reader) + { + float lastTime = 0; + + foreach (var l in reader.ReadToEnd().Split(',')) + { + var split = l.Split('|'); + + if (split.Length < 4 || float.Parse(split[0]) < 0) continue; + + lastTime += float.Parse(split[0]); + + Frames.Add(new ReplayFrame( + lastTime, + float.Parse(split[1]), + 384 - float.Parse(split[2]), + (ReplayButtonState)int.Parse(split[3]) + )); + } + } + + public class LegacyReplayFrame : ReplayFrame + { + public LegacyReplayFrame(Stream s) : this(new SerializationReader(s)) + { + } + + public LegacyReplayFrame(SerializationReader sr) + { + ButtonState = (ReplayButtonState)sr.ReadByte(); + + byte bt = sr.ReadByte(); + if (bt > 0)//Handle Pre-Taiko compatible replays. + ButtonState = ReplayButtonState.Right1; + + MouseX = sr.ReadSingle(); + MouseY = sr.ReadSingle(); + Time = sr.ReadInt32(); + } + + public void ReadFromStream(SerializationReader sr) + { + throw new NotImplementedException(); + } + + public void WriteToStream(SerializationWriter sw) + { + sw.Write((byte)ButtonState); + sw.Write((byte)0); + sw.Write(MouseX); + sw.Write(MouseY); + sw.Write(Time); + } + } + } +} diff --git a/osu.Game/Modes/Replay.cs b/osu.Game/Modes/Replays/Replay.cs similarity index 87% rename from osu.Game/Modes/Replay.cs rename to osu.Game/Modes/Replays/Replay.cs index 6d93afdeb9..c1ae952b77 100644 --- a/osu.Game/Modes/Replay.cs +++ b/osu.Game/Modes/Replays/Replay.cs @@ -3,7 +3,7 @@ using osu.Game.Input.Handlers; -namespace osu.Game.Modes +namespace osu.Game.Modes.Replays { public abstract class Replay { diff --git a/osu.Game/Modes/Replays/ReplayButtonState.cs b/osu.Game/Modes/Replays/ReplayButtonState.cs new file mode 100644 index 0000000000..d49139226c --- /dev/null +++ b/osu.Game/Modes/Replays/ReplayButtonState.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; + +namespace osu.Game.Modes.Replays +{ + [Flags] + public enum ReplayButtonState + { + None = 0, + Left1 = 1, + Right1 = 2, + Left2 = 4, + Right2 = 8, + Smoke = 16 + } +} \ No newline at end of file diff --git a/osu.Game/Modes/Replays/ReplayFrame.cs b/osu.Game/Modes/Replays/ReplayFrame.cs new file mode 100644 index 0000000000..4cd681beaf --- /dev/null +++ b/osu.Game/Modes/Replays/ReplayFrame.cs @@ -0,0 +1,71 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; + +namespace osu.Game.Modes.Replays +{ + public class ReplayFrame + { + public Vector2 Position => new Vector2(MouseX, MouseY); + + public bool IsImportant => MouseLeft || MouseRight; + + public float MouseX; + public float MouseY; + + public bool MouseLeft => MouseLeft1 || MouseLeft2; + public bool MouseRight => MouseRight1 || MouseRight2; + + public bool MouseLeft1 + { + get { return (ButtonState & ReplayButtonState.Left1) > 0; } + set { setButtonState(ReplayButtonState.Left1, value); } + } + public bool MouseRight1 + { + get { return (ButtonState & ReplayButtonState.Right1) > 0; } + set { setButtonState(ReplayButtonState.Right1, value); } + } + public bool MouseLeft2 + { + get { return (ButtonState & ReplayButtonState.Left2) > 0; } + set { setButtonState(ReplayButtonState.Left2, value); } + } + public bool MouseRight2 + { + get { return (ButtonState & ReplayButtonState.Right2) > 0; } + set { setButtonState(ReplayButtonState.Right2, value); } + } + + private void setButtonState(ReplayButtonState singleButton, bool pressed) + { + if (pressed) + ButtonState |= singleButton; + else + ButtonState &= ~singleButton; + } + + public double Time; + + public ReplayButtonState ButtonState; + + protected ReplayFrame() + { + + } + + public ReplayFrame(double time, float posX, float posY, ReplayButtonState buttonState) + { + MouseX = posX; + MouseY = posY; + ButtonState = buttonState; + Time = time; + } + + public override string ToString() + { + return $"{Time}\t({MouseX},{MouseY})\t{MouseLeft}\t{MouseRight}\t{MouseLeft1}\t{MouseRight1}\t{MouseLeft2}\t{MouseRight2}\t{ButtonState}"; + } + } +} \ No newline at end of file diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index 75c243278d..ab376ebdd6 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -7,6 +7,7 @@ using osu.Game.Database; using osu.Game.Modes.Mods; using osu.Game.Users; using System.IO; +using osu.Game.Modes.Replays; namespace osu.Game.Modes.Scoring { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a5bdf1df69..0bcbe9032f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -96,8 +96,9 @@ + - + @@ -123,7 +124,9 @@ - + + + From 0bcec4e61a158f976d0af09f258dbcb08ed6991d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 12:55:43 +0900 Subject: [PATCH 198/348] Add null-checks to comparers. --- osu.Game.Modes.Osu/OsuAutoReplay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index 2ac5f771c3..cc5859602a 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -34,6 +34,9 @@ namespace osu.Game.Modes.Osu { public int Compare(ReplayFrame f1, ReplayFrame f2) { + if (f1 == null) throw new NullReferenceException($@"{nameof(f1)} cannot be null"); + if (f2 == null) throw new NullReferenceException($@"{nameof(f2)} cannot be null"); + return f1.Time.CompareTo(f2.Time); } } From 79031b9e749fe5e1ca2e81eb82d1acdc805e15f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 12:58:54 +0900 Subject: [PATCH 199/348] Update framework. --- osu-framework | 2 +- osu.Game/Graphics/UserInterface/PercentageCounter.cs | 2 +- osu.Game/Graphics/UserInterface/ScoreCounter.cs | 2 +- osu.Game/Modes/UI/ComboCounter.cs | 2 +- osu.Game/Modes/UI/ComboResultCounter.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu-framework b/osu-framework index 269a1fd192..7ae3cf1a10 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 269a1fd192c573d558a5ab0ff990a8b462947287 +Subproject commit 7ae3cf1a10fa973a49995a71cbaf768702be1cce diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 66c9e7d461..c32b654840 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -47,7 +47,7 @@ namespace osu.Game.Graphics.UserInterface protected class TransformAccuracy : Transform { - protected override double CurrentValue + public override double CurrentValue { get { diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index c9a1040185..c2b1b026b6 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface protected class TransformScore : Transform { - protected override double CurrentValue + public override double CurrentValue { get { diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index f831677e44..3629634889 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -213,7 +213,7 @@ namespace osu.Game.Modes.UI protected class TransformComboRoll : Transform { - protected override int CurrentValue + public override int CurrentValue { get { diff --git a/osu.Game/Modes/UI/ComboResultCounter.cs b/osu.Game/Modes/UI/ComboResultCounter.cs index 957a720c94..63009c5351 100644 --- a/osu.Game/Modes/UI/ComboResultCounter.cs +++ b/osu.Game/Modes/UI/ComboResultCounter.cs @@ -36,7 +36,7 @@ namespace osu.Game.Modes.UI protected class TransformComboResult : Transform { - protected override ulong CurrentValue + public override ulong CurrentValue { get { From 09b98d71a705b56802a4dc1c7f89eae064905061 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 13:33:19 +0900 Subject: [PATCH 200/348] Add back Capacity. --- osu.Game/Modes/Scoring/ScoreProcessor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Modes/Scoring/ScoreProcessor.cs index 4c42f2a384..a64b4d4013 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Modes/Scoring/ScoreProcessor.cs @@ -120,6 +120,8 @@ namespace osu.Game.Modes.Scoring protected ScoreProcessor(HitRenderer hitRenderer) { + Judgements.Capacity = hitRenderer.Beatmap.HitObjects.Count; + hitRenderer.OnJudgement += AddJudgement; ComputeTargets(hitRenderer.Beatmap); From 43c306d65860f3d42d1482e48e903a05b1a130f5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 14:47:59 +0900 Subject: [PATCH 201/348] IAccented -> IHasAccentColour. --- osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs | 2 +- osu.Game/Graphics/{IAccented.cs => IHasAccentColour.cs} | 6 +++--- osu.Game/Graphics/Transforms/TransformAccent.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename osu.Game/Graphics/{IAccented.cs => IHasAccentColour.cs} (87%) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs index 20e16ae03c..2321ad30ee 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces /// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0. /// /// - public class CirclePiece : Container, IAccented + public class CirclePiece : Container, IHasAccentColour { public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; public const float SYMBOL_BORDER = 8; diff --git a/osu.Game/Graphics/IAccented.cs b/osu.Game/Graphics/IHasAccentColour.cs similarity index 87% rename from osu.Game/Graphics/IAccented.cs rename to osu.Game/Graphics/IHasAccentColour.cs index 6f0f107f3c..19f063e29a 100644 --- a/osu.Game/Graphics/IAccented.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -12,12 +12,12 @@ namespace osu.Game.Graphics /// The accent colour is used to colorize various objects inside a drawable /// without colorizing the drawable itself. /// - public interface IAccented : IDrawable + public interface IHasAccentColour : IDrawable { Color4 AccentColour { get; set; } } - public static class AccentedExtensions + public static class AccentedColourExtensions { /// /// Tweens the accent colour of a drawable to another colour. @@ -28,7 +28,7 @@ namespace osu.Game.Graphics /// The tween duration. /// The tween easing. public static void FadeAccent(this TDrawable drawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) - where TDrawable : Drawable, IAccented + where TDrawable : Drawable, IHasAccentColour { drawable.TransformTo(drawable.AccentColour, newColour, duration, easing, new TransformAccent()); } diff --git a/osu.Game/Graphics/Transforms/TransformAccent.cs b/osu.Game/Graphics/Transforms/TransformAccent.cs index 7f40a0a016..406d1ea9eb 100644 --- a/osu.Game/Graphics/Transforms/TransformAccent.cs +++ b/osu.Game/Graphics/Transforms/TransformAccent.cs @@ -29,7 +29,7 @@ namespace osu.Game.Graphics.Transforms { base.Apply(d); - var accented = d as IAccented; + var accented = d as IHasAccentColour; if (accented != null) accented.AccentColour = CurrentValue; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 00c189d01c..b2f76137fd 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -82,7 +82,7 @@ - + From a48224bd6dcc7e150e32518d487a96895f1f484e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 15:05:14 +0900 Subject: [PATCH 202/348] Don't need Drawable type. --- osu-framework | 2 +- osu.Game/Graphics/IHasAccentColour.cs | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu-framework b/osu-framework index 591b799f95..57821bd61c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 591b799f95a47e5da893c82d024e01311c9c37c6 +Subproject commit 57821bd61c7676c2fd9e8ff3ea314ec81c1eef41 diff --git a/osu.Game/Graphics/IHasAccentColour.cs b/osu.Game/Graphics/IHasAccentColour.cs index 19f063e29a..f959bc8760 100644 --- a/osu.Game/Graphics/IHasAccentColour.cs +++ b/osu.Game/Graphics/IHasAccentColour.cs @@ -22,15 +22,13 @@ namespace osu.Game.Graphics /// /// Tweens the accent colour of a drawable to another colour. /// - /// The type of drawable. - /// The drawable to apply the accent colour to. + /// The drawable to apply the accent colour to. /// The new accent colour. /// The tween duration. /// The tween easing. - public static void FadeAccent(this TDrawable drawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) - where TDrawable : Drawable, IHasAccentColour + public static void FadeAccent(this IHasAccentColour accentedDrawable, Color4 newColour, double duration = 0, EasingTypes easing = EasingTypes.None) { - drawable.TransformTo(drawable.AccentColour, newColour, duration, easing, new TransformAccent()); + accentedDrawable.TransformTo(accentedDrawable.AccentColour, newColour, duration, easing, new TransformAccent()); } } } From c531d774b7d77eda253cdbd1e459f27adec72060 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 15:21:30 +0900 Subject: [PATCH 203/348] Fix file naming. --- osu.Game/Modes/Replays/LegacyFramedReplay.cs | 4 ++-- osu.Game/Modes/Scoring/Score.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Modes/Replays/LegacyFramedReplay.cs b/osu.Game/Modes/Replays/LegacyFramedReplay.cs index 3e93751e09..3b99614f5e 100644 --- a/osu.Game/Modes/Replays/LegacyFramedReplay.cs +++ b/osu.Game/Modes/Replays/LegacyFramedReplay.cs @@ -10,9 +10,9 @@ namespace osu.Game.Modes.Replays /// /// Reads a replay from a legacy replay file (.osr v1) /// - public class LegacyReplay : FramedReplay + public class LegacyFramedReplay : FramedReplay { - public LegacyReplay(StreamReader reader) + public LegacyFramedReplay(StreamReader reader) { float lastTime = 0; diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index ab376ebdd6..70777a77ef 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -50,7 +50,7 @@ namespace osu.Game.Modes.Scoring /// /// The stream reader. /// The replay. - public virtual Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyReplay(reader); + public virtual Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyFramedReplay(reader); // [JsonProperty(@"count50")] 0, //[JsonProperty(@"count100")] 0, From 0f4b98ce7320825aefa7440a4d5c483f68aebc41 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 15:32:34 +0900 Subject: [PATCH 204/348] Move FramedReplayInputHandler to own file and un-nest. --- osu.Game/Modes/Replays/FramedReplay.cs | 141 ----------------- .../Modes/Replays/FramedReplayInputHandler.cs | 146 ++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 147 insertions(+), 141 deletions(-) create mode 100644 osu.Game/Modes/Replays/FramedReplayInputHandler.cs diff --git a/osu.Game/Modes/Replays/FramedReplay.cs b/osu.Game/Modes/Replays/FramedReplay.cs index 26144d1ed7..53b258e28b 100644 --- a/osu.Game/Modes/Replays/FramedReplay.cs +++ b/osu.Game/Modes/Replays/FramedReplay.cs @@ -1,16 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Input; -using osu.Framework.MathUtils; using osu.Game.Input.Handlers; -using OpenTK; -using OpenTK.Input; -using KeyboardState = osu.Framework.Input.KeyboardState; -using MouseState = osu.Framework.Input.MouseState; namespace osu.Game.Modes.Replays { @@ -19,138 +11,5 @@ namespace osu.Game.Modes.Replays protected List Frames = new List(); public override ReplayInputHandler CreateInputHandler() => new FramedReplayInputHandler(Frames); - - /// - /// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. - /// It handles logic of any frames which *must* be executed. - /// - public class FramedReplayInputHandler : ReplayInputHandler - { - private readonly List replayContent; - - public ReplayFrame CurrentFrame => !hasFrames ? null : replayContent[currentFrameIndex]; - public ReplayFrame NextFrame => !hasFrames ? null : replayContent[nextFrameIndex]; - - private int currentFrameIndex; - - private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, replayContent.Count - 1); - - public FramedReplayInputHandler(List replayContent) - { - this.replayContent = replayContent; - } - - private bool advanceFrame() - { - int newFrame = nextFrameIndex; - - //ensure we aren't at an extent. - if (newFrame == currentFrameIndex) return false; - - currentFrameIndex = newFrame; - return true; - } - - public void SetPosition(Vector2 pos) - { - } - - private Vector2? position - { - get - { - if (!hasFrames) - return null; - - return Interpolation.ValueAt(currentTime, CurrentFrame.Position, NextFrame.Position, CurrentFrame.Time, NextFrame.Time); - } - } - - public override List GetPendingStates() - { - var buttons = new HashSet(); - if (CurrentFrame?.MouseLeft ?? false) - buttons.Add(MouseButton.Left); - if (CurrentFrame?.MouseRight ?? false) - buttons.Add(MouseButton.Right); - - return new List - { - new InputState - { - Mouse = new ReplayMouseState(ToScreenSpace(position ?? Vector2.Zero), buttons), - Keyboard = new ReplayKeyboardState(new List()) - } - }; - } - - public bool AtLastFrame => currentFrameIndex == replayContent.Count - 1; - public bool AtFirstFrame => currentFrameIndex == 0; - - public Vector2 Size => new Vector2(512, 384); - - private const double sixty_frame_time = 1000.0 / 60; - - private double currentTime; - private int currentDirection; - - /// - /// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data. - /// Disabling this can make replay playback smoother (useful for autoplay, currently). - /// - public bool FrameAccuratePlayback = true; - - private bool hasFrames => replayContent.Count > 0; - - private bool inImportantSection => - FrameAccuratePlayback && - //a button is in a pressed state - ((currentDirection > 0 ? CurrentFrame : NextFrame)?.IsImportant ?? false) && - //the next frame is within an allowable time span - Math.Abs(currentTime - NextFrame?.Time ?? 0) <= sixty_frame_time * 1.2; - - /// - /// Update the current frame based on an incoming time value. - /// There are cases where we return a "must-use" time value that is different from the input. - /// This is to ensure accurate playback of replay data. - /// - /// The time which we should use for finding the current frame. - /// The usable time value. If null, we should not advance time as we do not have enough data. - public override double? SetFrameFromTime(double time) - { - currentDirection = time.CompareTo(currentTime); - if (currentDirection == 0) currentDirection = 1; - - if (hasFrames) - { - //if we changed frames, we want to execute once *exactly* on the frame's time. - if (currentDirection == time.CompareTo(NextFrame.Time) && advanceFrame()) - return currentTime = CurrentFrame.Time; - - //if we didn't change frames, we need to ensure we are allowed to run frames in between, else return null. - if (inImportantSection) - return null; - } - - return currentTime = time; - } - - protected class ReplayMouseState : MouseState - { - public ReplayMouseState(Vector2 position, IEnumerable list) - { - Position = position; - list.ForEach(b => PressedButtons.Add(b)); - } - } - - protected class ReplayKeyboardState : KeyboardState - { - public ReplayKeyboardState(List keys) - { - Keys = keys; - } - } - } } } \ No newline at end of file diff --git a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs b/osu.Game/Modes/Replays/FramedReplayInputHandler.cs new file mode 100644 index 0000000000..d72c023539 --- /dev/null +++ b/osu.Game/Modes/Replays/FramedReplayInputHandler.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Input; +using osu.Framework.MathUtils; +using osu.Game.Input.Handlers; +using OpenTK; +using OpenTK.Input; +using KeyboardState = osu.Framework.Input.KeyboardState; +using MouseState = osu.Framework.Input.MouseState; + +namespace osu.Game.Modes.Replays +{ + /// + /// The ReplayHandler will take a replay and handle the propagation of updates to the input stack. + /// It handles logic of any frames which *must* be executed. + /// + public class FramedReplayInputHandler : ReplayInputHandler + { + private readonly List replayContent; + + public ReplayFrame CurrentFrame => !hasFrames ? null : replayContent[currentFrameIndex]; + public ReplayFrame NextFrame => !hasFrames ? null : replayContent[nextFrameIndex]; + + private int currentFrameIndex; + + private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, replayContent.Count - 1); + + public FramedReplayInputHandler(List replayContent) + { + this.replayContent = replayContent; + } + + private bool advanceFrame() + { + int newFrame = nextFrameIndex; + + //ensure we aren't at an extent. + if (newFrame == currentFrameIndex) return false; + + currentFrameIndex = newFrame; + return true; + } + + public void SetPosition(Vector2 pos) + { + } + + private Vector2? position + { + get + { + if (!hasFrames) + return null; + + return Interpolation.ValueAt(currentTime, CurrentFrame.Position, NextFrame.Position, CurrentFrame.Time, NextFrame.Time); + } + } + + public override List GetPendingStates() + { + var buttons = new HashSet(); + if (CurrentFrame?.MouseLeft ?? false) + buttons.Add(MouseButton.Left); + if (CurrentFrame?.MouseRight ?? false) + buttons.Add(MouseButton.Right); + + return new List + { + new InputState + { + Mouse = new ReplayMouseState(ToScreenSpace(position ?? Vector2.Zero), buttons), + Keyboard = new ReplayKeyboardState(new List()) + } + }; + } + + public bool AtLastFrame => currentFrameIndex == replayContent.Count - 1; + public bool AtFirstFrame => currentFrameIndex == 0; + + public Vector2 Size => new Vector2(512, 384); + + private const double sixty_frame_time = 1000.0 / 60; + + private double currentTime; + private int currentDirection; + + /// + /// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data. + /// Disabling this can make replay playback smoother (useful for autoplay, currently). + /// + public bool FrameAccuratePlayback = true; + + private bool hasFrames => replayContent.Count > 0; + + private bool inImportantSection => + FrameAccuratePlayback && + //a button is in a pressed state + ((currentDirection > 0 ? CurrentFrame : NextFrame)?.IsImportant ?? false) && + //the next frame is within an allowable time span + Math.Abs(currentTime - NextFrame?.Time ?? 0) <= sixty_frame_time * 1.2; + + /// + /// Update the current frame based on an incoming time value. + /// There are cases where we return a "must-use" time value that is different from the input. + /// This is to ensure accurate playback of replay data. + /// + /// The time which we should use for finding the current frame. + /// The usable time value. If null, we should not advance time as we do not have enough data. + public override double? SetFrameFromTime(double time) + { + currentDirection = time.CompareTo(currentTime); + if (currentDirection == 0) currentDirection = 1; + + if (hasFrames) + { + //if we changed frames, we want to execute once *exactly* on the frame's time. + if (currentDirection == time.CompareTo(NextFrame.Time) && advanceFrame()) + return currentTime = CurrentFrame.Time; + + //if we didn't change frames, we need to ensure we are allowed to run frames in between, else return null. + if (inImportantSection) + return null; + } + + return currentTime = time; + } + + protected class ReplayMouseState : MouseState + { + public ReplayMouseState(Vector2 position, IEnumerable list) + { + Position = position; + list.ForEach(b => PressedButtons.Add(b)); + } + } + + protected class ReplayKeyboardState : KeyboardState + { + public ReplayKeyboardState(List keys) + { + Keys = keys; + } + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0bcbe9032f..a3ece6d5ca 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -98,6 +98,7 @@ + From fa7c72a0990c8b5f0ec19ec4c71bd1b821e790f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 15:59:53 +0900 Subject: [PATCH 205/348] Refactor ReplayInputHandler creation for more flexibility. --- osu.Game.Modes.Osu/OsuAutoReplay.cs | 2 +- osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Modes/Mods/Mod.cs | 2 +- osu.Game/Modes/Replays/FramedReplay.cs | 15 ---- .../Modes/Replays/FramedReplayInputHandler.cs | 23 +++--- osu.Game/Modes/Replays/LegacyFramedReplay.cs | 70 ------------------- osu.Game/Modes/Replays/Replay.cs | 6 +- osu.Game/Modes/Scoring/Score.cs | 28 +++++++- osu.Game/Modes/UI/HitRenderer.cs | 5 ++ osu.Game/OsuGame.cs | 2 +- osu.Game/Screens/Play/Player.cs | 20 ++---- osu.Game/Screens/Play/ReplayPlayer.cs | 23 ++++++ osu.Game/osu.Game.csproj | 5 +- 13 files changed, 84 insertions(+), 119 deletions(-) delete mode 100644 osu.Game/Modes/Replays/FramedReplay.cs delete mode 100644 osu.Game/Modes/Replays/LegacyFramedReplay.cs create mode 100644 osu.Game/Screens/Play/ReplayPlayer.cs diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index cc5859602a..ae85bd72d8 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -15,7 +15,7 @@ using osu.Game.Modes.Replays; namespace osu.Game.Modes.Osu { - public class OsuAutoReplay : FramedReplay + public class OsuAutoReplay : Replay { private static readonly Vector2 spinner_centre = new Vector2(256, 192); diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 096c0dcc29..5ce3ff273e 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -101,7 +101,7 @@ namespace osu.Game.Database using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize)) using (var reader = new StreamReader(lzma)) - score.Replay = score.CreateLegacyReplayFrom(reader); + score.Replay = score.CreateReplay(reader); } } diff --git a/osu.Game/Modes/Mods/Mod.cs b/osu.Game/Modes/Mods/Mod.cs index c53c6faa21..b6f09b8506 100644 --- a/osu.Game/Modes/Mods/Mod.cs +++ b/osu.Game/Modes/Mods/Mod.cs @@ -157,7 +157,7 @@ namespace osu.Game.Modes.Mods public void Apply(HitRenderer hitRenderer) { - hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.CreateInputHandler(); + hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay); } } diff --git a/osu.Game/Modes/Replays/FramedReplay.cs b/osu.Game/Modes/Replays/FramedReplay.cs deleted file mode 100644 index 53b258e28b..0000000000 --- a/osu.Game/Modes/Replays/FramedReplay.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 osu.Game.Input.Handlers; - -namespace osu.Game.Modes.Replays -{ - public abstract class FramedReplay : Replay - { - protected List Frames = new List(); - - public override ReplayInputHandler CreateInputHandler() => new FramedReplayInputHandler(Frames); - } -} \ No newline at end of file diff --git a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs b/osu.Game/Modes/Replays/FramedReplayInputHandler.cs index d72c023539..ae20ece515 100644 --- a/osu.Game/Modes/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Modes/Replays/FramedReplayInputHandler.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input; @@ -17,18 +20,20 @@ namespace osu.Game.Modes.Replays /// public class FramedReplayInputHandler : ReplayInputHandler { - private readonly List replayContent; + private readonly Replay replay; - public ReplayFrame CurrentFrame => !hasFrames ? null : replayContent[currentFrameIndex]; - public ReplayFrame NextFrame => !hasFrames ? null : replayContent[nextFrameIndex]; + protected List Frames => replay.Frames; + + public ReplayFrame CurrentFrame => !hasFrames ? null : Frames[currentFrameIndex]; + public ReplayFrame NextFrame => !hasFrames ? null : Frames[nextFrameIndex]; private int currentFrameIndex; - private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, replayContent.Count - 1); + private int nextFrameIndex => MathHelper.Clamp(currentFrameIndex + (currentDirection > 0 ? 1 : -1), 0, Frames.Count - 1); - public FramedReplayInputHandler(List replayContent) + public FramedReplayInputHandler(Replay replay) { - this.replayContent = replayContent; + this.replay = replay; } private bool advanceFrame() @@ -75,7 +80,7 @@ namespace osu.Game.Modes.Replays }; } - public bool AtLastFrame => currentFrameIndex == replayContent.Count - 1; + public bool AtLastFrame => currentFrameIndex == Frames.Count - 1; public bool AtFirstFrame => currentFrameIndex == 0; public Vector2 Size => new Vector2(512, 384); @@ -91,7 +96,7 @@ namespace osu.Game.Modes.Replays /// public bool FrameAccuratePlayback = true; - private bool hasFrames => replayContent.Count > 0; + private bool hasFrames => Frames.Count > 0; private bool inImportantSection => FrameAccuratePlayback && diff --git a/osu.Game/Modes/Replays/LegacyFramedReplay.cs b/osu.Game/Modes/Replays/LegacyFramedReplay.cs deleted file mode 100644 index 3b99614f5e..0000000000 --- a/osu.Game/Modes/Replays/LegacyFramedReplay.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.IO; -using osu.Game.IO.Legacy; - -namespace osu.Game.Modes.Replays -{ - /// - /// Reads a replay from a legacy replay file (.osr v1) - /// - public class LegacyFramedReplay : FramedReplay - { - public LegacyFramedReplay(StreamReader reader) - { - float lastTime = 0; - - foreach (var l in reader.ReadToEnd().Split(',')) - { - var split = l.Split('|'); - - if (split.Length < 4 || float.Parse(split[0]) < 0) continue; - - lastTime += float.Parse(split[0]); - - Frames.Add(new ReplayFrame( - lastTime, - float.Parse(split[1]), - 384 - float.Parse(split[2]), - (ReplayButtonState)int.Parse(split[3]) - )); - } - } - - public class LegacyReplayFrame : ReplayFrame - { - public LegacyReplayFrame(Stream s) : this(new SerializationReader(s)) - { - } - - public LegacyReplayFrame(SerializationReader sr) - { - ButtonState = (ReplayButtonState)sr.ReadByte(); - - byte bt = sr.ReadByte(); - if (bt > 0)//Handle Pre-Taiko compatible replays. - ButtonState = ReplayButtonState.Right1; - - MouseX = sr.ReadSingle(); - MouseY = sr.ReadSingle(); - Time = sr.ReadInt32(); - } - - public void ReadFromStream(SerializationReader sr) - { - throw new NotImplementedException(); - } - - public void WriteToStream(SerializationWriter sw) - { - sw.Write((byte)ButtonState); - sw.Write((byte)0); - sw.Write(MouseX); - sw.Write(MouseY); - sw.Write(Time); - } - } - } -} diff --git a/osu.Game/Modes/Replays/Replay.cs b/osu.Game/Modes/Replays/Replay.cs index c1ae952b77..62f60358e0 100644 --- a/osu.Game/Modes/Replays/Replay.cs +++ b/osu.Game/Modes/Replays/Replay.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Input.Handlers; +using System.Collections.Generic; namespace osu.Game.Modes.Replays { - public abstract class Replay + public class Replay { - public virtual ReplayInputHandler CreateInputHandler() => null; + public List Frames = new List(); } } \ No newline at end of file diff --git a/osu.Game/Modes/Scoring/Score.cs b/osu.Game/Modes/Scoring/Score.cs index 70777a77ef..c998b11f77 100644 --- a/osu.Game/Modes/Scoring/Score.cs +++ b/osu.Game/Modes/Scoring/Score.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Database; using osu.Game.Modes.Mods; @@ -46,11 +47,34 @@ namespace osu.Game.Modes.Scoring public DateTime Date; /// - /// Creates a legacy replay which is read from a stream. + /// Creates a replay which is read from a stream. /// /// The stream reader. /// The replay. - public virtual Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyFramedReplay(reader); + public virtual Replay CreateReplay(StreamReader reader) + { + var frames = new List(); + + float lastTime = 0; + + foreach (var l in reader.ReadToEnd().Split(',')) + { + var split = l.Split('|'); + + if (split.Length < 4 || float.Parse(split[0]) < 0) continue; + + lastTime += float.Parse(split[0]); + + frames.Add(new ReplayFrame( + lastTime, + float.Parse(split[1]), + 384 - float.Parse(split[2]), + (ReplayButtonState)int.Parse(split[3]) + )); + } + + return new Replay { Frames = frames }; + } // [JsonProperty(@"count50")] 0, //[JsonProperty(@"count100")] 0, diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 3d108b895d..8581d12244 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -14,6 +14,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; namespace osu.Game.Modes.UI @@ -68,6 +69,10 @@ namespace osu.Game.Modes.UI /// /// The input manager. protected virtual KeyConversionInputManager CreateKeyConversionInputManager() => new KeyConversionInputManager(); + + protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay); + + public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = CreateReplayInputHandler(replay); } /// diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 66196670b8..8ac86c5c67 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -125,7 +125,7 @@ namespace osu.Game Beatmap.Value = BeatmapDatabase.GetWorkingBeatmap(s.Beatmap); - menu.Push(new PlayerLoader(new Player { ReplayInputHandler = s.Replay.CreateInputHandler() })); + menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); } protected override void LoadComplete() diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0554c0e77b..73d397b24b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -15,7 +15,6 @@ using osu.Framework.Screens; using osu.Framework.Timing; using osu.Game.Configuration; using osu.Game.Database; -using osu.Game.Input.Handlers; using osu.Game.Modes; using osu.Game.Modes.UI; using osu.Game.Screens.Backgrounds; @@ -34,7 +33,7 @@ namespace osu.Game.Screens.Play internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused; - private bool hasReplayLoaded => hitRenderer.InputManager.ReplayInputHandler != null; + private bool hasReplayLoaded => HitRenderer.InputManager.ReplayInputHandler != null; public BeatmapInfo BeatmapInfo; @@ -53,7 +52,7 @@ namespace osu.Game.Screens.Play private Ruleset ruleset; private ScoreProcessor scoreProcessor; - private HitRenderer hitRenderer; + protected HitRenderer HitRenderer; private Bindable dimLevel; private SkipButton skipButton; @@ -112,9 +111,9 @@ namespace osu.Game.Screens.Play }); ruleset = Ruleset.GetRuleset(Beatmap.PlayMode); - hitRenderer = ruleset.CreateHitRendererWith(Beatmap); + HitRenderer = ruleset.CreateHitRendererWith(Beatmap); - scoreProcessor = hitRenderer.CreateScoreProcessor(); + scoreProcessor = HitRenderer.CreateScoreProcessor(); hudOverlay = new StandardHudOverlay(); hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); @@ -133,13 +132,10 @@ namespace osu.Game.Screens.Play }; - if (ReplayInputHandler != null) - hitRenderer.InputManager.ReplayInputHandler = ReplayInputHandler; - - hudOverlay.BindHitRenderer(hitRenderer); + hudOverlay.BindHitRenderer(HitRenderer); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) - hitRenderer.OnAllJudged += onCompletion; + HitRenderer.OnAllJudged += onCompletion; //bind ScoreProcessor to ourselves (for a fail situation) scoreProcessor.Failed += onFail; @@ -152,7 +148,7 @@ namespace osu.Game.Screens.Play Clock = interpolatedSourceClock, Children = new Drawable[] { - hitRenderer, + HitRenderer, skipButton = new SkipButton { Alpha = 0 @@ -336,8 +332,6 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; - public ReplayInputHandler ReplayInputHandler; - protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs new file mode 100644 index 0000000000..4593656a2e --- /dev/null +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Replays; + +namespace osu.Game.Screens.Play +{ + public class ReplayPlayer : Player + { + public Replay Replay; + + public ReplayPlayer(Replay replay) + { + Replay = replay; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + HitRenderer.SetReplay(Replay); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a3ece6d5ca..0dc2da48d1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -96,10 +96,9 @@ - + - @@ -125,7 +124,6 @@ - @@ -202,6 +200,7 @@ + From cf87330f802b20d5e838fd3bfc1f3fc881ef2a00 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 16:00:40 +0900 Subject: [PATCH 206/348] Allow SetReplay to receive null. --- osu.Game/Modes/UI/HitRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 8581d12244..62e3babd77 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -72,7 +72,7 @@ namespace osu.Game.Modes.UI protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay); - public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = CreateReplayInputHandler(replay); + public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null; } /// From 3f080ab424d80df7c9baf9dda602c916475f6c0c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 16:01:48 +0900 Subject: [PATCH 207/348] Add some commenting. --- osu.Game/Modes/UI/HitRenderer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index 62e3babd77..8c1e495c7a 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -72,6 +72,10 @@ namespace osu.Game.Modes.UI protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay); + /// + /// Sets a replay to be used, overriding local input. + /// + /// The replay, null for local input. public void SetReplay(Replay replay) => InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null; } From 75bdccdc3e5bbbb45478fd4f971c7aa2376c712c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 16:03:59 +0900 Subject: [PATCH 208/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 57821bd61c..415884e7e1 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 57821bd61c7676c2fd9e8ff3ea314ec81c1eef41 +Subproject commit 415884e7e19f9062a4fac457a7ce19b566fa2ee7 From 8f37d1ad91a4228e134d1db8c0d5520fcc30672f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 31 Mar 2017 16:20:31 +0900 Subject: [PATCH 209/348] Update to match new replay structure. --- osu.Game.Modes.Taiko/LegacyTaikoReplay.cs | 52 ------------------- osu.Game.Modes.Taiko/Mods/TaikoMod.cs | 1 + .../{ => Replays}/TaikoAutoReplay.cs | 43 +++++++-------- .../Replays/TaikoFramedReplayInputHandler.cs | 37 +++++++++++++ .../Scoring/TaikoScoreProcessor.cs | 9 ---- osu.Game.Modes.Taiko/TaikoScore.cs | 13 ----- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 4 ++ .../osu.Game.Modes.Taiko.csproj | 5 +- 8 files changed, 66 insertions(+), 98 deletions(-) delete mode 100644 osu.Game.Modes.Taiko/LegacyTaikoReplay.cs rename osu.Game.Modes.Taiko/{ => Replays}/TaikoAutoReplay.cs (65%) create mode 100644 osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs delete mode 100644 osu.Game.Modes.Taiko/TaikoScore.cs diff --git a/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs b/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs deleted file mode 100644 index 38a28270b3..0000000000 --- a/osu.Game.Modes.Taiko/LegacyTaikoReplay.cs +++ /dev/null @@ -1,52 +0,0 @@ -// 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.IO; -using osu.Framework.Input; -using osu.Game.Input.Handlers; -using OpenTK.Input; - -namespace osu.Game.Modes.Taiko -{ - public class LegacyTaikoReplay : LegacyReplay - { - protected LegacyTaikoReplay() - { - } - - public LegacyTaikoReplay(StreamReader reader) - : base(reader) - { - } - - public override ReplayInputHandler CreateInputHandler() => new LegacyTaikoReplayInputHandler(Frames); - - private class LegacyTaikoReplayInputHandler : LegacyReplayInputHandler - { - public LegacyTaikoReplayInputHandler(List replayContent) - : base(replayContent) - { - } - - public override List GetPendingStates() - { - var keys = new List(); - - if (CurrentFrame?.MouseRight1 == true) - keys.Add(Key.F); - if (CurrentFrame?.MouseRight2 == true) - keys.Add(Key.J); - if (CurrentFrame?.MouseLeft1 == true) - keys.Add(Key.D); - if (CurrentFrame?.MouseLeft2 == true) - keys.Add(Key.K); - - return new List - { - new InputState { Keyboard = new ReplayKeyboardState(keys) } - }; - } - } - } -} diff --git a/osu.Game.Modes.Taiko/Mods/TaikoMod.cs b/osu.Game.Modes.Taiko/Mods/TaikoMod.cs index 79370f58ee..422f0ec250 100644 --- a/osu.Game.Modes.Taiko/Mods/TaikoMod.cs +++ b/osu.Game.Modes.Taiko/Mods/TaikoMod.cs @@ -5,6 +5,7 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Mods; using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Replays; using osu.Game.Users; namespace osu.Game.Modes.Taiko.Mods diff --git a/osu.Game.Modes.Taiko/TaikoAutoReplay.cs b/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs similarity index 65% rename from osu.Game.Modes.Taiko/TaikoAutoReplay.cs rename to osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs index b30f26a9d3..c8a93c9068 100644 --- a/osu.Game.Modes.Taiko/TaikoAutoReplay.cs +++ b/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs @@ -1,14 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Objects.Types; -using osu.Game.Beatmaps; using System; +using osu.Game.Beatmaps; +using osu.Game.Modes.Objects.Types; +using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Replays; -namespace osu.Game.Modes.Taiko +namespace osu.Game.Modes.Taiko.Replays { - public class TaikoAutoReplay : LegacyTaikoReplay + public class TaikoAutoReplay : Replay { private readonly Beatmap beatmap; @@ -23,14 +24,14 @@ namespace osu.Game.Modes.Taiko { bool hitButton = true; - Frames.Add(new LegacyReplayFrame(-100000, 320, 240, LegacyButtonState.None)); - Frames.Add(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, LegacyButtonState.None)); + Frames.Add(new ReplayFrame(-100000, 320, 240, ReplayButtonState.None)); + Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, ReplayButtonState.None)); for (int i = 0; i < beatmap.HitObjects.Count; i++) { TaikoHitObject h = beatmap.HitObjects[i]; - LegacyButtonState button; + ReplayButtonState button; IHasEndTime endTimeData = h as IHasEndTime; double endTime = endTimeData?.EndTime ?? h.StartTime; @@ -50,20 +51,20 @@ namespace osu.Game.Modes.Taiko switch (d) { default: - button = LegacyButtonState.Left1; + button = ReplayButtonState.Left1; break; case 1: - button = LegacyButtonState.Right1; + button = ReplayButtonState.Right1; break; case 2: - button = LegacyButtonState.Left2; + button = ReplayButtonState.Left2; break; case 3: - button = LegacyButtonState.Right2; + button = ReplayButtonState.Right2; break; } - Frames.Add(new LegacyReplayFrame(j, 0, 0, button)); + Frames.Add(new ReplayFrame(j, 0, 0, button)); d = (d + 1) % 4; if (++count > req) break; @@ -77,7 +78,7 @@ namespace osu.Game.Modes.Taiko for (int j = 0; j < drumRoll.TotalTicks; j++) { - Frames.Add(new LegacyReplayFrame((int)time, 0, 0, hitButton ? LegacyButtonState.Left1 : LegacyButtonState.Left2)); + Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); time += delay; hitButton = !hitButton; } @@ -87,30 +88,30 @@ namespace osu.Game.Modes.Taiko if (hit is CentreHit) { if (h.IsStrong) - button = LegacyButtonState.Right1 | LegacyButtonState.Right2; + button = ReplayButtonState.Right1 | ReplayButtonState.Right2; else - button = hitButton ? LegacyButtonState.Right1 : LegacyButtonState.Right2; + button = hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2; } else { if (h.IsStrong) - button = LegacyButtonState.Left1 | LegacyButtonState.Left2; + button = ReplayButtonState.Left1 | ReplayButtonState.Left2; else - button = hitButton ? LegacyButtonState.Left1 : LegacyButtonState.Left2; + button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2; } - Frames.Add(new LegacyReplayFrame(h.StartTime, 0, 0, button)); + Frames.Add(new ReplayFrame(h.StartTime, 0, 0, button)); } else throw new Exception("Unknown hit object type."); - Frames.Add(new LegacyReplayFrame(endTime + 1, 0, 0, LegacyButtonState.None)); + Frames.Add(new ReplayFrame(endTime + 1, 0, 0, ReplayButtonState.None)); if (i < beatmap.HitObjects.Count - 1) { double waitTime = beatmap.HitObjects[i + 1].StartTime - 1000; if (waitTime > endTime) - Frames.Add(new LegacyReplayFrame(waitTime, 0, 0, LegacyButtonState.None)); + Frames.Add(new ReplayFrame(waitTime, 0, 0, ReplayButtonState.None)); } hitButton = !hitButton; diff --git a/osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs new file mode 100644 index 0000000000..44fca4abe7 --- /dev/null +++ b/osu.Game.Modes.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Modes.Replays; +using System.Collections.Generic; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Modes.Taiko.Replays +{ + internal class TaikoFramedReplayInputHandler : FramedReplayInputHandler + { + public TaikoFramedReplayInputHandler(Replay replay) + : base(replay) + { + } + + public override List GetPendingStates() + { + var keys = new List(); + + if (CurrentFrame?.MouseRight1 == true) + keys.Add(Key.F); + if (CurrentFrame?.MouseRight2 == true) + keys.Add(Key.J); + if (CurrentFrame?.MouseLeft1 == true) + keys.Add(Key.D); + if (CurrentFrame?.MouseLeft2 == true) + keys.Add(Key.K); + + return new List + { + new InputState { Keyboard = new ReplayKeyboardState(keys) } + }; + } + } +} diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index ad9392a72e..2ab31c5efb 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -119,15 +119,6 @@ namespace osu.Game.Modes.Taiko.Scoring { } - public override Score CreateScore() => new TaikoScore - { - TotalScore = TotalScore, - Combo = Combo, - MaxCombo = HighestCombo, - Accuracy = Accuracy, - Health = Health, - }; - protected override void ComputeTargets(Beatmap beatmap) { double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, 0.5, 0.75, 0.98)); diff --git a/osu.Game.Modes.Taiko/TaikoScore.cs b/osu.Game.Modes.Taiko/TaikoScore.cs deleted file mode 100644 index 2d5c3e750b..0000000000 --- a/osu.Game.Modes.Taiko/TaikoScore.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Modes.Scoring; -using System.IO; - -namespace osu.Game.Modes.Taiko -{ - public class TaikoScore : Score - { - public override Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyTaikoReplay(reader); - } -} diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 3266b5c030..e70e2d3811 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -3,10 +3,12 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Replays; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; @@ -28,5 +30,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Playfield CreatePlayfield() => new TaikoPlayfield(); protected override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) => null; + + protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay); } } diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index f00253b53e..4e42ea5761 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -52,7 +52,6 @@ - @@ -74,12 +73,12 @@ - + + - From 24d06fa92d69ba69c69fa707a18b4153a60030a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 17:38:33 +0900 Subject: [PATCH 210/348] CheckBox -> Checkbox. --- osu.Game/Graphics/UserInterface/Nub.cs | 10 +++++----- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 12 ++++++------ osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 6 +++--- .../Graphics/UserInterface/OsuTabControlCheckBox.cs | 12 ++++++------ .../Screens/Select/BeatmapDetailAreaTabControl.cs | 6 +++--- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 06e3be5c15..e150c7dc07 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface { - public class Nub : CircularContainer, IStateful + public class Nub : CircularContainer, IStateful { public const float COLLAPSED_SIZE = 20; public const float EXPANDED_SIZE = 40; @@ -84,9 +84,9 @@ namespace osu.Game.Graphics.UserInterface } } - private CheckBoxState state; + private CheckboxState state; - public CheckBoxState State + public CheckboxState State { get { @@ -98,10 +98,10 @@ namespace osu.Game.Graphics.UserInterface switch (state) { - case CheckBoxState.Checked: + case CheckboxState.Checked: fill.FadeIn(200, EasingTypes.OutQuint); break; - case CheckBoxState.Unchecked: + case CheckboxState.Unchecked: fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times break; } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 2209c96689..fc44d80ea6 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -16,7 +16,7 @@ using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { - public class OsuCheckbox : CheckBox + public class OsuCheckbox : Checkbox { private Bindable bindable; @@ -29,9 +29,9 @@ namespace osu.Game.Graphics.UserInterface bindable = value; if (bindable != null) { - bool state = State == CheckBoxState.Checked; + bool state = State == CheckboxState.Checked; if (state != bindable.Value) - State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; bindable.ValueChanged += bindableValueChanged; } @@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface private void bindableValueChanged(object sender, EventArgs e) { - State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; } protected override void Dispose(bool isDisposing) @@ -122,7 +122,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnChecked() { sampleChecked?.Play(); - nub.State = CheckBoxState.Checked; + nub.State = CheckboxState.Checked; if (bindable != null) bindable.Value = true; @@ -131,7 +131,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnUnchecked() { sampleUnchecked?.Play(); - nub.State = CheckBoxState.Unchecked; + nub.State = CheckboxState.Unchecked; if (bindable != null) bindable.Value = false; diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index b7d46cd409..078c8564d7 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -50,7 +50,7 @@ namespace osu.Game.Graphics.UserInterface nub = new Nub { Origin = Anchor.TopCentre, - State = CheckBoxState.Unchecked, + State = CheckboxState.Unchecked, Expanded = true, } }; @@ -94,13 +94,13 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - nub.State = CheckBoxState.Checked; + nub.State = CheckboxState.Checked; return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - nub.State = CheckBoxState.Unchecked; + nub.State = CheckboxState.Unchecked; return base.OnMouseUp(state, args); } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index f9d14f3b09..5914d0ba4c 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -16,15 +16,15 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { /// - /// A checkbox styled to be placed in line with an + /// A Checkbox styled to be placed in line with an /// - public class OsuTabControlCheckBox : CheckBox + public class OsuTabControlCheckbox : Checkbox { private readonly Box box; private readonly SpriteText text; private readonly TextAwesome icon; - public event EventHandler Action; + public event EventHandler Action; private Color4? accentColour; public Color4 AccentColour @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface { accentColour = value; - if (State != CheckBoxState.Checked) + if (State != CheckboxState.Checked) { text.Colour = AccentColour; icon.Colour = AccentColour; @@ -84,7 +84,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(InputState state) { - if (State == CheckBoxState.Unchecked) + if (State == CheckboxState.Unchecked) fadeOut(); base.OnHoverLost(state); @@ -97,7 +97,7 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Blue; } - public OsuTabControlCheckBox() + public OsuTabControlCheckbox() { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 9dc8de96d1..088346d91f 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -17,14 +17,14 @@ namespace osu.Game.Screens.Select public class BeatmapDetailAreaTabControl : Container { public static readonly float HEIGHT = 24; - private readonly OsuTabControlCheckBox modsCheckbox; + private readonly OsuTabControlCheckbox modsCheckbox; private readonly OsuTabControl tabs; public Action OnFilter; //passed the selected tab and if mods is checked private void invokeOnFilter() { - OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckBoxState.Checked); + OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckboxState.Checked); } [BackgroundDependencyLoader] @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, }, - modsCheckbox = new OsuTabControlCheckBox + modsCheckbox = new OsuTabControlCheckbox { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, From 2b847aa2f46488e4933c869fdabd6552a93f7b88 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 17:55:07 +0900 Subject: [PATCH 211/348] Bring VisualTests up-to-date. --- osu-framework | 2 +- .../{BenchmarkTest.cs => VisualTests.cs} | 6 +-- osu.Desktop.Tests/osu.Desktop.Tests.csproj | 2 +- .../AutomatedVisualTestGame.cs | 16 +++++++ osu.Desktop.VisualTests/Benchmark.cs | 45 ------------------- osu.Desktop.VisualTests/Program.cs | 2 +- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 2 +- .../Tests/TestCaseDialogOverlay.cs | 4 +- .../Tests/TestCaseHitObjects.cs | 29 +++++++----- .../Tests/TestCaseKeyCounter.cs | 26 ++++++++--- .../Tests/TestCaseLeaderboard.cs | 2 +- .../Tests/TestCaseModSelectOverlay.cs | 10 ++--- .../Tests/TestCaseMusicController.cs | 2 +- .../Tests/TestCaseNotificationManager.cs | 12 ++--- .../Tests/TestCasePauseOverlay.cs | 4 +- .../Tests/TestCasePlaySongSelect.cs | 13 ++---- .../Tests/TestCaseScoreCounter.cs | 10 ++--- .../Tests/TestCaseTaikoHitObjects.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 14 +++--- .../osu.Desktop.VisualTests.csproj | 2 +- 20 files changed, 96 insertions(+), 109 deletions(-) rename osu.Desktop.Tests/{BenchmarkTest.cs => VisualTests.cs} (83%) create mode 100644 osu.Desktop.VisualTests/AutomatedVisualTestGame.cs delete mode 100644 osu.Desktop.VisualTests/Benchmark.cs diff --git a/osu-framework b/osu-framework index 415884e7e1..50b62716b1 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 415884e7e19f9062a4fac457a7ce19b566fa2ee7 +Subproject commit 50b62716b16359ce4f51110ef0d21169533ec76a diff --git a/osu.Desktop.Tests/BenchmarkTest.cs b/osu.Desktop.Tests/VisualTests.cs similarity index 83% rename from osu.Desktop.Tests/BenchmarkTest.cs rename to osu.Desktop.Tests/VisualTests.cs index 6d001655ec..6519dbe917 100644 --- a/osu.Desktop.Tests/BenchmarkTest.cs +++ b/osu.Desktop.Tests/VisualTests.cs @@ -13,10 +13,10 @@ using osu.Game.Modes.Taiko; namespace osu.Desktop.Tests { [TestFixture] - public class BenchmarkTest + public class VisualTests { [Test] - public void TestBenchmark() + public void TestVisualTests() { using (var host = new HeadlessGameHost()) { @@ -25,7 +25,7 @@ namespace osu.Desktop.Tests Ruleset.Register(new ManiaRuleset()); Ruleset.Register(new CatchRuleset()); - host.Run(new Benchmark()); + host.Run(new AutomatedVisualTestGame()); } } } diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index ad69994592..d1b20bd161 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -56,7 +56,7 @@ - + diff --git a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs new file mode 100644 index 0000000000..0bce2ddc67 --- /dev/null +++ b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Game; + +namespace osu.Desktop.VisualTests +{ + public class AutomatedVisualTestGame : OsuGameBase + { + public AutomatedVisualTestGame() + { + Add(new TestRunner(new TestBrowser())); + } + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs deleted file mode 100644 index 884dff9f7a..0000000000 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using osu.Framework.Allocation; -using osu.Framework.Testing; -using osu.Game; - -namespace osu.Desktop.VisualTests -{ - public class Benchmark : OsuGameBase - { - private const double time_per_test = 200; - - [BackgroundDependencyLoader] - private void load() - { - Host.MaximumDrawHz = int.MaxValue; - Host.MaximumUpdateHz = int.MaxValue; - Host.MaximumInactiveHz = int.MaxValue; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - TestBrowser f = new TestBrowser(); - Add(f); - - Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {time_per_test}ms each..."); - - for (int i = 1; i < f.TestCount; i++) - { - int loadableCase = i; - Scheduler.AddDelayed(delegate - { - f.LoadTest(loadableCase); - Console.WriteLine($@"{Time}: Switching to test #{loadableCase}"); - }, loadableCase * time_per_test); - } - - Scheduler.AddDelayed(Host.Exit, f.TestCount * time_per_test); - } - } -} diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 6760852cf0..fe1cdfd7f0 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -27,7 +27,7 @@ namespace osu.Desktop.VisualTests Ruleset.Register(new CatchRuleset()); if (benchmark) - host.Run(new Benchmark()); + host.Run(new AutomatedVisualTestGame()); else host.Run(new VisualTestGame()); } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index 3fc6ce10e7..7c211227c6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Desktop.VisualTests.Tests Add(overlay); - AddButton(@"Toggle", overlay.ToggleVisibility); + AddStep(@"Toggle", overlay.ToggleVisibility); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 3ae5929ecc..90e214c3c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -20,7 +20,7 @@ namespace osu.Desktop.VisualTests.Tests Add(overlay = new DialogOverlay()); - AddButton("dialog #1", () => overlay.Push(new PopupDialog + AddStep("dialog #1", () => overlay.Push(new PopupDialog { Icon = FontAwesome.fa_trash_o, HeaderText = @"Confirm deletion of", @@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests }, })); - AddButton("dialog #2", () => overlay.Push(new PopupDialog + AddStep("dialog #2", () => overlay.Push(new PopupDialog { Icon = FontAwesome.fa_gear, HeaderText = @"What do you want to do with", diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 8818240b2d..cb7a3e3f84 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -93,19 +93,28 @@ namespace osu.Desktop.VisualTests.Tests playbackSpeed.TriggerChange(); - AddButton(@"circles", () => load(HitObjectType.Circle)); - AddButton(@"slider", () => load(HitObjectType.Slider)); - AddButton(@"spinner", () => load(HitObjectType.Spinner)); + AddStep(@"circles", () => load(HitObjectType.Circle)); + AddStep(@"slider", () => load(HitObjectType.Slider)); + AddStep(@"spinner", () => load(HitObjectType.Spinner)); - AddToggle(@"auto", state => { auto = state; load(mode); }); + AddToggleStep(@"auto", state => { auto = state; load(mode); }); - ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); - ButtonsContainer.Add(new BasicSliderBar + Add(new Container { - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - Bindable = playbackSpeed + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SpriteText { Text = "Playback Speed" }, + new BasicSliderBar + { + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Bindable = playbackSpeed + } + } }); framedClock.ProcessFrame(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 051db489e9..3dba201f5d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using OpenTK.Input; using osu.Framework.Graphics.UserInterface; using osu.Framework.Configuration; +using osu.Framework.Graphics.Containers; using OpenTK; using OpenTK.Graphics; using osu.Framework.MathUtils; @@ -37,19 +38,30 @@ namespace osu.Desktop.VisualTests.Tests }; BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 200, Default = 50 }; bindable.ValueChanged += delegate { kc.FadeTime = bindable.Value; }; - AddButton("Add Random", () => + AddStep("Add Random", () => { Key key = (Key)((int)Key.A + RNG.Next(26)); kc.Add(new KeyCounterKeyboard(key)); }); - ButtonsContainer.Add(new SpriteText { Text = "FadeTime" }); - ButtonsContainer.Add(new TestSliderBar + + Add(new Container { - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - Bindable = bindable + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SpriteText { Text = "FadeTime" }, + new TestSliderBar + { + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Bindable = bindable + } + } }); + Add(kc); } private class TestSliderBar : SliderBar where T : struct diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index c985375873..44e52c237e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -218,7 +218,7 @@ namespace osu.Desktop.VisualTests.Tests Size = new Vector2(550f, 450f), }); - AddButton(@"New Scores", newScores); + AddStep(@"New Scores", newScores); newScores(); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index 73f8ed6242..7677682ac8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -25,11 +25,11 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.BottomCentre, }); - AddButton("Toggle", modSelect.ToggleVisibility); - AddButton("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu); - AddButton("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko); - AddButton("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch); - AddButton("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania); + AddStep("Toggle", modSelect.ToggleVisibility); + AddStep("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu); + AddStep("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko); + AddStep("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch); + AddStep("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 305aa24252..c0c17cd50e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.Centre }; Add(mc); - AddToggle(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); + AddToggleStep(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 990052012f..8972040b06 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -30,13 +30,13 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopRight, }); - AddToggle(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden); + AddToggleStep(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden); - AddButton(@"simple #1", sendNotification1); - AddButton(@"simple #2", sendNotification2); - AddButton(@"progress #1", sendProgress1); - AddButton(@"progress #2", sendProgress2); - AddButton(@"barrage", () => sendBarrage()); + AddStep(@"simple #1", sendNotification1); + AddStep(@"simple #2", sendNotification2); + AddStep(@"progress #1", sendProgress1); + AddStep(@"progress #2", sendProgress2); + AddStep(@"barrage", () => sendBarrage()); } private void sendBarrage(int remaining = 100) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 09e2dc38aa..ebf6e0c350 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -25,8 +25,8 @@ namespace osu.Desktop.VisualTests.Tests OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit") }); - AddButton("Pause", pauseOverlay.Show); - AddButton("Add Retry", delegate + AddStep("Pause", pauseOverlay.Show); + AddStep("Add Retry", delegate { retryCount++; pauseOverlay.Retries = retryCount; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 16f7881dcd..aedab7e895 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -23,12 +23,10 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); - oldDb = Dependencies.Get(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); db = new BeatmapDatabase(storage); - Dependencies.Cache(db, true); var sets = new List(); @@ -40,19 +38,16 @@ namespace osu.Desktop.VisualTests.Tests Add(songSelect = new PlaySongSelect()); - AddButton(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); - AddButton(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); - AddButton(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); - AddButton(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); + AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); + AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); + AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); + AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } protected override void Dispose(bool isDisposing) { if (oldDb != null) - { - Dependencies.Cache(oldDb, true); db = null; - } base.Dispose(isDisposing); } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index cca87cd12b..55fc969217 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -68,7 +68,7 @@ namespace osu.Desktop.VisualTests.Tests }; Add(starsLabel); - AddButton(@"Reset all", delegate + AddStep(@"Reset all", delegate { score.Current.Value = 0; comboCounter.Current.Value = 0; @@ -78,7 +78,7 @@ namespace osu.Desktop.VisualTests.Tests starsLabel.Text = stars.Count.ToString("0.00"); }); - AddButton(@"Hit! :D", delegate + AddStep(@"Hit! :D", delegate { score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0); comboCounter.Increment(); @@ -86,20 +86,20 @@ namespace osu.Desktop.VisualTests.Tests accuracyCounter.SetFraction(numerator, denominator); }); - AddButton(@"miss...", delegate + AddStep(@"miss...", delegate { comboCounter.Current.Value = 0; denominator++; accuracyCounter.SetFraction(numerator, denominator); }); - AddButton(@"Alter stars", delegate + AddStep(@"Alter stars", delegate { stars.Count = RNG.NextSingle() * (stars.StarCount + 1); starsLabel.Text = stars.Count.ToString("0.00"); }); - AddButton(@"Stop counters", delegate + AddStep(@"Stop counters", delegate { score.StopRolling(); comboCounter.StopRolling(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index e8e32ebf3d..4005c94b5a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - AddToggle("Kiai", b => + AddToggleStep("Kiai", b => { kiai = !kiai; Reset(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 223f9ce5f8..c0aa3af176 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -24,13 +24,13 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - AddButton("Hit!", addHitJudgement); - AddButton("Miss :(", addMissJudgement); - AddButton("Swell", addSwell); - AddButton("Centre", () => addCentreHit(false)); - AddButton("Strong Centre", () => addCentreHit(true)); - AddButton("Rim", () => addRimHit(false)); - AddButton("Strong Rim", () => addRimHit(true)); + AddStep("Hit!", addHitJudgement); + AddStep("Miss :(", addMissJudgement); + AddStep("Swell", addSwell); + AddStep("Centre", () => addCentreHit(false)); + AddStep("Strong Centre", () => addCentreHit(true)); + AddStep("Rim", () => addRimHit(false)); + AddStep("Strong Rim", () => addRimHit(true)); Add(new Container { diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 9f3cd6b3c4..1baf322750 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -184,7 +184,7 @@ - + From 01538ed7d7c9bac1ec370132702c683e24069cab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 18:05:24 +0900 Subject: [PATCH 212/348] Fix nullref. --- osu.Desktop.VisualTests/AutomatedVisualTestGame.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs index 0bce2ddc67..b08588b29c 100644 --- a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs +++ b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs @@ -8,8 +8,12 @@ namespace osu.Desktop.VisualTests { public class AutomatedVisualTestGame : OsuGameBase { - public AutomatedVisualTestGame() + protected override void LoadComplete() { + base.LoadComplete(); + + // Have to construct this here, rather than in the constructor, because + // we depend on some dependencies to be loaded within OsuGameBase.load(). Add(new TestRunner(new TestBrowser())); } } From 904efb291638160e22f349b04edfed1cc8e187f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 18:13:24 +0900 Subject: [PATCH 213/348] Update framework again. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 50b62716b1..bf6a3dc401 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 50b62716b16359ce4f51110ef0d21169533ec76a +Subproject commit bf6a3dc40176ee4f921012808070e014fc4a5779 From d7c39a00b43100038207f9f75108ecfee4fba6d0 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 31 Mar 2017 16:43:31 +0300 Subject: [PATCH 214/348] Hud Visibility --- osu.Game/Configuration/OsuConfigManager.cs | 2 +- osu.Game/Modes/UI/HudOverlay.cs | 24 ++++++++++++-- .../Sections/Gameplay/GeneralOptions.cs | 5 +++ osu.Game/Screens/Play/Player.cs | 32 +++++++++++++++++-- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 6190678e1e..61397d2bee 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -36,6 +36,7 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); Set(OsuConfig.KeyOverlay, false); + Set(OsuConfig.ShowInterface, true); //todo: implement all settings below this line (remove the Disabled set when doing so). Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; @@ -89,7 +90,6 @@ namespace osu.Game.Configuration Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true; Set(OsuConfig.LoadSubmittedThread, true).Disabled = true; Set(OsuConfig.LobbyPlayMode, -1).Disabled = true; - Set(OsuConfig.ShowInterface, true).Disabled = true; Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true; Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true; Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true; diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index a6c54e7f3a..42d789c741 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -22,6 +22,9 @@ namespace osu.Game.Modes.UI public readonly HealthDisplay HealthDisplay; private Bindable showKeyCounter; + private Bindable showHud; + + public bool IsVisible => showHud; protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); @@ -47,11 +50,15 @@ namespace osu.Game.Modes.UI private void load(OsuConfigManager config) { showKeyCounter = config.GetBindable(OsuConfig.KeyOverlay); - showKeyCounter.ValueChanged += visibilityChanged; + showKeyCounter.ValueChanged += keyCounterVisibilityChanged; showKeyCounter.TriggerChange(); + + showHud = config.GetBindable(OsuConfig.ShowInterface); + showHud.ValueChanged += hudVisibilityChanged; + showHud.TriggerChange(); } - private void visibilityChanged(object sender, EventArgs e) + private void keyCounterVisibilityChanged(object sender, EventArgs e) { if (showKeyCounter) KeyCounter.Show(); @@ -59,6 +66,19 @@ namespace osu.Game.Modes.UI KeyCounter.Hide(); } + private void hudVisibilityChanged(object sender, EventArgs e) + { + if (showHud) + Show(); + else + Hide(); + } + + public void ChangeVisibility() + { + showHud.Value = !showHud.Value; + } + public void BindProcessor(ScoreProcessor processor) { //bind processor bindables to combocounter, score display etc. diff --git a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs index 70a2c52322..ee6778a47a 100644 --- a/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Gameplay/GeneralOptions.cs @@ -39,6 +39,11 @@ namespace osu.Game.Overlays.Options.Sections.Gameplay Bindable = (BindableDouble)config.GetBindable(OsuConfig.ScoreMeterScale) }, new OsuCheckbox + { + LabelText = "Show score overlay", + Bindable = config.GetBindable(OsuConfig.ShowInterface) + }, + new OsuCheckbox { LabelText = "Always show key overlay", Bindable = config.GetBindable(OsuConfig.KeyOverlay) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 73d397b24b..592d4a9433 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,6 +22,9 @@ using osu.Game.Screens.Ranking; using System; using System.Linq; using osu.Game.Modes.Scoring; +using osu.Game.Overlays; +using osu.Game.Overlays.Notifications; +using OpenTK.Input; namespace osu.Game.Screens.Play { @@ -59,8 +62,8 @@ namespace osu.Game.Screens.Play private HudOverlay hudOverlay; private PauseOverlay pauseOverlay; - [BackgroundDependencyLoader] - private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) + [BackgroundDependencyLoader(true)] + private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, NotificationManager notificationManager) { var beatmap = Beatmap.Beatmap; @@ -158,6 +161,14 @@ namespace osu.Game.Screens.Play hudOverlay, pauseOverlay }; + + if (!hudOverlay.IsVisible) + { + notificationManager?.Post(new SimpleNotification + { + Text = @"The score overlay is currently disabled. You can toogle this by pressing Shift + Tab." + }); + } } private void initializeSkipButton() @@ -333,5 +344,22 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (state.Keyboard.ShiftPressed) + { + switch (args.Key) + { + case Key.Tab: + hudOverlay.ChangeVisibility(); + return true; + } + } + + return base.OnKeyDown(state, args); + } } } \ No newline at end of file From 782c6bf28ecb12d12be14706623fcaa9b469bd08 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 1 Apr 2017 16:07:54 +0900 Subject: [PATCH 215/348] Remove unnecessary usings. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 2 -- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 664c0bf30a..2557875c84 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -3,10 +3,8 @@ using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Game.Graphics; using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4cc959215f..74f59f3fdb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; using osu.Game.Modes.Objects.Drawables; From d1e3bbb5f42c4b2d2d7105ee5a42529be71048ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 1 Apr 2017 16:12:27 +0900 Subject: [PATCH 216/348] Don't call Reset() from within TestCaseTaikoHitObjects. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 2557875c84..7aeb75ef8d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; @@ -22,7 +23,7 @@ namespace osu.Desktop.VisualTests.Tests AddToggleStep("Kiai", b => { kiai = !kiai; - Reset(); + updateKiaiState(); }); Add(new CirclePiece @@ -102,6 +103,12 @@ namespace osu.Desktop.VisualTests.Tests }); } + private void updateKiaiState() + { + foreach (var c in Children.OfType()) + c.KiaiMode = kiai; + } + private abstract class BaseCircle : Container { protected readonly CirclePiece Piece; From b5ef0ae0d8a2e37256bc41f665d154e87902e130 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 1 Apr 2017 16:32:31 +0900 Subject: [PATCH 217/348] consecutiveHits -> rollingHits. --- .../Objects/Drawable/DrawableDrumRoll.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index 6b1c4f546b..9374864003 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -17,9 +17,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable public class DrawableDrumRoll : DrawableTaikoHitObject { /// - /// Number of consecutive hits required to reach the dark/final accent colour. + /// Number of rolling hits required to reach the dark/final accent colour. /// - private const int consecutive_hits_for_dark_accent = 5; + private const int rolling_hits_for_dark_accent = 5; private readonly DrumRoll drumRoll; @@ -28,9 +28,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private Color4 accentDarkColour; /// - /// Number of consecutive tick hits. + /// Rolling number of tick hits. This increases for hits and increases for misses. /// - private int consecutiveHits; + private int rollingHits; public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) @@ -77,13 +77,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private void onTickJudgement(DrawableHitObject obj) { if (obj.Judgement.Result == HitResult.Hit) - consecutiveHits++; + rollingHits++; else - consecutiveHits--; + rollingHits--; - consecutiveHits = MathHelper.Clamp(consecutiveHits, 0, consecutive_hits_for_dark_accent); + rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent); - Color4 newAccent = Interpolation.ValueAt((float)consecutiveHits / consecutive_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1); + Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1); circle.FadeAccent(newAccent, 100); } From efb589cc089b7ea87bfda2865427f12536229aa4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 1 Apr 2017 16:34:30 +0900 Subject: [PATCH 218/348] (de)creases for misses. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index 9374864003..4697625c5e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -28,7 +28,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable private Color4 accentDarkColour; /// - /// Rolling number of tick hits. This increases for hits and increases for misses. + /// Rolling number of tick hits. This increases for hits and decreases for misses. /// private int rollingHits; From 9d027a61cd6b44ec6c278bf008145e78c2c9bbad Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 14:46:45 +0300 Subject: [PATCH 219/348] Move input to HudOverlay --- osu.Game/Modes/UI/HudOverlay.cs | 25 ++++++++++++++++++++----- osu.Game/Screens/Play/Player.cs | 18 ------------------ 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 42d789c741..215715c526 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -10,6 +10,8 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; using System; using osu.Game.Modes.Scoring; +using osu.Framework.Input; +using OpenTK.Input; namespace osu.Game.Modes.UI { @@ -35,6 +37,7 @@ namespace osu.Game.Modes.UI protected HudOverlay() { RelativeSizeAxes = Axes.Both; + AlwaysPresent = true; Children = new Drawable[] { @@ -74,11 +77,6 @@ namespace osu.Game.Modes.UI Hide(); } - public void ChangeVisibility() - { - showHud.Value = !showHud.Value; - } - public void BindProcessor(ScoreProcessor processor) { //bind processor bindables to combocounter, score display etc. @@ -93,5 +91,22 @@ namespace osu.Game.Modes.UI { hitRenderer.InputManager.Add(KeyCounter.GetReceptor()); } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) return false; + + if (state.Keyboard.ShiftPressed) + { + switch (args.Key) + { + case Key.Tab: + showHud.Value = !showHud.Value; + return true; + } + } + + return base.OnKeyDown(state, args); + } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 592d4a9433..e774dea1a6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -24,7 +24,6 @@ using System.Linq; using osu.Game.Modes.Scoring; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -using OpenTK.Input; namespace osu.Game.Screens.Play { @@ -344,22 +343,5 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; - - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) - { - if (args.Repeat) return false; - - if (state.Keyboard.ShiftPressed) - { - switch (args.Key) - { - case Key.Tab: - hudOverlay.ChangeVisibility(); - return true; - } - } - - return base.OnKeyDown(state, args); - } } } \ No newline at end of file From 38bbf2ac77492298771b4ba4bc2122f66a959552 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 1 Apr 2017 23:59:44 +0900 Subject: [PATCH 220/348] Fix post-merge errors. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 4 +++- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 99ca025ae4..28e25ac81e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -35,9 +35,9 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Swell", addSwell); AddStep("Centre", () => addCentreHit(false)); AddStep("Strong Centre", () => addCentreHit(true)); - AddButton("Add bar line", addBarLine); AddStep("Rim", () => addRimHit(false)); AddStep("Strong Rim", () => addRimHit(true)); + AddStep("Add bar line", addBarLine); Add(new Container { diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 7086dcfbc6..50bcc791ae 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -6,11 +6,13 @@ using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; +using osu.Game.Modes.Taiko.Objects.Drawable; using osu.Game.Modes.Taiko.Replays; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; @@ -70,7 +72,7 @@ namespace osu.Game.Modes.Taiko.UI { bool isMajor = currentBeat % (int)current.TimeSignature == 0; - BarLine barLine = new BarLine + var barLine = new BarLine { StartTime = time, }; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index d9eae9a773..0e46f9bc73 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; private readonly Container hitExplosionContainer; - private Container barLineContainer; + private readonly Container barLineContainer; private readonly Container judgementContainer; private readonly Container hitObjectContainer; From 2510a9fd3297f98944445f869644b2a4f6515cb3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sun, 2 Apr 2017 02:06:58 +0900 Subject: [PATCH 221/348] Cleanups. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 6 ------ osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs | 9 +++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 28e25ac81e..17edb017ab 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.MathUtils; using osu.Framework.Testing; -using osu.Framework.Timing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; @@ -21,11 +20,6 @@ namespace osu.Desktop.VisualTests.Tests private TaikoPlayfield playfield; - public TestCaseTaikoPlayfield() - { - Clock = new FramedClock(); - } - public override void Reset() { base.Reset(); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs index 958197ef03..10ac10e269 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs @@ -14,12 +14,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable public class DrawableBarLine : Container { /// - /// The line. + /// The visual line tracker. /// protected Box Tracker; /// - /// The + /// The bar line. /// protected readonly BarLine BarLine; @@ -61,12 +61,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable FadeOut(100 * BarLine.PreEmpt / 1000); } - private void moveToTimeOffset(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt)); + private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt)); protected override void Update() { base.Update(); - moveToTimeOffset(Time.Current); + + updateScrollPosition(Time.Current); } } } \ No newline at end of file From 14966d5b94662363f9b52ebafbefd9a96b262b77 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 21:14:30 +0300 Subject: [PATCH 222/348] Updated TestCase --- .../Tests/TestCaseInGameOverlays.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs index e0512f4747..575c54864c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs @@ -3,7 +3,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Logging; -using osu.Framework.Screens.Testing; +using osu.Framework.Testing; using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests @@ -20,7 +20,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - Add(pauseOverlay = new PauseOverlay + pauseOverlay = new PauseOverlay { Depth = -1, OnResume = () => Logger.Log(@"Resume"), @@ -28,31 +28,35 @@ namespace osu.Desktop.VisualTests.Tests OnQuit = () => Logger.Log(@"Quit"), Title = @"paused", Description = @"you're not going to do what i think you're going to do, are ya?", - }); - Add(failOverlay = new FailOverlay + }; + + failOverlay = new FailOverlay { Depth = -1, OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), Title = @"failed", Description = @"you're dead, try again?", - }); + }; - AddButton("Pause", delegate { + Add(pauseOverlay); + Add(failOverlay); + + AddToggleStep(@"Pause", delegate { if(failOverlay.State == Visibility.Visible) { failOverlay.Hide(); } pauseOverlay.Show(); }); - AddButton("Fail", delegate { + AddToggleStep("Fail", delegate { if (pauseOverlay.State == Visibility.Visible) { pauseOverlay.Hide(); } failOverlay.Show(); }); - AddButton("Add Retry", delegate + AddToggleStep("Add Retry", delegate { retryCount++; pauseOverlay.Retries = retryCount; From ebc814f06a6f79dabfb5bd63030530af0b925e1e Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 21:17:24 +0300 Subject: [PATCH 223/348] Typos fix --- osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs | 2 +- osu.Game/Screens/Play/Player.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs index 575c54864c..d8b0349ae2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs @@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseInGameOverlays : TestCase { - public override string Description => @"Tests the pause and fail overlays"; + public override string Description => @"Tests pause and fail overlays"; private PauseOverlay pauseOverlay; private FailOverlay failOverlay; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5dbd23190b..fcf95d3925 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -30,7 +30,7 @@ namespace osu.Game.Screens.Play internal override bool ShowOverlays => false; - internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused && !IsFailed; + internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused && !HasFailed; private bool hasReplayLoaded => HitRenderer.InputManager.ReplayInputHandler != null; @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play public bool IsPaused { get; private set; } - public bool IsFailed { get; private set; } + public bool HasFailed { get; private set; } public int RestartCount; @@ -274,7 +274,7 @@ namespace osu.Game.Screens.Play Delay(500); - IsFailed = true; + HasFailed = true; failOverlay.Retries = RestartCount; failOverlay.Show(); } From e3a8a14281d8b9266c73b1a08e4e6302cde5ced3 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 21:19:49 +0300 Subject: [PATCH 224/348] Removed unnecessary using --- osu.Game/Screens/Play/InGameOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index ba2027b4d5..91c2ac22c1 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -6,7 +6,6 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Play.Pause; From bd123fa906b2a1e11c7723ee0fc9d8b4e4c38950 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 21:29:17 +0300 Subject: [PATCH 225/348] Better inheritance --- osu.Game/Screens/Play/FailOverlay.cs | 8 ++++++++ osu.Game/Screens/Play/InGameOverlay.cs | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 906e25d14f..8636537416 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -4,6 +4,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using OpenTK.Input; +using osu.Game.Graphics; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -20,5 +22,11 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } + + protected override void AddButtons(OsuColour colours) + { + AddButton(@"Retry", colours.YellowDark, OnRetry); + AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); + } } } diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index 91c2ac22c1..6081044467 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -201,8 +201,7 @@ namespace osu.Game.Screens.Play protected virtual void AddButtons(OsuColour colours) { - AddButton(@"Retry", colours.YellowDark, OnRetry); - AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); + } public InGameOverlay() From f70de7439be23f5688d499807022359243241186 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 21:42:12 +0300 Subject: [PATCH 226/348] Moved title and description to each class --- .../Tests/TestCaseInGameOverlays.cs | 4 ---- osu.Game/Screens/Play/FailOverlay.cs | 6 ++++++ osu.Game/Screens/Play/InGameOverlay.cs | 20 ++++--------------- osu.Game/Screens/Play/PauseOverlay.cs | 6 ++++++ osu.Game/Screens/Play/Player.cs | 4 ---- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs index d8b0349ae2..48ab4c47eb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs @@ -26,8 +26,6 @@ namespace osu.Desktop.VisualTests.Tests OnResume = () => Logger.Log(@"Resume"), OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), - Title = @"paused", - Description = @"you're not going to do what i think you're going to do, are ya?", }; failOverlay = new FailOverlay @@ -35,8 +33,6 @@ namespace osu.Desktop.VisualTests.Tests Depth = -1, OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), - Title = @"failed", - Description = @"you're dead, try again?", }; Add(pauseOverlay); diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 8636537416..6ae0292cda 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -28,5 +28,11 @@ namespace osu.Game.Screens.Play AddButton(@"Retry", colours.YellowDark, OnRetry); AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } + + public FailOverlay() + { + title = @"failed"; + description = @"you're dead, try again?"; + } } } diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index 6081044467..6a8d7a21ca 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -27,20 +27,8 @@ namespace osu.Game.Screens.Play public Action OnRetry; public Action OnQuit; - private string title; - private string description; - - public string Title - { - get { return title; } - set { title = value; } - } - - public string Description - { - get { return description; } - set { description = value; } - } + protected string title; + protected string description; private FillFlowContainer buttons; @@ -143,7 +131,7 @@ namespace osu.Game.Screens.Play { new OsuSpriteText { - Text = Title, + Text = title, Font = @"Exo2.0-Medium", Spacing = new Vector2(5, 0), Origin = Anchor.TopCentre, @@ -155,7 +143,7 @@ namespace osu.Game.Screens.Play }, new OsuSpriteText { - Text = Description, + Text = description, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Shadow = true, diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index f359fc3a78..27c3b25d02 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -32,6 +32,12 @@ namespace osu.Game.Screens.Play AddButton(@"Retry", colours.YellowDark, OnRetry); AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } + + public PauseOverlay() + { + title = @"paused"; + description = @"you're not going to do what i think you're going to do, are ya?"; + } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fcf95d3925..cfe2b248ff 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -131,8 +131,6 @@ namespace osu.Game.Screens.Play }, OnRetry = Restart, OnQuit = Exit, - Title = @"paused", - Description = @"you're not going to do what i think you're going to do, are ya?", }; failOverlay = new FailOverlay @@ -140,8 +138,6 @@ namespace osu.Game.Screens.Play Depth = -1, OnRetry = Restart, OnQuit = Exit, - Title = @"failed", - Description = @"you're dead, try again?", }; From 1ecff1b32cfddbaba4d6ea4eb74835195689474f Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 1 Apr 2017 21:50:25 +0300 Subject: [PATCH 227/348] Fix naming and testcase --- osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs | 6 +++--- osu.Game/Screens/Play/FailOverlay.cs | 4 ++-- osu.Game/Screens/Play/InGameOverlay.cs | 8 ++++---- osu.Game/Screens/Play/PauseOverlay.cs | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs index 48ab4c47eb..ca59c9faeb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs @@ -38,21 +38,21 @@ namespace osu.Desktop.VisualTests.Tests Add(pauseOverlay); Add(failOverlay); - AddToggleStep(@"Pause", delegate { + AddStep(@"Pause", delegate { if(failOverlay.State == Visibility.Visible) { failOverlay.Hide(); } pauseOverlay.Show(); }); - AddToggleStep("Fail", delegate { + AddStep("Fail", delegate { if (pauseOverlay.State == Visibility.Visible) { pauseOverlay.Hide(); } failOverlay.Show(); }); - AddToggleStep("Add Retry", delegate + AddStep("Add Retry", delegate { retryCount++; pauseOverlay.Retries = retryCount; diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 6ae0292cda..c8539dc475 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -31,8 +31,8 @@ namespace osu.Game.Screens.Play public FailOverlay() { - title = @"failed"; - description = @"you're dead, try again?"; + Title = @"failed"; + Description = @"you're dead, try again?"; } } } diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index 6a8d7a21ca..db46e00752 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -27,8 +27,8 @@ namespace osu.Game.Screens.Play public Action OnRetry; public Action OnQuit; - protected string title; - protected string description; + protected string Title; + protected string Description; private FillFlowContainer buttons; @@ -131,7 +131,7 @@ namespace osu.Game.Screens.Play { new OsuSpriteText { - Text = title, + Text = Title, Font = @"Exo2.0-Medium", Spacing = new Vector2(5, 0), Origin = Anchor.TopCentre, @@ -143,7 +143,7 @@ namespace osu.Game.Screens.Play }, new OsuSpriteText { - Text = description, + Text = Description, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Shadow = true, diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 27c3b25d02..2a67662298 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -35,8 +35,8 @@ namespace osu.Game.Screens.Play public PauseOverlay() { - title = @"paused"; - description = @"you're not going to do what i think you're going to do, are ya?"; + Title = @"paused"; + Description = @"you're not going to do what i think you're going to do, are ya?"; } } } From 6f1fff4ee7f990b36c4083dd867b0f4e8352267b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 2 Apr 2017 15:56:12 +0900 Subject: [PATCH 228/348] Update async load usage to new style. --- osu-framework | 2 +- osu.Desktop.VisualTests/VisualTestGame.cs | 2 +- osu.Desktop/OsuGameDesktop.cs | 2 +- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 18 +- osu.Game/OsuGame.cs | 22 +-- osu.Game/Overlays/MusicController.cs | 10 +- osu.Game/Screens/BackgroundScreen.cs | 10 +- .../Backgrounds/BackgroundScreenBeatmap.cs | 2 +- osu.Game/Screens/Loader.cs | 4 +- osu.Game/Screens/Menu/Disclaimer.cs | 4 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 7 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 182 +++++++++--------- .../Select/Leaderboards/LeaderboardScore.cs | 31 ++- osu.Game/Screens/Select/PlaySongSelect.cs | 4 +- osu.Game/Users/UpdateableAvatar.cs | 10 +- 18 files changed, 146 insertions(+), 170 deletions(-) diff --git a/osu-framework b/osu-framework index bf6a3dc401..84200e72ac 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit bf6a3dc40176ee4f921012808070e014fc4a5779 +Subproject commit 84200e72acaacd6441ae81291aef251ac31cbd63 diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 0392dc5443..e0d168390b 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -14,7 +14,7 @@ namespace osu.Desktop.VisualTests { base.LoadComplete(); - new BackgroundScreenDefault { Depth = 10 }.LoadAsync(this, AddInternal); + LoadComponentAsync(new BackgroundScreenDefault { Depth = 10 }, AddInternal); // Have to construct this here, rather than in the constructor, because // we depend on some dependencies to be loaded within OsuGameBase.load(). diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 95870125e3..c2bb39ac4a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -29,7 +29,7 @@ namespace osu.Desktop { base.LoadComplete(); - versionManager.LoadAsync(this); + LoadComponentAsync(versionManager); ScreenChanged += s => { if (!versionManager.IsAlive && s is Intro) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index e26dcac16b..96747cd9d3 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -33,19 +33,15 @@ namespace osu.Game.Beatmaps.Drawables Children = new Drawable[] { - new DelayedLoadContainer - { - RelativeSizeAxes = Axes.Both, - TimeBeforeLoad = 300, - FinishedLoading = d => d.FadeInFromZero(400, EasingTypes.Out), - Children = new[] + new DelayedLoadContainer( + new PanelBackground(beatmap) { - new PanelBackground(beatmap) - { - RelativeSizeAxes = Axes.Both, - Depth = 1, - } + RelativeSizeAxes = Axes.Both, + OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), } + ) + { + TimeBeforeLoad = 300, }, new FillFlowContainer { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 8ac86c5c67..d75f8b4d8e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -150,7 +150,7 @@ namespace osu.Game } }); - (screenStack = new Loader()).LoadAsync(this, d => + LoadComponentAsync(screenStack = new Loader(), d => { screenStack.ModePushed += screenAdded; screenStack.Exited += screenRemoved; @@ -158,27 +158,27 @@ namespace osu.Game }); //overlay elements - (chat = new ChatOverlay { Depth = 0 }).LoadAsync(this, overlayContent.Add); - (options = new OptionsOverlay { Depth = -1 }).LoadAsync(this, overlayContent.Add); - (musicController = new MusicController + LoadComponentAsync(chat = new ChatOverlay { Depth = 0 }, overlayContent.Add); + LoadComponentAsync(options = new OptionsOverlay { Depth = -1 }, overlayContent.Add); + LoadComponentAsync(musicController = new MusicController { Depth = -2, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }).LoadAsync(this, overlayContent.Add); + }, overlayContent.Add); - (notificationManager = new NotificationManager + LoadComponentAsync(notificationManager = new NotificationManager { Depth = -2, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - }).LoadAsync(this, overlayContent.Add); + }, overlayContent.Add); - (dialogOverlay = new DialogOverlay + LoadComponentAsync(dialogOverlay = new DialogOverlay { Depth = -4, - }).LoadAsync(this, overlayContent.Add); + }, overlayContent.Add); Logger.NewEntry += entry => { @@ -195,12 +195,12 @@ namespace osu.Game Dependencies.Cache(notificationManager); Dependencies.Cache(dialogOverlay); - (Toolbar = new Toolbar + LoadComponentAsync(Toolbar = new Toolbar { Depth = -3, OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); }, OnPlayModeChange = m => PlayMode.Value = m, - }).LoadAsync(this, t => + }, t => { PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); }; PlayMode.TriggerChange(); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 2f8f0ab650..d119065173 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -347,12 +347,9 @@ namespace osu.Game.Overlays } }); - dragContainer.Add(new AsyncLoadContainer + dragContainer.Add(new AsyncLoadContainer(new MusicControllerBackground(beatmap) { - RelativeSizeAxes = Axes.Both, - Depth = float.MaxValue, - Children = new[] { new MusicControllerBackground(beatmap) }, - FinishedLoading = d => + OnLoadComplete = d => { switch (direction) { @@ -370,6 +367,9 @@ namespace osu.Game.Overlays currentBackground.Expire(); currentBackground = d; } + }) + { + Depth = float.MaxValue, }); }; } diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 317199c6a9..e86bf9371c 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -27,21 +27,13 @@ namespace osu.Game.Screens return false; } - private Framework.Game game; - - [BackgroundDependencyLoader] - private void load(Framework.Game game) - { - this.game = game; - } - public override bool Push(Screen screen) { // When trying to push a non-loaded GameMode, load it asynchronously and re-invoke Push // once it's done. if (screen.LoadState == LoadState.NotLoaded) { - screen.LoadAsync(game, d => Push((BackgroundScreen)d)); + LoadComponentAsync(screen, d => Push((BackgroundScreen)d)); return true; } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 6baccdf9c9..ade860f358 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Backgrounds { var newBackground = beatmap == null ? new Background(@"Backgrounds/bg1") : new BeatmapBackground(beatmap); - newBackground.LoadAsync(Game, delegate + LoadComponentAsync(newBackground, delegate { float newDepth = 0; if (background != null) diff --git a/osu.Game/Screens/Loader.cs b/osu.Game/Screens/Loader.cs index 41ca9df83b..30e1538b47 100644 --- a/osu.Game/Screens/Loader.cs +++ b/osu.Game/Screens/Loader.cs @@ -20,9 +20,9 @@ namespace osu.Game.Screens private void load(OsuGame game) { if (game.IsDeployedBuild) - new Disclaimer().LoadAsync(game, d => Push((Screen)d)); + LoadComponentAsync(new Disclaimer(), d => Push((Screen)d)); else - new Intro().LoadAsync(game, d => Push((Screen)d)); + LoadComponentAsync(new Intro(), d => Push((Screen)d)); } } } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index bef98a2d57..4640067017 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -88,9 +88,9 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(OsuGame game, OsuColour colours) + private void load(OsuColour colours) { - (intro = new Intro()).LoadAsync(game); + LoadComponentAsync(intro = new Intro()); iconColour = colours.Yellow; } diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 890b3f6970..ac926cba0c 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu { bgm.Start(); - (mainMenu = new MainMenu()).LoadAsync(Game); + LoadComponentAsync(mainMenu = new MainMenu()); Scheduler.AddDelayed(delegate { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index d19dd40938..59528dad91 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader] private void load(OsuGame game) { - background.LoadAsync(game); + LoadComponentAsync(background); buttons.OnSettings = game.ToggleOptions; @@ -67,10 +67,7 @@ namespace osu.Game.Screens.Menu private void preloadSongSelect() { if (songSelect == null) - { - songSelect = new PlaySongSelect(); - songSelect.LoadAsync(Game); - } + LoadComponentAsync(songSelect = new PlaySongSelect()); } private Screen consumeSongSelect() diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 73d397b24b..5bdb629393 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -225,7 +225,7 @@ namespace osu.Game.Screens.Play var newPlayer = new Player(); - newPlayer.LoadAsync(Game, delegate + LoadComponentAsync(newPlayer, delegate { newPlayer.RestartCount = RestartCount + 1; ValidForResume = false; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index d766777697..64d17fd5bb 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.Centre, }); - player.LoadAsync(Game); + LoadComponentAsync(player); } protected override void OnEntering(Screen last) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 3cbf743c15..d28267e3ab 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -103,111 +103,109 @@ namespace osu.Game.Screens.Select labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } - Add(beatmapInfoContainer = new AsyncLoadContainer - { - FinishedLoading = d => - { - FadeIn(250); + AlwaysPresent = true; - lastContainer?.FadeOut(250); - lastContainer?.Expire(); - }, - Depth = newDepth, - RelativeSizeAxes = Axes.Both, - Children = new[] + Add(beatmapInfoContainer = new AsyncLoadContainer( + new BufferedContainer { - new BufferedContainer + OnLoadComplete = d => { - PixelSnapping = true, - CacheDrawnFrameBuffer = true, - Shear = -Shear, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + FadeIn(250); + + lastContainer?.FadeOut(250); + lastContainer?.Expire(); + }, + PixelSnapping = true, + CacheDrawnFrameBuffer = true, + Shear = -Shear, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + // We will create the white-to-black gradient by modulating transparency and having + // a black backdrop. This results in an sRGB-space gradient and not linear space, + // transitioning from white to black more perceptually uniformly. + new Box { - // We will create the white-to-black gradient by modulating transparency and having - // a black backdrop. This results in an sRGB-space gradient and not linear space, - // transitioning from white to black more perceptually uniformly. - new Box + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + // We use a container, such that we can set the colour gradient to go across the + // vertices of the masked container instead of the vertices of the (larger) sprite. + new Container + { + RelativeSizeAxes = Axes.Both, + ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), + Children = new[] { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - // We use a container, such that we can set the colour gradient to go across the - // vertices of the masked container instead of the vertices of the (larger) sprite. - new Container - { - RelativeSizeAxes = Axes.Both, - ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), - Children = new[] + // Zoomed-in and cropped beatmap background + new BeatmapBackgroundSprite(beatmap) { - // Zoomed-in and cropped beatmap background - new BeatmapBackgroundSprite(beatmap) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - FillMode = FillMode.Fill, - }, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, }, }, - // Text for beatmap info - new FillFlowContainer + }, + // Text for beatmap info + new FillFlowContainer + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] { - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Direction = FillDirection.Vertical, - Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] + new OsuSpriteText { - new OsuSpriteText + Font = @"Exo2.0-MediumItalic", + Text = metadata.Artist + " -- " + metadata.Title, + TextSize = 28, + Shadow = true, + }, + new OsuSpriteText + { + Font = @"Exo2.0-MediumItalic", + Text = beatmapInfo.Version, + TextSize = 17, + Shadow = true, + }, + new FillFlowContainer + { + Margin = new MarginPadding { Top = 10 }, + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + Children = new[] { - Font = @"Exo2.0-MediumItalic", - Text = metadata.Artist + " -- " + metadata.Title, - TextSize = 28, - Shadow = true, - }, - new OsuSpriteText - { - Font = @"Exo2.0-MediumItalic", - Text = beatmapInfo.Version, - TextSize = 17, - Shadow = true, - }, - new FillFlowContainer - { - Margin = new MarginPadding { Top = 10 }, - Direction = FillDirection.Horizontal, - AutoSizeAxes = Axes.Both, - Children = new[] + new OsuSpriteText { - new OsuSpriteText - { - Font = @"Exo2.0-Medium", - Text = "mapped by ", - TextSize = 15, - Shadow = true, - }, - new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = metadata.Author, - TextSize = 15, - Shadow = true, - }, - } - }, - new FillFlowContainer - { - Margin = new MarginPadding { Top = 20 }, - Spacing = new Vector2(40, 0), - AutoSizeAxes = Axes.Both, - Children = labels - }, - } - }, - } + Font = @"Exo2.0-Medium", + Text = "mapped by ", + TextSize = 15, + Shadow = true, + }, + new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = metadata.Author, + TextSize = 15, + Shadow = true, + }, + } + }, + new FillFlowContainer + { + Margin = new MarginPadding { Top = 20 }, + Spacing = new Vector2(40, 0), + AutoSizeAxes = Axes.Both, + Children = labels + }, + } + }, } - } + }) + { + Depth = newDepth, }); } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 9a169b1f10..70b3225a1f 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -141,26 +141,23 @@ namespace osu.Game.Screens.Select.Leaderboards Padding = new MarginPadding(edge_margin), Children = new Drawable[] { - avatar = new DelayedLoadContainer + avatar = new DelayedLoadContainer( + new Avatar(Score.User ?? new User { Id = Score.UserID }) + { + RelativeSizeAxes = Axes.Both, + CornerRadius = corner_radius, + Masking = true, + OnLoadComplete = d => d.FadeInFromZero(200), + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Radius = 1, + Colour = Color4.Black.Opacity(0.2f), + }, + }) { TimeBeforeLoad = 500, - FinishedLoading = d => d.FadeInFromZero(200), Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), - Children = new Drawable[] - { - new Avatar(Score.User ?? new User { Id = Score.UserID }) - { - RelativeSizeAxes = Axes.Both, - CornerRadius = corner_radius, - Masking = true, - EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Shadow, - Radius = 1, - Colour = Color4.Black.Opacity(0.2f), - }, - }, - } }, new Container { diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index fb7ed3809f..78a8e4c177 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select { if (player != null) return; - (player = new PlayerLoader(new Player + LoadComponentAsync(player = new PlayerLoader(new Player { Beatmap = Beatmap, //eagerly set this so it's present before push. - })).LoadAsync(Game, l => Push(player)); + }), l => Push(player)); } } } diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 4fc2298525..f42fd95d14 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -40,15 +40,11 @@ namespace osu.Game.Users { displayedAvatar?.FadeOut(300); displayedAvatar?.Expire(); - Add(displayedAvatar = new AsyncLoadContainer + Add(displayedAvatar = new AsyncLoadContainer(new Avatar(user) { RelativeSizeAxes = Axes.Both, - FinishedLoading = d => d.FadeInFromZero(200), - Children = new[] - { - new Avatar(user) { RelativeSizeAxes = Axes.Both } - } - }); + OnLoadComplete = d => d.FadeInFromZero(200), + })); } } } \ No newline at end of file From bfa2e68bfba4f82aecaf9fa8a69fca07f307f91c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 2 Apr 2017 16:17:13 +0900 Subject: [PATCH 229/348] Container->Wrapper. --- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 2 +- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Users/UpdateableAvatar.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 96747cd9d3..89399a56ff 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Drawables Children = new Drawable[] { - new DelayedLoadContainer( + new DelayedLoadWrapper( new PanelBackground(beatmap) { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index d119065173..aa0ea1ae9b 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -347,7 +347,7 @@ namespace osu.Game.Overlays } }); - dragContainer.Add(new AsyncLoadContainer(new MusicControllerBackground(beatmap) + dragContainer.Add(new AsyncLoadWrapper(new MusicControllerBackground(beatmap) { OnLoadComplete = d => { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d28267e3ab..768cef4645 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -105,7 +105,7 @@ namespace osu.Game.Screens.Select AlwaysPresent = true; - Add(beatmapInfoContainer = new AsyncLoadContainer( + Add(beatmapInfoContainer = new AsyncLoadWrapper( new BufferedContainer { OnLoadComplete = d => diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 70b3225a1f..adcf8fd042 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -141,7 +141,7 @@ namespace osu.Game.Screens.Select.Leaderboards Padding = new MarginPadding(edge_margin), Children = new Drawable[] { - avatar = new DelayedLoadContainer( + avatar = new DelayedLoadWrapper( new Avatar(Score.User ?? new User { Id = Score.UserID }) { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index f42fd95d14..7d304e3bbc 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -40,7 +40,7 @@ namespace osu.Game.Users { displayedAvatar?.FadeOut(300); displayedAvatar?.Expire(); - Add(displayedAvatar = new AsyncLoadContainer(new Avatar(user) + Add(displayedAvatar = new AsyncLoadWrapper(new Avatar(user) { RelativeSizeAxes = Axes.Both, OnLoadComplete = d => d.FadeInFromZero(200), From a7f48e0edadca517bcccc65c707b958fffdc3940 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 2 Apr 2017 17:07:25 +0900 Subject: [PATCH 230/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 84200e72ac..1c08c1fec4 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 84200e72acaacd6441ae81291aef251ac31cbd63 +Subproject commit 1c08c1fec496e9d64ba8f30ff0464cd5cdf567b6 From 263374a357a40fdcfd0fdd3f7d22cf5a7cb43d6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 2 Apr 2017 17:11:31 +0900 Subject: [PATCH 231/348] Remove unnecessary using. --- osu.Game/Screens/BackgroundScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index e86bf9371c..fd40141fcb 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -3,7 +3,6 @@ using System; using System.Threading; -using osu.Framework.Allocation; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Input; From ed476a79f8522aa4e1d4f1a35f5180669bcc4cac Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sun, 2 Apr 2017 16:18:01 +0300 Subject: [PATCH 232/348] Move posting notification in HudOverlay --- osu.Game/Modes/UI/HudOverlay.cs | 16 ++++++++++++---- osu.Game/Screens/Play/Player.cs | 14 ++------------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 215715c526..4a2f8f0c41 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -12,6 +12,8 @@ using System; using osu.Game.Modes.Scoring; using osu.Framework.Input; using OpenTK.Input; +using osu.Game.Overlays; +using osu.Game.Overlays.Notifications; namespace osu.Game.Modes.UI { @@ -26,8 +28,6 @@ namespace osu.Game.Modes.UI private Bindable showKeyCounter; private Bindable showHud; - public bool IsVisible => showHud; - protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); protected abstract PercentageCounter CreateAccuracyCounter(); @@ -49,8 +49,8 @@ namespace osu.Game.Modes.UI }; } - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + [BackgroundDependencyLoader(true)] + private void load(OsuConfigManager config, NotificationManager notificationManager) { showKeyCounter = config.GetBindable(OsuConfig.KeyOverlay); showKeyCounter.ValueChanged += keyCounterVisibilityChanged; @@ -59,6 +59,14 @@ namespace osu.Game.Modes.UI showHud = config.GetBindable(OsuConfig.ShowInterface); showHud.ValueChanged += hudVisibilityChanged; showHud.TriggerChange(); + + if (!showHud) + { + notificationManager?.Post(new SimpleNotification + { + Text = @"The score overlay is currently disabled. You can toogle this by pressing Shift + Tab." + }); + } } private void keyCounterVisibilityChanged(object sender, EventArgs e) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e774dea1a6..73d397b24b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -22,8 +22,6 @@ using osu.Game.Screens.Ranking; using System; using System.Linq; using osu.Game.Modes.Scoring; -using osu.Game.Overlays; -using osu.Game.Overlays.Notifications; namespace osu.Game.Screens.Play { @@ -61,8 +59,8 @@ namespace osu.Game.Screens.Play private HudOverlay hudOverlay; private PauseOverlay pauseOverlay; - [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, NotificationManager notificationManager) + [BackgroundDependencyLoader] + private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config) { var beatmap = Beatmap.Beatmap; @@ -160,14 +158,6 @@ namespace osu.Game.Screens.Play hudOverlay, pauseOverlay }; - - if (!hudOverlay.IsVisible) - { - notificationManager?.Post(new SimpleNotification - { - Text = @"The score overlay is currently disabled. You can toogle this by pressing Shift + Tab." - }); - } } private void initializeSkipButton() From 0745098783e52759bf2e67696de3d78435fda523 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 10:04:13 +0900 Subject: [PATCH 233/348] Cleanup. --- .../Tests/TestCaseTaikoPlayfield.cs | 9 +++---- .../Objects/Drawable/DrawableBarLine.cs | 16 +++++++++--- .../Objects/Drawable/DrawableMajorBarLine.cs | 26 ++++++++++--------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 17edb017ab..11855953c7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -31,7 +31,8 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Strong Centre", () => addCentreHit(true)); AddStep("Rim", () => addRimHit(false)); AddStep("Strong Rim", () => addRimHit(true)); - AddStep("Add bar line", addBarLine); + AddStep("Add bar line", () => addBarLine(false)); + AddStep("Add major bar line", () => addBarLine(true)); Add(new Container { @@ -74,17 +75,15 @@ namespace osu.Desktop.VisualTests.Tests }); } - private void addBarLine() + private void addBarLine(bool major) { - bool isMajor = RNG.Next(8) == 0; - BarLine bl = new BarLine { StartTime = Time.Current + 1000, PreEmpt = 1000 }; - playfield.AddBarLine(isMajor ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl)); + playfield.AddBarLine(major ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl)); } private void addSwell() diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs index 10ac10e269..8c963a8e4f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs @@ -13,6 +13,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// public class DrawableBarLine : Container { + /// + /// The width of the line tracker. + /// + private const float tracker_width = 2f; + + /// + /// Fade out time calibrated to a pre-empt of 1000ms. + /// + private const float base_fadeout_time = 100f; + /// /// The visual line tracker. /// @@ -33,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable RelativePositionAxes = Axes.X; RelativeSizeAxes = Axes.Y; - Width = 2f; + Width = tracker_width; Children = new[] { @@ -41,9 +51,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - EdgeSmoothness = new Vector2(0.5f, 0), Alpha = 0.75f } @@ -58,7 +66,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt; Delay(BarLine.StartTime - Time.Current); - FadeOut(100 * BarLine.PreEmpt / 1000); + FadeOut(base_fadeout_time * BarLine.PreEmpt / 1000); } private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt)); diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs index ca5a6f9299..684ea93dec 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs @@ -10,6 +10,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableMajorBarLine : DrawableBarLine { + /// + /// The vertical offset of the triangles from the line tracker. + /// + private const float triangle_offfset = 10f; + + /// + /// The size of the triangles. + /// + private const float triangle_size = 20f; + public DrawableMajorBarLine(BarLine barLine) : base(barLine) { @@ -17,33 +27,25 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new[] { new EquilateralTriangle { Name = "Top", - Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - - Position = new Vector2(0, -10), - Size = new Vector2(-20), - + Position = new Vector2(0, -triangle_offfset), + Size = new Vector2(-triangle_size), EdgeSmoothness = new Vector2(1), }, new EquilateralTriangle { Name = "Bottom", - Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre, - - Position = new Vector2(0, 10), - Size = new Vector2(20), - + Position = new Vector2(0, triangle_offfset), + Size = new Vector2(triangle_size), EdgeSmoothness = new Vector2(1), } } From 1a667556943b56274990c01f3d5fdeb68548624f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 10:20:20 +0900 Subject: [PATCH 234/348] Fix second hit displaying two judgements, move hitobjects above playfield when hit. --- osu.Game.Modes.Taiko/UI/HitExplosion.cs | 26 +++++++++++++++++------ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 21 +++++++++++++++--- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs index 94938a700d..e3fd89e2b5 100644 --- a/osu.Game.Modes.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -18,12 +18,21 @@ namespace osu.Game.Modes.Taiko.UI /// internal class HitExplosion : CircularContainer { - private readonly TaikoJudgement judgement; + /// + /// The size of a hit explosion if a hit object has been hit with the second key. + /// + private const float secondhit_scale = 1.5f; + + /// + /// The judgement this hit explosion visualises. + /// + public readonly TaikoJudgement Judgement; + private readonly Box innerFill; public HitExplosion(TaikoJudgement judgement) { - this.judgement = judgement; + Judgement = judgement; Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); @@ -50,10 +59,7 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (judgement.SecondHit) - Size *= 1.5f; - - switch (judgement.TaikoResult) + switch (Judgement.TaikoResult) { case TaikoHitResult.Good: innerFill.Colour = colours.Green; @@ -73,5 +79,13 @@ namespace osu.Game.Modes.Taiko.UI Expire(); } + + /// + /// Transforms this hit explosion to visualise a secondary hit. + /// + public void VisualiseSecondHit() + { + ResizeTo(Size * secondhit_scale, 50); + } } } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index b6165b785b..8efb815fc0 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -15,6 +15,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Primitives; using osu.Game.Modes.Taiko.Objects.Drawable; +using System.Linq; namespace osu.Game.Modes.Taiko.UI { @@ -176,9 +177,7 @@ namespace osu.Game.Modes.Taiko.UI public override void OnJudgement(DrawableHitObject judgedObject) { bool wasHit = judgedObject.Judgement.Result == HitResult.Hit; - - if (wasHit) - hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); + bool secondHit = judgedObject.Judgement.SecondHit; judgementContainer.Add(new DrawableTaikoJudgement(judgedObject.Judgement) { @@ -187,6 +186,22 @@ namespace osu.Game.Modes.Taiko.UI RelativePositionAxes = Axes.X, X = wasHit ? judgedObject.Position.X : 0, }); + + if (!wasHit) + return; + + if (!secondHit) + { + if (judgedObject.X >= -0.05f && !(judgedObject is DrawableSwell)) + { + // If we're far enough away from the left stage, we should bring outselves in front of it + topLevelHitContainer.Add(judgedObject.CreateProxy()); + } + + hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); + } + else + hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit(); } } } \ No newline at end of file From b027d0d3b43230f1ca3ac5e7e832905657a4dcb8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 10:28:03 +0900 Subject: [PATCH 235/348] Changing duration is wrong, add HitMultiplier. I don't know if this is the best way to handle this/if there's a better way, but this seems pretty sane? This could be expanded on in the future to make swells harder/require more hits with a smaller duration. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 3 ++- osu.Game.Modes.Taiko/Objects/Swell.cs | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index cc361628a3..cc5e394987 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -70,7 +70,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps Sample = original.Sample, IsStrong = strong, - EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor + EndTime = original.StartTime + endTimeData.Duration, + HitMultiplier = bash_convert_factor }; } diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs index 4cbb5904c7..a2d52d1358 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -14,6 +14,12 @@ namespace osu.Game.Modes.Taiko.Objects public double Duration => EndTime - StartTime; + /// + /// The multiplier for cases in which the number of required hits by a Swell is not + /// dependent on solely the overall difficulty and the duration of the swell. + /// + public double HitMultiplier { get; set; } = 1; + /// /// The number of hits required to complete the swell successfully. /// @@ -24,7 +30,7 @@ namespace osu.Game.Modes.Taiko.Objects base.ApplyDefaults(timing, difficulty); double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); - RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio); + RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio * HitMultiplier); } } } \ No newline at end of file From 3b672fd8424028af9c08882193702e38e4702433 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 1 Apr 2017 23:30:16 +0900 Subject: [PATCH 236/348] Lengthen drum rolls as required by conversion. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index cc5e394987..7cc383f622 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -57,7 +57,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps Sample = original.Sample, IsStrong = strong, - Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) + Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale }; } From 33e10adfa6336e844efa9124034d5a46abff2aea Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 10:54:13 +0900 Subject: [PATCH 237/348] Rewrite beatmap conversion to allow converting sliders to normal hits. --- .../Beatmaps/TaikoBeatmapConverter.cs | 109 +++++++++++------- 1 file changed, 67 insertions(+), 42 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 7cc383f622..693e9cadf3 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -7,6 +7,7 @@ using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Taiko.Objects; +using System; using System.Collections.Generic; using System.Linq; @@ -24,75 +25,99 @@ namespace osu.Game.Modes.Taiko.Beatmaps return new Beatmap(original) { - HitObjects = convertHitObjects(original.HitObjects) + HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() }; } - private List convertHitObjects(List hitObjects) - { - return hitObjects.Select(convertHitObject).ToList(); - } - - private TaikoHitObject convertHitObject(HitObject original) + private IEnumerable convertHitObject(HitObject obj, Beatmap beatmap) { // Check if this HitObject is already a TaikoHitObject, and return it if so - TaikoHitObject originalTaiko = original as TaikoHitObject; + var originalTaiko = obj as TaikoHitObject; if (originalTaiko != null) - return originalTaiko; + yield return originalTaiko; - IHasDistance distanceData = original as IHasDistance; - IHasRepeats repeatsData = original as IHasRepeats; - IHasEndTime endTimeData = original as IHasEndTime; + var distanceData = obj as IHasDistance; + var repeatsData = obj as IHasRepeats; + var endTimeData = obj as IHasEndTime; // Old osu! used hit sounding to determine various hit type information - SampleType sample = original.Sample?.Type ?? SampleType.None; + SampleType sample = obj.Sample?.Type ?? SampleType.None; bool strong = (sample & SampleType.Finish) > 0; if (distanceData != null) { - return new DrumRoll + double sv = beatmap.TimingInfo.SliderVelocityAt(obj.StartTime) * beatmap.BeatmapInfo.Difficulty.SliderMultiplier; + + double l = distanceData.Distance * legacy_velocity_scale; + double v = sv * legacy_velocity_scale; + double bl = beatmap.TimingInfo.BeatLengthAt(obj.StartTime); + + int repeats = repeatsData?.RepeatCount ?? 1; + + double skipPeriod = Math.Min(bl / beatmap.BeatmapInfo.Difficulty.SliderTickRate, distanceData.Duration / repeats); + + if (skipPeriod > 0 && l / v * 1000 < 2 * bl) { - StartTime = original.StartTime, - Sample = original.Sample, - IsStrong = strong, - - Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale - }; + for (double j = obj.StartTime; j <= distanceData.EndTime + skipPeriod / 8; j += skipPeriod) + { + // Todo: This should generate different type of hits (including strongs) + // depending on hitobject sound additions (not implemented fully yet) + yield return new CentreHit + { + StartTime = obj.StartTime, + Sample = obj.Sample, + IsStrong = strong + }; + } + } + else + { + yield return new DrumRoll + { + StartTime = obj.StartTime, + Sample = obj.Sample, + IsStrong = strong, + Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale + }; + } } - - if (endTimeData != null) + else if (endTimeData != null) { // We compute the end time manually to add in the Bash convert factor - return new Swell + yield return new Swell { - StartTime = original.StartTime, - Sample = original.Sample, + StartTime = obj.StartTime, + Sample = obj.Sample, IsStrong = strong, - EndTime = original.StartTime + endTimeData.Duration, + EndTime = obj.StartTime + endTimeData.Duration, HitMultiplier = bash_convert_factor }; } - - bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0; - - if (isCentre) + else { - return new CentreHit + bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0; + + if (isCentre) { - StartTime = original.StartTime, - Sample = original.Sample, - IsStrong = strong - }; + yield return new CentreHit + { + StartTime = obj.StartTime, + Sample = obj.Sample, + IsStrong = strong + }; + } + else + { + yield return new RimHit + { + StartTime = obj.StartTime, + Sample = obj.Sample, + IsStrong = strong, + }; + } } - - return new RimHit - { - StartTime = original.StartTime, - Sample = original.Sample, - IsStrong = strong, - }; } } } From 3920758981a233b1b05dfcdea98a6a6652a3fbef Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 10:59:49 +0900 Subject: [PATCH 238/348] Rename all occurrences of finishers to strong. --- osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs | 2 +- osu.Game.Modes.Taiko/UI/HitTarget.cs | 14 +++++++------- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs index f4745730db..c2c4093b1b 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs @@ -43,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Judgements public override string MaxResultString => MAX_HIT_RESULT.GetDescription(); /// - /// Whether this Judgement has a secondary hit in the case of finishers. + /// Whether this Judgement has a secondary hit in the case of strong hits. /// public virtual bool SecondHit { get; set; } diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index 32b2877545..27562cd916 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -21,9 +21,9 @@ namespace osu.Game.Modes.Taiko.UI private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2; /// - /// Diameter of finisher hit object circles. + /// Diameter of strong hit object circles. /// - private const float finisher_diameter = normal_diameter * 1.5f; + private const float strong_hit_diameter = normal_diameter * 1.5f; /// /// The 1px inner border of the taiko playfield. @@ -47,15 +47,15 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), Alpha = 0.1f }, new CircularContainer { - Name = "Finisher Ring", + Name = "Strong Hit Ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(finisher_diameter), + Size = new Vector2(strong_hit_diameter), Masking = true, BorderColour = Color4.White, BorderThickness = border_thickness, @@ -72,7 +72,7 @@ namespace osu.Game.Modes.Taiko.UI }, new CircularContainer { - Name = "Normal Ring", + Name = "Normal Hit Ring", Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(normal_diameter), @@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -border_offset, - Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - finisher_diameter) / 2f - border_offset), + Size = new Vector2(border_thickness, (TaikoPlayfield.PLAYFIELD_HEIGHT - strong_hit_diameter) / 2f - border_offset), Alpha = 0.1f }, }; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 8efb815fc0..c23d920eda 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -23,7 +23,7 @@ namespace osu.Game.Modes.Taiko.UI { /// /// The play field height. This is relative to the size of hit objects - /// such that the playfield is just a bit larger than finishers. + /// such that the playfield is just a bit larger than strong hits. /// public const float PLAYFIELD_HEIGHT = TaikoHitObject.CIRCLE_RADIUS * 2 * 2; From cd6fdcf0290a108e24a3bcb792095b6990a3c25a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 11:00:59 +0900 Subject: [PATCH 239/348] Rename spinnerRotationRatio -> baseHitMultiplier. --- osu.Game.Modes.Taiko/Objects/Swell.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs index a2d52d1358..db31add4d7 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -29,8 +29,8 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); - RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio * HitMultiplier); + double baseHitMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); + RequiredHits = (int)Math.Max(1, Duration / 1000f * baseHitMultiplier * HitMultiplier); } } } \ No newline at end of file From 8aa723b6a372f4621f8782f2a1e223b9ca4899e4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 11:05:15 +0900 Subject: [PATCH 240/348] General fixes. --- osu.Game.Modes.Taiko/Objects/Swell.cs | 2 +- osu.Game.Modes.Taiko/UI/HitExplosion.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs index db31add4d7..0b654f6ff4 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -15,7 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects public double Duration => EndTime - StartTime; /// - /// The multiplier for cases in which the number of required hits by a Swell is not + /// The multiplier for cases in which the number of required hits by a swell is not /// dependent on solely the overall difficulty and the duration of the swell. /// public double HitMultiplier { get; set; } = 1; diff --git a/osu.Game.Modes.Taiko/UI/HitExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs index e3fd89e2b5..eb43c1a5d0 100644 --- a/osu.Game.Modes.Taiko/UI/HitExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -19,9 +19,9 @@ namespace osu.Game.Modes.Taiko.UI internal class HitExplosion : CircularContainer { /// - /// The size of a hit explosion if a hit object has been hit with the second key. + /// The size multiplier of a hit explosion if a hit object has been hit with the second key. /// - private const float secondhit_scale = 1.5f; + private const float secondhit_size_multiplier = 1.5f; /// /// The judgement this hit explosion visualises. @@ -85,7 +85,7 @@ namespace osu.Game.Modes.Taiko.UI /// public void VisualiseSecondHit() { - ResizeTo(Size * secondhit_scale, 50); + ResizeTo(Size * secondhit_size_multiplier, 50); } } } From f1b0a12ee357012684c7b458e961075f04b303eb Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 11:48:15 +0900 Subject: [PATCH 241/348] Rename BPMMultiplierAt -> SpeedMultiplierAt. --- osu.Game/Beatmaps/Timing/TimingInfo.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index 0e47ba983b..1535ae8879 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -20,11 +20,11 @@ namespace osu.Game.Beatmaps.Timing } /// - /// Finds the BPM multiplier at a time. + /// Finds the speed multiplier at a time. /// - /// The time to find the BPM multiplier at. - /// The BPM multiplier. - public double BPMMultiplierAt(double time) + /// The time to find the speed multiplier at. + /// The speed multiplier. + public double SpeedMultiplierAt(double time) { ControlPoint overridePoint; ControlPoint timingPoint = TimingPointAt(time, out overridePoint); @@ -33,10 +33,10 @@ namespace osu.Game.Beatmaps.Timing } /// - /// Finds the beat length at a time. + /// Finds the beat length at a time. This is expressed in milliseconds. /// /// The time to find the beat length at. - /// The beat length in milliseconds. + /// The beat length. public double BeatLengthAt(double time) { ControlPoint overridePoint; From ffe4d0ae4a569797aa9cb9386fda6738e6f651e2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 11:48:42 +0900 Subject: [PATCH 242/348] Remove BeatDistanceAt (does not express distance) and BeatVelocityAt. --- osu.Game/Beatmaps/Timing/TimingInfo.cs | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index 1535ae8879..a0a3bd38f0 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -45,32 +45,6 @@ namespace osu.Game.Beatmaps.Timing return timingPoint.BeatLength; } - /// - /// Finds the beat velocity at a time. - /// - /// The time to find the velocity at. - /// The velocity. - public double BeatVelocityAt(double time) - { - ControlPoint overridePoint; - ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - - return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1; - } - - /// - /// Finds the beat length at a time. - /// - /// The time to find the beat length at. - /// The beat length in positional length units. - public double BeatDistanceAt(double time) - { - ControlPoint overridePoint; - ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - - return (timingPoint?.BeatLength ?? 1) * (overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1); - } - /// /// Finds the timing point at a time. /// From 74bd4279977a8c7541a66a6701dbf982bd70850c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:10:20 +0900 Subject: [PATCH 243/348] Remove SliderVelocityAt, compute it manually inside hit objects. --- osu.Game.Modes.Osu/Objects/Slider.cs | 14 ++++++++------ osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 7 ++++++- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 7 ++++++- osu.Game/Beatmaps/Timing/TimingInfo.cs | 16 ---------------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 213a4a7bee..38d1dfda5d 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -14,6 +14,11 @@ namespace osu.Game.Modes.Osu.Objects { public class Slider : OsuHitObject, IHasCurve { + /// + /// Scoring distance with a speed-adjusted beat length of 1 second. + /// + private const float base_scoring_distance = 100; + public IHasCurve CurveObject { get; set; } public SliderCurve Curve => CurveObject.Curve; @@ -51,13 +56,10 @@ namespace osu.Game.Modes.Osu.Objects { base.ApplyDefaults(timing, difficulty); - ControlPoint overridePoint; - ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); - var velocityAdjustment = overridePoint?.VelocityAdjustment ?? 1; - var baseVelocity = 100 * difficulty.SliderMultiplier / velocityAdjustment; + double scoringDistance = base_scoring_distance * difficulty.SliderMultiplier / timing.SpeedMultiplierAt(StartTime); - Velocity = baseVelocity / timingPoint.BeatLength; - TickDistance = baseVelocity / difficulty.SliderTickRate; + Velocity = scoringDistance / timing.BeatLengthAt(StartTime); + TickDistance = scoringDistance / difficulty.SliderTickRate; } public IEnumerable Ticks diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 1f9241268b..40277e18fb 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -13,6 +13,11 @@ namespace osu.Game.Modes.Taiko.Objects { public class DrumRoll : TaikoHitObject, IHasDistance { + /// + /// Drum roll distance that results in a duration of 1 speed-adjusted beat length. + /// + private const float base_distance = 100; + public double EndTime => StartTime + Distance / Velocity; public double Duration => EndTime - StartTime; @@ -59,7 +64,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; + Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime); TickTimeDistance = timing.BeatLengthAt(StartTime); //TODO: move this to legacy conversion code to allow for direct division without special case. diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index ac47a3bc88..327c0402ab 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -14,6 +14,11 @@ namespace osu.Game.Modes.Taiko.Objects /// public const float CIRCLE_RADIUS = 42f; + /// + /// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second. + /// + private const double base_scroll_time = 6000; + /// /// The time to scroll in the HitObject. /// @@ -34,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000; + PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index a0a3bd38f0..076618beea 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -76,21 +76,5 @@ namespace osu.Game.Beatmaps.Timing return timingPoint ?? ControlPoint.Default; } - - /// - /// Finds the slider velocity at a time. - /// - /// The time to find the slider velocity at. - /// The slider velocity in milliseconds. - public double SliderVelocityAt(double time) - { - const double base_scoring_distance = 100; - - double beatDistance = BeatDistanceAt(time); - - if (beatDistance > 0) - return base_scoring_distance / beatDistance * 1000; - return base_scoring_distance; - } } } \ No newline at end of file From 6a3601efdca8614a274b3089ceecc106bbfe5317 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:22:22 +0900 Subject: [PATCH 244/348] Fix post-merge errors. --- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 32 +++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index f8e2c81236..d47d3496d9 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -4,15 +4,15 @@ using osu.Game.Beatmaps; using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; -using osu.Game.Modes.Replays; using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawable; -using osu.Game.Modes.Taiko.Replays; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; +using osu.Game.Modes.Replays; +using osu.Game.Modes.Taiko.Replays; namespace osu.Game.Modes.Taiko.UI { @@ -37,20 +37,20 @@ namespace osu.Game.Modes.Taiko.UI protected override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) { - var hit = h as Hit; - if (hit != null) + var centreHit = h as CentreHit; + if (centreHit != null) { - switch (hit.Type) - { - case HitType.Centre: - if (h.IsStrong) - return new DrawableStrongCentreHit(hit); - return new DrawableCentreHit(hit); - case HitType.Rim: - if (h.IsStrong) - return new DrawableStrongRimHit(hit); - return new DrawableRimHit(hit); - } + if (h.IsStrong) + return new DrawableStrongCentreHit(centreHit); + return new DrawableCentreHit(centreHit); + } + + var rimHit = h as RimHit; + if (centreHit != null) + { + if (h.IsStrong) + return new DrawableStrongRimHit(rimHit); + return new DrawableRimHit(rimHit); } var drumRoll = h as DrumRoll; @@ -67,5 +67,7 @@ namespace osu.Game.Modes.Taiko.UI return null; } + + protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay); } } From 501d52dd8930c60138149033f2155deb42f8f5a3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:28:28 +0900 Subject: [PATCH 245/348] Good catch resharper :+1:. --- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index d47d3496d9..5640e1df30 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -46,7 +46,7 @@ namespace osu.Game.Modes.Taiko.UI } var rimHit = h as RimHit; - if (centreHit != null) + if (rimHit != null) { if (h.IsStrong) return new DrawableStrongRimHit(rimHit); From 6e612bbefc029cb2fc788469feeb910e56b22d95 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:39:56 +0900 Subject: [PATCH 246/348] Reduce complexity of instantiating circle pieces in hits. --- .../Objects/Drawable/DrawableCentreHit.cs | 16 ++++++---------- .../Objects/Drawable/DrawableHit.cs | 13 +++++++++++-- .../Objects/Drawable/DrawableRimHit.cs | 16 ++++++---------- .../Objects/Drawable/DrawableStrongCentreHit.cs | 16 ++++++---------- .../Objects/Drawable/DrawableStrongRimHit.cs | 16 ++++++---------- 5 files changed, 35 insertions(+), 42 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs index 683d48df10..76eb6bb77d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.F, Key.J }; - private readonly CirclePiece circlePiece; - public DrawableCentreHit(Hit hit) : base(hit) { - Add(circlePiece = new CirclePiece - { - Children = new[] - { - new CentreHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.PinkDarker; + Circle.AccentColour = colours.PinkDarker; } + + protected override CirclePiece CreateCirclePiece() => new CirclePiece + { + Children = new[] { new CentreHitSymbolPiece() } + }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index c8a7355e3c..f6239da929 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using System; using System.Linq; @@ -20,15 +21,17 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable protected override Container Content => bodyContainer; + protected readonly CirclePiece Circle; + private readonly Hit hit; + private readonly Container bodyContainer; + /// /// Whether the last key pressed is a valid hit key. /// private bool validKeyPressed; - private readonly Container bodyContainer; - protected DrawableHit(Hit hit) : base(hit) { @@ -38,6 +41,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Children = new[] + { + Circle = CreateCirclePiece() + } }); } @@ -100,5 +107,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Expire(); } + + protected abstract CirclePiece CreateCirclePiece(); } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs index cab6819300..893a6fbb4d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.D, Key.K }; - private readonly CirclePiece circlePiece; - public DrawableRimHit(Hit hit) : base(hit) { - Add(circlePiece = new CirclePiece - { - Children = new[] - { - new RimHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.BlueDarker; + Circle.AccentColour = colours.BlueDarker; } + + protected override CirclePiece CreateCirclePiece() => new CirclePiece + { + Children = new[] { new RimHitSymbolPiece() } + }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs index b4ec0b108a..bac44f48fb 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.F, Key.J }; - private readonly CirclePiece circlePiece; - public DrawableStrongCentreHit(Hit hit) : base(hit) { - Add(circlePiece = new StrongCirclePiece - { - Children = new [] - { - new CentreHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.PinkDarker; + Circle.AccentColour = colours.PinkDarker; } + + protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece + { + Children = new[] { new CentreHitSymbolPiece() } + }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs index 1f77ad0409..985ba1c2df 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs @@ -12,24 +12,20 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { protected override Key[] HitKeys { get; } = { Key.D, Key.K }; - private readonly CirclePiece circlePiece; - public DrawableStrongRimHit(Hit hit) : base(hit) { - Add(circlePiece = new StrongCirclePiece - { - Children = new[] - { - new RimHitSymbolPiece() - } - }); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - circlePiece.AccentColour = colours.BlueDarker; + Circle.AccentColour = colours.BlueDarker; } + + protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece + { + Children = new[] { new RimHitSymbolPiece() } + }; } } From ebbf381cd6a160fd27b767867e73fb99625692a3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:40:12 +0900 Subject: [PATCH 247/348] Fix kiai not working during gameplay. --- osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs | 1 + osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs | 2 ++ osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs index 4697625c5e..ea6b0043d7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs @@ -41,6 +41,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); Add(circle = CreateCirclePiece()); + circle.KiaiMode = HitObject.Kiai; foreach (var tick in drumRoll.Ticks) { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs index f6239da929..87f0e76f60 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs @@ -46,6 +46,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Circle = CreateCirclePiece() } }); + + Circle.KiaiMode = HitObject.Kiai; } protected override void CheckJudgement(bool userTriggered) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs index ccd6380542..ec1ab42bfc 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs @@ -128,6 +128,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable } } }; + + circlePiece.KiaiMode = HitObject.Kiai; } [BackgroundDependencyLoader] From e7b55f9beabbe6113c1a7d464988dea04afb9946 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 14:49:26 +0900 Subject: [PATCH 248/348] Fix bar line pre empt time calculation. --- osu.Game.Modes.Taiko/Objects/BarLine.cs | 2 +- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/BarLine.cs b/osu.Game.Modes.Taiko/Objects/BarLine.cs index 0af36d0603..a6eceb2e48 100644 --- a/osu.Game.Modes.Taiko/Objects/BarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/BarLine.cs @@ -20,7 +20,7 @@ namespace osu.Game.Modes.Taiko.Objects public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { - PreEmpt = 600 / (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) * 1000; + PreEmpt = TaikoHitObject.BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; } } } diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 327c0402ab..bc7e3d82d6 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -17,7 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second. /// - private const double base_scroll_time = 6000; + public const double BASE_SCROLL_TIME = 6000; /// /// The time to scroll in the HitObject. @@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; + PreEmpt = BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; From 774e15b89dd94efd1e7fbfd001db55e8aa611adc Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 15:02:21 +0900 Subject: [PATCH 249/348] Set RequiredHits at conversion time to remove HitMultiplier. --- .../Beatmaps/TaikoBeatmapConverter.cs | 5 ++++- osu.Game.Modes.Taiko/Objects/Swell.cs | 19 +------------------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 693e9cadf3..ec8f64bd2f 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -10,6 +10,7 @@ using osu.Game.Modes.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; +using osu.Game.Database; namespace osu.Game.Modes.Taiko.Beatmaps { @@ -84,6 +85,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps } else if (endTimeData != null) { + double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * bash_convert_factor; + // We compute the end time manually to add in the Bash convert factor yield return new Swell { @@ -92,7 +95,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, EndTime = obj.StartTime + endTimeData.Duration, - HitMultiplier = bash_convert_factor + RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier) }; } else diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs index 0b654f6ff4..f55416509a 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -1,9 +1,6 @@ // 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.Timing; -using osu.Game.Database; using osu.Game.Modes.Objects.Types; namespace osu.Game.Modes.Taiko.Objects @@ -14,23 +11,9 @@ namespace osu.Game.Modes.Taiko.Objects public double Duration => EndTime - StartTime; - /// - /// The multiplier for cases in which the number of required hits by a swell is not - /// dependent on solely the overall difficulty and the duration of the swell. - /// - public double HitMultiplier { get; set; } = 1; - /// /// The number of hits required to complete the swell successfully. /// - public int RequiredHits { get; protected set; } = 10; - - public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) - { - base.ApplyDefaults(timing, difficulty); - - double baseHitMultiplier = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); - RequiredHits = (int)Math.Max(1, Duration / 1000f * baseHitMultiplier * HitMultiplier); - } + public int RequiredHits = 10; } } \ No newline at end of file From a03cffab587d1e7794c2ad178bf51a5705bdc330 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 15:05:12 +0900 Subject: [PATCH 250/348] No need to compute end time manually anymore. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index ec8f64bd2f..97acdeb3e6 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -87,14 +87,13 @@ namespace osu.Game.Modes.Taiko.Beatmaps { double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * bash_convert_factor; - // We compute the end time manually to add in the Bash convert factor yield return new Swell { StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - EndTime = obj.StartTime + endTimeData.Duration, + EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier) }; } From 293ea6fbd7490c19cf671de639a7468f1aa82387 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 15:24:30 +0900 Subject: [PATCH 251/348] Fix up beatmap converter error. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 97acdeb3e6..805666d5cf 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -19,6 +19,11 @@ namespace osu.Game.Modes.Taiko.Beatmaps private const float legacy_velocity_scale = 1.4f; private const float bash_convert_factor = 1.65f; + /// + /// Drum roll distance that results in a duration of 1 speed-adjusted beat length. + /// + private const float base_distance = 100; + public Beatmap Convert(Beatmap original) { if (original is LegacyBeatmap) @@ -48,7 +53,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (distanceData != null) { - double sv = beatmap.TimingInfo.SliderVelocityAt(obj.StartTime) * beatmap.BeatmapInfo.Difficulty.SliderMultiplier; + double sv = base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * beatmap.TimingInfo.BeatLengthAt(obj.StartTime) / 1000; double l = distanceData.Distance * legacy_velocity_scale; double v = sv * legacy_velocity_scale; From aad88514605095ca1c0f55afa7a4f20d7bd01595 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 15:32:38 +0900 Subject: [PATCH 252/348] Define TickRate to adjust rate of ticks externally, removing todo. --- .../Beatmaps/TaikoBeatmapConverter.cs | 3 ++- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 25 +++++++++---------- osu.Game.Modes.Taiko/Objects/DrumRollTick.cs | 6 ++--- .../Replays/TaikoAutoReplay.cs | 9 ++----- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 805666d5cf..0c356ebdc9 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -84,7 +84,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale + Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale, + TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4 }; } } diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ccf86654b5..ed8d332010 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -33,10 +33,9 @@ namespace osu.Game.Modes.Taiko.Objects public double Velocity { get; protected set; } = 5; /// - /// The distance between ticks of this drumroll. - /// Half of this value is the hit window of the ticks. + /// Numer of ticks per beat length. /// - public double TickTimeDistance { get; protected set; } = 100; + public int TickRate = 1; /// /// Number of drum roll ticks required for a "Good" hit. @@ -60,18 +59,18 @@ namespace osu.Game.Modes.Taiko.Objects private List ticks; + /// + /// The length (in milliseconds) between ticks of this drumroll. + /// Half of this value is the hit window of the ticks. + /// + private double tickSpacing = 100; + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { base.ApplyDefaults(timing, difficulty); Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime); - TickTimeDistance = timing.BeatLengthAt(StartTime); - - //TODO: move this to legacy conversion code to allow for direct division without special case. - if (difficulty.SliderTickRate == 3) - TickTimeDistance /= 3; - else - TickTimeDistance /= 4; + tickSpacing = timing.BeatLengthAt(StartTime) / TickRate; RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty); RequiredGreatHits = TotalTicks * Math.Min(0.30, 0.10 + 0.20 / 6 * difficulty.OverallDifficulty); @@ -81,17 +80,17 @@ namespace osu.Game.Modes.Taiko.Objects { var ret = new List(); - if (TickTimeDistance == 0) + if (tickSpacing == 0) return ret; bool first = true; - for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance) + for (double t = StartTime; t < EndTime + (int)tickSpacing; t += tickSpacing) { ret.Add(new DrumRollTick { FirstTick = first, PreEmpt = PreEmpt, - TickTimeDistance = TickTimeDistance, + TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, Sample = new HitSampleInfo diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs index 2ca0d71fc1..32e8851b66 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs @@ -11,14 +11,14 @@ namespace osu.Game.Modes.Taiko.Objects public bool FirstTick; /// - /// The distance between this tick and the next in milliseconds. + /// The length (in milliseconds) between this tick and the next. /// Half of this value is the hit window of the tick. /// - public double TickTimeDistance; + public double TickSpacing; /// /// The time allowed to hit this tick. /// - public double HitWindow => TickTimeDistance / 2; + public double HitWindow => TickSpacing / 2; } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs b/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs index c8a93c9068..89d974baf9 100644 --- a/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs +++ b/osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs @@ -72,14 +72,9 @@ namespace osu.Game.Modes.Taiko.Replays } else if (drumRoll != null) { - double delay = drumRoll.TickTimeDistance; - - double time = drumRoll.StartTime; - - for (int j = 0; j < drumRoll.TotalTicks; j++) + foreach (var tick in drumRoll.Ticks) { - Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); - time += delay; + Frames.Add(new ReplayFrame(tick.StartTime, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2)); hitButton = !hitButton; } } From d7ed392f2749ac8bf9be980a64b171bed359808b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 17:19:46 +0900 Subject: [PATCH 253/348] Add a velocity multiplier to taiko hit objects. This will be usable from the editor moving forward also - where every hit object can have its own velocity multiplier on top of the control point one. --- .../Beatmaps/TaikoBeatmapConverter.cs | 16 +++++++++------- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 2 +- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 7 ++++++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 0c356ebdc9..7749b5177a 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -26,8 +26,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps public Beatmap Convert(Beatmap original) { - if (original is LegacyBeatmap) - original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) { @@ -73,7 +71,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps { StartTime = obj.StartTime, Sample = obj.Sample, - IsStrong = strong + IsStrong = strong, + VelocityMultiplier = legacy_velocity_scale }; } } @@ -85,7 +84,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps Sample = obj.Sample, IsStrong = strong, Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale, - TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4 + TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, + VelocityMultiplier = legacy_velocity_scale }; } } @@ -98,9 +98,9 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - EndTime = endTimeData.EndTime, - RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier) + RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), + VelocityMultiplier = legacy_velocity_scale }; } else @@ -113,7 +113,8 @@ namespace osu.Game.Modes.Taiko.Beatmaps { StartTime = obj.StartTime, Sample = obj.Sample, - IsStrong = strong + IsStrong = strong, + VelocityMultiplier = legacy_velocity_scale }; } else @@ -123,6 +124,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, + VelocityMultiplier = legacy_velocity_scale }; } } diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ed8d332010..5c57ee77de 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -69,7 +69,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = base_distance * difficulty.SliderMultiplier * difficulty.SliderTickRate * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime); + Velocity = base_distance * difficulty.SliderMultiplier * VelocityMultiplier / timing.BeatLengthAt(StartTime); tickSpacing = timing.BeatLengthAt(StartTime) / TickRate; RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty); diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 327c0402ab..5de7e20b67 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -19,6 +19,11 @@ namespace osu.Game.Modes.Taiko.Objects /// private const double base_scroll_time = 6000; + /// + /// The velocity multiplier applied to this hit object. + /// + public float VelocityMultiplier = 1; + /// /// The time to scroll in the HitObject. /// @@ -39,7 +44,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; + PreEmpt = base_scroll_time / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; From 0c572990669d0fe5120c40f758b8568bcf6d0b9e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 17:20:46 +0900 Subject: [PATCH 254/348] Rewrite drum roll -> hit conversion to match osu-stable. --- .../Beatmaps/TaikoBeatmapConverter.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 7749b5177a..377ee37e2f 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -18,6 +18,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { private const float legacy_velocity_scale = 1.4f; private const float bash_convert_factor = 1.65f; + private const float base_scoring_distance = 100; /// /// Drum roll distance that results in a duration of 1 speed-adjusted beat length. @@ -26,7 +27,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps public Beatmap Convert(Beatmap original) { - return new Beatmap(original) { HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() @@ -51,17 +51,20 @@ namespace osu.Game.Modes.Taiko.Beatmaps if (distanceData != null) { - double sv = base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * beatmap.TimingInfo.BeatLengthAt(obj.StartTime) / 1000; - - double l = distanceData.Distance * legacy_velocity_scale; - double v = sv * legacy_velocity_scale; - double bl = beatmap.TimingInfo.BeatLengthAt(obj.StartTime); - int repeats = repeatsData?.RepeatCount ?? 1; - double skipPeriod = Math.Min(bl / beatmap.BeatmapInfo.Difficulty.SliderTickRate, distanceData.Duration / repeats); + double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(obj.StartTime) * beatmap.TimingInfo.SpeedMultiplierAt(obj.StartTime); + double distance = distanceData.Distance * repeats * legacy_velocity_scale; - if (skipPeriod > 0 && l / v * 1000 < 2 * bl) + double taikoVelocity = base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_scale; + double taikoDuration = distance / taikoVelocity; + + double osuVelocity = base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_scale; + double osuDuration = distance / osuVelocity; + + double skipPeriod = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats); + + if (skipPeriod > 0 && osuDuration < 2 * speedAdjustedBeatLength) { for (double j = obj.StartTime; j <= distanceData.EndTime + skipPeriod / 8; j += skipPeriod) { From a32eb665381c6700af3c359992151a640740f4bd Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 17:31:08 +0900 Subject: [PATCH 255/348] Fix missing speed multiplier + split onto multiple lines. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 5c57ee77de..ede576835c 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -69,7 +69,9 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = base_distance * difficulty.SliderMultiplier * VelocityMultiplier / timing.BeatLengthAt(StartTime); + double speedAdjutedBeatLength = timing.SpeedMultiplierAt(StartTime) * timing.BeatLengthAt(StartTime); + + Velocity = base_distance * difficulty.SliderMultiplier / speedAdjutedBeatLength * VelocityMultiplier; tickSpacing = timing.BeatLengthAt(StartTime) / TickRate; RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty); From e51fdd3c863098687f546c269734e3e9e3a0f6f8 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 3 Apr 2017 11:41:17 +0300 Subject: [PATCH 256/348] Added container whose visibility will be changable --- osu.Game/Modes/UI/HudOverlay.cs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 4a2f8f0c41..162fe05148 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -28,6 +28,8 @@ namespace osu.Game.Modes.UI private Bindable showKeyCounter; private Bindable showHud; + private readonly Container hud; + protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); protected abstract PercentageCounter CreateAccuracyCounter(); @@ -39,14 +41,19 @@ namespace osu.Game.Modes.UI RelativeSizeAxes = Axes.Both; AlwaysPresent = true; - Children = new Drawable[] + Add(hud = new Container { - KeyCounter = CreateKeyCounter(), - ComboCounter = CreateComboCounter(), - ScoreCounter = CreateScoreCounter(), - AccuracyCounter = CreateAccuracyCounter(), - HealthDisplay = CreateHealthDisplay(), - }; + RelativeSizeAxes = Axes.Both, + + Children = new Drawable[] + { + KeyCounter = CreateKeyCounter(), + ComboCounter = CreateComboCounter(), + ScoreCounter = CreateScoreCounter(), + AccuracyCounter = CreateAccuracyCounter(), + HealthDisplay = CreateHealthDisplay(), + } + }); } [BackgroundDependencyLoader(true)] @@ -80,9 +87,9 @@ namespace osu.Game.Modes.UI private void hudVisibilityChanged(object sender, EventArgs e) { if (showHud) - Show(); + hud.Show(); else - Hide(); + hud.Hide(); } public void BindProcessor(ScoreProcessor processor) From 91eec9e8fcf2f9f0dbeada7bba7be42a29da431d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 17:54:48 +0900 Subject: [PATCH 257/348] Fix incorrect split hit circle start time. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 377ee37e2f..c5843e84d9 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -72,7 +72,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps // depending on hitobject sound additions (not implemented fully yet) yield return new CentreHit { - StartTime = obj.StartTime, + StartTime = j, Sample = obj.Sample, IsStrong = strong, VelocityMultiplier = legacy_velocity_scale From 63a1eef6e4d2ed074a3e0b4b08e8093b8e21a664 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 3 Apr 2017 11:54:50 +0300 Subject: [PATCH 258/348] Removed unnecessary line --- osu.Game/Modes/UI/HudOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 162fe05148..e2e18e437e 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -39,7 +39,6 @@ namespace osu.Game.Modes.UI protected HudOverlay() { RelativeSizeAxes = Axes.Both; - AlwaysPresent = true; Add(hud = new Container { From e1d3befaed9292627473a55cd71c27507e77f5f5 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 3 Apr 2017 12:03:21 +0300 Subject: [PATCH 259/348] Added bool to ensure the notification is only displayed once per game execution --- osu.Game/Modes/UI/HudOverlay.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index e2e18e437e..a259f2d09f 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -30,6 +30,8 @@ namespace osu.Game.Modes.UI private readonly Container hud; + private static bool has_shown_notification_once = false; + protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); protected abstract PercentageCounter CreateAccuracyCounter(); @@ -66,8 +68,10 @@ namespace osu.Game.Modes.UI showHud.ValueChanged += hudVisibilityChanged; showHud.TriggerChange(); - if (!showHud) + if (!showHud && !has_shown_notification_once) { + has_shown_notification_once = true; + notificationManager?.Post(new SimpleNotification { Text = @"The score overlay is currently disabled. You can toogle this by pressing Shift + Tab." From c1b48c6cbf65ff20b2abe08f6cb9fb276cb11e9f Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 3 Apr 2017 12:17:53 +0300 Subject: [PATCH 260/348] FadeIn/Out --- osu.Game/Modes/UI/HudOverlay.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index a259f2d09f..a070afb889 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -19,6 +19,9 @@ namespace osu.Game.Modes.UI { public abstract class HudOverlay : Container { + private const int duration = 100; + + private readonly Container hud; public readonly KeyCounterCollection KeyCounter; public readonly ComboCounter ComboCounter; public readonly ScoreCounter ScoreCounter; @@ -28,8 +31,6 @@ namespace osu.Game.Modes.UI private Bindable showKeyCounter; private Bindable showHud; - private readonly Container hud; - private static bool has_shown_notification_once = false; protected abstract KeyCounterCollection CreateKeyCounter(); @@ -90,9 +91,9 @@ namespace osu.Game.Modes.UI private void hudVisibilityChanged(object sender, EventArgs e) { if (showHud) - hud.Show(); + hud.FadeIn(duration); else - hud.Hide(); + hud.FadeOut(duration); } public void BindProcessor(ScoreProcessor processor) From 19b5555ef2de5b339f0eaed25ac2821f44dd8fdf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 20:26:46 +0900 Subject: [PATCH 261/348] Slightly clean up archive readers + decoders. Read beatmap version into BeatmapInfo. --- .../Beatmaps/IO/LegacyFilesystemReader.cs | 17 +++------- .../Beatmaps/IO/OszArchiveReaderTest.cs | 9 +++++- osu.Game/Beatmaps/Formats/BeatmapDecoder.cs | 16 +++++----- .../Formats/ConstructableBeatmapDecoder.cs | 16 ---------- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 31 ++++++++++++++----- osu.Game/Beatmaps/IO/ArchiveReader.cs | 6 ---- osu.Game/Beatmaps/IO/OszArchiveReader.cs | 21 +++---------- osu.Game/Database/BeatmapDatabase.cs | 5 ++- osu.Game/Database/BeatmapInfo.cs | 2 ++ osu.Game/Database/DatabaseWorkingBeatmap.cs | 10 +++--- osu.Game/osu.Game.csproj | 1 - 11 files changed, 61 insertions(+), 73 deletions(-) delete mode 100644 osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index 0ef448cafe..ffa37c29b7 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -3,10 +3,8 @@ using System.IO; using System.Linq; -using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; using osu.Game.Beatmaps; -using osu.Game.Database; namespace osu.Desktop.Beatmaps.IO { @@ -18,20 +16,17 @@ namespace osu.Desktop.Beatmaps.IO public static void Register() => AddReader((storage, path) => Directory.Exists(path)); private string basePath { get; } - private Beatmap firstMap { get; } public LegacyFilesystemReader(string path) { basePath = path; + BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray(); + if (BeatmapFilenames.Length == 0) throw new FileNotFoundException(@"This directory contains no beatmaps"); + StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault(); - using (var stream = new StreamReader(GetStream(BeatmapFilenames[0]))) - { - var decoder = BeatmapDecoder.GetDecoder(stream); - firstMap = decoder.Decode(stream); - } } public override Stream GetStream(string name) @@ -39,14 +34,10 @@ namespace osu.Desktop.Beatmaps.IO return File.OpenRead(Path.Combine(basePath, name)); } - public override BeatmapMetadata ReadMetadata() - { - return firstMap.BeatmapInfo.Metadata; - } - public override void Dispose() { // no-op } + } } diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 2a69be92ca..8c44e6c954 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -7,6 +7,9 @@ using osu.Game.Beatmaps.IO; using osu.Game.Modes; using osu.Game.Modes.Osu; using osu.Game.Tests.Resources; +using osu.Game.Beatmaps.Formats; +using osu.Game.Beatmaps; +using osu.Game.Database; namespace osu.Game.Tests.Beatmaps.IO { @@ -53,7 +56,11 @@ namespace osu.Game.Tests.Beatmaps.IO using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz")) { var reader = new OszArchiveReader(osz); - var meta = reader.ReadMetadata(); + + BeatmapMetadata meta; + using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu"))) + meta = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; + Assert.AreEqual(241526, meta.OnlineBeatmapSetID); Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.ArtistUnicode); diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 425c6cc5dc..452bd595c7 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -13,13 +13,13 @@ namespace osu.Game.Beatmaps.Formats { private static Dictionary decoders { get; } = new Dictionary(); - public static BeatmapDecoder GetDecoder(TextReader stream) + public static BeatmapDecoder GetDecoder(StreamReader stream) { - var line = stream.ReadLine()?.Trim(); + string line = stream.ReadLine()?.Trim(); if (line == null || !decoders.ContainsKey(line)) throw new IOException(@"Unknown file format"); - return (BeatmapDecoder)Activator.CreateInstance(decoders[line]); + return (BeatmapDecoder)Activator.CreateInstance(decoders[line], line); } protected static void AddDecoder(string magic) where T : BeatmapDecoder @@ -27,17 +27,17 @@ namespace osu.Game.Beatmaps.Formats decoders[magic] = typeof(T); } - public virtual Beatmap Decode(TextReader stream) + public virtual Beatmap Decode(StreamReader stream) { return ParseFile(stream); } - public virtual void Decode(TextReader stream, Beatmap beatmap) + public virtual void Decode(StreamReader stream, Beatmap beatmap) { ParseFile(stream, beatmap); } - protected virtual Beatmap ParseFile(TextReader stream) + protected virtual Beatmap ParseFile(StreamReader stream) { var beatmap = new Beatmap { @@ -48,9 +48,11 @@ namespace osu.Game.Beatmaps.Formats Difficulty = new BeatmapDifficulty(), }, }; + ParseFile(stream, beatmap); return beatmap; } - protected abstract void ParseFile(TextReader stream, Beatmap beatmap); + + protected abstract void ParseFile(StreamReader stream, Beatmap beatmap); } } diff --git a/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs deleted file mode 100644 index 3e7dbb4d1b..0000000000 --- a/osu.Game/Beatmaps/Formats/ConstructableBeatmapDecoder.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.IO; - -namespace osu.Game.Beatmaps.Formats -{ - public class ConstructableBeatmapDecoder : BeatmapDecoder - { - protected override void ParseFile(TextReader stream, Beatmap beatmap) - { - throw new NotImplementedException(); - } - } -} diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 20b977499e..6d03205ca2 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -31,6 +31,17 @@ namespace osu.Game.Beatmaps.Formats // TODO: Not sure how far back to go, or differences between versions } + private readonly int beatmapVersion; + + public OsuLegacyDecoder() + { + } + + public OsuLegacyDecoder(string header) + { + beatmapVersion = int.Parse(header.Substring(17)); + } + private enum Section { None, @@ -246,32 +257,36 @@ namespace osu.Game.Beatmaps.Formats } } - protected override Beatmap ParseFile(TextReader stream) + protected override Beatmap ParseFile(StreamReader stream) { return new LegacyBeatmap(base.ParseFile(stream)); } - public override Beatmap Decode(TextReader stream) + public override Beatmap Decode(StreamReader stream) { return new LegacyBeatmap(base.Decode(stream)); } - protected override void ParseFile(TextReader stream, Beatmap beatmap) + protected override void ParseFile(StreamReader stream, Beatmap beatmap) { + beatmap.BeatmapInfo.BeatmapVersion = beatmapVersion; + HitObjectParser parser = null; bool hasCustomColours = false; - var section = Section.None; - while (true) + Section section = Section.None; + string line = null; + while ((line = stream.ReadLine()) != null) { - var line = stream.ReadLine(); - if (line == null) - break; if (string.IsNullOrEmpty(line)) continue; + if (line.StartsWith(@"osu file format v")) + { + beatmap.BeatmapInfo.BeatmapVersion = int.Parse(line.Substring(17)); continue; + } if (line.StartsWith(@"[") && line.EndsWith(@"]")) { diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/Beatmaps/IO/ArchiveReader.cs index bbf4de20f5..6c6b6be23c 100644 --- a/osu.Game/Beatmaps/IO/ArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/ArchiveReader.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using osu.Framework.IO.Stores; using osu.Framework.Platform; -using osu.Game.Database; namespace osu.Game.Beatmaps.IO { @@ -35,11 +34,6 @@ namespace osu.Game.Beatmaps.IO readers.Add(new Reader { Test = test, Type = typeof(T) }); } - /// - /// Reads the beatmap metadata from this archive. - /// - public abstract BeatmapMetadata ReadMetadata(); - /// /// Gets a list of beatmap file names. /// diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index 5c0f29fb86..6c550def8d 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -5,7 +5,6 @@ using System.IO; using System.Linq; using Ionic.Zip; using osu.Game.Beatmaps.Formats; -using osu.Game.Database; namespace osu.Game.Beatmaps.IO { @@ -23,23 +22,18 @@ namespace osu.Game.Beatmaps.IO private readonly Stream archiveStream; private readonly ZipFile archive; - private readonly Beatmap firstMap; public OszArchiveReader(Stream archiveStream) { this.archiveStream = archiveStream; archive = ZipFile.Read(archiveStream); - BeatmapFilenames = archive.Entries.Where(e => e.FileName.EndsWith(@".osu")) - .Select(e => e.FileName).ToArray(); + + BeatmapFilenames = archive.Entries.Where(e => e.FileName.EndsWith(@".osu")).Select(e => e.FileName).ToArray(); + if (BeatmapFilenames.Length == 0) throw new FileNotFoundException(@"This directory contains no beatmaps"); - StoryboardFilename = archive.Entries.Where(e => e.FileName.EndsWith(@".osb")) - .Select(e => e.FileName).FirstOrDefault(); - using (var stream = new StreamReader(GetStream(BeatmapFilenames[0]))) - { - var decoder = BeatmapDecoder.GetDecoder(stream); - firstMap = decoder.Decode(stream); - } + + StoryboardFilename = archive.Entries.Where(e => e.FileName.EndsWith(@".osb")).Select(e => e.FileName).FirstOrDefault(); } public override Stream GetStream(string name) @@ -50,11 +44,6 @@ namespace osu.Game.Beatmaps.IO return entry.OpenReader(); } - public override BeatmapMetadata ReadMetadata() - { - return firstMap.BeatmapInfo.Metadata; - } - public override void Dispose() { archive.Dispose(); diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index dfc916a136..41ddd8df39 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -175,7 +175,10 @@ namespace osu.Game.Database BeatmapMetadata metadata; using (var reader = ArchiveReader.GetReader(storage, path)) - metadata = reader.ReadMetadata(); + { + using (var stream = new StreamReader(reader.GetStream(reader.BeatmapFilenames[0]))) + metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; + } if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader { diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index cda9cba70c..890623091d 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -15,6 +15,8 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } + public int BeatmapVersion; + public int? OnlineBeatmapID { get; set; } public int? OnlineBeatmapSetID { get; set; } diff --git a/osu.Game/Database/DatabaseWorkingBeatmap.cs b/osu.Game/Database/DatabaseWorkingBeatmap.cs index 1b37cf2fa0..9fb3bed1e7 100644 --- a/osu.Game/Database/DatabaseWorkingBeatmap.cs +++ b/osu.Game/Database/DatabaseWorkingBeatmap.cs @@ -34,12 +34,14 @@ namespace osu.Game.Database using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path))) { decoder = BeatmapDecoder.GetDecoder(stream); - beatmap = decoder?.Decode(stream); + beatmap = decoder.Decode(stream); } - if (WithStoryboard && beatmap != null && BeatmapSetInfo.StoryboardFile != null) - using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile))) - decoder.Decode(stream, beatmap); + if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null) + return beatmap; + + using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile))) + decoder.Decode(stream, beatmap); } return beatmap; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ecb3f5084c..a9e8dfb5bb 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -142,7 +142,6 @@ - From 2be745853203470a5642c00f3579b1b3a11b071a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 20:27:11 +0900 Subject: [PATCH 262/348] Commenting (+ version check for speed adjustment). --- .../Beatmaps/TaikoBeatmapConverter.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index c5843e84d9..21b75070df 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Types; @@ -53,20 +52,33 @@ namespace osu.Game.Modes.Taiko.Beatmaps { int repeats = repeatsData?.RepeatCount ?? 1; - double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(obj.StartTime) * beatmap.TimingInfo.SpeedMultiplierAt(obj.StartTime); + double speedAdjustment = beatmap.TimingInfo.SpeedMultiplierAt(obj.StartTime); + double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(obj.StartTime) * speedAdjustment; + + // The true distance, accounting for any repeats. This ends up being the drum roll distance later double distance = distanceData.Distance * repeats * legacy_velocity_scale; + // The velocity of the taiko hit object - calculated as the velocity of a drum roll double taikoVelocity = base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_scale; + // The duration of the taiko hit object double taikoDuration = distance / taikoVelocity; + // For some reason, old osu! always uses speedAdjustment to determine the taiko velocity, but + // only uses it to determine osu! velocity if beatmap version < 8. Let's account for that here. + if (beatmap.BeatmapInfo.BeatmapVersion >= 8) + speedAdjustedBeatLength /= speedAdjustment; + + // The velocity of the osu! hit object - calculated as the velocity of a slider double osuVelocity = base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_scale; + // The duration of the osu! hit object double osuDuration = distance / osuVelocity; - double skipPeriod = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats); + // If the drum roll is to be split into hit circles, assume the ticks are 1/8 spaced within the duration of one beat + double tickSpacing = Math.Min(speedAdjustedBeatLength / beatmap.BeatmapInfo.Difficulty.SliderTickRate, taikoDuration / repeats) / 8; - if (skipPeriod > 0 && osuDuration < 2 * speedAdjustedBeatLength) + if (tickSpacing > 0 && osuDuration < 2 * speedAdjustedBeatLength) { - for (double j = obj.StartTime; j <= distanceData.EndTime + skipPeriod / 8; j += skipPeriod) + for (double j = obj.StartTime; j <= distanceData.EndTime + tickSpacing; j += tickSpacing) { // Todo: This should generate different type of hits (including strongs) // depending on hitobject sound additions (not implemented fully yet) @@ -86,7 +98,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale, + Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, VelocityMultiplier = legacy_velocity_scale }; From 15db37d9e0e8be5df134f631320813138ea80a8e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 20:27:25 +0900 Subject: [PATCH 263/348] Cleanup. --- osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs | 2 -- osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs | 1 - 2 files changed, 3 deletions(-) diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index ffa37c29b7..abc45d82ec 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using osu.Game.Beatmaps.IO; -using osu.Game.Beatmaps; namespace osu.Desktop.Beatmaps.IO { @@ -38,6 +37,5 @@ namespace osu.Desktop.Beatmaps.IO { // no-op } - } } diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index 8c44e6c954..b9c4cf780a 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -8,7 +8,6 @@ using osu.Game.Modes; using osu.Game.Modes.Osu; using osu.Game.Tests.Resources; using osu.Game.Beatmaps.Formats; -using osu.Game.Beatmaps; using osu.Game.Database; namespace osu.Game.Tests.Beatmaps.IO From 5cb16f6e7c42c6dbce3e1f62cc17201f2c01e080 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 20:32:03 +0900 Subject: [PATCH 264/348] Renamings + comments. --- .../Beatmaps/TaikoBeatmapConverter.cs | 39 ++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 21b75070df..594ed5f309 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -15,14 +15,27 @@ namespace osu.Game.Modes.Taiko.Beatmaps { internal class TaikoBeatmapConverter : IBeatmapConverter { - private const float legacy_velocity_scale = 1.4f; - private const float bash_convert_factor = 1.65f; - private const float base_scoring_distance = 100; + /// + /// osu! is generally slower than taiko, so a factor is added to increase + /// speed. This must be used everywhere slider length or beat length is used. + /// + private const float legacy_velocity_multiplier = 1.4f; + + /// + /// Because swells are easier in taiko than spinners are in osu!, + /// legacy taiko multiplies a factor when converting the number of required hits. + /// + private const float swell_hit_multiplier = 1.65f; + + /// + /// Base osu! slider scoring distance. + /// + private const float osu_base_scoring_distance = 100; /// /// Drum roll distance that results in a duration of 1 speed-adjusted beat length. /// - private const float base_distance = 100; + private const float taiko_base_distance = 100; public Beatmap Convert(Beatmap original) { @@ -56,10 +69,10 @@ namespace osu.Game.Modes.Taiko.Beatmaps double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(obj.StartTime) * speedAdjustment; // The true distance, accounting for any repeats. This ends up being the drum roll distance later - double distance = distanceData.Distance * repeats * legacy_velocity_scale; + double distance = distanceData.Distance * repeats * legacy_velocity_multiplier; // The velocity of the taiko hit object - calculated as the velocity of a drum roll - double taikoVelocity = base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_scale; + double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier; // The duration of the taiko hit object double taikoDuration = distance / taikoVelocity; @@ -69,7 +82,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps speedAdjustedBeatLength /= speedAdjustment; // The velocity of the osu! hit object - calculated as the velocity of a slider - double osuVelocity = base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_scale; + double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier; // The duration of the osu! hit object double osuDuration = distance / osuVelocity; @@ -87,7 +100,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = j, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_scale + VelocityMultiplier = legacy_velocity_multiplier }; } } @@ -100,13 +113,13 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, - VelocityMultiplier = legacy_velocity_scale + VelocityMultiplier = legacy_velocity_multiplier }; } } else if (endTimeData != null) { - double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * bash_convert_factor; + double hitMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.OverallDifficulty, 3, 5, 7.5) * swell_hit_multiplier; yield return new Swell { @@ -115,7 +128,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), - VelocityMultiplier = legacy_velocity_scale + VelocityMultiplier = legacy_velocity_multiplier }; } else @@ -129,7 +142,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_scale + VelocityMultiplier = legacy_velocity_multiplier }; } else @@ -139,7 +152,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_scale + VelocityMultiplier = legacy_velocity_multiplier }; } } From 2e80ecfda845945c526f91fc7b282175815fb9db Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 20:33:10 +0900 Subject: [PATCH 265/348] Don't need explicit null value. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 6d03205ca2..748583606b 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -273,10 +273,10 @@ namespace osu.Game.Beatmaps.Formats HitObjectParser parser = null; + Section section = Section.None; bool hasCustomColours = false; - Section section = Section.None; - string line = null; + string line; while ((line = stream.ReadLine()) != null) { if (string.IsNullOrEmpty(line)) From 5baa887f55466556c7270e8fbe2dadf8c55886fb Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Mon, 3 Apr 2017 14:58:38 +0300 Subject: [PATCH 266/348] Fixes --- osu.Game/Modes/UI/HudOverlay.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index a070afb889..f493ae942d 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -31,7 +31,7 @@ namespace osu.Game.Modes.UI private Bindable showKeyCounter; private Bindable showHud; - private static bool has_shown_notification_once = false; + private static bool hasShownNotificationOnce; protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); @@ -69,9 +69,9 @@ namespace osu.Game.Modes.UI showHud.ValueChanged += hudVisibilityChanged; showHud.TriggerChange(); - if (!showHud && !has_shown_notification_once) + if (!showHud && !hasShownNotificationOnce) { - has_shown_notification_once = true; + hasShownNotificationOnce = true; notificationManager?.Post(new SimpleNotification { From 7edabe730a920266fa1e27ec567c2ff905546655 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 3 Apr 2017 21:10:39 +0900 Subject: [PATCH 267/348] Cleanup. --- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index a22ef11f7d..a44410c4a4 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -14,10 +14,8 @@ using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects.Drawable; -using osu.Game.Modes.Taiko.Replays; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; -using osu.Game.Modes.Replays; using osu.Game.Modes.Taiko.Replays; namespace osu.Game.Modes.Taiko.UI @@ -48,7 +46,7 @@ namespace osu.Game.Modes.Taiko.UI var timingPoints = Beatmap.TimingInfo.ControlPoints.FindAll(cp => cp.TimingChange); - if (timingPoints == null || timingPoints.Count == 0) + if (timingPoints.Count == 0) return; int currentIndex = 0; From d0ebbad0fab3da4833bc9e295270fce20dbb684c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 09:47:52 +0900 Subject: [PATCH 268/348] Fix avatar display. --- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index adcf8fd042..2bac387c5c 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -157,6 +157,7 @@ namespace osu.Game.Screens.Select.Leaderboards }) { TimeBeforeLoad = 500, + RelativeSizeAxes = Axes.None, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), }, new Container From 8fcb1690cf2d5abd271daa16feaa2a85f67442e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 10:33:48 +0900 Subject: [PATCH 269/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 1c08c1fec4..e9b388934e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1c08c1fec496e9d64ba8f30ff0464cd5cdf567b6 +Subproject commit e9b388934ed77cbc1af3cdfd213eb754f71554ae From 353cf2a0264b530ec8067ab93aedf25716b907d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 10:32:57 +0900 Subject: [PATCH 270/348] Adjust timings to make TestCase more usable. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 14af26dbe4..7d606d7dd3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -19,6 +19,8 @@ namespace osu.Desktop.VisualTests.Tests private TaikoPlayfield playfield; + protected override double TimePerAction => 500; + public override void Reset() { base.Reset(); @@ -91,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests playfield.Add(new DrawableSwell(new Swell { StartTime = Time.Current + 1000, - EndTime = Time.Current + 5000, + EndTime = Time.Current + 1000, PreEmpt = 1000 })); } @@ -101,7 +103,7 @@ namespace osu.Desktop.VisualTests.Tests var d = new DrumRoll { StartTime = Time.Current + 1000, - Distance = 20000, + Distance = 1000, PreEmpt = 1000, }; From b0ebacb06d67edfb1b6dfeaccecf4adbea480a49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 18:33:14 +0900 Subject: [PATCH 271/348] Fix some unused variables in test cases. --- .../Tests/TestCaseChatDisplay.cs | 3 --- .../Tests/TestCasePlaySongSelect.cs | 14 +++++++------- osu.Desktop.VisualTests/Tests/TestCaseReplay.cs | 9 --------- .../Tests/TestCaseScoreCounter.cs | 2 -- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 2cb63ba7a0..2663c952cf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -3,15 +3,12 @@ using osu.Framework.Testing; using osu.Framework.Graphics.Containers; -using osu.Framework.Threading; using osu.Game.Overlays; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseChatDisplay : TestCase { - private ScheduledDelegate messageRequest; - public override string Description => @"Testing chat api and overlay"; public override void Reset() diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index aedab7e895..1a43425dda 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -14,7 +14,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCasePlaySongSelect : TestCase { - private BeatmapDatabase db, oldDb; + private BeatmapDatabase db; private TestStorage storage; private PlaySongSelect songSelect; @@ -44,13 +44,13 @@ namespace osu.Desktop.VisualTests.Tests AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } - protected override void Dispose(bool isDisposing) - { - if (oldDb != null) - db = null; + //protected override void Dispose(bool isDisposing) + //{ + // if (oldDb != null) + // db = null; - base.Dispose(isDisposing); - } + // base.Dispose(isDisposing); + //} private BeatmapSetInfo createTestBeatmapSet(int i) { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs index c36fc0a47d..ffdca25bb3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs @@ -1,24 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input.Handlers; using osu.Game.Beatmaps; using osu.Game.Modes.Mods; using osu.Game.Modes.Osu.Mods; using osu.Game.Screens.Play; -using System; -using System.IO; namespace osu.Desktop.VisualTests.Tests { internal class TestCaseReplay : TestCasePlayer { - private WorkingBeatmap beatmap; - - private InputHandler replay; - - private Func getReplayStream; - public override string Description => @"Testing replay playback."; protected override Player CreatePlayer(WorkingBeatmap beatmap) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index 55fc969217..f3cca16678 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -22,8 +22,6 @@ namespace osu.Desktop.VisualTests.Tests int numerator = 0, denominator = 0; - bool maniaHold = false; - ScoreCounter score = new ScoreCounter(7) { Origin = Anchor.TopRight, From f6303d55ec04e89d4635667a4304e8f19933a21d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 18:35:33 +0900 Subject: [PATCH 272/348] Upodate some tab usages. --- .../Tests/TestCaseTabControl.cs | 4 +- .../Graphics/UserInterface/OsuTabControl.cs | 49 ++++++++----------- .../Select/BeatmapDetailAreaTabControl.cs | 4 +- 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 23e7f8a74d..780ff7b833 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -36,9 +36,9 @@ namespace osu.Desktop.VisualTests.Tests filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.ItemChanged += (sender, mode) => + filter.SelectedItem.ValueChanged += (sender, args) => { - text.Text = "Currently Selected: " + mode.ToString(); + text.Text = "Currently Selected: " + filter.SelectedItem.ToString(); }; } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 6d17d79ca1..242a9a8f6a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -21,7 +21,7 @@ namespace osu.Game.Graphics.UserInterface { protected override Dropdown CreateDropdown() => new OsuTabDropdown(); - protected override TabItem CreateTabItem(T value) => new OsuTabItem { Value = value }; + protected override TabItem CreateTabItem(T value) => new OsuTabItem(value); protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || Dropdown.Contains(screenSpacePos); @@ -75,16 +75,6 @@ namespace osu.Game.Graphics.UserInterface } } - public new T Value - { - get { return base.Value; } - set - { - base.Value = value; - text.Text = (value as Enum)?.GetDescription(); - } - } - public override bool Active { get { return base.Active; } @@ -134,30 +124,31 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Blue; } - public OsuTabItem() + public OsuTabItem(T value) : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Children = new Drawable[] { - text = new OsuSpriteText - { - Margin = new MarginPadding { Top = 5, Bottom = 5 }, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - TextSize = 14, - Font = @"Exo2.0-Bold", // Font should only turn bold when active? - }, - box = new Box - { - RelativeSizeAxes = Axes.X, - Height = 1, - Alpha = 0, - Colour = Color4.White, - Origin = Anchor.BottomLeft, - Anchor = Anchor.BottomLeft, - } + text = new OsuSpriteText + { + Margin = new MarginPadding { Top = 5, Bottom = 5 }, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + Text = (value as Enum)?.GetDescription(), + TextSize = 14, + Font = @"Exo2.0-Bold", // Font should only turn bold when active? + }, + box = new Box + { + RelativeSizeAxes = Axes.X, + Height = 1, + Alpha = 0, + Colour = Color4.White, + Origin = Anchor.BottomLeft, + Anchor = Anchor.BottomLeft, + } }; } } diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 088346d91f..c9ea9e884e 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -61,10 +61,10 @@ namespace osu.Game.Screens.Select }, }; - tabs.ItemChanged += (sender, e) => invokeOnFilter(); + tabs.SelectedItem.ValueChanged += (sender, e) => invokeOnFilter(); modsCheckbox.Action += (sender, e) => invokeOnFilter(); - tabs.SelectedItem = BeatmapDetailTab.Global; + tabs.SelectedItem.Value = BeatmapDetailTab.Global; } } From 7c74951454498206d559f9906d402d951a8760e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 19:34:00 +0900 Subject: [PATCH 273/348] Update bindables. # Conflicts: # osu.Desktop.VisualTests/Tests/TestCaseResults.cs # osu.Game/Screens/Ranking/ResultModeButton.cs # osu.Game/Screens/Ranking/Results.cs --- osu-resources | 2 +- .../Tests/TestCaseHitObjects.cs | 2 +- .../Tests/TestCaseKeyCounter.cs | 2 +- .../Tests/TestCaseTabControl.cs | 4 +-- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 26 +++++--------- osu.Game/Configuration/OsuConfigManager.cs | 4 --- osu.Game/Graphics/Cursor/GameplayCursor.cs | 8 +---- osu.Game/Graphics/Cursor/MenuCursor.cs | 7 +--- .../Graphics/UserInterface/OsuCheckbox.cs | 5 ++- .../Graphics/UserInterface/RollingCounter.cs | 11 +++--- .../UserInterface/Volume/VolumeControl.cs | 3 +- osu.Game/Modes/UI/ComboCounter.cs | 7 +--- osu.Game/Modes/UI/HealthDisplay.cs | 2 +- osu.Game/Modes/UI/HudOverlay.cs | 17 ++++----- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 6 ++-- osu.Game/Overlays/MusicController.cs | 35 ++++++------------- osu.Game/Overlays/Options/OptionSlider.cs | 4 +-- osu.Game/Overlays/Options/OptionTextBox.cs | 6 +--- .../Sections/Graphics/LayoutOptions.cs | 5 ++- osu.Game/Screens/OsuGameScreen.cs | 8 +---- osu.Game/Screens/Play/Player.cs | 10 ++---- .../Select/BeatmapDetailAreaTabControl.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 6 ++-- osu.Game/Screens/Select/SongSelect.cs | 5 +-- 24 files changed, 57 insertions(+), 130 deletions(-) diff --git a/osu-resources b/osu-resources index 12bbab717d..0d6dc29473 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 12bbab717d372dadbd3220d38da862276ac97e98 +Subproject commit 0d6dc294738d433999c6c68ff61169d3a8e6ce5f diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index cb7a3e3f84..99da7d1c73 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -112,7 +112,7 @@ namespace osu.Desktop.VisualTests.Tests Width = 150, Height = 10, SelectionColor = Color4.Orange, - Bindable = playbackSpeed + Value = playbackSpeed } } }); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 3dba201f5d..7e7782662b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -57,7 +57,7 @@ namespace osu.Desktop.VisualTests.Tests Width = 150, Height = 10, SelectionColor = Color4.Orange, - Bindable = bindable + Value = bindable } } }); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 780ff7b833..2d3969b822 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -36,9 +36,9 @@ namespace osu.Desktop.VisualTests.Tests filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.SelectedItem.ValueChanged += (sender, args) => + filter.SelectedItem.ValueChanged += newFilter => { - text.Text = "Currently Selected: " + filter.SelectedItem.ToString(); + text.Text = "Currently Selected: " + newFilter.ToString(); }; } } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 89399a56ff..534578337f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -22,8 +22,9 @@ namespace osu.Game.Beatmaps.Drawables public Action GainedSelection; private readonly SpriteText title; private readonly SpriteText artist; - private OsuConfigManager config; + private Bindable preferUnicode; + private readonly WorkingBeatmap beatmap; private readonly FillFlowContainer difficultyIcons; @@ -83,24 +84,13 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - this.config = config; - preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += preferUnicode_changed; - preferUnicode_changed(preferUnicode, null); - } - - private void preferUnicode_changed(object sender, EventArgs e) - { - title.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Title, beatmap.BeatmapSetInfo.Metadata.TitleUnicode); - artist.Text = config.GetUnicodeString(beatmap.BeatmapSetInfo.Metadata.Artist, beatmap.BeatmapSetInfo.Metadata.ArtistUnicode); - } - - protected override void Dispose(bool isDisposing) - { - if (preferUnicode != null) - preferUnicode.ValueChanged -= preferUnicode_changed; - base.Dispose(isDisposing); + preferUnicode.ValueChanged += unicode => + { + title.Text = unicode ? beatmap.BeatmapSetInfo.Metadata.TitleUnicode : beatmap.BeatmapSetInfo.Metadata.Title; + artist.Text = unicode ? beatmap.BeatmapSetInfo.Metadata.ArtistUnicode : beatmap.BeatmapSetInfo.Metadata.Artist; + }; + preferUnicode.TriggerChange(); } private class PanelBackground : BufferedContainer diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 6190678e1e..a4a960a7bc 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -187,10 +187,6 @@ namespace osu.Game.Configuration #pragma warning restore CS0612 // Type or member is obsolete } - //todo: make a UnicodeString class/struct rather than requiring this helper method. - public string GetUnicodeString(string nonunicode, string unicode) - => Get(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode; - public OsuConfigManager(Storage storage) : base(storage) { } diff --git a/osu.Game/Graphics/Cursor/GameplayCursor.cs b/osu.Game/Graphics/Cursor/GameplayCursor.cs index 3f94bbaddc..3f699219a4 100644 --- a/osu.Game/Graphics/Cursor/GameplayCursor.cs +++ b/osu.Game/Graphics/Cursor/GameplayCursor.cs @@ -12,7 +12,6 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; using osu.Game.Configuration; -using System; namespace osu.Game.Graphics.Cursor { @@ -116,14 +115,9 @@ namespace osu.Game.Graphics.Cursor }; cursorScale = config.GetBindable(OsuConfig.GameplayCursorSize); - cursorScale.ValueChanged += scaleChanged; + cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale); cursorScale.TriggerChange(); } - - private void scaleChanged(object sender, EventArgs e) - { - cursorContainer.Scale = new Vector2((float)cursorScale); - } } } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 67b17fae5c..0fb7f59212 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -131,14 +131,9 @@ namespace osu.Game.Graphics.Cursor }; cursorScale = config.GetBindable(OsuConfig.MenuCursorSize); - cursorScale.ValueChanged += scaleChanged; + cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale); cursorScale.TriggerChange(); } - - private void scaleChanged(object sender, EventArgs e) - { - cursorContainer.Scale = new Vector2((float)cursorScale); - } } } } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index fc44d80ea6..6a5151b90c 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -86,9 +85,9 @@ namespace osu.Game.Graphics.UserInterface }; } - private void bindableValueChanged(object sender, EventArgs e) + private void bindableValueChanged(bool isChecked) { - State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; + State = isChecked ? CheckboxState.Checked : CheckboxState.Unchecked; } protected override void Dispose(bool isDisposing) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index a4f6092d66..12eeb771dd 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -98,13 +98,10 @@ namespace osu.Game.Graphics.UserInterface DisplayedCount = Current; - Current.ValueChanged += currentChanged; - } - - private void currentChanged(object sender, EventArgs e) - { - if (IsLoaded) - TransformCount(displayedCount, Current); + Current.ValueChanged += newValue => + { + if (IsLoaded) TransformCount(displayedCount, newValue); + }; } protected override void LoadComplete() diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 374385e351..4933c170e8 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // 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.Input; @@ -19,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface.Volume protected override bool HideOnEscape => false; - private void volumeChanged(object sender, EventArgs e) + private void volumeChanged(double newVolume) { Show(); schedulePopOut(); diff --git a/osu.Game/Modes/UI/ComboCounter.cs b/osu.Game/Modes/UI/ComboCounter.cs index 3629634889..8c0327fa04 100644 --- a/osu.Game/Modes/UI/ComboCounter.cs +++ b/osu.Game/Modes/UI/ComboCounter.cs @@ -66,12 +66,7 @@ namespace osu.Game.Modes.UI TextSize = 80; - Current.ValueChanged += comboChanged; - } - - private void comboChanged(object sender, System.EventArgs e) - { - updateCount(Current.Value == 0); + Current.ValueChanged += newValue => updateCount(newValue == 0); } protected override void LoadComplete() diff --git a/osu.Game/Modes/UI/HealthDisplay.cs b/osu.Game/Modes/UI/HealthDisplay.cs index 3471f4bc3f..4c8d7e4ab8 100644 --- a/osu.Game/Modes/UI/HealthDisplay.cs +++ b/osu.Game/Modes/UI/HealthDisplay.cs @@ -16,7 +16,7 @@ namespace osu.Game.Modes.UI protected HealthDisplay() { - Current.ValueChanged += (s, e) => SetHealth((float)Current); + Current.ValueChanged += newValue => SetHealth((float)newValue); } protected abstract void SetHealth(float value); diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index a6c54e7f3a..945f4a2fa8 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; -using System; using osu.Game.Modes.Scoring; namespace osu.Game.Modes.UI @@ -47,18 +46,16 @@ namespace osu.Game.Modes.UI private void load(OsuConfigManager config) { showKeyCounter = config.GetBindable(OsuConfig.KeyOverlay); - showKeyCounter.ValueChanged += visibilityChanged; + showKeyCounter.ValueChanged += visibility => + { + if (visibility) + KeyCounter.Show(); + else + KeyCounter.Hide(); + }; showKeyCounter.TriggerChange(); } - private void visibilityChanged(object sender, EventArgs e) - { - if (showKeyCounter) - KeyCounter.Show(); - else - KeyCounter.Hide(); - } - public void BindProcessor(ScoreProcessor processor) { //bind processor bindables to combocounter, score display etc. diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 0272438927..2b9f8e86a9 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -39,9 +39,9 @@ namespace osu.Game.Overlays.Mods public readonly Bindable PlayMode = new Bindable(); - private void modeChanged(object sender, EventArgs eventArgs) + private void modeChanged(PlayMode newMode) { - var ruleset = Ruleset.GetRuleset(PlayMode); + var ruleset = Ruleset.GetRuleset(newMode); foreach (ModSection section in modSectionsContainer.Children) section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); refreshSelectedMods(); @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Mods if (osu != null) PlayMode.BindTo(osu.PlayMode); PlayMode.ValueChanged += modeChanged; - modeChanged(null, null); + PlayMode.TriggerChange(); } protected override void PopOut() diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index aa0ea1ae9b..9f3eeb47a0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -78,8 +78,6 @@ namespace osu.Game.Overlays [BackgroundDependencyLoader] private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours) { - unicodeString = config.GetUnicodeString; - Children = new Drawable[] { dragContainer = new Container @@ -210,7 +208,7 @@ namespace osu.Game.Overlays this.beatmaps = beatmaps; trackManager = game.Audio.Track; preferUnicode = config.GetBindable(OsuConfig.ShowUnicode); - preferUnicode.ValueChanged += preferUnicode_changed; + preferUnicode.ValueChanged += unicode => updateDisplay(current, TransformDirection.None); beatmapSource = game.Beatmap ?? new Bindable(); playList = beatmaps.GetAllWithChildren(); @@ -222,7 +220,8 @@ namespace osu.Game.Overlays protected override void LoadComplete() { beatmapSource.ValueChanged += workingChanged; - workingChanged(); + beatmapSource.TriggerChange(); + base.LoadComplete(); } @@ -247,17 +246,12 @@ namespace osu.Game.Overlays playButton.Icon = FontAwesome.fa_play_circle_o; } - private void preferUnicode_changed(object sender, EventArgs e) + private void workingChanged(WorkingBeatmap beatmap) { - updateDisplay(current, TransformDirection.None); - } - - private void workingChanged(object sender = null, EventArgs e = null) - { - progress.IsEnabled = beatmapSource.Value != null; - if (beatmapSource.Value == current) return; - bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmapSource?.Value?.BeatmapInfo) ?? false; - current = beatmapSource.Value; + progress.IsEnabled = beatmap != null; + if (beatmap == current) return; + bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmap?.BeatmapInfo) ?? false; + current = beatmap; updateDisplay(current, audioEquals ? TransformDirection.None : TransformDirection.Next); appendToHistory(current?.BeatmapInfo); } @@ -342,8 +336,8 @@ namespace osu.Game.Overlays else { BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata; - title.Text = unicodeString(metadata.Title, metadata.TitleUnicode); - artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode); + title.Text = preferUnicode ? metadata.TitleUnicode : metadata.Title; + artist.Text = preferUnicode ? metadata.ArtistUnicode : metadata.Artist; } }); @@ -374,21 +368,12 @@ namespace osu.Game.Overlays }; } - private Func unicodeString; - private void seek(float position) { current?.Track?.Seek(current.Track.Length * position); current?.Track?.Start(); } - protected override void Dispose(bool isDisposing) - { - if (preferUnicode != null) - preferUnicode.ValueChanged -= preferUnicode_changed; - base.Dispose(isDisposing); - } - private const float transition_length = 800; protected override void PopIn() diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 772d2c37e6..8fa9bf063d 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -29,10 +29,10 @@ namespace osu.Game.Overlays.Options public BindableNumber Bindable { - get { return slider.Bindable; } + get { return slider.Value; } set { - slider.Bindable = value; + slider.Value = value; if (value?.Disabled ?? true) Alpha = 0.3f; } diff --git a/osu.Game/Overlays/Options/OptionTextBox.cs b/osu.Game/Overlays/Options/OptionTextBox.cs index 47c81e6a7e..722f24d50d 100644 --- a/osu.Game/Overlays/Options/OptionTextBox.cs +++ b/osu.Game/Overlays/Options/OptionTextBox.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Configuration; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; @@ -41,10 +40,7 @@ namespace osu.Game.Overlays.Options bindable.Value = Text; } - private void bindableValueChanged(object sender, EventArgs e) - { - Text = bindable.Value; - } + private void bindableValueChanged(string newValue) => Text = newValue; protected override void Dispose(bool isDisposing) { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs index 8c4930d99d..b04f853ec4 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/LayoutOptions.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; -using System; namespace osu.Game.Overlays.Options.Sections.Graphics { @@ -52,9 +51,9 @@ namespace osu.Game.Overlays.Options.Sections.Graphics letterboxing.TriggerChange(); } - private void visibilityChanged(object sender, EventArgs e) + private void visibilityChanged(bool newVisibility) { - if (letterboxing) + if (newVisibility) { letterboxPositionX.Show(); letterboxPositionY.Show(); diff --git a/osu.Game/Screens/OsuGameScreen.cs b/osu.Game/Screens/OsuGameScreen.cs index a5c6cec09e..3e832b36fa 100644 --- a/osu.Game/Screens/OsuGameScreen.cs +++ b/osu.Game/Screens/OsuGameScreen.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Screens; @@ -40,11 +39,6 @@ namespace osu.Game.Screens } } - private void beatmap_ValueChanged(object sender, EventArgs e) - { - OnBeatmapChanged(beatmap.Value); - } - [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuGameBase game) { @@ -57,7 +51,7 @@ namespace osu.Game.Screens beatmap.Value = localMap; } - beatmap.ValueChanged += beatmap_ValueChanged; + beatmap.ValueChanged += OnBeatmapChanged; } protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c678e9bf37..b263b5507c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -275,7 +275,8 @@ namespace osu.Game.Screens.Play Background?.FadeTo((100f - dimLevel) / 100, 1500, EasingTypes.OutQuint); Content.Alpha = 0; - dimLevel.ValueChanged += dimChanged; + + dimLevel.ValueChanged += newDim => Background?.FadeTo((100f - newDim) / 100, 800); Content.ScaleTo(0.7f); @@ -318,18 +319,11 @@ namespace osu.Game.Screens.Play { FadeOut(250); Content.ScaleTo(0.7f, 750, EasingTypes.InQuint); - - dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } } - private void dimChanged(object sender, EventArgs e) - { - Background?.FadeTo((100f - dimLevel) / 100, 800); - } - private Bindable mouseWheelDisabled; protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index c9ea9e884e..c52d0397ed 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select }, }; - tabs.SelectedItem.ValueChanged += (sender, e) => invokeOnFilter(); + tabs.SelectedItem.ValueChanged += item => invokeOnFilter(); modsCheckbox.Action += (sender, e) => invokeOnFilter(); tabs.SelectedItem.Value = BeatmapDetailTab.Global; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 5445847da5..26daddc3a9 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -151,8 +151,8 @@ namespace osu.Game.Screens.Select groupTabs.PinItem(GroupMode.All); groupTabs.PinItem(GroupMode.RecentlyPlayed); - groupTabs.ItemChanged += (sender, value) => Group = value; - sortTabs.ItemChanged += (sender, value) => Sort = value; + groupTabs.SelectedItem.ValueChanged += val => Group = val; + sortTabs.SelectedItem.ValueChanged += val => Sort = val; } public void Deactivate() @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Select if (osu != null) playMode.BindTo(osu.PlayMode); - playMode.ValueChanged += (s, e) => FilterChanged?.Invoke(CreateCriteria()); + playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 656adf0d62..44204f5beb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Linq; using System.Threading; using OpenTK; @@ -170,7 +169,7 @@ namespace osu.Game.Screens.Select if (osu != null) playMode.BindTo(osu.PlayMode); - playMode.ValueChanged += playMode_ValueChanged; + playMode.ValueChanged += val => Beatmap.PreferredPlayMode = val; if (database == null) database = beatmaps; @@ -276,8 +275,6 @@ namespace osu.Game.Screens.Select initialAddSetsTask.Cancel(); } - private void playMode_ValueChanged(object sender, EventArgs e) => Beatmap.PreferredPlayMode = playMode; - private void changeBackground(WorkingBeatmap beatmap) { var backgroundModeBeatmap = Background as BackgroundScreenBeatmap; From c6216dbde12a8a212bae9ae2c36d5e372ce63de2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 15:22:54 +0900 Subject: [PATCH 274/348] Remove outdated todo. --- osu.Game/Modes/UI/HudOverlay.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 945f4a2fa8..45dce8b332 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -58,8 +58,6 @@ namespace osu.Game.Modes.UI public void BindProcessor(ScoreProcessor processor) { - //bind processor bindables to combocounter, score display etc. - //TODO: these should be bindable binds, not events! ScoreCounter?.Current.BindTo(processor.TotalScore); AccuracyCounter?.Current.BindTo(processor.Accuracy); ComboCounter?.Current.BindTo(processor.Combo); From 1233fb5b82755271b3c248641ae760c66249d420 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 3 Apr 2017 14:41:46 +0900 Subject: [PATCH 275/348] Split noto out into individual ranges. --- osu.Game/OsuGameBase.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index f454956de7..f95e8c3ac6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -92,7 +92,10 @@ namespace osu.Game Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); - Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic")); + Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic")); From 2df360a5e9daa9926b951709907bd5373754b2df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 12:38:55 +0900 Subject: [PATCH 276/348] Fix clashing namespace. --- .../Tests/TestCaseTaikoHitObjects.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- .../DrawableBarLine.cs | 2 +- .../DrawableCentreHit.cs | 8 ++--- .../DrawableDrumRoll.cs | 10 +++--- .../DrawableDrumRollTick.cs | 10 +++--- .../{Drawable => Drawables}/DrawableHit.cs | 12 +++---- .../DrawableMajorBarLine.cs | 2 +- .../{Drawable => Drawables}/DrawableRimHit.cs | 4 +-- .../DrawableStrongCentreHit.cs | 6 ++-- .../DrawableStrongDrumRoll.cs | 4 +-- .../DrawableStrongHit.cs | 4 +-- .../DrawableStrongRimHit.cs | 4 +-- .../{Drawable => Drawables}/DrawableSwell.cs | 20 +++++------ .../DrawableTaikoHitObject.cs | 8 ++--- .../Pieces/CentreHitSymbolPiece.cs | 4 +-- .../Pieces/CirclePiece.cs | 12 +++---- .../Pieces/RimHitSymbolPiece.cs | 4 +-- .../Pieces/StrongCirclePiece.cs | 2 +- .../Pieces/SwellSymbolPiece.cs | 4 +-- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 +- .../osu.Game.Modes.Taiko.csproj | 36 +++++++++---------- 23 files changed, 82 insertions(+), 82 deletions(-) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableBarLine.cs (94%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableCentreHit.cs (85%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableDrumRoll.cs (94%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableDrumRollTick.cs (95%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableHit.cs (91%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableMajorBarLine.cs (94%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableRimHit.cs (85%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableStrongCentreHit.cs (85%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableStrongDrumRoll.cs (82%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableStrongHit.cs (95%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableStrongRimHit.cs (85%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableSwell.cs (94%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/DrawableTaikoHitObject.cs (95%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/Pieces/CentreHitSymbolPiece.cs (90%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/Pieces/CirclePiece.cs (92%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/Pieces/RimHitSymbolPiece.cs (91%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/Pieces/StrongCirclePiece.cs (90%) rename osu.Game.Modes.Taiko/Objects/{Drawable => Drawables}/Pieces/SwellSymbolPiece.cs (88%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 7aeb75ef8d..1f0bdf40e0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -6,7 +6,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; namespace osu.Desktop.VisualTests.Tests { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 7d606d7dd3..c7ef33c573 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -8,7 +8,7 @@ using osu.Framework.Testing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Objects.Drawable; +using osu.Game.Modes.Taiko.Objects.Drawables; using osu.Game.Modes.Taiko.UI; namespace osu.Desktop.VisualTests.Tests diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs index 8c963a8e4f..6567975796 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { /// /// A line that scrolls alongside hit objects in the playfield and visualises control points. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs index 76eb6bb77d..c79351f4d9 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using osu.Game.Graphics; using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableCentreHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index ea6b0043d7..4e8d75315d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -1,18 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableDrumRoll : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index b7509bc51d..85f9e32c6c 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -1,17 +1,17 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; -using osu.Game.Modes.Taiko.Judgements; using System; -using osu.Game.Modes.Objects.Drawables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Modes.Taiko.Judgements; using OpenTK; using OpenTK.Graphics; -using osu.Framework.Graphics.Sprites; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableDrumRollTick : DrawableTaikoHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs index 87f0e76f60..25ecd5ac84 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; +using System; +using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System; -using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public abstract class DrawableHit : DrawableTaikoHitObject { @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// protected abstract Key[] HitKeys { get; } - protected override Container Content => bodyContainer; + protected override Container Content => bodyContainer; protected readonly CirclePiece Circle; diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs index 684ea93dec..14d3d84f4b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableMajorBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableMajorBarLine : DrawableBarLine { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs index 893a6fbb4d..0fa51b1661 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableRimHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs index bac44f48fb..815c19779a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableStrongCentreHit : DrawableStrongHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs similarity index 82% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs index e9723a0162..bb7e197502 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs @@ -2,9 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableStrongDrumRoll : DrawableDrumRoll { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs index a6cb6ae7fa..116ef94ee4 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using System; using System.Linq; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public abstract class DrawableStrongHit : DrawableHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs similarity index 85% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs index 985ba1c2df..3af0ff399b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableStrongRimHit : DrawableStrongHit { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs similarity index 94% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs index ec1ab42bfc..717cda9126 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs @@ -1,9 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; -using OpenTK.Input; +using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -12,11 +11,12 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawable.Pieces; -using System; -using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public class DrawableSwell : DrawableTaikoHitObject { @@ -56,11 +56,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { this.swell = swell; - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { bodyContainer = new Container { - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { expandingRing = new CircularContainer { @@ -89,7 +89,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Masking = true, BorderThickness = target_ring_thick_border, BlendingMode = BlendingMode.Additive, - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { new Box { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs similarity index 95% rename from osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 8da05d8bed..5f85903827 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -1,14 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; +using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using System.Collections.Generic; -using osu.Framework.Input; +using OpenTK.Input; -namespace osu.Game.Modes.Taiko.Objects.Drawable +namespace osu.Game.Modes.Taiko.Objects.Drawables { public abstract class DrawableTaikoHitObject : DrawableHitObject { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs index e62ca6b073..0cf4e97b41 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CentreHitSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CentreHitSymbolPiece.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for centre hit pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs similarity index 92% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index d51c06bcad..941ef3b37f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; -using System; -using osu.Game.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// A circle piece which is used uniformly through osu!taiko to visualise hitobjects. @@ -63,7 +63,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); } } - protected override Container Content => SymbolContainer; + protected override Container Content => SymbolContainer; protected readonly Container SymbolContainer; private readonly Container background; @@ -81,7 +81,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { background = new CircularContainer { @@ -90,7 +90,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Masking = true, - Children = new Framework.Graphics.Drawable[] + Children = new Drawable[] { new Box { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs index 6999634108..6e19497978 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/RimHitSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/RimHitSymbolPiece.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for rim hit pieces. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs similarity index 90% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs index 319ca17cb8..9676c4a19f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/StrongCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs @@ -3,7 +3,7 @@ using OpenTK; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// A type of circle piece which is drawn at a higher scale to represent a "strong" piece. diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs similarity index 88% rename from osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs index 2bd86406a7..e491793902 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/Pieces/SwellSymbolPiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/SwellSymbolPiece.cs @@ -1,10 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Graphics; using osu.Framework.Graphics; +using osu.Game.Graphics; -namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces { /// /// The symbol used for swell pieces. diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index a44410c4a4..9399994078 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -13,7 +13,7 @@ using osu.Game.Modes.Scoring; using osu.Game.Modes.Taiko.Beatmaps; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; -using osu.Game.Modes.Taiko.Objects.Drawable; +using osu.Game.Modes.Taiko.Objects.Drawables; using osu.Game.Modes.Taiko.Scoring; using osu.Game.Modes.UI; using osu.Game.Modes.Taiko.Replays; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 65cb0db33e..958055d768 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -14,8 +14,8 @@ using osu.Game.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics.Primitives; -using osu.Game.Modes.Taiko.Objects.Drawable; using System.Linq; +using osu.Game.Modes.Taiko.Objects.Drawables; namespace osu.Game.Modes.Taiko.UI { diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 261dda95ed..1fbf1b27a1 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,25 +54,25 @@ - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + From 4b424263cea47ae0ce168838362f4364c1954bf9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 4 Apr 2017 13:11:04 +0900 Subject: [PATCH 277/348] Fully parse control points. --- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 1 - osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 74 ++++++++++++++----- osu.Game/Beatmaps/Samples/HitSampleInfo.cs | 2 +- osu.Game/Beatmaps/Samples/SampleInfo.cs | 1 + osu.Game/Beatmaps/Timing/ControlPoint.cs | 3 + osu.Game/Database/BeatmapInfo.cs | 1 - 6 files changed, 61 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 356fa5a6c1..3c1f4eaf45 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -55,7 +55,6 @@ namespace osu.Game.Tests.Beatmaps.Formats var beatmapInfo = decoder.Decode(new StreamReader(stream)).BeatmapInfo; Assert.AreEqual(0, beatmapInfo.AudioLeadIn); Assert.AreEqual(false, beatmapInfo.Countdown); - Assert.AreEqual(SampleSet.Soft, beatmapInfo.SampleSet); Assert.AreEqual(0.7f, beatmapInfo.StackLeniency); Assert.AreEqual(false, beatmapInfo.SpecialStyle); Assert.AreEqual(PlayMode.Osu, beatmapInfo.Mode); diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 748583606b..6139ed8ec6 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -31,6 +31,10 @@ namespace osu.Game.Beatmaps.Formats // TODO: Not sure how far back to go, or differences between versions } + private SampleSet defaultSampleSet; + private int defaultSampleVolume; + private bool samplesMatchPlaybackRate; + private readonly int beatmapVersion; public OsuLegacyDecoder() @@ -73,7 +77,13 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.Countdown = int.Parse(val) == 1; break; case @"SampleSet": - beatmap.BeatmapInfo.SampleSet = (SampleSet)Enum.Parse(typeof(SampleSet), val); + defaultSampleSet = (SampleSet)Enum.Parse(typeof(SampleSet), val); + break; + case @"SampleVolume": + defaultSampleVolume = int.Parse(val); + break; + case "SamplesMatchPlaybackRate": + samplesMatchPlaybackRate = val[0] == '1'; break; case @"StackLeniency": beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo); @@ -203,28 +213,56 @@ namespace osu.Game.Beatmaps.Formats private void handleTimingPoints(Beatmap beatmap, string val) { - ControlPoint cp = null; - string[] split = val.Split(','); - if (split.Length > 2) + double time = double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo); + double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo); + + TimeSignatures timeSignature = TimeSignatures.SimpleQuadruple; + if (split.Length >= 3) + timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)int.Parse(split[2]); + + SampleSet sampleSet = defaultSampleSet; + if (split.Length >= 4) + sampleSet = (SampleSet)int.Parse(split[3]); + + SampleBank sampleBank = SampleBank.Default; + if (split.Length >= 5) + sampleBank = (SampleBank)int.Parse(split[4]); + + int sampleVolume = defaultSampleVolume; + if (split.Length >= 6) + sampleVolume = int.Parse(split[5]); + + bool timingChange = true; + if (split.Length >= 7) + timingChange = split[6][0] == '1'; + + bool kiaiMode = false; + bool omitFirstBarSignature = false; + if (split.Length >= 8) { - int effectFlags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0; - double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo); - cp = new ControlPoint - { - Time = double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo), - BeatLength = beatLength > 0 ? beatLength : 0, - VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, - TimingChange = split.Length <= 6 || split[6][0] == '1', - KiaiMode = (effectFlags & 1) > 0, - OmitFirstBarLine = (effectFlags & 8) > 0, - TimeSignature = (TimeSignatures)int.Parse(split[2]) - }; + int effectFlags = int.Parse(split[7]); + kiaiMode = (effectFlags & 1) > 0; + omitFirstBarSignature = (effectFlags & 8) > 0; } - if (cp != null) - beatmap.TimingInfo.ControlPoints.Add(cp); + beatmap.TimingInfo.ControlPoints.Add(new ControlPoint + { + Time = time, + BeatLength = beatLength, + VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, + TimingChange = timingChange, + TimeSignature = timeSignature, + Sample = new SampleInfo + { + Bank = sampleBank, + Set = sampleSet, + Volume = sampleVolume + }, + KiaiMode = kiaiMode, + OmitFirstBarLine = omitFirstBarSignature + }); } private void handleColours(Beatmap beatmap, string key, string val, ref bool hasCustomColours) diff --git a/osu.Game/Beatmaps/Samples/HitSampleInfo.cs b/osu.Game/Beatmaps/Samples/HitSampleInfo.cs index c1cf1bd5e5..f5a5cc1bea 100644 --- a/osu.Game/Beatmaps/Samples/HitSampleInfo.cs +++ b/osu.Game/Beatmaps/Samples/HitSampleInfo.cs @@ -5,6 +5,6 @@ namespace osu.Game.Beatmaps.Samples { public class HitSampleInfo : SampleInfo { - public SampleType Type { get; set; } + public SampleType Type; } } diff --git a/osu.Game/Beatmaps/Samples/SampleInfo.cs b/osu.Game/Beatmaps/Samples/SampleInfo.cs index 5f9572c871..5b8f44d116 100644 --- a/osu.Game/Beatmaps/Samples/SampleInfo.cs +++ b/osu.Game/Beatmaps/Samples/SampleInfo.cs @@ -7,5 +7,6 @@ namespace osu.Game.Beatmaps.Samples { public SampleBank Bank; public SampleSet Set; + public int Volume; } } diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index 40320a88d7..00d3acba71 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps.Samples; + namespace osu.Game.Beatmaps.Timing { public class ControlPoint @@ -11,6 +13,7 @@ namespace osu.Game.Beatmaps.Timing TimingChange = true, }; + public SampleInfo Sample; public TimeSignatures TimeSignature; public double Time; public double BeatLength; diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 890623091d..e8ec8e500c 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -46,7 +46,6 @@ namespace osu.Game.Database // General public int AudioLeadIn { get; set; } public bool Countdown { get; set; } - public SampleSet SampleSet { get; set; } public float StackLeniency { get; set; } public bool SpecialStyle { get; set; } public PlayMode Mode { get; set; } From 5e67bcb581a7521ec98b5e9d6a6036a5f64392d1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 4 Apr 2017 13:14:45 +0900 Subject: [PATCH 278/348] Remove a few unused classes. --- osu.Game/Beatmaps/Timing/SampleChange.cs | 12 ------------ osu.Game/Beatmaps/Timing/TimingChange.cs | 15 --------------- osu.Game/osu.Game.csproj | 2 -- 3 files changed, 29 deletions(-) delete mode 100644 osu.Game/Beatmaps/Timing/SampleChange.cs delete mode 100644 osu.Game/Beatmaps/Timing/TimingChange.cs diff --git a/osu.Game/Beatmaps/Timing/SampleChange.cs b/osu.Game/Beatmaps/Timing/SampleChange.cs deleted file mode 100644 index 2946fd749b..0000000000 --- a/osu.Game/Beatmaps/Timing/SampleChange.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Beatmaps.Samples; - -namespace osu.Game.Beatmaps.Timing -{ - public class SampleChange : ControlPoint - { - public SampleInfo Sample; - } -} diff --git a/osu.Game/Beatmaps/Timing/TimingChange.cs b/osu.Game/Beatmaps/Timing/TimingChange.cs deleted file mode 100644 index b759fcd01c..0000000000 --- a/osu.Game/Beatmaps/Timing/TimingChange.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Timing -{ - internal class TimingChange : ControlPoint - { - public TimingChange(double beatLength) - { - BeatLength = beatLength; - } - - public double BPM => 60000 / BeatLength; - } -} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a9e8dfb5bb..da3b4dd406 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -154,8 +154,6 @@ - - From 1d4a371ded76ef5f66e6f0cdd3de766c48a40c6d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 4 Apr 2017 14:31:50 +0900 Subject: [PATCH 279/348] A few general fixes. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 6139ed8ec6..c1b802bb48 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -32,7 +32,7 @@ namespace osu.Game.Beatmaps.Formats } private SampleSet defaultSampleSet; - private int defaultSampleVolume; + private int defaultSampleVolume = 100; private bool samplesMatchPlaybackRate; private readonly int beatmapVersion; @@ -309,7 +309,7 @@ namespace osu.Game.Beatmaps.Formats { beatmap.BeatmapInfo.BeatmapVersion = beatmapVersion; - HitObjectParser parser = null; + HitObjectParser parser = new LegacyHitObjectParser(); Section section = Section.None; bool hasCustomColours = false; @@ -343,7 +343,6 @@ namespace osu.Game.Beatmaps.Formats { case Section.General: handleGeneral(beatmap, key, val); - parser = new LegacyHitObjectParser(); break; case Section.Editor: handleEditor(beatmap, key, val); From 1654e7423559496a6a6d09411097b490af1b7eda Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 16:37:10 +0900 Subject: [PATCH 280/348] Remove unnecessary CI override. --- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 9399994078..c1ee1f6691 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -41,7 +41,6 @@ namespace osu.Game.Modes.Taiko.UI return; TaikoHitObject lastObject = Beatmap.HitObjects[Beatmap.HitObjects.Count - 1]; - // ReSharper disable once SuspiciousTypeConversion.Global (will be fixed with hitobjects) double lastHitTime = 1 + (lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime; var timingPoints = Beatmap.TimingInfo.ControlPoints.FindAll(cp => cp.TimingChange); From 20a5648b053889a0479f545f5cc4a31af8bc2e00 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 4 Apr 2017 12:53:06 +0900 Subject: [PATCH 281/348] Move CreateCirclePiece to DrawableTaikoHitObject and simplify strong creation. --- osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs | 6 +----- osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs | 2 -- osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs | 2 -- osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs | 6 +----- .../Objects/Drawables/DrawableStrongCentreHit.cs | 6 +----- osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs | 3 +++ .../Objects/Drawables/DrawableStrongRimHit.cs | 6 +----- .../Objects/Drawables/DrawableTaikoHitObject.cs | 3 +++ 8 files changed, 10 insertions(+), 24 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs index c79351f4d9..add656f208 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -15,6 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableCentreHit(Hit hit) : base(hit) { + Circle.Add(new CentreHitSymbolPiece()); } [BackgroundDependencyLoader] @@ -22,10 +23,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { Circle.AccentColour = colours.PinkDarker; } - - protected override CirclePiece CreateCirclePiece() => new CirclePiece - { - Children = new[] { new CentreHitSymbolPiece() } - }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 4e8d75315d..48bd3e4eb1 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -110,7 +110,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override void UpdateState(ArmedState state) { } - - protected virtual CirclePiece CreateCirclePiece() => new CirclePiece(); } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs index 25ecd5ac84..19799f7ada 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs @@ -109,7 +109,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables Expire(); } - - protected abstract CirclePiece CreateCirclePiece(); } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs index 0fa51b1661..ff8881172d 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -15,6 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableRimHit(Hit hit) : base(hit) { + Circle.Add(new RimHitSymbolPiece()); } [BackgroundDependencyLoader] @@ -22,10 +23,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { Circle.AccentColour = colours.BlueDarker; } - - protected override CirclePiece CreateCirclePiece() => new CirclePiece - { - Children = new[] { new RimHitSymbolPiece() } - }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs index 815c19779a..a84c8894d5 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs @@ -15,6 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableStrongCentreHit(Hit hit) : base(hit) { + Circle.Add(new CentreHitSymbolPiece()); } [BackgroundDependencyLoader] @@ -22,10 +23,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { Circle.AccentColour = colours.PinkDarker; } - - protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece - { - Children = new[] { new CentreHitSymbolPiece() } - }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs index 116ef94ee4..107f476ae2 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -6,6 +6,7 @@ using System.Linq; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables @@ -29,6 +30,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override TaikoJudgement CreateJudgement() => new TaikoStrongHitJudgement(); + protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece(); + protected override void CheckJudgement(bool userTriggered) { if (Judgement.Result == HitResult.None) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs index 3af0ff399b..7ab9be548e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs @@ -15,6 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableStrongRimHit(Hit hit) : base(hit) { + Circle.Add(new RimHitSymbolPiece()); } [BackgroundDependencyLoader] @@ -22,10 +23,5 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { Circle.AccentColour = colours.BlueDarker; } - - protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece - { - Children = new[] { new RimHitSymbolPiece() } - }; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 5f85903827..8afe6ad4cf 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables @@ -36,6 +37,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override TaikoJudgement CreateJudgement() => new TaikoJudgement(); + protected virtual CirclePiece CreateCirclePiece() => new CirclePiece(); + /// /// Sets the scroll position of the DrawableHitObject relative to the offset between /// a time value and the HitObject's StartTime. From bec4bf36ac6eaf6f8196d05fedb8fa293e23d98e Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 4 Apr 2017 17:47:41 +0300 Subject: [PATCH 282/348] hud->content and style fixes --- osu.Game/Modes/UI/HudOverlay.cs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 586d28e7f6..263699422c 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -20,7 +20,7 @@ namespace osu.Game.Modes.UI { private const int duration = 100; - private readonly Container hud; + private readonly Container content; public readonly KeyCounterCollection KeyCounter; public readonly ComboCounter ComboCounter; public readonly ScoreCounter ScoreCounter; @@ -42,7 +42,7 @@ namespace osu.Game.Modes.UI { RelativeSizeAxes = Axes.Both; - Add(hud = new Container + Add(content = new Container { RelativeSizeAxes = Axes.Both, @@ -61,17 +61,23 @@ namespace osu.Game.Modes.UI private void load(OsuConfigManager config, NotificationManager notificationManager) { showKeyCounter = config.GetBindable(OsuConfig.KeyOverlay); - showKeyCounter.ValueChanged += visibility => + showKeyCounter.ValueChanged += keyCounterVisibility => { - if (visibility) - KeyCounter.Show(); + if (keyCounterVisibility) + KeyCounter.FadeIn(duration); else - KeyCounter.Hide(); + KeyCounter.FadeOut(duration); }; showKeyCounter.TriggerChange(); showHud = config.GetBindable(OsuConfig.ShowInterface); - showHud.ValueChanged += hudVisibilityChanged; + showHud.ValueChanged += hudVisibility => + { + if (hudVisibility) + content.FadeIn(duration); + else + content.FadeOut(duration); + }; showHud.TriggerChange(); if (!showHud && !hasShownNotificationOnce) @@ -85,14 +91,6 @@ namespace osu.Game.Modes.UI } } - private void hudVisibilityChanged(object sender, EventArgs e) - { - if (showHud) - hud.FadeIn(duration); - else - hud.FadeOut(duration); - } - public void BindProcessor(ScoreProcessor processor) { ScoreCounter?.Current.BindTo(processor.TotalScore); From 7b95f2d46af9ede9c3cb982f19bd0ae16eba4c99 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 4 Apr 2017 18:53:13 +0300 Subject: [PATCH 283/348] InGameOverlay now is abstract --- osu.Game/Screens/Play/InGameOverlay.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index db46e00752..85469f098e 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -16,7 +16,7 @@ using osu.Framework.Allocation; namespace osu.Game.Screens.Play { - public class InGameOverlay : OverlayContainer + public abstract class InGameOverlay : OverlayContainer { private const int transition_duration = 200; private const int button_height = 70; @@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(InputState state) => true; - public void AddButton(string text, Color4 colour, Action action) + protected void AddButton(string text, Color4 colour, Action action) { buttons.Add(new PauseButton { From f2a9ec0f2495ab9f7ee3439f53b14d64a23b2a93 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 4 Apr 2017 19:02:36 +0300 Subject: [PATCH 284/348] Converted constructor to protected --- osu.Game/Screens/Play/InGameOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index 85469f098e..00c78913c6 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -192,7 +192,7 @@ namespace osu.Game.Screens.Play } - public InGameOverlay() + protected InGameOverlay() { AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; From c4c8604afdf907e31fc2b40d051333b5c54da3ef Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 4 Apr 2017 19:06:53 +0300 Subject: [PATCH 285/348] A little change to woke up AppVeyor --- osu.Game/Configuration/OsuConfigManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 7a30d64cb2..9a2cda2d80 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -35,8 +35,8 @@ namespace osu.Game.Configuration Set(OsuConfig.MenuParallax, true); - Set(OsuConfig.KeyOverlay, false); Set(OsuConfig.ShowInterface, true); + Set(OsuConfig.KeyOverlay, false); //todo: implement all settings below this line (remove the Disabled set when doing so). Set(OsuConfig.MouseSpeed, 1.0).Disabled = true; From 75f85867dd39853f99d36554bfc99c6bb7101765 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 08:58:17 +0900 Subject: [PATCH 286/348] Adjust input drum animations slightly. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index e7470ee913..5eea08ad8b 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -128,17 +128,36 @@ namespace osu.Game.Modes.Taiko.UI return false; Drawable target = null; + Drawable back = null; if (args.Key == CentreKey) + { target = centreHit; + back = centre; + } else if (args.Key == RimKey) + { target = rimHit; + back = rim; + } if (target != null) { - target.FadeTo(Math.Min(target.Alpha + 0.4f, 1), 40, EasingTypes.OutQuint); - target.Delay(40); - target.FadeOut(1000, EasingTypes.OutQuint); + const float scale_amount = 0.05f; + const float alpha_amount = 0.5f; + + const float down_time = 40; + const float up_time = 1000; + + back.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); + back.Delay(down_time); + back.ScaleTo(1, up_time, EasingTypes.OutQuint); + + target.ScaleTo(target.Scale.X - scale_amount, down_time, EasingTypes.OutQuint); + target.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time, EasingTypes.OutQuint); + target.Delay(down_time); + target.ScaleTo(1, up_time, EasingTypes.OutQuint); + target.FadeOut(up_time, EasingTypes.OutQuint); } return false; From 7040cee99b73d8cb663cba6316e23eed2d9983c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 09:31:41 +0900 Subject: [PATCH 287/348] Remove unnecessary width specifcations from TestCaseTaikoHitObjects. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 1f0bdf40e0..352af5d109 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -29,7 +29,6 @@ namespace osu.Desktop.VisualTests.Tests Add(new CirclePiece { Position = new Vector2(100, 100), - Width = 0, AccentColour = Color4.DarkRed, KiaiMode = kiai, Children = new[] @@ -41,7 +40,6 @@ namespace osu.Desktop.VisualTests.Tests Add(new StrongCirclePiece { Position = new Vector2(350, 100), - Width = 0, AccentColour = Color4.DarkRed, KiaiMode = kiai, Children = new[] @@ -53,7 +51,6 @@ namespace osu.Desktop.VisualTests.Tests Add(new CirclePiece { Position = new Vector2(100, 300), - Width = 0, AccentColour = Color4.DarkBlue, KiaiMode = kiai, Children = new[] @@ -65,7 +62,6 @@ namespace osu.Desktop.VisualTests.Tests Add(new StrongCirclePiece { Position = new Vector2(350, 300), - Width = 0, AccentColour = Color4.DarkBlue, KiaiMode = kiai, Children = new[] @@ -77,7 +73,6 @@ namespace osu.Desktop.VisualTests.Tests Add(new CirclePiece { Position = new Vector2(100, 500), - Width = 0, AccentColour = Color4.Orange, KiaiMode = kiai, Children = new[] From 6dc03c1cc48c1f5d59cb42a0eba7914a80023247 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 09:57:22 +0900 Subject: [PATCH 288/348] Add adjustable clock to testcase. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index c7ef33c573..4bf44a21e4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -5,6 +5,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using osu.Framework.Testing; +using osu.Framework.Timing; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects; @@ -37,8 +38,12 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Add bar line", () => addBarLine(false)); AddStep("Add major bar line", () => addBarLine(true)); + + var rateAdjustClock = new StopwatchClock(true) { Rate = 1 }; + Add(new Container { + Clock = new FramedClock(rateAdjustClock), RelativeSizeAxes = Axes.X, Y = 200, Children = new[] From 028e941ab2fb14a5a83c6744a2acb852d4dcf723 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 10:01:40 +0900 Subject: [PATCH 289/348] Major rsefinements to taiko drawable classes. --- .../Tests/TestCaseTaikoHitObjects.cs | 6 +- .../Tests/TestCaseTaikoPlayfield.cs | 3 +- .../Objects/Drawables/DrawableCentreHit.cs | 4 +- .../Objects/Drawables/DrawableDrumRoll.cs | 37 ++--- .../Objects/Drawables/DrawableDrumRollTick.cs | 64 ++------ .../Objects/Drawables/DrawableHit.cs | 43 ++--- .../Objects/Drawables/DrawableRimHit.cs | 4 +- .../Drawables/DrawableStrongCentreHit.cs | 4 +- .../Drawables/DrawableStrongDrumRoll.cs | 20 --- .../Objects/Drawables/DrawableStrongHit.cs | 6 +- .../Objects/Drawables/DrawableStrongRimHit.cs | 4 +- .../Objects/Drawables/DrawableSwell.cs | 19 +-- .../Drawables/DrawableTaikoHitObject.cs | 42 ++++- .../Objects/Drawables/Pieces/CirclePiece.cs | 155 ++++++++---------- .../Drawables/Pieces/ElongatedCirclePiece.cs | 41 +++++ .../Drawables/Pieces/StrongCirclePiece.cs | 25 --- .../Objects/Drawables/Pieces/TaikoPiece.cs | 45 +++++ .../Objects/Drawables/Pieces/TickPiece.cs | 60 +++++++ .../Objects/TaikoHitObject.cs | 2 +- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 2 - .../osu.Game.Modes.Taiko.csproj | 5 +- 21 files changed, 316 insertions(+), 275 deletions(-) delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 352af5d109..1590437495 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests } }); - Add(new StrongCirclePiece + Add(new CirclePiece(true) { Position = new Vector2(350, 100), AccentColour = Color4.DarkRed, @@ -59,7 +59,7 @@ namespace osu.Desktop.VisualTests.Tests } }); - Add(new StrongCirclePiece + Add(new CirclePiece(true) { Position = new Vector2(350, 300), AccentColour = Color4.DarkBlue, @@ -89,7 +89,7 @@ namespace osu.Desktop.VisualTests.Tests KiaiMode = kiai, }); - Add(new StrongCirclePiece + Add(new CirclePiece(true) { Position = new Vector2(575, 300), Width = 0.25f, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4bf44a21e4..d2c026251a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -108,11 +108,12 @@ namespace osu.Desktop.VisualTests.Tests var d = new DrumRoll { StartTime = Time.Current + 1000, + IsStrong = strong, Distance = 1000, PreEmpt = 1000, }; - playfield.Add(strong ? new DrawableStrongDrumRoll(d) : new DrawableDrumRoll(d)); + playfield.Add(new DrawableDrumRoll(d)); } private void addCentreHit(bool strong) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs index add656f208..ff5ac859b4 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHit.cs @@ -15,13 +15,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableCentreHit(Hit hit) : base(hit) { - Circle.Add(new CentreHitSymbolPiece()); + MainPiece.Add(new CentreHitSymbolPiece()); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - Circle.AccentColour = colours.PinkDarker; + MainPiece.AccentColour = colours.PinkDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index 48bd3e4eb1..a4a3e0e062 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -3,28 +3,23 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK; using OpenTK.Graphics; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public class DrawableDrumRoll : DrawableTaikoHitObject + public class DrawableDrumRoll : DrawableTaikoHitObject { /// /// Number of rolling hits required to reach the dark/final accent colour. /// private const int rolling_hits_for_dark_accent = 5; - private readonly DrumRoll drumRoll; - - private readonly CirclePiece circle; - private Color4 accentDarkColour; /// @@ -35,14 +30,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableDrumRoll(DrumRoll drumRoll) : base(drumRoll) { - this.drumRoll = drumRoll; - - RelativeSizeAxes = Axes.X; - Width = (float)(drumRoll.Duration / drumRoll.PreEmpt); - - Add(circle = CreateCirclePiece()); - circle.KiaiMode = HitObject.Kiai; - foreach (var tick in drumRoll.Ticks) { var newTick = new DrawableDrumRollTick(tick) @@ -53,14 +40,22 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables newTick.OnJudgement += onTickJudgement; AddNested(newTick); - Add(newTick); + MainPiece.Add(newTick); } } + protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = HitObject.IsStrong }; + + protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) + { + Length = (float)(HitObject.Duration / HitObject.PreEmpt), + PlayfieldLengthReference = () => Parent.DrawSize.X + }; + [BackgroundDependencyLoader] private void load(OsuColour colours) { - circle.AccentColour = AccentColour = colours.YellowDark; + MainPiece.AccentColour = AccentColour = colours.YellowDark; accentDarkColour = colours.YellowDarker; } @@ -72,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables // is further than mid point of the play field, so the time taken to scroll in should always // be greater than the time taken to scroll out to the left of the screen. // Thus, using PreEmpt here is enough for the drum roll to completely scroll out. - LifetimeEnd = drumRoll.EndTime + drumRoll.PreEmpt; + LifetimeEnd = HitObject.EndTime + HitObject.PreEmpt; } private void onTickJudgement(DrawableHitObject obj) @@ -85,7 +80,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables rollingHits = MathHelper.Clamp(rollingHits, 0, rolling_hits_for_dark_accent); Color4 newAccent = Interpolation.ValueAt((float)rollingHits / rolling_hits_for_dark_accent, AccentColour, accentDarkColour, 0, 1); - circle.FadeAccent(newAccent, 100); + MainPiece.FadeAccent(newAccent, 100); } protected override void CheckJudgement(bool userTriggered) @@ -98,10 +93,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables int countHit = NestedHitObjects.Count(o => o.Judgement.Result == HitResult.Hit); - if (countHit > drumRoll.RequiredGoodHits) + if (countHit > HitObject.RequiredGoodHits) { Judgement.Result = HitResult.Hit; - Judgement.TaikoResult = countHit >= drumRoll.RequiredGreatHits ? TaikoHitResult.Great : TaikoHitResult.Good; + Judgement.TaikoResult = countHit >= HitObject.RequiredGreatHits ? TaikoHitResult.Great : TaikoHitResult.Good; } else Judgement.Result = HitResult.Miss; diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs index 85f9e32c6c..296affedaf 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRollTick.cs @@ -3,79 +3,37 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using OpenTK; -using OpenTK.Graphics; using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public class DrawableDrumRollTick : DrawableTaikoHitObject + public class DrawableDrumRollTick : DrawableTaikoHitObject { - /// - /// The size of a tick. - /// - private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2; - - /// - /// Any tick that is not the first for a drumroll is not filled, but is instead displayed - /// as a hollow circle. This is what controls the border width of that circle. - /// - private const float tick_border_width = tick_size / 4; - - private readonly DrumRollTick tick; - - private readonly CircularContainer bodyContainer; - public DrawableDrumRollTick(DrumRollTick tick) : base(tick) { - this.tick = tick; - - Anchor = Anchor.CentreLeft; - Origin = Anchor.Centre; - - RelativePositionAxes = Axes.X; - Size = new Vector2(tick_size); - - Children = new[] - { - bodyContainer = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderThickness = tick_border_width, - BorderColour = Color4.White, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = tick.FirstTick ? 1 : 0, - AlwaysPresent = true - } - } - } - }; } - protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = tick.IsStrong }; + protected override TaikoPiece CreateMainPiece() => new TickPiece + { + Filled = HitObject.FirstTick + }; + + protected override TaikoJudgement CreateJudgement() => new TaikoDrumRollTickJudgement { SecondHit = HitObject.IsStrong }; protected override void CheckJudgement(bool userTriggered) { if (!userTriggered) { - if (Judgement.TimeOffset > tick.HitWindow) + if (Judgement.TimeOffset > HitObject.HitWindow) Judgement.Result = HitResult.Miss; return; } - if (Math.Abs(Judgement.TimeOffset) < tick.HitWindow) + if (Math.Abs(Judgement.TimeOffset) < HitObject.HitWindow) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Great; @@ -87,7 +45,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables switch (state) { case ArmedState.Hit: - bodyContainer.ScaleTo(0, 100, EasingTypes.OutQuint); + Content.ScaleTo(0, 100, EasingTypes.OutQuint); break; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs index 19799f7ada..40d625812a 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs @@ -4,29 +4,19 @@ using System; using System.Linq; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public abstract class DrawableHit : DrawableTaikoHitObject + public abstract class DrawableHit : DrawableTaikoHitObject { /// /// A list of keys which can result in hits for this HitObject. /// protected abstract Key[] HitKeys { get; } - protected override Container Content => bodyContainer; - - protected readonly CirclePiece Circle; - - private readonly Hit hit; - - private readonly Container bodyContainer; - /// /// Whether the last key pressed is a valid hit key. /// @@ -35,41 +25,28 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected DrawableHit(Hit hit) : base(hit) { - this.hit = hit; - - AddInternal(bodyContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new[] - { - Circle = CreateCirclePiece() - } - }); - - Circle.KiaiMode = HitObject.Kiai; } protected override void CheckJudgement(bool userTriggered) { if (!userTriggered) { - if (Judgement.TimeOffset > hit.HitWindowGood) + if (Judgement.TimeOffset > HitObject.HitWindowGood) Judgement.Result = HitResult.Miss; return; } double hitOffset = Math.Abs(Judgement.TimeOffset); - if (hitOffset > hit.HitWindowMiss) + if (hitOffset > HitObject.HitWindowMiss) return; if (!validKeyPressed) Judgement.Result = HitResult.Miss; - else if (hitOffset < hit.HitWindowGood) + else if (hitOffset < HitObject.HitWindowGood) { Judgement.Result = HitResult.Hit; - Judgement.TaikoResult = hitOffset < hit.HitWindowGreat ? TaikoHitResult.Great : TaikoHitResult.Good; + Judgement.TaikoResult = hitOffset < HitObject.HitWindowGreat ? TaikoHitResult.Great : TaikoHitResult.Good; } else Judgement.Result = HitResult.Miss; @@ -92,16 +69,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables switch (State) { case ArmedState.Idle: - Delay(hit.HitWindowMiss); + Delay(HitObject.HitWindowMiss); break; case ArmedState.Miss: FadeOut(100); break; case ArmedState.Hit: - bodyContainer.ScaleTo(0.8f, 400, EasingTypes.OutQuad); - bodyContainer.MoveToY(-200, 250, EasingTypes.Out); - bodyContainer.Delay(250); - bodyContainer.MoveToY(0, 500, EasingTypes.In); + Content.ScaleTo(0.8f, 400, EasingTypes.OutQuad); + Content.MoveToY(-200, 250, EasingTypes.Out); + Content.Delay(250); + Content.MoveToY(0, 500, EasingTypes.In); FadeOut(600); break; diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs index ff8881172d..5a311d51ef 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHit.cs @@ -15,13 +15,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableRimHit(Hit hit) : base(hit) { - Circle.Add(new RimHitSymbolPiece()); + MainPiece.Add(new RimHitSymbolPiece()); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - Circle.AccentColour = colours.BlueDarker; + MainPiece.AccentColour = colours.BlueDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs index a84c8894d5..4dee29147e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs @@ -15,13 +15,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableStrongCentreHit(Hit hit) : base(hit) { - Circle.Add(new CentreHitSymbolPiece()); + MainPiece.Add(new CentreHitSymbolPiece()); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - Circle.AccentColour = colours.PinkDarker; + MainPiece.AccentColour = colours.PinkDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs deleted file mode 100644 index bb7e197502..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongDrumRoll.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; - -namespace osu.Game.Modes.Taiko.Objects.Drawables -{ - public class DrawableStrongDrumRoll : DrawableDrumRoll - { - public DrawableStrongDrumRoll(DrumRoll drumRoll) - : base(drumRoll) - { - } - - protected override TaikoJudgement CreateJudgement() => new TaikoJudgement { SecondHit = true }; - - protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece(); - } -} diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs index 107f476ae2..e53c81004f 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs @@ -6,8 +6,8 @@ using System.Linq; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; -using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; using OpenTK.Input; +using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawables { @@ -28,9 +28,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { } - protected override TaikoJudgement CreateJudgement() => new TaikoStrongHitJudgement(); + protected override TaikoPiece CreateMainPiece() => new CirclePiece(true); - protected override CirclePiece CreateCirclePiece() => new StrongCirclePiece(); + protected override TaikoJudgement CreateJudgement() => new TaikoStrongHitJudgement(); protected override void CheckJudgement(bool userTriggered) { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs index 7ab9be548e..10e58a919e 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs @@ -15,13 +15,13 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableStrongRimHit(Hit hit) : base(hit) { - Circle.Add(new RimHitSymbolPiece()); + MainPiece.Add(new RimHitSymbolPiece()); } [BackgroundDependencyLoader] private void load(OsuColour colours) { - Circle.AccentColour = colours.BlueDarker; + MainPiece.AccentColour = colours.BlueDarker; } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs index 717cda9126..e1a590a025 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableSwell.cs @@ -18,7 +18,7 @@ using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public class DrawableSwell : DrawableTaikoHitObject + public class DrawableSwell : DrawableTaikoHitObject { /// /// Invoked when the swell has reached the hit target, i.e. when CurrentTime >= StartTime. @@ -31,8 +31,6 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables private const float target_ring_scale = 5f; private const float inner_ring_alpha = 0.65f; - private readonly Swell swell; - private readonly Container bodyContainer; private readonly CircularContainer targetRing; private readonly CircularContainer expandingRing; @@ -54,12 +52,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables public DrawableSwell(Swell swell) : base(swell) { - this.swell = swell; - Children = new Drawable[] { bodyContainer = new Container { + AutoSizeAxes = Axes.Both, Children = new Drawable[] { expandingRing = new CircularContainer @@ -120,6 +117,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables }, circlePiece = new CirclePiece { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Children = new [] { symbol = new SwellSymbolPiece() @@ -146,18 +145,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { userHits++; - var completion = (float)userHits / swell.RequiredHits; + var completion = (float)userHits / HitObject.RequiredHits; expandingRing.FadeTo(expandingRing.Alpha + MathHelper.Clamp(completion / 16, 0.1f, 0.6f), 50); expandingRing.Delay(50); expandingRing.FadeTo(completion / 8, 2000, EasingTypes.OutQuint); expandingRing.DelayReset(); - symbol.RotateTo((float)(completion * swell.Duration / 8), 4000, EasingTypes.OutQuint); + symbol.RotateTo((float)(completion * HitObject.Duration / 8), 4000, EasingTypes.OutQuint); expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, EasingTypes.OutQuint); - if (userHits == swell.RequiredHits) + if (userHits == HitObject.RequiredHits) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Great; @@ -169,7 +168,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables return; //TODO: THIS IS SHIT AND CAN'T EXIST POST-TAIKO WORLD CUP - if (userHits > swell.RequiredHits / 2) + if (userHits > HitObject.RequiredHits / 2) { Judgement.Result = HitResult.Hit; Judgement.TaikoResult = TaikoHitResult.Good; @@ -189,7 +188,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables Delay(preempt, true); - Delay(Judgement.TimeOffset + swell.Duration, true); + Delay(Judgement.TimeOffset + HitObject.Duration, true); const float out_transition_time = 300; diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 8afe6ad4cf..e4ab134cf3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -3,15 +3,18 @@ using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; +using OpenTK; using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public abstract class DrawableTaikoHitObject : DrawableHitObject + public abstract class DrawableTaikoHitObject : DrawableHitObject + where TaikoHitType : TaikoHitObject { /// /// A list of keys which this hit object will accept. These are the standard Taiko keys for now. @@ -19,35 +22,56 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// private readonly List validKeys = new List(new[] { Key.D, Key.F, Key.J, Key.K }); - protected DrawableTaikoHitObject(TaikoHitObject hitObject) + public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); + + protected override Container Content => bodyContainer; + + protected readonly TaikoPiece MainPiece; + + private readonly Container bodyContainer; + + public new TaikoHitType HitObject; + + protected DrawableTaikoHitObject(TaikoHitType hitObject) : base(hitObject) { + HitObject = hitObject; + Anchor = Anchor.CentreLeft; - Origin = Anchor.CentreLeft; + Origin = Anchor.Custom; + + AutoSizeAxes = Axes.Both; RelativePositionAxes = Axes.X; + + AddInternal(bodyContainer = new Container + { + AutoSizeAxes = Axes.Both, + Children = new[] + { + MainPiece = CreateMainPiece() + } + }); + + MainPiece.KiaiMode = HitObject.Kiai; } protected override void LoadComplete() { LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; - base.LoadComplete(); } protected override TaikoJudgement CreateJudgement() => new TaikoJudgement(); - protected virtual CirclePiece CreateCirclePiece() => new CirclePiece(); + protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(HitObject.IsStrong); /// /// Sets the scroll position of the DrawableHitObject relative to the offset between /// a time value and the HitObject's StartTime. /// /// - protected virtual void UpdateScrollPosition(double time) - { - MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); - } + protected virtual void UpdateScrollPosition(double time) => MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); protected override void Update() { diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 941ef3b37f..0ac96b02a3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -1,12 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using OpenTK.Graphics; @@ -15,26 +13,30 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces /// /// A circle piece which is used uniformly through osu!taiko to visualise hitobjects. /// - /// The body of this piece will overshoot its parent by to form - /// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0. + /// Note that this can actually be non-circle if the width is changed. See + /// for a usage example. /// /// - public class CirclePiece : Container, IHasAccentColour + public class CirclePiece : TaikoPiece { public const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f; public const float SYMBOL_BORDER = 8; public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER; - private Color4 accentColour; + /// + /// The amount to scale up the base circle to show it as a "strong" piece. + /// + private const float strong_scale = 1.5f; + /// /// The colour of the inner circle and outer glows. /// - public Color4 AccentColour + public override Color4 AccentColour { - get { return accentColour; } + get { return base.AccentColour; } set { - accentColour = value; + base.AccentColour = value; background.Colour = AccentColour; @@ -42,107 +44,92 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces } } - private bool kiaiMode; /// /// Whether Kiai mode effects are enabled for this circle piece. /// - public bool KiaiMode + public override bool KiaiMode { - get { return kiaiMode; } + get { return base.KiaiMode; } set { - kiaiMode = value; + base.KiaiMode = value; resetEdgeEffects(); } } - public override Anchor Origin - { - get { return Anchor.CentreLeft; } - set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); } - } + protected override Container Content => content; - protected override Container Content => SymbolContainer; - protected readonly Container SymbolContainer; + private readonly Container content; private readonly Container background; - private readonly Container innerLayer; - public CirclePiece() + public CirclePiece(bool isStrong = false) { - RelativeSizeAxes = Axes.X; - Height = TaikoHitObject.CIRCLE_RADIUS * 2; - - // The "inner layer" is the body of the CirclePiece that overshoots it by Height/2 px on both sides - AddInternal(innerLayer = new Container + AddInternal(new Drawable[] { - Name = "Inner Layer", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Y, - Children = new Drawable[] + background = new CircularContainer { - background = new CircularContainer + Name = "Background", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Masking = true, + Children = new Drawable[] { - Name = "Background", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Masking = true, - Children = new Drawable[] + new Box { - new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - }, - new Triangles - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - ColourLight = Color4.White, - ColourDark = Color4.White.Darken(0.1f) - } - } - }, - new CircularContainer - { - Name = "Ring", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BorderThickness = 8, - BorderColour = Color4.White, - Masking = true, - Children = new[] + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + }, + new Triangles { - new Box - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Alpha = 0, - AlwaysPresent = true - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + ColourLight = Color4.White, + ColourDark = Color4.White.Darken(0.1f) } - }, - SymbolContainer = new Container - { - Name = "Symbol", - Anchor = Anchor.Centre, - Origin = Anchor.Centre, } + }, + new CircularContainer + { + Name = "Ring", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + BorderThickness = 8, + BorderColour = Color4.White, + Masking = true, + Children = new[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }, + content = new Container + { + RelativeSizeAxes = Axes.Both, + Name = "Symbol", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, } }); - } - protected override void Update() - { - // Add the overshoot to compensate for corner radius - innerLayer.Width = DrawWidth + DrawHeight; + if (isStrong) + { + Size *= strong_scale; + + //for symbols etc. + Content.Scale *= strong_scale; + } } private void resetEdgeEffects() diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs new file mode 100644 index 0000000000..396392b556 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -0,0 +1,41 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Graphics.Primitives; +using osu.Game.Modes.Taiko.UI; + +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +{ + public class ElongatedCirclePiece : CirclePiece + { + /// + /// As we are being used to define the absolute size of hits, we need to be given a relative reference of our containing . + /// + public Func PlayfieldLengthReference; + + /// + /// The length of this piece as a multiple of the value returned by + /// + public float Length; + + public ElongatedCirclePiece(bool isStrong = false) : base(isStrong) + { + } + + protected override void Update() + { + base.Update(); + + var contentPadding = DrawHeight / 2 * Content.Scale.X; + + Content.Padding = new MarginPadding + { + Left = contentPadding, + Right = contentPadding, + }; + + Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight; + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs deleted file mode 100644 index 9676c4a19f..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/StrongCirclePiece.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using OpenTK; - -namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces -{ - /// - /// A type of circle piece which is drawn at a higher scale to represent a "strong" piece. - /// - public class StrongCirclePiece : CirclePiece - { - /// - /// The amount to scale up the base circle to show it as a "strong" piece. - /// - private const float strong_scale = 1.5f; - - public StrongCirclePiece() - { - SymbolContainer.Scale = new Vector2(strong_scale); - } - - public override Vector2 Size => new Vector2(base.Size.X, base.Size.Y * strong_scale); - } -} diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs new file mode 100644 index 0000000000..a0c8865c59 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +{ + public class TaikoPiece : Container, IHasAccentColour + { + private Color4 accentColour; + /// + /// The colour of the inner circle and outer glows. + /// + public virtual Color4 AccentColour + { + get { return accentColour; } + set + { + accentColour = value; + } + } + + private bool kiaiMode; + /// + /// Whether Kiai mode effects are enabled for this circle piece. + /// + public virtual bool KiaiMode + { + get { return kiaiMode; } + set + { + kiaiMode = value; + } + } + + public TaikoPiece() + { + //just a default + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs new file mode 100644 index 0000000000..697102eb22 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces +{ + public class TickPiece : TaikoPiece + { + /// + /// Any tick that is not the first for a drumroll is not filled, but is instead displayed + /// as a hollow circle. This is what controls the border width of that circle. + /// + private const float tick_border_width = TaikoHitObject.CIRCLE_RADIUS / 2 / 4; + + /// + /// The size of a tick. + /// + private const float tick_size = TaikoHitObject.CIRCLE_RADIUS / 2; + + private bool filled; + public bool Filled + { + get { return filled; } + set + { + filled = value; + fillBox.Alpha = filled ? 1 : 0; + } + } + + private readonly Box fillBox; + + public TickPiece() + { + Size = new Vector2(tick_size); + + Add(new CircularContainer + { + RelativeSizeAxes = Axes.Both, + Masking = true, + BorderThickness = tick_border_width, + BorderColour = Color4.White, + Children = new[] + { + fillBox = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + AlwaysPresent = true + } + } + }); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 839471a651..800ee9de9f 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -25,7 +25,7 @@ namespace osu.Game.Modes.Taiko.Objects public float VelocityMultiplier = 1; /// - /// The time to scroll in the HitObject. + /// The time from the initial right (off-screen) spawn position to the centre of the hit target. /// public double PreEmpt; diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index c1ee1f6691..2394a88a9e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -133,8 +133,6 @@ namespace osu.Game.Modes.Taiko.UI var drumRoll = h as DrumRoll; if (drumRoll != null) { - if (h.IsStrong) - return new DrawableStrongDrumRoll(drumRoll); return new DrawableDrumRoll(drumRoll); } diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 1fbf1b27a1..a96a95118b 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -61,18 +61,19 @@ - + - + + From a5cb2339755605fe732315ecef0a9a9250949017 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 10:37:49 +0900 Subject: [PATCH 290/348] Use more suffixes. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 6 +++--- .../{DrawableMajorBarLine.cs => DrawableBarLineMajor.cs} | 4 ++-- ...wableStrongCentreHit.cs => DrawableCentreHitStrong.cs} | 4 ++-- .../{DrawableStrongHit.cs => DrawableHitStrong.cs} | 4 ++-- .../{DrawableStrongRimHit.cs => DrawableRimHitStrong.cs} | 4 ++-- osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs | 6 +++--- osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) rename osu.Game.Modes.Taiko/Objects/Drawables/{DrawableMajorBarLine.cs => DrawableBarLineMajor.cs} (91%) rename osu.Game.Modes.Taiko/Objects/Drawables/{DrawableStrongCentreHit.cs => DrawableCentreHitStrong.cs} (83%) rename osu.Game.Modes.Taiko/Objects/Drawables/{DrawableStrongHit.cs => DrawableHitStrong.cs} (93%) rename osu.Game.Modes.Taiko/Objects/Drawables/{DrawableStrongRimHit.cs => DrawableRimHitStrong.cs} (83%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index d2c026251a..c417b4eff7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -90,7 +90,7 @@ namespace osu.Desktop.VisualTests.Tests PreEmpt = 1000 }; - playfield.AddBarLine(major ? new DrawableMajorBarLine(bl) : new DrawableBarLine(bl)); + playfield.AddBarLine(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl)); } private void addSwell() @@ -125,7 +125,7 @@ namespace osu.Desktop.VisualTests.Tests }; if (strong) - playfield.Add(new DrawableStrongCentreHit(h)); + playfield.Add(new DrawableCentreHitStrong(h)); else playfield.Add(new DrawableCentreHit(h)); } @@ -139,7 +139,7 @@ namespace osu.Desktop.VisualTests.Tests }; if (strong) - playfield.Add(new DrawableStrongRimHit(h)); + playfield.Add(new DrawableRimHitStrong(h)); else playfield.Add(new DrawableRimHit(h)); } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLineMajor.cs similarity index 91% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLineMajor.cs index 14d3d84f4b..73565e6948 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableMajorBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLineMajor.cs @@ -8,7 +8,7 @@ using OpenTK; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public class DrawableMajorBarLine : DrawableBarLine + public class DrawableBarLineMajor : DrawableBarLine { /// /// The vertical offset of the triangles from the line tracker. @@ -20,7 +20,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// private const float triangle_size = 20f; - public DrawableMajorBarLine(BarLine barLine) + public DrawableBarLineMajor(BarLine barLine) : base(barLine) { Add(new Container diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs index 4dee29147e..bc24e2aa65 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongCentreHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableCentreHitStrong.cs @@ -8,11 +8,11 @@ using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public class DrawableStrongCentreHit : DrawableStrongHit + public class DrawableCentreHitStrong : DrawableHitStrong { protected override Key[] HitKeys { get; } = { Key.F, Key.J }; - public DrawableStrongCentreHit(Hit hit) + public DrawableCentreHitStrong(Hit hit) : base(hit) { MainPiece.Add(new CentreHitSymbolPiece()); diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHitStrong.cs similarity index 93% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableHitStrong.cs index e53c81004f..4ab029acb3 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHitStrong.cs @@ -11,7 +11,7 @@ using osu.Game.Modes.Taiko.Objects.Drawables.Pieces; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public abstract class DrawableStrongHit : DrawableHit + public abstract class DrawableHitStrong : DrawableHit { /// /// The lenience for the second key press. @@ -23,7 +23,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables private bool firstKeyHeld; private Key firstHitKey; - protected DrawableStrongHit(Hit hit) + protected DrawableHitStrong(Hit hit) : base(hit) { } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHitStrong.cs similarity index 83% rename from osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs rename to osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHitStrong.cs index 10e58a919e..5789dfb140 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableStrongRimHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableRimHitStrong.cs @@ -8,11 +8,11 @@ using OpenTK.Input; namespace osu.Game.Modes.Taiko.Objects.Drawables { - public class DrawableStrongRimHit : DrawableStrongHit + public class DrawableRimHitStrong : DrawableHitStrong { protected override Key[] HitKeys { get; } = { Key.D, Key.K }; - public DrawableStrongRimHit(Hit hit) + public DrawableRimHitStrong(Hit hit) : base(hit) { MainPiece.Add(new RimHitSymbolPiece()); diff --git a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs index 2394a88a9e..29fa693d58 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoHitRenderer.cs @@ -79,7 +79,7 @@ namespace osu.Game.Modes.Taiko.UI barLine.ApplyDefaults(Beatmap.TimingInfo, Beatmap.BeatmapInfo.Difficulty); - taikoPlayfield.AddBarLine(isMajor ? new DrawableMajorBarLine(barLine) : new DrawableBarLine(barLine)); + taikoPlayfield.AddBarLine(isMajor ? new DrawableBarLineMajor(barLine) : new DrawableBarLine(barLine)); currentBeat++; } @@ -118,7 +118,7 @@ namespace osu.Game.Modes.Taiko.UI if (centreHit != null) { if (h.IsStrong) - return new DrawableStrongCentreHit(centreHit); + return new DrawableCentreHitStrong(centreHit); return new DrawableCentreHit(centreHit); } @@ -126,7 +126,7 @@ namespace osu.Game.Modes.Taiko.UI if (rimHit != null) { if (h.IsStrong) - return new DrawableStrongRimHit(rimHit); + return new DrawableRimHitStrong(rimHit); return new DrawableRimHit(rimHit); } diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index a96a95118b..d0981c2500 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -55,14 +55,14 @@ - + - + - - + + From 1b2713239a2f130d934fc60ec9befe9d76aee6f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 11:48:19 +0900 Subject: [PATCH 291/348] Rename PreEmpt to ScrollTime and remove VelocityMultiplier for now. --- .../Tests/TestCaseTaikoPlayfield.cs | 10 +++++----- .../Objects/Drawables/DrawableDrumRoll.cs | 4 ++-- .../Objects/Drawables/DrawableTaikoHitObject.cs | 4 ++-- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 4 ++-- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 15 +++++---------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index c417b4eff7..3ca8591839 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -87,7 +87,7 @@ namespace osu.Desktop.VisualTests.Tests BarLine bl = new BarLine { StartTime = Time.Current + 1000, - PreEmpt = 1000 + ScrollTime = 1000 }; playfield.AddBarLine(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl)); @@ -99,7 +99,7 @@ namespace osu.Desktop.VisualTests.Tests { StartTime = Time.Current + 1000, EndTime = Time.Current + 1000, - PreEmpt = 1000 + ScrollTime = 1000 })); } @@ -110,7 +110,7 @@ namespace osu.Desktop.VisualTests.Tests StartTime = Time.Current + 1000, IsStrong = strong, Distance = 1000, - PreEmpt = 1000, + ScrollTime = 1000, }; playfield.Add(new DrawableDrumRoll(d)); @@ -121,7 +121,7 @@ namespace osu.Desktop.VisualTests.Tests Hit h = new Hit { StartTime = Time.Current + 1000, - PreEmpt = 1000 + ScrollTime = 1000 }; if (strong) @@ -135,7 +135,7 @@ namespace osu.Desktop.VisualTests.Tests Hit h = new Hit { StartTime = Time.Current + 1000, - PreEmpt = 1000 + ScrollTime = 1000 }; if (strong) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index a4a3e0e062..c21894c56b 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -48,7 +48,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override TaikoPiece CreateMainPiece() => new ElongatedCirclePiece(HitObject.IsStrong) { - Length = (float)(HitObject.Duration / HitObject.PreEmpt), + Length = (float)(HitObject.Duration / HitObject.ScrollTime), PlayfieldLengthReference = () => Parent.DrawSize.X }; @@ -67,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables // is further than mid point of the play field, so the time taken to scroll in should always // be greater than the time taken to scroll out to the left of the screen. // Thus, using PreEmpt here is enough for the drum roll to completely scroll out. - LifetimeEnd = HitObject.EndTime + HitObject.PreEmpt; + LifetimeEnd = HitObject.EndTime + HitObject.ScrollTime; } private void onTickJudgement(DrawableHitObject obj) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index e4ab134cf3..5086ab8f81 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -58,7 +58,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables protected override void LoadComplete() { - LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; + LifetimeStart = HitObject.StartTime - HitObject.ScrollTime * 2; base.LoadComplete(); } @@ -71,7 +71,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// a time value and the HitObject's StartTime. /// /// - protected virtual void UpdateScrollPosition(double time) => MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); + protected virtual void UpdateScrollPosition(double time) => MoveToX((float)((HitObject.StartTime - time) / HitObject.ScrollTime)); protected override void Update() { diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ede576835c..c21e24b6db 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -71,7 +71,7 @@ namespace osu.Game.Modes.Taiko.Objects double speedAdjutedBeatLength = timing.SpeedMultiplierAt(StartTime) * timing.BeatLengthAt(StartTime); - Velocity = base_distance * difficulty.SliderMultiplier / speedAdjutedBeatLength * VelocityMultiplier; + Velocity = base_distance * difficulty.SliderMultiplier / speedAdjutedBeatLength; tickSpacing = timing.BeatLengthAt(StartTime) / TickRate; RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty); @@ -91,7 +91,7 @@ namespace osu.Game.Modes.Taiko.Objects ret.Add(new DrumRollTick { FirstTick = first, - PreEmpt = PreEmpt, + ScrollTime = ScrollTime, TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 800ee9de9f..d2af610863 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -15,19 +15,14 @@ namespace osu.Game.Modes.Taiko.Objects public const float CIRCLE_RADIUS = 42f; /// - /// Time (in milliseconds) to scroll in the hit object with a speed-adjusted beat length of 1 second. + /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. /// - public const double BASE_SCROLL_TIME = 6000; + public const double SCROLL_TIME = 6000; /// - /// The velocity multiplier applied to this hit object. + /// Our adjusted taking into consideration local and other speed multipliers. /// - public float VelocityMultiplier = 1; - - /// - /// The time from the initial right (off-screen) spawn position to the centre of the hit target. - /// - public double PreEmpt; + public double ScrollTime; /// /// Whether this HitObject is a "strong" type. @@ -44,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - PreEmpt = BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / VelocityMultiplier / 1000; + ScrollTime = SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; From abf6dbc3079d59c5fc7f49f8224532b4a01e7ca9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 11:48:30 +0900 Subject: [PATCH 292/348] BarLine : TaikoHitObject. --- osu.Game.Modes.Taiko/Objects/BarLine.cs | 19 +------------------ .../Objects/Drawables/DrawableBarLine.cs | 8 ++++---- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/BarLine.cs b/osu.Game.Modes.Taiko/Objects/BarLine.cs index a6eceb2e48..ae3c03de5e 100644 --- a/osu.Game.Modes.Taiko/Objects/BarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/BarLine.cs @@ -1,26 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps.Timing; -using osu.Game.Database; - namespace osu.Game.Modes.Taiko.Objects { - public class BarLine + public class BarLine : TaikoHitObject { - /// - /// The start time of the control point this bar line represents. - /// - public double StartTime; - - /// - /// The time to scroll in the bar line. - /// - public double PreEmpt; - - public void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) - { - PreEmpt = TaikoHitObject.BASE_SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; - } } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs index 6567975796..2ff1f2d9e0 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -62,14 +62,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { base.LoadComplete(); - LifetimeStart = BarLine.StartTime - BarLine.PreEmpt * 2; - LifetimeEnd = BarLine.StartTime + BarLine.PreEmpt; + LifetimeStart = BarLine.StartTime - BarLine.ScrollTime * 2; + LifetimeEnd = BarLine.StartTime + BarLine.ScrollTime; Delay(BarLine.StartTime - Time.Current); - FadeOut(base_fadeout_time * BarLine.PreEmpt / 1000); + FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } - private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.PreEmpt)); + private void updateScrollPosition(double time) => MoveToX((float)((BarLine.StartTime - time) / BarLine.ScrollTime)); protected override void Update() { From 6a922da87e03bb1d9613859683580f39b21a5685 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 12:05:48 +0900 Subject: [PATCH 293/348] Move legacy_velocity_multiplier application to LegacyTimingInfo. --- .../Beatmaps/TaikoBeatmapConverter.cs | 23 +++++++++++++++---- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Beatmaps/Timing/ControlPoint.cs | 4 +++- osu.Game/Beatmaps/Timing/TimingInfo.cs | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 594ed5f309..42e21e43cf 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; +using osu.Game.Beatmaps.Timing; using osu.Game.Database; namespace osu.Game.Modes.Taiko.Beatmaps @@ -41,6 +42,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { return new Beatmap(original) { + TimingInfo = new LegacyTimingInfo(original.TimingInfo), HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() }; } @@ -100,7 +102,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = j, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_multiplier }; } } @@ -113,7 +114,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, - VelocityMultiplier = legacy_velocity_multiplier }; } } @@ -128,7 +128,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps IsStrong = strong, EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), - VelocityMultiplier = legacy_velocity_multiplier }; } else @@ -142,7 +141,6 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_multiplier }; } else @@ -152,10 +150,25 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - VelocityMultiplier = legacy_velocity_multiplier }; } } } + + private class LegacyTimingInfo : TimingInfo + { + public LegacyTimingInfo(TimingInfo original) + { + if (original is LegacyTimingInfo) + ControlPoints.AddRange(original.ControlPoints); + else + { + ControlPoints.AddRange(original.ControlPoints.Select(c => c.Clone())); + + foreach (var c in ControlPoints) + c.SpeedMultiplier *= legacy_velocity_multiplier; + } + } + } } } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 748583606b..2bf282346a 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -215,7 +215,7 @@ namespace osu.Game.Beatmaps.Formats { Time = double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo), BeatLength = beatLength > 0 ? beatLength : 0, - VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, + SpeedMultiplier = beatLength < 0 ? -beatLength / 100.0 : 1, TimingChange = split.Length <= 6 || split[6][0] == '1', KiaiMode = (effectFlags & 1) > 0, OmitFirstBarLine = (effectFlags & 8) > 0, diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index 40320a88d7..a08bc57ecd 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -14,9 +14,11 @@ namespace osu.Game.Beatmaps.Timing public TimeSignatures TimeSignature; public double Time; public double BeatLength; - public double VelocityAdjustment; + public double SpeedMultiplier; public bool TimingChange; public bool KiaiMode; public bool OmitFirstBarLine; + + public ControlPoint Clone() => (ControlPoint)MemberwiseClone(); } } diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index 076618beea..fc4a6ad24c 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Timing ControlPoint overridePoint; ControlPoint timingPoint = TimingPointAt(time, out overridePoint); - return overridePoint?.VelocityAdjustment ?? timingPoint?.VelocityAdjustment ?? 1; + return overridePoint?.SpeedMultiplier ?? timingPoint?.SpeedMultiplier ?? 1; } /// From 3f20e2381f7e94305ef9200faeb16d950c208808 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 13:52:22 +0900 Subject: [PATCH 294/348] Fix potential tick overflow. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index c21e24b6db..f5e561029f 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -86,7 +86,7 @@ namespace osu.Game.Modes.Taiko.Objects return ret; bool first = true; - for (double t = StartTime; t < EndTime + (int)tickSpacing; t += tickSpacing) + for (double t = StartTime; t < EndTime + tickSpacing / 2; t += tickSpacing) { ret.Add(new DrumRollTick { From 0e0ab6904d3b00cbd3cdca25ce7dfaf1d1d212f0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 13:52:53 +0900 Subject: [PATCH 295/348] Distance -> Duration. --- .../Beatmaps/TaikoBeatmapConverter.cs | 4 ++-- .../Objects/Drawables/DrawableDrumRoll.cs | 2 +- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 11 +++-------- osu.Game.Modes.Taiko/Objects/Swell.cs | 4 ++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 42e21e43cf..3b77610910 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -112,7 +112,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - Distance = distance, + Duration = taikoDuration, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, }; } @@ -126,7 +126,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps StartTime = obj.StartTime, Sample = obj.Sample, IsStrong = strong, - EndTime = endTimeData.EndTime, + Duration = endTimeData.Duration, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), }; } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs index c21894c56b..0a0098dd34 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableDrumRoll.cs @@ -34,7 +34,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables { var newTick = new DrawableDrumRollTick(tick) { - X = (float)((tick.StartTime - HitObject.StartTime) / drumRoll.Duration) + X = (float)((tick.StartTime - HitObject.StartTime) / HitObject.Duration) }; newTick.OnJudgement += onTickJudgement; diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index f5e561029f..69864bc422 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -11,21 +11,16 @@ using osu.Game.Database; namespace osu.Game.Modes.Taiko.Objects { - public class DrumRoll : TaikoHitObject, IHasDistance + public class DrumRoll : TaikoHitObject, IHasEndTime { /// /// Drum roll distance that results in a duration of 1 speed-adjusted beat length. /// private const float base_distance = 100; - public double EndTime => StartTime + Distance / Velocity; + public double EndTime => StartTime + Duration; - public double Duration => EndTime - StartTime; - - /// - /// Raw length of the drum roll in positional length units. - /// - public double Distance { get; set; } + public double Duration { get; set; } /// /// Velocity of the drum roll in positional length units per millisecond. diff --git a/osu.Game.Modes.Taiko/Objects/Swell.cs b/osu.Game.Modes.Taiko/Objects/Swell.cs index f55416509a..97101ea797 100644 --- a/osu.Game.Modes.Taiko/Objects/Swell.cs +++ b/osu.Game.Modes.Taiko/Objects/Swell.cs @@ -7,9 +7,9 @@ namespace osu.Game.Modes.Taiko.Objects { public class Swell : TaikoHitObject, IHasEndTime { - public double EndTime { get; set; } + public double EndTime => StartTime + Duration; - public double Duration => EndTime - StartTime; + public double Duration { get; set; } /// /// The number of hits required to complete the swell successfully. From fcea52dd3a6c7eb3751f54eba2cff7a93b236577 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 13:53:07 +0900 Subject: [PATCH 296/348] Fix strong drumrolls (again). --- .../Objects/Drawables/Pieces/CirclePiece.cs | 10 +++++----- .../Objects/Drawables/Pieces/ElongatedCirclePiece.cs | 11 +++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 0ac96b02a3..76bc60d887 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -26,7 +26,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces /// /// The amount to scale up the base circle to show it as a "strong" piece. /// - private const float strong_scale = 1.5f; + protected const float STRONG_SCALE = 1.5f; /// /// The colour of the inner circle and outer glows. @@ -117,7 +117,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces content = new Container { RelativeSizeAxes = Axes.Both, - Name = "Symbol", + Name = "Content", Anchor = Anchor.Centre, Origin = Anchor.Centre, } @@ -125,10 +125,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces if (isStrong) { - Size *= strong_scale; + Size *= STRONG_SCALE; - //for symbols etc. - Content.Scale *= strong_scale; + //default for symbols etc. + Content.Scale *= STRONG_SCALE; } } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs index 396392b556..d203c4ea05 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -21,18 +21,21 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces public ElongatedCirclePiece(bool isStrong = false) : base(isStrong) { + if (isStrong) + { + //undo the strong scale provided in CirclePiece. + Content.Scale /= STRONG_SCALE; + } } protected override void Update() { base.Update(); - var contentPadding = DrawHeight / 2 * Content.Scale.X; - Content.Padding = new MarginPadding { - Left = contentPadding, - Right = contentPadding, + Left = DrawHeight / 2, + Right = DrawHeight / 2, }; Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight; From eed78d4251f460daaed9ee078968dac1010457cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 13:53:29 +0900 Subject: [PATCH 297/348] Improve TestCaseTaikoPlayfield. --- .../Tests/TestCaseTaikoPlayfield.cs | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 3ca8591839..d0a35b7b3e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -20,7 +20,11 @@ namespace osu.Desktop.VisualTests.Tests private TaikoPlayfield playfield; - protected override double TimePerAction => 500; + protected override double TimePerAction => default_duration * 2; + + private const double default_duration = 300; + + private const float scroll_time = 1000; public override void Reset() { @@ -30,7 +34,7 @@ namespace osu.Desktop.VisualTests.Tests AddStep("Miss :(", addMissJudgement); AddStep("DrumRoll", () => addDrumRoll(false)); AddStep("Strong DrumRoll", () => addDrumRoll(true)); - AddStep("Swell", addSwell); + AddStep("Swell", () => addSwell()); AddStep("Centre", () => addCentreHit(false)); AddStep("Strong Centre", () => addCentreHit(true)); AddStep("Rim", () => addRimHit(false)); @@ -82,35 +86,38 @@ namespace osu.Desktop.VisualTests.Tests }); } - private void addBarLine(bool major) + private void addBarLine(bool major, double delay = scroll_time) { BarLine bl = new BarLine { - StartTime = Time.Current + 1000, - ScrollTime = 1000 + StartTime = playfield.Time.Current + delay, + ScrollTime = scroll_time }; playfield.AddBarLine(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl)); } - private void addSwell() + private void addSwell(double duration = default_duration) { playfield.Add(new DrawableSwell(new Swell { - StartTime = Time.Current + 1000, - EndTime = Time.Current + 1000, - ScrollTime = 1000 + StartTime = playfield.Time.Current + scroll_time, + Duration = duration, + ScrollTime = scroll_time })); } - private void addDrumRoll(bool strong) + private void addDrumRoll(bool strong, double duration = default_duration) { + addBarLine(true); + addBarLine(true, scroll_time + duration); + var d = new DrumRoll { - StartTime = Time.Current + 1000, + StartTime = playfield.Time.Current + scroll_time, IsStrong = strong, - Distance = 1000, - ScrollTime = 1000, + Duration = duration, + ScrollTime = scroll_time, }; playfield.Add(new DrawableDrumRoll(d)); @@ -120,8 +127,8 @@ namespace osu.Desktop.VisualTests.Tests { Hit h = new Hit { - StartTime = Time.Current + 1000, - ScrollTime = 1000 + StartTime = playfield.Time.Current + scroll_time, + ScrollTime = scroll_time }; if (strong) @@ -134,8 +141,8 @@ namespace osu.Desktop.VisualTests.Tests { Hit h = new Hit { - StartTime = Time.Current + 1000, - ScrollTime = 1000 + StartTime = playfield.Time.Current + scroll_time, + ScrollTime = scroll_time }; if (strong) From 28648bf97ded6cf299f9a52cfd75799ddffeab29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 13:56:16 +0900 Subject: [PATCH 298/348] Change playfield padding to x-offset to correctly hide notes appearing. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 958055d768..9e7eb571a1 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -85,7 +85,7 @@ namespace osu.Game.Modes.Taiko.UI { new Container { - Padding = new MarginPadding { Left = hit_target_offset }, + X = hit_target_offset, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { From 57a068c5d13b4e2cd08bd272a910a0a2e269b541 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 15:11:51 +0900 Subject: [PATCH 299/348] Fix notes travelling backwards when hit. Also improves the gravity curve. --- .../Objects/Drawables/DrawableHit.cs | 14 +++++++++----- .../Objects/Drawables/DrawableTaikoHitObject.cs | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs index 40d625812a..f325026be9 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableHit.cs @@ -75,12 +75,16 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables FadeOut(100); break; case ArmedState.Hit: - Content.ScaleTo(0.8f, 400, EasingTypes.OutQuad); - Content.MoveToY(-200, 250, EasingTypes.Out); - Content.Delay(250); - Content.MoveToY(0, 500, EasingTypes.In); - FadeOut(600); + + const float gravity_time = 300; + const float gravity_travel_height = 200; + + Content.ScaleTo(0.8f, gravity_time * 2, EasingTypes.OutQuad); + + MoveToY(-gravity_travel_height, gravity_time, EasingTypes.Out); + Delay(gravity_time, true); + MoveToY(gravity_travel_height * 2, gravity_time * 2, EasingTypes.In); break; } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 5086ab8f81..0c9720b0bb 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -71,7 +71,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables /// a time value and the HitObject's StartTime. /// /// - protected virtual void UpdateScrollPosition(double time) => MoveToX((float)((HitObject.StartTime - time) / HitObject.ScrollTime)); + protected virtual void UpdateScrollPosition(double time) => X = (float)((HitObject.StartTime - time) / HitObject.ScrollTime); protected override void Update() { From 87b8f8ef6e5f13a5c67204bf809f431572286561 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 16:27:59 +0900 Subject: [PATCH 300/348] Fix incorrect relative mapping for CirclePiece's content. --- .../Objects/Drawables/Pieces/CirclePiece.cs | 14 +++++++++++--- .../Drawables/Pieces/ElongatedCirclePiece.cs | 11 ++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 76bc60d887..6ea1494ea7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -26,7 +26,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces /// /// The amount to scale up the base circle to show it as a "strong" piece. /// - protected const float STRONG_SCALE = 1.5f; + private const float strong_scale = 1.5f; /// /// The colour of the inner circle and outer glows. @@ -125,13 +125,21 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces if (isStrong) { - Size *= STRONG_SCALE; + Size *= strong_scale; //default for symbols etc. - Content.Scale *= STRONG_SCALE; + Content.Scale *= strong_scale; } } + protected override void Update() + { + base.Update(); + + //we want to allow for width of content to remain mapped to the area inside us, regardless of the scale applied above. + Content.Width = 1 / Content.Scale.X; + } + private void resetEdgeEffects() { background.EdgeEffect = new EdgeEffect diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs index d203c4ea05..5431507614 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/Pieces/ElongatedCirclePiece.cs @@ -21,21 +21,18 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables.Pieces public ElongatedCirclePiece(bool isStrong = false) : base(isStrong) { - if (isStrong) - { - //undo the strong scale provided in CirclePiece. - Content.Scale /= STRONG_SCALE; - } } protected override void Update() { base.Update(); + var padding = Content.DrawHeight * Content.Width / 2; + Content.Padding = new MarginPadding { - Left = DrawHeight / 2, - Right = DrawHeight / 2, + Left = padding, + Right = padding, }; Width = (PlayfieldLengthReference?.Invoke() ?? 0) * Length + DrawHeight; From 9ac18230ccf99e57995c49c336b70f6d2d8ca448 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 16:31:15 +0900 Subject: [PATCH 301/348] Only apply taiko LegacyTimingInfo to LegacyBeatmaps. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 3b77610910..4e16623199 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -9,6 +9,7 @@ using osu.Game.Modes.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; +using osu.Game.Beatmaps.Legacy; using osu.Game.Beatmaps.Timing; using osu.Game.Database; @@ -42,7 +43,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps { return new Beatmap(original) { - TimingInfo = new LegacyTimingInfo(original.TimingInfo), + TimingInfo = original is LegacyBeatmap ? new LegacyTimingInfo(original.TimingInfo) : original.TimingInfo, HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() }; } From a4cc7fc6afa1f8351a5aeab4ebfe0d66c4333bd7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 16:44:45 +0900 Subject: [PATCH 302/348] Remove unused velocity variables. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 69864bc422..3a66c55ea5 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -22,11 +22,6 @@ namespace osu.Game.Modes.Taiko.Objects public double Duration { get; set; } - /// - /// Velocity of the drum roll in positional length units per millisecond. - /// - public double Velocity { get; protected set; } = 5; - /// /// Numer of ticks per beat length. /// @@ -64,9 +59,6 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - double speedAdjutedBeatLength = timing.SpeedMultiplierAt(StartTime) * timing.BeatLengthAt(StartTime); - - Velocity = base_distance * difficulty.SliderMultiplier / speedAdjutedBeatLength; tickSpacing = timing.BeatLengthAt(StartTime) / TickRate; RequiredGoodHits = TotalTicks * Math.Min(0.15, 0.05 + 0.10 / 6 * difficulty.OverallDifficulty); From 3b3455afb3938b6c1b2bbc685f61e00d2836010f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 16:51:21 +0900 Subject: [PATCH 303/348] Fix incorrect ScrollTime calculation. --- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index d2af610863..731a9a88b3 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -15,12 +15,12 @@ namespace osu.Game.Modes.Taiko.Objects public const float CIRCLE_RADIUS = 42f; /// - /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. + /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000>ms. /// - public const double SCROLL_TIME = 6000; + private const double scroll_time = 6000; /// - /// Our adjusted taking into consideration local and other speed multipliers. + /// Our adjusted taking into consideration local and other speed multipliers. /// public double ScrollTime; @@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - ScrollTime = SCROLL_TIME / difficulty.SliderMultiplier * timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000; + ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) / 1000) / (difficulty.SliderMultiplier * timing.SpeedMultiplierAt(StartTime)); ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; From 8173d01d788cf0bd7450f10881adea46e610a8a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 10:15:39 +0900 Subject: [PATCH 304/348] Fix crash on changing play mode too early. --- osu.Game/Screens/Select/SongSelect.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 44204f5beb..3e8ddc0f64 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -167,13 +167,12 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue); } - if (osu != null) - playMode.BindTo(osu.PlayMode); - playMode.ValueChanged += val => Beatmap.PreferredPlayMode = val; - if (database == null) database = beatmaps; + playMode.ValueChanged += val => { if (Beatmap != null) Beatmap.PreferredPlayMode = val; }; + if (osu != null) playMode.BindTo(osu.PlayMode); + database.BeatmapSetAdded += onBeatmapSetAdded; database.BeatmapSetRemoved += onBeatmapSetRemoved; From 4b1588a21d677a07283749be7c7ba81aa446914c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 17:27:01 +0900 Subject: [PATCH 305/348] Fix correct mode filter not being applied when first entering song select. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 ++-- osu.Game/Screens/Select/FilterControl.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 7443603c8b..f104bf9a37 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -179,11 +179,11 @@ namespace osu.Game.Screens.Select public void Filter(FilterCriteria newCriteria = null, bool debounce = true) { - if (!IsLoaded) return; - if (newCriteria != null) criteria = newCriteria; + if (!IsLoaded) return; + Action perform = delegate { filterTask = null; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 26daddc3a9..6d92b35993 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -173,9 +173,9 @@ namespace osu.Game.Screens.Select { sortTabs.AccentColour = colours.GreenLight; - if (osu != null) - playMode.BindTo(osu.PlayMode); + if (osu != null) playMode.BindTo(osu.PlayMode); playMode.ValueChanged += val => FilterChanged?.Invoke(CreateCriteria()); + playMode.TriggerChange(); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; From 4aafc172ca5e2056d316a0c8a49bc7af54c902c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 17:38:13 +0900 Subject: [PATCH 306/348] Allow playfield to specify whether it has a cursor or not. --- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 2 ++ osu.Game/Modes/UI/HitRenderer.cs | 12 ++++++++++++ osu.Game/Modes/UI/Playfield.cs | 5 +++++ osu.Game/OsuGame.cs | 2 +- osu.Game/Screens/Play/Player.cs | 6 ++---- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 8090263fe1..d89bbfd131 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -21,6 +21,8 @@ namespace osu.Game.Modes.Osu.UI private readonly Container judgementLayer; private readonly ConnectionRenderer connectionLayer; + public override bool ProvidingUserCursor => true; + public override Vector2 Size { get diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index e36d2a101c..a958c61c68 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -42,6 +42,16 @@ namespace osu.Game.Modes.UI /// protected readonly KeyConversionInputManager KeyConversionInputManager; + /// + /// Whether we are currently providing the local user a gameplay cursor. + /// + public virtual bool ProvidingUserCursor => false; + + /// + /// Whether we have a replay loaded currently. + /// + public bool HasReplayLoaded => InputManager.ReplayInputHandler != null; + /// /// Whether all the HitObjects have been judged. /// @@ -157,6 +167,8 @@ namespace osu.Game.Modes.UI { public event Action OnJudgement; + public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor; + protected override Container Content => content; protected override bool AllObjectsJudged => Playfield.HitObjects.Children.All(h => h.Judgement.Result != HitResult.None); diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index eff06ce80f..f31ee0f189 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -22,6 +22,11 @@ namespace osu.Game.Modes.UI internal Container ScaledContent; + /// + /// Whether we are currently providing the local user a gameplay cursor. + /// + public virtual bool ProvidingUserCursor => false; + protected override Container Content => content; private readonly Container content; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index d75f8b4d8e..7172aba3be 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -314,7 +314,7 @@ namespace osu.Game if (intro?.ChildScreen != null) intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight }; - Cursor.State = currentScreen == null || currentScreen.HasLocalCursorDisplayed ? Visibility.Hidden : Visibility.Visible; + Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden; } private void screenAdded(Screen newScreen) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b263b5507c..f160563c3b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -31,9 +31,7 @@ namespace osu.Game.Screens.Play internal override bool ShowOverlays => false; - internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused; - - private bool hasReplayLoaded => HitRenderer.InputManager.ReplayInputHandler != null; + internal override bool HasLocalCursorDisplayed => !IsPaused && HitRenderer.ProvidingUserCursor; public BeatmapInfo BeatmapInfo; @@ -305,7 +303,7 @@ namespace osu.Game.Screens.Play { if (pauseOverlay == null) return false; - if (hasReplayLoaded) + if (HitRenderer.HasReplayLoaded) return false; if (pauseOverlay.State != Visibility.Visible && !canPause) return true; From 8d16e1efa2114cf62e87fd03376b0e8d4a862b4e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 17:42:56 +0900 Subject: [PATCH 307/348] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e9b388934e..cd715ac535 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e9b388934ed77cbc1af3cdfd213eb754f71554ae +Subproject commit cd715ac535ace224188ac56f88a08c4c2908f51b From 2d8239a3f71247206cf4941802bbe1f0a991ca88 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 5 Apr 2017 21:34:28 +0900 Subject: [PATCH 308/348] Re-implement the SampleBank/Sample structure. No parsing support yet. --- .../Beatmaps/OsuBeatmapConverter.cs | 6 +- .../Objects/Drawables/DrawableSlider.cs | 4 +- .../Objects/Drawables/DrawableSliderTick.cs | 6 +- osu.Game.Modes.Osu/Objects/Slider.cs | 6 +- .../Beatmaps/TaikoBeatmapConverter.cs | 16 ++-- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 6 +- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 4 +- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 8 +- osu.Game/Beatmaps/Samples/HitSampleInfo.cs | 10 --- osu.Game/Beatmaps/Samples/Sample.cs | 21 +++++ osu.Game/Beatmaps/Samples/SampleBank.cs | 29 ++++-- osu.Game/Beatmaps/Samples/SampleInfo.cs | 12 --- osu.Game/Beatmaps/Samples/SampleSet.cs | 13 --- osu.Game/Beatmaps/Samples/SampleType.cs | 19 ++-- .../Objects/Drawables/DrawableHitObject.cs | 88 +++++++++---------- osu.Game/Modes/Objects/HitObject.cs | 4 +- .../Modes/Objects/LegacyHitObjectParser.cs | 4 +- osu.Game/osu.Game.csproj | 8 +- 18 files changed, 126 insertions(+), 138 deletions(-) delete mode 100644 osu.Game/Beatmaps/Samples/HitSampleInfo.cs create mode 100644 osu.Game/Beatmaps/Samples/Sample.cs delete mode 100644 osu.Game/Beatmaps/Samples/SampleInfo.cs delete mode 100644 osu.Game/Beatmaps/Samples/SampleSet.cs diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index fec675be54..3e8d022af2 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -43,7 +43,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new Slider { StartTime = original.StartTime, - Sample = original.Sample, + SampleBank = original.SampleBank, CurveObject = curveData, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false @@ -55,7 +55,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new Spinner { StartTime = original.StartTime, - Sample = original.Sample, + SampleBank = original.SampleBank, Position = new Vector2(512, 384) / 2, EndTime = endTimeData.EndTime }; @@ -64,7 +64,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new HitCircle { StartTime = original.StartTime, - Sample = original.Sample, + SampleBank = original.SampleBank, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index e8f2154d7f..cd8086720f 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -67,7 +67,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables ComboIndex = s.ComboIndex, Scale = s.Scale, ComboColour = s.ComboColour, - Sample = s.Sample, + SampleBank = s.SampleBank, }), }; @@ -111,7 +111,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables if (repeat > currentRepeat) { if (repeat < slider.RepeatCount && ball.Tracking) - PlaySample(); + PlaySamples(); currentRepeat = repeat; } diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index be66689054..1bcfb54b24 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -58,12 +58,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower(); - - sample = audio.Sample.Get($@"Gameplay/{sampleSet}-slidertick"); + sample = audio.Sample.Get($@"Gameplay/{HitObject.SampleBank.Name.ToLower()}-slidertick"); } - protected override void PlaySample() + protected override void PlaySamples() { sample?.Play(); } diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 38d1dfda5d..0fa837207f 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -95,11 +95,7 @@ namespace osu.Game.Modes.Osu.Objects StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, - Sample = new HitSampleInfo - { - Type = SampleType.None, - Set = SampleSet.Soft, - }, + SampleBank = SampleBank }; } } diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 594ed5f309..903ac5ae05 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -57,9 +57,9 @@ namespace osu.Game.Modes.Taiko.Beatmaps var endTimeData = obj as IHasEndTime; // Old osu! used hit sounding to determine various hit type information - SampleType sample = obj.Sample?.Type ?? SampleType.None; + SampleBank sampleBank = obj.SampleBank; - bool strong = (sample & SampleType.Finish) > 0; + bool strong = sampleBank.Sets.Any(s => s.Type == SampleType.Finish); if (distanceData != null) { @@ -98,7 +98,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new CentreHit { StartTime = j, - Sample = obj.Sample, + SampleBank = obj.SampleBank, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; @@ -109,7 +109,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new DrumRoll { StartTime = obj.StartTime, - Sample = obj.Sample, + SampleBank = obj.SampleBank, IsStrong = strong, Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, @@ -124,7 +124,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new Swell { StartTime = obj.StartTime, - Sample = obj.Sample, + SampleBank = obj.SampleBank, IsStrong = strong, EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), @@ -133,14 +133,14 @@ namespace osu.Game.Modes.Taiko.Beatmaps } else { - bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0; + bool isCentre = sampleBank.Sets.Any(s => s.Type == SampleType.Normal); if (isCentre) { yield return new CentreHit { StartTime = obj.StartTime, - Sample = obj.Sample, + SampleBank = obj.SampleBank, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; @@ -150,7 +150,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new RimHit { StartTime = obj.StartTime, - Sample = obj.Sample, + SampleBank = obj.SampleBank, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ede576835c..427ddcf3fa 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -95,11 +95,7 @@ namespace osu.Game.Modes.Taiko.Objects TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, - Sample = new HitSampleInfo - { - Type = SampleType.None, - Set = SampleSet.Soft - } + SampleBank = SampleBank }); first = false; diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 3c1f4eaf45..cc3d507038 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -136,12 +136,12 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(slider); Assert.AreEqual(new Vector2(192, 168), slider.Position); Assert.AreEqual(956, slider.StartTime); - Assert.AreEqual(SampleType.None, slider.Sample.Type); + Assert.AreEqual(SampleType.None, slider.SampleBank.Type); var hit = beatmap.HitObjects[1] as LegacyHit; Assert.IsNotNull(hit); Assert.AreEqual(new Vector2(304, 56), hit.Position); Assert.AreEqual(1285, hit.StartTime); - Assert.AreEqual(SampleType.Clap, hit.Sample.Type); + Assert.AreEqual(SampleType.Clap, hit.SampleBank.Type); } } } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index c1b802bb48..7c042b4907 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats // TODO: Not sure how far back to go, or differences between versions } - private SampleSet defaultSampleSet; + private Sample defaultSampleSet; private int defaultSampleVolume = 100; private bool samplesMatchPlaybackRate; @@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.Countdown = int.Parse(val) == 1; break; case @"SampleSet": - defaultSampleSet = (SampleSet)Enum.Parse(typeof(SampleSet), val); + defaultSampleSet = (Sample)Enum.Parse(typeof(Sample), val); break; case @"SampleVolume": defaultSampleVolume = int.Parse(val); @@ -222,9 +222,9 @@ namespace osu.Game.Beatmaps.Formats if (split.Length >= 3) timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)int.Parse(split[2]); - SampleSet sampleSet = defaultSampleSet; + Sample sampleSet = defaultSampleSet; if (split.Length >= 4) - sampleSet = (SampleSet)int.Parse(split[3]); + sampleSet = (Sample)int.Parse(split[3]); SampleBank sampleBank = SampleBank.Default; if (split.Length >= 5) diff --git a/osu.Game/Beatmaps/Samples/HitSampleInfo.cs b/osu.Game/Beatmaps/Samples/HitSampleInfo.cs deleted file mode 100644 index f5a5cc1bea..0000000000 --- a/osu.Game/Beatmaps/Samples/HitSampleInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Samples -{ - public class HitSampleInfo : SampleInfo - { - public SampleType Type; - } -} diff --git a/osu.Game/Beatmaps/Samples/Sample.cs b/osu.Game/Beatmaps/Samples/Sample.cs new file mode 100644 index 0000000000..d90362bd0b --- /dev/null +++ b/osu.Game/Beatmaps/Samples/Sample.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Samples +{ + /// + /// A defines a type of sound that is to be played. + /// + public class Sample + { + /// + /// The type of sound to be played. + /// + public SampleType Type; + + /// + /// The volume to be played at. + /// + public int? Volume; + } +} diff --git a/osu.Game/Beatmaps/Samples/SampleBank.cs b/osu.Game/Beatmaps/Samples/SampleBank.cs index 2154713cff..30876c2ce0 100644 --- a/osu.Game/Beatmaps/Samples/SampleBank.cs +++ b/osu.Game/Beatmaps/Samples/SampleBank.cs @@ -1,12 +1,29 @@ -// 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; + namespace osu.Game.Beatmaps.Samples { - public enum SampleBank + /// + /// Wraps a list of to change which bank of files are used for each . + /// + public class SampleBank { - Default = 0, - Custom1 = 1, - Custom2 = 2 + /// + /// The list of samples that are to be played to be played from this bank. + /// + public List Sets; + + /// + /// In conversion from osu-stable, this is equivalent to SampleSet (_not_ CustomSampleSet). + /// i.e. None/Normal/Soft/Drum + /// + public string Name; + + /// + /// Default sample volume. + /// + public int Volume; } -} \ No newline at end of file +} diff --git a/osu.Game/Beatmaps/Samples/SampleInfo.cs b/osu.Game/Beatmaps/Samples/SampleInfo.cs deleted file mode 100644 index 5b8f44d116..0000000000 --- a/osu.Game/Beatmaps/Samples/SampleInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Samples -{ - public class SampleInfo - { - public SampleBank Bank; - public SampleSet Set; - public int Volume; - } -} diff --git a/osu.Game/Beatmaps/Samples/SampleSet.cs b/osu.Game/Beatmaps/Samples/SampleSet.cs deleted file mode 100644 index 72f97d9e0e..0000000000 --- a/osu.Game/Beatmaps/Samples/SampleSet.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Samples -{ - public enum SampleSet - { - None = 0, - Normal = 1, - Soft = 2, - Drum = 3 - } -} \ No newline at end of file diff --git a/osu.Game/Beatmaps/Samples/SampleType.cs b/osu.Game/Beatmaps/Samples/SampleType.cs index 0a18a65201..ea2fc96810 100644 --- a/osu.Game/Beatmaps/Samples/SampleType.cs +++ b/osu.Game/Beatmaps/Samples/SampleType.cs @@ -1,17 +1,14 @@ -// 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; - namespace osu.Game.Beatmaps.Samples { - [Flags] public enum SampleType { - None = 0, - Normal = 1, - Whistle = 2, - Finish = 4, - Clap = 8 - }; -} \ No newline at end of file + None, + Normal, + Whistle, + Finish, + Clap + } +} diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index ed8269876e..352c660d4c 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -15,7 +15,7 @@ using OpenTK.Graphics; namespace osu.Game.Modes.Objects.Drawables { - public abstract class DrawableHitObject : Container, IStateful + public abstract class DrawableHitObject : Container where TJudgement : Judgement { public override bool HandleInput => Interactive; @@ -24,9 +24,44 @@ namespace osu.Game.Modes.Objects.Drawables public TJudgement Judgement; - protected abstract TJudgement CreateJudgement(); + protected override void LoadComplete() + { + base.LoadComplete(); - protected abstract void UpdateState(ArmedState state); + // We may be setting a custom judgement in test cases or what not + if (Judgement == null) + Judgement = CreateJudgement(); + } + + protected abstract TJudgement CreateJudgement(); + } + + public abstract class DrawableHitObject : DrawableHitObject, IStateful + where TObject : HitObject + where TJudgement : Judgement + { + public event Action> OnJudgement; + + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public Color4 AccentColour { get; protected set; } + + public TObject HitObject; + + private readonly List samples = new List(); + + protected DrawableHitObject(TObject hitObject) + { + HitObject = hitObject; + } + + [BackgroundDependencyLoader] + private void load(AudioManager audio) + { + foreach (var sample in HitObject.SampleBank.Sets) + samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type.ToString().ToLower()}-hit{HitObject.SampleBank.Name.ToLower()}")); + } private ArmedState state; public ArmedState State @@ -45,47 +80,17 @@ namespace osu.Game.Modes.Objects.Drawables UpdateState(state); if (State == ArmedState.Hit) - PlaySample(); + PlaySamples(); } } - protected SampleChannel Sample; - - protected virtual void PlaySample() - { - Sample?.Play(); - } - protected override void LoadComplete() { base.LoadComplete(); - //we may be setting a custom judgement in test cases or what not. - if (Judgement == null) - Judgement = CreateJudgement(); - - //force application of the state that was set before we loaded. + // Force application of the state that was set before we loaded UpdateState(State); } - } - - public abstract class DrawableHitObject : DrawableHitObject - where TObject : HitObject - where TJudgement : Judgement - { - public event Action> OnJudgement; - - public TObject HitObject; - - /// - /// The colour used for various elements of this DrawableHitObject. - /// - public Color4 AccentColour { get; protected set; } - - protected DrawableHitObject(TObject hitObject) - { - HitObject = hitObject; - } /// /// Process a hit of this hitobject. Carries out judgement. @@ -149,16 +154,9 @@ namespace osu.Game.Modes.Objects.Drawables UpdateJudgement(false); } - [BackgroundDependencyLoader] - private void load(AudioManager audio) + protected virtual void PlaySamples() { - SampleType type = HitObject.Sample?.Type ?? SampleType.None; - if (type == SampleType.None) - type = SampleType.Normal; - - SampleSet sampleSet = HitObject.Sample?.Set ?? SampleSet.Normal; - - Sample = audio.Sample.Get($@"Gameplay/{sampleSet.ToString().ToLower()}-hit{type.ToString().ToLower()}"); + samples.ForEach(s => s?.Play()); } private List> nestedHitObjects; @@ -173,5 +171,7 @@ namespace osu.Game.Modes.Objects.Drawables h.OnJudgement += d => OnJudgement?.Invoke(d); nestedHitObjects.Add(h); } + + protected abstract void UpdateState(ArmedState state); } } diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index f2712d92ba..d734dce073 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -21,9 +21,9 @@ namespace osu.Game.Modes.Objects public double StartTime { get; set; } /// - /// The sample to be played when this HitObject is hit. + /// The sample bank to be played when this hit object is hit. /// - public HitSampleInfo Sample { get; set; } + public SampleBank SampleBank { get; set; } /// /// Applies default values to this HitObject. diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index ccc5f18822..bb94d02d38 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -105,10 +105,10 @@ namespace osu.Game.Modes.Objects throw new InvalidOperationException($@"Unknown hit object type {type}"); result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); - result.Sample = new HitSampleInfo + result.SampleBank = new HitSampleInfo { Type = (SampleType)int.Parse(split[4]), - Set = SampleSet.Soft, + Set = Sample.Soft, }; // TODO: "addition" field diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da3b4dd406..c8a38bc48e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -76,6 +76,9 @@ + + + @@ -148,11 +151,6 @@ - - - - - From 8d720e39c6d34becff5f857bb5fae906eabcd111 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 5 Apr 2017 21:39:09 +0900 Subject: [PATCH 309/348] Going forward, explicit ToLower should not be needed. --- osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs | 2 +- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 1bcfb54b24..47eecccf66 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -58,7 +58,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - sample = audio.Sample.Get($@"Gameplay/{HitObject.SampleBank.Name.ToLower()}-slidertick"); + sample = audio.Sample.Get($@"Gameplay/{HitObject.SampleBank.Name}-slidertick"); } protected override void PlaySamples() diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 352c660d4c..29b0e00351 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -60,7 +60,7 @@ namespace osu.Game.Modes.Objects.Drawables private void load(AudioManager audio) { foreach (var sample in HitObject.SampleBank.Sets) - samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type.ToString().ToLower()}-hit{HitObject.SampleBank.Name.ToLower()}")); + samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type}-hit{HitObject.SampleBank.Name}")); } private ArmedState state; From d607207b69115cb9ce2742006743966c6bd66767 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 5 Apr 2017 21:59:07 +0900 Subject: [PATCH 310/348] Ability to contain multiple sample banks. Get default bank name from control point. --- .../Beatmaps/OsuBeatmapConverter.cs | 6 +++--- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 11 +++++----- osu.Game.Modes.Osu/Objects/Slider.cs | 2 +- .../Beatmaps/TaikoBeatmapConverter.cs | 16 +++++++------- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 2 +- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 5 +++-- osu.Game/Beatmaps/Samples/SampleBank.cs | 2 +- osu.Game/Beatmaps/Timing/ControlPoint.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 5 +++-- osu.Game/Modes/Objects/HitObject.cs | 21 ++++++++++++++++--- 11 files changed, 46 insertions(+), 28 deletions(-) diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index 3e8d022af2..e0cd66ca94 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -43,7 +43,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new Slider { StartTime = original.StartTime, - SampleBank = original.SampleBank, + SampleBanks = original.SampleBanks, CurveObject = curveData, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false @@ -55,7 +55,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new Spinner { StartTime = original.StartTime, - SampleBank = original.SampleBank, + SampleBanks = original.SampleBanks, Position = new Vector2(512, 384) / 2, EndTime = endTimeData.EndTime }; @@ -64,7 +64,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new HitCircle { StartTime = original.StartTime, - SampleBank = original.SampleBank, + SampleBanks = original.SampleBanks, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index cd8086720f..596bd2cb9d 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -67,7 +67,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables ComboIndex = s.ComboIndex, Scale = s.Scale, ComboColour = s.ComboColour, - SampleBank = s.SampleBank, + SampleBanks = s.SampleBanks, }), }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 47eecccf66..c8fd60c8d6 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -12,6 +12,7 @@ using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Judgements; using OpenTK; using OpenTK.Graphics; +using System.Collections.Generic; namespace osu.Game.Modes.Osu.Objects.Drawables { @@ -28,6 +29,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.SliderTick }; + private List samples = new List(); + public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) { this.sliderTick = sliderTick; @@ -53,20 +56,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables }; } - private SampleChannel sample; - [BackgroundDependencyLoader] private void load(AudioManager audio) { - sample = audio.Sample.Get($@"Gameplay/{HitObject.SampleBank.Name}-slidertick"); + foreach (var bank in HitObject.SampleBanks) + samples.Add(audio.Sample.Get($@"Gameplay/{bank.Name}-slidertick")); } protected override void PlaySamples() { - sample?.Play(); + samples.ForEach(s => s?.Play()); } - protected override void CheckJudgement(bool userTriggered) { if (Judgement.TimeOffset >= 0) diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 0fa837207f..49d16ec859 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -95,7 +95,7 @@ namespace osu.Game.Modes.Osu.Objects StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, - SampleBank = SampleBank + SampleBanks = SampleBanks }; } } diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 903ac5ae05..d0dce85863 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -57,9 +57,9 @@ namespace osu.Game.Modes.Taiko.Beatmaps var endTimeData = obj as IHasEndTime; // Old osu! used hit sounding to determine various hit type information - SampleBank sampleBank = obj.SampleBank; + List sampleBanks = obj.SampleBanks; - bool strong = sampleBank.Sets.Any(s => s.Type == SampleType.Finish); + bool strong = sampleBanks.Any(b => b.Samples.Any(s => s.Type == SampleType.Finish)); if (distanceData != null) { @@ -98,7 +98,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new CentreHit { StartTime = j, - SampleBank = obj.SampleBank, + SampleBanks = obj.SampleBanks, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; @@ -109,7 +109,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new DrumRoll { StartTime = obj.StartTime, - SampleBank = obj.SampleBank, + SampleBanks = obj.SampleBanks, IsStrong = strong, Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, @@ -124,7 +124,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new Swell { StartTime = obj.StartTime, - SampleBank = obj.SampleBank, + SampleBanks = obj.SampleBanks, IsStrong = strong, EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), @@ -133,14 +133,14 @@ namespace osu.Game.Modes.Taiko.Beatmaps } else { - bool isCentre = sampleBank.Sets.Any(s => s.Type == SampleType.Normal); + bool isCentre = sampleBanks.Any(b => b.Samples.Any(s => s.Type == SampleType.Normal)); if (isCentre) { yield return new CentreHit { StartTime = obj.StartTime, - SampleBank = obj.SampleBank, + SampleBanks = obj.SampleBanks, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; @@ -150,7 +150,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new RimHit { StartTime = obj.StartTime, - SampleBank = obj.SampleBank, + SampleBanks = obj.SampleBanks, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 427ddcf3fa..52878fa688 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -95,7 +95,7 @@ namespace osu.Game.Modes.Taiko.Objects TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, - SampleBank = SampleBank + SampleBanks = SampleBanks }); first = false; diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index cc3d507038..27ff942aa7 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -11,6 +11,7 @@ using osu.Game.Modes; using osu.Game.Tests.Resources; using osu.Game.Modes.Osu; using osu.Game.Modes.Objects.Legacy; +using System.Linq; namespace osu.Game.Tests.Beatmaps.Formats { @@ -136,12 +137,12 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(slider); Assert.AreEqual(new Vector2(192, 168), slider.Position); Assert.AreEqual(956, slider.StartTime); - Assert.AreEqual(SampleType.None, slider.SampleBank.Type); + Assert.IsTrue(slider.SampleBanks.Any(b => b.Name == "none")); var hit = beatmap.HitObjects[1] as LegacyHit; Assert.IsNotNull(hit); Assert.AreEqual(new Vector2(304, 56), hit.Position); Assert.AreEqual(1285, hit.StartTime); - Assert.AreEqual(SampleType.Clap, hit.SampleBank.Type); + Assert.IsTrue(hit.SampleBanks.Any(b => b.Name == "clap")); } } } diff --git a/osu.Game/Beatmaps/Samples/SampleBank.cs b/osu.Game/Beatmaps/Samples/SampleBank.cs index 30876c2ce0..7ec81e64fa 100644 --- a/osu.Game/Beatmaps/Samples/SampleBank.cs +++ b/osu.Game/Beatmaps/Samples/SampleBank.cs @@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps.Samples /// /// The list of samples that are to be played to be played from this bank. /// - public List Sets; + public List Samples; /// /// In conversion from osu-stable, this is equivalent to SampleSet (_not_ CustomSampleSet). diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index 00d3acba71..eb965cf678 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps.Timing TimingChange = true, }; - public SampleInfo Sample; + public SampleBank SampleBank; public TimeSignatures TimeSignature; public double Time; public double BeatLength; diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 29b0e00351..53eb890719 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -59,8 +59,9 @@ namespace osu.Game.Modes.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - foreach (var sample in HitObject.SampleBank.Sets) - samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type}-hit{HitObject.SampleBank.Name}")); + foreach (var bank in HitObject.SampleBanks) + foreach (var sample in bank.Samples) + samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type}-hit{bank.Name}")); } private ArmedState state; diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index d734dce073..7d91885dcb 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -4,6 +4,7 @@ using osu.Game.Beatmaps.Samples; using osu.Game.Beatmaps.Timing; using osu.Game.Database; +using System.Collections.Generic; namespace osu.Game.Modes.Objects { @@ -21,15 +22,29 @@ namespace osu.Game.Modes.Objects public double StartTime { get; set; } /// - /// The sample bank to be played when this hit object is hit. + /// The sample banks to be played when this hit object is hit. /// - public SampleBank SampleBank { get; set; } + public List SampleBanks = new List(); /// /// Applies default values to this HitObject. /// /// The difficulty settings to use. /// The timing settings to use. - public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { } + public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + foreach (var bank in SampleBanks) + { + if (!string.IsNullOrEmpty(bank.Name)) + continue; + + // If the bank is not assigned a name, assign it from the relevant timing point + ControlPoint overridePoint; + ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); + + bank.Name = (overridePoint ?? timingPoint)?.SampleBank.Name ?? string.Empty; + bank.Volume = (overridePoint ?? timingPoint)?.SampleBank.Volume ?? 0; + } + } } } From 1ef465716daa49a44de01c03fa3c1ecd5f352c17 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 5 Apr 2017 21:59:40 +0900 Subject: [PATCH 311/348] Proper legacy timing point parsing. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 27 ++++++++++++------- .../Modes/Objects/LegacyHitObjectParser.cs | 5 ---- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 7c042b4907..cfef8e947b 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats // TODO: Not sure how far back to go, or differences between versions } - private Sample defaultSampleSet; + private LegacySampleBank defaultSampleBank; private int defaultSampleVolume = 100; private bool samplesMatchPlaybackRate; @@ -77,7 +77,7 @@ namespace osu.Game.Beatmaps.Formats beatmap.BeatmapInfo.Countdown = int.Parse(val) == 1; break; case @"SampleSet": - defaultSampleSet = (Sample)Enum.Parse(typeof(Sample), val); + defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), val); break; case @"SampleVolume": defaultSampleVolume = int.Parse(val); @@ -222,13 +222,13 @@ namespace osu.Game.Beatmaps.Formats if (split.Length >= 3) timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)int.Parse(split[2]); - Sample sampleSet = defaultSampleSet; + LegacySampleBank sampleSet = defaultSampleBank; if (split.Length >= 4) - sampleSet = (Sample)int.Parse(split[3]); + sampleSet = (LegacySampleBank)int.Parse(split[3]); - SampleBank sampleBank = SampleBank.Default; - if (split.Length >= 5) - sampleBank = (SampleBank)int.Parse(split[4]); + //SampleBank sampleBank = SampleBank.Default; + //if (split.Length >= 5) + // sampleBank = (SampleBank)int.Parse(split[4]); int sampleVolume = defaultSampleVolume; if (split.Length >= 6) @@ -254,10 +254,9 @@ namespace osu.Game.Beatmaps.Formats VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, TimingChange = timingChange, TimeSignature = timeSignature, - Sample = new SampleInfo + SampleBank = new SampleBank { - Bank = sampleBank, - Set = sampleSet, + Name = sampleSet.ToString().ToLower(), Volume = sampleVolume }, KiaiMode = kiaiMode, @@ -372,5 +371,13 @@ namespace osu.Game.Beatmaps.Formats } } } + + private enum LegacySampleBank + { + None = 0, + Normal = 1, + Soft = 2, + Drum = 3 + } } } diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index bb94d02d38..4bf3d0f093 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -105,11 +105,6 @@ namespace osu.Game.Modes.Objects throw new InvalidOperationException($@"Unknown hit object type {type}"); result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); - result.SampleBank = new HitSampleInfo - { - Type = (SampleType)int.Parse(split[4]), - Set = Sample.Soft, - }; // TODO: "addition" field From 6a510097df21b9fbc826677c23c63b314aa53cfe Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Wed, 5 Apr 2017 22:36:03 +0300 Subject: [PATCH 312/348] InGameOverlay fixes --- osu.Game/Screens/Play/FailOverlay.cs | 9 +++------ osu.Game/Screens/Play/InGameOverlay.cs | 13 +++++-------- osu.Game/Screens/Play/PauseOverlay.cs | 9 +++------ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index c8539dc475..ceabaee43b 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -11,6 +11,9 @@ namespace osu.Game.Screens.Play { public class FailOverlay : InGameOverlay { + + public override string Header => "failed"; + public override string Description => "you're dead, try again?"; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (args.Key == Key.Escape) @@ -28,11 +31,5 @@ namespace osu.Game.Screens.Play AddButton(@"Retry", colours.YellowDark, OnRetry); AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } - - public FailOverlay() - { - Title = @"failed"; - Description = @"you're dead, try again?"; - } } } diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index 00c78913c6..cdd858644d 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -27,8 +27,8 @@ namespace osu.Game.Screens.Play public Action OnRetry; public Action OnQuit; - protected string Title; - protected string Description; + public abstract string Header { get; } + public abstract string Description { get; } private FillFlowContainer buttons; @@ -82,6 +82,8 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(InputState state) => true; + protected abstract void AddButtons(OsuColour colours); + protected void AddButton(string text, Color4 colour, Action action) { buttons.Add(new PauseButton @@ -131,7 +133,7 @@ namespace osu.Game.Screens.Play { new OsuSpriteText { - Text = Title, + Text = Header, Font = @"Exo2.0-Medium", Spacing = new Vector2(5, 0), Origin = Anchor.TopCentre, @@ -187,11 +189,6 @@ namespace osu.Game.Screens.Play AddButtons(colours); } - protected virtual void AddButtons(OsuColour colours) - { - - } - protected InGameOverlay() { AlwaysReceiveInput = true; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 2a67662298..a6b550368b 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -14,6 +14,9 @@ namespace osu.Game.Screens.Play { public Action OnResume; + public override string Header => "paused"; + public override string Description => "you're not going to do what i think you're going to do, are ya?"; + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (args.Key == Key.Escape) @@ -32,12 +35,6 @@ namespace osu.Game.Screens.Play AddButton(@"Retry", colours.YellowDark, OnRetry); AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); } - - public PauseOverlay() - { - Title = @"paused"; - Description = @"you're not going to do what i think you're going to do, are ya?"; - } } } \ No newline at end of file From 0946e42363e6ecd9fc54ca5f48d5ac779777b525 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Wed, 5 Apr 2017 22:51:43 +0300 Subject: [PATCH 313/348] removed useless stuff --- osu.Game/Screens/Play/FailOverlay.cs | 4 +++- osu.Game/Screens/Play/InGameOverlay.cs | 4 ---- osu.Game/Screens/Play/PauseOverlay.cs | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index ceabaee43b..0726536ddd 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -6,6 +6,7 @@ using osu.Framework.Input; using OpenTK.Input; using osu.Game.Graphics; using OpenTK.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Screens.Play { @@ -26,7 +27,8 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } - protected override void AddButtons(OsuColour colours) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { AddButton(@"Retry", colours.YellowDark, OnRetry); AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/InGameOverlay.cs index cdd858644d..d35fe28f3e 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/InGameOverlay.cs @@ -82,8 +82,6 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(InputState state) => true; - protected abstract void AddButtons(OsuColour colours); - protected void AddButton(string text, Color4 colour, Action action) { buttons.Add(new PauseButton @@ -185,8 +183,6 @@ namespace osu.Game.Screens.Play }; Retries = 0; - - AddButtons(colours); } protected InGameOverlay() diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index a6b550368b..061b91d289 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -7,6 +7,7 @@ using osu.Game.Graphics; using OpenTK.Input; using osu.Framework.Graphics.Containers; using OpenTK.Graphics; +using osu.Framework.Allocation; namespace osu.Game.Screens.Play { @@ -29,7 +30,8 @@ namespace osu.Game.Screens.Play return base.OnKeyDown(state, args); } - protected override void AddButtons(OsuColour colours) + [BackgroundDependencyLoader] + private void load(OsuColour colours) { AddButton(@"Continue", colours.Green, OnResume); AddButton(@"Retry", colours.YellowDark, OnRetry); From e903241c7b2c2301306904d2c433e163921a46c3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 09:43:47 +0900 Subject: [PATCH 314/348] Implement sample + addition sample reading from hit objects. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Beatmaps/Samples/SampleBank.cs | 2 +- osu.Game/Beatmaps/Samples/SampleType.cs | 1 - .../Objects/Drawables/DrawableHitObject.cs | 2 +- osu.Game/Modes/Objects/HitObject.cs | 2 +- .../Modes/Objects/LegacyHitObjectParser.cs | 65 ++++++++++++++++++- 6 files changed, 67 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index cfef8e947b..5303a84f0a 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -372,7 +372,7 @@ namespace osu.Game.Beatmaps.Formats } } - private enum LegacySampleBank + internal enum LegacySampleBank { None = 0, Normal = 1, diff --git a/osu.Game/Beatmaps/Samples/SampleBank.cs b/osu.Game/Beatmaps/Samples/SampleBank.cs index 7ec81e64fa..d0464ad4c3 100644 --- a/osu.Game/Beatmaps/Samples/SampleBank.cs +++ b/osu.Game/Beatmaps/Samples/SampleBank.cs @@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps.Samples /// /// The list of samples that are to be played to be played from this bank. /// - public List Samples; + public List Samples = new List(); /// /// In conversion from osu-stable, this is equivalent to SampleSet (_not_ CustomSampleSet). diff --git a/osu.Game/Beatmaps/Samples/SampleType.cs b/osu.Game/Beatmaps/Samples/SampleType.cs index ea2fc96810..0f4809c1fe 100644 --- a/osu.Game/Beatmaps/Samples/SampleType.cs +++ b/osu.Game/Beatmaps/Samples/SampleType.cs @@ -5,7 +5,6 @@ namespace osu.Game.Beatmaps.Samples { public enum SampleType { - None, Normal, Whistle, Finish, diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 53eb890719..ca25074d25 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -61,7 +61,7 @@ namespace osu.Game.Modes.Objects.Drawables { foreach (var bank in HitObject.SampleBanks) foreach (var sample in bank.Samples) - samples.Add(audio.Sample.Get($@"Gameplay/{sample.Type}-hit{bank.Name}")); + samples.Add(audio.Sample.Get($@"Gameplay/{bank.Name}-hit{sample.Type.ToString().ToLower()}")); } private ArmedState state; diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index 7d91885dcb..68062cce98 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -35,7 +35,7 @@ namespace osu.Game.Modes.Objects { foreach (var bank in SampleBanks) { - if (!string.IsNullOrEmpty(bank.Name)) + if (!string.IsNullOrEmpty(bank.Name) && bank.Name != @"none") continue; // If the bank is not assigned a name, assign it from the relevant timing point diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index 4bf3d0f093..bc8d430716 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -2,12 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; using System.Collections.Generic; using System.Globalization; using osu.Game.Modes.Objects.Legacy; +using osu.Game.Beatmaps.Samples; +using osu.Game.Beatmaps.Formats; namespace osu.Game.Modes.Objects { @@ -20,6 +21,9 @@ namespace osu.Game.Modes.Objects bool combo = type.HasFlag(LegacyHitObjectType.NewCombo); type &= ~LegacyHitObjectType.NewCombo; + var normalSampleBank = new SampleBank(); + var addSampleBank = new SampleBank(); + HitObject result; if ((type & LegacyHitObjectType.Circle) > 0) @@ -29,6 +33,9 @@ namespace osu.Game.Modes.Objects Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), NewCombo = combo }; + + if (split.Length > 5) + readCustomSampleBanks(split[5], ref normalSampleBank, ref addSampleBank); } else if ((type & LegacyHitObjectType.Slider) > 0) { @@ -84,6 +91,9 @@ namespace osu.Game.Modes.Objects Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), NewCombo = combo }; + + if (split.Length > 10) + readCustomSampleBanks(split[10], ref normalSampleBank, ref addSampleBank); } else if ((type & LegacyHitObjectType.Spinner) > 0) { @@ -91,6 +101,9 @@ namespace osu.Game.Modes.Objects { EndTime = Convert.ToDouble(split[5], CultureInfo.InvariantCulture) }; + + if (split.Length > 6) + readCustomSampleBanks(split[6], ref normalSampleBank, ref addSampleBank); } else if ((type & LegacyHitObjectType.Hold) > 0) { @@ -106,9 +119,57 @@ namespace osu.Game.Modes.Objects result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture); - // TODO: "addition" field + var soundType = (LegacySoundType)int.Parse(split[4]); + + normalSampleBank.Samples.Add(new Sample { Type = SampleType.Normal }); + if ((soundType & LegacySoundType.Finish) > 0) + addSampleBank.Samples.Add(new Sample { Type = SampleType.Finish }); + if ((soundType & LegacySoundType.Whistle) > 0) + addSampleBank.Samples.Add(new Sample { Type = SampleType.Whistle }); + if ((soundType & LegacySoundType.Clap) > 0) + addSampleBank.Samples.Add(new Sample { Type = SampleType.Clap }); + + result.SampleBanks.Add(normalSampleBank); + result.SampleBanks.Add(addSampleBank); return result; } + + private void readCustomSampleBanks(string str, ref SampleBank normalSampleBank, ref SampleBank addSampleBank) + { + if (string.IsNullOrEmpty(str)) + return; + + string[] split = str.Split(':'); + + var sb = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[0]); + var addsb = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[1]); + + int volume = split.Length > 3 ? int.Parse(split[3]) : 0; + + //string sampleFile = split2.Length > 4 ? split2[4] : string.Empty; + + normalSampleBank = new SampleBank + { + Name = sb.ToString().ToLower(), + Volume = volume + }; + + addSampleBank = new SampleBank + { + Name = addsb.ToString().ToLower(), + Volume = volume + }; + } + + [Flags] + private enum LegacySoundType + { + None = 0, + Normal = 1, + Whistle = 2, + Finish = 4, + Clap = 8 + } } } From 5f79df36970949a85e559ad2f396df456cb428c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 19:58:57 +0900 Subject: [PATCH 315/348] Fix lifetimes being set too late. --- osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs | 7 +++---- .../Objects/Drawables/DrawableTaikoHitObject.cs | 4 ---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs index 2ff1f2d9e0..59f8aca867 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableBarLine.cs @@ -56,15 +56,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables Alpha = 0.75f } }; + + LifetimeStart = BarLine.StartTime - BarLine.ScrollTime * 2; + LifetimeEnd = BarLine.StartTime + BarLine.ScrollTime; } protected override void LoadComplete() { base.LoadComplete(); - - LifetimeStart = BarLine.StartTime - BarLine.ScrollTime * 2; - LifetimeEnd = BarLine.StartTime + BarLine.ScrollTime; - Delay(BarLine.StartTime - Time.Current); FadeOut(base_fadeout_time * BarLine.ScrollTime / 1000); } diff --git a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 0c9720b0bb..f15f2bd152 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -54,12 +54,8 @@ namespace osu.Game.Modes.Taiko.Objects.Drawables }); MainPiece.KiaiMode = HitObject.Kiai; - } - protected override void LoadComplete() - { LifetimeStart = HitObject.StartTime - HitObject.ScrollTime * 2; - base.LoadComplete(); } protected override TaikoJudgement CreateJudgement() => new TaikoJudgement(); From 8354fb5eb580f6d7b6605cce5f438eaad0abaeb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 19:59:13 +0900 Subject: [PATCH 316/348] Fix judgements being constructed too late. --- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index ed8269876e..c0b1645b79 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -56,13 +56,17 @@ namespace osu.Game.Modes.Objects.Drawables Sample?.Play(); } - protected override void LoadComplete() + [BackgroundDependencyLoader] + private void load() { - base.LoadComplete(); - //we may be setting a custom judgement in test cases or what not. if (Judgement == null) Judgement = CreateJudgement(); + } + + protected override void LoadComplete() + { + base.LoadComplete(); //force application of the state that was set before we loaded. UpdateState(State); From 863dc44c4d83455f1966f331d54dad49c2d084b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 5 Apr 2017 20:00:22 +0900 Subject: [PATCH 317/348] Some minor improvements. --- osu.Game/Graphics/Backgrounds/Triangles.cs | 22 +++++++++++-------- .../Notifications/NotificationSection.cs | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 8dff614f6c..830d0adc97 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -60,8 +60,8 @@ namespace osu.Game.Graphics.Backgrounds protected override void LoadComplete() { base.LoadComplete(); - for (int i = 0; i < aimTriangleCount; i++) - addTriangle(true); + + addTriangles(true); } private int aimTriangleCount => (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio); @@ -83,8 +83,8 @@ namespace osu.Game.Graphics.Backgrounds t.Expire(); } - while (CreateNewTriangles && Children.Count() < aimTriangleCount) - addTriangle(false); + if (CreateNewTriangles) + addTriangles(false); } protected virtual Triangle CreateTriangle() @@ -113,12 +113,16 @@ namespace osu.Game.Graphics.Backgrounds protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); - private void addTriangle(bool randomY) + private void addTriangles(bool randomY) { - var sprite = CreateTriangle(); - float triangleHeight = sprite.DrawHeight / DrawHeight; - sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1); - Add(sprite); + int addCount = aimTriangleCount - Children.Count(); + for (int i = 0; i < addCount; i++) + { + var sprite = CreateTriangle(); + float triangleHeight = sprite.DrawHeight / DrawHeight; + sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1); + Add(sprite); + } } } } diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 77fc010e6d..663c5cf90c 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Notifications public void MarkAllRead() { - notifications.Children.ForEach(n => n.Read = true); + notifications?.Children.ForEach(n => n.Read = true); } } } \ No newline at end of file From eb82a4c090309a33092b1ce3a3ed9cb99eb48364 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 11:41:16 +0900 Subject: [PATCH 318/348] Back to using SampleInfo + fix taiko beatmap conversion. --- .../Beatmaps/OsuBeatmapConverter.cs | 6 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 19 ---- osu.Game.Modes.Osu/Objects/Slider.cs | 10 ++- .../Beatmaps/TaikoBeatmapConverter.cs | 24 ++--- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 9 +- .../Beatmaps/Formats/OsuLegacyDecoderTest.cs | 5 +- osu.Game/Audio/BeatmapSampleStore.cs | 21 +++++ osu.Game/Audio/SampleInfo.cs | 23 +++++ osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 12 +-- osu.Game/Beatmaps/Samples/Sample.cs | 21 ----- osu.Game/Beatmaps/Samples/SampleBank.cs | 29 ------ osu.Game/Beatmaps/Samples/SampleType.cs | 13 --- osu.Game/Beatmaps/Timing/ControlPoint.cs | 6 +- osu.Game/Database/BeatmapInfo.cs | 1 - .../Objects/Drawables/DrawableHitObject.cs | 24 +++-- osu.Game/Modes/Objects/HitObject.cs | 24 ++--- .../Modes/Objects/LegacyHitObjectParser.cs | 88 ++++++++++++------- osu.Game/osu.Game.csproj | 5 +- 19 files changed, 178 insertions(+), 164 deletions(-) create mode 100644 osu.Game/Audio/BeatmapSampleStore.cs create mode 100644 osu.Game/Audio/SampleInfo.cs delete mode 100644 osu.Game/Beatmaps/Samples/Sample.cs delete mode 100644 osu.Game/Beatmaps/Samples/SampleBank.cs delete mode 100644 osu.Game/Beatmaps/Samples/SampleType.cs diff --git a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs index e0cd66ca94..bae12a98e3 100644 --- a/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs +++ b/osu.Game.Modes.Osu/Beatmaps/OsuBeatmapConverter.cs @@ -43,7 +43,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new Slider { StartTime = original.StartTime, - SampleBanks = original.SampleBanks, + Samples = original.Samples, CurveObject = curveData, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false @@ -55,7 +55,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new Spinner { StartTime = original.StartTime, - SampleBanks = original.SampleBanks, + Samples = original.Samples, Position = new Vector2(512, 384) / 2, EndTime = endTimeData.EndTime }; @@ -64,7 +64,7 @@ namespace osu.Game.Modes.Osu.Beatmaps return new HitCircle { StartTime = original.StartTime, - SampleBanks = original.SampleBanks, + Samples = original.Samples, Position = positionData?.Position ?? Vector2.Zero, NewCombo = comboData?.NewCombo ?? false }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index 596bd2cb9d..be326751ba 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -67,7 +67,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables ComboIndex = s.ComboIndex, Scale = s.Scale, ComboColour = s.ComboColour, - SampleBanks = s.SampleBanks, + Samples = s.Samples, }), }; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index c8fd60c8d6..245809c584 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -2,17 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Allocation; -using osu.Framework.Audio; -using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Judgements; using OpenTK; using OpenTK.Graphics; -using System.Collections.Generic; namespace osu.Game.Modes.Osu.Objects.Drawables { @@ -29,8 +24,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables protected override OsuJudgement CreateJudgement() => new OsuJudgement { MaxScore = OsuScoreResult.SliderTick }; - private List samples = new List(); - public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) { this.sliderTick = sliderTick; @@ -56,18 +49,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables }; } - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - foreach (var bank in HitObject.SampleBanks) - samples.Add(audio.Sample.Get($@"Gameplay/{bank.Name}-slidertick")); - } - - protected override void PlaySamples() - { - samples.ForEach(s => s?.Play()); - } - protected override void CheckJudgement(bool userTriggered) { if (Judgement.TimeOffset >= 0) diff --git a/osu.Game.Modes.Osu/Objects/Slider.cs b/osu.Game.Modes.Osu/Objects/Slider.cs index 49d16ec859..a01c517cb2 100644 --- a/osu.Game.Modes.Osu/Objects/Slider.cs +++ b/osu.Game.Modes.Osu/Objects/Slider.cs @@ -2,13 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Game.Beatmaps.Samples; using osu.Game.Beatmaps.Timing; using osu.Game.Modes.Objects.Types; using System; using System.Collections.Generic; using osu.Game.Modes.Objects; using osu.Game.Database; +using System.Linq; +using osu.Game.Audio; namespace osu.Game.Modes.Osu.Objects { @@ -95,7 +96,12 @@ namespace osu.Game.Modes.Osu.Objects StackHeight = StackHeight, Scale = Scale, ComboColour = ComboColour, - SampleBanks = SampleBanks + Samples = Samples.Select(s => new SampleInfo + { + Bank = s.Bank, + Name = @"slidertick", + Volume = s.Volume + }).ToList() }; } } diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index d0dce85863..5aa3cf5024 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Taiko.Objects; @@ -10,6 +9,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Database; +using osu.Game.Audio; namespace osu.Game.Modes.Taiko.Beatmaps { @@ -57,9 +57,9 @@ namespace osu.Game.Modes.Taiko.Beatmaps var endTimeData = obj as IHasEndTime; // Old osu! used hit sounding to determine various hit type information - List sampleBanks = obj.SampleBanks; + List samples = obj.Samples; - bool strong = sampleBanks.Any(b => b.Samples.Any(s => s.Type == SampleType.Finish)); + bool strong = samples.Any(s => s.Name == @"hitfinish"); if (distanceData != null) { @@ -98,7 +98,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new CentreHit { StartTime = j, - SampleBanks = obj.SampleBanks, + Samples = obj.Samples, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; @@ -109,7 +109,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new DrumRoll { StartTime = obj.StartTime, - SampleBanks = obj.SampleBanks, + Samples = obj.Samples, IsStrong = strong, Distance = distance, TickRate = beatmap.BeatmapInfo.Difficulty.SliderTickRate == 3 ? 3 : 4, @@ -124,7 +124,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps yield return new Swell { StartTime = obj.StartTime, - SampleBanks = obj.SampleBanks, + Samples = obj.Samples, IsStrong = strong, EndTime = endTimeData.EndTime, RequiredHits = (int)Math.Max(1, endTimeData.Duration / 1000 * hitMultiplier), @@ -133,24 +133,24 @@ namespace osu.Game.Modes.Taiko.Beatmaps } else { - bool isCentre = sampleBanks.Any(b => b.Samples.Any(s => s.Type == SampleType.Normal)); + bool isRim = samples.Any(s => s.Name == @"hitclap" || s.Name == @"hitwhistle"); - if (isCentre) + if (isRim) { - yield return new CentreHit + yield return new RimHit { StartTime = obj.StartTime, - SampleBanks = obj.SampleBanks, + Samples = obj.Samples, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; } else { - yield return new RimHit + yield return new CentreHit { StartTime = obj.StartTime, - SampleBanks = obj.SampleBanks, + Samples = obj.Samples, IsStrong = strong, VelocityMultiplier = legacy_velocity_multiplier }; diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 52878fa688..ecd887a4cf 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -1,13 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps.Timing; using osu.Game.Database; +using osu.Game.Audio; namespace osu.Game.Modes.Taiko.Objects { @@ -95,7 +95,12 @@ namespace osu.Game.Modes.Taiko.Objects TickSpacing = tickSpacing, StartTime = t, IsStrong = IsStrong, - SampleBanks = SampleBanks + Samples = Samples.Select(s => new SampleInfo + { + Bank = s.Bank, + Name = @"slidertick", + Volume = s.Volume + }).ToList() }); first = false; diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 27ff942aa7..1832e1b620 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -6,7 +6,6 @@ using NUnit.Framework; using OpenTK; using OpenTK.Graphics; using osu.Game.Beatmaps.Formats; -using osu.Game.Beatmaps.Samples; using osu.Game.Modes; using osu.Game.Tests.Resources; using osu.Game.Modes.Osu; @@ -137,12 +136,12 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(slider); Assert.AreEqual(new Vector2(192, 168), slider.Position); Assert.AreEqual(956, slider.StartTime); - Assert.IsTrue(slider.SampleBanks.Any(b => b.Name == "none")); + Assert.IsTrue(slider.Samples.Any(s => s.Name == @"normal")); var hit = beatmap.HitObjects[1] as LegacyHit; Assert.IsNotNull(hit); Assert.AreEqual(new Vector2(304, 56), hit.Position); Assert.AreEqual(1285, hit.StartTime); - Assert.IsTrue(hit.SampleBanks.Any(b => b.Name == "clap")); + Assert.IsTrue(hit.Samples.Any(s => s.Name == @"clap")); } } } diff --git a/osu.Game/Audio/BeatmapSampleStore.cs b/osu.Game/Audio/BeatmapSampleStore.cs new file mode 100644 index 0000000000..bd72070384 --- /dev/null +++ b/osu.Game/Audio/BeatmapSampleStore.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Audio.Sample; +using osu.Framework.IO.Stores; + +namespace osu.Game.Audio +{ + public class BeatmapSampleStore : NamespacedResourceStore + { + public BeatmapSampleStore(IResourceStore store, string ns) + : base(store, ns) + { + } + + public SampleChannel Get(SampleInfo sampleInfo) + { + return Get($@"{sampleInfo.Bank}-{sampleInfo.Name}"); + } + } +} diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs new file mode 100644 index 0000000000..4357861f89 --- /dev/null +++ b/osu.Game/Audio/SampleInfo.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Audio +{ + public class SampleInfo + { + /// + /// The bank to load the sample from. + /// + public string Bank; + + /// + /// The name of the sample to load. + /// + public string Name; + + /// + /// The sample volume. + /// + public int Volume; + } +} diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 5303a84f0a..5930a99c74 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.IO; using OpenTK.Graphics; using osu.Game.Beatmaps.Events; -using osu.Game.Beatmaps.Samples; using osu.Game.Beatmaps.Timing; using osu.Game.Modes; using osu.Game.Modes.Objects; @@ -247,6 +246,10 @@ namespace osu.Game.Beatmaps.Formats omitFirstBarSignature = (effectFlags & 8) > 0; } + string stringSampleSet = sampleSet.ToString().ToLower(); + if (stringSampleSet == "none") + stringSampleSet = "normal"; + beatmap.TimingInfo.ControlPoints.Add(new ControlPoint { Time = time, @@ -254,11 +257,8 @@ namespace osu.Game.Beatmaps.Formats VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, TimingChange = timingChange, TimeSignature = timeSignature, - SampleBank = new SampleBank - { - Name = sampleSet.ToString().ToLower(), - Volume = sampleVolume - }, + SampleBank = stringSampleSet, + SampleVolume = sampleVolume, KiaiMode = kiaiMode, OmitFirstBarLine = omitFirstBarSignature }); diff --git a/osu.Game/Beatmaps/Samples/Sample.cs b/osu.Game/Beatmaps/Samples/Sample.cs deleted file mode 100644 index d90362bd0b..0000000000 --- a/osu.Game/Beatmaps/Samples/Sample.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Samples -{ - /// - /// A defines a type of sound that is to be played. - /// - public class Sample - { - /// - /// The type of sound to be played. - /// - public SampleType Type; - - /// - /// The volume to be played at. - /// - public int? Volume; - } -} diff --git a/osu.Game/Beatmaps/Samples/SampleBank.cs b/osu.Game/Beatmaps/Samples/SampleBank.cs deleted file mode 100644 index d0464ad4c3..0000000000 --- a/osu.Game/Beatmaps/Samples/SampleBank.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; - -namespace osu.Game.Beatmaps.Samples -{ - /// - /// Wraps a list of to change which bank of files are used for each . - /// - public class SampleBank - { - /// - /// The list of samples that are to be played to be played from this bank. - /// - public List Samples = new List(); - - /// - /// In conversion from osu-stable, this is equivalent to SampleSet (_not_ CustomSampleSet). - /// i.e. None/Normal/Soft/Drum - /// - public string Name; - - /// - /// Default sample volume. - /// - public int Volume; - } -} diff --git a/osu.Game/Beatmaps/Samples/SampleType.cs b/osu.Game/Beatmaps/Samples/SampleType.cs deleted file mode 100644 index 0f4809c1fe..0000000000 --- a/osu.Game/Beatmaps/Samples/SampleType.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Samples -{ - public enum SampleType - { - Normal, - Whistle, - Finish, - Clap - } -} diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index eb965cf678..e79fd8bb31 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps.Samples; - namespace osu.Game.Beatmaps.Timing { public class ControlPoint @@ -13,7 +11,9 @@ namespace osu.Game.Beatmaps.Timing TimingChange = true, }; - public SampleBank SampleBank; + public string SampleBank; + public int SampleVolume; + public TimeSignatures TimeSignature; public double Time; public double BeatLength; diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index e8ec8e500c..93ef8cae4a 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps.Samples; using osu.Game.Modes; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index ca25074d25..602789dcf1 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -7,11 +7,11 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Judgements; using Container = osu.Framework.Graphics.Containers.Container; using osu.Game.Modes.Objects.Types; using OpenTK.Graphics; +using osu.Game.Audio; namespace osu.Game.Modes.Objects.Drawables { @@ -50,6 +50,7 @@ namespace osu.Game.Modes.Objects.Drawables public TObject HitObject; private readonly List samples = new List(); + private AudioManager audio; protected DrawableHitObject(TObject hitObject) { @@ -59,9 +60,10 @@ namespace osu.Game.Modes.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - foreach (var bank in HitObject.SampleBanks) - foreach (var sample in bank.Samples) - samples.Add(audio.Sample.Get($@"Gameplay/{bank.Name}-hit{sample.Type.ToString().ToLower()}")); + this.audio = audio; + + foreach (var sample in HitObject.Samples) + samples.Add(GetSample(sample)); } private ArmedState state; @@ -155,9 +157,21 @@ namespace osu.Game.Modes.Objects.Drawables UpdateJudgement(false); } + protected SampleChannel GetSample(SampleInfo sampleInfo) + { + SampleChannel ret = audio.Sample.Get($@"Gameplay/{sampleInfo.Bank}-{sampleInfo.Name}"); + ret.Volume.Value = sampleInfo.Volume; + + return ret; + } + protected virtual void PlaySamples() { - samples.ForEach(s => s?.Play()); + samples.ForEach(s => + { + + s?.Play(); + }); } private List> nestedHitObjects; diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index 68062cce98..be2ee35915 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Beatmaps.Samples; +using osu.Game.Audio; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using System.Collections.Generic; @@ -22,9 +22,9 @@ namespace osu.Game.Modes.Objects public double StartTime { get; set; } /// - /// The sample banks to be played when this hit object is hit. + /// The samples to be played when this hit object is hit. /// - public List SampleBanks = new List(); + public List Samples = new List(); /// /// Applies default values to this HitObject. @@ -33,17 +33,19 @@ namespace osu.Game.Modes.Objects /// The timing settings to use. public virtual void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { - foreach (var bank in SampleBanks) + ControlPoint overridePoint; + ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); + + foreach (var sample in Samples) { - if (!string.IsNullOrEmpty(bank.Name) && bank.Name != @"none") + if (sample.Volume == 0) + sample.Volume = (overridePoint ?? timingPoint)?.SampleVolume ?? 0; + + // If the bank is not assigned a name, assign it from the control point + if (!string.IsNullOrEmpty(sample.Bank)) continue; - // If the bank is not assigned a name, assign it from the relevant timing point - ControlPoint overridePoint; - ControlPoint timingPoint = timing.TimingPointAt(StartTime, out overridePoint); - - bank.Name = (overridePoint ?? timingPoint)?.SampleBank.Name ?? string.Empty; - bank.Volume = (overridePoint ?? timingPoint)?.SampleBank.Volume ?? 0; + sample.Bank = (overridePoint ?? timingPoint)?.SampleBank ?? string.Empty; } } } diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index bc8d430716..30e0949eb1 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -7,8 +7,8 @@ using System; using System.Collections.Generic; using System.Globalization; using osu.Game.Modes.Objects.Legacy; -using osu.Game.Beatmaps.Samples; using osu.Game.Beatmaps.Formats; +using osu.Game.Audio; namespace osu.Game.Modes.Objects { @@ -21,8 +21,9 @@ namespace osu.Game.Modes.Objects bool combo = type.HasFlag(LegacyHitObjectType.NewCombo); type &= ~LegacyHitObjectType.NewCombo; - var normalSampleBank = new SampleBank(); - var addSampleBank = new SampleBank(); + int sampleVolume = 0; + string normalSampleBank = string.Empty; + string addSampleBank = string.Empty; HitObject result; @@ -35,7 +36,7 @@ namespace osu.Game.Modes.Objects }; if (split.Length > 5) - readCustomSampleBanks(split[5], ref normalSampleBank, ref addSampleBank); + readCustomSampleBanks(split[5], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } else if ((type & LegacyHitObjectType.Slider) > 0) { @@ -93,7 +94,7 @@ namespace osu.Game.Modes.Objects }; if (split.Length > 10) - readCustomSampleBanks(split[10], ref normalSampleBank, ref addSampleBank); + readCustomSampleBanks(split[10], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } else if ((type & LegacyHitObjectType.Spinner) > 0) { @@ -103,11 +104,15 @@ namespace osu.Game.Modes.Objects }; if (split.Length > 6) - readCustomSampleBanks(split[6], ref normalSampleBank, ref addSampleBank); + readCustomSampleBanks(split[6], ref normalSampleBank, ref addSampleBank, ref sampleVolume); } else if ((type & LegacyHitObjectType.Hold) > 0) { // Note: Hold is generated by BMS converts + + // Todo: Apparently end time is determined by samples?? + // Shouldn't be needed until mania + result = new LegacyHold { Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])), @@ -121,45 +126,68 @@ namespace osu.Game.Modes.Objects var soundType = (LegacySoundType)int.Parse(split[4]); - normalSampleBank.Samples.Add(new Sample { Type = SampleType.Normal }); - if ((soundType & LegacySoundType.Finish) > 0) - addSampleBank.Samples.Add(new Sample { Type = SampleType.Finish }); - if ((soundType & LegacySoundType.Whistle) > 0) - addSampleBank.Samples.Add(new Sample { Type = SampleType.Whistle }); - if ((soundType & LegacySoundType.Clap) > 0) - addSampleBank.Samples.Add(new Sample { Type = SampleType.Clap }); + result.Samples.Add(new SampleInfo + { + Bank = normalSampleBank, + Name = "hitnormal", + Volume = sampleVolume + }); - result.SampleBanks.Add(normalSampleBank); - result.SampleBanks.Add(addSampleBank); + if ((soundType & LegacySoundType.Finish) > 0) + { + result.Samples.Add(new SampleInfo + { + Bank = addSampleBank, + Name = "hitfinish", + Volume = sampleVolume + }); + } + + if ((soundType & LegacySoundType.Whistle) > 0) + { + result.Samples.Add(new SampleInfo + { + Bank = addSampleBank, + Name = "hitwhistle", + Volume = sampleVolume + }); + } + + if ((soundType & LegacySoundType.Clap) > 0) + { + result.Samples.Add(new SampleInfo + { + Bank = addSampleBank, + Name = "hitclap", + Volume = sampleVolume + }); + } return result; } - private void readCustomSampleBanks(string str, ref SampleBank normalSampleBank, ref SampleBank addSampleBank) + private void readCustomSampleBanks(string str, ref string normalSampleBank, ref string addSampleBank, ref int sampleVolume) { if (string.IsNullOrEmpty(str)) return; string[] split = str.Split(':'); - var sb = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[0]); - var addsb = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[1]); - - int volume = split.Length > 3 ? int.Parse(split[3]) : 0; + var bank = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[0]); + var addbank = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[1]); //string sampleFile = split2.Length > 4 ? split2[4] : string.Empty; - normalSampleBank = new SampleBank - { - Name = sb.ToString().ToLower(), - Volume = volume - }; + string stringBank = bank.ToString().ToLower(); + if (stringBank == @"none") + stringBank = string.Empty; + string stringAddBank = addbank.ToString().ToLower(); + if (stringAddBank == @"none") + stringAddBank = string.Empty; - addSampleBank = new SampleBank - { - Name = addsb.ToString().ToLower(), - Volume = volume - }; + normalSampleBank = stringBank; + addSampleBank = stringAddBank; + sampleVolume = split.Length > 3 ? int.Parse(split[3]) : 0; } [Flags] diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c8a38bc48e..801e498115 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -71,14 +71,13 @@ + + - - - From c73d6a52ec9c6c1c6b7341577b430a9f6fe42322 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 11:47:54 +0900 Subject: [PATCH 319/348] Add a few comments. --- osu.Game/Modes/Objects/LegacyHitObjectParser.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index 30e0949eb1..952730e256 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -111,7 +111,7 @@ namespace osu.Game.Modes.Objects // Note: Hold is generated by BMS converts // Todo: Apparently end time is determined by samples?? - // Shouldn't be needed until mania + // Shouldn't need implementation until mania result = new LegacyHold { @@ -176,6 +176,7 @@ namespace osu.Game.Modes.Objects var bank = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[0]); var addbank = (OsuLegacyDecoder.LegacySampleBank)Convert.ToInt32(split[1]); + // Let's not implement this for now, because this doesn't fit nicely into the bank structure //string sampleFile = split2.Length > 4 ? split2[4] : string.Empty; string stringBank = bank.ToString().ToLower(); From 5beab4c43db8e0177aa9164428db21ab1274fc04 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 11:48:48 +0900 Subject: [PATCH 320/348] Absolute default bank should be normal. --- osu.Game/Modes/Objects/HitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/Objects/HitObject.cs b/osu.Game/Modes/Objects/HitObject.cs index be2ee35915..f362d6de63 100644 --- a/osu.Game/Modes/Objects/HitObject.cs +++ b/osu.Game/Modes/Objects/HitObject.cs @@ -45,7 +45,7 @@ namespace osu.Game.Modes.Objects if (!string.IsNullOrEmpty(sample.Bank)) continue; - sample.Bank = (overridePoint ?? timingPoint)?.SampleBank ?? string.Empty; + sample.Bank = (overridePoint ?? timingPoint)?.SampleBank ?? @"normal"; } } } From acfcd30cc6b63eede0371acb31e1326e7126a480 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 11:51:04 +0900 Subject: [PATCH 321/348] Simplify lambda. --- osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 602789dcf1..b80f349f46 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -165,13 +165,9 @@ namespace osu.Game.Modes.Objects.Drawables return ret; } - protected virtual void PlaySamples() + protected void PlaySamples() { - samples.ForEach(s => - { - - s?.Play(); - }); + samples.ForEach(s => s?.Play()); } private List> nestedHitObjects; From 2a16eafe8fd2ada03811ddcf4f4be1b3ce1c25a6 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 11:54:05 +0900 Subject: [PATCH 322/348] Fix assertions. --- osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 1832e1b620..6adc523f94 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -136,12 +136,12 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(slider); Assert.AreEqual(new Vector2(192, 168), slider.Position); Assert.AreEqual(956, slider.StartTime); - Assert.IsTrue(slider.Samples.Any(s => s.Name == @"normal")); + Assert.IsTrue(slider.Samples.Any(s => s.Name == @"hitnormal")); var hit = beatmap.HitObjects[1] as LegacyHit; Assert.IsNotNull(hit); Assert.AreEqual(new Vector2(304, 56), hit.Position); Assert.AreEqual(1285, hit.StartTime); - Assert.IsTrue(hit.Samples.Any(s => s.Name == @"clap")); + Assert.IsTrue(hit.Samples.Any(s => s.Name == @"hitclap")); } } } From c65ab5b6f148b78ae60577e8f07689bf34b0bfe9 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 11:54:11 +0900 Subject: [PATCH 323/348] General cleanup. --- osu.Game/Audio/BeatmapSampleStore.cs | 21 ------------------- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 8 ++----- osu.Game/osu.Game.csproj | 1 - 3 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 osu.Game/Audio/BeatmapSampleStore.cs diff --git a/osu.Game/Audio/BeatmapSampleStore.cs b/osu.Game/Audio/BeatmapSampleStore.cs deleted file mode 100644 index bd72070384..0000000000 --- a/osu.Game/Audio/BeatmapSampleStore.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Audio.Sample; -using osu.Framework.IO.Stores; - -namespace osu.Game.Audio -{ - public class BeatmapSampleStore : NamespacedResourceStore - { - public BeatmapSampleStore(IResourceStore store, string ns) - : base(store, ns) - { - } - - public SampleChannel Get(SampleInfo sampleInfo) - { - return Get($@"{sampleInfo.Bank}-{sampleInfo.Name}"); - } - } -} diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 5930a99c74..d3dfddda0f 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -32,7 +32,6 @@ namespace osu.Game.Beatmaps.Formats private LegacySampleBank defaultSampleBank; private int defaultSampleVolume = 100; - private bool samplesMatchPlaybackRate; private readonly int beatmapVersion; @@ -81,9 +80,6 @@ namespace osu.Game.Beatmaps.Formats case @"SampleVolume": defaultSampleVolume = int.Parse(val); break; - case "SamplesMatchPlaybackRate": - samplesMatchPlaybackRate = val[0] == '1'; - break; case @"StackLeniency": beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo); break; @@ -247,8 +243,8 @@ namespace osu.Game.Beatmaps.Formats } string stringSampleSet = sampleSet.ToString().ToLower(); - if (stringSampleSet == "none") - stringSampleSet = "normal"; + if (stringSampleSet == @"none") + stringSampleSet = @"normal"; beatmap.TimingInfo.ControlPoints.Add(new ControlPoint { diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 801e498115..ffa84c36d4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -71,7 +71,6 @@ - From 4cc309e5a76c3f9beccc25a1ded65492672b0eaa Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 12:14:06 +0900 Subject: [PATCH 324/348] Make hit sounds into consts. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 ++-- osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs | 5 +++-- osu.Game/Audio/SampleInfo.cs | 5 +++++ osu.Game/Modes/Objects/LegacyHitObjectParser.cs | 8 ++++---- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 5aa3cf5024..d978774666 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -59,7 +59,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps // Old osu! used hit sounding to determine various hit type information List samples = obj.Samples; - bool strong = samples.Any(s => s.Name == @"hitfinish"); + bool strong = samples.Any(s => s.Name == SampleInfo.HIT_FINISH); if (distanceData != null) { @@ -133,7 +133,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps } else { - bool isRim = samples.Any(s => s.Name == @"hitclap" || s.Name == @"hitwhistle"); + bool isRim = samples.Any(s => s.Name == SampleInfo.HIT_CLAP || s.Name == SampleInfo.HIT_WHISTLE); if (isRim) { diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs index 6adc523f94..8183bc952e 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuLegacyDecoderTest.cs @@ -11,6 +11,7 @@ using osu.Game.Tests.Resources; using osu.Game.Modes.Osu; using osu.Game.Modes.Objects.Legacy; using System.Linq; +using osu.Game.Audio; namespace osu.Game.Tests.Beatmaps.Formats { @@ -136,12 +137,12 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsNotNull(slider); Assert.AreEqual(new Vector2(192, 168), slider.Position); Assert.AreEqual(956, slider.StartTime); - Assert.IsTrue(slider.Samples.Any(s => s.Name == @"hitnormal")); + Assert.IsTrue(slider.Samples.Any(s => s.Name == SampleInfo.HIT_NORMAL)); var hit = beatmap.HitObjects[1] as LegacyHit; Assert.IsNotNull(hit); Assert.AreEqual(new Vector2(304, 56), hit.Position); Assert.AreEqual(1285, hit.StartTime); - Assert.IsTrue(hit.Samples.Any(s => s.Name == @"hitclap")); + Assert.IsTrue(hit.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); } } } diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 4357861f89..171a1bdf75 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -5,6 +5,11 @@ namespace osu.Game.Audio { public class SampleInfo { + public const string HIT_WHISTLE = @"hitwhistle"; + public const string HIT_FINISH = @"hitfinish"; + public const string HIT_NORMAL = @"hitnormal"; + public const string HIT_CLAP = @"hitclap"; + /// /// The bank to load the sample from. /// diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index 952730e256..ae85cd8cf4 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -129,7 +129,7 @@ namespace osu.Game.Modes.Objects result.Samples.Add(new SampleInfo { Bank = normalSampleBank, - Name = "hitnormal", + Name = SampleInfo.HIT_NORMAL, Volume = sampleVolume }); @@ -138,7 +138,7 @@ namespace osu.Game.Modes.Objects result.Samples.Add(new SampleInfo { Bank = addSampleBank, - Name = "hitfinish", + Name = SampleInfo.HIT_FINISH, Volume = sampleVolume }); } @@ -148,7 +148,7 @@ namespace osu.Game.Modes.Objects result.Samples.Add(new SampleInfo { Bank = addSampleBank, - Name = "hitwhistle", + Name = SampleInfo.HIT_WHISTLE, Volume = sampleVolume }); } @@ -158,7 +158,7 @@ namespace osu.Game.Modes.Objects result.Samples.Add(new SampleInfo { Bank = addSampleBank, - Name = "hitclap", + Name = SampleInfo.HIT_CLAP, Volume = sampleVolume }); } From 73e2ddaf265340b19ef7ae0d7479c402c4302ccf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 12:24:17 +0900 Subject: [PATCH 325/348] Revert DrawableHitObject changes, make them less conflicting. --- .../Objects/Drawables/DrawableHitObject.cs | 94 +++++++++---------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index b80f349f46..83f800dfa8 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -15,7 +15,7 @@ using osu.Game.Audio; namespace osu.Game.Modes.Objects.Drawables { - public abstract class DrawableHitObject : Container + public abstract class DrawableHitObject : Container, IStateful where TJudgement : Judgement { public override bool HandleInput => Interactive; @@ -24,47 +24,9 @@ namespace osu.Game.Modes.Objects.Drawables public TJudgement Judgement; - protected override void LoadComplete() - { - base.LoadComplete(); - - // We may be setting a custom judgement in test cases or what not - if (Judgement == null) - Judgement = CreateJudgement(); - } - protected abstract TJudgement CreateJudgement(); - } - public abstract class DrawableHitObject : DrawableHitObject, IStateful - where TObject : HitObject - where TJudgement : Judgement - { - public event Action> OnJudgement; - - /// - /// The colour used for various elements of this DrawableHitObject. - /// - public Color4 AccentColour { get; protected set; } - - public TObject HitObject; - - private readonly List samples = new List(); - private AudioManager audio; - - protected DrawableHitObject(TObject hitObject) - { - HitObject = hitObject; - } - - [BackgroundDependencyLoader] - private void load(AudioManager audio) - { - this.audio = audio; - - foreach (var sample in HitObject.Samples) - samples.Add(GetSample(sample)); - } + protected abstract void UpdateState(ArmedState state); private ArmedState state; public ArmedState State @@ -87,13 +49,43 @@ namespace osu.Game.Modes.Objects.Drawables } } + protected List Samples = new List(); + + protected void PlaySamples() + { + Samples.ForEach(s => s?.Play()); + } + protected override void LoadComplete() { base.LoadComplete(); - // Force application of the state that was set before we loaded + //we may be setting a custom judgement in test cases or what not. + if (Judgement == null) + Judgement = CreateJudgement(); + + //force application of the state that was set before we loaded. UpdateState(State); } + } + + public abstract class DrawableHitObject : DrawableHitObject + where TObject : HitObject + where TJudgement : Judgement + { + public event Action> OnJudgement; + + public TObject HitObject; + + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public Color4 AccentColour { get; protected set; } + + protected DrawableHitObject(TObject hitObject) + { + HitObject = hitObject; + } /// /// Process a hit of this hitobject. Carries out judgement. @@ -157,17 +149,19 @@ namespace osu.Game.Modes.Objects.Drawables UpdateJudgement(false); } - protected SampleChannel GetSample(SampleInfo sampleInfo) + [BackgroundDependencyLoader] + private void load(AudioManager audio) { - SampleChannel ret = audio.Sample.Get($@"Gameplay/{sampleInfo.Bank}-{sampleInfo.Name}"); - ret.Volume.Value = sampleInfo.Volume; + foreach (SampleInfo sample in HitObject.Samples) + { + SampleChannel channel = audio.Sample.Get($@"Gameplay/{sample.Bank}-{sample.Name}"); - return ret; - } + if (channel == null) + continue; - protected void PlaySamples() - { - samples.ForEach(s => s?.Play()); + channel.Volume.Value = sample.Volume; + Samples.Add(channel); + } } private List> nestedHitObjects; @@ -182,7 +176,5 @@ namespace osu.Game.Modes.Objects.Drawables h.OnJudgement += d => OnJudgement?.Invoke(d); nestedHitObjects.Add(h); } - - protected abstract void UpdateState(ArmedState state); } } From 982dbb5bbad72fef0d4130992c94a865164f7d5a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 12:27:35 +0900 Subject: [PATCH 326/348] Cleanup + bow down to resharper. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- osu.Game/Modes/Objects/LegacyHitObjectParser.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index d3dfddda0f..ea91ff9efb 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -358,7 +358,7 @@ namespace osu.Game.Beatmaps.Formats handleColours(beatmap, key, val, ref hasCustomColours); break; case Section.HitObjects: - var obj = parser?.Parse(val); + var obj = parser.Parse(val); if (obj != null) beatmap.HitObjects.Add(obj); diff --git a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs index ae85cd8cf4..2316e5dc5d 100644 --- a/osu.Game/Modes/Objects/LegacyHitObjectParser.cs +++ b/osu.Game/Modes/Objects/LegacyHitObjectParser.cs @@ -22,8 +22,8 @@ namespace osu.Game.Modes.Objects type &= ~LegacyHitObjectType.NewCombo; int sampleVolume = 0; - string normalSampleBank = string.Empty; - string addSampleBank = string.Empty; + string normalSampleBank = null; + string addSampleBank = null; HitObject result; @@ -181,10 +181,10 @@ namespace osu.Game.Modes.Objects string stringBank = bank.ToString().ToLower(); if (stringBank == @"none") - stringBank = string.Empty; + stringBank = null; string stringAddBank = addbank.ToString().ToLower(); if (stringAddBank == @"none") - stringAddBank = string.Empty; + stringAddBank = null; normalSampleBank = stringBank; addSampleBank = stringAddBank; From e299d7286e8131779706f63d4833aa86145dbab4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 12:52:04 +0900 Subject: [PATCH 327/348] Update framework + fix TestCaseTaikoHitObjects. --- osu-framework | 2 +- .../Tests/TestCaseTaikoHitObjects.cs | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/osu-framework b/osu-framework index cd715ac535..a7c99e06ff 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cd715ac535ace224188ac56f88a08c4c2908f51b +Subproject commit a7c99e06ff4c3f56fad24bec170eb93f42b1e149 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index 1590437495..b3cb8c3457 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -81,20 +81,22 @@ namespace osu.Desktop.VisualTests.Tests } }); - Add(new CirclePiece + Add(new ElongatedCirclePiece { Position = new Vector2(575, 100), - Width = 0.25f, AccentColour = Color4.Orange, KiaiMode = kiai, + Length = 0.10f, + PlayfieldLengthReference = () => DrawSize.X }); - Add(new CirclePiece(true) + Add(new ElongatedCirclePiece(true) { Position = new Vector2(575, 300), - Width = 0.25f, AccentColour = Color4.Orange, - KiaiMode = kiai + KiaiMode = kiai, + Length = 0.10f, + PlayfieldLengthReference = () => DrawSize.X }); } From 042aa787a58d0516cd325a9bfb69a39643d966f5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 13:14:52 +0900 Subject: [PATCH 328/348] Fix typo. --- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 731a9a88b3..7375ea2b0d 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -15,7 +15,7 @@ namespace osu.Game.Modes.Taiko.Objects public const float CIRCLE_RADIUS = 42f; /// - /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000>ms. + /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. /// private const double scroll_time = 6000; From c50960af63c736e9cbc8d87d1b4891e678158c0b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 13:15:12 +0900 Subject: [PATCH 329/348] Add better defaults for ControlPoint. --- osu.Game/Beatmaps/Timing/ControlPoint.cs | 12 +++--------- osu.Game/Beatmaps/Timing/TimingInfo.cs | 6 +++--- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/Timing/ControlPoint.cs b/osu.Game/Beatmaps/Timing/ControlPoint.cs index a08bc57ecd..e306796d24 100644 --- a/osu.Game/Beatmaps/Timing/ControlPoint.cs +++ b/osu.Game/Beatmaps/Timing/ControlPoint.cs @@ -5,17 +5,11 @@ namespace osu.Game.Beatmaps.Timing { public class ControlPoint { - public static ControlPoint Default = new ControlPoint - { - BeatLength = 500, - TimingChange = true, - }; - public TimeSignatures TimeSignature; public double Time; - public double BeatLength; - public double SpeedMultiplier; - public bool TimingChange; + public double BeatLength = 500; + public double SpeedMultiplier = 1; + public bool TimingChange = true; public bool KiaiMode; public bool OmitFirstBarLine; diff --git a/osu.Game/Beatmaps/Timing/TimingInfo.cs b/osu.Game/Beatmaps/Timing/TimingInfo.cs index fc4a6ad24c..19cb0816ba 100644 --- a/osu.Game/Beatmaps/Timing/TimingInfo.cs +++ b/osu.Game/Beatmaps/Timing/TimingInfo.cs @@ -10,8 +10,8 @@ namespace osu.Game.Beatmaps.Timing { public readonly List ControlPoints = new List(); - public double BPMMaximum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength; - public double BPMMinimum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? ControlPoint.Default).BeatLength; + public double BPMMaximum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).FirstOrDefault() ?? new ControlPoint()).BeatLength; + public double BPMMinimum => 60000 / (ControlPoints?.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).FirstOrDefault() ?? new ControlPoint()).BeatLength; public double BPMMode => BPMAt(ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); public double BPMAt(double time) @@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps.Timing else break; } - return timingPoint ?? ControlPoint.Default; + return timingPoint ?? new ControlPoint(); } } } \ No newline at end of file From f193af2a2aed6f9ede5705d3e59c8039fc1cfbc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 13:15:21 +0900 Subject: [PATCH 330/348] Add better defaults for BaseDifficulty. --- osu.Game/Database/BaseDifficulty.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Database/BaseDifficulty.cs b/osu.Game/Database/BaseDifficulty.cs index 3db8b29644..7c9f47e7b6 100644 --- a/osu.Game/Database/BaseDifficulty.cs +++ b/osu.Game/Database/BaseDifficulty.cs @@ -9,12 +9,12 @@ namespace osu.Game.Database { [PrimaryKey, AutoIncrement] public int ID { get; set; } - public float DrainRate { get; set; } - public float CircleSize { get; set; } - public float OverallDifficulty { get; set; } - public float ApproachRate { get; set; } - public float SliderMultiplier { get; set; } - public float SliderTickRate { get; set; } + public float DrainRate { get; set; } = 5; + public float CircleSize { get; set; } = 5; + public float OverallDifficulty { get; set; } = 5; + public float ApproachRate { get; set; } = 5; + public float SliderMultiplier { get; set; } = 1; + public float SliderTickRate { get; set; } = 1; /// /// Maps a difficulty value [0, 10] to a two-piece linear range of values. From 18ff8efd468882f44cbe7b7a83960f9e174a7326 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 13:15:33 +0900 Subject: [PATCH 331/348] Mark TODO for BeatmapVersion. --- osu.Game/Database/BeatmapInfo.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index 890623091d..aabe0755fe 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -15,6 +15,7 @@ namespace osu.Game.Database [PrimaryKey, AutoIncrement] public int ID { get; set; } + //TODO: should be in database public int BeatmapVersion; public int? OnlineBeatmapID { get; set; } From d87a65f19e4b5edcdc21e9e71be75b70fcce49dc Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 13:44:43 +0900 Subject: [PATCH 332/348] Fix accuracy calculations. --- osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs | 5 +++-- osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs b/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs index c2c4093b1b..7676ef8c29 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoJudgement.cs @@ -3,6 +3,7 @@ using osu.Game.Modes.Judgements; using osu.Framework.Extensions; +using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Taiko.Judgements { @@ -21,12 +22,12 @@ namespace osu.Game.Modes.Taiko.Judgements /// /// The result value for the combo portion of the score. /// - public int ResultValueForScore => NumericResultForScore(TaikoResult); + public int ResultValueForScore => Result == HitResult.Miss ? 0 : NumericResultForScore(TaikoResult); /// /// The result value for the accuracy portion of the score. /// - public int ResultValueForAccuracy => NumericResultForAccuracy(TaikoResult); + public int ResultValueForAccuracy => Result == HitResult.Miss ? 0 : NumericResultForAccuracy(TaikoResult); /// /// The maximum result value for the combo portion of the score. diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index fa7e18cadb..d215793abe 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -261,7 +261,7 @@ namespace osu.Game.Modes.Taiko.Scoring foreach (var j in Judgements) { scoreForAccuracy += j.ResultValueForAccuracy; - maxScoreForAccuracy = j.MaxResultValueForAccuracy; + maxScoreForAccuracy += j.MaxResultValueForAccuracy; } Accuracy.Value = (double)scoreForAccuracy / maxScoreForAccuracy; From 98630dd06c712199dcdb50610fcf2a112b1f8ef3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 13:46:26 +0900 Subject: [PATCH 333/348] Fix combo calculations. --- .../Scoring/TaikoScoreProcessor.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index d215793abe..1774787247 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -188,8 +188,18 @@ namespace osu.Game.Modes.Taiko.Scoring totalHits++; // Apply combo changes, must be done before the hit score is added - if (!isTick && judgement.Result == HitResult.Hit) - Combo.Value++; + if (!isTick) + { + switch (judgement.Result) + { + case HitResult.Miss: + Combo.Value = 0; + break; + case HitResult.Hit: + Combo.Value++; + break; + } + } // Apply score changes addHitScore(judgement); From 5fa0d9f6f1bd70754c5196e45047c92e93936141 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 13:58:32 +0900 Subject: [PATCH 334/348] Update CodeFileSanity. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0d5878aa77..cc6dfb9c88 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ install: - cmd: git submodule update --init --recursive - cmd: choco install resharper-clt -y - cmd: choco install nvika -y - - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.1/CodeFileSanity.exe + - cmd: appveyor DownloadFile https://github.com/peppy/CodeFileSanity/releases/download/v0.2.2/CodeFileSanity.exe before_build: - cmd: CodeFileSanity.exe - cmd: nuget restore From 2bb99eac72b1eccd96043042a158ab7d796c21de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 14:27:23 +0900 Subject: [PATCH 335/348] fix typo --- osu.Game/Modes/UI/HudOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 263699422c..355b62bc57 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -86,7 +86,7 @@ namespace osu.Game.Modes.UI notificationManager?.Post(new SimpleNotification { - Text = @"The score overlay is currently disabled. You can toogle this by pressing Shift + Tab." + Text = @"The score overlay is currently disabled. You can toggle this by pressing Shift+Tab." }); } } From 37129bf03d1b7fed848f230522862b51d317a8dd Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 14:37:13 +0900 Subject: [PATCH 336/348] Make combo be changed by the base ScoreProcessor. --- .../Judgements/TaikoDrumRollTickJudgement.cs | 2 ++ .../Scoring/TaikoScoreProcessor.cs | 14 -------------- osu.Game/Modes/Judgements/Judgement.cs | 5 +---- osu.Game/Modes/Scoring/ScoreProcessor.cs | 16 ++++++++++++++-- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs b/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs index b6a727aeb4..6ae476b265 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoDrumRollTickJudgement.cs @@ -15,6 +15,8 @@ namespace osu.Game.Modes.Taiko.Judgements /// public override string MaxResultString => string.Empty; + public override bool AffectsCombo => false; + protected override int NumericResultForScore(TaikoHitResult result) { switch (result) diff --git a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs index 1774787247..987c3181a4 100644 --- a/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Modes.Taiko/Scoring/TaikoScoreProcessor.cs @@ -187,20 +187,6 @@ namespace osu.Game.Modes.Taiko.Scoring if (!isTick) totalHits++; - // Apply combo changes, must be done before the hit score is added - if (!isTick) - { - switch (judgement.Result) - { - case HitResult.Miss: - Combo.Value = 0; - break; - case HitResult.Hit: - Combo.Value++; - break; - } - } - // Apply score changes addHitScore(judgement); diff --git a/osu.Game/Modes/Judgements/Judgement.cs b/osu.Game/Modes/Judgements/Judgement.cs index 677ec8bca9..1bf898d25c 100644 --- a/osu.Game/Modes/Judgements/Judgement.cs +++ b/osu.Game/Modes/Judgements/Judgement.cs @@ -17,10 +17,7 @@ namespace osu.Game.Modes.Judgements /// public double TimeOffset; - /// - /// The combo after this judgement was processed. - /// - public int ComboAtHit; + public virtual bool AffectsCombo => true; /// /// The string representation for the result achieved. diff --git a/osu.Game/Modes/Scoring/ScoreProcessor.cs b/osu.Game/Modes/Scoring/ScoreProcessor.cs index a64b4d4013..ba845b84dc 100644 --- a/osu.Game/Modes/Scoring/ScoreProcessor.cs +++ b/osu.Game/Modes/Scoring/ScoreProcessor.cs @@ -8,6 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Modes.Judgements; using osu.Game.Modes.Objects; using osu.Game.Modes.UI; +using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Scoring { @@ -145,10 +146,21 @@ namespace osu.Game.Modes.Scoring if (!exists) { + if (judgement.AffectsCombo) + { + switch (judgement.Result) + { + case HitResult.Miss: + Combo.Value = 0; + break; + case HitResult.Hit: + Combo.Value++; + break; + } + } + Judgements.Add(judgement); OnNewJudgement(judgement); - - judgement.ComboAtHit = Combo.Value; } else OnJudgementChanged(judgement); From 856696b17e3cdad2faea5dc2dc3c80e2714df671 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 15:31:21 +0900 Subject: [PATCH 337/348] Fix incorrect verbatim strings. --- osu.Game/Screens/Play/FailOverlay.cs | 4 ++-- osu.Game/Screens/Play/PauseOverlay.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 0726536ddd..566f8d9cc1 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -30,8 +30,8 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuColour colours) { - AddButton(@"Retry", colours.YellowDark, OnRetry); - AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); + AddButton("Retry", colours.YellowDark, OnRetry); + AddButton("Quit", new Color4(170, 27, 39, 255), OnQuit); } } } diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 061b91d289..1a5ecbe92f 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -33,9 +33,9 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuColour colours) { - AddButton(@"Continue", colours.Green, OnResume); - AddButton(@"Retry", colours.YellowDark, OnRetry); - AddButton(@"Quit to Main Menu", new Color4(170, 27, 39, 255), OnQuit); + AddButton("Continue", colours.Green, OnResume); + AddButton("Retry", colours.YellowDark, OnRetry); + AddButton("Quit", new Color4(170, 27, 39, 255), OnQuit); } } } From a18367454d0791641138d3653b96d4cdaf73648b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 15:34:52 +0900 Subject: [PATCH 338/348] InGameOverlay -> MenuOverlay. --- osu.Game/Screens/Play/FailOverlay.cs | 2 +- .../Play/{InGameOverlay.cs => MenuOverlay.cs} | 4 +- osu.Game/Screens/Play/PauseOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 39 ++++++++----------- osu.Game/osu.Game.csproj | 2 +- 5 files changed, 22 insertions(+), 27 deletions(-) rename osu.Game/Screens/Play/{InGameOverlay.cs => MenuOverlay.cs} (96%) diff --git a/osu.Game/Screens/Play/FailOverlay.cs b/osu.Game/Screens/Play/FailOverlay.cs index 566f8d9cc1..7a32e19338 100644 --- a/osu.Game/Screens/Play/FailOverlay.cs +++ b/osu.Game/Screens/Play/FailOverlay.cs @@ -10,7 +10,7 @@ using osu.Framework.Allocation; namespace osu.Game.Screens.Play { - public class FailOverlay : InGameOverlay + public class FailOverlay : MenuOverlay { public override string Header => "failed"; diff --git a/osu.Game/Screens/Play/InGameOverlay.cs b/osu.Game/Screens/Play/MenuOverlay.cs similarity index 96% rename from osu.Game/Screens/Play/InGameOverlay.cs rename to osu.Game/Screens/Play/MenuOverlay.cs index d35fe28f3e..ede49065a7 100644 --- a/osu.Game/Screens/Play/InGameOverlay.cs +++ b/osu.Game/Screens/Play/MenuOverlay.cs @@ -16,7 +16,7 @@ using osu.Framework.Allocation; namespace osu.Game.Screens.Play { - public abstract class InGameOverlay : OverlayContainer + public abstract class MenuOverlay : OverlayContainer { private const int transition_duration = 200; private const int button_height = 70; @@ -185,7 +185,7 @@ namespace osu.Game.Screens.Play Retries = 0; } - protected InGameOverlay() + protected MenuOverlay() { AlwaysReceiveInput = true; RelativeSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs index 1a5ecbe92f..f9706d263e 100644 --- a/osu.Game/Screens/Play/PauseOverlay.cs +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -11,7 +11,7 @@ using osu.Framework.Allocation; namespace osu.Game.Screens.Play { - public class PauseOverlay : InGameOverlay + public class PauseOverlay : MenuOverlay { public Action OnResume; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a854e05150..5868f86215 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -119,26 +119,6 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); - pauseOverlay = new PauseOverlay - { - Depth = -1, - OnResume = delegate - { - Delay(400); - Schedule(Resume); - }, - OnRetry = Restart, - OnQuit = Exit, - }; - - failOverlay = new FailOverlay - { - Depth = -1, - OnRetry = Restart, - OnQuit = Exit, - }; - - hudOverlay.BindHitRenderer(HitRenderer); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) @@ -163,8 +143,23 @@ namespace osu.Game.Screens.Play } }, hudOverlay, - pauseOverlay, - failOverlay + pauseOverlay = new PauseOverlay + { + Depth = -1, + OnResume = delegate + { + Delay(400); + Schedule(Resume); + }, + OnRetry = Restart, + OnQuit = Exit, + }, + failOverlay = new FailOverlay + { + Depth = -1, + OnRetry = Restart, + OnQuit = Exit, + } }; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6113aa3d14..ec0a4b4c39 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -199,7 +199,7 @@ - + From 7c63c8394b3e3b971f4ed6953f019cfdb7b37784 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 15:36:03 +0900 Subject: [PATCH 339/348] Remove unnecessary depth setting. --- osu.Game/Screens/Play/Player.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5868f86215..d645c0c1f3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -118,7 +118,6 @@ namespace osu.Game.Screens.Play hudOverlay = new StandardHudOverlay(); hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor); - hudOverlay.BindHitRenderer(HitRenderer); //bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) @@ -145,7 +144,6 @@ namespace osu.Game.Screens.Play hudOverlay, pauseOverlay = new PauseOverlay { - Depth = -1, OnResume = delegate { Delay(400); @@ -156,7 +154,6 @@ namespace osu.Game.Screens.Play }, failOverlay = new FailOverlay { - Depth = -1, OnRetry = Restart, OnQuit = Exit, } From cec8bca78ad67fa8850168e1949b3cfc624ec8f2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 15:54:50 +0900 Subject: [PATCH 340/348] Implement IJsonSerializable, BeatmapInfo IJsonSerializable. --- osu.Game/Database/BeatmapInfo.cs | 20 ++++++------- .../IO/Serialization/IJsonSerializable.cs | 29 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 osu.Game/IO/Serialization/IJsonSerializable.cs diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index aabe0755fe..b9ec0c69af 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -1,7 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using Newtonsoft.Json; using osu.Game.Beatmaps.Samples; +using osu.Game.IO.Serialization; using osu.Game.Modes; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; @@ -10,7 +12,7 @@ using System.Linq; namespace osu.Game.Database { - public class BeatmapInfo : IEquatable + public class BeatmapInfo : IEquatable, IJsonSerializable { [PrimaryKey, AutoIncrement] public int ID { get; set; } @@ -57,17 +59,13 @@ namespace osu.Game.Database // Editor // This bookmarks stuff is necessary because DB doesn't know how to store int[] public string StoredBookmarks { get; internal set; } + [Ignore] + [JsonIgnore] public int[] Bookmarks { - get - { - return StoredBookmarks.Split(',').Select(int.Parse).ToArray(); - } - set - { - StoredBookmarks = string.Join(",", value); - } + get { return StoredBookmarks.Split(',').Select(int.Parse).ToArray(); } + set { StoredBookmarks = string.Join(",", value); } } public double DistanceSpacing { get; set; } @@ -86,7 +84,7 @@ namespace osu.Game.Database } public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && - BeatmapSet.Path == other.BeatmapSet.Path && - (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; + BeatmapSet.Path == other.BeatmapSet.Path && + (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; } } diff --git a/osu.Game/IO/Serialization/IJsonSerializable.cs b/osu.Game/IO/Serialization/IJsonSerializable.cs new file mode 100644 index 0000000000..33d0801e47 --- /dev/null +++ b/osu.Game/IO/Serialization/IJsonSerializable.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using Newtonsoft.Json; + +namespace osu.Game.IO.Serialization +{ + public interface IJsonSerializable + { + } + + public static class JsonSerializableExtensions + { + public static string Serialize(this IJsonSerializable obj) + { + return JsonConvert.SerializeObject(obj); + } + + public static T Deserialize(string objString) + { + return JsonConvert.DeserializeObject(objString); + } + + public static T DeepClone(this IJsonSerializable obj) + { + return Deserialize(Serialize(obj)); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a9e8dfb5bb..b2d8aedb7f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -97,6 +97,7 @@ + From 1942ef9e8f09ebbecfeb51a55ea1d143595942d6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 6 Apr 2017 16:06:02 +0900 Subject: [PATCH 341/348] Fix merge fail. --- osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index ea91ff9efb..35d81311d2 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -250,7 +250,7 @@ namespace osu.Game.Beatmaps.Formats { Time = time, BeatLength = beatLength, - VelocityAdjustment = beatLength < 0 ? -beatLength / 100.0 : 1, + SpeedMultiplier = beatLength < 0 ? -beatLength / 100.0 : 1, TimingChange = timingChange, TimeSignature = timeSignature, SampleBank = stringSampleSet, From bc216f647085a677dec9e6adb39fac5b4de53854 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 15:55:08 +0900 Subject: [PATCH 342/348] Legacy multiplier only needs to be applied to SliderMultiplier. --- .../Beatmaps/TaikoBeatmapConverter.cs | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 4e16623199..4828d80339 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -9,9 +9,8 @@ using osu.Game.Modes.Taiko.Objects; using System; using System.Collections.Generic; using System.Linq; -using osu.Game.Beatmaps.Legacy; -using osu.Game.Beatmaps.Timing; using osu.Game.Database; +using osu.Game.IO.Serialization; namespace osu.Game.Modes.Taiko.Beatmaps { @@ -41,9 +40,12 @@ namespace osu.Game.Modes.Taiko.Beatmaps public Beatmap Convert(Beatmap original) { + BeatmapInfo info = original.BeatmapInfo.DeepClone(); + info.Difficulty.SliderMultiplier *= legacy_velocity_multiplier; + return new Beatmap(original) { - TimingInfo = original is LegacyBeatmap ? new LegacyTimingInfo(original.TimingInfo) : original.TimingInfo, + BeatmapInfo = info, HitObjects = original.HitObjects.SelectMany(h => convertHitObject(h, original)).ToList() }; } @@ -75,7 +77,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps double distance = distanceData.Distance * repeats * legacy_velocity_multiplier; // The velocity of the taiko hit object - calculated as the velocity of a drum roll - double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier; + double taikoVelocity = taiko_base_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength; // The duration of the taiko hit object double taikoDuration = distance / taikoVelocity; @@ -85,7 +87,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps speedAdjustedBeatLength /= speedAdjustment; // The velocity of the osu! hit object - calculated as the velocity of a slider - double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier / speedAdjustedBeatLength * legacy_velocity_multiplier; + double osuVelocity = osu_base_scoring_distance * beatmap.BeatmapInfo.Difficulty.SliderMultiplier * legacy_velocity_multiplier / speedAdjustedBeatLength; // The duration of the osu! hit object double osuDuration = distance / osuVelocity; @@ -155,21 +157,5 @@ namespace osu.Game.Modes.Taiko.Beatmaps } } } - - private class LegacyTimingInfo : TimingInfo - { - public LegacyTimingInfo(TimingInfo original) - { - if (original is LegacyTimingInfo) - ControlPoints.AddRange(original.ControlPoints); - else - { - ControlPoints.AddRange(original.ControlPoints.Select(c => c.Clone())); - - foreach (var c in ControlPoints) - c.SpeedMultiplier *= legacy_velocity_multiplier; - } - } - } } } From 9260d1c24ddefe09992a39fd74ba6a9eec2f928d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 16:21:18 +0900 Subject: [PATCH 343/348] Fix incorrect scroll time calculation. --- osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 7375ea2b0d..54ab8c5300 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -39,7 +39,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) / 1000) / (difficulty.SliderMultiplier * timing.SpeedMultiplierAt(StartTime)); + ScrollTime = scroll_time * (timing.BeatLengthAt(StartTime) * timing.SpeedMultiplierAt(StartTime) / 1000) / difficulty.SliderMultiplier; ControlPoint overridePoint; Kiai = timing.TimingPointAt(StartTime, out overridePoint).KiaiMode; From 010777273723c612decd23380a570f68bc7c8d10 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 6 Apr 2017 16:25:46 +0900 Subject: [PATCH 344/348] Fix using. --- osu.Game/Database/BeatmapInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index dbc975bd74..bc6e077633 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using Newtonsoft.Json; -using osu.Game.Beatmaps.Samples; using osu.Game.IO.Serialization; using osu.Game.Modes; using SQLite.Net.Attributes; From 9b1e010dcc0e33c5dad70d009b4643d08151e653 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 6 Apr 2017 16:05:41 +0800 Subject: [PATCH 345/348] Fix filename mismatch. --- .../{IBeatmapCoverter.cs => IBeatmapConverter.cs} | 0 .../{BaseDifficulty.cs => BeatmapDifficulty.cs} | 0 ...abControlCheckBox.cs => OsuTabControlCheckbox.cs} | 0 ...PopupDialogOKButton.cs => PopupDialogOkButton.cs} | 0 osu.Game/Screens/{OsuGameScreen.cs => OsuScreen.cs} | 0 .../{GameScreenWhiteBox.cs => ScreenWhiteBox.cs} | 0 osu.Game/osu.Game.csproj | 12 ++++++------ 7 files changed, 6 insertions(+), 6 deletions(-) rename osu.Game/Beatmaps/{IBeatmapCoverter.cs => IBeatmapConverter.cs} (100%) rename osu.Game/Database/{BaseDifficulty.cs => BeatmapDifficulty.cs} (100%) rename osu.Game/Graphics/UserInterface/{OsuTabControlCheckBox.cs => OsuTabControlCheckbox.cs} (100%) rename osu.Game/Overlays/Dialog/{PopupDialogOKButton.cs => PopupDialogOkButton.cs} (100%) rename osu.Game/Screens/{OsuGameScreen.cs => OsuScreen.cs} (100%) rename osu.Game/Screens/{GameScreenWhiteBox.cs => ScreenWhiteBox.cs} (100%) diff --git a/osu.Game/Beatmaps/IBeatmapCoverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs similarity index 100% rename from osu.Game/Beatmaps/IBeatmapCoverter.cs rename to osu.Game/Beatmaps/IBeatmapConverter.cs diff --git a/osu.Game/Database/BaseDifficulty.cs b/osu.Game/Database/BeatmapDifficulty.cs similarity index 100% rename from osu.Game/Database/BaseDifficulty.cs rename to osu.Game/Database/BeatmapDifficulty.cs diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs similarity index 100% rename from osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs rename to osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs diff --git a/osu.Game/Overlays/Dialog/PopupDialogOKButton.cs b/osu.Game/Overlays/Dialog/PopupDialogOkButton.cs similarity index 100% rename from osu.Game/Overlays/Dialog/PopupDialogOKButton.cs rename to osu.Game/Overlays/Dialog/PopupDialogOkButton.cs diff --git a/osu.Game/Screens/OsuGameScreen.cs b/osu.Game/Screens/OsuScreen.cs similarity index 100% rename from osu.Game/Screens/OsuGameScreen.cs rename to osu.Game/Screens/OsuScreen.cs diff --git a/osu.Game/Screens/GameScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs similarity index 100% rename from osu.Game/Screens/GameScreenWhiteBox.cs rename to osu.Game/Screens/ScreenWhiteBox.cs diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1577ed2229..6dd5ec3088 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -74,7 +74,7 @@ - + @@ -180,7 +180,7 @@ - + @@ -208,7 +208,7 @@ - + @@ -282,7 +282,7 @@ - + @@ -346,7 +346,7 @@ - + @@ -363,7 +363,7 @@ - + From 411988f038b63a3c8fa42971f26f8e04a7470fa2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 6 Apr 2017 16:21:18 +0800 Subject: [PATCH 346/348] Remove all trailing whitespaces in this repo. --- osu.Desktop.Deploy/Properties/AssemblyInfo.cs | 10 +++++----- osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs | 2 +- osu.Desktop.VisualTests/Platform/TestStorage.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 2 +- osu.Desktop/Properties/AssemblyInfo.cs | 6 +++--- osu.Game.Modes.Catch/Properties/AssemblyInfo.cs | 10 +++++----- osu.Game.Modes.Mania/Properties/AssemblyInfo.cs | 10 +++++----- .../Objects/Drawables/Connections/FollowPoint.cs | 2 +- .../Objects/Drawables/DrawableSliderTick.cs | 2 +- osu.Game.Modes.Osu/Properties/AssemblyInfo.cs | 10 +++++----- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 2 +- osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs | 10 +++++----- osu.Game.Modes.Taiko/UI/HitTarget.cs | 2 +- osu.Game.Modes.Taiko/UI/InputDrum.cs | 2 +- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 6 +++--- osu.Game/Configuration/OsuConfigManager.cs | 2 +- osu.Game/Database/ScoreDatabase.cs | 2 +- osu.Game/Graphics/Containers/ParallaxContainer.cs | 4 ++-- osu.Game/Modes/Objects/BezierApproximator.cs | 2 +- osu.Game/Modes/Objects/CircularArcApproximator.cs | 2 +- osu.Game/Modes/UI/ModIcon.cs | 4 ++-- osu.Game/Overlays/Options/OptionsSection.cs | 2 +- .../Options/Sections/General/LanguageOptions.cs | 2 +- .../Sections/Graphics/SongSelectGraphicsOptions.cs | 2 +- .../Options/Sections/Online/NotificationsOptions.cs | 2 +- .../Overlays/Options/Sections/Online/PrivacyOptions.cs | 2 +- osu.Game/Overlays/Options/Sections/SkinSection.cs | 2 +- osu.Game/Overlays/Options/Sidebar.cs | 4 ++-- osu.Game/Overlays/OptionsOverlay.cs | 4 ++-- osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs | 2 +- osu.Game/Properties/AssemblyInfo.cs | 10 +++++----- osu.Game/Screens/Select/BeatmapDetailArea.cs | 2 +- 34 files changed, 66 insertions(+), 66 deletions(-) diff --git a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs index 8df81400c1..5841c1b082 100644 --- a/osu.Desktop.Deploy/Properties/AssemblyInfo.cs +++ b/osu.Desktop.Deploy/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu.Desktop.Deploy")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,11 +27,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs index f135a6affa..5e3f5b5133 100644 --- a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs @@ -16,7 +16,7 @@ namespace osu.Desktop.VisualTests.Beatmaps } private readonly Beatmap beatmap; - + protected override Beatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; protected override Track GetTrack() => null; diff --git a/osu.Desktop.VisualTests/Platform/TestStorage.cs b/osu.Desktop.VisualTests/Platform/TestStorage.cs index c5502d5d5d..f711ddac24 100644 --- a/osu.Desktop.VisualTests/Platform/TestStorage.cs +++ b/osu.Desktop.VisualTests/Platform/TestStorage.cs @@ -15,7 +15,7 @@ namespace osu.Desktop.VisualTests.Platform public TestStorage(string baseName) : base(baseName) { } - + public override SQLiteConnection GetDatabase(string name) { ISQLitePlatform platform; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index d0a35b7b3e..88a037afee 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -106,7 +106,7 @@ namespace osu.Desktop.VisualTests.Tests ScrollTime = scroll_time })); } - + private void addDrumRoll(bool strong, double duration = default_duration) { addBarLine(true); diff --git a/osu.Desktop/Properties/AssemblyInfo.cs b/osu.Desktop/Properties/AssemblyInfo.cs index eacfc996d5..fe7ad20124 100644 --- a/osu.Desktop/Properties/AssemblyInfo.cs +++ b/osu.Desktop/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu!lazer")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] diff --git a/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs b/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs index 07a088e1e9..1d25411e73 100644 --- a/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Catch/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu.Game.Modes.Catch")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,11 +27,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs b/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs index 6cfa3c42b3..11c8290f1b 100644 --- a/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Mania/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu.Game.Modes.Mania")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,11 +27,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs index efbd5b291a..7815e3ba41 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Connections/FollowPoint.cs @@ -32,7 +32,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Connections Colour = Color4.White.Opacity(0.2f), Radius = 4, }; - + Children = new Drawable[] { new Box diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index 245809c584..188306c857 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -57,7 +57,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables Judgement.Score = Tracking ? OsuScoreResult.SliderTick : OsuScoreResult.Miss; } } - + protected override void UpdatePreemptState() { var animIn = Math.Min(150, sliderTick.StartTime - FadeInTime); diff --git a/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs b/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs index 61e6ae6f7a..791c9b594d 100644 --- a/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Osu/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu.Game.Mode.Osu")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,11 +27,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 898ace935e..aee06ad796 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -72,7 +72,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps double speedAdjustment = beatmap.TimingInfo.SpeedMultiplierAt(obj.StartTime); double speedAdjustedBeatLength = beatmap.TimingInfo.BeatLengthAt(obj.StartTime) * speedAdjustment; - + // The true distance, accounting for any repeats. This ends up being the drum roll distance later double distance = distanceData.Distance * repeats * legacy_velocity_multiplier; diff --git a/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs b/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs index 61eca30b5f..94ec895707 100644 --- a/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs +++ b/osu.Game.Modes.Taiko/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu.Game.Modes.Taiko")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,11 +27,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index 27562cd916..a17480628d 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -19,7 +19,7 @@ namespace osu.Game.Modes.Taiko.UI /// Diameter of normal hit object circles. /// private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2; - + /// /// Diameter of strong hit object circles. /// diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 5eea08ad8b..0c1e1105cb 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -60,7 +60,7 @@ namespace osu.Game.Modes.Taiko.UI /// The key to be used for the rim of the half-drum. /// public Key RimKey; - + /// /// The key to be used for the centre of the half-drum. /// diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 39fb1bfa8a..5d15b43761 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -97,7 +97,7 @@ namespace osu.Game.Tests.Beatmaps.IO ensureLoaded(osu); Assert.IsTrue(File.Exists(temp)); - + File.Delete(temp); Assert.IsFalse(File.Exists(temp)); diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index ac0ab9966f..8c1378cae4 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps.Drawables GainedSelection = headerGainedSelection, RelativeSizeAxes = Axes.X, }; - + BeatmapSet.Beatmaps = BeatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList(); BeatmapPanels = BeatmapSet.Beatmaps.Select(b => new BeatmapPanel(b) { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 74c8866596..5bea1d0986 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -40,7 +40,7 @@ namespace osu.Game.Beatmaps protected abstract Beatmap GetBeatmap(); protected abstract Texture GetBackground(); protected abstract Track GetTrack(); - + private Beatmap beatmap; private readonly object beatmapLock = new object(); public Beatmap Beatmap @@ -53,7 +53,7 @@ namespace osu.Game.Beatmaps } } } - + private readonly object backgroundLock = new object(); private Texture background; public Texture Background @@ -87,7 +87,7 @@ namespace osu.Game.Beatmaps if (track != null && BeatmapInfo.AudioEquals(other.BeatmapInfo)) other.track = track; } - + public virtual void Dispose() { track?.Dispose(); diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 9a2cda2d80..377fc8c0ee 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -13,7 +13,7 @@ namespace osu.Game.Configuration protected override void InitialiseDefaults() { #pragma warning disable CS0612 // Type or member is obsolete - + Set(OsuConfig.Username, string.Empty); Set(OsuConfig.Token, string.Empty); diff --git a/osu.Game/Database/ScoreDatabase.cs b/osu.Game/Database/ScoreDatabase.cs index 5ce3ff273e..642bb4aff6 100644 --- a/osu.Game/Database/ScoreDatabase.cs +++ b/osu.Game/Database/ScoreDatabase.cs @@ -104,7 +104,7 @@ namespace osu.Game.Database score.Replay = score.CreateReplay(reader); } } - + return score; } } diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index a143618807..8352656f8e 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -56,8 +56,8 @@ namespace osu.Game.Graphics.Containers { base.Update(); - if (parallaxEnabled) - { + if (parallaxEnabled) + { Vector2 offset = input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2; content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); content.Scale = new Vector2(1 + ParallaxAmount); diff --git a/osu.Game/Modes/Objects/BezierApproximator.cs b/osu.Game/Modes/Objects/BezierApproximator.cs index ee8e9b0e06..6688e6b2ce 100644 --- a/osu.Game/Modes/Objects/BezierApproximator.cs +++ b/osu.Game/Modes/Objects/BezierApproximator.cs @@ -109,7 +109,7 @@ namespace osu.Game.Modes.Objects // "toFlatten" contains all the curves which are not yet approximated well enough. // We use a stack to emulate recursion without the risk of running into a stack overflow. - // (More specifically, we iteratively and adaptively refine our curve with a + // (More specifically, we iteratively and adaptively refine our curve with a // Depth-first search // over the tree resulting from the subdivisions we make.) toFlatten.Push(controlPoints.ToArray()); diff --git a/osu.Game/Modes/Objects/CircularArcApproximator.cs b/osu.Game/Modes/Objects/CircularArcApproximator.cs index 310b923b0b..73db5fab29 100644 --- a/osu.Game/Modes/Objects/CircularArcApproximator.cs +++ b/osu.Game/Modes/Objects/CircularArcApproximator.cs @@ -66,7 +66,7 @@ namespace osu.Game.Modes.Objects double dir = 1; double thetaRange = thetaEnd - thetaStart; - // Decide in which direction to draw the circle, depending on which side of + // Decide in which direction to draw the circle, depending on which side of // AC B lies. Vector2 orthoAtoC = c - a; orthoAtoC = new Vector2(orthoAtoC.Y, -orthoAtoC.X); diff --git a/osu.Game/Modes/UI/ModIcon.cs b/osu.Game/Modes/UI/ModIcon.cs index 35459985c9..1e0aa89a41 100644 --- a/osu.Game/Modes/UI/ModIcon.cs +++ b/osu.Game/Modes/UI/ModIcon.cs @@ -26,7 +26,7 @@ namespace osu.Game.Modes.UI reapplySize(); } } - + public new Color4 Colour { get @@ -38,7 +38,7 @@ namespace osu.Game.Modes.UI background.Colour = value; } } - + public FontAwesome Icon { get diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 777a4fe703..d5dafad9ba 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Options }, }); } - + [BackgroundDependencyLoader] private void load(OsuColour colours) { diff --git a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs index dc29b56f44..98b67342cb 100644 --- a/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs +++ b/osu.Game/Overlays/Options/Sections/General/LanguageOptions.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Options.Sections.General public class LanguageOptions : OptionsSubsection { protected override string Header => "Language"; - + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { diff --git a/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs b/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs index d4855a1619..cbaeebcee3 100644 --- a/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Graphics/SongSelectGraphicsOptions.cs @@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Options.Sections.Graphics public class SongSelectGraphicsOptions : OptionsSubsection { protected override string Header => "Song Select"; - + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { diff --git a/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs b/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs index 4614210e9f..350121db16 100644 --- a/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Online/NotificationsOptions.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Options.Sections.Online public class NotificationsOptions : OptionsSubsection { protected override string Header => "Notifications"; - + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { diff --git a/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs b/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs index fb2adbb2ac..5c4d4c3502 100644 --- a/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Online/PrivacyOptions.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Options.Sections.Online public class PrivacyOptions : OptionsSubsection { protected override string Header => "Privacy"; - + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { diff --git a/osu.Game/Overlays/Options/Sections/SkinSection.cs b/osu.Game/Overlays/Options/Sections/SkinSection.cs index 0ee561c1ad..78f4f1e380 100644 --- a/osu.Game/Overlays/Options/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Options/Sections/SkinSection.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options.Sections { public override string Header => "Skin"; public override FontAwesome Icon => FontAwesome.fa_paint_brush; - + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index 5d0eac1cc1..eb489810ad 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Options } private ScheduledDelegate expandEvent; - + protected override bool OnHover(InputState state) { expandEvent = Scheduler.AddDelayed(() => @@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Options }, 750); return true; } - + protected override void OnHoverLost(InputState state) { expandEvent?.Cancel(); diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index ee20cea969..0c66cb5881 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays public const float SIDEBAR_WIDTH = Sidebar.DEFAULT_WIDTH; private const float width = 400; - + private const float sidebar_padding = 10; private ScrollContainer scrollContainer; @@ -118,7 +118,7 @@ namespace osu.Game.Overlays ).ToArray() } }; - + scrollContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 }; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index d20564bd03..e117089166 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Toolbar private ToolbarModeButton activeButton; public Action OnPlayModeChange; - + public ToolbarModeSelector() { RelativeSizeAxes = Axes.Y; diff --git a/osu.Game/Properties/AssemblyInfo.cs b/osu.Game/Properties/AssemblyInfo.cs index f6bbc91854..4cc9549567 100644 --- a/osu.Game/Properties/AssemblyInfo.cs +++ b/osu.Game/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("osu!main")] @@ -16,8 +16,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] @@ -27,11 +27,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 21e4d643f2..dae909f2b7 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Select new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, - OnFilter = (tab, mods) => + OnFilter = (tab, mods) => { switch (tab) { From ff469ee5f657c6f04400851c2965a0b31b1dc4bf Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 6 Apr 2017 16:56:27 +0800 Subject: [PATCH 347/348] Update resources for CodeFileSanity. --- osu-resources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-resources b/osu-resources index 0d6dc29473..0cba3cbc16 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 0d6dc294738d433999c6c68ff61169d3a8e6ce5f +Subproject commit 0cba3cbc167cfe94e07fe5b629c925e190be939e From c6f4cff2e7e6833063363a3b95cab7fcd7c5452e Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Thu, 6 Apr 2017 12:27:45 +0300 Subject: [PATCH 348/348] Fix Pause/Fail testcase --- ...ameOverlays.cs => TestCaseMenuOverlays.cs} | 20 +++++++------------ .../osu.Desktop.VisualTests.csproj | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) rename osu.Desktop.VisualTests/Tests/{TestCaseInGameOverlays.cs => TestCaseMenuOverlays.cs} (82%) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs similarity index 82% rename from osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs rename to osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs index ca59c9faeb..acf98ea86b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseInGameOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs @@ -8,7 +8,7 @@ using osu.Game.Screens.Play; namespace osu.Desktop.VisualTests.Tests { - internal class TestCaseInGameOverlays : TestCase + internal class TestCaseMenuOverlays : TestCase { public override string Description => @"Tests pause and fail overlays"; @@ -20,23 +20,19 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - pauseOverlay = new PauseOverlay + retryCount = 0; + + Add(pauseOverlay = new PauseOverlay { - Depth = -1, OnResume = () => Logger.Log(@"Resume"), OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), - }; - - failOverlay = new FailOverlay + }); + Add(failOverlay = new FailOverlay { - Depth = -1, OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit"), - }; - - Add(pauseOverlay); - Add(failOverlay); + }); AddStep(@"Pause", delegate { if(failOverlay.State == Visibility.Visible) @@ -58,8 +54,6 @@ namespace osu.Desktop.VisualTests.Tests pauseOverlay.Retries = retryCount; failOverlay.Retries = retryCount; }); - - retryCount = 0; } } } diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index ea83b0d71a..da068c5557 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -189,7 +189,7 @@ - +