From 991ad298d96b3cc7eb0f6f4a9c3ca0427924a5d8 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Fri, 16 Dec 2016 04:25:28 +0100 Subject: [PATCH 01/50] =?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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] 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/50] .. --- 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/50] 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/50] 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/50] 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/50] 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 21c6c23189ad0626d2aabdd49031406bfb577496 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 20 Dec 2016 17:28:27 +0300 Subject: [PATCH 19/50] Login improvements --- .../Overlays/Options/General/LoginOptions.cs | 80 +++++++++++++------ 1 file changed, 54 insertions(+), 26 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 03789c59c9..39fb2ce501 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -11,20 +11,26 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; - +using osu.Game.Configuration; + namespace osu.Game.Overlays.Options.General { public class LoginOptions : OptionsSubsection, IOnlineComponent { - private Container loginForm; + private APIAccess api; - private Action performLogout; protected override string Header => "Sign In"; [BackgroundDependencyLoader(permitNulls: true)] private void load(APIAccess api) { api?.Register(this); + this.api = api; + } + + private void performLogout() + { + api.Logout(); } public void APIStateChanged(APIAccess api, APIState state) @@ -66,7 +72,7 @@ namespace osu.Game.Overlays.Options.General { RelativeSizeAxes = Axes.X, Text = "Sign out", - Action = api.Logout + Action = performLogout } }; break; @@ -79,27 +85,6 @@ namespace osu.Game.Overlays.Options.General private TextBox password; private APIAccess api; - public LoginForm() - { - Direction = FlowDirection.VerticalOnly; - AutoSizeAxes = Axes.Y; - RelativeSizeAxes = Axes.X; - Spacing = new Vector2(0, 5); - // TODO: Wire things up - Children = new Drawable[] - { - new SpriteText { Text = "Username" }, - username = new TextBox { Height = 20, RelativeSizeAxes = Axes.X, Text = api?.Username ?? string.Empty }, - new SpriteText { Text = "Password" }, - password = new PasswordTextBox { Height = 20, RelativeSizeAxes = Axes.X }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Log in", - Action = performLogin - } - }; - } private void performLogin() { @@ -108,9 +93,52 @@ namespace osu.Game.Overlays.Options.General } [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api) + private void load(APIAccess api, OsuConfigManager config) { this.api = api; + Direction = FlowDirection.VerticalOnly; + AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.X; + Spacing = new Vector2(0, 5); + // TODO: Wire things up + Children = new Drawable[] + { + new SpriteText { Text = "Username" }, + username = new TextBox + { + Height = 20, + RelativeSizeAxes = Axes.X, + Text = api?.Username ?? string.Empty + }, + new SpriteText { Text = "Password" }, + password = new PasswordTextBox + { + Height = 20, + RelativeSizeAxes = Axes.X + }, + new CheckBoxOption + { + LabelText = "Remember Username", + Bindable = config.GetBindable(OsuConfig.SaveUsername), + }, + new CheckBoxOption + { + LabelText = "Remember Password", + Bindable = config.GetBindable(OsuConfig.SavePassword), + }, + new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Log in", + Action = performLogin + }, + new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Register", + //Action = performLogin + } + }; } } } From d519e28ddaab75bfe24fe2159eb2ce52689300ca Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Tue, 20 Dec 2016 17:52:16 +0300 Subject: [PATCH 20/50] PasswordTextBox fix --- osu.Game/Overlays/Options/General/LoginOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 39fb2ce501..9939a00177 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -82,7 +82,7 @@ namespace osu.Game.Overlays.Options.General class LoginForm : FlowContainer { private TextBox username; - private TextBox password; + private PasswordTextBox password; private APIAccess api; From c7de4497132e44f3e60334cb94aa86c272e9d66a Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Wed, 21 Dec 2016 00:37:54 +0300 Subject: [PATCH 21/50] Token fix If "Save Password" is checked, Token will be saved --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 7c1f620c93..3deb447a9f 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -117,7 +117,7 @@ namespace osu.Game //refresh token may have changed. if (Config != null && API != null) { - Config.Set(OsuConfig.Token, API.Token); + Config.Set(OsuConfig.Token, Config.Get(OsuConfig.SavePassword) ? API.Token : string.Empty); Config.Save(); } From bba4c46ae35d69ac8764ab63365204ef69674b05 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Wed, 21 Dec 2016 01:05:10 +0300 Subject: [PATCH 22/50] TODO comment and deleted repeating lines --- osu.Game/Configuration/OsuConfigManager.cs | 2 -- osu.Game/Overlays/Options/General/LoginOptions.cs | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2c5c53cc3f..380af878a8 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -152,8 +152,6 @@ namespace osu.Game.Configuration Set(OsuConfig.HiddenShowFirstApproach, true); Set(OsuConfig.ComboColourSliderBall, true); Set(OsuConfig.AlternativeChatFont, false); - Set(OsuConfig.Password, string.Empty); - Set(OsuConfig.Username, string.Empty); Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0); Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0); Set(OsuConfig.AudioDevice, string.Empty); diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 9939a00177..e5de055f32 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -31,6 +31,7 @@ namespace osu.Game.Overlays.Options.General private void performLogout() { api.Logout(); + //TODO: set null strings in username, password, token } public void APIStateChanged(APIAccess api, APIState state) From 1c79ebff9f82a988ce95c51b6655c0d7700ccaad Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Wed, 21 Dec 2016 01:51:01 +0300 Subject: [PATCH 23/50] Fix loggining on start even after logout and exit --- osu.Game/OsuGameBase.cs | 2 ++ osu.Game/Overlays/Options/General/LoginOptions.cs | 11 ++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 3deb447a9f..0be9c3b1dd 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -117,6 +117,8 @@ namespace osu.Game //refresh token may have changed. if (Config != null && API != null) { + Config.Set(OsuConfig.Username, Config.Get(OsuConfig.SaveUsername) ? API.Username : string.Empty); + Config.Set(OsuConfig.Password, Config.Get(OsuConfig.SavePassword) ? API.Password : string.Empty); Config.Set(OsuConfig.Token, Config.Get(OsuConfig.SavePassword) ? API.Token : string.Empty); Config.Save(); } diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index e5de055f32..a5e21e2c47 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -26,12 +26,6 @@ namespace osu.Game.Overlays.Options.General { api?.Register(this); this.api = api; - } - - private void performLogout() - { - api.Logout(); - //TODO: set null strings in username, password, token } public void APIStateChanged(APIAccess api, APIState state) @@ -73,7 +67,7 @@ namespace osu.Game.Overlays.Options.General { RelativeSizeAxes = Axes.X, Text = "Sign out", - Action = performLogout + Action = api.Logout } }; break; @@ -101,7 +95,6 @@ namespace osu.Game.Overlays.Options.General AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; Spacing = new Vector2(0, 5); - // TODO: Wire things up Children = new Drawable[] { new SpriteText { Text = "Username" }, @@ -137,7 +130,7 @@ namespace osu.Game.Overlays.Options.General { RelativeSizeAxes = Axes.X, Text = "Register", - //Action = performLogin + //Action = registerLink } }; } From b066a7d9058c937c9b5cccfb633be50663c1fa4f Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Thu, 22 Dec 2016 15:26:31 +0300 Subject: [PATCH 24/50] Stop saving password --- osu.Game/OsuGameBase.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 0be9c3b1dd..212adb202c 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -118,7 +118,6 @@ namespace osu.Game if (Config != null && API != null) { Config.Set(OsuConfig.Username, Config.Get(OsuConfig.SaveUsername) ? API.Username : string.Empty); - Config.Set(OsuConfig.Password, Config.Get(OsuConfig.SavePassword) ? API.Password : string.Empty); Config.Set(OsuConfig.Token, Config.Get(OsuConfig.SavePassword) ? API.Token : string.Empty); Config.Save(); } From 4817d4bf102a7e18b744b2b653fbcaa169af56b4 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Thu, 22 Dec 2016 15:41:06 +0300 Subject: [PATCH 25/50] Stop using password field in .ini at all --- osu.Game/OsuGameBase.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 212adb202c..1a9ab41d72 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -68,7 +68,6 @@ namespace osu.Game Dependencies.Cache(API = new APIAccess { Username = Config.Get(OsuConfig.Username), - Password = Config.Get(OsuConfig.Password), Token = Config.Get(OsuConfig.Token) }); @@ -81,7 +80,6 @@ namespace osu.Game { case APIState.Online: Config.Set(OsuConfig.Username, Config.Get(OsuConfig.SaveUsername) ? API.Username : string.Empty); - Config.Set(OsuConfig.Password, Config.Get(OsuConfig.SavePassword) ? API.Password : string.Empty); break; } } @@ -117,7 +115,6 @@ namespace osu.Game //refresh token may have changed. if (Config != null && API != null) { - Config.Set(OsuConfig.Username, Config.Get(OsuConfig.SaveUsername) ? API.Username : string.Empty); Config.Set(OsuConfig.Token, Config.Get(OsuConfig.SavePassword) ? API.Token : string.Empty); Config.Save(); } From 7c96102229b5e14a50e9c412e92e71d799460f46 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Thu, 22 Dec 2016 16:09:42 +0300 Subject: [PATCH 26/50] When we have empty login, api.Token becames empty So we can't sign in having Token without login --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1a9ab41d72..632555cd13 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -68,7 +68,7 @@ namespace osu.Game Dependencies.Cache(API = new APIAccess { Username = Config.Get(OsuConfig.Username), - Token = Config.Get(OsuConfig.Token) + Token = string.IsNullOrEmpty(Config.Get(OsuConfig.Username)) ? string.Empty : Config.Get(OsuConfig.Token) }); API.Register(this); From cd3ab33d088072be522b350596d53cb96260082c Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 23 Dec 2016 00:43:43 +0300 Subject: [PATCH 27/50] Remove the password field from game.ini --- osu.Game/Configuration/OsuConfigManager.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 380af878a8..5b19d65dec 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -18,7 +18,6 @@ namespace osu.Game.Configuration Set(OsuConfig.MouseSpeed, 1.0); Set(OsuConfig.Username, string.Empty); - Set(OsuConfig.Password, string.Empty); Set(OsuConfig.Token, string.Empty); Set(OsuConfig.PlayMode, PlayMode.Osu); @@ -332,7 +331,6 @@ namespace osu.Game.Configuration HiddenShowFirstApproach, ComboColourSliderBall, AlternativeChatFont, - Password, Username, DisplayStarsMaximum, DisplayStarsMinimum, From 70dc3bae4aacb9490e4dbf422a79935d9e200595 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 23 Dec 2016 20:24:28 +0300 Subject: [PATCH 28/50] Dependent checkboxes --- .../Overlays/Options/General/LoginOptions.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index a5e21e2c47..c0d4784349 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -80,11 +80,22 @@ namespace osu.Game.Overlays.Options.General private PasswordTextBox password; private APIAccess api; + private CheckBoxOption saveUsername; + private CheckBoxOption savePassword; private void performLogin() { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) api.Login(username.Text, password.Text); + } + + + private void dependentChecking(CheckBoxOption saveUsername, CheckBoxOption savePassword) + { + if (savePassword.State == CheckBoxState.Checked) + { + saveUsername.State = CheckBoxState.Checked; + } } [BackgroundDependencyLoader(permitNulls: true)] @@ -110,12 +121,12 @@ namespace osu.Game.Overlays.Options.General Height = 20, RelativeSizeAxes = Axes.X }, - new CheckBoxOption + saveUsername = new CheckBoxOption { LabelText = "Remember Username", Bindable = config.GetBindable(OsuConfig.SaveUsername), }, - new CheckBoxOption + savePassword = new CheckBoxOption { LabelText = "Remember Password", Bindable = config.GetBindable(OsuConfig.SavePassword), @@ -133,6 +144,7 @@ namespace osu.Game.Overlays.Options.General //Action = registerLink } }; + dependentChecking(saveUsername, savePassword); } } } From 70c825002185a328572cf42139b5bb89f894efb9 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 23 Dec 2016 23:05:44 +0300 Subject: [PATCH 29/50] Revert "Dependent checkboxes" This reverts commit 70dc3bae4aacb9490e4dbf422a79935d9e200595. --- .../Overlays/Options/General/LoginOptions.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index c0d4784349..a5e21e2c47 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -80,22 +80,11 @@ namespace osu.Game.Overlays.Options.General private PasswordTextBox password; private APIAccess api; - private CheckBoxOption saveUsername; - private CheckBoxOption savePassword; private void performLogin() { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) api.Login(username.Text, password.Text); - } - - - private void dependentChecking(CheckBoxOption saveUsername, CheckBoxOption savePassword) - { - if (savePassword.State == CheckBoxState.Checked) - { - saveUsername.State = CheckBoxState.Checked; - } } [BackgroundDependencyLoader(permitNulls: true)] @@ -121,12 +110,12 @@ namespace osu.Game.Overlays.Options.General Height = 20, RelativeSizeAxes = Axes.X }, - saveUsername = new CheckBoxOption + new CheckBoxOption { LabelText = "Remember Username", Bindable = config.GetBindable(OsuConfig.SaveUsername), }, - savePassword = new CheckBoxOption + new CheckBoxOption { LabelText = "Remember Password", Bindable = config.GetBindable(OsuConfig.SavePassword), @@ -144,7 +133,6 @@ namespace osu.Game.Overlays.Options.General //Action = registerLink } }; - dependentChecking(saveUsername, savePassword); } } } From 9f202ecba8fc2d2acbf74e41d517816e609c8188 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Fri, 23 Dec 2016 23:49:42 +0300 Subject: [PATCH 30/50] fix --- osu.Game/Overlays/Options/General/LoginOptions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index a5e21e2c47..0c4a48b89b 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -80,6 +80,8 @@ namespace osu.Game.Overlays.Options.General private PasswordTextBox password; private APIAccess api; + private CheckBoxOption saveUsername; + private CheckBoxOption savePassword; private void performLogin() { @@ -110,12 +112,12 @@ namespace osu.Game.Overlays.Options.General Height = 20, RelativeSizeAxes = Axes.X }, - new CheckBoxOption + saveUsername = new CheckBoxOption { LabelText = "Remember Username", Bindable = config.GetBindable(OsuConfig.SaveUsername), }, - new CheckBoxOption + savePassword = new CheckBoxOption { LabelText = "Remember Password", Bindable = config.GetBindable(OsuConfig.SavePassword), From ba1d0b3a84d419f4205f9d2226aac6b72b4e8717 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 24 Dec 2016 09:09:01 +0300 Subject: [PATCH 31/50] Added Events for checkboxes --- .../Overlays/Options/General/LoginOptions.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 0c4a48b89b..a6e354bbcb 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -83,6 +83,22 @@ namespace osu.Game.Overlays.Options.General private CheckBoxOption saveUsername; private CheckBoxOption savePassword; + private void eventPassword() + { + if (savePassword.State == CheckBoxState.Checked) + { + saveUsername.State = CheckBoxState.Checked; + } + } + private void eventUsername() + { + if (savePassword.State == CheckBoxState.Checked) + { + if(saveUsername.State == CheckBoxState.Unchecked) + savePassword.State = CheckBoxState.Unchecked; + } + } + private void performLogin() { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) @@ -135,6 +151,8 @@ namespace osu.Game.Overlays.Options.General //Action = registerLink } }; + config.GetBindable(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); }; + config.GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); }; } } } From 5fbc0e408bdd33068fe9d65e14240893738bc806 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 24 Dec 2016 09:16:17 +0300 Subject: [PATCH 32/50] Remove unnesessary Username field check --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 632555cd13..a91db9414f 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -68,7 +68,7 @@ namespace osu.Game Dependencies.Cache(API = new APIAccess { Username = Config.Get(OsuConfig.Username), - Token = string.IsNullOrEmpty(Config.Get(OsuConfig.Username)) ? string.Empty : Config.Get(OsuConfig.Token) + Token = Config.Get(OsuConfig.Username) }); API.Register(this); From eabfa11614c033e2e5fdb434b131d50796ecf424 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 24 Dec 2016 10:04:43 +0300 Subject: [PATCH 33/50] Minor fix --- osu.Game/Overlays/Options/General/LoginOptions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index a6e354bbcb..4ffa1e9381 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -87,6 +87,7 @@ namespace osu.Game.Overlays.Options.General { if (savePassword.State == CheckBoxState.Checked) { + if(saveUsername.State == CheckBoxState.Unchecked) saveUsername.State = CheckBoxState.Checked; } } From acc50e34734840e5666dc9046e5b001c075d16a5 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 24 Dec 2016 10:16:22 +0300 Subject: [PATCH 34/50] fixed wrong parameter for token --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index a91db9414f..1a9ab41d72 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -68,7 +68,7 @@ namespace osu.Game Dependencies.Cache(API = new APIAccess { Username = Config.Get(OsuConfig.Username), - Token = Config.Get(OsuConfig.Username) + Token = Config.Get(OsuConfig.Token) }); API.Register(this); From c0980437a6f810ea397c7c61ad9d0ef36b091b04 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 7 Jan 2017 00:55:04 +0300 Subject: [PATCH 35/50] Removed unnecessary api reference --- osu.Game/Overlays/Options/General/LoginOptions.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 4ffa1e9381..b08393f476 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -17,15 +17,12 @@ namespace osu.Game.Overlays.Options.General { public class LoginOptions : OptionsSubsection, IOnlineComponent { - private APIAccess api; - protected override string Header => "Sign In"; [BackgroundDependencyLoader(permitNulls: true)] private void load(APIAccess api) { api?.Register(this); - this.api = api; } public void APIStateChanged(APIAccess api, APIState state) From 63fcfdbbde6f8c07f08a3044fb5c1261f9e24b0f Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Wed, 11 Jan 2017 10:28:24 +0300 Subject: [PATCH 36/50] Fixed checkboxes state and better code --- osu.Game/Overlays/Options/General/LoginOptions.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index b08393f476..5e81b741dd 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -82,19 +82,13 @@ namespace osu.Game.Overlays.Options.General private void eventPassword() { - if (savePassword.State == CheckBoxState.Checked) - { - if(saveUsername.State == CheckBoxState.Unchecked) + if ((savePassword.State == CheckBoxState.Checked) && (saveUsername.State == CheckBoxState.Unchecked)) saveUsername.State = CheckBoxState.Checked; - } } private void eventUsername() { - if (savePassword.State == CheckBoxState.Checked) - { - if(saveUsername.State == CheckBoxState.Unchecked) + if ((saveUsername.State == CheckBoxState.Unchecked) && (savePassword.State == CheckBoxState.Checked)) savePassword.State = CheckBoxState.Unchecked; - } } private void performLogin() From f12a8ace3fa9f3715612c3d170361cbb23136465 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 28 Jan 2017 13:10:05 +0300 Subject: [PATCH 37/50] Moved Config logic to OsuConfigManager --- osu.Game/Configuration/OsuConfigManager.cs | 14 ++++++++++++++ osu.Game/Overlays/Options/General/LoginOptions.cs | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 0c69f4aed2..2ff663e3a2 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -168,9 +168,23 @@ namespace osu.Game.Configuration Set(OsuConfig.CanForceOptimusCompatibility, true); Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? ConfineMouseMode.Fullscreen : ConfineMouseMode.Never); + + GetBindable(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); }; + GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); }; #pragma warning restore CS0612 // Type or member is obsolete } + private void eventPassword() + { + if ((GetBindable(OsuConfig.SavePassword) == true) && (GetBindable(OsuConfig.SaveUsername) == false)) + Set(OsuConfig.SaveUsername, true); + } + private void eventUsername() + { + if ((GetBindable(OsuConfig.SaveUsername) == false) && (GetBindable(OsuConfig.SavePassword) == true)) + Set(OsuConfig.SavePassword, false); + } + //todo: make a UnicodeString class/struct rather than requiring this helper method. public string GetUnicodeString(string nonunicode, string unicode) => Get(OsuConfig.ShowUnicode) ? unicode ?? nonunicode : nonunicode ?? unicode; diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 5e81b741dd..333b794d58 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -80,17 +80,6 @@ namespace osu.Game.Overlays.Options.General private CheckBoxOption saveUsername; private CheckBoxOption savePassword; - private void eventPassword() - { - if ((savePassword.State == CheckBoxState.Checked) && (saveUsername.State == CheckBoxState.Unchecked)) - saveUsername.State = CheckBoxState.Checked; - } - private void eventUsername() - { - if ((saveUsername.State == CheckBoxState.Unchecked) && (savePassword.State == CheckBoxState.Checked)) - savePassword.State = CheckBoxState.Unchecked; - } - private void performLogin() { if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text)) @@ -143,8 +132,6 @@ namespace osu.Game.Overlays.Options.General //Action = registerLink } }; - config.GetBindable(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); }; - config.GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); }; } } } From e25b8bb2986c4f7e81d88a78eb822653f0e1b5e4 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 28 Jan 2017 16:56:05 +0300 Subject: [PATCH 38/50] Removed explicit methods --- osu.Game/Configuration/OsuConfigManager.cs | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 2ff663e3a2..74a5cae051 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -169,20 +169,18 @@ namespace osu.Game.Configuration Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? ConfineMouseMode.Fullscreen : ConfineMouseMode.Never); - GetBindable(OsuConfig.SavePassword).ValueChanged += delegate { eventPassword(); }; - GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { eventUsername(); }; -#pragma warning restore CS0612 // Type or member is obsolete - } - private void eventPassword() - { - if ((GetBindable(OsuConfig.SavePassword) == true) && (GetBindable(OsuConfig.SaveUsername) == false)) - Set(OsuConfig.SaveUsername, true); - } - private void eventUsername() - { - if ((GetBindable(OsuConfig.SaveUsername) == false) && (GetBindable(OsuConfig.SavePassword) == true)) - Set(OsuConfig.SavePassword, false); + GetBindable(OsuConfig.SavePassword).ValueChanged += delegate + { + if (Get(OsuConfig.SavePassword) && !Get(OsuConfig.SaveUsername)) + Set(OsuConfig.SaveUsername, true); + }; + GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate + { + if (!Get(OsuConfig.SaveUsername) && Get(OsuConfig.SavePassword)) + Set(OsuConfig.SavePassword, false); + }; +#pragma warning restore CS0612 // Type or member is obsolete } //todo: make a UnicodeString class/struct rather than requiring this helper method. From 72bc7f8786504b5bdc53b6a51b1848759b5b3eb2 Mon Sep 17 00:00:00 2001 From: Andrey Zavadskiy Date: Sat, 28 Jan 2017 17:01:11 +0300 Subject: [PATCH 39/50] Simplify checking --- osu.Game/Configuration/OsuConfigManager.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 74a5cae051..86c3985436 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -172,13 +172,11 @@ namespace osu.Game.Configuration GetBindable(OsuConfig.SavePassword).ValueChanged += delegate { - if (Get(OsuConfig.SavePassword) && !Get(OsuConfig.SaveUsername)) - Set(OsuConfig.SaveUsername, true); + if (Get(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true); }; GetBindable(OsuConfig.SaveUsername).ValueChanged += delegate { - if (!Get(OsuConfig.SaveUsername) && Get(OsuConfig.SavePassword)) - Set(OsuConfig.SavePassword, false); + if (!Get(OsuConfig.SaveUsername)) Set(OsuConfig.SavePassword, false); }; #pragma warning restore CS0612 // Type or member is obsolete } From 3125fa89ee7e7ea5043e99226799d9f027047be5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 29 Jan 2017 15:06:44 +0900 Subject: [PATCH 40/50] 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 41/50] 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 42/50] 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 43/50] 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 44/50] 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 45/50] 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 46/50] 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 47/50] 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 48/50] 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 49/50] 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 50/50] 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