diff --git a/osu-framework b/osu-framework index 1c80609e7a..a50dd75b11 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 1c80609e7aa686f4abdc82bcd6a8f03439463ce7 +Subproject commit a50dd75b114da963c75e6a5314099d99140035b8 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index 79616d777f..ede430478e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -1,11 +1,11 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; -using osu.Framework.Screens.Testing; +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; +using osu.Framework.Screens.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Modes.Catch.UI; @@ -14,7 +14,7 @@ using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; using osu.Game.Modes.Taiko.UI; -using OpenTK; +using System.Collections.Generic; namespace osu.Desktop.VisualTests.Tests { @@ -55,30 +55,26 @@ namespace osu.Desktop.VisualTests.Tests Clock = new FramedClock(), Children = new Drawable[] { - new OsuHitRenderer + new OsuHitRenderer(beatmap) { - Beatmap = beatmap, Scale = new Vector2(0.5f), Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft }, - new TaikoHitRenderer + new TaikoHitRenderer(beatmap) { - Beatmap = beatmap, Scale = new Vector2(0.5f), Anchor = Anchor.TopRight, Origin = Anchor.TopRight }, - new CatchHitRenderer + new CatchHitRenderer(beatmap) { - Beatmap = beatmap, Scale = new Vector2(0.5f), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, - new ManiaHitRenderer + new ManiaHitRenderer(beatmap) { - Beatmap = beatmap, Scale = new Vector2(0.5f), Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index f4b2afee08..be313efed3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -1,20 +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 osu.Framework.Screens.Testing; +using OpenTK; using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; +using osu.Framework.Screens.Testing; using osu.Game.Graphics.UserInterface; -using osu.Game.Modes.Catch.UI; -using osu.Game.Modes.Mania.UI; -using osu.Game.Modes.Osu.UI; -using osu.Game.Modes.Taiko.UI; using osu.Game.Modes.UI; -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.Graphics.Primitives; namespace osu.Desktop.VisualTests.Tests { @@ -35,58 +29,26 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopRight, Anchor = Anchor.TopRight, TextSize = 40, - Count = 0, Margin = new MarginPadding(20), }; Add(score); - ComboCounter standardCombo = new OsuComboCounter + ComboCounter comboCounter = new StandardComboCounter { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Margin = new MarginPadding(10), - Count = 0, TextSize = 40, }; - Add(standardCombo); + Add(comboCounter); - CatchComboCounter catchCombo = new CatchComboCounter - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Count = 0, - TextSize = 40, - }; - Add(catchCombo); - - ComboCounter taikoCombo = new TaikoComboCounter - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.Centre, - Position = new Vector2(0, -160), - Count = 0, - TextSize = 40, - }; - Add(taikoCombo); - - ManiaComboCounter maniaCombo = new ManiaComboCounter - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Position = new Vector2(0, -80), - Count = 0, - TextSize = 40, - }; - Add(maniaCombo); - - - PercentageCounter accuracyCombo = new PercentageCounter + PercentageCounter accuracyCounter = new PercentageCounter { Origin = Anchor.TopRight, Anchor = Anchor.TopRight, Position = new Vector2(-20, 60), }; - Add(accuracyCombo); + Add(accuracyCounter); StarCounter stars = new StarCounter { @@ -108,50 +70,27 @@ namespace osu.Desktop.VisualTests.Tests AddButton(@"Reset all", delegate { - score.Count = 0; - standardCombo.Count = 0; - taikoCombo.Count = 0; - maniaCombo.Count = 0; - catchCombo.Count = 0; + score.Current.Value = 0; + comboCounter.Current.Value = 0; numerator = denominator = 0; - accuracyCombo.SetFraction(0, 0); + accuracyCounter.SetFraction(0, 0); stars.Count = 0; starsLabel.Text = stars.Count.ToString("0.00"); }); AddButton(@"Hit! :D", delegate { - score.Count += 300 + (ulong)(300.0 * (standardCombo.Count > 0 ? standardCombo.Count - 1 : 0) / 25.0); - standardCombo.Count++; - taikoCombo.Count++; - maniaCombo.Count++; - catchCombo.CatchFruit(new Color4( - Math.Max(0.5f, RNG.NextSingle()), - Math.Max(0.5f, RNG.NextSingle()), - Math.Max(0.5f, RNG.NextSingle()), - 1) - ); + score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0); + comboCounter.Increment(); numerator++; denominator++; - accuracyCombo.SetFraction(numerator, denominator); + accuracyCounter.SetFraction(numerator, denominator); }); AddButton(@"miss...", delegate { - standardCombo.Roll(); - taikoCombo.Roll(); - maniaCombo.Roll(); - catchCombo.Roll(); + comboCounter.Current.Value = 0; denominator++; - accuracyCombo.SetFraction(numerator, denominator); - }); - - AddButton(@"mania hold", delegate - { - if (!maniaHold) - maniaCombo.HoldStart(); - else - maniaCombo.HoldEnd(); - maniaHold = !maniaHold; + accuracyCounter.SetFraction(numerator, denominator); }); AddButton(@"Alter stars", delegate @@ -163,11 +102,8 @@ namespace osu.Desktop.VisualTests.Tests AddButton(@"Stop counters", delegate { score.StopRolling(); - standardCombo.StopRolling(); - catchCombo.StopRolling(); - taikoCombo.StopRolling(); - maniaCombo.StopRolling(); - accuracyCombo.StopRolling(); + comboCounter.StopRolling(); + accuracyCounter.StopRolling(); stars.StopAnimation(); }); } diff --git a/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs new file mode 100644 index 0000000000..6460751570 --- /dev/null +++ b/osu.Game.Modes.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Objects; +using System.Collections.Generic; + +namespace osu.Game.Modes.Catch.Beatmaps +{ + internal class CatchBeatmapConverter : IBeatmapConverter + { + public Beatmap Convert(Beatmap original) + { + return new Beatmap(original) + { + HitObjects = new List() // Todo: Convert HitObjects + }; + } + } +} diff --git a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs index ccc4097d59..53c6f5c2ce 100644 --- a/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs +++ b/osu.Game.Modes.Catch/CatchDifficultyCalculator.cs @@ -2,26 +2,23 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Beatmaps; using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Objects; -using System; using System.Collections.Generic; namespace osu.Game.Modes.Catch { public class CatchDifficultyCalculator : DifficultyCalculator { - protected override PlayMode PlayMode => PlayMode.Catch; - public CatchDifficultyCalculator(Beatmap beatmap) : base(beatmap) { } - protected override HitObjectConverter Converter => new CatchConverter(); - - protected override double CalculateInternal(Dictionary categoryDifficulty) + protected override double CalculateInternal(Dictionary categoryDifficulty) { return 0; } + + protected override IBeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); } } \ No newline at end of file diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 737bd99f94..08edeb7bcb 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -1,24 +1,20 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; +using OpenTK.Input; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Modes.Catch.UI; using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; -using osu.Game.Beatmaps; +using osu.Game.Screens.Play; +using System.Collections.Generic; namespace osu.Game.Modes.Catch { public class CatchRuleset : Ruleset { - public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); - - public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer - { - Beatmap = beatmap, - }; + public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer(beatmap); public override IEnumerable GetModsFor(ModType type) { @@ -79,8 +75,17 @@ namespace osu.Game.Modes.Catch protected override PlayMode PlayMode => PlayMode.Catch; + public override string Description => "osu!catch"; + public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; + public override IEnumerable CreateGameplayKeys() => new KeyCounter[] + { + new KeyCounterKeyboard(Key.ShiftLeft), + new KeyCounterMouse(MouseButton.Left), + new KeyCounterMouse(MouseButton.Right) + }; + public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); diff --git a/osu.Game.Modes.Catch/UI/CatchComboCounter.cs b/osu.Game.Modes.Catch/UI/CatchComboCounter.cs deleted file mode 100644 index e0a07dc295..0000000000 --- a/osu.Game.Modes.Catch/UI/CatchComboCounter.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Modes.Osu.UI; -using OpenTK.Graphics; - -namespace osu.Game.Modes.Catch.UI -{ - /// - /// Similar to Standard, but without the 'x' and has tinted pop-ups. Used in osu!catch. - /// - public class CatchComboCounter : OsuComboCounter - { - protected override bool CanPopOutWhileRolling => true; - - protected virtual double FadeOutDelay => 1000; - protected override double FadeOutDuration => 300; - - protected override string FormatCount(ulong count) - { - return $@"{count:#,0}"; - } - - private void animateFade() - { - Show(); - Delay(FadeOutDelay); - FadeOut(FadeOutDuration); - DelayReset(); - } - - protected override void OnCountChange(ulong currentValue, ulong newValue) - { - if (newValue != 0) - animateFade(); - base.OnCountChange(currentValue, newValue); - } - - protected override void OnCountRolling(ulong currentValue, ulong newValue) - { - if (!IsRolling) - { - PopOutCount.Colour = DisplayedCountSpriteText.Colour; - FadeOut(FadeOutDuration); - } - base.OnCountRolling(currentValue, newValue); - } - - protected override void OnCountIncrement(ulong currentValue, ulong newValue) - { - animateFade(); - base.OnCountIncrement(currentValue, newValue); - } - - /// - /// Increaces counter and tints pop-out before animation. - /// - /// Last grabbed fruit colour. - public void CatchFruit(Color4 colour) - { - PopOutCount.Colour = colour; - Count++; - } - } -} diff --git a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs index dd61fdd453..1537227d8f 100644 --- a/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs +++ b/osu.Game.Modes.Catch/UI/CatchHitRenderer.cs @@ -1,8 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; +using osu.Game.Modes.Catch.Beatmaps; using osu.Game.Modes.Catch.Objects; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; @@ -10,7 +11,12 @@ namespace osu.Game.Modes.Catch.UI { public class CatchHitRenderer : HitRenderer { - protected override HitObjectConverter Converter => new CatchConverter(); + public CatchHitRenderer(Beatmap beatmap) + : base(beatmap) + { + } + + protected override IBeatmapConverter CreateBeatmapConverter() => new CatchBeatmapConverter(); protected override Playfield CreatePlayfield() => new CatchPlayfield(); diff --git a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj index 42f06608b9..10abb312fc 100644 --- a/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj +++ b/osu.Game.Modes.Catch/osu.Game.Modes.Catch.csproj @@ -47,6 +47,7 @@ + @@ -54,7 +55,6 @@ - diff --git a/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs new file mode 100644 index 0000000000..0f42da4ac8 --- /dev/null +++ b/osu.Game.Modes.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + + +using osu.Game.Beatmaps; +using osu.Game.Modes.Mania.Objects; +using System.Collections.Generic; + +namespace osu.Game.Modes.Mania.Beatmaps +{ + internal class ManiaBeatmapConverter : IBeatmapConverter + { + public Beatmap Convert(Beatmap original) + { + return new Beatmap(original) + { + HitObjects = new List() // Todo: Implement + }; + } + } +} diff --git a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs index 975b78c215..02a5a3acdc 100644 --- a/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs +++ b/osu.Game.Modes.Mania/ManiaDifficultyCalculator.cs @@ -2,29 +2,24 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Beatmaps; +using osu.Game.Modes.Mania.Beatmaps; using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.Objects; -using System; using System.Collections.Generic; namespace osu.Game.Modes.Mania { public class ManiaDifficultyCalculator : DifficultyCalculator { - protected override PlayMode PlayMode => PlayMode.Mania; - - private int columns; - - public ManiaDifficultyCalculator(Beatmap beatmap, int columns = 5) : base(beatmap) + public ManiaDifficultyCalculator(Beatmap beatmap) + : base(beatmap) { - this.columns = columns; } - protected override HitObjectConverter Converter => new ManiaConverter(columns); - - protected override double CalculateInternal(Dictionary categoryDifficulty) + protected override double CalculateInternal(Dictionary categoryDifficulty) { return 0; } + + protected override IBeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); } } \ No newline at end of file diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 6d5606f796..e6e9cfd799 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -1,24 +1,19 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Modes.Mania.UI; using osu.Game.Modes.Objects; -using osu.Game.Modes.Osu.UI; using osu.Game.Modes.UI; -using osu.Game.Beatmaps; +using osu.Game.Screens.Play; +using System.Collections.Generic; namespace osu.Game.Modes.Mania { public class ManiaRuleset : Ruleset { - public override ScoreOverlay CreateScoreOverlay() => new OsuScoreOverlay(); - - public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new ManiaHitRenderer - { - Beatmap = beatmap, - }; + public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new ManiaHitRenderer(beatmap); public override IEnumerable GetModsFor(ModType type) { @@ -100,8 +95,12 @@ namespace osu.Game.Modes.Mania protected override PlayMode PlayMode => PlayMode.Mania; + public override string Description => "osu!mania"; + public override FontAwesome Icon => FontAwesome.fa_osu_mania_o; + public override IEnumerable CreateGameplayKeys() => new KeyCounter[] { /* Todo: Should be keymod specific */ }; + public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; public override HitObjectParser CreateHitObjectParser() => new NullHitObjectParser(); diff --git a/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs b/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs deleted file mode 100644 index c5ed557854..0000000000 --- a/osu.Game.Modes.Mania/UI/ManiaComboCounter.cs +++ /dev/null @@ -1,78 +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.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Game.Modes.Taiko.UI; -using OpenTK.Graphics; - -namespace osu.Game.Modes.Mania.UI -{ - /// - /// Similar to osu!taiko, with a pop-out animation when failing (rolling). Used in osu!mania. - /// - public class ManiaComboCounter : TaikoComboCounter - { - protected ushort KeysHeld; - - protected Color4 OriginalColour; - - protected Color4 TintColour => Color4.Orange; - protected EasingTypes TintEasing => EasingTypes.None; - protected int TintDuration => 500; - - protected Color4 PopOutColor => Color4.Red; - protected override float PopOutInitialAlpha => 1.0f; - protected override double PopOutDuration => 300; - - protected override void LoadComplete() - { - base.LoadComplete(); - - PopOutCount.Anchor = Anchor.BottomCentre; - PopOutCount.Origin = Anchor.Centre; - PopOutCount.FadeColour(PopOutColor); - OriginalColour = DisplayedCountSpriteText.Colour; - } - - protected override void OnCountRolling(ulong currentValue, ulong newValue) - { - if (!IsRolling && newValue < currentValue) - { - PopOutCount.Text = FormatCount(currentValue); - - PopOutCount.FadeTo(PopOutInitialAlpha); - PopOutCount.ScaleTo(1.0f); - - PopOutCount.FadeOut(PopOutDuration, PopOutEasing); - PopOutCount.ScaleTo(PopOutScale, PopOutDuration, PopOutEasing); - } - - base.OnCountRolling(currentValue, newValue); - } - - /// - /// Tints text while holding a key. - /// - /// - /// Does not alter combo. This has to be done depending of the scoring system. - /// (i.e. v1 = each period of time; v2 = when starting and ending a key hold) - /// - public void HoldStart() - { - if (KeysHeld == 0) - DisplayedCountSpriteText.FadeColour(TintColour, TintDuration, TintEasing); - KeysHeld++; - } - - /// - /// Ends tinting. - /// - public void HoldEnd() - { - KeysHeld--; - if (KeysHeld == 0) - DisplayedCountSpriteText.FadeColour(OriginalColour, TintDuration, TintEasing); - } - } -} diff --git a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs index 31bc4fffe4..911742b222 100644 --- a/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs +++ b/osu.Game.Modes.Mania/UI/ManiaHitRenderer.cs @@ -1,8 +1,9 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Beatmaps; +using osu.Game.Modes.Mania.Beatmaps; using osu.Game.Modes.Mania.Objects; -using osu.Game.Modes.Objects; using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.UI; @@ -12,12 +13,13 @@ namespace osu.Game.Modes.Mania.UI { private readonly int columns; - public ManiaHitRenderer(int columns = 5) + public ManiaHitRenderer(Beatmap beatmap, int columns = 5) + : base(beatmap) { this.columns = columns; } - protected override HitObjectConverter Converter => new ManiaConverter(columns); + protected override IBeatmapConverter CreateBeatmapConverter() => new ManiaBeatmapConverter(); protected override Playfield CreatePlayfield() => new ManiaPlayfield(columns); diff --git a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj index 457fb38e00..66e46f9e48 100644 --- a/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj +++ b/osu.Game.Modes.Mania/osu.Game.Modes.Mania.csproj @@ -47,6 +47,7 @@ + @@ -54,7 +55,6 @@ - @@ -86,6 +86,7 @@ +