From 12de3f6657a277550ff07a36d4b5f9bfb907c881 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 13:56:14 +0900 Subject: [PATCH 001/103] Implement DrumRoll + DrumRollTick. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 121 ++++++++++++++++++ osu.Game.Modes.Taiko/Objects/DrumRollTick.cs | 21 +++ .../osu.Game.Modes.Taiko.csproj | 2 + 3 files changed, 144 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/DrumRoll.cs create mode 100644 osu.Game.Modes.Taiko/Objects/DrumRollTick.cs diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs new file mode 100644 index 0000000000..9ce2758d84 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -0,0 +1,121 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// 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.Types; +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; + +namespace osu.Game.Modes.Taiko.Objects +{ + public class DrumRoll : TaikoHitObject, IHasDistance + { + public double EndTime => StartTime + Distance / Velocity; + + public double Duration => EndTime - StartTime; + + /// + /// Raw length of the drum roll in positional length units. + /// + public double Distance { get; set; } + + /// + /// Velocity of the drum roll in positional length units per millisecond. + /// + public double Velocity; + + /// + /// The distance between ticks of this drumroll. + /// Half of this value is the hit window of the ticks. + /// + public double TickTimeDistance; + + /// + /// Number of drum roll ticks required for a "Good" hit. + /// + public double RequiredGoodHits; + + /// + /// Number of drum roll ticks required for a "Great" hit. + /// + public double RequiredGreatHits; + + /// + /// Total number of drum roll ticks. + /// + public int TotalTicks; + + /// + /// Initializes the drum roll ticks if not initialized and returns them. + /// + public IEnumerable Ticks + { + get + { + if (ticks == null) + createTicks(); + return ticks; + } + } + + private List ticks; + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + TickTimeDistance = timing.BeatLengthAt(StartTime); + + if (difficulty.SliderTickRate == 3) + TickTimeDistance /= 3; + else + TickTimeDistance /= 4; + + TotalTicks = Ticks.Count(); + 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); + } + + private void createTicks() + { + ticks = new List(); + + if (TickTimeDistance == 0) + return; + + bool first = true; + for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance) + { + ticks.Add(new DrumRollTick + { + FirstTick = first, + PreEmpt = PreEmpt, + TickTimeDistance = TickTimeDistance, + StartTime = t, + Sample = new HitSampleInfo + { + Type = SampleType.None, + Set = SampleSet.Soft + } + }); + + first = false; + } + } + + public override TaikoHitType Type + { + get + { + SampleType st = Sample?.Type ?? SampleType.None; + + return TaikoHitType.DrumRoll | ((st & SampleType.Finish) > 0 ? TaikoHitType.Finisher : TaikoHitType.None); + } + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs new file mode 100644 index 0000000000..c2487f7422 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/DrumRollTick.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.Modes.Taiko.Objects +{ + public class DrumRollTick : TaikoHitObject + { + /// + /// Whether this is the first (initial) tick of the slider. + /// + public bool FirstTick; + + /// + /// The distance between this tick and the next in milliseconds. + /// Half of this value is the hit window of the tick. + /// + public double TickTimeDistance; + + public override TaikoHitType Type => TaikoHitType.DrumRollTick; + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 0e9e6a56b4..5fbdc7d525 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,6 +50,8 @@ + + From d2194e3d2a51e7e6851977af222657d9462ab5fb Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:01:32 +0900 Subject: [PATCH 002/103] Implement Bash. --- osu.Game.Modes.Taiko/Objects/Bash.cs | 32 +++++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 1 + 2 files changed, 33 insertions(+) create mode 100644 osu.Game.Modes.Taiko/Objects/Bash.cs diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Bash.cs new file mode 100644 index 0000000000..c9f4d01256 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Bash.cs @@ -0,0 +1,32 @@ +// 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 +{ + public class Bash : TaikoHitObject, IHasEndTime + { + public double EndTime => StartTime + Duration; + + public double Duration { get; set; } + + /// + /// The number of hits required to complete the bash successfully. + /// + public int RequiredHits; + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); + RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio); + } + + public override TaikoHitType Type => TaikoHitType.Bash; + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 0e9e6a56b4..699ef87e99 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 ccc2253068a669158cc8f9fcbc94f0d34ce42fd8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:39:38 +0900 Subject: [PATCH 003/103] Implement basic Taiko HitObject conversion. --- .../Beatmaps/TaikoBeatmapConverter.cs | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index d78c347f22..0fa7572cd4 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -2,8 +2,12 @@ // 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.Modes.Objects; +using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Taiko.Objects; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Modes.Taiko.Beatmaps { @@ -11,9 +15,52 @@ namespace osu.Game.Modes.Taiko.Beatmaps { public Beatmap Convert(Beatmap original) { + if (original is IIsLegacy) + original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4); + return new Beatmap(original) { - HitObjects = new List() // Todo: Implement + HitObjects = convertHitObjects(original.HitObjects) + }; + } + + private List convertHitObjects(List hitObjects) + { + return hitObjects.Select(convertHitObject).ToList(); + } + + private TaikoHitObject convertHitObject(HitObject original) + { + IHasDistance distanceData = original as IHasDistance; + IHasRepeats repeatsData = original as IHasRepeats; + IHasEndTime endTimeData = original as IHasEndTime; + + if (distanceData != null) + { + return new DrumRoll + { + StartTime = original.StartTime, + Sample = original.Sample, + + Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) + }; + } + + if (endTimeData != null) + { + return new Bash + { + StartTime = original.StartTime, + Sample = original.Sample, + + EndTime = endTimeData.EndTime + }; + } + + return new TaikoHitObject + { + StartTime = original.StartTime, + Sample = original.Sample, }; } } From d478a58a89545c08f544129838746316069dc943 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:43:00 +0900 Subject: [PATCH 004/103] Invert getters and setters for EndTime / Duration. --- osu.Game.Modes.Taiko/Objects/Bash.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Bash.cs index c9f4d01256..895b25e987 100644 --- a/osu.Game.Modes.Taiko/Objects/Bash.cs +++ b/osu.Game.Modes.Taiko/Objects/Bash.cs @@ -10,9 +10,9 @@ namespace osu.Game.Modes.Taiko.Objects { public class Bash : TaikoHitObject, IHasEndTime { - public double EndTime => StartTime + Duration; + public double EndTime { get; set; } - public double Duration { get; set; } + public double Duration => EndTime - StartTime; /// /// The number of hits required to complete the bash successfully. From 4a85b899c9a9fdf9adbbcb0510adebd5134e1fd2 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 14:44:48 +0900 Subject: [PATCH 005/103] Fix up VelocityAdjustment value. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 0fa7572cd4..e89ba110be 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -13,10 +13,12 @@ namespace osu.Game.Modes.Taiko.Beatmaps { internal class TaikoBeatmapConverter : IBeatmapConverter { + private const float legacy_velocity_scale = 1.4f; + public Beatmap Convert(Beatmap original) { if (original is IIsLegacy) - original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment *= 1.4); + original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) { From 2e0d100a226823ee7279fc455325df5eb4f4d352 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 15:19:56 +0900 Subject: [PATCH 006/103] Add base DrawableTaikoHitObject, remove DrawableTaikoHit. --- .../Objects/Drawable/DrawableTaikoHit.cs | 39 ------------------- .../Drawable/DrawableTaikoHitObject.cs | 34 ++++++++++++++++ .../osu.Game.Modes.Taiko.csproj | 2 +- 3 files changed, 35 insertions(+), 40 deletions(-) delete mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs create mode 100644 osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs deleted file mode 100644 index 760977ef5b..0000000000 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.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 osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; -using OpenTK; - -namespace osu.Game.Modes.Taiko.Objects.Drawable -{ - internal class DrawableTaikoHit : Sprite - { - private TaikoHitObject h; - - public DrawableTaikoHit(TaikoHitObject h) - { - this.h = h; - - Origin = Anchor.Centre; - Scale = new Vector2(0.2f); - RelativePositionAxes = Axes.Both; - Position = new Vector2(1.1f, 0.5f); - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - Texture = textures.Get(@"Menu/logo"); - - double duration = 0; - - Transforms.Add(new TransformPositionX { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f }); - Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); - Expire(true); - } - } -} diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs new file mode 100644 index 0000000000..e29caf3f49 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -0,0 +1,34 @@ +// 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.Taiko.Judgements; + +namespace osu.Game.Modes.Taiko.Objects.Drawable +{ + public class DrawableTaikoHitObject : DrawableHitObject + { + public DrawableTaikoHitObject(TaikoHitObject hitObject) + : base(hitObject) + { + LifetimeStart = HitObject.StartTime - HitObject.PreEmpt; + LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; + } + + protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); + + protected override void UpdateState(ArmedState state) + { + } + + protected void UpdateScrollPosition(double time) + { + MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); + } + + protected override void Update() + { + UpdateScrollPosition(Time.Current); + } + } +} diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 0e9e6a56b4..aab9a17276 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -50,9 +50,9 @@ + - From f48af91686bc48d8f57c30932aa34b87dabb8632 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 15:45:54 +0900 Subject: [PATCH 007/103] Appease the resharper gods. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 9ce2758d84..eebbb4717e 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.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; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; @@ -68,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; TickTimeDistance = timing.BeatLengthAt(StartTime); if (difficulty.SliderTickRate == 3) From cdfe95c15930ac6e0072699d7f7ab2c0725fccaf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 16:05:16 +0900 Subject: [PATCH 008/103] Add AcentColour and xmldoc. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index e29caf3f49..4adbf2cb33 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.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.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; @@ -8,6 +9,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { public class DrawableTaikoHitObject : DrawableHitObject { + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public virtual Color4 AccentColour { get; } + public DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { @@ -21,6 +27,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { } + /// + /// Sets the scroll position of the DrawableHitObject relative to the offset between + /// a time value and the HitObject's StartTime. + /// + /// protected void UpdateScrollPosition(double time) { MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); From 35f63cb2aa774daec62fc13fb7085cb9f05aef9f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 16:10:40 +0900 Subject: [PATCH 009/103] Set Anchor/Origin and RelativePositionAxes. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 4adbf2cb33..321a1beea7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; +using osu.Framework.Graphics; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; @@ -17,7 +18,12 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable public DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { - LifetimeStart = HitObject.StartTime - HitObject.PreEmpt; + Anchor = Anchor.CentreLeft; + Origin = Anchor.Centre; + + RelativePositionAxes = Axes.X; + + LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; } From 0e4ed829f2d148558d2f9a671ea4118ea1ab3965 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 18:55:54 +0900 Subject: [PATCH 010/103] Make DrawableTaikoHitObject generic. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 321a1beea7..5e8aeb4844 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -8,14 +8,15 @@ using osu.Game.Modes.Taiko.Judgements; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableTaikoHitObject : DrawableHitObject + public class DrawableTaikoHitObject : DrawableHitObject + where TTaikoObject : TaikoHitObject { /// /// The colour used for various elements of this DrawableHitObject. /// public virtual Color4 AccentColour { get; } - public DrawableTaikoHitObject(TaikoHitObject hitObject) + public DrawableTaikoHitObject(TTaikoObject hitObject) : base(hitObject) { Anchor = Anchor.CentreLeft; From 5136064cb35b706985d50a564ec079e98fd544f5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:23:18 +0900 Subject: [PATCH 011/103] Revert "Make DrawableTaikoHitObject generic." This reverts commit 0e4ed829f2d148558d2f9a671ea4118ea1ab3965. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 5e8aeb4844..321a1beea7 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -8,15 +8,14 @@ using osu.Game.Modes.Taiko.Judgements; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableTaikoHitObject : DrawableHitObject - where TTaikoObject : TaikoHitObject + public class DrawableTaikoHitObject : DrawableHitObject { /// /// The colour used for various elements of this DrawableHitObject. /// public virtual Color4 AccentColour { get; } - public DrawableTaikoHitObject(TTaikoObject hitObject) + public DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { Anchor = Anchor.CentreLeft; From 7f7e8047d4dcf4c6b9bdf6cb99580d2edaa8ed47 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:51:56 +0900 Subject: [PATCH 012/103] Don't convert originally taiko hitobjects. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index e89ba110be..6533295ce4 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -33,6 +33,11 @@ namespace osu.Game.Modes.Taiko.Beatmaps private TaikoHitObject convertHitObject(HitObject original) { + // Check if this HitObject is already a TaikoHitObject, and return it if so + TaikoHitObject originalTaiko = original as TaikoHitObject; + if (originalTaiko != null) + return originalTaiko; + IHasDistance distanceData = original as IHasDistance; IHasRepeats repeatsData = original as IHasRepeats; IHasEndTime endTimeData = original as IHasEndTime; From 605f733cf905f299050af7f0212662eb11e06c56 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:52:24 +0900 Subject: [PATCH 013/103] Add back the bash conversion factor. --- osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs index 6533295ce4..00a17c017c 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -14,6 +14,7 @@ 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; public Beatmap Convert(Beatmap original) { @@ -55,12 +56,13 @@ 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 { StartTime = original.StartTime, Sample = original.Sample, - EndTime = endTimeData.EndTime + EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor }; } From 2a9e8f4ed6b98aa4ac8e3eb83751d022f5ede0cf Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 17 Mar 2017 19:54:36 +0900 Subject: [PATCH 014/103] Fix license headers. --- osu.Game/Beatmaps/Legacy/IIsLegacy.cs | 5 ++++- osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs index 23ab9f4bc4..3babd3e66f 100644 --- a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs +++ b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Beatmaps.Legacy +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Legacy { /// /// A Beatmap that was loaded from a legacy .osu beatmap file (version <=15). diff --git a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs index 00aeeb2b49..d0386e7560 100644 --- a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs +++ b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs @@ -1,4 +1,7 @@ -namespace osu.Game.Beatmaps.Legacy +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Beatmaps.Legacy { /// /// A type of Beatmap loaded from a legacy .osu beatmap file (version <=15). From 77bdfe880a54a00e53c3aa8f05a775f3f95b4489 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 18 Mar 2017 18:34:45 +0900 Subject: [PATCH 015/103] Fix post-merge errors. --- 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 00a17c017c..06c0b6c994 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps public Beatmap Convert(Beatmap original) { - if (original is IIsLegacy) + if (original is LegacyBeatmap) original.TimingInfo.ControlPoints.ForEach(c => c.VelocityAdjustment /= legacy_velocity_scale); return new Beatmap(original) From f4f571590658415d9dbe44e7a291040006427b46 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Sat, 18 Mar 2017 18:37:48 +0900 Subject: [PATCH 016/103] Resharper. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 9ce2758d84..eebbb4717e 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.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; using osu.Game.Beatmaps.Samples; using osu.Game.Modes.Objects.Types; using System; @@ -68,7 +67,7 @@ namespace osu.Game.Modes.Taiko.Objects { base.ApplyDefaults(timing, difficulty); - Velocity = (timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier) / 1000; + Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; TickTimeDistance = timing.BeatLengthAt(StartTime); if (difficulty.SliderTickRate == 3) From b3b8fadf031a11f867d28a2cd5ecd29b9636dad4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 13:02:52 +0900 Subject: [PATCH 017/103] Remove Type. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 10 ---------- osu.Game.Modes.Taiko/Objects/DrumRollTick.cs | 2 -- 2 files changed, 12 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index eebbb4717e..ba51878635 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -106,15 +106,5 @@ namespace osu.Game.Modes.Taiko.Objects first = false; } } - - public override TaikoHitType Type - { - get - { - SampleType st = Sample?.Type ?? SampleType.None; - - return TaikoHitType.DrumRoll | ((st & SampleType.Finish) > 0 ? TaikoHitType.Finisher : TaikoHitType.None); - } - } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs index c2487f7422..66a2d16fe1 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRollTick.cs @@ -15,7 +15,5 @@ namespace osu.Game.Modes.Taiko.Objects /// Half of this value is the hit window of the tick. /// public double TickTimeDistance; - - public override TaikoHitType Type => TaikoHitType.DrumRollTick; } } \ No newline at end of file From b9006e4026ad0f0f613e2ab7ad1ae60733d4fa21 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 13:04:09 +0900 Subject: [PATCH 018/103] Remove Type. --- osu.Game.Modes.Taiko/Objects/Bash.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Bash.cs index 895b25e987..1b771cb1d5 100644 --- a/osu.Game.Modes.Taiko/Objects/Bash.cs +++ b/osu.Game.Modes.Taiko/Objects/Bash.cs @@ -26,7 +26,5 @@ namespace osu.Game.Modes.Taiko.Objects double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5); RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio); } - - public override TaikoHitType Type => TaikoHitType.Bash; } } \ No newline at end of file From 75fb7a3eb34577f302e05547b5feb5be7704a248 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 20 Mar 2017 18:10:09 +0900 Subject: [PATCH 019/103] Suppress Resharper. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 321a1beea7..bc52be63c6 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -25,6 +25,9 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; + + // Todo: Remove (suppresses Resharper) + AccentColour = Color4.White; } protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); From 58be4548ef34218bad1ba053f5808ad3fb7105fe Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 14:53:55 +0900 Subject: [PATCH 020/103] Late-add the HitObjects container in the Playfield. Allows derivers to define the Content container in the constructor, to redirect the positioning of the HitObjects container. --- osu.Game/Modes/UI/Playfield.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index bff461f649..e5babecad9 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -7,6 +7,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using OpenTK; using osu.Game.Modes.Judgements; +using osu.Framework.Allocation; namespace osu.Game.Modes.UI { @@ -45,10 +46,16 @@ namespace osu.Game.Modes.UI } }); - Add(HitObjects = new HitObjectContainer> + HitObjects = new HitObjectContainer> { RelativeSizeAxes = Axes.Both, - }); + }; + } + + [BackgroundDependencyLoader] + private void load() + { + Add(HitObjects); } /// From 27a21cd23d8422147a47cdaec7413c7ab208d5e4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 14:58:34 +0900 Subject: [PATCH 021/103] Add taiko playfield. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 1 + osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs new file mode 100644 index 0000000000..2ed38c84d5 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -0,0 +1 @@ +using osu.Framework.Screens.Testing; diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 68aed38b34..aa4f782c22 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 @@ + From 10ed6ef10d48339df8e8d83d4ffff6b824fee79b Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 15:09:54 +0900 Subject: [PATCH 022/103] Move TaikoPlayfield to separate file. --- .../Tests/TestCaseTaikoPlayfield.cs | 22 ++ osu.Game.Modes.Taiko/UI/HitTarget.cs | 153 ++++++++++++++ osu.Game.Modes.Taiko/UI/InputDrum.cs | 142 +++++++++++++ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 189 ++++++++++++++++-- .../osu.Game.Modes.Taiko.csproj | 2 + 5 files changed, 493 insertions(+), 15 deletions(-) create mode 100644 osu.Game.Modes.Taiko/UI/HitTarget.cs create mode 100644 osu.Game.Modes.Taiko/UI/InputDrum.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 2ed38c84d5..3c801744e8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -1 +1,23 @@ +// 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.Game.Modes.Taiko.UI; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseTaikoPlayfield : TestCase + { + public override string Description => "Taiko playfield"; + + public override void Reset() + { + base.Reset(); + + Add(new TaikoPlayfield + { + Y = 200 + }); + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs new file mode 100644 index 0000000000..b370f6f486 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -0,0 +1,153 @@ +// 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.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osu.Game.Modes.Taiko.Objects; + +namespace osu.Game.Modes.Taiko.UI +{ + internal class HitTarget : Container + { + private Sprite outer; + private Sprite inner; + + private Container innerFlash; + private Container outerFlash; + + public HitTarget() + { + Children = new Drawable[] + { + new Box + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(5, TaikoPlayfield.PlayfieldHeight), + + Colour = Color4.Black + }, + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f), + Scale = new Vector2(TaikoPlayfield.PLAYFIELD_SCALE), + + Children = new Drawable[] + { + outer = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + }, + inner = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1 / 1.5f) + }, + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Children = new Drawable[] + { + outerFlash = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, 680), + + Masking = true, + CornerRadius = TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, + + Alpha = 0, + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }, + innerFlash = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Masking = true, + + Alpha = 0, + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Colour = Color4.White.Opacity(0.85f), + } + }, + } + } + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + } + + public void Flash(Color4 colour) + { + innerFlash.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = colour, + Radius = 20 + }; + + outerFlash.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = colour, + Radius = 250 + }; + + outerFlash.FadeTo(0.3f, 125, EasingTypes.OutQuint); + outerFlash.Delay(125).FadeOut(125); + + innerFlash.FadeIn(); + innerFlash.FadeOut(250, EasingTypes.OutQuint); + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs new file mode 100644 index 0000000000..59ab579a63 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -0,0 +1,142 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Input; +using osu.Game.Graphics; +using System.Collections.Generic; + +namespace osu.Game.Modes.Taiko.UI +{ + internal class InputDrum : Container + { + public InputDrum() + { + Size = new Vector2(TaikoPlayfield.PlayfieldHeight); + + Children = new Drawable[] + { + new TaikoHalfDrum(false) + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + + RelativeSizeAxes = Axes.Both, + + Keys = new List(new[] { Key.F, Key.D }) + }, + new TaikoHalfDrum(true) + { + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + + RelativeSizeAxes = Axes.Both, + + Position = new Vector2(-1f, 0), + + Keys = new List(new[] { Key.J, Key.K }) + } + }; + } + + private class TaikoHalfDrum : Container + { + /// + /// Keys[0] -> Inner key + /// Keys[0] -> Outer key + /// + public List Keys = new List(); + + private Sprite outer; + private Sprite outerHit; + private Sprite inner; + private Sprite innerHit; + + public TaikoHalfDrum(bool flipped) + { + Masking = true; + + Children = new Drawable[] + { + outer = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both + }, + outerHit = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + + BlendingMode = BlendingMode.Additive + }, + inner = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.7f) + }, + innerHit = new Sprite + { + Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, + Origin = Anchor.Centre, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(0.7f), + + Alpha = 0, + + BlendingMode = BlendingMode.Additive + } + }; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures, OsuColour colours) + { + outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + outerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); + inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + innerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); + + outerHit.Colour = colours.Blue; + innerHit.Colour = colours.Pink; + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (args.Repeat) + return false; + + if (args.Key == Keys[0]) + { + innerHit.FadeIn(); + innerHit.FadeOut(500, EasingTypes.OutQuint); + } + + if (args.Key == Keys[1]) + { + outerHit.FadeIn(); + outerHit.FadeOut(500, EasingTypes.OutQuint); + } + + return false; + } + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index f3ae600501..a40693fa89 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -4,39 +4,198 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.UI; using OpenTK; using OpenTK.Graphics; using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Objects.Drawables; +using osu.Game.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Primitives; namespace osu.Game.Modes.Taiko.UI { public class TaikoPlayfield : Playfield { + /// + /// The default play field height. + /// + public const float PLAYFIELD_BASE_HEIGHT = 242; + + /// + /// The play field height scale. + /// + public const float PLAYFIELD_SCALE = 0.65f; + + /// + /// The play field height after scaling. + /// + public static float PlayfieldHeight => PLAYFIELD_BASE_HEIGHT * PLAYFIELD_SCALE; + + /// + /// The offset from which the center of the hit target lies at. + /// + private const float hit_target_offset = 80; + + /// + /// The size of the left area of the playfield. This area contains the input drum. + /// + private const float left_area_size = 240; + + protected override Container Content => hitObjectContainer; + + private HitTarget hitTarget; + //private Container explosionRingContainer; + //private Container barLineContainer; + //private Container judgementContainer; + + private Container hitObjectContainer; + private Container topLevelHitContainer; + private Container leftBackgroundContainer; + private Container rightBackgroundContainer; + private Box leftBackground; + private Box rightBackground; + public TaikoPlayfield() { RelativeSizeAxes = Axes.X; - Size = new Vector2(1, 100); - Anchor = Anchor.Centre; - Origin = Anchor.Centre; + Height = PlayfieldHeight; + + AddInternal(new Drawable[] + { + rightBackgroundContainer = new Container + { + RelativeSizeAxes = Axes.Both, + BorderThickness = 2, + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = Color4.Black.Opacity(0.2f), + Radius = 5, + }, + Children = new Drawable[] + { + rightBackground = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.6f + }, + } + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = left_area_size }, + Children = new Drawable[] + { + new Container + { + Padding = new MarginPadding { Left = hit_target_offset }, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new Container + { + Name = @"Hit target", + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + //explosionRingContainer = new Container + //{ + // Anchor = Anchor.CentreLeft, + // Origin = Anchor.Centre, + // Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + // Scale = new Vector2(PLAYFIELD_SCALE), + // BlendingMode = BlendingMode.Additive + //}, + } + }, + //barLineContainer = new Container + //{ + // RelativeSizeAxes = Axes.Both, + //}, + hitTarget = new HitTarget + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + }, + hitObjectContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + //judgementContainer = new Container + //{ + // RelativeSizeAxes = Axes.Both, + // BlendingMode = BlendingMode.Additive + //}, + }, + }, + } + }, + leftBackgroundContainer = new Container + { + Size = new Vector2(left_area_size, PlayfieldHeight), + BorderThickness = 1, + Children = new Drawable[] + { + leftBackground = new Box + { + RelativeSizeAxes = Axes.Both, + }, + new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativePositionAxes = Axes.X, + Position = new Vector2(0.10f, 0), + Children = new Drawable[] + { + new InputDrum + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(0.9f) + }, + } + }, + new Box + { + Anchor = Anchor.TopRight, + RelativeSizeAxes = Axes.Y, + Width = 10, + ColourInfo = Framework.Graphics.Colour.ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.6f), Color4.Black.Opacity(0)), + }, + } + }, + topLevelHitContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } + }); } [BackgroundDependencyLoader] - private void load(TextureStore textures) + private void load(OsuColour colours) { - Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); + leftBackgroundContainer.BorderColour = colours.Gray0; + leftBackground.Colour = colours.Gray1; - Add(new Sprite - { - Texture = textures.Get(@"Menu/logo"), - Origin = Anchor.Centre, - Scale = new Vector2(0.2f), - RelativePositionAxes = Axes.Both, - Position = new Vector2(0.1f, 0.5f), - Colour = Color4.Gray - }); + rightBackgroundContainer.BorderColour = colours.Gray1; + rightBackground.Colour = colours.Gray0; + } + + public override void Add(DrawableHitObject h) + { + h.Depth = (float)h.HitObject.StartTime; + + base.Add(h); + } + + public override void OnJudgement(DrawableHitObject judgedObject) + { } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 7ea6dfeadb..a4d87b096a 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -55,6 +55,8 @@ + + From 4c398b106d6f171804a0e1295ecb453d64b20018 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 15:54:57 +0900 Subject: [PATCH 023/103] Add explosion rings. --- .../Tests/TestCaseTaikoPlayfield.cs | 59 +++++++++++++++- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 69 +++++++++++++++++++ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 25 ++++--- .../osu.Game.Modes.Taiko.csproj | 1 + 4 files changed, 144 insertions(+), 10 deletions(-) create mode 100644 osu.Game.Modes.Taiko/UI/RingExplosion.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 3c801744e8..4568685fb1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.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 osu.Framework.MathUtils; 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.UI; namespace osu.Desktop.VisualTests.Tests @@ -10,14 +14,67 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "Taiko playfield"; + private TaikoPlayfield playfield; + public override void Reset() { base.Reset(); - Add(new TaikoPlayfield + AddButton("Hit!", addHitJudgement); + AddButton("Miss :(", addMissJudgement); + + Add(playfield = new TaikoPlayfield { Y = 200 }); } + + private void addHitJudgement() + { + TaikoScoreResult score = RNG.Next(2) == 0 ? TaikoScoreResult.Good : TaikoScoreResult.Great; + + playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) + { + Judgement = new TaikoJudgementInfo + { + Result = HitResult.Hit, + Score = score, + TimeOffset = 0, + ComboAtHit = 1 + } + }); + } + + private void addMissJudgement() + { + playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) + { + Judgement = new TaikoJudgementInfo + { + Result = HitResult.Miss, + TimeOffset = 0, + ComboAtHit = 0 + } + }); + } + + private class DrawableTestHit : DrawableHitObject + { + public DrawableTestHit(TaikoHitObject hitObject) + : base(hitObject) + { + } + + protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); + + protected override void UpdateState(ArmedState state) + { + } + + protected override void Update() + { + // Doesn't move + } + } } } diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs new file mode 100644 index 0000000000..63e860e8c1 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -0,0 +1,69 @@ +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.Graphics.Transforms; +using osu.Game.Graphics; +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Taiko.Objects; + +namespace osu.Game.Modes.Taiko.UI +{ + internal class RingExplosion : CircularContainer + { + public TaikoScoreResult ScoreResult; + + private Box innerFill; + + public RingExplosion() + { + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + RelativePositionAxes = Axes.Both; + + BorderColour = Color4.White; + BorderThickness = 1; + + Alpha = 0.15f; + + Children = new[] + { + innerFill = new Box + { + RelativeSizeAxes = Axes.Both, + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + switch (ScoreResult) + { + default: + break; + case TaikoScoreResult.Good: + innerFill.Colour = colours.Green; + break; + case TaikoScoreResult.Great: + innerFill.Colour = colours.Blue; + break; + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ScaleTo(5f, 1000, EasingTypes.OutQuint); + FadeOut(500); + + Expire(); + } + } +} diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index a40693fa89..7aeebc0bdf 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -47,7 +47,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; private HitTarget hitTarget; - //private Container explosionRingContainer; + private Container ringExplosionContainer; //private Container barLineContainer; //private Container judgementContainer; @@ -103,14 +103,14 @@ namespace osu.Game.Modes.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - //explosionRingContainer = new Container - //{ - // Anchor = Anchor.CentreLeft, - // Origin = Anchor.Centre, - // Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), - // Scale = new Vector2(PLAYFIELD_SCALE), - // BlendingMode = BlendingMode.Additive - //}, + ringExplosionContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Scale = new Vector2(PLAYFIELD_SCALE), + BlendingMode = BlendingMode.Additive + }, } }, //barLineContainer = new Container @@ -196,6 +196,13 @@ namespace osu.Game.Modes.Taiko.UI public override void OnJudgement(DrawableHitObject judgedObject) { + if (judgedObject.Judgement.Result == HitResult.Hit) + { + ringExplosionContainer.Add(new RingExplosion + { + ScoreResult = judgedObject.Judgement.Score + }); + } } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 16ada59858..a12c2aee22 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -58,6 +58,7 @@ + From 1ac9898a36e135341054f6a5f9f9e537fe55bb6c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 16:33:25 +0900 Subject: [PATCH 024/103] Add judgement texts. --- .../Tests/TestCaseTaikoPlayfield.cs | 1 + osu.Game.Modes.Taiko/UI/JudgementText.cs | 126 ++++++++++++++++++ osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 25 +++- .../osu.Game.Modes.Taiko.csproj | 1 + 4 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Modes.Taiko/UI/JudgementText.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 4568685fb1..2e20c44ab7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -35,6 +35,7 @@ namespace osu.Desktop.VisualTests.Tests playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) { + X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgementInfo { Result = HitResult.Hit, diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs new file mode 100644 index 0000000000..b35f81b2a0 --- /dev/null +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -0,0 +1,126 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics.Sprites; +using OpenTK; +using OpenTK.Graphics; +using osu.Game.Modes.Taiko.Judgements; +using osu.Game.Modes.Objects.Drawables; +using osu.Framework.Allocation; +using osu.Game.Graphics; + +namespace osu.Game.Modes.Taiko.UI +{ + public class JudgementText : Container + { + public TaikoJudgementInfo Judgement; + + private Container textContainer; + private OsuSpriteText glowText; + private OsuSpriteText normalText; + + private int movementDirection; + + public JudgementText() + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + textContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + AutoSizeAxes = Axes.Both, + + Children = new Drawable[] + { + new BufferedContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + BlurSigma = new Vector2(10), + CacheDrawnFrameBuffer = true, + + RelativeSizeAxes = Axes.Both, + Size = new Vector2(3), + + BlendingMode = BlendingMode.Additive, + + Children = new[] + { + glowText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Font = "Venera", + TextSize = 22f, + } + } + }, + normalText = new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Font = "Venera", + TextSize = 22f, + } + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Color4 judgementColour = Color4.White; + string judgementText = string.Empty; + + switch (Judgement.Result) + { + case HitResult.Miss: + judgementColour = colours.Red; + judgementText = "MISS"; + movementDirection = 1; + break; + case HitResult.Hit: + switch (Judgement.Score) + { + case TaikoScoreResult.Good: + judgementColour = colours.Green; + judgementText = "GOOD"; + textContainer.Scale = new Vector2(0.45f); + break; + case TaikoScoreResult.Great: + judgementColour = colours.Blue; + judgementText = "GREAT"; + break; + } + + movementDirection = -1; + break; + } + + glowText.Colour = judgementColour; + glowText.Text = normalText.Text = judgementText; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + ScaleTo(1.5f, 250, EasingTypes.OutQuint); + MoveToY(movementDirection * 100, 500); + + Delay(250); + ScaleTo(0.75f, 250); + FadeOut(250); + + Expire(); + } + } +} \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 7aeebc0bdf..2295f498c7 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.UI private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; - //private Container judgementContainer; + private Container judgementContainer; private Container hitObjectContainer; private Container topLevelHitContainer; @@ -126,11 +126,11 @@ namespace osu.Game.Modes.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - //judgementContainer = new Container - //{ - // RelativeSizeAxes = Axes.Both, - // BlendingMode = BlendingMode.Additive - //}, + judgementContainer = new Container + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive + }, }, }, } @@ -203,6 +203,19 @@ namespace osu.Game.Modes.Taiko.UI ScoreResult = judgedObject.Judgement.Score }); } + + float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; + + judgementContainer.Add(new JudgementText + { + Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, + Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, + + RelativePositionAxes = Axes.X, + X = judgementOffset, + + Judgement = judgedObject.Judgement + }); } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index a12c2aee22..372f9ba6fd 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -58,6 +58,7 @@ + From 4e7a44cd441f370fbd8ece897075078e70c18bce Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 16:40:37 +0900 Subject: [PATCH 025/103] Add license + general fixes. --- osu.Game.Modes.Taiko/UI/JudgementText.cs | 5 ++++- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 7 ++++--- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index b35f81b2a0..f7ccd4a5ec 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.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; using osu.Framework.Graphics.Transforms; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index 63e860e8c1..16037de22a 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -1,4 +1,7 @@ -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 OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -45,8 +48,6 @@ namespace osu.Game.Modes.Taiko.UI { switch (ScoreResult) { - default: - break; case TaikoScoreResult.Good: innerFill.Colour = colours.Green; break; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 2295f498c7..d0829d2fac 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,12 +46,14 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; + // ReSharper disable once NotAccessedField.Local private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; private Container judgementContainer; private Container hitObjectContainer; + // ReSharper disable once NotAccessedField.Local private Container topLevelHitContainer; private Container leftBackgroundContainer; private Container rightBackgroundContainer; From eec4a1b5d37110858cd875297b63769ad0b8e379 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:48:19 +0900 Subject: [PATCH 026/103] Redesign HitTarget. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 172 +++++++++------------------ 1 file changed, 58 insertions(+), 114 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index b370f6f486..496f3741d7 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -3,151 +3,95 @@ using OpenTK; using OpenTK.Graphics; -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.Textures; -using osu.Framework.Graphics.Transforms; using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { internal class HitTarget : Container { - private Sprite outer; - private Sprite inner; - - private Container innerFlash; - private Container outerFlash; + private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; + private const float finisher_diameter = normal_diameter * 1.5f; public HitTarget() { + RelativeSizeAxes = Axes.Y; + Children = new Drawable[] { new Box { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, + Name = "Bar Upper", - Size = new Vector2(5, TaikoPlayfield.PlayfieldHeight), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, - Colour = Color4.Black + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + + Alpha = 0.1f }, - new Container + new CircularContainer { + Name = "Finisher Ring", + Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f), - Scale = new Vector2(TaikoPlayfield.PLAYFIELD_SCALE), + Size = new Vector2(finisher_diameter), - Children = new Drawable[] + BorderColour = Color4.White, + BorderThickness = 2, + Alpha = 0.1f, + + Children = new[] { - outer = new Sprite + new Box { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - RelativeSizeAxes = Axes.Both, - }, - inner = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - RelativeSizeAxes = Axes.Both, - Size = new Vector2(1 / 1.5f) - }, - new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - outerFlash = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, 680), - - Masking = true, - CornerRadius = TaikoHitObject.CIRCLE_RADIUS * 2 * 1.5f, - - Alpha = 0, - - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - - Alpha = 0, - AlwaysPresent = true - } - } - }, - innerFlash = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - - RelativeSizeAxes = Axes.Both, - - Masking = true, - - Alpha = 0, - - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - - Colour = Color4.White.Opacity(0.85f), - } - }, - } - } + Alpha = 0, + AlwaysPresent = true } } - } + }, + new CircularContainer + { + Name = "Normal Ring", + + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Size = new Vector2(normal_diameter), + + BorderColour = Color4.White, + BorderThickness = 2, + Alpha = 0.5f, + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + + Alpha = 0, + AlwaysPresent = true + } + } + }, + new Box + { + Name = "Bar Lower", + + Anchor = Anchor.BottomCentre, + Origin = Anchor.BottomCentre, + + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + + Alpha = 0.1f + }, }; } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); - inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); - } - - public void Flash(Color4 colour) - { - innerFlash.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Colour = colour, - Radius = 20 - }; - - outerFlash.EdgeEffect = new EdgeEffect - { - Type = EdgeEffectType.Glow, - Colour = colour, - Radius = 250 - }; - - outerFlash.FadeTo(0.3f, 125, EasingTypes.OutQuint); - outerFlash.Delay(125).FadeOut(125); - - innerFlash.FadeIn(); - innerFlash.FadeOut(250, EasingTypes.OutQuint); - } } } From 60e866aebd5d53f1109d0aa5b875deefa51c5b5a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:49:22 +0900 Subject: [PATCH 027/103] Increase RingExplosion base size for finishers. Subtle but looks good imo (checked with flyte). --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 3 ++- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 7 +++++-- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 2e20c44ab7..b61ada57a3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -41,7 +41,8 @@ namespace osu.Desktop.VisualTests.Tests Result = HitResult.Hit, Score = score, TimeOffset = 0, - ComboAtHit = 1 + ComboAtHit = 1, + SecondHit = RNG.Next(2) == 0 } }); } diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index 16037de22a..e7dcda086d 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -16,7 +16,7 @@ namespace osu.Game.Modes.Taiko.UI { internal class RingExplosion : CircularContainer { - public TaikoScoreResult ScoreResult; + public TaikoJudgementInfo Judgement; private Box innerFill; @@ -46,7 +46,10 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - switch (ScoreResult) + if (Judgement.SecondHit) + Size *= 1.5f; + + switch (Judgement.Score) { case TaikoScoreResult.Good: innerFill.Colour = colours.Green; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index d0829d2fac..808e417e46 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -202,7 +202,7 @@ namespace osu.Game.Modes.Taiko.UI { ringExplosionContainer.Add(new RingExplosion { - ScoreResult = judgedObject.Judgement.Score + Judgement = judgedObject.Judgement }); } From 2cfab75bc78499abb7ff4463d7501778a5ad8ac5 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:50:05 +0900 Subject: [PATCH 028/103] Remove now unnecessary field. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 808e417e46..1b1b445995 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,8 +46,6 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; - // ReSharper disable once NotAccessedField.Local - private HitTarget hitTarget; private Container ringExplosionContainer; //private Container barLineContainer; private Container judgementContainer; @@ -119,7 +117,7 @@ namespace osu.Game.Modes.Taiko.UI //{ // RelativeSizeAxes = Axes.Both, //}, - hitTarget = new HitTarget + new HitTarget { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, From aac4f24a2e3b0f7a607006ac64dddce004e6bc05 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 17:55:18 +0900 Subject: [PATCH 029/103] 10% chance to get finisher hits in testcase. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index b61ada57a3..787bca5832 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -42,7 +42,7 @@ namespace osu.Desktop.VisualTests.Tests Score = score, TimeOffset = 0, ComboAtHit = 1, - SecondHit = RNG.Next(2) == 0 + SecondHit = RNG.Next(10) == 0 } }); } From 7cb237798a8a1c08e0353229d4247bcb1ebd0d29 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 18:13:10 +0900 Subject: [PATCH 030/103] Add a 1px offset for the playfield border. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index 496f3741d7..c7b60e871f 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -14,6 +14,7 @@ namespace osu.Game.Modes.Taiko.UI { private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; private const float finisher_diameter = normal_diameter * 1.5f; + private const float border_offset = 1; public HitTarget() { @@ -28,7 +29,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + Y = border_offset, + + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, @@ -87,7 +90,9 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f), + Y = -border_offset, + + Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), Alpha = 0.1f }, From e2b510f3f0c09c039802c62dde531fa3d8a336db Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 18:16:14 +0900 Subject: [PATCH 031/103] Add comments. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 14 ++++++++++++++ osu.Game.Modes.Taiko/UI/InputDrum.cs | 16 ++++++++++++++-- osu.Game.Modes.Taiko/UI/JudgementText.cs | 6 ++++++ osu.Game.Modes.Taiko/UI/RingExplosion.cs | 6 ++++++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index c7b60e871f..9f20e1da0c 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -10,10 +10,24 @@ using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { + /// + /// A component that is displayed at the hit position in the taiko playfield. + /// internal class HitTarget : Container { + /// + /// Diameter of normal hit object circles. + /// private const float normal_diameter = TaikoHitObject.CIRCLE_RADIUS * 2 * TaikoPlayfield.PLAYFIELD_SCALE; + + /// + /// Diameter of finisher hit object circles. + /// private const float finisher_diameter = normal_diameter * 1.5f; + + /// + /// The 1px inner border of the taiko playfield. + /// private const float border_offset = 1; public HitTarget() diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index 59ab579a63..607fd205bb 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -15,6 +15,9 @@ using System.Collections.Generic; namespace osu.Game.Modes.Taiko.UI { + /// + /// A component of the playfield that captures input and displays input as a drum. + /// internal class InputDrum : Container { public InputDrum() @@ -25,6 +28,8 @@ namespace osu.Game.Modes.Taiko.UI { new TaikoHalfDrum(false) { + Name = "Left Half", + Anchor = Anchor.Centre, Origin = Anchor.CentreRight, @@ -34,6 +39,8 @@ namespace osu.Game.Modes.Taiko.UI }, new TaikoHalfDrum(true) { + Name = "Right Half", + Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, @@ -46,11 +53,16 @@ namespace osu.Game.Modes.Taiko.UI }; } + /// + /// A half-drum. Contains one centre and one rim hit. + /// private class TaikoHalfDrum : Container { /// - /// Keys[0] -> Inner key - /// Keys[0] -> Outer key + /// A list of keys which this half-drum accepts. + /// + /// [0] => Inner key, [1] => Outer key + /// /// public List Keys = new List(); diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index f7ccd4a5ec..a65e85e0af 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -14,8 +14,14 @@ using osu.Game.Graphics; namespace osu.Game.Modes.Taiko.UI { + /// + /// Text that is shown as judgement when a hit object is hit or missed. + /// public class JudgementText : Container { + /// + /// The Judgement to display. + /// public TaikoJudgementInfo Judgement; private Container textContainer; diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index e7dcda086d..e405fa0bfb 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -14,8 +14,14 @@ using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { + /// + /// A ring that explodes to indicate a judgement has occurred. + /// internal class RingExplosion : CircularContainer { + /// + /// The Judgement to display. + /// public TaikoJudgementInfo Judgement; private Box innerFill; From 259ed03610fcb5ee425bebceb84aaa3d3c5c8341 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 21 Mar 2017 18:28:04 +0900 Subject: [PATCH 032/103] Reduce some container nesting. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 34 +++++++---------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 1b1b445995..b2248e2c3e 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -97,21 +97,13 @@ namespace osu.Game.Modes.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new Container + ringExplosionContainer = new Container { - Name = @"Hit target", - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - ringExplosionContainer = new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.Centre, - Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), - Scale = new Vector2(PLAYFIELD_SCALE), - BlendingMode = BlendingMode.Additive - }, - } + Anchor = Anchor.CentreLeft, + Origin = Anchor.Centre, + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2), + Scale = new Vector2(PLAYFIELD_SCALE), + BlendingMode = BlendingMode.Additive }, //barLineContainer = new Container //{ @@ -145,21 +137,15 @@ namespace osu.Game.Modes.Taiko.UI { RelativeSizeAxes = Axes.Both, }, - new Container + new InputDrum { Anchor = Anchor.Centre, Origin = Anchor.Centre, + RelativePositionAxes = Axes.X, Position = new Vector2(0.10f, 0), - Children = new Drawable[] - { - new InputDrum - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Scale = new Vector2(0.9f) - }, - } + + Scale = new Vector2(0.9f) }, new Box { From 712d2e194c7e6699350f3748780dfdf5f9cd7547 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:33:22 +0900 Subject: [PATCH 033/103] A bit more protection. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 31 +++++++++--------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index ba51878635..78e9202f20 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -25,41 +25,33 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Velocity of the drum roll in positional length units per millisecond. /// - public double Velocity; + public double Velocity { get; protected set; } /// /// The distance between ticks of this drumroll. /// Half of this value is the hit window of the ticks. /// - public double TickTimeDistance; + public double TickTimeDistance { get; protected set; } /// /// Number of drum roll ticks required for a "Good" hit. /// - public double RequiredGoodHits; + public double RequiredGoodHits { get; protected set; } /// /// Number of drum roll ticks required for a "Great" hit. /// - public double RequiredGreatHits; + public double RequiredGreatHits { get; protected set; } /// /// Total number of drum roll ticks. /// - public int TotalTicks; + public int TotalTicks => Ticks.Count(); /// /// Initializes the drum roll ticks if not initialized and returns them. /// - public IEnumerable Ticks - { - get - { - if (ticks == null) - createTicks(); - return ticks; - } - } + public IEnumerable Ticks => ticks ?? (ticks = createTicks()); private List ticks; @@ -75,22 +67,21 @@ namespace osu.Game.Modes.Taiko.Objects else TickTimeDistance /= 4; - TotalTicks = Ticks.Count(); 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); } - private void createTicks() + private List createTicks() { - ticks = new List(); + var ret = new List(); if (TickTimeDistance == 0) - return; + return ret; bool first = true; for (double t = StartTime; t < EndTime + (int)TickTimeDistance; t += TickTimeDistance) { - ticks.Add(new DrumRollTick + ret.Add(new DrumRollTick { FirstTick = first, PreEmpt = PreEmpt, @@ -105,6 +96,8 @@ namespace osu.Game.Modes.Taiko.Objects first = false; } + + return ret; } } } \ No newline at end of file From b3dde2c399aae4cfcd7bc32698fa425642d75b16 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:35:39 +0900 Subject: [PATCH 034/103] A bit more protection. --- osu.Game.Modes.Taiko/Objects/Bash.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/Bash.cs b/osu.Game.Modes.Taiko/Objects/Bash.cs index 1b771cb1d5..b8b4eea6a9 100644 --- a/osu.Game.Modes.Taiko/Objects/Bash.cs +++ b/osu.Game.Modes.Taiko/Objects/Bash.cs @@ -17,7 +17,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// The number of hits required to complete the bash successfully. /// - public int RequiredHits; + public int RequiredHits { get; protected set; } public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { From b769c436605ea8a5a5771ef110127255d8c4ce4a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:39:39 +0900 Subject: [PATCH 035/103] Update framework. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e6394035d4..a4fc38818e 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e6394035d443d4498b71e845e5763dd3faf98c7c +Subproject commit a4fc38818ea64313fa72fc169a7087047a74839c From e7a93073a445e15007929844f62bd537da4ee858 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:42:40 +0900 Subject: [PATCH 036/103] Fix post-merge errors. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 6 +++--- osu.Game.Modes.Taiko/UI/JudgementText.cs | 6 +++--- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 787bca5832..488b2f192e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -31,15 +31,15 @@ namespace osu.Desktop.VisualTests.Tests private void addHitJudgement() { - TaikoScoreResult score = RNG.Next(2) == 0 ? TaikoScoreResult.Good : TaikoScoreResult.Great; + TaikoHitResult hitResult = RNG.Next(2) == 0 ? TaikoHitResult.Good : TaikoHitResult.Great; playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject()) { - X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f), + X = RNG.NextSingle(hitResult == TaikoHitResult.Good ? -0.1f : -0.05f, hitResult == TaikoHitResult.Good ? 0.1f : 0.05f), Judgement = new TaikoJudgementInfo { Result = HitResult.Hit, - Score = score, + TaikoResult = hitResult, TimeOffset = 0, ComboAtHit = 1, SecondHit = RNG.Next(10) == 0 diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index a65e85e0af..5156020931 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -97,14 +97,14 @@ namespace osu.Game.Modes.Taiko.UI movementDirection = 1; break; case HitResult.Hit: - switch (Judgement.Score) + switch (Judgement.TaikoResult) { - case TaikoScoreResult.Good: + case TaikoHitResult.Good: judgementColour = colours.Green; judgementText = "GOOD"; textContainer.Scale = new Vector2(0.45f); break; - case TaikoScoreResult.Great: + case TaikoHitResult.Great: judgementColour = colours.Blue; judgementText = "GREAT"; break; diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index e405fa0bfb..6400b0d573 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -55,12 +55,12 @@ namespace osu.Game.Modes.Taiko.UI if (Judgement.SecondHit) Size *= 1.5f; - switch (Judgement.Score) + switch (Judgement.TaikoResult) { - case TaikoScoreResult.Good: + case TaikoHitResult.Good: innerFill.Colour = colours.Green; break; - case TaikoScoreResult.Great: + case TaikoHitResult.Great: innerFill.Colour = colours.Blue; break; } From 8f6cee2544bea606786a69c13cc8a89ecf74027f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:43:20 +0900 Subject: [PATCH 037/103] Override is unnecessary. --- osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 488b2f192e..9c0673b527 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -72,11 +72,6 @@ namespace osu.Desktop.VisualTests.Tests protected override void UpdateState(ArmedState state) { } - - protected override void Update() - { - // Doesn't move - } } } } From 24e78d015e40b633cdbd5b326aab94f82c504465 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 01:46:06 +0900 Subject: [PATCH 038/103] Make UpdateScrollPosition virtual. --- 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 bc52be63c6..1cd02e8292 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -41,7 +41,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable /// a time value and the HitObject's StartTime. /// /// - protected void UpdateScrollPosition(double time) + protected virtual void UpdateScrollPosition(double time) { MoveToX((float)((HitObject.StartTime - time) / HitObject.PreEmpt)); } From aa8780797ebd3e6df63a6a9d1e2a96204348829a Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 22 Mar 2017 15:22:02 +0900 Subject: [PATCH 039/103] Abstract class + move AccentColour to base. --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 17 ++--------------- .../Objects/Drawables/DrawableHitObject.cs | 6 ++++++ 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 1cd02e8292..864a7b80a6 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -1,21 +1,15 @@ // 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.Modes.Objects.Drawables; using osu.Game.Modes.Taiko.Judgements; namespace osu.Game.Modes.Taiko.Objects.Drawable { - public class DrawableTaikoHitObject : DrawableHitObject + public abstract class DrawableTaikoHitObject : DrawableHitObject { - /// - /// The colour used for various elements of this DrawableHitObject. - /// - public virtual Color4 AccentColour { get; } - - public DrawableTaikoHitObject(TaikoHitObject hitObject) + protected DrawableTaikoHitObject(TaikoHitObject hitObject) : base(hitObject) { Anchor = Anchor.CentreLeft; @@ -25,17 +19,10 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; - - // Todo: Remove (suppresses Resharper) - AccentColour = Color4.White; } protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); - protected override void UpdateState(ArmedState state) - { - } - /// /// Sets the scroll position of the DrawableHitObject relative to the offset between /// a time value and the HitObject's StartTime. diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 3ff30bd90e..f3bb07d2d8 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -11,6 +11,7 @@ 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; namespace osu.Game.Modes.Objects.Drawables { @@ -73,6 +74,11 @@ namespace osu.Game.Modes.Objects.Drawables public TObject HitObject; + /// + /// The colour used for various elements of this DrawableHitObject. + /// + public Color4 AccentColour { get; protected set; } + protected DrawableHitObject(TObject hitObject) { HitObject = hitObject; From 9c325ddd33904828c40b2c80d393fc469e1165ac Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 09:12:51 +0900 Subject: [PATCH 040/103] Cleanups + fix CircularContainer usages. --- osu.Game.Modes.Taiko/UI/HitTarget.cs | 20 ++------------------ osu.Game.Modes.Taiko/UI/InputDrum.cs | 15 --------------- osu.Game.Modes.Taiko/UI/JudgementText.cs | 8 -------- osu.Game.Modes.Taiko/UI/RingExplosion.cs | 1 + 4 files changed, 3 insertions(+), 41 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/HitTarget.cs b/osu.Game.Modes.Taiko/UI/HitTarget.cs index 9f20e1da0c..cc332abb8d 100644 --- a/osu.Game.Modes.Taiko/UI/HitTarget.cs +++ b/osu.Game.Modes.Taiko/UI/HitTarget.cs @@ -39,35 +39,27 @@ namespace osu.Game.Modes.Taiko.UI new Box { Name = "Bar Upper", - Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Y = border_offset, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - finisher_diameter) / 2f - border_offset), - Alpha = 0.1f }, new CircularContainer { Name = "Finisher Ring", - Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(finisher_diameter), - + Masking = true, BorderColour = Color4.White, BorderThickness = 2, Alpha = 0.1f, - Children = new[] { new Box { RelativeSizeAxes = Axes.Both, - Alpha = 0, AlwaysPresent = true } @@ -76,22 +68,18 @@ namespace osu.Game.Modes.Taiko.UI new CircularContainer { Name = "Normal Ring", - Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(normal_diameter), - + Masking = true, BorderColour = Color4.White, BorderThickness = 2, Alpha = 0.5f, - Children = new[] { new Box { RelativeSizeAxes = Axes.Both, - Alpha = 0, AlwaysPresent = true } @@ -100,14 +88,10 @@ namespace osu.Game.Modes.Taiko.UI new Box { Name = "Bar Lower", - Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Y = -border_offset, - Size = new Vector2(3, (TaikoPlayfield.PlayfieldHeight - 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 607fd205bb..b763b53aa2 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -29,25 +29,18 @@ namespace osu.Game.Modes.Taiko.UI new TaikoHalfDrum(false) { Name = "Left Half", - Anchor = Anchor.Centre, Origin = Anchor.CentreRight, - RelativeSizeAxes = Axes.Both, - Keys = new List(new[] { Key.F, Key.D }) }, new TaikoHalfDrum(true) { Name = "Right Half", - Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - Position = new Vector2(-1f, 0), - Keys = new List(new[] { Key.J, Key.K }) } }; @@ -81,25 +74,20 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both }, outerHit = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Alpha = 0, - BlendingMode = BlendingMode.Additive }, inner = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, Size = new Vector2(0.7f) }, @@ -107,12 +95,9 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, Size = new Vector2(0.7f), - Alpha = 0, - BlendingMode = BlendingMode.Additive } }; diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index 5156020931..8d86e880d6 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -40,31 +40,24 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.Centre, Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] { new BufferedContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - BlurSigma = new Vector2(10), CacheDrawnFrameBuffer = true, - RelativeSizeAxes = Axes.Both, Size = new Vector2(3), - BlendingMode = BlendingMode.Additive, - Children = new[] { glowText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = "Venera", TextSize = 22f, } @@ -74,7 +67,6 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = "Venera", TextSize = 22f, } diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/RingExplosion.cs index 6400b0d573..2bc1d2d3eb 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/RingExplosion.cs @@ -39,6 +39,7 @@ namespace osu.Game.Modes.Taiko.UI BorderThickness = 1; Alpha = 0.15f; + Masking = true; Children = new[] { From bf94587ca7d925e0da4f535fff476d7616631114 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 10:56:30 +0900 Subject: [PATCH 041/103] Add TODO. --- osu.Game.Modes.Taiko/Objects/DrumRoll.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs index 78e9202f20..cdb8ef2405 100644 --- a/osu.Game.Modes.Taiko/Objects/DrumRoll.cs +++ b/osu.Game.Modes.Taiko/Objects/DrumRoll.cs @@ -62,6 +62,7 @@ namespace osu.Game.Modes.Taiko.Objects Velocity = timing.SliderVelocityAt(StartTime) * difficulty.SliderMultiplier / 1000; 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 @@ -100,4 +101,4 @@ namespace osu.Game.Modes.Taiko.Objects return ret; } } -} \ No newline at end of file +} From 5daa5745517eba9a7afc5595ba562b70aa9bd289 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:05:58 +0900 Subject: [PATCH 042/103] Don't set lifetime until LoadComplete (fixes possible clock nullref if added without a clock). --- .../Objects/Drawable/DrawableTaikoHitObject.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs index 864a7b80a6..ebad53e787 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHitObject.cs @@ -16,9 +16,14 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable Origin = Anchor.Centre; RelativePositionAxes = Axes.X; + } + protected override void LoadComplete() + { LifetimeStart = HitObject.StartTime - HitObject.PreEmpt * 2; LifetimeEnd = HitObject.StartTime + HitObject.PreEmpt; + + base.LoadComplete(); } protected override TaikoJudgementInfo CreateJudgementInfo() => new TaikoJudgementInfo(); From db8bf8a78fbd8377a06f1197a80a7f8d6c055eed Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:21:45 +0900 Subject: [PATCH 043/103] Add Hit class, make TaikoHitObject abstract. --- osu.Game.Modes.Taiko/Objects/Hit.cs | 35 +++++++++++++++++++ .../Objects/TaikoHitObject.cs | 23 ++---------- .../osu.Game.Modes.Taiko.csproj | 1 + 3 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 osu.Game.Modes.Taiko/Objects/Hit.cs diff --git a/osu.Game.Modes.Taiko/Objects/Hit.cs b/osu.Game.Modes.Taiko/Objects/Hit.cs new file mode 100644 index 0000000000..ad8d07d901 --- /dev/null +++ b/osu.Game.Modes.Taiko/Objects/Hit.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.Game.Beatmaps.Timing; +using osu.Game.Database; + +namespace osu.Game.Modes.Taiko.Objects +{ + public class Hit : TaikoHitObject + { + /// + /// The hit window that results in a "GREAT" hit. + /// + public double HitWindowGreat = 35; + + /// + /// The hit window that results in a "GOOD" hit. + /// + public double HitWindowGood = 80; + + /// + /// The hit window that results in a "MISS". + /// + public double HitWindowMiss = 95; + + public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) + { + base.ApplyDefaults(timing, difficulty); + + HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20); + HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50); + HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70); + } + } +} diff --git a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs index 61d8ed5f01..4505065489 100644 --- a/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Modes.Taiko/Objects/TaikoHitObject.cs @@ -7,28 +7,13 @@ using osu.Game.Modes.Objects; namespace osu.Game.Modes.Taiko.Objects { - public class TaikoHitObject : HitObject + public abstract class TaikoHitObject : HitObject { /// /// HitCircle radius. /// public const float CIRCLE_RADIUS = 64; - /// - /// The hit window that results in a "GREAT" hit. - /// - public double HitWindowGreat = 35; - - /// - /// The hit window that results in a "GOOD" hit. - /// - public double HitWindowGood = 80; - - /// - /// The hit window that results in a "MISS". - /// - public double HitWindowMiss = 95; - /// /// The time to scroll in the HitObject. /// @@ -37,7 +22,7 @@ namespace osu.Game.Modes.Taiko.Objects /// /// Whether this HitObject is in Kiai time. /// - public bool Kiai; + public bool Kiai { get; protected set; } public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty) { @@ -50,10 +35,6 @@ namespace osu.Game.Modes.Taiko.Objects if (overridePoint != null) Kiai |= overridePoint.KiaiMode; - - HitWindowGreat = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 50, 35, 20); - HitWindowGood = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 120, 80, 50); - HitWindowMiss = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 135, 95, 70); } } } \ No newline at end of file diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 8c3bd1b438..de6444dd5f 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -54,6 +54,7 @@ + From b77b039d73dfd867e7aac68e930fd9e4edca9f7f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 11:25:38 +0900 Subject: [PATCH 044/103] Don't instantiate TaikoHitObject. --- 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 06c0b6c994..0606ee4d5a 100644 --- a/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs +++ b/osu.Game.Modes.Taiko/Beatmaps/TaikoBeatmapConverter.cs @@ -66,7 +66,7 @@ namespace osu.Game.Modes.Taiko.Beatmaps }; } - return new TaikoHitObject + return new Hit { StartTime = original.StartTime, Sample = original.Sample, From 8b71d70633292c97c6a2d75e3697709a0d23035d Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:21:09 +0900 Subject: [PATCH 045/103] Add a way to get the score string from JugementInfo. --- .../Judgements/CatchJudgementInfo.cs | 3 +++ .../Judgements/ManiaJudgementInfo.cs | 3 +++ .../Judgements/OsuJudgementInfo.cs | 5 ++++ .../Judgements/TaikoHitResult.cs | 4 +++ .../Judgements/TaikoJudgementInfo.cs | 5 ++++ osu.Game/Modes/Judgements/JudgementInfo.cs | 25 +++++++++++++++++-- 6 files changed, 43 insertions(+), 2 deletions(-) diff --git a/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs b/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs index 33e84d2f97..53e0c6c0bf 100644 --- a/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs +++ b/osu.Game.Modes.Catch/Judgements/CatchJudgementInfo.cs @@ -7,5 +7,8 @@ namespace osu.Game.Modes.Catch.Judgements { public class CatchJudgementInfo : JudgementInfo { + public override string ScoreString => string.Empty; + + public override string MaxScoreString => string.Empty; } } diff --git a/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs b/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs index a75f95abe7..c65bd87b6b 100644 --- a/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs +++ b/osu.Game.Modes.Mania/Judgements/ManiaJudgementInfo.cs @@ -7,5 +7,8 @@ namespace osu.Game.Modes.Mania.Judgements { public class ManiaJudgementInfo : JudgementInfo { + public override string ScoreString => string.Empty; + + public override string MaxScoreString => string.Empty; } } diff --git a/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs b/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs index 20d36efe55..b945bad8a1 100644 --- a/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs +++ b/osu.Game.Modes.Osu/Judgements/OsuJudgementInfo.cs @@ -4,6 +4,7 @@ using OpenTK; using osu.Game.Modes.Judgements; using osu.Game.Modes.Osu.Objects.Drawables; +using osu.Framework.Extensions; namespace osu.Game.Modes.Osu.Judgements { @@ -24,6 +25,10 @@ namespace osu.Game.Modes.Osu.Judgements /// public OsuScoreResult MaxScore = OsuScoreResult.Hit300; + public override string ScoreString => Score.GetDescription(); + + public override string MaxScoreString => MaxScore.GetDescription(); + public int ScoreValue => scoreToInt(Score); public int MaxScoreValue => scoreToInt(MaxScore); diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs b/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs index d425616b66..cbc3919c4f 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoHitResult.cs @@ -1,11 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.ComponentModel; + namespace osu.Game.Modes.Taiko.Judgements { public enum TaikoHitResult { + [Description("GOOD")] Good, + [Description("GREAT")] Great } } diff --git a/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs b/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs index d9e81d4d77..3312661e2a 100644 --- a/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs +++ b/osu.Game.Modes.Taiko/Judgements/TaikoJudgementInfo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Modes.Judgements; +using osu.Framework.Extensions; namespace osu.Game.Modes.Taiko.Judgements { @@ -37,6 +38,10 @@ namespace osu.Game.Modes.Taiko.Judgements /// public int MaxAccuracyScoreValue => NumericResultForAccuracy(MAX_HIT_RESULT); + public override string ScoreString => TaikoResult.GetDescription(); + + public override string MaxScoreString => MAX_HIT_RESULT.GetDescription(); + /// /// Whether this Judgement has a secondary hit in the case of finishers. /// diff --git a/osu.Game/Modes/Judgements/JudgementInfo.cs b/osu.Game/Modes/Judgements/JudgementInfo.cs index 8e7539134e..a3cb9ba51f 100644 --- a/osu.Game/Modes/Judgements/JudgementInfo.cs +++ b/osu.Game/Modes/Judgements/JudgementInfo.cs @@ -5,10 +5,31 @@ using osu.Game.Modes.Objects.Drawables; namespace osu.Game.Modes.Judgements { - public class JudgementInfo + public abstract class JudgementInfo { - public ulong? ComboAtHit; + /// + /// Whether this judgement is the result of a hit or a miss. + /// public HitResult? Result; + + /// + /// The offset at which this judgement occurred. + /// public double TimeOffset; + + /// + /// The combo after this judgement was processed. + /// + public ulong? ComboAtHit; + + /// + /// The string representation for the score achieved. + /// + public abstract string ScoreString { get; } + + /// + /// The string representation for the max score achievable. + /// + public abstract string MaxScoreString { get; } } } \ No newline at end of file From c173c4b7eeecb67c60026e7470ef2a360e7843da Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 00:22:31 -0300 Subject: [PATCH 046/103] Tab control --- .../Tests/TestCaseBeatmapDetailArea.cs | 27 ++++ .../osu.Desktop.VisualTests.csproj | 1 + .../Graphics/UserInterface/OsuTabControl.cs | 4 +- .../UserInterface/OsuTabControlCheckBox.cs | 134 ++++++++++++++++++ osu.Game/Screens/Select/BeatmapDetailArea.cs | 27 ++++ .../Select/BeatmapDetailAreaTabControl.cs | 75 ++++++++++ osu.Game/osu.Game.csproj | 3 + 7 files changed, 270 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs create mode 100644 osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs create mode 100644 osu.Game/Screens/Select/BeatmapDetailArea.cs create mode 100644 osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs new file mode 100644 index 0000000000..59859f3f29 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Screens.Select; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatmapDetailArea : TestCase + { + public override string Description => @"Beatmap details in song select"; + + public override void Reset() + { + base.Reset(); + + Add(new BeatmapDetailArea + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(550f, 450f), + }); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index b67b4c4bb3..9ca82c9867 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -206,6 +206,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 8283c1baa0..ad8c17587a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -28,6 +28,8 @@ namespace osu.Game.Graphics.UserInterface public OsuTabControl() { + TabContainer.Spacing = new Vector2(10f, 0f); + if (!typeof(T).IsEnum) throw new InvalidOperationException("OsuTabControl only supports enums as the generic type argument"); @@ -142,7 +144,7 @@ namespace osu.Game.Graphics.UserInterface { text = new OsuSpriteText { - Margin = new MarginPadding(5), + Margin = new MarginPadding { Top = 5, Bottom = 5 }, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, TextSize = 14, diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs new file mode 100644 index 0000000000..7d86136fd5 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -0,0 +1,134 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A checkbox styled to be placed in line with an + /// + public class OsuTabControlCheckBox : CheckBox + { + private const float transition_length = 500; + + public event EventHandler Action; + + private Color4 accentColour; + public Color4 AccentColour + { + get { return accentColour; } + set + { + accentColour = value; + + if (State == CheckBoxState.Unchecked) + { + text.Colour = accentColour; + icon.Colour = accentColour; + } + } + } + + public string Text + { + get { return text.Text; } + set { text.Text = value; } + } + + private Box box; + private SpriteText text; + private TextAwesome icon; + + private void fadeIn() + { + box.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + } + + private void fadeOut() + { + box.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeColour(accentColour, transition_length, EasingTypes.OutQuint); + } + + protected override void OnChecked() + { + fadeIn(); + icon.Icon = FontAwesome.fa_check_circle_o; + Action?.Invoke(this, State); + } + + protected override void OnUnchecked() + { + fadeOut(); + icon.Icon = FontAwesome.fa_circle_o; + Action?.Invoke(this, State); + } + + protected override bool OnHover(InputState state) + { + fadeIn(); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (State == CheckBoxState.Unchecked) + fadeOut(); + + base.OnHoverLost(state); + } + + public OsuTabControlCheckBox() + { + AutoSizeAxes = Axes.Both; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Margin = new MarginPadding { Top = 5, Bottom = 5, }, + Spacing = new Vector2(5f, 0f), + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + text = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + icon = new TextAwesome + { + TextSize = 14, + Icon = FontAwesome.fa_circle_o, + Shadow = true, + }, + }, + }, + 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/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs new file mode 100644 index 0000000000..f576e47780 --- /dev/null +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -0,0 +1,27 @@ +// 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; + +namespace osu.Game.Screens.Select +{ + public class BeatmapDetailArea : Container + { + public BeatmapDetailArea() + { + Children = new Drawable[] + { + new BeatmapDetailAreaTabControl + { + RelativeSizeAxes = Axes.X, + }, + new Container + { + Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs new file mode 100644 index 0000000000..be3fd43184 --- /dev/null +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -0,0 +1,75 @@ +// 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.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Select +{ + public class BeatmapDetailAreaTabControl : Container + { + public static readonly float HEIGHT = 24; + private OsuTabControlCheckBox modsCheckbox; + private OsuTabControl tabs; + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; + } + + public BeatmapDetailAreaTabControl() + { + Height = HEIGHT; + + Children = new Drawable[] + { + new Box + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + Height = 1, + Colour = Color4.White.Opacity(0.2f), + }, + tabs = new OsuTabControl + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.Both, + }, + modsCheckbox = new OsuTabControlCheckBox + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Text = @"Mods", + }, + }; + + tabs.ItemChanged += (sender, e) => + { + + }; + + modsCheckbox.Action += (sender, e) => + { + + }; + } + } + + public enum BeatmapDetailTab + { + Details, + Local, + Country, + Global, + Friends + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index bfb787cd51..25c96966d9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -362,6 +362,9 @@ + + + From 87b8015e8f08a4836023382b5b5c024d7f3511d9 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 00:29:28 -0300 Subject: [PATCH 047/103] Cleanup --- .../UserInterface/OsuTabControlCheckBox.cs | 51 +++++++++++-------- osu.Game/Screens/Select/BeatmapDetailArea.cs | 10 ++-- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index 7d86136fd5..dbdef991f7 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -22,22 +22,24 @@ namespace osu.Game.Graphics.UserInterface /// public class OsuTabControlCheckBox : CheckBox { - private const float transition_length = 500; + private Box box; + private SpriteText text; + private TextAwesome icon; public event EventHandler Action; - private Color4 accentColour; + private Color4? accentColour; public Color4 AccentColour { - get { return accentColour; } + get { return accentColour.GetValueOrDefault(); } set { accentColour = value; - if (State == CheckBoxState.Unchecked) + if (State != CheckBoxState.Checked) { - text.Colour = accentColour; - icon.Colour = accentColour; + text.Colour = AccentColour; + icon.Colour = AccentColour; } } } @@ -48,22 +50,6 @@ namespace osu.Game.Graphics.UserInterface set { text.Text = value; } } - private Box box; - private SpriteText text; - private TextAwesome icon; - - private void fadeIn() - { - box.FadeIn(transition_length, EasingTypes.OutQuint); - text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); - } - - private void fadeOut() - { - box.FadeOut(transition_length, EasingTypes.OutQuint); - text.FadeColour(accentColour, transition_length, EasingTypes.OutQuint); - } - protected override void OnChecked() { fadeIn(); @@ -78,6 +64,20 @@ namespace osu.Game.Graphics.UserInterface Action?.Invoke(this, State); } + private const float transition_length = 500; + + private void fadeIn() + { + box.FadeIn(transition_length, EasingTypes.OutQuint); + text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint); + } + + private void fadeOut() + { + box.FadeOut(transition_length, EasingTypes.OutQuint); + text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint); + } + protected override bool OnHover(InputState state) { fadeIn(); @@ -92,6 +92,13 @@ namespace osu.Game.Graphics.UserInterface base.OnHoverLost(state); } + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + if (accentColour == null) + AccentColour = colours.Blue; + } + public OsuTabControlCheckBox() { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index f576e47780..27706a4112 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -9,19 +9,23 @@ namespace osu.Game.Screens.Select { public class BeatmapDetailArea : Container { + private Container content; + protected override Container Content => content; + public BeatmapDetailArea() { - Children = new Drawable[] + AddInternal(new Drawable[] { new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, }, - new Container + content = new Container { + RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, }, - }; + }); } } } From c9fe9e681d561d4a47e118668f29a1e30f8b6b5c Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:49:28 +0900 Subject: [PATCH 048/103] Make judgement text generic to be used between game modes. --- .../Objects/Drawables/HitExplosion.cs | 66 ++------------ osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 6 +- .../Modes/Judgements/DrawableJudgementInfo.cs | 86 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 4 files changed, 98 insertions(+), 61 deletions(-) create mode 100644 osu.Game/Modes/Judgements/DrawableJudgementInfo.cs diff --git a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs index ab34d49ecf..ddc394f57f 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs @@ -1,85 +1,31 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics.Sprites; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Osu.Judgements; using OpenTK; -using OpenTK.Graphics; +using osu.Game.Modes.Judgements; namespace osu.Game.Modes.Osu.Objects.Drawables { - public class HitExplosion : FillFlowContainer + public class HitExplosion : DrawableJudgementInfo { - private readonly OsuJudgementInfo judgement; - private SpriteText line1; - private SpriteText line2; - - public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null) + public HitExplosion(OsuJudgementInfo judgement) + : base(judgement) { - this.judgement = judgement; - AutoSizeAxes = Axes.Both; - Origin = Anchor.Centre; - - Direction = FillDirection.Vertical; - Spacing = new Vector2(0, 2); - Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset; - - Children = new Drawable[] - { - line1 = new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = judgement.Score.GetDescription(), - Font = @"Venera", - TextSize = 16, - }, - line2 = new OsuSpriteText - { - Text = judgement.Combo.GetDescription(), - Font = @"Venera", - TextSize = 11, - } - }; } protected override void LoadComplete() { base.LoadComplete(); - if (judgement.Result == HitResult.Miss) + if (Judgement.Result != HitResult.Miss) { - FadeInFromZero(60); - - ScaleTo(1.6f); - ScaleTo(1, 100, EasingTypes.In); - - MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); - RotateTo(40, 800, EasingTypes.InQuint); - - Delay(600); - FadeOut(200); - } - else - { - line1.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); - line2.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); + JudgementText.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint); FadeOut(500); } - switch (judgement.Result) - { - case HitResult.Miss: - Colour = Color4.Red; - break; - } - Expire(); } } diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 5caaaafb13..bd9b4982eb 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -85,7 +85,11 @@ namespace osu.Game.Modes.Osu.UI public override void OnJudgement(DrawableHitObject judgedObject) { - HitExplosion explosion = new HitExplosion(judgedObject.Judgement, judgedObject.HitObject); + HitExplosion explosion = new HitExplosion(judgedObject.Judgement) + { + Origin = Anchor.Centre, + Position = judgedObject.HitObject.StackedEndPosition + judgedObject.Judgement.PositionOffset + }; judgementLayer.Add(explosion); } diff --git a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs new file mode 100644 index 0000000000..fb85e20da0 --- /dev/null +++ b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs @@ -0,0 +1,86 @@ +// 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.Extensions; +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.Graphics.Sprites; +using osu.Game.Modes.Objects.Drawables; + +namespace osu.Game.Modes.Judgements +{ + /// + /// A drawable object which visualises the hit result of a . + /// + /// The type of judgement to visualise. + public class DrawableJudgementInfo : Container + where TJudgement : JudgementInfo + { + protected readonly TJudgement Judgement; + + protected readonly SpriteText JudgementText; + + /// + /// Creates a drawable which visualises a . + /// + /// The judgement to visualise. + public DrawableJudgementInfo(TJudgement judgement) + { + Judgement = judgement; + + AutoSizeAxes = Axes.Both; + + string scoreString = judgement.Result == HitResult.Hit ? judgement.ScoreString : judgement.Result.GetDescription(); + + Children = new[] + { + JudgementText = new OsuSpriteText + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Text = scoreString.ToUpper(), + Font = @"Venera", + TextSize = 16 + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + switch (Judgement.Result) + { + case HitResult.Miss: + Colour = colours.Red; + break; + } + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + if (Judgement.Result == HitResult.Miss) + { + FadeInFromZero(60); + + ScaleTo(1.6f); + ScaleTo(1, 100, EasingTypes.In); + + MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint); + RotateTo(40, 800, EasingTypes.InQuint); + + Delay(600); + FadeOut(200); + } + + Expire(); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index bfb787cd51..164c8c7ec1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -96,6 +96,7 @@ + From 39ff026b2787519466633f915a90644fc56f6934 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:49:58 +0900 Subject: [PATCH 049/103] Reimplement JudgementText with the new DrawableJudgementInfo. --- osu.Game.Modes.Taiko/UI/JudgementText.cs | 90 ++++------------------- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 4 +- 2 files changed, 15 insertions(+), 79 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index 8d86e880d6..ae7bd6b596 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -11,115 +11,53 @@ using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Objects.Drawables; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes.Judgements; namespace osu.Game.Modes.Taiko.UI { /// /// Text that is shown as judgement when a hit object is hit or missed. /// - public class JudgementText : Container + public class JudgementText : DrawableJudgementInfo { /// - /// The Judgement to display. + /// Creates a new judgement text. /// - public TaikoJudgementInfo Judgement; - - private Container textContainer; - private OsuSpriteText glowText; - private OsuSpriteText normalText; - - private int movementDirection; - - public JudgementText() + /// The judgement to visualise. + public JudgementText(TaikoJudgementInfo judgement) + : base(judgement) { - AutoSizeAxes = Axes.Both; - - Children = new Drawable[] - { - textContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new BufferedContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - BlurSigma = new Vector2(10), - CacheDrawnFrameBuffer = true, - RelativeSizeAxes = Axes.Both, - Size = new Vector2(3), - BlendingMode = BlendingMode.Additive, - Children = new[] - { - glowText = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = "Venera", - TextSize = 22f, - } - } - }, - normalText = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Font = "Venera", - TextSize = 22f, - } - } - } - }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - Color4 judgementColour = Color4.White; - string judgementText = string.Empty; - switch (Judgement.Result) { - case HitResult.Miss: - judgementColour = colours.Red; - judgementText = "MISS"; - movementDirection = 1; - break; case HitResult.Hit: switch (Judgement.TaikoResult) { case TaikoHitResult.Good: - judgementColour = colours.Green; - judgementText = "GOOD"; - textContainer.Scale = new Vector2(0.45f); + Colour = colours.Green; break; case TaikoHitResult.Great: - judgementColour = colours.Blue; - judgementText = "GREAT"; + Colour = colours.Blue; break; } - - movementDirection = -1; break; } - - glowText.Colour = judgementColour; - glowText.Text = normalText.Text = judgementText; } protected override void LoadComplete() { base.LoadComplete(); - ScaleTo(1.5f, 250, EasingTypes.OutQuint); - MoveToY(movementDirection * 100, 500); - - Delay(250); - ScaleTo(0.75f, 250); - FadeOut(250); + if (Judgement.Result == HitResult.Hit) + { + MoveToY(-100, 500); + Delay(250); + FadeOut(250); + } Expire(); } diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index b2248e2c3e..d93f45cc3b 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -192,15 +192,13 @@ namespace osu.Game.Modes.Taiko.UI float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; - judgementContainer.Add(new JudgementText + judgementContainer.Add(new JudgementText(judgedObject.Judgement) { Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, RelativePositionAxes = Axes.X, X = judgementOffset, - - Judgement = judgedObject.Judgement }); } } From 7f33e10db07ec893051d512b4153f4f53ec13ea0 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:53:38 +0900 Subject: [PATCH 050/103] Renaming + don't use List. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 58 +++++++++++++++------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index b763b53aa2..e69ae68e03 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -32,7 +32,8 @@ namespace osu.Game.Modes.Taiko.UI Anchor = Anchor.Centre, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, - Keys = new List(new[] { Key.F, Key.D }) + RimKey = Key.D, + CentreKey = Key.F }, new TaikoHalfDrum(true) { @@ -41,7 +42,8 @@ namespace osu.Game.Modes.Taiko.UI Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, Position = new Vector2(-1f, 0), - Keys = new List(new[] { Key.J, Key.K }) + RimKey = Key.K, + CentreKey = Key.J } }; } @@ -52,17 +54,19 @@ namespace osu.Game.Modes.Taiko.UI private class TaikoHalfDrum : Container { /// - /// A list of keys which this half-drum accepts. - /// - /// [0] => Inner key, [1] => Outer key - /// + /// The key to be used for the rim of the half-drum. /// - public List Keys = new List(); + public Key RimKey; + + /// + /// The key to be used for the centre of the half-drum. + /// + public Key CentreKey; - private Sprite outer; - private Sprite outerHit; - private Sprite inner; - private Sprite innerHit; + private Sprite rim; + private Sprite rimHit; + private Sprite centre; + private Sprite centreHit; public TaikoHalfDrum(bool flipped) { @@ -70,13 +74,13 @@ namespace osu.Game.Modes.Taiko.UI Children = new Drawable[] { - outer = new Sprite + rim = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both }, - outerHit = new Sprite + rimHit = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, @@ -84,14 +88,14 @@ namespace osu.Game.Modes.Taiko.UI Alpha = 0, BlendingMode = BlendingMode.Additive }, - inner = new Sprite + centre = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.7f) }, - innerHit = new Sprite + centreHit = new Sprite { Anchor = flipped ? Anchor.CentreLeft : Anchor.CentreRight, Origin = Anchor.Centre, @@ -106,13 +110,13 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(TextureStore textures, OsuColour colours) { - outer.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); - outerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); - inner.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); - innerHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); + rim.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer"); + rimHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-outer-hit"); + centre.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner"); + centreHit.Texture = textures.Get(@"Play/Taiko/taiko-drum-inner-hit"); - outerHit.Colour = colours.Blue; - innerHit.Colour = colours.Pink; + rimHit.Colour = colours.Blue; + centreHit.Colour = colours.Pink; } protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) @@ -120,16 +124,16 @@ namespace osu.Game.Modes.Taiko.UI if (args.Repeat) return false; - if (args.Key == Keys[0]) + if (args.Key == CentreKey) { - innerHit.FadeIn(); - innerHit.FadeOut(500, EasingTypes.OutQuint); + centreHit.FadeIn(); + centreHit.FadeOut(500, EasingTypes.OutQuint); } - if (args.Key == Keys[1]) + if (args.Key == RimKey) { - outerHit.FadeIn(); - outerHit.FadeOut(500, EasingTypes.OutQuint); + rimHit.FadeIn(); + rimHit.FadeOut(500, EasingTypes.OutQuint); } return false; From 00054f15737fe4ce0b68acaa9be202e728af2bc1 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 12:56:32 +0900 Subject: [PATCH 051/103] Comment out unused container for now. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index d93f45cc3b..38100df38d 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -51,8 +51,7 @@ namespace osu.Game.Modes.Taiko.UI private Container judgementContainer; private Container hitObjectContainer; - // ReSharper disable once NotAccessedField.Local - private Container topLevelHitContainer; + //private Container topLevelHitContainer; private Container leftBackgroundContainer; private Container rightBackgroundContainer; private Box leftBackground; @@ -156,10 +155,10 @@ namespace osu.Game.Modes.Taiko.UI }, } }, - topLevelHitContainer = new Container - { - RelativeSizeAxes = Axes.Both, - } + //topLevelHitContainer = new Container + //{ + // RelativeSizeAxes = Axes.Both, + //} }); } From cedcab1e2651a971f20a05ccb6d791f00ebcea70 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:02:01 +0900 Subject: [PATCH 052/103] s/Ring/Hit + privatize Judgement inside RingExplosion. --- .../UI/{RingExplosion.cs => HitExplosion.cs} | 18 ++++++++---------- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 9 +++------ .../osu.Game.Modes.Taiko.csproj | 2 +- 3 files changed, 12 insertions(+), 17 deletions(-) rename osu.Game.Modes.Taiko/UI/{RingExplosion.cs => HitExplosion.cs} (79%) diff --git a/osu.Game.Modes.Taiko/UI/RingExplosion.cs b/osu.Game.Modes.Taiko/UI/HitExplosion.cs similarity index 79% rename from osu.Game.Modes.Taiko/UI/RingExplosion.cs rename to osu.Game.Modes.Taiko/UI/HitExplosion.cs index 2bc1d2d3eb..c3059ef713 100644 --- a/osu.Game.Modes.Taiko/UI/RingExplosion.cs +++ b/osu.Game.Modes.Taiko/UI/HitExplosion.cs @@ -15,19 +15,17 @@ using osu.Game.Modes.Taiko.Objects; namespace osu.Game.Modes.Taiko.UI { /// - /// A ring that explodes to indicate a judgement has occurred. + /// A circle explodes from the hit target to indicate a hitobject has been hit. /// - internal class RingExplosion : CircularContainer + internal class HitExplosion : CircularContainer { - /// - /// The Judgement to display. - /// - public TaikoJudgementInfo Judgement; - + private TaikoJudgementInfo judgement; private Box innerFill; - public RingExplosion() + public HitExplosion(TaikoJudgementInfo judgement) { + this.judgement = judgement; + Size = new Vector2(TaikoHitObject.CIRCLE_RADIUS * 2); Anchor = Anchor.Centre; @@ -53,10 +51,10 @@ namespace osu.Game.Modes.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - if (Judgement.SecondHit) + if (judgement.SecondHit) Size *= 1.5f; - switch (Judgement.TaikoResult) + switch (judgement.TaikoResult) { case TaikoHitResult.Good: innerFill.Colour = colours.Green; diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 38100df38d..77fe511108 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -46,7 +46,7 @@ namespace osu.Game.Modes.Taiko.UI protected override Container Content => hitObjectContainer; - private Container ringExplosionContainer; + private Container hitExplosionContainer; //private Container barLineContainer; private Container judgementContainer; @@ -96,7 +96,7 @@ namespace osu.Game.Modes.Taiko.UI RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - ringExplosionContainer = new Container + hitExplosionContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, @@ -183,10 +183,7 @@ namespace osu.Game.Modes.Taiko.UI { if (judgedObject.Judgement.Result == HitResult.Hit) { - ringExplosionContainer.Add(new RingExplosion - { - Judgement = judgedObject.Judgement - }); + hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement)); } float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0; diff --git a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj index 2bd9ddc327..6c97ed3391 100644 --- a/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj +++ b/osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj @@ -62,7 +62,7 @@ - + From aa2b22ff1222356d02f58765916f92f08639332f Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:02:34 +0900 Subject: [PATCH 053/103] Fix usings. --- osu.Game.Modes.Taiko/UI/InputDrum.cs | 1 - osu.Game.Modes.Taiko/UI/JudgementText.cs | 6 ------ osu.Game/Modes/Judgements/DrawableJudgementInfo.cs | 1 - 3 files changed, 8 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/InputDrum.cs b/osu.Game.Modes.Taiko/UI/InputDrum.cs index e69ae68e03..580b67a03d 100644 --- a/osu.Game.Modes.Taiko/UI/InputDrum.cs +++ b/osu.Game.Modes.Taiko/UI/InputDrum.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using osu.Game.Graphics; -using System.Collections.Generic; namespace osu.Game.Modes.Taiko.UI { diff --git a/osu.Game.Modes.Taiko/UI/JudgementText.cs b/osu.Game.Modes.Taiko/UI/JudgementText.cs index ae7bd6b596..06368d6d2c 100644 --- a/osu.Game.Modes.Taiko/UI/JudgementText.cs +++ b/osu.Game.Modes.Taiko/UI/JudgementText.cs @@ -1,12 +1,6 @@ // 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.Transforms; -using osu.Game.Graphics.Sprites; -using OpenTK; -using OpenTK.Graphics; using osu.Game.Modes.Taiko.Judgements; using osu.Game.Modes.Objects.Drawables; using osu.Framework.Allocation; diff --git a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs b/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs index fb85e20da0..0eadec42d8 100644 --- a/osu.Game/Modes/Judgements/DrawableJudgementInfo.cs +++ b/osu.Game/Modes/Judgements/DrawableJudgementInfo.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.Extensions; using osu.Framework.Graphics; From 677b8afc1f16c8a44acdda432735c2d507009dd2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:19:29 -0300 Subject: [PATCH 054/103] Integration --- osu.Game/Screens/Select/BeatmapDetailArea.cs | 61 +++++++++++++++++++ .../Select/BeatmapDetailAreaTabControl.cs | 20 +++--- .../Select/Leaderboards/Leaderboard.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 19 ++---- 4 files changed, 77 insertions(+), 25 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 27706a4112..ff66605c76 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -1,17 +1,36 @@ // 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.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Transforms; +using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests; +using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select { public class BeatmapDetailArea : Container { + private const float transition_duration = 500; + private Container content; protected override Container Content => content; + public readonly Container Details; //todo: replace with a real details view when added + public readonly Leaderboard Leaderboard; + + private OsuGame game; + + [BackgroundDependencyLoader(permitNulls: true)] + private void load(OsuGame game) + { + this.game = game; + } + public BeatmapDetailArea() { AddInternal(new Drawable[] @@ -19,6 +38,21 @@ namespace osu.Game.Screens.Select new BeatmapDetailAreaTabControl { RelativeSizeAxes = Axes.X, + OnFilter = (tab, mods) => + { + switch (tab) + { + case BeatmapDetailTab.Details: + Details.FadeIn(transition_duration, EasingTypes.OutQuint); + Leaderboard.FadeOut(transition_duration, EasingTypes.OutQuint); + break; + + default: + Details.FadeOut(transition_duration, EasingTypes.OutQuint); + Leaderboard.FadeIn(transition_duration, EasingTypes.OutQuint); + break; + } + }, }, content = new Container { @@ -26,6 +60,33 @@ namespace osu.Game.Screens.Select Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT }, }, }); + + Add(new Drawable[] + { + Details = new Container + { + RelativeSizeAxes = Axes.Both, + }, + Leaderboard = new Leaderboard + { + RelativeSizeAxes = Axes.Both, + } + }); + } + + private GetScoresRequest getScoresRequest; + public void PresentScores(WorkingBeatmap beatmap) + { + if (game == null) return; + + Leaderboard.Scores = null; + getScoresRequest?.Cancel(); + + if (beatmap?.BeatmapInfo == null) return; + + getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); + getScoresRequest.Success += r => Leaderboard.Scores = r.Scores; + game.API.Queue(getScoresRequest); } } } diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index be3fd43184..1345fc7a6a 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK.Graphics; 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.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -18,6 +20,13 @@ namespace osu.Game.Screens.Select private OsuTabControlCheckBox modsCheckbox; private 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); + } + [BackgroundDependencyLoader] private void load(OsuColour colour) { @@ -52,15 +61,8 @@ namespace osu.Game.Screens.Select }, }; - tabs.ItemChanged += (sender, e) => - { - - }; - - modsCheckbox.Action += (sender, e) => - { - - }; + tabs.ItemChanged += (sender, e) => invokeOnFilter(); + modsCheckbox.Action += (sender, e) => invokeOnFilter(); } } diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index 20e6db6241..18691f011f 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Select.Leaderboards RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 5f), - Padding = new MarginPadding(5), + Padding = new MarginPadding { Top = 10, Bottom = 5 }, }, }, }, diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index c5c8543e6b..7d73b17c8e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select { private OsuScreen player; private ModSelectOverlay modSelect; - private Leaderboard leaderboard; + private BeatmapDetailArea beatmapDetails; public PlaySongSelect() { @@ -32,9 +32,10 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Bottom = 50 } }); - LeftContent.Add(leaderboard = new Leaderboard + LeftContent.Add(beatmapDetails = new BeatmapDetailArea { RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = 5, Right = 5 }, }); } @@ -58,23 +59,11 @@ namespace osu.Game.Screens.Select { beatmap?.Mods.BindTo(modSelect.SelectedMods); - updateLeaderboard(beatmap); + beatmapDetails.PresentScores(beatmap); base.OnBeatmapChanged(beatmap); } - private void updateLeaderboard(WorkingBeatmap beatmap) - { - leaderboard.Scores = null; - getScoresRequest?.Cancel(); - - if (beatmap?.BeatmapInfo == null) return; - - getScoresRequest = new GetScoresRequest(beatmap.BeatmapInfo); - getScoresRequest.Success += r => leaderboard.Scores = r.Scores; - Game.API.Queue(getScoresRequest); - } - protected override void OnResuming(Screen last) { player = null; From 8e1eef25b4bffd9af63fa14ecb879df2e8180774 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Thu, 23 Mar 2017 13:20:17 +0900 Subject: [PATCH 055/103] Fix some lone newlines. --- osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs index 77fe511108..0ab31606eb 100644 --- a/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Modes.Taiko/UI/TaikoPlayfield.cs @@ -140,10 +140,8 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativePositionAxes = Axes.X, Position = new Vector2(0.10f, 0), - Scale = new Vector2(0.9f) }, new Box @@ -192,7 +190,6 @@ namespace osu.Game.Modes.Taiko.UI { Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft, Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre, - RelativePositionAxes = Axes.X, X = judgementOffset, }); From 8c99a8b103ab757f6bb580c2ce9c8156a404673b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:25:30 -0300 Subject: [PATCH 056/103] Remove visual test(pretty useless) --- .../Tests/TestCaseBeatmapDetailArea.cs | 27 ------------------- .../osu.Desktop.VisualTests.csproj | 1 - 2 files changed, 28 deletions(-) delete mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs deleted file mode 100644 index 59859f3f29..0000000000 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs +++ /dev/null @@ -1,27 +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 osu.Framework.Graphics; -using osu.Framework.Screens.Testing; -using osu.Game.Screens.Select; - -namespace osu.Desktop.VisualTests.Tests -{ - internal class TestCaseBeatmapDetailArea : TestCase - { - public override string Description => @"Beatmap details in song select"; - - public override void Reset() - { - base.Reset(); - - Add(new BeatmapDetailArea - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(550f, 450f), - }); - } - } -} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 9ca82c9867..b67b4c4bb3 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -206,7 +206,6 @@ - From 67421cdf1c01577bab21da404b9c77e2298f336b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:34:06 -0300 Subject: [PATCH 057/103] Even though it was 5 minutes ago what was I thinking --- .../Tests/TestCaseBeatmapDetailArea.cs | 27 +++++++++++++++++++ .../osu.Desktop.VisualTests.csproj | 1 + .../UserInterface/OsuTabControlCheckBox.cs | 1 - osu.Game/Screens/Select/BeatmapDetailArea.cs | 1 - 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs new file mode 100644 index 0000000000..bb7df19202 --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Screens.Testing; +using osu.Game.Screens.Select; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseBeatmapDetailArea : TestCase + { + public override string Description => @"Beatmap details in song select"; + + public override void Reset() + { + base.Reset(); + + Add(new BeatmapDetailArea + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(550f, 450f), + }); + } + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index b67b4c4bb3..9ca82c9867 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -206,6 +206,7 @@ + diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index dbdef991f7..1ae3698b9f 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -5,7 +5,6 @@ using System; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index ff66605c76..5943a0d0ad 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.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.Graphics; using osu.Framework.Graphics.Containers; From b8b45262c5d0f3a1647b83dfe2356b9117910073 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 23 Mar 2017 01:35:55 -0300 Subject: [PATCH 058/103] Formatting --- osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index 1ae3698b9f..a09173f6e2 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -17,7 +17,7 @@ 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 { diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 7d73b17c8e..aa3b660479 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -8,11 +8,9 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Online.API.Requests; using osu.Game.Overlays.Mods; using osu.Game.Screens.Edit; using osu.Game.Screens.Play; -using osu.Game.Screens.Select.Leaderboards; namespace osu.Game.Screens.Select { @@ -53,8 +51,6 @@ namespace osu.Game.Screens.Select }, Key.Number3); } - private GetScoresRequest getScoresRequest; - protected override void OnBeatmapChanged(WorkingBeatmap beatmap) { beatmap?.Mods.BindTo(modSelect.SelectedMods); From 54e1b24fe9814e2348b307b8f6978d49d6675ea3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Mar 2017 13:41:50 +0900 Subject: [PATCH 059/103] Enforce readonly private members where possible. --- osu.Desktop.Deploy/Program.cs | 2 +- .../Beatmaps/TestWorkingBeatmap.cs | 2 +- osu.Desktop.VisualTests/Benchmark.cs | 2 +- .../Tests/TestCaseHitObjects.cs | 4 ++-- .../Tests/TestCaseNotificationManager.cs | 2 +- osu.Desktop/OsuGameDesktop.cs | 2 +- .../Objects/Drawable/DrawableFruit.cs | 2 +- .../Objects/Drawables/DrawableHitCircle.cs | 14 +++++++------- .../Objects/Drawables/DrawableSlider.cs | 14 +++++++------- .../Objects/Drawables/DrawableSliderTick.cs | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 12 ++++++------ .../Objects/Drawables/HitExplosion.cs | 4 ++-- .../Objects/Drawables/Pieces/ApproachCircle.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 2 +- .../Objects/Drawables/Pieces/GlowPiece.cs | 2 +- .../Objects/Drawables/Pieces/NumberPiece.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 2 +- .../Objects/Drawables/Pieces/SliderBody.cs | 8 ++++---- .../Objects/Drawables/Pieces/SliderBouncer.cs | 2 +- .../Objects/OsuHitObjectDifficulty.cs | 6 +++--- osu.Game.Modes.Osu/OsuAutoReplay.cs | 6 +++--- osu.Game.Modes.Osu/UI/OsuPlayfield.cs | 6 +++--- .../Objects/Drawable/DrawableTaikoHit.cs | 2 +- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 6 +++--- .../Beatmaps/Drawables/BeatmapSetHeader.cs | 7 ++++--- osu.Game/Beatmaps/Drawables/Panel.cs | 2 +- osu.Game/Beatmaps/IO/OszArchiveReader.cs | 6 +++--- osu.Game/Beatmaps/WorkingBeatmap.cs | 6 +++--- osu.Game/Database/BeatmapDatabase.cs | 2 +- osu.Game/Graphics/Backgrounds/Background.cs | 2 +- .../Graphics/Containers/ParallaxContainer.cs | 2 +- osu.Game/Graphics/Cursor/CursorTrail.cs | 6 +++--- .../Graphics/UserInterface/DialogButton.cs | 11 ++++++++--- osu.Game/Graphics/UserInterface/Nub.cs | 2 +- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 4 ++-- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 4 ++-- .../UserInterface/OsuPasswordTextBox.cs | 2 +- .../Graphics/UserInterface/OsuSliderBar.cs | 5 +++-- .../Graphics/UserInterface/OsuTabControl.cs | 4 ++-- osu.Game/Graphics/UserInterface/StarCounter.cs | 2 +- .../Graphics/UserInterface/TwoLayerButton.cs | 8 ++++---- .../UserInterface/Volume/VolumeControl.cs | 6 +++--- .../UserInterface/Volume/VolumeMeter.cs | 2 +- osu.Game/IO/Legacy/SerializationReader.cs | 2 +- osu.Game/IPC/BeatmapIPCChannel.cs | 2 +- osu.Game/IPC/ScoreIPCChannel.cs | 2 +- osu.Game/Modes/Objects/BezierApproximator.cs | 8 ++++---- .../Modes/Objects/CircularArcApproximator.cs | 6 +++--- osu.Game/Modes/Objects/SliderCurve.cs | 4 ++-- osu.Game/Modes/Ruleset.cs | 8 ++++---- osu.Game/Modes/UI/HitRenderer.cs | 2 +- osu.Game/Modes/UI/ModIcon.cs | 3 ++- osu.Game/Modes/UI/Playfield.cs | 2 +- osu.Game/Modes/UI/StandardHealthDisplay.cs | 2 +- osu.Game/Online/API/APIAccess.cs | 8 ++++---- .../Online/API/Requests/GetMessagesRequest.cs | 2 +- .../Online/Chat/Drawables/DrawableChannel.cs | 4 ++-- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 4 ++-- osu.Game/Overlays/Dialog/PopupDialog.cs | 10 ++++++---- osu.Game/Overlays/DialogOverlay.cs | 2 +- osu.Game/Overlays/DragBar.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 4 ++-- osu.Game/Overlays/Mods/ModSection.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 7 ++++--- osu.Game/Overlays/MusicController.cs | 6 +++--- .../Overlays/Notifications/Notification.cs | 4 ++-- .../Notifications/NotificationSection.cs | 2 +- .../Notifications/ProgressNotification.cs | 4 ++-- .../Notifications/SimpleNotification.cs | 4 ++-- osu.Game/Overlays/Options/OptionDropdown.cs | 4 ++-- osu.Game/Overlays/Options/OptionSlider.cs | 4 ++-- osu.Game/Overlays/Options/OptionsSection.cs | 2 +- osu.Game/Overlays/Options/OptionsSubsection.cs | 2 +- osu.Game/Overlays/Options/Sidebar.cs | 2 +- osu.Game/Overlays/Options/SidebarButton.cs | 10 +++++----- osu.Game/Overlays/Toolbar/Toolbar.cs | 8 ++++---- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 6 +++--- .../Overlays/Toolbar/ToolbarModeSelector.cs | 4 ++-- .../Toolbar/ToolbarOverlayToggleButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 2 +- osu.Game/Overlays/WaveOverlayContainer.cs | 7 +++++-- .../Backgrounds/BackgroundScreenBeatmap.cs | 2 +- osu.Game/Screens/GameScreenWhiteBox.cs | 6 +++--- osu.Game/Screens/Menu/Button.cs | 14 +++++++------- osu.Game/Screens/Menu/ButtonSystem.cs | 18 +++++++++--------- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 4 ++-- osu.Game/Screens/Menu/OsuLogo.cs | 16 ++++++++-------- osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- .../Screens/Play/Pause/PauseProgressBar.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerInputManager.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 8 ++++---- osu.Game/Screens/Select/FilterControl.cs | 6 +++--- osu.Game/Screens/Select/Footer.cs | 4 ++-- osu.Game/Screens/Select/FooterButton.cs | 6 +++--- .../Select/Leaderboards/DrawableRank.cs | 2 +- .../Screens/Select/Leaderboards/Leaderboard.cs | 4 ++-- .../Select/Leaderboards/LeaderboardScore.cs | 18 ++++++++++-------- .../Select/Options/BeatmapOptionsButton.cs | 10 ++++++---- .../Select/Options/BeatmapOptionsOverlay.cs | 4 ++-- osu.Game/Screens/Select/PlaySongSelect.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 7 +++---- .../Components/VisualiserContainer.cs | 2 +- osu.Game/Screens/Tournament/Drawings.cs | 2 +- osu.Game/Screens/Tournament/Group.cs | 10 +++++----- osu.Game/Screens/Tournament/GroupContainer.cs | 4 ++-- .../Tournament/ScrollingTeamContainer.cs | 6 +++--- .../Tournament/Teams/StorageBackedTeamList.cs | 2 +- osu.Game/Users/Country.cs | 2 +- osu.sln.DotSettings | 4 +++- 115 files changed, 278 insertions(+), 259 deletions(-) diff --git a/osu.Desktop.Deploy/Program.cs b/osu.Desktop.Deploy/Program.cs index 00ec215e8a..37776b329f 100644 --- a/osu.Desktop.Deploy/Program.cs +++ b/osu.Desktop.Deploy/Program.cs @@ -53,7 +53,7 @@ namespace osu.Desktop.Deploy private static string nupkgFilename(string ver) => $"{PackageName}.{ver}.nupkg"; private static string nupkgDistroFilename(string ver) => $"{PackageName}-{ver}-full.nupkg"; - private static Stopwatch sw = new Stopwatch(); + private static readonly Stopwatch sw = new Stopwatch(); private static string codeSigningPassword; diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs index babca8ee06..f135a6affa 100644 --- a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs @@ -15,7 +15,7 @@ namespace osu.Desktop.VisualTests.Beatmaps this.beatmap = beatmap; } - private Beatmap beatmap; + private readonly Beatmap beatmap; protected override Beatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs index 3847b6f00f..01a6e749f3 100644 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ b/osu.Desktop.VisualTests/Benchmark.cs @@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests { public class Benchmark : OsuGameBase { - private double timePerTest = 200; + private readonly double timePerTest = 200; [BackgroundDependencyLoader] private void load() diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index eeebc7faa8..f302330346 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseHitObjects : TestCase { - private FramedClock framedClock; + private readonly FramedClock framedClock; private bool auto; @@ -34,7 +34,7 @@ namespace osu.Desktop.VisualTests.Tests private HitObjectType mode = HitObjectType.Slider; - private BindableNumber playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; + private readonly BindableNumber playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; private Container playfieldContainer; private Container approachContainer; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index c3a9064e69..13f89153e9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests progressingNotifications.Add(n); } - private List progressingNotifications = new List(); + private readonly List progressingNotifications = new List(); private void sendProgress1() { diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index da3e7b704a..95870125e3 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -17,7 +17,7 @@ namespace osu.Desktop { internal class OsuGameDesktop : OsuGame { - private VersionManager versionManager; + private readonly VersionManager versionManager; public OsuGameDesktop(string[] args = null) : base(args) diff --git a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs index 5d19d902b1..4ea310f083 100644 --- a/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs +++ b/osu.Game.Modes.Catch/Objects/Drawable/DrawableFruit.cs @@ -12,7 +12,7 @@ namespace osu.Game.Modes.Catch.Objects.Drawable { internal class DrawableFruit : Sprite { - private CatchBaseHit h; + private readonly CatchBaseHit h; public DrawableFruit(CatchBaseHit h) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs index e8c74d4f8d..fe5b2f9859 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -13,15 +13,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { - private OsuHitObject osuObject; + private readonly OsuHitObject osuObject; public ApproachCircle ApproachCircle; - private CirclePiece circle; - private RingPiece ring; - private FlashPiece flash; - private ExplodePiece explode; - private NumberPiece number; - private GlowPiece glow; + private readonly CirclePiece circle; + private readonly RingPiece ring; + private readonly FlashPiece flash; + private readonly ExplodePiece explode; + private readonly NumberPiece number; + private readonly GlowPiece glow; public DrawableHitCircle(OsuHitObject h) : base(h) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs index a2a52c7d94..f730d55e21 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSlider.cs @@ -13,18 +13,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach { - private Slider slider; + private readonly Slider slider; - private DrawableHitCircle initialCircle; + private readonly DrawableHitCircle initialCircle; - private List components = new List(); + private readonly List components = new List(); - private Container ticks; + private readonly Container ticks; - private SliderBody body; - private SliderBall ball; + private readonly SliderBody body; + private readonly SliderBall ball; - private SliderBouncer bouncer2; + private readonly SliderBouncer bouncer2; public DrawableSlider(Slider s) : base(s) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs index fff08b9f60..988eab45b5 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -18,7 +18,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { public class DrawableSliderTick : DrawableOsuHitObject { - private SliderTick sliderTick; + private readonly SliderTick sliderTick; public double FadeInTime; public double FadeOutTime; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs index 8098e87b12..2d701b3eeb 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/DrawableSpinner.cs @@ -15,12 +15,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables { public class DrawableSpinner : DrawableOsuHitObject { - private Spinner spinner; + private readonly Spinner spinner; - private SpinnerDisc disc; - private SpinnerBackground background; - private Container circleContainer; - private DrawableHitCircle circle; + private readonly SpinnerDisc disc; + private readonly SpinnerBackground background; + private readonly Container circleContainer; + private readonly DrawableHitCircle circle; public DrawableSpinner(Spinner s) : base(s) { @@ -108,7 +108,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables private Vector2 scaleToCircle => circle.Scale * circle.DrawWidth / DrawWidth * 0.95f; - private float spinsPerMinuteNeeded = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5 + private readonly float spinsPerMinuteNeeded = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5 private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); diff --git a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs index ab34d49ecf..f2ccf554d9 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/HitExplosion.cs @@ -17,8 +17,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables public class HitExplosion : FillFlowContainer { private readonly OsuJudgementInfo judgement; - private SpriteText line1; - private SpriteText line2; + private readonly SpriteText line1; + private readonly SpriteText line2; public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null) { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs index b0b1e81fca..fd4ef64350 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/ApproachCircle.cs @@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class ApproachCircle : Container { - private Sprite approachCircle; + private readonly Sprite approachCircle; public ApproachCircle() { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs index 2a503e3dec..704a6b7490 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -14,7 +14,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class CirclePiece : Container { - private Sprite disc; + private readonly Sprite disc; public Func Hit; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs index 1a16eae48c..6cffa370cf 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/GlowPiece.cs @@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class GlowPiece : Container { - private Sprite layer; + private readonly Sprite layer; public GlowPiece() { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 750f203a8d..0ebd274246 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -12,7 +12,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class NumberPiece : Container { - private SpriteText number; + private readonly SpriteText number; public string Text { diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs index 0b1a3aa751..cccd10469d 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -13,7 +13,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces public class SliderBall : CircularContainer, ISliderProgress { private readonly Slider slider; - private Box follow; + private readonly Box follow; private const float width = 128; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs index b923d05713..c541a861d4 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -18,8 +18,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { public class SliderBody : Container, ISliderProgress { - private Path path; - private BufferedContainer container; + private readonly Path path; + private readonly BufferedContainer container; public float PathWidth { @@ -33,7 +33,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces public double? SnakedStart { get; private set; } public double? SnakedEnd { get; private set; } - private Slider slider; + private readonly Slider slider; public SliderBody(Slider s) { slider = s; @@ -122,7 +122,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces path.Texture = texture; } - private List currentCurve = new List(); + private readonly List currentCurve = new List(); private bool updateSnaking(double p0, double p1) { if (SnakedStart == p0 && SnakedEnd == p1) return false; diff --git a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs index 1a78e5d85f..196b9fb521 100644 --- a/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs +++ b/osu.Game.Modes.Osu/Objects/Drawables/Pieces/SliderBouncer.cs @@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces { private readonly Slider slider; private readonly bool isEnd; - private TextAwesome icon; + private readonly TextAwesome icon; public SliderBouncer(Slider slider, bool isEnd) { diff --git a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs b/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs index 926e5132bd..322f6b077a 100644 --- a/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs +++ b/osu.Game.Modes.Osu/Objects/OsuHitObjectDifficulty.cs @@ -47,11 +47,11 @@ namespace osu.Game.Modes.Osu.Objects internal int MaxCombo = 1; - private float scalingFactor; + private readonly float scalingFactor; private float lazySliderLength; - private Vector2 startPosition; - private Vector2 endPosition; + private readonly Vector2 startPosition; + private readonly Vector2 endPosition; internal OsuHitObjectDifficulty(OsuHitObject baseHitObject) { diff --git a/osu.Game.Modes.Osu/OsuAutoReplay.cs b/osu.Game.Modes.Osu/OsuAutoReplay.cs index 6b543cb98f..61b7466d86 100644 --- a/osu.Game.Modes.Osu/OsuAutoReplay.cs +++ b/osu.Game.Modes.Osu/OsuAutoReplay.cs @@ -20,7 +20,7 @@ namespace osu.Game.Modes.Osu private const float spin_radius = 50; - private Beatmap beatmap; + private readonly Beatmap beatmap; public OsuAutoReplay(Beatmap beatmap) { @@ -37,11 +37,11 @@ namespace osu.Game.Modes.Osu } } - private static IComparer replayFrameComparer = new LegacyReplayFrameComparer(); + private static readonly IComparer replay_frame_comparer = new LegacyReplayFrameComparer(); private int findInsertionIndex(LegacyReplayFrame frame) { - int index = Frames.BinarySearch(frame, replayFrameComparer); + int index = Frames.BinarySearch(frame, replay_frame_comparer); if (index < 0) { diff --git a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs index 5caaaafb13..87c80f94bc 100644 --- a/osu.Game.Modes.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Modes.Osu/UI/OsuPlayfield.cs @@ -17,9 +17,9 @@ namespace osu.Game.Modes.Osu.UI { public class OsuPlayfield : Playfield { - private Container approachCircles; - private Container judgementLayer; - private ConnectionRenderer connectionLayer; + private readonly Container approachCircles; + private readonly Container judgementLayer; + private readonly ConnectionRenderer connectionLayer; public override Vector2 Size { diff --git a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs index 760977ef5b..cdf1e600d5 100644 --- a/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs +++ b/osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs @@ -12,7 +12,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable { internal class DrawableTaikoHit : Sprite { - private TaikoHitObject h; + private readonly TaikoHitObject h; public DrawableTaikoHit(TaikoHitObject h) { diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index 67ebb2fcb9..34e4ebf8ac 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -21,12 +21,12 @@ namespace osu.Game.Beatmaps.Drawables public class BeatmapPanel : Panel { public BeatmapInfo Beatmap; - private Sprite background; + private readonly Sprite background; public Action GainedSelection; public Action StartRequested; - private Triangles triangles; - private StarCounter starCounter; + private readonly Triangles triangles; + private readonly StarCounter starCounter; protected override void Selected() { diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 3dc5fdedc9..2d032f0ea4 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -20,11 +20,12 @@ namespace osu.Game.Beatmaps.Drawables public class BeatmapSetHeader : Panel { public Action GainedSelection; - private SpriteText title, artist; + private readonly SpriteText title; + private readonly SpriteText artist; private OsuConfigManager config; private Bindable preferUnicode; - private WorkingBeatmap beatmap; - private FillFlowContainer difficultyIcons; + private readonly WorkingBeatmap beatmap; + private readonly FillFlowContainer difficultyIcons; public BeatmapSetHeader(WorkingBeatmap beatmap) { diff --git a/osu.Game/Beatmaps/Drawables/Panel.cs b/osu.Game/Beatmaps/Drawables/Panel.cs index c51ae8680e..2a5564bc71 100644 --- a/osu.Game/Beatmaps/Drawables/Panel.cs +++ b/osu.Game/Beatmaps/Drawables/Panel.cs @@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps.Drawables public override bool RemoveWhenNotAlive => false; - private Container nestedContainer; + private readonly Container nestedContainer; protected override Container Content => nestedContainer; diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index 8a1d071cfc..5c0f29fb86 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -21,9 +21,9 @@ namespace osu.Game.Beatmaps.IO OsuLegacyDecoder.Register(); } - private Stream archiveStream; - private ZipFile archive; - private Beatmap firstMap; + private readonly Stream archiveStream; + private readonly ZipFile archive; + private readonly Beatmap firstMap; public OszArchiveReader(Stream archiveStream) { diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 2a2de1b6ef..74c8866596 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -42,7 +42,7 @@ namespace osu.Game.Beatmaps protected abstract Track GetTrack(); private Beatmap beatmap; - private object beatmapLock = new object(); + private readonly object beatmapLock = new object(); public Beatmap Beatmap { get @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps } } - private object backgroundLock = new object(); + private readonly object backgroundLock = new object(); private Texture background; public Texture Background { @@ -68,7 +68,7 @@ namespace osu.Game.Beatmaps } private Track track; - private object trackLock = new object(); + private readonly object trackLock = new object(); public Track Track { get diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 317467d792..dfc916a136 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -21,7 +21,7 @@ namespace osu.Game.Database public class BeatmapDatabase { private SQLiteConnection connection { get; } - private Storage storage; + private readonly Storage storage; public event Action BeatmapSetAdded; public event Action BeatmapSetRemoved; diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 5bafc8cd64..7c47635276 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -14,7 +14,7 @@ namespace osu.Game.Graphics.Backgrounds { public Sprite Sprite; - private string textureName; + private readonly string textureName; public Background(string textureName = @"") { diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index c4cd1777e1..9dfc26dd3c 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -31,7 +31,7 @@ namespace osu.Game.Graphics.Containers }); } - private Container content; + private readonly Container content; private InputManager input; protected override Container Content => content; diff --git a/osu.Game/Graphics/Cursor/CursorTrail.cs b/osu.Game/Graphics/Cursor/CursorTrail.cs index ffd96d9622..e804b506cc 100644 --- a/osu.Game/Graphics/Cursor/CursorTrail.cs +++ b/osu.Game/Graphics/Cursor/CursorTrail.cs @@ -31,10 +31,10 @@ namespace osu.Game.Graphics.Cursor private float time; - private TrailDrawNodeSharedData trailDrawNodeSharedData = new TrailDrawNodeSharedData(); + private readonly TrailDrawNodeSharedData trailDrawNodeSharedData = new TrailDrawNodeSharedData(); private const int max_sprites = 2048; - private TrailPart[] parts = new TrailPart[max_sprites]; + private readonly TrailPart[] parts = new TrailPart[max_sprites]; private Vector2? lastPosition; @@ -163,7 +163,7 @@ namespace osu.Game.Graphics.Cursor public float Time; public TrailDrawNodeSharedData Shared; - public TrailPart[] Parts = new TrailPart[max_sprites]; + public readonly TrailPart[] Parts = new TrailPart[max_sprites]; public Vector2 Size; public TrailDrawNode() diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 49b5f1e509..6015f56d6c 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -81,9 +81,14 @@ namespace osu.Game.Graphics.UserInterface public SampleChannel SampleClick, SampleHover; - private Container backgroundContainer, colourContainer, glowContainer; - private Box leftGlow, centerGlow, rightGlow, background; - private SpriteText spriteText; + private readonly Container backgroundContainer; + private readonly Container colourContainer; + private readonly Container glowContainer; + private readonly Box leftGlow; + private readonly Box centerGlow; + private readonly Box rightGlow; + private readonly Box background; + private readonly SpriteText spriteText; private Vector2 hoverSpacing => new Vector2(3f, 0f); private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index a32e047af9..71060fbd09 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface public const float COLLAPSED_SIZE = 20; public const float EXPANDED_SIZE = 40; - private Box fill; + private readonly Box fill; private const float border_width = 3; private Color4 glowingColour, idleColour; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index a2469afb53..2209c96689 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -64,8 +64,8 @@ namespace osu.Game.Graphics.UserInterface } } - private Nub nub; - private SpriteText labelSpriteText; + private readonly Nub nub; + private readonly SpriteText labelSpriteText; private SampleChannel sampleChecked; private SampleChannel sampleUnchecked; diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 7a31337660..3466fb1a60 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -85,7 +85,7 @@ namespace osu.Game.Graphics.UserInterface private Color4? accentColour; - private TextAwesome chevron; + private readonly TextAwesome chevron; protected override void FormatForeground(bool hover = false) { @@ -116,7 +116,7 @@ namespace osu.Game.Graphics.UserInterface protected class OsuDropdownHeader : DropdownHeader { - private SpriteText label; + private readonly SpriteText label; protected override string Label { get { return label.Text; } diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index c9d8f936f6..d0072af0eb 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface public class PasswordMaskChar : Container { - private CircularContainer circle; + private readonly CircularContainer circle; public PasswordMaskChar(float size) { diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 58fe24a9e6..81a1b5ca1b 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -19,8 +19,9 @@ namespace osu.Game.Graphics.UserInterface private SampleChannel sample; private double lastSampleTime; - private Nub nub; - private Box leftBox, rightBox; + private readonly Nub nub; + private readonly Box leftBox; + private readonly Box rightBox; public OsuSliderBar() { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 8283c1baa0..5f6de4bee4 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -59,8 +59,8 @@ namespace osu.Game.Graphics.UserInterface private class OsuTabItem : TabItem { - private SpriteText text; - private Box box; + private readonly SpriteText text; + private readonly Box box; private Color4? accentColour; public Color4 AccentColour diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index c46eda6582..c0d55fa608 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -147,7 +147,7 @@ namespace osu.Game.Graphics.UserInterface private class Star : Container { - public TextAwesome Icon; + public readonly TextAwesome Icon; public Star() { Size = new Vector2(star_size); diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 0d4e72f92c..daf4df657b 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface { public class TwoLayerButton : ClickableContainer { - private TextAwesome icon; + private readonly TextAwesome icon; public Box IconLayer; public Box TextLayer; @@ -29,11 +29,11 @@ namespace osu.Game.Graphics.UserInterface public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50); public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50); public SampleChannel ActivationSound; - private SpriteText text; + private readonly SpriteText text; public Color4 HoverColour; - private Container c1; - private Container c2; + private readonly Container c1; + private readonly Container c2; public Color4 BackgroundColour { diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index a9f09ce86c..374385e351 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface.Volume { internal class VolumeControl : OverlayContainer { - private VolumeMeter volumeMeterMaster; + private readonly VolumeMeter volumeMeterMaster; protected override bool HideOnEscape => false; @@ -89,8 +89,8 @@ namespace osu.Game.Graphics.UserInterface.Volume private ScheduledDelegate popOutDelegate; - private VolumeMeter volumeMeterEffect; - private VolumeMeter volumeMeterMusic; + private readonly VolumeMeter volumeMeterEffect; + private readonly VolumeMeter volumeMeterMusic; protected override void PopIn() { diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index 4d68177fef..4d83805b83 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface.Volume { internal class VolumeMeter : Container { - private Box meterFill; + private readonly Box meterFill; public BindableDouble Bindable { get; } = new BindableDouble(); public VolumeMeter(string meterName) diff --git a/osu.Game/IO/Legacy/SerializationReader.cs b/osu.Game/IO/Legacy/SerializationReader.cs index 6cab5c534d..6bb6c3bbbf 100644 --- a/osu.Game/IO/Legacy/SerializationReader.cs +++ b/osu.Game/IO/Legacy/SerializationReader.cs @@ -18,7 +18,7 @@ namespace osu.Game.IO.Legacy /// handle null strings and simplify use with ISerializable. public class SerializationReader : BinaryReader { - private Stream stream; + private readonly Stream stream; public SerializationReader(Stream s) : base(s, Encoding.UTF8) diff --git a/osu.Game/IPC/BeatmapIPCChannel.cs b/osu.Game/IPC/BeatmapIPCChannel.cs index 2b98d5254f..61e6cc76cc 100644 --- a/osu.Game/IPC/BeatmapIPCChannel.cs +++ b/osu.Game/IPC/BeatmapIPCChannel.cs @@ -10,7 +10,7 @@ namespace osu.Game.IPC { public class BeatmapIPCChannel : IpcChannel { - private BeatmapDatabase beatmaps; + private readonly BeatmapDatabase beatmaps; public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null) : base(host) diff --git a/osu.Game/IPC/ScoreIPCChannel.cs b/osu.Game/IPC/ScoreIPCChannel.cs index 0a49f4cd8f..7a509ee0e8 100644 --- a/osu.Game/IPC/ScoreIPCChannel.cs +++ b/osu.Game/IPC/ScoreIPCChannel.cs @@ -10,7 +10,7 @@ namespace osu.Game.IPC { public class ScoreIPCChannel : IpcChannel { - private ScoreDatabase scores; + private readonly ScoreDatabase scores; public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null) : base(host) diff --git a/osu.Game/Modes/Objects/BezierApproximator.cs b/osu.Game/Modes/Objects/BezierApproximator.cs index b0f17afc7e..ee8e9b0e06 100644 --- a/osu.Game/Modes/Objects/BezierApproximator.cs +++ b/osu.Game/Modes/Objects/BezierApproximator.cs @@ -8,10 +8,10 @@ namespace osu.Game.Modes.Objects { public class BezierApproximator { - private int count; - private List controlPoints; - private Vector2[] subdivisionBuffer1; - private Vector2[] subdivisionBuffer2; + private readonly int count; + private readonly List controlPoints; + private readonly Vector2[] subdivisionBuffer1; + private readonly Vector2[] subdivisionBuffer2; private const float tolerance = 0.25f; private const float tolerance_sq = tolerance * tolerance; diff --git a/osu.Game/Modes/Objects/CircularArcApproximator.cs b/osu.Game/Modes/Objects/CircularArcApproximator.cs index af15f99e43..310b923b0b 100644 --- a/osu.Game/Modes/Objects/CircularArcApproximator.cs +++ b/osu.Game/Modes/Objects/CircularArcApproximator.cs @@ -10,9 +10,9 @@ namespace osu.Game.Modes.Objects { public class CircularArcApproximator { - private Vector2 a; - private Vector2 b; - private Vector2 c; + private readonly Vector2 a; + private readonly Vector2 b; + private readonly Vector2 c; private int amountPoints; diff --git a/osu.Game/Modes/Objects/SliderCurve.cs b/osu.Game/Modes/Objects/SliderCurve.cs index 8ab5097257..642a65af21 100644 --- a/osu.Game/Modes/Objects/SliderCurve.cs +++ b/osu.Game/Modes/Objects/SliderCurve.cs @@ -19,8 +19,8 @@ namespace osu.Game.Modes.Objects public Vector2 Offset; - private List calculatedPath = new List(); - private List cumulativeLength = new List(); + private readonly List calculatedPath = new List(); + private readonly List cumulativeLength = new List(); private List calculateSubpath(List subControlPoints) { diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 013ea1d4fc..886b49f26b 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -21,9 +21,9 @@ namespace osu.Game.Modes public abstract class Ruleset { - private static ConcurrentDictionary availableRulesets = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary available_rulesets = new ConcurrentDictionary(); - public static IEnumerable PlayModes => availableRulesets.Keys; + public static IEnumerable PlayModes => available_rulesets.Keys; public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; @@ -35,7 +35,7 @@ namespace osu.Game.Modes public abstract ScoreProcessor CreateScoreProcessor(); - public static void Register(Ruleset ruleset) => availableRulesets.TryAdd(ruleset.PlayMode, ruleset.GetType()); + public static void Register(Ruleset ruleset) => available_rulesets.TryAdd(ruleset.PlayMode, ruleset.GetType()); protected abstract PlayMode PlayMode { get; } @@ -49,7 +49,7 @@ namespace osu.Game.Modes { Type type; - if (!availableRulesets.TryGetValue(mode, out type)) + if (!available_rulesets.TryGetValue(mode, out type)) return null; return Activator.CreateInstance(type) as Ruleset; diff --git a/osu.Game/Modes/UI/HitRenderer.cs b/osu.Game/Modes/UI/HitRenderer.cs index b82e3ada51..05b02a77b3 100644 --- a/osu.Game/Modes/UI/HitRenderer.cs +++ b/osu.Game/Modes/UI/HitRenderer.cs @@ -155,7 +155,7 @@ namespace osu.Game.Modes.UI /// protected Playfield Playfield; - private Container content; + private readonly Container content; protected HitRenderer(WorkingBeatmap beatmap) : base(beatmap) diff --git a/osu.Game/Modes/UI/ModIcon.cs b/osu.Game/Modes/UI/ModIcon.cs index 65a570fea7..35459985c9 100644 --- a/osu.Game/Modes/UI/ModIcon.cs +++ b/osu.Game/Modes/UI/ModIcon.cs @@ -10,7 +10,8 @@ namespace osu.Game.Modes.UI { public class ModIcon : Container { - private TextAwesome modIcon, background; + private readonly TextAwesome modIcon; + private readonly TextAwesome background; private float iconSize = 80; public float IconSize diff --git a/osu.Game/Modes/UI/Playfield.cs b/osu.Game/Modes/UI/Playfield.cs index e5babecad9..4e4e1ed2fa 100644 --- a/osu.Game/Modes/UI/Playfield.cs +++ b/osu.Game/Modes/UI/Playfield.cs @@ -23,7 +23,7 @@ namespace osu.Game.Modes.UI internal Container ScaledContent; protected override Container Content => content; - private Container content; + private readonly Container content; /// /// A container for keeping track of DrawableHitObjects. diff --git a/osu.Game/Modes/UI/StandardHealthDisplay.cs b/osu.Game/Modes/UI/StandardHealthDisplay.cs index c639f3d482..58b44eabd3 100644 --- a/osu.Game/Modes/UI/StandardHealthDisplay.cs +++ b/osu.Game/Modes/UI/StandardHealthDisplay.cs @@ -15,7 +15,7 @@ namespace osu.Game.Modes.UI { public class StandardHealthDisplay : HealthDisplay { - private Container fill; + private readonly Container fill; public StandardHealthDisplay() { diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 6bb61ca83c..f39dec47e1 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -17,7 +17,7 @@ namespace osu.Game.Online.API { public class APIAccess : IUpdateable { - private OAuth authentication; + private readonly OAuth authentication; public string Endpoint = @"https://new.ppy.sh"; private const string client_id = @"5"; @@ -44,9 +44,9 @@ namespace osu.Game.Online.API protected bool HasLogin => Token != null || !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password); // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable (should dispose of this or at very least keep a reference). - private Thread thread; + private readonly Thread thread; - private Logger log; + private readonly Logger log; public APIAccess() { @@ -57,7 +57,7 @@ namespace osu.Game.Online.API thread.Start(); } - private List components = new List(); + private readonly List components = new List(); public void Register(IOnlineComponent component) { diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index af5a96a66a..cf52f9ccd3 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -9,7 +9,7 @@ namespace osu.Game.Online.API.Requests { public class GetMessagesRequest : APIRequest> { - private List channels; + private readonly List channels; private long? since; public GetMessagesRequest(List channels, long? sinceId) diff --git a/osu.Game/Online/Chat/Drawables/DrawableChannel.cs b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs index eb8653976a..e3101e8fd7 100644 --- a/osu.Game/Online/Chat/Drawables/DrawableChannel.cs +++ b/osu.Game/Online/Chat/Drawables/DrawableChannel.cs @@ -14,8 +14,8 @@ namespace osu.Game.Online.Chat.Drawables public class DrawableChannel : Container { private readonly Channel channel; - private FillFlowContainer flow; - private ScrollContainer scroll; + private readonly FillFlowContainer flow; + private readonly ScrollContainer scroll; public DrawableChannel(Channel channel) { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 5e7c47c9a9..1fca318149 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -60,7 +60,7 @@ namespace osu.Game public Bindable PlayMode; - private string[] args; + private readonly string[] args; private OptionsOverlay options; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index efd366adb1..73ecf20891 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -31,11 +31,11 @@ namespace osu.Game.Overlays private ScheduledDelegate messageRequest; - private Container content; + private readonly Container content; protected override Container Content => content; - private FocusedTextBox inputTextBox; + private readonly FocusedTextBox inputTextBox; private APIAccess api; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 7936339e0c..bbac5ca786 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -27,10 +27,12 @@ namespace osu.Game.Overlays.Dialog private readonly Vector2 ringMinifiedSize = new Vector2(20f); private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f); - private Container content, ring; - private FillFlowContainer buttonsContainer; - private TextAwesome iconText; - private SpriteText header, body; + private readonly Container content; + private readonly Container ring; + private readonly FillFlowContainer buttonsContainer; + private readonly TextAwesome iconText; + private readonly SpriteText header; + private readonly SpriteText body; public FontAwesome Icon { diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index 12cca5275a..1769702c40 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays { public class DialogOverlay : FocusedOverlayContainer { - private Container dialogContainer; + private readonly Container dialogContainer; private PopupDialog currentDialog; public void Push(PopupDialog dialog) diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index 2e8eb272d8..a9cf735171 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays { public class DragBar : Container { - private Box fill; + private readonly Box fill; public Action SeekRequested; private bool isDragging; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index acd5f37092..cd045aae41 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -23,8 +23,8 @@ namespace osu.Game.Overlays.Mods public class ModButton : FillFlowContainer { private ModIcon foregroundIcon { get; set; } - private SpriteText text; - private Container iconsContainer; + private readonly SpriteText text; + private readonly Container iconsContainer; private SampleChannel sampleOn, sampleOff; public Action Action; // Passed the selected mod or null if none diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 489af21ef4..0e93a5520d 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Mods { public abstract class ModSection : Container { - private OsuSpriteText headerLabel; + private readonly OsuSpriteText headerLabel; public FillFlowContainer ButtonsContainer { get; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 3a685be7fa..d4ceb29c23 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -30,10 +30,11 @@ namespace osu.Game.Overlays.Mods private Color4 lowMultiplierColour, highMultiplierColour; - private OsuSpriteText rankedLabel, multiplierLabel; - private FillFlowContainer rankedMultiplerContainer; + private readonly OsuSpriteText rankedLabel; + private readonly OsuSpriteText multiplierLabel; + private readonly FillFlowContainer rankedMultiplerContainer; - private FillFlowContainer modSectionsContainer; + private readonly FillFlowContainer modSectionsContainer; public readonly Bindable> SelectedMods = new Bindable>(); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 32061974ad..a45dcaacb8 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays private SpriteText title, artist; private List playList; - private List playHistory = new List(); + private readonly List playHistory = new List(); private int playListIndex; private int playHistoryIndex = -1; @@ -415,8 +415,8 @@ namespace osu.Game.Overlays private class MusicControllerBackground : BufferedContainer { - private Sprite sprite; - private WorkingBeatmap beatmap; + private readonly Sprite sprite; + private readonly WorkingBeatmap beatmap; public MusicControllerBackground(WorkingBeatmap beatmap = null) { diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index e003a0e9dd..961e83e958 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -35,9 +35,9 @@ namespace osu.Game.Overlays.Notifications public virtual bool DisplayOnTop => true; protected NotificationLight Light; - private CloseButton closeButton; + private readonly CloseButton closeButton; protected Container IconContent; - private Container content; + private readonly Container content; protected override Container Content => content; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index e5debc9c9b..ee74c5e2cb 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.Notifications private class ClearAllButton : ClickableContainer { - private OsuSpriteText text; + private readonly OsuSpriteText text; public ClearAllButton() { diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 9dcee5c8af..5179e85df1 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -104,12 +104,12 @@ namespace osu.Game.Overlays.Notifications public override bool DisplayOnTop => false; - private ProgressBar progressBar; + private readonly ProgressBar progressBar; private Color4 colourQueued; private Color4 colourActive; private Color4 colourCancelled; - private SpriteText textDrawable; + private readonly SpriteText textDrawable; public ProgressNotification() { diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 19034d6d1c..ba2ec02651 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -34,8 +34,8 @@ namespace osu.Game.Overlays.Notifications } } - private SpriteText textDrawable; - private TextAwesome iconDrawable; + private readonly SpriteText textDrawable; + private readonly TextAwesome iconDrawable; protected Box IconBackgound; diff --git a/osu.Game/Overlays/Options/OptionDropdown.cs b/osu.Game/Overlays/Options/OptionDropdown.cs index d46e786bca..9ae02a17d3 100644 --- a/osu.Game/Overlays/Options/OptionDropdown.cs +++ b/osu.Game/Overlays/Options/OptionDropdown.cs @@ -15,8 +15,8 @@ namespace osu.Game.Overlays.Options { public class OptionDropdown : FillFlowContainer { - private Dropdown dropdown; - private SpriteText text; + private readonly Dropdown dropdown; + private readonly SpriteText text; public string LabelText { diff --git a/osu.Game/Overlays/Options/OptionSlider.cs b/osu.Game/Overlays/Options/OptionSlider.cs index 2f09c51655..772d2c37e6 100644 --- a/osu.Game/Overlays/Options/OptionSlider.cs +++ b/osu.Game/Overlays/Options/OptionSlider.cs @@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Options { public class OptionSlider : FillFlowContainer where T : struct { - private SliderBar slider; - private SpriteText text; + private readonly SliderBar slider; + private readonly SpriteText text; public string LabelText { diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 25e891b5c9..777a4fe703 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Options public abstract FontAwesome Icon { get; } public abstract string Header { get; } - private SpriteText headerLabel; + private readonly SpriteText headerLabel; protected OptionsSection() { diff --git a/osu.Game/Overlays/Options/OptionsSubsection.cs b/osu.Game/Overlays/Options/OptionsSubsection.cs index a6baf0a6cd..9fd2e8fb1e 100644 --- a/osu.Game/Overlays/Options/OptionsSubsection.cs +++ b/osu.Game/Overlays/Options/OptionsSubsection.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Options { protected override Container Content => content; - private Container content; + private readonly Container content; protected abstract string Header { get; } diff --git a/osu.Game/Overlays/Options/Sidebar.cs b/osu.Game/Overlays/Options/Sidebar.cs index b0618ed3a6..e66c6de742 100644 --- a/osu.Game/Overlays/Options/Sidebar.cs +++ b/osu.Game/Overlays/Options/Sidebar.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options { public class Sidebar : Container { - private FillFlowContainer content; + private readonly FillFlowContainer content; internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH; internal const int EXPANDED_WIDTH = 200; protected override Container Content => content; diff --git a/osu.Game/Overlays/Options/SidebarButton.cs b/osu.Game/Overlays/Options/SidebarButton.cs index 729a9be326..7c0049e8c7 100644 --- a/osu.Game/Overlays/Options/SidebarButton.cs +++ b/osu.Game/Overlays/Options/SidebarButton.cs @@ -16,11 +16,11 @@ namespace osu.Game.Overlays.Options { public class SidebarButton : Container { - private TextAwesome drawableIcon; - private SpriteText headerText; - private Box backgroundBox; - private Box selectionIndicator; - private Container text; + private readonly TextAwesome drawableIcon; + private readonly SpriteText headerText; + private readonly Box backgroundBox; + private readonly Box selectionIndicator; + private readonly Container text; public Action Action; private OptionsSection section; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 657334d1bb..ff1e37aafb 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -23,8 +23,8 @@ namespace osu.Game.Overlays.Toolbar public Action OnHome; public Action OnPlayModeChange; - private ToolbarModeSelector modeSelector; - private ToolbarUserArea userArea; + private readonly ToolbarModeSelector modeSelector; + private readonly ToolbarUserArea userArea; protected override bool HideOnEscape => false; @@ -90,8 +90,8 @@ namespace osu.Game.Overlays.Toolbar public class ToolbarBackground : Container { - private Box solidBackground; - private Box gradientBackground; + private readonly Box solidBackground; + private readonly Box gradientBackground; public ToolbarBackground() { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index be4a23722f..fa1e1abf2a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -63,9 +63,9 @@ namespace osu.Game.Overlays.Toolbar protected TextAwesome DrawableIcon; protected SpriteText DrawableText; protected Box HoverBackground; - private FillFlowContainer tooltipContainer; - private SpriteText tooltip1; - private SpriteText tooltip2; + private readonly FillFlowContainer tooltipContainer; + private readonly SpriteText tooltip1; + private readonly SpriteText tooltip2; protected FillFlowContainer Flow; private SampleChannel sampleClick; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 30474ad796..a6df237f20 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Toolbar { private const float padding = 10; - private FillFlowContainer modeButtons; - private Drawable modeButtonLine; + private readonly FillFlowContainer modeButtons; + private readonly Drawable modeButtonLine; private ToolbarModeButton activeButton; public Action OnPlayModeChange; diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index 991c76e164..023d9cfea7 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Toolbar { internal class ToolbarOverlayToggleButton : ToolbarButton { - private Box stateBackground; + private readonly Box stateBackground; private OverlayContainer stateContainer; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index 7f28764b17..1928c0fc1f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Toolbar internal class ToolbarUserArea : Container { public LoginOverlay LoginOverlay; - private ToolbarUserButton button; + private readonly ToolbarUserButton button; public override RectangleF BoundingBox => button.BoundingBox; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 52c9ab5aa4..7e266a2b43 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 Avatar avatar; + private readonly Avatar avatar; public ToolbarUserButton() { diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 747b46aecc..07b76c188d 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -20,9 +20,12 @@ namespace osu.Game.Overlays private const EasingTypes easing_show = EasingTypes.OutSine; private const EasingTypes easing_hide = EasingTypes.InSine; - private Wave firstWave, secondWave, thirdWave, fourthWave; + private readonly Wave firstWave; + private readonly Wave secondWave; + private readonly Wave thirdWave; + private readonly Wave fourthWave; - private Container wavesContainer; + private readonly Container wavesContainer; private readonly Container contentContainer; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 9c352aad80..81319553ba 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Backgrounds private class BeatmapBackground : Background { - private WorkingBeatmap beatmap; + private readonly WorkingBeatmap beatmap; public BeatmapBackground(WorkingBeatmap beatmap) { diff --git a/osu.Game/Screens/GameScreenWhiteBox.cs b/osu.Game/Screens/GameScreenWhiteBox.cs index f659d3681e..60e8edb6e1 100644 --- a/osu.Game/Screens/GameScreenWhiteBox.cs +++ b/osu.Game/Screens/GameScreenWhiteBox.cs @@ -19,14 +19,14 @@ namespace osu.Game.Screens { public class ScreenWhiteBox : OsuScreen { - private BackButton popButton; + private readonly BackButton popButton; private const double transition_time = 1000; protected virtual IEnumerable PossibleChildren => null; - private Container textContainer; - private Box box; + private readonly Container textContainer; + private readonly Box box; protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 52872c858b..5f62f382c0 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -26,13 +26,13 @@ namespace osu.Game.Screens.Menu /// public class Button : Container, IStateful { - private Container iconText; - private Container box; - private Box boxHoverLayer; - private TextAwesome icon; - private string internalName; - private Action clickAction; - private Key triggerKey; + private readonly Container iconText; + private readonly Container box; + private readonly Box boxHoverLayer; + private readonly TextAwesome icon; + private readonly string internalName; + private readonly Action clickAction; + private readonly Key triggerKey; private SampleChannel sampleClick; protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 7903062929..ac7e419765 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Menu private Toolbar toolbar; - private FlowContainerWithOrigin buttonFlow; + private readonly FlowContainerWithOrigin buttonFlow; //todo: make these non-internal somehow. internal const float BUTTON_AREA_HEIGHT = 100; @@ -41,16 +41,16 @@ namespace osu.Game.Screens.Menu public const int EXIT_DELAY = 3000; - private OsuLogo osuLogo; - private Drawable iconFacade; - private Container buttonArea; - private Box buttonAreaBackground; + private readonly OsuLogo osuLogo; + private readonly Drawable iconFacade; + private readonly Container buttonArea; + private readonly Box buttonAreaBackground; - private Button backButton; - private Button settingsButton; + private readonly Button backButton; + private readonly Button settingsButton; - private List