From 991ad298d96b3cc7eb0f6f4a9c3ca0427924a5d8 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Fri, 16 Dec 2016 04:25:28 +0100 Subject: [PATCH 01/29] =?UTF-8?q?more=20beat=C3=B9a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 67 ++++++++++++++++++++- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index e4aa8f27b9..88202674b9 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -14,6 +14,8 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; +using System.Linq; +using osu.Game.Graphics; namespace osu.Game.Screens.Select { @@ -137,11 +139,72 @@ namespace osu.Game.Screens.Select Shadow = true, }, } - } + }, + new FlowContainer + { + Margin = new MarginPadding { Top = 10 }, + Direction = FlowDirection.HorizontalOnly, + AutoSizeAxes = Axes.Both, + Spacing = new Vector2(4, 0), + Children = new[] + { + new TextAwesome + { + Icon = FontAwesome.fa_clock_o, + Colour = Color4.Yellow, + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new SpriteText + { + Font = @"Exo2.0-Bold", + Colour = Color4.Yellow, + Text = ""+TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime-beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"), + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new TextAwesome + { + Icon = FontAwesome.fa_music, + Colour = Color4.Yellow, + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new SpriteText + { + Font = @"Exo2.0-Bold", + Colour = Color4.Yellow, + Text = ""+60000/beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime)+" bpm", + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new TextAwesome + { + Icon = FontAwesome.fa_circle_o, + Colour = Color4.Yellow, + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new SpriteText + { + Font = @"Exo2.0-Bold", + Colour = Color4.Yellow, + Text = ""+beatmap.Beatmap.HitObjects.Count(), + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + } + }, } } } - }).Preload(game, delegate(Drawable d) + }).Preload(game, delegate (Drawable d) { FadeIn(250); From 881d58574ea91a17bdd075d701e57641ca9322d4 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Fri, 16 Dec 2016 14:21:12 +0100 Subject: [PATCH 02/29] Design improvements --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 24 ++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 88202674b9..54b7db2abc 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -99,7 +99,7 @@ namespace osu.Game.Screens.Select Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Direction = FlowDirection.VerticalOnly, - Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 40 }, + Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new[] { @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select }, new FlowContainer { - Margin = new MarginPadding { Top = 10 }, + Margin = new MarginPadding { Top = 20 }, Direction = FlowDirection.HorizontalOnly, AutoSizeAxes = Axes.Both, Spacing = new Vector2(4, 0), @@ -183,6 +183,24 @@ namespace osu.Game.Screens.Select Origin = Anchor.BottomLeft }, new TextAwesome + { + Icon = FontAwesome.fa_dot_circle_o, + BorderColour = Color4.Purple, + Colour = Color4.Yellow, + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new SpriteText + { + Font = @"Exo2.0-Bold", + Colour = Color4.Yellow, + Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")), + TextSize = 17, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft + }, + new TextAwesome { Icon = FontAwesome.fa_circle_o, Colour = Color4.Yellow, @@ -194,7 +212,7 @@ namespace osu.Game.Screens.Select { Font = @"Exo2.0-Bold", Colour = Color4.Yellow, - Text = ""+beatmap.Beatmap.HitObjects.Count(), + Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")), TextSize = 17, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft From b78b40a6299431efc95e30f0c92986001c2d203e Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 01:58:39 +0100 Subject: [PATCH 03/29] implement icons --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 128 ++++++++++++-------- 1 file changed, 75 insertions(+), 53 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 54b7db2abc..ff5d9fb249 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; using System.Linq; using osu.Game.Graphics; +using osu.Framework.Graphics.Textures; namespace osu.Game.Screens.Select { @@ -25,6 +26,11 @@ namespace osu.Game.Screens.Select private Container beatmapInfoContainer; + private Texture time; + private Texture bpm; + private Texture hitCircles; + private Texture sliders; + private BaseGame game; public BeatmapInfoWedge() @@ -43,9 +49,13 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(BaseGame game) + private void load(BaseGame game, TextureStore textures) { this.game = game; + time = textures.Get(@"BeatmapInfo/time"); + bpm = textures.Get(@"BeatmapInfo/bpm"); + hitCircles = textures.Get(@"BeatmapInfo/hitCircles"); + sliders = textures.Get(@"BeatmapInfo/sliders"); } public void UpdateBeatmap(WorkingBeatmap beatmap) @@ -84,7 +94,7 @@ namespace osu.Game.Screens.Select ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)), Children = new [] { - // Zoomed-in and cropped beatmap background + // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(beatmap) { Anchor = Anchor.Centre, @@ -101,7 +111,7 @@ namespace osu.Game.Screens.Select Direction = FlowDirection.VerticalOnly, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, - Children = new[] + Children = new Drawable[] { new SpriteText { @@ -140,87 +150,99 @@ namespace osu.Game.Screens.Select }, } }, - new FlowContainer + new Container { Margin = new MarginPadding { Top = 20 }, - Direction = FlowDirection.HorizontalOnly, AutoSizeAxes = Axes.Both, - Spacing = new Vector2(4, 0), - Children = new[] - { - new TextAwesome - { - Icon = FontAwesome.fa_clock_o, - Colour = Color4.Yellow, - TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft + Children = new Drawable[] + { + new Container + { + AutoSizeAxes = Axes.Both, + Children = new[] + { + new Sprite + { + Texture = time, + Scale = new Vector2(0.5f, 0.5f), + }, + } }, new SpriteText { + Margin = new MarginPadding { Left = 23, Bottom = 3 }, Font = @"Exo2.0-Bold", - Colour = Color4.Yellow, + Colour = new Color4(255,221,85,255), Text = ""+TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime-beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"), - TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new TextAwesome - { - Icon = FontAwesome.fa_music, - Colour = Color4.Yellow, TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft + }, + new Container + { + Margin = new MarginPadding { Left = 100 }, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new Sprite + { + Texture = bpm, + Scale = new Vector2(0.5f, 0.5f), + }, + } }, new SpriteText { + Margin = new MarginPadding { Left = 123, Bottom = 3 }, Font = @"Exo2.0-Bold", - Colour = Color4.Yellow, + Colour = new Color4(255,221,85,255), Text = ""+60000/beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime)+" bpm", - TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new TextAwesome - { - Icon = FontAwesome.fa_dot_circle_o, - BorderColour = Color4.Purple, - Colour = Color4.Yellow, TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft + }, + new Container + { + Margin = new MarginPadding { Left = 200 }, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new Sprite + { + Texture = hitCircles, + Scale = new Vector2(0.5f, 0.5f), + }, + } }, new SpriteText { + Margin = new MarginPadding { Left = 223, Bottom = 3 }, Font = @"Exo2.0-Bold", - Colour = Color4.Yellow, + Colour = new Color4(255,221,85,255), Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")), - TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft - }, - new TextAwesome - { - Icon = FontAwesome.fa_circle_o, - Colour = Color4.Yellow, TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft + }, + new Container + { + Margin = new MarginPadding { Left = 300 }, + AutoSizeAxes = Axes.Both, + Children = new[] + { + new Sprite + { + Texture = sliders, + Scale = new Vector2(0.5f, 0.5f), + }, + } }, new SpriteText { + Margin = new MarginPadding { Left = 323, Bottom = 3 }, Font = @"Exo2.0-Bold", - Colour = Color4.Yellow, + Colour = new Color4(255,221,85,255), Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")), TextSize = 17, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft }, } }, } - } + }, } }).Preload(game, delegate (Drawable d) { From 590db66b37a93a045ab34b32f3a71fcd47f4f022 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 11:30:30 +0100 Subject: [PATCH 04/29] remove icons from resource --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 36 ++++++++++----------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index ff5d9fb249..fd4d0ea208 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -16,7 +16,6 @@ using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; using System.Linq; using osu.Game.Graphics; -using osu.Framework.Graphics.Textures; namespace osu.Game.Screens.Select { @@ -26,11 +25,6 @@ namespace osu.Game.Screens.Select private Container beatmapInfoContainer; - private Texture time; - private Texture bpm; - private Texture hitCircles; - private Texture sliders; - private BaseGame game; public BeatmapInfoWedge() @@ -49,13 +43,9 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(BaseGame game, TextureStore textures) + private void load(BaseGame game) { this.game = game; - time = textures.Get(@"BeatmapInfo/time"); - bpm = textures.Get(@"BeatmapInfo/bpm"); - hitCircles = textures.Get(@"BeatmapInfo/hitCircles"); - sliders = textures.Get(@"BeatmapInfo/sliders"); } public void UpdateBeatmap(WorkingBeatmap beatmap) @@ -153,7 +143,7 @@ namespace osu.Game.Screens.Select new Container { Margin = new MarginPadding { Top = 20 }, - AutoSizeAxes = Axes.Both, + //AutoSizeAxes = Axes.Both, Children = new Drawable[] { new Container @@ -161,11 +151,19 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new[] { - new Sprite + new TextAwesome { - Texture = time, - Scale = new Vector2(0.5f, 0.5f), + Icon = FontAwesome.fa_square, + Colour = Color4.Purple, + TextSize = 17, + Rotation = 45, }, + new TextAwesome + { + Icon = FontAwesome.fa_clock_o, + Colour = Color4.Purple, + TextSize = 17, + } } }, new SpriteText @@ -184,7 +182,7 @@ namespace osu.Game.Screens.Select { new Sprite { - Texture = bpm, + Scale = new Vector2(0.5f, 0.5f), }, } @@ -194,7 +192,7 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Left = 123, Bottom = 3 }, Font = @"Exo2.0-Bold", Colour = new Color4(255,221,85,255), - Text = ""+60000/beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime)+" bpm", + Text = ""+60000/beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime)+"bpm", TextSize = 17, }, new Container @@ -205,7 +203,7 @@ namespace osu.Game.Screens.Select { new Sprite { - Texture = hitCircles, + Scale = new Vector2(0.5f, 0.5f), }, } @@ -226,7 +224,7 @@ namespace osu.Game.Screens.Select { new Sprite { - Texture = sliders, + Scale = new Vector2(0.5f, 0.5f), }, } From 376b3df2f8b3340df18bf40318238dccd17c1b03 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 11:57:52 +0100 Subject: [PATCH 05/29] icons with TextAwesome --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 133 +++++++++++--------- 1 file changed, 77 insertions(+), 56 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index fd4d0ea208..56eb67a200 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -143,29 +143,29 @@ namespace osu.Game.Screens.Select new Container { Margin = new MarginPadding { Top = 20 }, - //AutoSizeAxes = Axes.Both, + AutoSizeAxes = Axes.Both, Children = new Drawable[] { new Container - { - AutoSizeAxes = Axes.Both, - Children = new[] - { - new TextAwesome - { - Icon = FontAwesome.fa_square, - Colour = Color4.Purple, - TextSize = 17, - Rotation = 45, - }, - new TextAwesome - { - Icon = FontAwesome.fa_clock_o, - Colour = Color4.Purple, - TextSize = 17, - } - } - }, + { + Margin = new MarginPadding { Left = 10, Top = 10 }, + AutoSizeAxes = Axes.Both, + Children = new[] { + new TextAwesome + { + Icon = FontAwesome.fa_square, + Colour = new Color4(68,17,136,255), + TextSize = 17, + Rotation = 45, + }, + new TextAwesome + { + Icon = FontAwesome.fa_clock_o, + Colour = new Color4(255,221,85,255), + TextSize = 14, + } + } + }, new SpriteText { Margin = new MarginPadding { Left = 23, Bottom = 3 }, @@ -175,18 +175,25 @@ namespace osu.Game.Screens.Select TextSize = 17, }, new Container - { - Margin = new MarginPadding { Left = 100 }, - AutoSizeAxes = Axes.Both, - Children = new[] - { - new Sprite - { - - Scale = new Vector2(0.5f, 0.5f), - }, - } - }, + { + Margin = new MarginPadding { Left = 110, Top = 10 }, + AutoSizeAxes = Axes.Both, + Children = new[] { + new TextAwesome + { + Icon = FontAwesome.fa_square, + Colour = new Color4(68,17,136,255), + TextSize = 17, + Rotation = 45, + }, + new TextAwesome + { + Icon = FontAwesome.fa_circle_o, + Colour = new Color4(255,221,85,255), + TextSize = 14, + } + } + }, new SpriteText { Margin = new MarginPadding { Left = 123, Bottom = 3 }, @@ -196,18 +203,25 @@ namespace osu.Game.Screens.Select TextSize = 17, }, new Container - { - Margin = new MarginPadding { Left = 200 }, - AutoSizeAxes = Axes.Both, - Children = new[] - { - new Sprite - { - - Scale = new Vector2(0.5f, 0.5f), - }, - } - }, + { + Margin = new MarginPadding { Left = 210, Top = 10 }, + AutoSizeAxes = Axes.Both, + Children = new[] { + new TextAwesome + { + Icon = FontAwesome.fa_square, + Colour = new Color4(68,17,136,255), + TextSize = 17, + Rotation = 45, + }, + new TextAwesome + { + Icon = FontAwesome.fa_dot_circle_o, + Colour = new Color4(255,221,85,255), + TextSize = 14, + } + } + }, new SpriteText { Margin = new MarginPadding { Left = 223, Bottom = 3 }, @@ -217,18 +231,25 @@ namespace osu.Game.Screens.Select TextSize = 17, }, new Container - { - Margin = new MarginPadding { Left = 300 }, - AutoSizeAxes = Axes.Both, - Children = new[] - { - new Sprite - { - - Scale = new Vector2(0.5f, 0.5f), - }, - } - }, + { + Margin = new MarginPadding { Left = 310, Top = 10 }, + AutoSizeAxes = Axes.Both, + Children = new[] { + new TextAwesome + { + Icon = FontAwesome.fa_square, + Colour = new Color4(68,17,136,255), + TextSize = 17, + Rotation = 45, + }, + new TextAwesome + { + Icon = FontAwesome.fa_circle_o, + Colour = new Color4(255,221,85,255), + TextSize = 14, + } + } + }, new SpriteText { Margin = new MarginPadding { Left = 323, Bottom = 3 }, From e31e19f1b870974129389087aa5e67d759de3f66 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 12:04:42 +0100 Subject: [PATCH 06/29] removed unnecessary padding --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 56eb67a200..85f056c44a 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -168,7 +168,7 @@ namespace osu.Game.Screens.Select }, new SpriteText { - Margin = new MarginPadding { Left = 23, Bottom = 3 }, + Margin = new MarginPadding { Left = 23}, Font = @"Exo2.0-Bold", Colour = new Color4(255,221,85,255), Text = ""+TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime-beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"), @@ -196,7 +196,7 @@ namespace osu.Game.Screens.Select }, new SpriteText { - Margin = new MarginPadding { Left = 123, Bottom = 3 }, + Margin = new MarginPadding { Left = 123}, Font = @"Exo2.0-Bold", Colour = new Color4(255,221,85,255), Text = ""+60000/beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime)+"bpm", @@ -224,7 +224,7 @@ namespace osu.Game.Screens.Select }, new SpriteText { - Margin = new MarginPadding { Left = 223, Bottom = 3 }, + Margin = new MarginPadding { Left = 223}, Font = @"Exo2.0-Bold", Colour = new Color4(255,221,85,255), Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")), @@ -252,7 +252,7 @@ namespace osu.Game.Screens.Select }, new SpriteText { - Margin = new MarginPadding { Left = 323, Bottom = 3 }, + Margin = new MarginPadding { Left = 323}, Font = @"Exo2.0-Bold", Colour = new Color4(255,221,85,255), Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")), From 9e6161b862d6a1c28d977b27fdd97ff130008140 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 12:18:55 +0100 Subject: [PATCH 07/29] better scaling --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 85f056c44a..0ed1b1ccb3 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -155,14 +155,13 @@ namespace osu.Game.Screens.Select { Icon = FontAwesome.fa_square, Colour = new Color4(68,17,136,255), - TextSize = 17, Rotation = 45, }, new TextAwesome { Icon = FontAwesome.fa_clock_o, Colour = new Color4(255,221,85,255), - TextSize = 14, + Scale = new Vector2(0.8f,0.8f), } } }, @@ -183,14 +182,13 @@ namespace osu.Game.Screens.Select { Icon = FontAwesome.fa_square, Colour = new Color4(68,17,136,255), - TextSize = 17, Rotation = 45, }, new TextAwesome { Icon = FontAwesome.fa_circle_o, Colour = new Color4(255,221,85,255), - TextSize = 14, + Scale = new Vector2(0.8f,0.8f), } } }, @@ -211,14 +209,19 @@ namespace osu.Game.Screens.Select { Icon = FontAwesome.fa_square, Colour = new Color4(68,17,136,255), - TextSize = 17, Rotation = 45, }, new TextAwesome { - Icon = FontAwesome.fa_dot_circle_o, + Icon = FontAwesome.fa_circle_o, Colour = new Color4(255,221,85,255), - TextSize = 14, + Scale = new Vector2(0.8f,0.8f), + }, + new TextAwesome + { + Icon = FontAwesome.fa_circle_o, + Colour = new Color4(255,221,85,255), + Scale = new Vector2(0.4f,0.4f) } } }, @@ -239,14 +242,13 @@ namespace osu.Game.Screens.Select { Icon = FontAwesome.fa_square, Colour = new Color4(68,17,136,255), - TextSize = 17, Rotation = 45, }, new TextAwesome { Icon = FontAwesome.fa_circle_o, Colour = new Color4(255,221,85,255), - TextSize = 14, + Scale = new Vector2(0.8f,0.8f), } } }, From d812a7cb4ec3e08bb56778c7aac88d1ce4aa7111 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 15:53:26 +0100 Subject: [PATCH 08/29] func for icons --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 161 ++++++-------------- 1 file changed, 44 insertions(+), 117 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 0ed1b1ccb3..8ff2a370ab 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -60,6 +60,11 @@ namespace osu.Game.Screens.Select BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; + string length = "" + TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"); + string bpm = 60000 / beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime) + "bpm"; + string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); + string sliders = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); + (beatmapInfoContainer = new BufferedContainer { Depth = newDepth, @@ -84,7 +89,7 @@ namespace osu.Game.Screens.Select ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)), Children = new [] { - // Zoomed-in and cropped beatmap background + // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(beatmap) { Anchor = Anchor.Centre, @@ -146,126 +151,16 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new Container - { - Margin = new MarginPadding { Left = 10, Top = 10 }, - AutoSizeAxes = Axes.Both, - Children = new[] { - new TextAwesome - { - Icon = FontAwesome.fa_square, - Colour = new Color4(68,17,136,255), - Rotation = 45, - }, - new TextAwesome - { - Icon = FontAwesome.fa_clock_o, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f), - } - } - }, - new SpriteText - { - Margin = new MarginPadding { Left = 23}, - Font = @"Exo2.0-Bold", - Colour = new Color4(255,221,85,255), - Text = ""+TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime-beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"), - TextSize = 17, - }, - new Container - { - Margin = new MarginPadding { Left = 110, Top = 10 }, - AutoSizeAxes = Axes.Both, - Children = new[] { - new TextAwesome - { - Icon = FontAwesome.fa_square, - Colour = new Color4(68,17,136,255), - Rotation = 45, - }, - new TextAwesome - { - Icon = FontAwesome.fa_circle_o, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f), - } - } - }, - new SpriteText - { - Margin = new MarginPadding { Left = 123}, - Font = @"Exo2.0-Bold", - Colour = new Color4(255,221,85,255), - Text = ""+60000/beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime)+"bpm", - TextSize = 17, - }, - new Container - { - Margin = new MarginPadding { Left = 210, Top = 10 }, - AutoSizeAxes = Axes.Both, - Children = new[] { - new TextAwesome - { - Icon = FontAwesome.fa_square, - Colour = new Color4(68,17,136,255), - Rotation = 45, - }, - new TextAwesome - { - Icon = FontAwesome.fa_circle_o, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f), - }, - new TextAwesome - { - Icon = FontAwesome.fa_circle_o, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.4f,0.4f) - } - } - }, - new SpriteText - { - Margin = new MarginPadding { Left = 223}, - Font = @"Exo2.0-Bold", - Colour = new Color4(255,221,85,255), - Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")), - TextSize = 17, - }, - new Container - { - Margin = new MarginPadding { Left = 310, Top = 10 }, - AutoSizeAxes = Axes.Both, - Children = new[] { - new TextAwesome - { - Icon = FontAwesome.fa_square, - Colour = new Color4(68,17,136,255), - Rotation = 45, - }, - new TextAwesome - { - Icon = FontAwesome.fa_circle_o, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f), - } - } - }, - new SpriteText - { - Margin = new MarginPadding { Left = 323}, - Font = @"Exo2.0-Bold", - Colour = new Color4(255,221,85,255), - Text = ""+beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")), - TextSize = 17, - }, + InfoLabel(FontAwesome.fa_clock_o, length, 0), + InfoLabel(FontAwesome.fa_circle, bpm, 1), + InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles, 2), + InfoLabel(FontAwesome.fa_circle_o, sliders, 3), } }, } - }, + }, } - }).Preload(game, delegate (Drawable d) + }).Preload(game, delegate(Drawable d) { FadeIn(250); @@ -275,5 +170,37 @@ namespace osu.Game.Screens.Select Add(d); }); } + + private Container InfoLabel(FontAwesome icon, string text, int pos) + { + Container cont = new Container + { + Margin = new MarginPadding {Left = pos*100, Top = 10 }, + AutoSizeAxes = Axes.Both, + Children = new[] { + new TextAwesome + { + Icon = FontAwesome.fa_square, + Colour = new Color4(68,17,136,255), + Rotation = 45, + }, + new TextAwesome + { + Icon = icon, + Colour = new Color4(255,221,85,255), + Scale = new Vector2(0.8f,0.8f), + }, + new SpriteText + { + Margin = new MarginPadding {Left = 13}, + Font = @"Exo2.0-Bold", + Colour = new Color4(255,221,85,255), + Text = text, + TextSize = 17, + }, + } + }; + return cont; + } } } From a04a0a7d2c65991874f58018a582b2c7901f273a Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 15:58:51 +0100 Subject: [PATCH 09/29] fix allignment... --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 8ff2a370ab..0f6059b174 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -182,13 +182,13 @@ namespace osu.Game.Screens.Select { Icon = FontAwesome.fa_square, Colour = new Color4(68,17,136,255), - Rotation = 45, + Rotation = 45 }, new TextAwesome { Icon = icon, Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f), + Scale = new Vector2(0.8f,0.8f) }, new SpriteText { @@ -197,6 +197,7 @@ namespace osu.Game.Screens.Select Colour = new Color4(255,221,85,255), Text = text, TextSize = 17, + Origin = Anchor.CentreLeft }, } }; From 2f708a704db8d8cd5852fbef57d3d79303458b1a Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 19:31:34 +0100 Subject: [PATCH 10/29] bpm range added + changed spacing --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 29 +++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 0f6059b174..a931d58624 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; using System.Linq; using osu.Game.Graphics; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Select { @@ -60,8 +61,20 @@ namespace osu.Game.Screens.Select BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; + double bpmPreview = 60000 / beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime); + double bpmMax = bpmPreview; + double bpmMin = bpmPreview; + foreach( ControlPoint a in beatmap.Beatmap.ControlPoints) + { + if (a.BeatLength == 0) continue; + double tmp = 60000 / a.BeatLength; + if (bpmMax < tmp) bpmMax = tmp; + if (bpmMin > tmp) bpmMin = tmp; + } + string bpm; + if (bpmMax == bpmMin) bpm = bpmMin + "bpm"; + else bpm = bpmMin + "-" + bpmMax + "(" + 60000 / beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; string length = "" + TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"); - string bpm = 60000 / beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime) + "bpm"; string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); string sliders = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); @@ -145,16 +158,17 @@ namespace osu.Game.Screens.Select }, } }, - new Container + new FlowContainer { Margin = new MarginPadding { Top = 20 }, + Spacing = new Vector2(40,0), AutoSizeAxes = Axes.Both, Children = new Drawable[] { - InfoLabel(FontAwesome.fa_clock_o, length, 0), - InfoLabel(FontAwesome.fa_circle, bpm, 1), - InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles, 2), - InfoLabel(FontAwesome.fa_circle_o, sliders, 3), + InfoLabel(FontAwesome.fa_clock_o, length), + InfoLabel(FontAwesome.fa_circle, bpm), + InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles), + InfoLabel(FontAwesome.fa_circle_o, sliders), } }, } @@ -171,11 +185,10 @@ namespace osu.Game.Screens.Select }); } - private Container InfoLabel(FontAwesome icon, string text, int pos) + private Container InfoLabel(FontAwesome icon, string text) { Container cont = new Container { - Margin = new MarginPadding {Left = pos*100, Top = 10 }, AutoSizeAxes = Axes.Both, Children = new[] { new TextAwesome From 73532b9172bde01acee729d71c2c207b7a4a1802 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 19:57:58 +0100 Subject: [PATCH 11/29] small code improvements --- osu.Game/Beatmaps/Beatmap.cs | 5 ++++ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 29 ++++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index fcdef1ce39..5683663816 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -17,6 +17,11 @@ namespace osu.Game.Beatmaps public List ControlPoints { get; set; } public List ComboColors { get; set; } + public double BPMAt(double time) + { + return 60000 / BeatLengthAt(time); + } + public double BeatLengthAt(double time, bool applyMultipliers = false) { int point = 0; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index a931d58624..42836e046c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -61,19 +61,7 @@ namespace osu.Game.Screens.Select BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - double bpmPreview = 60000 / beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime); - double bpmMax = bpmPreview; - double bpmMin = bpmPreview; - foreach( ControlPoint a in beatmap.Beatmap.ControlPoints) - { - if (a.BeatLength == 0) continue; - double tmp = 60000 / a.BeatLength; - if (bpmMax < tmp) bpmMax = tmp; - if (bpmMin > tmp) bpmMin = tmp; - } - string bpm; - if (bpmMax == bpmMin) bpm = bpmMin + "bpm"; - else bpm = bpmMin + "-" + bpmMax + "(" + 60000 / beatmap.Beatmap.BeatLengthAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; + string bpm = GetBPMRange(beatmap); string length = "" + TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"); string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); string sliders = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); @@ -184,6 +172,21 @@ namespace osu.Game.Screens.Select Add(d); }); } + + private string GetBPMRange(WorkingBeatmap beatmap) + { + double bpmMax = double.MinValue; + double bpmMin = double.MaxValue; + foreach (ControlPoint a in beatmap.Beatmap.ControlPoints) + { + if (a.BeatLength == 0) continue; + double tmp = 60000 / a.BeatLength; + if (bpmMax < tmp) bpmMax = tmp; + if (bpmMin > tmp) bpmMin = tmp; + } + if (bpmMax == bpmMin) return bpmMin + "bpm"; + return bpmMin + "-" + bpmMax + "(" + beatmap.Beatmap.BPMAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; + } private Container InfoLabel(FontAwesome icon, string text) { From 63dd8893d9178e6ad8e1ddf6387ae147d0aa61d7 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 02:53:43 +0100 Subject: [PATCH 12/29] bpm as ints --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 42836e046c..f85c84f2b1 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -184,8 +184,8 @@ namespace osu.Game.Screens.Select if (bpmMax < tmp) bpmMax = tmp; if (bpmMin > tmp) bpmMin = tmp; } - if (bpmMax == bpmMin) return bpmMin + "bpm"; - return bpmMin + "-" + bpmMax + "(" + beatmap.Beatmap.BPMAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; + if (bpmMax == bpmMin) return (int)bpmMin + "bpm"; + return (int)bpmMin + "-" + (int)bpmMax + "(" + (int)beatmap.Beatmap.BPMAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; } private Container InfoLabel(FontAwesome icon, string text) From 3d64bee06981610831897bbd8f5cbd90719770bd Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 03:53:26 +0100 Subject: [PATCH 13/29] proper round + std bpm --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index f85c84f2b1..74f676e8e1 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -177,15 +177,17 @@ namespace osu.Game.Screens.Select { double bpmMax = double.MinValue; double bpmMin = double.MaxValue; + //double bpmMost = 60000/ beatmap.Beatmap.ControlPoints.Select(b => b.BeatLength).GroupBy(bl => bl).OrderByDescending(grp => grp.Count()).Select(grp => grp.Key).First(); + double bpmMost = beatmap.Beatmap.BPMAt(beatmap.Beatmap.ControlPoints.GroupBy(b => b.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); foreach (ControlPoint a in beatmap.Beatmap.ControlPoints) { if (a.BeatLength == 0) continue; - double tmp = 60000 / a.BeatLength; + double tmp = beatmap.Beatmap.BPMAt(a.Time); if (bpmMax < tmp) bpmMax = tmp; if (bpmMin > tmp) bpmMin = tmp; } - if (bpmMax == bpmMin) return (int)bpmMin + "bpm"; - return (int)bpmMin + "-" + (int)bpmMax + "(" + (int)beatmap.Beatmap.BPMAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; + if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm"; + return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "(" + Math.Round(bpmMost) + ")bpm"; } private Container InfoLabel(FontAwesome icon, string text) From f551133b0e87398c72040eea3771d1764a93bca2 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 03:56:27 +0100 Subject: [PATCH 14/29] .. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 74f676e8e1..998f6112b5 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -177,7 +177,6 @@ namespace osu.Game.Screens.Select { double bpmMax = double.MinValue; double bpmMin = double.MaxValue; - //double bpmMost = 60000/ beatmap.Beatmap.ControlPoints.Select(b => b.BeatLength).GroupBy(bl => bl).OrderByDescending(grp => grp.Count()).Select(grp => grp.Key).First(); double bpmMost = beatmap.Beatmap.BPMAt(beatmap.Beatmap.ControlPoints.GroupBy(b => b.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); foreach (ControlPoint a in beatmap.Beatmap.ControlPoints) { From 492581fa50b9725da134f8f071e70293f1fbf78f Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 04:03:11 +0100 Subject: [PATCH 15/29] fixed length.seconds display --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 998f6112b5..446d3cce60 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Select BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; string bpm = GetBPMRange(beatmap); - string length = "" + TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:s"); + string length = "" + TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); string sliders = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); From 5f893d46c7adb6a62700b69b3300e0c2a57060ac Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 16:53:52 +0100 Subject: [PATCH 16/29] style fixes --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 37 ++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 446d3cce60..c06136adc6 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -61,10 +61,10 @@ namespace osu.Game.Screens.Select BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - string bpm = GetBPMRange(beatmap); - string length = "" + TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); - string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); - string sliders = "" + beatmap.Beatmap.HitObjects.Count(b => b.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); + string bpm = getBPMRange(beatmap); + string length = TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); + string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); + string sliders = "" + beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); (beatmapInfoContainer = new BufferedContainer { @@ -153,10 +153,10 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - InfoLabel(FontAwesome.fa_clock_o, length), - InfoLabel(FontAwesome.fa_circle, bpm), - InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles), - InfoLabel(FontAwesome.fa_circle_o, sliders), + infoLabel(FontAwesome.fa_clock_o, length), + infoLabel(FontAwesome.fa_circle, bpm), + infoLabel(FontAwesome.fa_dot_circle_o, hitCircles), + infoLabel(FontAwesome.fa_circle_o, sliders), } }, } @@ -173,11 +173,11 @@ namespace osu.Game.Screens.Select }); } - private string GetBPMRange(WorkingBeatmap beatmap) + private string getBPMRange(WorkingBeatmap beatmap) { double bpmMax = double.MinValue; double bpmMin = double.MaxValue; - double bpmMost = beatmap.Beatmap.BPMAt(beatmap.Beatmap.ControlPoints.GroupBy(b => b.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); + double bpmMost = beatmap.Beatmap.BPMAt(beatmap.Beatmap.ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); foreach (ControlPoint a in beatmap.Beatmap.ControlPoints) { if (a.BeatLength == 0) continue; @@ -189,23 +189,23 @@ namespace osu.Game.Screens.Select return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "(" + Math.Round(bpmMost) + ")bpm"; } - private Container InfoLabel(FontAwesome icon, string text) + private Container infoLabel(FontAwesome icon, string text) { - Container cont = new Container + return new Container { AutoSizeAxes = Axes.Both, Children = new[] { new TextAwesome { - Icon = FontAwesome.fa_square, - Colour = new Color4(68,17,136,255), - Rotation = 45 + Icon = FontAwesome.fa_square, + Colour = new Color4(68,17,136,255), + Rotation = 45 }, new TextAwesome { - Icon = icon, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f) + Icon = icon, + Colour = new Color4(255,221,85,255), + Scale = new Vector2(0.8f,0.8f) }, new SpriteText { @@ -218,7 +218,6 @@ namespace osu.Game.Screens.Select }, } }; - return cont; } } } From ded6588d3b64fecfc99d1d7d7b393335d2cd4c23 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 17:21:05 +0100 Subject: [PATCH 17/29] minor style fixed --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index c06136adc6..fdd9a8bbf0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -63,8 +63,8 @@ namespace osu.Game.Screens.Select string bpm = getBPMRange(beatmap); string length = TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); - string hitCircles = "" + beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")); - string sliders = "" + beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")); + string hitCircles = beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")).ToString(); + string sliders = beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")).ToString(); (beatmapInfoContainer = new BufferedContainer { @@ -194,7 +194,8 @@ namespace osu.Game.Screens.Select return new Container { AutoSizeAxes = Axes.Both, - Children = new[] { + Children = new[] + { new TextAwesome { Icon = FontAwesome.fa_square, From c614d61b1a04ea5af414ff582732d5caa6e5face Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 19:34:20 +0100 Subject: [PATCH 18/29] getbpm takes Beatmap instead of WorkingBeatmap --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index fdd9a8bbf0..57e9deedf9 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - string bpm = getBPMRange(beatmap); + string bpm = getBPMRange(beatmap.Beatmap); string length = TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); string hitCircles = beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")).ToString(); string sliders = beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")).ToString(); @@ -173,15 +173,15 @@ namespace osu.Game.Screens.Select }); } - private string getBPMRange(WorkingBeatmap beatmap) + private string getBPMRange(Beatmap beatmap) { double bpmMax = double.MinValue; double bpmMin = double.MaxValue; - double bpmMost = beatmap.Beatmap.BPMAt(beatmap.Beatmap.ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); - foreach (ControlPoint a in beatmap.Beatmap.ControlPoints) + double bpmMost = beatmap.BPMAt(beatmap.ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); + foreach (ControlPoint a in beatmap.ControlPoints) { if (a.BeatLength == 0) continue; - double tmp = beatmap.Beatmap.BPMAt(a.Time); + double tmp = beatmap.BPMAt(a.Time); if (bpmMax < tmp) bpmMax = tmp; if (bpmMin > tmp) bpmMin = tmp; } From 3125fa89ee7e7ea5043e99226799d9f027047be5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Jan 2017 15:06:44 +0900 Subject: [PATCH 19/29] Fix method which should be class. --- osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 118 ++++++++++---------- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 28 ++--- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 7799095a77..6c1d04909e 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -1,42 +1,42 @@ -//Copyright (c) 2007-2016 ppy Pty Ltd . -//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Transformations; -using osu.Game.Database; - -namespace osu.Game.Beatmaps.Drawables -{ - class BeatmapGroup : IStateful - { - public BeatmapPanel SelectedPanel; - - /// - /// Fires when one of our difficulties was selected. Will fire on first expand. - /// - public Action SelectionChanged; - +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; +using osu.Game.Database; + +namespace osu.Game.Beatmaps.Drawables +{ + class BeatmapGroup : IStateful + { + public BeatmapPanel SelectedPanel; + + /// + /// Fires when one of our difficulties was selected. Will fire on first expand. + /// + public Action SelectionChanged; + /// /// Fires when one of our difficulties is clicked when already selected. Should start playing the map. - /// - public Action StartRequested; - - public BeatmapSetHeader Header; - + /// + public Action StartRequested; + + public BeatmapSetHeader Header; + private BeatmapGroupState state; - public List BeatmapPanels; - - public BeatmapGroupState State - { - get { return state; } - set - { - state = value; + public List BeatmapPanels; + + public BeatmapGroupState State + { + get { return state; } + set + { + state = value; switch (state) { case BeatmapGroupState.Expanded: @@ -56,28 +56,28 @@ namespace osu.Game.Beatmaps.Drawables panel.FadeOut(300, EasingTypes.OutQuint); break; } - } - } - - public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) - { - Header = new BeatmapSetHeader(beatmap) - { - GainedSelection = headerGainedSelection, - RelativeSizeAxes = Axes.X, - }; - + } + } + + public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null) + { + Header = new BeatmapSetHeader(beatmap) + { + GainedSelection = headerGainedSelection, + RelativeSizeAxes = Axes.X, + }; + BeatmapPanels = beatmap.BeatmapSetInfo.Beatmaps.Select(b => new BeatmapPanel(b) { Alpha = 0, GainedSelection = panelGainedSelection, StartRequested = p => { StartRequested?.Invoke(p.Beatmap); }, RelativeSizeAxes = Axes.X, - }).ToList(); + }).ToList(); } - private void headerGainedSelection(BeatmapSetHeader panel) - { + private void headerGainedSelection(BeatmapSetHeader panel) + { State = BeatmapGroupState.Expanded; //we want to make sure one of our children is selected in the case none have been selected yet. @@ -85,10 +85,10 @@ namespace osu.Game.Beatmaps.Drawables BeatmapPanels.First().State = PanelSelectedState.Selected; else SelectionChanged?.Invoke(this, SelectedPanel.Beatmap); - } - - private void panelGainedSelection(BeatmapPanel panel) - { + } + + private void panelGainedSelection(BeatmapPanel panel) + { try { if (SelectedPanel == panel) return; @@ -96,18 +96,18 @@ namespace osu.Game.Beatmaps.Drawables if (SelectedPanel != null) SelectedPanel.State = PanelSelectedState.NotSelected; SelectedPanel = panel; - } - finally + } + finally { State = BeatmapGroupState.Expanded; SelectionChanged?.Invoke(this, panel.Beatmap); - } - } + } + } } public enum BeatmapGroupState { Collapsed, Expanded, - } -} + } +} diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 9d03662761..f782e36cbe 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -152,18 +152,18 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(40,0), AutoSizeAxes = Axes.Both, - Children = new Drawable[] + Children = new [] { - infoLabel(FontAwesome.fa_clock_o, length), - infoLabel(FontAwesome.fa_circle, bpm), - infoLabel(FontAwesome.fa_dot_circle_o, hitCircles), - infoLabel(FontAwesome.fa_circle_o, sliders), + new InfoLabel(FontAwesome.fa_clock_o, length), + new InfoLabel(FontAwesome.fa_circle, bpm), + new InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles), + new InfoLabel(FontAwesome.fa_circle_o, sliders), } }, } }, } - }).Preload(game, delegate(Drawable d) + }).Preload(game, delegate (Drawable d) { FadeIn(250); @@ -187,15 +187,15 @@ namespace osu.Game.Screens.Select if (bpmMin > tmp) bpmMin = tmp; } if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm"; - return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "(" + Math.Round(bpmMost) + ")bpm"; + return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (avg. " + Math.Round(bpmMost) + "bpm)"; } - - private Container infoLabel(FontAwesome icon, string text) + + public class InfoLabel : Container { - return new Container + public InfoLabel(FontAwesome icon, string text) { - AutoSizeAxes = Axes.Both, - Children = new[] + AutoSizeAxes = Axes.Both; + Children = new[] { new TextAwesome { @@ -218,8 +218,8 @@ namespace osu.Game.Screens.Select TextSize = 17, Origin = Anchor.CentreLeft }, - } - }; + }; + } } } } From 2e76874384229802a0092485c78b5381bfa00c60 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Jan 2017 15:09:42 +0900 Subject: [PATCH 20/29] Simplify the lookup conditions for hitcircles/sliders (uses duration to discern). --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index f782e36cbe..0e85b3bcae 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -63,8 +63,8 @@ namespace osu.Game.Screens.Select string bpm = getBPMRange(beatmap.Beatmap); string length = TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); - string hitCircles = beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.HitCircle")).ToString(); - string sliders = beatmap.Beatmap.HitObjects.Count(h => h.GetType().ToString().Equals("osu.Game.Modes.Osu.Objects.Slider")).ToString(); + string hitCircles = beatmap.Beatmap.HitObjects.Count(h => h.Duration == 0).ToString(); + string sliders = beatmap.Beatmap.HitObjects.Count(h => h.Duration > 0).ToString(); (beatmapInfoContainer = new BufferedContainer { From 6027cc7afa92f19fbd7141696f21ad2676cd1eb3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Jan 2017 15:15:04 +0900 Subject: [PATCH 21/29] Formatting fixes. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 0e85b3bcae..5a1d7377cf 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -200,20 +200,20 @@ namespace osu.Game.Screens.Select new TextAwesome { Icon = FontAwesome.fa_square, - Colour = new Color4(68,17,136,255), + Colour = new Color4(68, 17, 136, 255), Rotation = 45 }, new TextAwesome { Icon = icon, - Colour = new Color4(255,221,85,255), - Scale = new Vector2(0.8f,0.8f) + Colour = new Color4(255, 221, 85, 255), + Scale = new Vector2(0.8f) }, new SpriteText { - Margin = new MarginPadding {Left = 13}, + Margin = new MarginPadding { Left = 13 }, Font = @"Exo2.0-Bold", - Colour = new Color4(255,221,85,255), + Colour = new Color4(255, 221, 85, 255), Text = text, TextSize = 17, Origin = Anchor.CentreLeft From 3286713d117e7566a548966c6a2c5e33590d0985 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Jan 2017 15:16:38 +0900 Subject: [PATCH 22/29] avg -> mostly --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 5a1d7377cf..3a53542119 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -187,7 +187,7 @@ namespace osu.Game.Screens.Select if (bpmMin > tmp) bpmMin = tmp; } if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm"; - return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (avg. " + Math.Round(bpmMost) + "bpm)"; + return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(bpmMost) + "bpm)"; } public class InfoLabel : Container From e93f60396f9bfd1905bc63038e92247b2998f37b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 13:12:30 +0900 Subject: [PATCH 23/29] Add the ability for individual game modes to report statistics for display at song select. --- osu.Game.Modes.Osu/OsuRuleset.cs | 19 ++++++++++++ osu.Game/Modes/Ruleset.cs | 11 +++++++ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 34 ++++++++++++--------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 259a8c3880..b46036fd48 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -2,6 +2,9 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; @@ -15,6 +18,22 @@ namespace osu.Game.Modes.Osu public override HitRenderer CreateHitRendererWith(List objects) => new OsuHitRenderer { Objects = objects }; + public override IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] + { + new BeatmapStatistic + { + Name = @"Circle count", + Content = beatmap.Beatmap.HitObjects.Count(h => h is HitCircle).ToString(), + Icon = FontAwesome.fa_dot_circle_o + }, + new BeatmapStatistic + { + Name = @"Slider count", + Content = beatmap.Beatmap.HitObjects.Count(h => h is Slider).ToString(), + Icon = FontAwesome.fa_circle_o + } + }; + public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => new OsuScoreProcessor(hitObjectCount); diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index e0f4ce4e98..3f11bf8aef 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -9,15 +9,26 @@ using osu.Framework.Extensions; using System; using System.Collections.Concurrent; using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Graphics; namespace osu.Game.Modes { + public class BeatmapStatistic + { + public FontAwesome Icon; + public string Content; + public string Name; + } + public abstract class Ruleset { private static ConcurrentDictionary availableRulesets = new ConcurrentDictionary(); public abstract ScoreOverlay CreateScoreOverlay(); + public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; + public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount); public abstract HitRenderer CreateHitRendererWith(List objects); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 3a53542119..233e5056f8 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -2,6 +2,7 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Framework; using osu.Framework.Allocation; using OpenTK; @@ -15,8 +16,10 @@ using osu.Game.Database; using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; using System.Linq; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Graphics; using osu.Game.Beatmaps.Timing; +using osu.Game.Modes; namespace osu.Game.Screens.Select { @@ -26,7 +29,7 @@ namespace osu.Game.Screens.Select private Container beatmapInfoContainer; - private BaseGame game; + private OsuGame game; public BeatmapInfoWedge() { @@ -44,7 +47,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(BaseGame game) + private void load(OsuGame game) { this.game = game; } @@ -62,9 +65,16 @@ namespace osu.Game.Screens.Select BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; string bpm = getBPMRange(beatmap.Beatmap); - string length = TimeSpan.FromMilliseconds((beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime)).ToString(@"m\:ss"); - string hitCircles = beatmap.Beatmap.HitObjects.Count(h => h.Duration == 0).ToString(); - string sliders = beatmap.Beatmap.HitObjects.Count(h => h.Duration > 0).ToString(); + string length = TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"); + + List labels = new List + { + new InfoLabel(new BeatmapStatistic { Name = "Length", Content = length, Icon = FontAwesome.fa_clock_o }), + new InfoLabel(new BeatmapStatistic { Name = "BPM", Content = bpm, Icon = FontAwesome.fa_circle }), + }; + + //get statistics fromt he current ruleset. + Ruleset.GetRuleset(game.PlayMode.Value).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s))); (beatmapInfoContainer = new BufferedContainer { @@ -152,13 +162,7 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(40,0), AutoSizeAxes = Axes.Both, - Children = new [] - { - new InfoLabel(FontAwesome.fa_clock_o, length), - new InfoLabel(FontAwesome.fa_circle, bpm), - new InfoLabel(FontAwesome.fa_dot_circle_o, hitCircles), - new InfoLabel(FontAwesome.fa_circle_o, sliders), - } + Children = labels }, } }, @@ -192,7 +196,7 @@ namespace osu.Game.Screens.Select public class InfoLabel : Container { - public InfoLabel(FontAwesome icon, string text) + public InfoLabel(BeatmapStatistic statistic) { AutoSizeAxes = Axes.Both; Children = new[] @@ -205,7 +209,7 @@ namespace osu.Game.Screens.Select }, new TextAwesome { - Icon = icon, + Icon = statistic.Icon, Colour = new Color4(255, 221, 85, 255), Scale = new Vector2(0.8f) }, @@ -214,7 +218,7 @@ namespace osu.Game.Screens.Select Margin = new MarginPadding { Left = 13 }, Font = @"Exo2.0-Bold", Colour = new Color4(255, 221, 85, 255), - Text = text, + Text = statistic.Content, TextSize = 17, Origin = Anchor.CentreLeft }, From 0c2152f3d0a048d0fb57f41815cc826a14c5a65b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 13:14:02 +0900 Subject: [PATCH 24/29] Use beatmap's play mode. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 233e5056f8..4e86819036 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Select }; //get statistics fromt he current ruleset. - Ruleset.GetRuleset(game.PlayMode.Value).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s))); + Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s))); (beatmapInfoContainer = new BufferedContainer { From 2ed5cf7c91112f9263dc41b5b1f17d6370f9cf39 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 13:35:40 +0900 Subject: [PATCH 25/29] Hook up icons better. --- osu.Game.Modes.Catch/CatchRuleset.cs | 3 +++ osu.Game.Modes.Mania/ManiaRuleset.cs | 3 +++ osu.Game.Modes.Osu/OsuRuleset.cs | 2 ++ osu.Game.Modes.Taiko/TaikoRuleset.cs | 3 +++ osu.Game/Beatmaps/Drawables/BeatmapGroup.cs | 2 ++ osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 3 ++- osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs | 15 +++++++++------ osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 8 +++++--- osu.Game/Modes/Ruleset.cs | 5 ++--- osu.Game/Overlays/Toolbar/ToolbarModeButton.cs | 14 +------------- 10 files changed, 32 insertions(+), 26 deletions(-) diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 9ee0e2c4c3..cebc7967c4 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -2,6 +2,7 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Game.Graphics; using osu.Game.Modes.Catch.UI; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; @@ -18,6 +19,8 @@ namespace osu.Game.Modes.Catch protected override PlayMode PlayMode => PlayMode.Catch; + public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; + public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 6671b0efaf..be444adb99 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -2,6 +2,7 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Game.Graphics; using osu.Game.Modes.Mania.UI; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu; @@ -19,6 +20,8 @@ namespace osu.Game.Modes.Mania protected override PlayMode PlayMode => PlayMode.Mania; + public override FontAwesome Icon => FontAwesome.fa_osu_mania_o; + public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index b46036fd48..76e3bacb65 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -34,6 +34,8 @@ namespace osu.Game.Modes.Osu } }; + public override FontAwesome Icon => FontAwesome.fa_osu_osu_o; + public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => new OsuScoreProcessor(hitObjectCount); diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index b8a066bc8b..f844db0169 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Graphics; using osu.Game.Modes.Objects; using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.UI; @@ -19,6 +20,8 @@ namespace osu.Game.Modes.Taiko protected override PlayMode PlayMode => PlayMode.Taiko; + public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o; + public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null; public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); diff --git a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs index 6c1d04909e..9efefaf8c3 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapGroup.cs @@ -74,6 +74,8 @@ namespace osu.Game.Beatmaps.Drawables StartRequested = p => { StartRequested?.Invoke(p.Beatmap); }, RelativeSizeAxes = Axes.X, }).ToList(); + + Header.AddDifficultyIcons(BeatmapPanels); } private void headerGainedSelection(BeatmapSetHeader panel) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index ed5db58418..220aa1f56d 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -17,6 +17,7 @@ using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; using osu.Framework.Input; +using osu.Game.Modes; namespace osu.Game.Beatmaps.Drawables { @@ -83,7 +84,7 @@ namespace osu.Game.Beatmaps.Drawables Origin = Anchor.CentreLeft, Children = new Drawable[] { - new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)) + new DifficultyIcon(beatmap) { Scale = new Vector2(1.8f), Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs index 99942de133..b15942c5bb 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetHeader.cs @@ -2,6 +2,7 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -23,6 +24,7 @@ namespace osu.Game.Beatmaps.Drawables private OsuConfigManager config; private Bindable preferUnicode; private WorkingBeatmap beatmap; + private FlowContainer difficultyIcons; public BeatmapSetHeader(WorkingBeatmap beatmap) { @@ -56,15 +58,10 @@ namespace osu.Game.Beatmaps.Drawables TextSize = 17, Shadow = true, }, - new FlowContainer + difficultyIcons = new FlowContainer { Margin = new MarginPadding { Top = 5 }, AutoSizeAxes = Axes.Both, - Children = new[] - { - new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)), - new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)), - } } } } @@ -177,5 +174,11 @@ namespace osu.Game.Beatmaps.Drawables }); } } + + public void AddDifficultyIcons(IEnumerable panels) + { + foreach (var p in panels) + difficultyIcons.Add(new DifficultyIcon(p.Beatmap)); + } } } \ No newline at end of file diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 4bb02d53c4..460af12d65 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -3,7 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Modes; using OpenTK; using OpenTK.Graphics; @@ -11,7 +13,7 @@ namespace osu.Game.Beatmaps.Drawables { class DifficultyIcon : Container { - public DifficultyIcon(FontAwesome icon, Color4 color) + public DifficultyIcon(BeatmapInfo beatmap) { const float size = 20; Size = new Vector2(size); @@ -21,8 +23,8 @@ namespace osu.Game.Beatmaps.Drawables { Anchor = Anchor.Centre, TextSize = size, - Colour = color, - Icon = icon + Colour = new Color4(159, 198, 0, 255), + Icon = Ruleset.GetRuleset(beatmap.Mode).Icon } }; } diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index 3f11bf8aef..a587f82daa 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -4,11 +4,8 @@ using System.Collections.Generic; using osu.Game.Modes.Objects; using osu.Game.Modes.UI; -using System.Reflection; -using osu.Framework.Extensions; using System; using System.Collections.Concurrent; -using System.Linq; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -39,6 +36,8 @@ namespace osu.Game.Modes protected abstract PlayMode PlayMode { get; } + public virtual FontAwesome Icon => FontAwesome.fa_question_circle; + public static Ruleset GetRuleset(PlayMode mode) { Type type; diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 60ce228164..84c2a390aa 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -3,7 +3,6 @@ using osu.Framework.Extensions; using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; using osu.Game.Modes; using OpenTK.Graphics; @@ -20,7 +19,7 @@ namespace osu.Game.Overlays.Toolbar mode = value; TooltipMain = mode.GetDescription(); TooltipSub = $"Play some {mode.GetDescription()}"; - Icon = getModeIcon(mode); + Icon = Ruleset.GetRuleset(mode).Icon; } } @@ -48,17 +47,6 @@ namespace osu.Game.Overlays.Toolbar } } - private FontAwesome getModeIcon(PlayMode mode) - { - switch (mode) - { - default: return FontAwesome.fa_osu_osu_o; - case PlayMode.Taiko: return FontAwesome.fa_osu_taiko_o; - case PlayMode.Catch: return FontAwesome.fa_osu_fruits_o; - case PlayMode.Mania: return FontAwesome.fa_osu_mania_o; - } - } - protected override void LoadComplete() { base.LoadComplete(); From 1f2f2fa1444a0769552c67a8b762556d50897620 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 15:15:56 +0900 Subject: [PATCH 26/29] Fix visualtests. --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4e86819036..93280cbe4f 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select private Container beatmapInfoContainer; - private OsuGame game; + private OsuGameBase game; public BeatmapInfoWedge() { @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(OsuGame game) + private void load(OsuGameBase game) { this.game = game; } @@ -64,17 +64,27 @@ namespace osu.Game.Screens.Select BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; - string bpm = getBPMRange(beatmap.Beatmap); - string length = TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"); + List labels = new List(); - List labels = new List + if (beatmap.Beatmap != null) { - new InfoLabel(new BeatmapStatistic { Name = "Length", Content = length, Icon = FontAwesome.fa_clock_o }), - new InfoLabel(new BeatmapStatistic { Name = "BPM", Content = bpm, Icon = FontAwesome.fa_circle }), - }; + labels.Add(new InfoLabel(new BeatmapStatistic + { + Name = "Length", + Icon = FontAwesome.fa_clock_o, + Content = TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), + })); - //get statistics fromt he current ruleset. - Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s))); + labels.Add(new InfoLabel(new BeatmapStatistic + { + Name = "BPM", + Icon = FontAwesome.fa_circle, + Content = getBPMRange(beatmap.Beatmap), + })); + + //get statistics fromt he current ruleset. + Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s))); + } (beatmapInfoContainer = new BufferedContainer { From 0272c4b55940d48452f8e51f1b426d3fb73b5a1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 15:26:28 +0900 Subject: [PATCH 27/29] Add StarDifficulty property and correct colouring of difficulty icons. --- osu.Game/Beatmaps/Drawables/BeatmapPanel.cs | 2 +- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 67 +++++++++++++++++-- osu.Game/Database/BeatmapInfo.cs | 2 + osu.Game/Graphics/OsuColour.cs | 40 +++++++++-- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- 5 files changed, 102 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index 220aa1f56d..ed402858a6 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -131,7 +131,7 @@ namespace osu.Game.Beatmaps.Drawables }, } }, - new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 } + new StarCounter { Count = beatmap.StarDifficulty, StarSize = 8 } } } } diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 460af12d65..0d1a3b7320 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -1,7 +1,10 @@ //Copyright (c) 2007-2016 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.Colour; using osu.Framework.Graphics.Containers; using osu.Game.Database; using osu.Game.Graphics; @@ -13,20 +16,76 @@ namespace osu.Game.Beatmaps.Drawables { class DifficultyIcon : Container { + private readonly BeatmapInfo beatmap; + private OsuColour palette; + public DifficultyIcon(BeatmapInfo beatmap) { + this.beatmap = beatmap; const float size = 20; Size = new Vector2(size); - Children = new[] + } + + [BackgroundDependencyLoader] + private void load(OsuColour palette) + { + this.palette = palette; + + Children = new[] { new TextAwesome { Anchor = Anchor.Centre, - TextSize = size, - Colour = new Color4(159, 198, 0, 255), + TextSize = Size.X, + Colour = getColour(beatmap), + Icon = FontAwesome.fa_circle + }, + new TextAwesome + { + Anchor = Anchor.Centre, + TextSize = Size.X, + Colour = Color4.White, Icon = Ruleset.GetRuleset(beatmap.Mode).Icon } - }; + }; + } + + enum DifficultyRating + { + Easy, + Normal, + Hard, + Insane, + Expert + } + + private DifficultyRating getDifficultyRating(BeatmapInfo beatmap) + { + var rating = beatmap.StarDifficulty; + + if (rating < 1.5) return DifficultyRating.Easy; + if (rating < 2.25) return DifficultyRating.Normal; + if (rating < 3.75) return DifficultyRating.Hard; + if (rating < 5.25) return DifficultyRating.Insane; + return DifficultyRating.Expert; + } + + private Color4 getColour(BeatmapInfo beatmap) + { + switch (getDifficultyRating(beatmap)) + { + case DifficultyRating.Easy: + return palette.Green; + default: + case DifficultyRating.Normal: + return palette.Yellow; + case DifficultyRating.Hard: + return palette.Pink; + case DifficultyRating.Insane: + return palette.Purple; + case DifficultyRating.Expert: + return palette.Gray0; + } } } } \ No newline at end of file diff --git a/osu.Game/Database/BeatmapInfo.cs b/osu.Game/Database/BeatmapInfo.cs index ef5f00b634..002a883ec5 100644 --- a/osu.Game/Database/BeatmapInfo.cs +++ b/osu.Game/Database/BeatmapInfo.cs @@ -73,6 +73,8 @@ namespace osu.Game.Database // Metadata public string Version { get; set; } + public float StarDifficulty => BaseDifficulty?.OverallDifficulty ?? 5; //todo: implement properly + public bool Equals(BeatmapInfo other) { return ID == other?.ID; diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 1ab5ec8f7c..2d434fb9b4 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; using OpenTK.Graphics; using osu.Framework.Graphics.Colour; @@ -17,11 +18,23 @@ namespace osu.Game.Graphics private static Color4 FromHex(string hex) { - return new Color4( - Convert.ToByte(hex.Substring(0, 2), 16), - Convert.ToByte(hex.Substring(2, 2), 16), - Convert.ToByte(hex.Substring(4, 2), 16), - 255); + switch (hex.Length) + { + default: + throw new Exception(@"Invalid hex string length!"); + case 3: + return new Color4( + (byte)(Convert.ToByte(hex.Substring(0, 1), 16) * 17), + (byte)(Convert.ToByte(hex.Substring(1, 1), 16) * 17), + (byte)(Convert.ToByte(hex.Substring(2, 1), 16) * 17), + 255); + case 6: + return new Color4( + Convert.ToByte(hex.Substring(0, 2), 16), + Convert.ToByte(hex.Substring(2, 2), 16), + Convert.ToByte(hex.Substring(4, 2), 16), + 255); + } } // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less @@ -56,6 +69,23 @@ namespace osu.Game.Graphics public Color4 GreenDark = FromHex(@"668800"); public Color4 GreenDarker = FromHex(@"445500"); + public Color4 Gray0 = FromHex(@"000"); + public Color4 Gray1 = FromHex(@"111"); + public Color4 Gray2 = FromHex(@"222"); + public Color4 Gray3 = FromHex(@"333"); + public Color4 Gray4 = FromHex(@"444"); + public Color4 Gray5 = FromHex(@"555"); + public Color4 Gray6 = FromHex(@"666"); + public Color4 Gray7 = FromHex(@"777"); + public Color4 Gray8 = FromHex(@"888"); + public Color4 Gray9 = FromHex(@"999"); + public Color4 GrayA = FromHex(@"aaa"); + public Color4 GrayB = FromHex(@"bbb"); + public Color4 GrayC = FromHex(@"ccc"); + public Color4 GrayD = FromHex(@"ddd"); + public Color4 GrayE = FromHex(@"eee"); + public Color4 GrayF = FromHex(@"fff"); + public Color4 Red = FromHex(@"fc4549"); } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 23aed2d1a3..69336dc013 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -310,7 +310,7 @@ namespace osu.Game.Screens.Select if (b.Metadata == null) b.Metadata = beatmapSet.Metadata; }); - beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList(); + beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList(); var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database); From 8f1e7ef19a0b8d447e2a5fe955a080f2dc01a34b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 15:28:47 +0900 Subject: [PATCH 28/29] Fix non-matching shear angles. --- osu.Game/Graphics/UserInterface/BackButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index d246b421a2..7663c74f95 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -25,7 +25,7 @@ namespace osu.Game.Graphics.UserInterface private const double transform_time = 600; private const int pulse_length = 250; - private const float shear = 0.1f; + private const float shear = 0.15f; public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50); public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50); From 9f90b57543dacf94161cc3b1379aae1c553f784f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 30 Jan 2017 16:03:45 +0900 Subject: [PATCH 29/29] Move BPM calculations to Beatmap. --- osu.Game/Beatmaps/Beatmap.cs | 4 ++++ osu.Game/Screens/Select/BeatmapInfoWedge.cs | 19 +++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 5683663816..7151a13b74 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -2,6 +2,7 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; @@ -16,6 +17,9 @@ namespace osu.Game.Beatmaps public List HitObjects { get; set; } public List ControlPoints { get; set; } public List ComboColors { get; set; } + public double BPMMaximum => 60000 / ControlPoints.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).First().BeatLength; + public double BPMMinimum => 60000 / ControlPoints.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).First().BeatLength; + public double BPMMode => BPMAt(ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); public double BPMAt(double time) { diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 93280cbe4f..964f4552ba 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics.Colour; using osu.Game.Beatmaps.Drawables; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Modes; @@ -190,18 +191,12 @@ namespace osu.Game.Screens.Select private string getBPMRange(Beatmap beatmap) { - double bpmMax = double.MinValue; - double bpmMin = double.MaxValue; - double bpmMost = beatmap.BPMAt(beatmap.ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time); - foreach (ControlPoint a in beatmap.ControlPoints) - { - if (a.BeatLength == 0) continue; - double tmp = beatmap.BPMAt(a.Time); - if (bpmMax < tmp) bpmMax = tmp; - if (bpmMin > tmp) bpmMin = tmp; - } - if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm"; - return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(bpmMost) + "bpm)"; + double bpmMax = beatmap.BPMMaximum; + double bpmMin = beatmap.BPMMinimum; + + if (Precision.AlmostEquals(bpmMin, bpmMax)) return Math.Round(bpmMin) + "bpm"; + + return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(beatmap.BPMMode) + "bpm)"; } public class InfoLabel : Container