From 212b2c114206628c5030ff214bace924ad30a5bc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 1 Jun 2017 04:45:46 -0300 Subject: [PATCH 01/59] Initial layout and animation --- osu-resources | 2 +- .../Tests/TestCaseMedalOverlay.cs | 28 +++ .../osu.Desktop.VisualTests.csproj | 1 + osu.Game/Overlays/MedalOverlay.cs | 212 ++++++++++++++++++ .../Overlays/MedalSplash/DrawableMedal.cs | 147 ++++++++++++ osu.Game/Users/Medal.cs | 11 + osu.Game/osu.Game.csproj | 3 + 7 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs create mode 100644 osu.Game/Overlays/MedalOverlay.cs create mode 100644 osu.Game/Overlays/MedalSplash/DrawableMedal.cs create mode 100644 osu.Game/Users/Medal.cs diff --git a/osu-resources b/osu-resources index 9f46a456dc..37e9e96d01 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 9f46a456dc3a56dcbff09671a3f588b16a464106 +Subproject commit 37e9e96d011ba7faeb4a302e65fb7bdb4dc16690 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs new file mode 100644 index 0000000000..581675e66a --- /dev/null +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Game.Overlays; +using osu.Game.Users; + +namespace osu.Desktop.VisualTests.Tests +{ + internal class TestCaseMedalOverlay : TestCase + { + public override string Description => @"medal get!"; + + public override void Reset() + { + base.Reset(); + + MedalOverlay overlay; + Add(overlay = new MedalOverlay(new Medal + { + Name = @"Animations", + Description = @"More complex than you think.", + })); + + AddStep(@"show", overlay.Show); + } + } +} diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 5a532d7234..52e429efd8 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -224,6 +224,7 @@ + diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs new file mode 100644 index 0000000000..2d2a32fa4f --- /dev/null +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -0,0 +1,212 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Sprites; +using osu.Game.Users; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Overlays.MedalSplash; +using osu.Framework.Allocation; +using osu.Framework.Audio.Sample; +using osu.Framework.Audio; +using osu.Framework.Graphics.Textures; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Overlays +{ + public class MedalOverlay : FocusedOverlayContainer + { + public const float DISC_SIZE = 400; + + private const float border_width = 5; + + private readonly Box background; + private readonly FillFlowContainer backgroundStrip; + private readonly BackgroundStrip leftStrip, rightStrip; + private readonly CircularContainer disc; + private readonly Sprite innerSpin, outterSpin; + private readonly DrawableMedal drawableMedal; + + private SampleChannel getSample; + + protected override bool BlockPassThroughKeyboard => true; + + public MedalOverlay(Medal medal) + { + RelativeSizeAxes = Axes.Both; + Alpha = 0f; + + Children = new Drawable[] + { + background = new Box + { + Name = @"dim", + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black.Opacity(60), + }, + outterSpin = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(DISC_SIZE + 500), + Alpha = 0f, + }, + backgroundStrip = new FillFlowContainer + { + Name = @"background strip", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Width = 0f, + Height = border_width, + Alpha = 0f, + Direction = FillDirection.Horizontal, + Children = new[] + { + leftStrip = new BackgroundStrip(0f, 1f), + rightStrip = new BackgroundStrip(1f, 0f), + }, + }, + disc = new CircularContainer + { + Name = @"content", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0f, + Masking = true, + BorderColour = Color4.White, + BorderThickness = border_width, + Size = new Vector2(DISC_SIZE), + Scale = new Vector2(0.8f), + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"05262f"), + }, + new Triangles + { + RelativeSizeAxes = Axes.Both, + TriangleScale = 2, + ColourDark = OsuColour.FromHex(@"04222b"), + ColourLight = OsuColour.FromHex(@"052933"), + }, + innerSpin = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Size = new Vector2(1.05f), + Alpha = 0.25f, + }, + drawableMedal = new DrawableMedal(medal) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, TextureStore textures, AudioManager audio) + { + getSample = audio.Sample.Get(@"MedalSplash/medal-get"); + innerSpin.Texture = outterSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); + + disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Glow, + Colour = colours.Blue.Opacity(0.5f), + Radius = 50, + }; + } + + protected override void PopIn() + { + base.PopIn(); + + FadeIn(200); + background.FlashColour(Color4.White.Opacity(0.25f), 400); + + double duration1 = 400; + double duration2 = 900; + double duration3 = 900; + double duration4 = 1000; + + getSample.Play(); + Delay(200, true); + + innerSpin.Transforms.Add(new TransformRotation + { + StartValue = 0, + EndValue = 359, + StartTime = Clock.TimeInfo.Current, + EndTime = Clock.TimeInfo.Current + 20000, + LoopCount = -1, + }); + + outterSpin.Transforms.Add(new TransformRotation + { + StartValue = 0, + EndValue = 359, + StartTime = Clock.TimeInfo.Current, + EndTime = Clock.TimeInfo.Current + 40000, + LoopCount = -1, + }); + + disc.FadeIn(duration1); + backgroundStrip.FadeIn(duration1); + backgroundStrip.ResizeWidthTo(1f, duration1 * 2, EasingTypes.OutQuint); + outterSpin.FadeTo(0.1f, duration1 * 2); + disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); + + Delay(duration1 + 200, true); + drawableMedal.ChangeState(DrawableMedal.DisplayState.Icon, duration2); + + Delay(duration2, true); + drawableMedal.ChangeState(DrawableMedal.DisplayState.MedalUnlocked, duration3); + + Delay(duration3, true); + drawableMedal.ChangeState(DrawableMedal.DisplayState.Full, duration4); + } + + protected override void PopOut() + { + base.PopOut(); + + FadeOut(200); + } + + private class BackgroundStrip : Container + { + public BackgroundStrip(float start, float end) + { + RelativeSizeAxes = Axes.Both; + Width = 0.5f; + ColourInfo = ColourInfo.GradientHorizontal(Color4.White.Opacity(start), Color4.White.Opacity(end)); + Masking = true; + + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.White, + } + }; + } + } + } +} diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs new file mode 100644 index 0000000000..c85adc4f2a --- /dev/null +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -0,0 +1,147 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Overlays.MedalSplash +{ + public class DrawableMedal : Container + { + private const float scale_when_unlocked = 0.76f; + private const float scale_when_full = 0.6f; + + private readonly Container medal; + private readonly Sprite medalGlow; + private readonly OsuSpriteText unlocked, name; + private readonly Paragraph description; + private readonly FillFlowContainer infoFlow; + private readonly IEnumerable descriptionSprites; + + public DrawableMedal(Medal medal) + { + Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); + + Children = new Drawable[] + { + this.medal = new Container + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Alpha = 0f, + Children = new[] + { + medalGlow = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }, + }, + unlocked = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "Medal Unlocked".ToUpper(), + TextSize = 24, + Font = @"Exo2.0-Light", + Alpha = 0f, + Scale = new Vector2(1 / scale_when_unlocked), + }, + infoFlow = new FillFlowContainer + { + Anchor = Anchor.TopCentre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Width = 0.6f, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0f, 5f), + Children = new Drawable[] + { + name = new OsuSpriteText + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = medal.Name, + TextSize = 20, + Font = @"Exo2.0-Bold", + Alpha = 0f, + Scale = new Vector2(1 / scale_when_full), + }, + description = new Paragraph + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Alpha = 0f, + Scale = new Vector2(1 / scale_when_full), + }, + }, + }, + }; + + descriptionSprites = description.AddText(medal.Description, s => + { + s.Anchor = Anchor.TopCentre; + s.Origin = Anchor.TopCentre; + s.TextSize = 16; + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours, TextureStore textures) + { + medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); + + foreach (var s in descriptionSprites) + s.Colour = colours.BlueLight; + + var pos = new Vector2(0f, medal.Size.Y / 2 + 10); + unlocked.Position = pos; + pos.Y += 90; + infoFlow.Position = pos; + } + + public void ChangeState(DisplayState newState, double duration) + { + switch (newState) + { + case DisplayState.Icon: + medal.Scale = Vector2.Zero; + medal.ScaleTo(1, duration, EasingTypes.OutElastic); + medal.FadeInFromZero(duration); + break; + case DisplayState.MedalUnlocked: + ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); + MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); + unlocked.FadeInFromZero(duration); + break; + case DisplayState.Full: + ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); + MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); + name.FadeInFromZero(duration); + description.FadeInFromZero(duration * 2); + break; + } + } + + public enum DisplayState + { + Icon, + MedalUnlocked, + Full, + } + } +} diff --git a/osu.Game/Users/Medal.cs b/osu.Game/Users/Medal.cs new file mode 100644 index 0000000000..5ac6eceddc --- /dev/null +++ b/osu.Game/Users/Medal.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Users +{ + public class Medal + { + public string Name { get; set; } + public string Description { get; set; } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 0ec0624978..93d0652aa9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -452,6 +452,9 @@ + + + From 15cd4f77b2eb40506f985860d18c5084e2f74efd Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 22:35:06 -0300 Subject: [PATCH 02/59] Proper dismissing. --- osu.Game/Overlays/MedalOverlay.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 2d2a32fa4f..a796da82b9 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -19,6 +19,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK.Input; +using System.Linq; namespace osu.Game.Overlays { @@ -37,7 +38,16 @@ namespace osu.Game.Overlays private SampleChannel getSample; - protected override bool BlockPassThroughKeyboard => true; + protected override bool OnClick(InputState state) + { + dismiss(); + return true; + } + + protected override void OnFocusLost(InputState state) + { + if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + } public MedalOverlay(Medal medal) { @@ -189,6 +199,12 @@ namespace osu.Game.Overlays FadeOut(200); } + private void dismiss() + { + if (drawableMedal.Transforms.Count != 0) return; + Hide(); + } + private class BackgroundStrip : Container { public BackgroundStrip(float start, float end) From 3c97f0482655b2cb049ee5447c04db1e0618630a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 23:18:44 -0300 Subject: [PATCH 03/59] Particles. --- osu.Game/Overlays/MedalOverlay.cs | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index a40d9bffda..6cb7e7662b 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -21,6 +21,8 @@ using osu.Framework.Input; using OpenTK.Input; using System.Linq; using osu.Framework.Graphics.Shapes; +using System; +using osu.Framework.MathUtils; namespace osu.Game.Overlays { @@ -144,6 +146,13 @@ namespace osu.Game.Overlays }; } + protected override void Update() + { + base.Update(); + + Add(new MedalParticle(RNG.Next(0, 359))); + } + protected override void PopIn() { base.PopIn(); @@ -225,5 +234,36 @@ namespace osu.Game.Overlays }; } } + + private class MedalParticle : CircularContainer + { + private readonly float direction; + + private Vector2 positionForOffset(float offset) => new Vector2((float)(offset * Math.Sin(direction)), (float)(offset * Math.Cos(direction))); + + public MedalParticle(float direction) + { + this.direction = direction; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + Position = positionForOffset(DISC_SIZE / 2); + Masking = true; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + EdgeEffect = new EdgeEffectParameters + { + Type = EdgeEffectType.Glow, + Colour = colours.Blue.Opacity(0.5f), + Radius = 5, + }; + + MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500); + FadeOut(500); + Expire(); + } + } } } From c71f34c50796eea717378dede6cb101dd31f6e4a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 23 Jun 2017 23:51:28 -0300 Subject: [PATCH 04/59] Make the background strip expand from the disc edges. --- osu.Game/Overlays/MedalOverlay.cs | 43 ++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 6cb7e7662b..ecd9a0af2f 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays private const float border_width = 5; private readonly Box background; - private readonly FillFlowContainer backgroundStrip; + private readonly Container backgroundStrip; private readonly BackgroundStrip leftStrip, rightStrip; private readonly CircularContainer disc; private readonly Sprite innerSpin, outterSpin; @@ -72,20 +72,44 @@ namespace osu.Game.Overlays Size = new Vector2(DISC_SIZE + 500), Alpha = 0f, }, - backgroundStrip = new FillFlowContainer + backgroundStrip = new Container { Name = @"background strip", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, - Width = 0f, Height = border_width, Alpha = 0f, - Direction = FillDirection.Horizontal, Children = new[] { - leftStrip = new BackgroundStrip(0f, 1f), - rightStrip = new BackgroundStrip(1f, 0f), + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.CentreRight, + Width = 0.5f, + Padding = new MarginPadding { Right = DISC_SIZE / 2 }, + Children = new[] + { + leftStrip = new BackgroundStrip(0f, 1f) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }, + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.CentreLeft, + Width = 0.5f, + Padding = new MarginPadding { Left = DISC_SIZE / 2 }, + Children = new[] + { + rightStrip = new BackgroundStrip(1f, 0f), + }, + }, }, }, disc = new CircularContainer @@ -187,12 +211,13 @@ namespace osu.Game.Overlays }); disc.FadeIn(duration1); - backgroundStrip.FadeIn(duration1); - backgroundStrip.ResizeWidthTo(1f, duration1 * 2, EasingTypes.OutQuint); outterSpin.FadeTo(0.1f, duration1 * 2); disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); Delay(duration1 + 200, true); + backgroundStrip.FadeIn(duration2); + leftStrip.ResizeWidthTo(1f, duration2, EasingTypes.OutQuint); + rightStrip.ResizeWidthTo(1f, duration2, EasingTypes.OutQuint); drawableMedal.ChangeState(DrawableMedal.DisplayState.Icon, duration2); Delay(duration2, true); @@ -220,7 +245,7 @@ namespace osu.Game.Overlays public BackgroundStrip(float start, float end) { RelativeSizeAxes = Axes.Both; - Width = 0.5f; + Width = 0f; ColourInfo = ColourInfo.GradientHorizontal(Color4.White.Opacity(start), Color4.White.Opacity(end)); Masking = true; From 0133f9c0869d4ff7123d049a1c1623f9a2c0acee Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 01:19:44 -0300 Subject: [PATCH 05/59] Medal sprite, make MedalOverlay auto-show when loaded. --- .../Tests/TestCaseMedalOverlay.cs | 6 ++--- osu.Game/Overlays/MedalOverlay.cs | 2 ++ .../Overlays/MedalSplash/DrawableMedal.cs | 23 +++++++++++++------ osu.Game/Users/Medal.cs | 2 ++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs index 581675e66a..ac983277a4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -15,14 +15,12 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - MedalOverlay overlay; - Add(overlay = new MedalOverlay(new Medal + Add(new MedalOverlay(new Medal { Name = @"Animations", + InternalName = @"all-intro-doubletime", Description = @"More complex than you think.", })); - - AddStep(@"show", overlay.Show); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index ecd9a0af2f..d9c949a0da 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -168,6 +168,8 @@ namespace osu.Game.Overlays Colour = colours.Blue.Opacity(0.5f), Radius = 50, }; + + Show(); } protected override void Update() diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index ba2e3964a4..e230b9de9b 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -19,8 +19,9 @@ namespace osu.Game.Overlays.MedalSplash private const float scale_when_unlocked = 0.76f; private const float scale_when_full = 0.6f; - private readonly Container medal; - private readonly Sprite medalGlow; + private readonly Medal medal; + private readonly Container medalContainer; + private readonly Sprite medalGlow, medalSprite; private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private readonly FillFlowContainer infoFlow; @@ -28,11 +29,12 @@ namespace osu.Game.Overlays.MedalSplash public DrawableMedal(Medal medal) { + this.medal = medal; Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); Children = new Drawable[] { - this.medal = new Container + this.medalContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, @@ -40,6 +42,12 @@ namespace osu.Game.Overlays.MedalSplash Alpha = 0f, Children = new[] { + medalSprite = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(0.81f), + }, medalGlow = new Sprite { Anchor = Anchor.Centre, @@ -102,12 +110,13 @@ namespace osu.Game.Overlays.MedalSplash [BackgroundDependencyLoader] private void load(OsuColour colours, TextureStore textures) { + medalSprite.Texture = textures.Get(medal.ImageUrl); medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); foreach (var s in descriptionSprites) s.Colour = colours.BlueLight; - var pos = new Vector2(0f, medal.Size.Y / 2 + 10); + var pos = new Vector2(0f, medalContainer.Size.Y / 2 + 10); unlocked.Position = pos; pos.Y += 90; infoFlow.Position = pos; @@ -118,9 +127,9 @@ namespace osu.Game.Overlays.MedalSplash switch (newState) { case DisplayState.Icon: - medal.Scale = Vector2.Zero; - medal.ScaleTo(1, duration, EasingTypes.OutElastic); - medal.FadeInFromZero(duration); + medalContainer.Scale = Vector2.Zero; + medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic); + medalContainer.FadeInFromZero(duration); break; case DisplayState.MedalUnlocked: ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); diff --git a/osu.Game/Users/Medal.cs b/osu.Game/Users/Medal.cs index 5ac6eceddc..aa7382b457 100644 --- a/osu.Game/Users/Medal.cs +++ b/osu.Game/Users/Medal.cs @@ -6,6 +6,8 @@ namespace osu.Game.Users public class Medal { public string Name { get; set; } + public string InternalName { get; set; } + public string ImageUrl => $@"https://s.ppy.sh/images/medals-client/{InternalName}@2x.png"; public string Description { get; set; } } } From b2c516238e70f4b19950dbde62701df3eb4dd3e2 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 01:48:55 -0300 Subject: [PATCH 06/59] Cleanup. --- osu.Game/Overlays/MedalOverlay.cs | 15 ++++++++++----- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 14 ++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index d9c949a0da..617a5f7d0b 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays private const float border_width = 5; private readonly Box background; - private readonly Container backgroundStrip; + private readonly Container backgroundStrip, particleContainer; private readonly BackgroundStrip leftStrip, rightStrip; private readonly CircularContainer disc; private readonly Sprite innerSpin, outterSpin; @@ -61,7 +61,6 @@ namespace osu.Game.Overlays { background = new Box { - Name = @"dim", RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(60), }, @@ -74,7 +73,6 @@ namespace osu.Game.Overlays }, backgroundStrip = new Container { - Name = @"background strip", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, @@ -112,9 +110,12 @@ namespace osu.Game.Overlays }, }, }, + particleContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, disc = new CircularContainer { - Name = @"content", Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0f, @@ -168,7 +169,11 @@ namespace osu.Game.Overlays Colour = colours.Blue.Opacity(0.5f), Radius = 50, }; + } + protected override void LoadComplete() + { + base.LoadComplete(); Show(); } @@ -176,7 +181,7 @@ namespace osu.Game.Overlays { base.Update(); - Add(new MedalParticle(RNG.Next(0, 359))); + particleContainer.Add(new MedalParticle(RNG.Next(0, 359))); } protected override void PopIn() diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index e230b9de9b..e385601f6d 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.MedalSplash Children = new Drawable[] { - this.medalContainer = new Container + medalContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.MedalSplash TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, - Scale = new Vector2(1 / scale_when_unlocked), + Scale = new Vector2(1f / scale_when_unlocked), }, infoFlow = new FillFlowContainer { @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.MedalSplash TextSize = 20, Font = @"Exo2.0-Bold", Alpha = 0f, - Scale = new Vector2(1 / scale_when_full), + Scale = new Vector2(1f / scale_when_full), }, description = new TextFlowContainer { @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.MedalSplash RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Alpha = 0f, - Scale = new Vector2(1 / scale_when_full), + Scale = new Vector2(1f / scale_when_full), }, }, }, @@ -116,10 +116,8 @@ namespace osu.Game.Overlays.MedalSplash foreach (var s in descriptionSprites) s.Colour = colours.BlueLight; - var pos = new Vector2(0f, medalContainer.Size.Y / 2 + 10); - unlocked.Position = pos; - pos.Y += 90; - infoFlow.Position = pos; + unlocked.Position = new Vector2(0f, medalContainer.Size.Y / 2 + 10); + infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90); } public void ChangeState(DisplayState newState, double duration) From 0de55776c03bfbb7f47e467c5dac68f40c35f6cc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:05:48 -0300 Subject: [PATCH 07/59] Update DrawableRoom design. --- .../Tests/TestCaseDrawableRoom.cs | 130 +++++++---- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 212 ++++++++++++++---- osu.Game/Screens/Multiplayer/RoomInspector.cs | 1 - 3 files changed, 254 insertions(+), 89 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 43a8069720..db8b712638 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -8,6 +8,7 @@ using osu.Game.Screens.Multiplayer; using osu.Game.Online.Multiplayer; using osu.Game.Users; using osu.Game.Database; +using osu.Framework.Allocation; namespace osu.Desktop.VisualTests.Tests { @@ -15,74 +16,105 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Select your favourite room"; + private RulesetDatabase rulesets; + public override void Reset() { base.Reset(); DrawableRoom first; - DrawableRoom second; Add(new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Y, - Width = 500f, + Width = 580f, Direction = FillDirection.Vertical, Children = new Drawable[] { - first = new DrawableRoom(new Room()), - second = new DrawableRoom(new Room()), + first = new DrawableRoom(new Room + { + Name = { Value = @"Great Room Right Here" }, + Host = { Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTeamVersus() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 4.65, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Critical Crystal", + Artist = @"Seiryu", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455" }, + }, + }, + }, + Participants = + { + Value = new[] + { + new User { GlobalRank = 1355 }, + new User { GlobalRank = 8756 }, + }, + }, + }), + new DrawableRoom(new Room + { + Name = { Value = @"Relax It's The Weekend" }, + Host = { Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } } }, + Status = { Value = new RoomStatusPlaying() }, + Type = { Value = new GameTypeTagTeam() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 1.96, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"Serendipity", + Artist = @"ZAQ", + }, + OnlineInfo = new BeatmapOnlineInfo + { + Covers = new[] { @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706" }, + }, + }, + }, + Participants = + { + Value = new[] + { + new User { GlobalRank = 578975 }, + new User { GlobalRank = 24554 }, + }, + }, + }), } }); - first.Room.Name.Value = @"Great Room Right Here"; - first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } }; - first.Room.Status.Value = new RoomStatusOpen(); - first.Room.Beatmap.Value = new BeatmapInfo + AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name"); + AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }); + AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying()); + AddStep(@"change type", () => first.Room.Type.Value = new GameTypeVersus()); + AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null); + AddStep(@"change participants", () => first.Room.Participants.Value = new[] { - Metadata = new BeatmapMetadata - { - Title = @"Seiryu", - Artist = @"Critical Crystal", - }, - }; - - second.Room.Name.Value = @"Relax It's The Weekend"; - second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } }; - second.Room.Status.Value = new RoomStatusPlaying(); - second.Room.Beatmap.Value = new BeatmapInfo - { - Metadata = new BeatmapMetadata - { - Title = @"Serendipity", - Artist = @"ZAQ", - }, - }; - - AddStep(@"change state", () => - { - first.Room.Status.Value = new RoomStatusPlaying(); + new User { GlobalRank = 1254 }, + new User { GlobalRank = 123189 }, }); + } - AddStep(@"change name", () => - { - first.Room.Name.Value = @"I Changed Name"; - }); - - AddStep(@"change host", () => - { - first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } }; - }); - - AddStep(@"change beatmap", () => - { - first.Room.Beatmap.Value = null; - }); - - AddStep(@"change state", () => - { - first.Room.Status.Value = new RoomStatusOpen(); - }); + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + this.rulesets = rulesets; } } } diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 71114dd3a3..bd58fafd12 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -1,14 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; +using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -19,22 +23,36 @@ namespace osu.Game.Screens.Multiplayer { public class DrawableRoom : ClickableContainer { - private const float content_padding = 5; - private const float height = 90; + private const float transition_duration = 100; + private const float content_padding = 10; + private const float height = 100; + private const float side_strip_width = 5; + private const float cover_width = 145; + private const float ruleset_height = 30; private readonly Box sideStrip; - private readonly UpdateableAvatar avatar; + private readonly Container coverContainer, rulesetContainer, gameTypeContainer; private readonly OsuSpriteText name; private readonly Container flagContainer; private readonly OsuSpriteText host; - private readonly OsuSpriteText rankBounds; + private readonly FillFlowContainer levelRangeContainer; + private readonly OsuSpriteText levelRangeLower; + private readonly OsuSpriteText levelRangeHigher; private readonly OsuSpriteText status; private readonly FillFlowContainer beatmapInfoFlow; private readonly OsuSpriteText beatmapTitle; private readonly OsuSpriteText beatmapDash; private readonly OsuSpriteText beatmapArtist; + private readonly Bindable nameBind = new Bindable(); + private readonly Bindable hostBind = new Bindable(); + private readonly Bindable statusBind = new Bindable(); + private readonly Bindable typeBind = new Bindable(); + private readonly Bindable beatmapBind = new Bindable(); + private readonly Bindable participantsBind = new Bindable(); + private OsuColour colours; + private TextureStore textures; private LocalisationEngine localisation; public readonly Room Room; @@ -59,24 +77,36 @@ namespace osu.Game.Screens.Multiplayer new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(34), + Colour = OsuColour.FromHex(@"212121"), }, sideStrip = new Box { RelativeSizeAxes = Axes.Y, - Width = content_padding, + Width = side_strip_width, }, - avatar = new UpdateableAvatar + new Container { - Size = new Vector2(Height - content_padding * 2), + Width = cover_width, + RelativeSizeAxes = Axes.Y, Masking = true, - CornerRadius = 5f, - Margin = new MarginPadding { Left = content_padding * 2, Top = content_padding }, + Margin = new MarginPadding { Left = side_strip_width }, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + coverContainer = new Container + { + RelativeSizeAxes = Axes.Both, + }, + }, }, new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = Height + content_padding * 2, Right = content_padding }, + Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = side_strip_width + cover_width + content_padding, Right = content_padding }, Children = new Drawable[] { new FillFlowContainer @@ -100,20 +130,30 @@ namespace osu.Game.Screens.Multiplayer new FillFlowContainer { AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, + Height = 15f, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { flagContainer = new Container { - Width = 30f, + Width = 22f, RelativeSizeAxes = Axes.Y, }, - new Container + new Container //todo: team banners { - Width = 40f, + Width = 38f, RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, }, new OsuSpriteText { @@ -131,13 +171,40 @@ namespace osu.Game.Screens.Multiplayer }, }, }, - rankBounds = new OsuSpriteText + levelRangeContainer = new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Text = "#0 - #0", - TextSize = 14, - Margin = new MarginPadding { Right = 10 }, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, }, }, }, @@ -150,7 +217,6 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, - Margin = new MarginPadding { Bottom = content_padding }, Children = new Drawable[] { status = new OsuSpriteText @@ -173,7 +239,7 @@ namespace osu.Game.Screens.Multiplayer beatmapDash = new OsuSpriteText { TextSize = 14, - Font = @"Exo2.0-RegularItalic", + Font = @"Exo2.0-BoldItalic", }, beatmapArtist = new OsuSpriteText { @@ -184,26 +250,64 @@ namespace osu.Game.Screens.Multiplayer }, }, }, + new FillFlowContainer + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Height = ruleset_height, + Direction = FillDirection.Horizontal, + LayoutDuration = transition_duration, + Spacing = new Vector2(5f, 0f), + Children = new[] + { + rulesetContainer = new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + }, + gameTypeContainer = new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + }, + }, + }, }, }, }; - Room.Name.ValueChanged += displayName; - Room.Host.ValueChanged += displayUser; - Room.Status.ValueChanged += displayStatus; - Room.Beatmap.ValueChanged += displayBeatmap; + nameBind.ValueChanged += displayName; + hostBind.ValueChanged += displayUser; + participantsBind.ValueChanged += displayParticipants; + + nameBind.BindTo(Room.Name); + hostBind.BindTo(Room.Host); + statusBind.BindTo(Room.Status); + typeBind.BindTo(Room.Type); + beatmapBind.BindTo(Room.Beatmap); + participantsBind.BindTo(Room.Participants); } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours, TextureStore textures, LocalisationEngine localisation) { this.localisation = localisation; + this.textures = textures; this.colours = colours; - beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9; + beatmapInfoFlow.Colour = levelRangeContainer.Colour = colours.Gray9; host.Colour = colours.Blue; - displayStatus(Room.Status.Value); + //binded here instead of ctor because dependencies are needed + statusBind.ValueChanged += displayStatus; + typeBind.ValueChanged += displayGameType; + beatmapBind.ValueChanged += displayBeatmap; + + statusBind.TriggerChange(); + typeBind.TriggerChange(); + beatmapBind.TriggerChange(); } private void displayName(string value) @@ -213,7 +317,6 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { - avatar.User = value; host.Text = value.Username; flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; } @@ -227,33 +330,64 @@ namespace osu.Game.Screens.Multiplayer d.FadeColour(value.GetAppropriateColour(colours), 100); } + private void displayGameType(GameType value) + { + gameTypeContainer.Children = new[] + { + new DrawableGameType(value) + { + Size = new Vector2(ruleset_height), + }, + }; + } + private void displayBeatmap(BeatmapInfo value) { if (value != null) { + coverContainer.FadeIn(transition_duration); + coverContainer.Children = new[] + { + new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + }) { RelativeSizeAxes = Axes.Both } + }; + + rulesetContainer.FadeIn(transition_duration); + rulesetContainer.Children = new[] + { + new DifficultyIcon(value) + { + Size = new Vector2(ruleset_height), + } + }; + beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); } else { + coverContainer.FadeOut(transition_duration); + rulesetContainer.FadeOut(transition_duration); + beatmapTitle.Current = null; beatmapArtist.Current = null; - beatmapTitle.Text = @"Changing map"; - beatmapDash.Text = string.Empty; - beatmapArtist.Text = string.Empty; + beatmapTitle.Text = "Changing map"; + beatmapDash.Text = beatmapArtist.Text = string.Empty; } } - protected override void Dispose(bool isDisposing) + private void displayParticipants(User[] value) { - Room.Name.ValueChanged -= displayName; - Room.Host.ValueChanged -= displayUser; - Room.Status.ValueChanged -= displayStatus; - Room.Beatmap.ValueChanged -= displayBeatmap; - - base.Dispose(isDisposing); + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); } } } diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 2181f37be9..508128c749 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -331,7 +331,6 @@ namespace osu.Game.Screens.Multiplayer }, levelRangeHigher = new OsuSpriteText { - Text = "6251", TextSize = 14, Font = @"Exo2.0-Bold", }, From 05b5fe8ae7cfff1d9caed9037d951b31345576ed Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:21:42 -0300 Subject: [PATCH 08/59] Share host/participant info displaying. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 105 +------------ .../Screens/Multiplayer/ParticipantInfo.cs | 142 ++++++++++++++++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 110 +------------- osu.Game/osu.Game.csproj | 1 + 4 files changed, 156 insertions(+), 202 deletions(-) create mode 100644 osu.Game/Screens/Multiplayer/ParticipantInfo.cs diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index bd58fafd12..507e0039e1 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -33,11 +32,7 @@ namespace osu.Game.Screens.Multiplayer private readonly Box sideStrip; private readonly Container coverContainer, rulesetContainer, gameTypeContainer; private readonly OsuSpriteText name; - private readonly Container flagContainer; - private readonly OsuSpriteText host; - private readonly FillFlowContainer levelRangeContainer; - private readonly OsuSpriteText levelRangeLower; - private readonly OsuSpriteText levelRangeHigher; + private readonly ParticipantInfo participantInfo; private readonly OsuSpriteText status; private readonly FillFlowContainer beatmapInfoFlow; private readonly OsuSpriteText beatmapTitle; @@ -121,93 +116,7 @@ namespace osu.Game.Screens.Multiplayer { TextSize = 18, }, - new Container - { - RelativeSizeAxes = Axes.X, - Height = 20f, - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.X, - Height = 15f, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - flagContainer = new Container - { - Width = 22f, - RelativeSizeAxes = Axes.Y, - }, - new Container //todo: team banners - { - Width = 38f, - RelativeSizeAxes = Axes.Y, - CornerRadius = 2f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"ad387e"), - }, - }, - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - host = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - }, - }, - levelRangeContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeLower = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - new OsuSpriteText - { - Text = " - ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeHigher = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - }, - }, - }, - }, + participantInfo = new ParticipantInfo(), }, }, new FillFlowContainer @@ -297,8 +206,7 @@ namespace osu.Game.Screens.Multiplayer this.textures = textures; this.colours = colours; - beatmapInfoFlow.Colour = levelRangeContainer.Colour = colours.Gray9; - host.Colour = colours.Blue; + beatmapInfoFlow.Colour = colours.Gray9; //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; @@ -317,8 +225,7 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { - host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + participantInfo.Host = value; } private void displayStatus(RoomStatus value) @@ -385,9 +292,7 @@ namespace osu.Game.Screens.Multiplayer private void displayParticipants(User[] value) { - var ranks = value.Select(u => u.GlobalRank); - levelRangeLower.Text = ranks.Min().ToString(); - levelRangeHigher.Text = ranks.Max().ToString(); + participantInfo.Participants = value; } } } diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs new file mode 100644 index 0000000000..cd9101d5ad --- /dev/null +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -0,0 +1,142 @@ +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class ParticipantInfo : Container + { + private readonly Container flagContainer; + private readonly OsuSpriteText host; + private readonly FillFlowContainer levelRangeContainer; + private readonly OsuSpriteText levelRangeLower; + private readonly OsuSpriteText levelRangeHigher; + + public User Host + { + set + { + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + } + + public IEnumerable Participants + { + set + { + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); + } + } + + public ParticipantInfo(string rankPrefix = null) + { + RelativeSizeAxes = Axes.X; + Height = 15f; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + flagContainer = new Container + { + Width = 22f, + RelativeSizeAxes = Axes.Y, + }, + new Container //todo: team banners + { + Width = 38f, + RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + levelRangeContainer = new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = rankPrefix, + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + levelRangeContainer.Colour = colours.Gray9; + host.Colour = colours.Blue; + } + } +} diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 508128c749..d840495765 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -30,9 +30,10 @@ namespace osu.Game.Screens.Multiplayer private const float ruleset_height = 30; private readonly Box statusStrip; - private readonly Container coverContainer, rulesetContainer, gameTypeContainer, flagContainer; - private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow; - private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher; + private readonly Container coverContainer, rulesetContainer, gameTypeContainer; + private readonly FillFlowContainer topFlow, participantsFlow; + private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; + private readonly ParticipantInfo participantInfo; private readonly ScrollContainer participantsScroll; private readonly Bindable nameBind = new Bindable(); @@ -252,90 +253,7 @@ namespace osu.Game.Screens.Multiplayer Padding = contentPadding, Children = new Drawable[] { - new FillFlowContainer - { - AutoSizeAxes = Axes.X, - Height = 15f, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - flagContainer = new Container - { - Width = 22f, - RelativeSizeAxes = Axes.Y, - }, - new Container //todo: team banners - { - Width = 38f, - RelativeSizeAxes = Axes.Y, - CornerRadius = 2f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"ad387e"), - }, - }, - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - host = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - }, - }, - levelRangeContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = "Rank Range ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeLower = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - new OsuSpriteText - { - Text = " - ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeHigher = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - }, - }, + participantInfo = new ParticipantInfo(@"Rank Range "), }, }, }, @@ -372,8 +290,7 @@ namespace osu.Game.Screens.Multiplayer this.colours = colours; this.textures = textures; - beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9; - host.Colour = colours.Blue; + beatmapAuthor.Colour = colours.Gray9; //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; @@ -399,14 +316,7 @@ namespace osu.Game.Screens.Multiplayer private void displayUser(User value) { - host.Text = value.Username; - flagContainer.Children = new[] - { - new DrawableFlag(value.Country?.FlagName ?? @"__") - { - RelativeSizeAxes = Axes.Both, - }, - }; + participantInfo.Host = value; } private void displayStatus(RoomStatus value) @@ -489,11 +399,7 @@ namespace osu.Game.Screens.Multiplayer private void displayParticipants(User[] value) { participants.Text = value.Length.ToString(); - - var ranks = value.Select(u => u.GlobalRank); - levelRangeLower.Text = ranks.Min().ToString(); - levelRangeHigher.Text = ranks.Max().ToString(); - + participantInfo.Participants = value; participantsFlow.Children = value.Select(u => new UserTile(u)); } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 64b81ddc6a..4e015242e2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -490,6 +490,7 @@ + From 35951ffc40053e1a03570a26081a6ca87438c6b0 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:23:31 -0300 Subject: [PATCH 09/59] Line endings. --- .../Screens/Multiplayer/ParticipantInfo.cs | 284 +++++++++--------- 1 file changed, 142 insertions(+), 142 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index cd9101d5ad..c1a031f8cb 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -1,142 +1,142 @@ -using System.Collections.Generic; -using System.Linq; -using OpenTK; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Users; - -namespace osu.Game.Screens.Multiplayer -{ - public class ParticipantInfo : Container - { - private readonly Container flagContainer; - private readonly OsuSpriteText host; - private readonly FillFlowContainer levelRangeContainer; - private readonly OsuSpriteText levelRangeLower; - private readonly OsuSpriteText levelRangeHigher; - - public User Host - { - set - { - host.Text = value.Username; - flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; - } - } - - public IEnumerable Participants - { - set - { - var ranks = value.Select(u => u.GlobalRank); - levelRangeLower.Text = ranks.Min().ToString(); - levelRangeHigher.Text = ranks.Max().ToString(); - } - } - - public ParticipantInfo(string rankPrefix = null) - { - RelativeSizeAxes = Axes.X; - Height = 15f; - - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - Direction = FillDirection.Horizontal, - Spacing = new Vector2(5f, 0f), - Children = new Drawable[] - { - flagContainer = new Container - { - Width = 22f, - RelativeSizeAxes = Axes.Y, - }, - new Container //todo: team banners - { - Width = 38f, - RelativeSizeAxes = Axes.Y, - CornerRadius = 2f, - Masking = true, - Children = new[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex(@"ad387e"), - }, - }, - }, - new OsuSpriteText - { - Text = "hosted by", - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - }, - host = new OsuSpriteText - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - TextSize = 14, - Font = @"Exo2.0-BoldItalic", - }, - }, - }, - levelRangeContainer = new FillFlowContainer - { - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Horizontal, - Children = new[] - { - new OsuSpriteText - { - Text = rankPrefix, - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeLower = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - new OsuSpriteText - { - Text = " - ", - TextSize = 14, - }, - new OsuSpriteText - { - Text = "#", - TextSize = 14, - }, - levelRangeHigher = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, - }, - }, - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - levelRangeContainer.Colour = colours.Gray9; - host.Colour = colours.Blue; - } - } -} +using System.Collections.Generic; +using System.Linq; +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Users; + +namespace osu.Game.Screens.Multiplayer +{ + public class ParticipantInfo : Container + { + private readonly Container flagContainer; + private readonly OsuSpriteText host; + private readonly FillFlowContainer levelRangeContainer; + private readonly OsuSpriteText levelRangeLower; + private readonly OsuSpriteText levelRangeHigher; + + public User Host + { + set + { + host.Text = value.Username; + flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } }; + } + } + + public IEnumerable Participants + { + set + { + var ranks = value.Select(u => u.GlobalRank); + levelRangeLower.Text = ranks.Min().ToString(); + levelRangeHigher.Text = ranks.Max().ToString(); + } + } + + public ParticipantInfo(string rankPrefix = null) + { + RelativeSizeAxes = Axes.X; + Height = 15f; + + Children = new Drawable[] + { + new FillFlowContainer + { + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(5f, 0f), + Children = new Drawable[] + { + flagContainer = new Container + { + Width = 22f, + RelativeSizeAxes = Axes.Y, + }, + new Container //todo: team banners + { + Width = 38f, + RelativeSizeAxes = Axes.Y, + CornerRadius = 2f, + Masking = true, + Children = new[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"ad387e"), + }, + }, + }, + new OsuSpriteText + { + Text = "hosted by", + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + }, + host = new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + TextSize = 14, + Font = @"Exo2.0-BoldItalic", + }, + }, + }, + levelRangeContainer = new FillFlowContainer + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new[] + { + new OsuSpriteText + { + Text = rankPrefix, + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeLower = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + new OsuSpriteText + { + Text = " - ", + TextSize = 14, + }, + new OsuSpriteText + { + Text = "#", + TextSize = 14, + }, + levelRangeHigher = new OsuSpriteText + { + TextSize = 14, + Font = @"Exo2.0-Bold", + }, + }, + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + levelRangeContainer.Colour = colours.Gray9; + host.Colour = colours.Blue; + } + } +} From fe875957a708bbd4093bfa611ffabd967b3ecbd6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:43:52 -0300 Subject: [PATCH 10/59] Share ruleset and type displaying, fix tag team icon. --- osu.Game/Online/Multiplayer/GameType.cs | 24 +++++- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 45 ++-------- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 82 +++++++++++++++++++ osu.Game/Screens/Multiplayer/RoomInspector.cs | 33 ++------ osu.Game/osu.Game.csproj | 1 + 5 files changed, 118 insertions(+), 67 deletions(-) create mode 100644 osu.Game/Screens/Multiplayer/ModeTypeInfo.cs diff --git a/osu.Game/Online/Multiplayer/GameType.cs b/osu.Game/Online/Multiplayer/GameType.cs index 4d1a6c4839..22e2ffac31 100644 --- a/osu.Game/Online/Multiplayer/GameType.cs +++ b/osu.Game/Online/Multiplayer/GameType.cs @@ -52,10 +52,32 @@ namespace osu.Game.Online.Multiplayer public override string Name => "Tag Team"; public override Drawable GetIcon(OsuColour colours, float size) { - return new VersusRow(colours.Blue, colours.Blue, size * 0.6f) + return new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Spacing = new Vector2(2f), + Children = new[] + { + new TextAwesome + { + Icon = FontAwesome.fa_refresh, + TextSize = size * 0.75f, + Colour = colours.Blue, + Shadow = false, + UseFullGlyphHeight = false, + }, + new TextAwesome + { + Icon = FontAwesome.fa_refresh, + TextSize = size * 0.75f, + Colour = colours.Pink, + Shadow = false, + UseFullGlyphHeight = false, + }, + }, }; } } diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 507e0039e1..8a970427e5 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -27,12 +27,12 @@ namespace osu.Game.Screens.Multiplayer private const float height = 100; private const float side_strip_width = 5; private const float cover_width = 145; - private const float ruleset_height = 30; private readonly Box sideStrip; - private readonly Container coverContainer, rulesetContainer, gameTypeContainer; + private readonly Container coverContainer; private readonly OsuSpriteText name; private readonly ParticipantInfo participantInfo; + private readonly ModeTypeInfo modeTypeInfo; private readonly OsuSpriteText status; private readonly FillFlowContainer beatmapInfoFlow; private readonly OsuSpriteText beatmapTitle; @@ -159,29 +159,10 @@ namespace osu.Game.Screens.Multiplayer }, }, }, - new FillFlowContainer + modeTypeInfo = new ModeTypeInfo { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, - Height = ruleset_height, - Direction = FillDirection.Horizontal, - LayoutDuration = transition_duration, - Spacing = new Vector2(5f, 0f), - Children = new[] - { - rulesetContainer = new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - }, - gameTypeContainer = new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - }, - }, }, }, }, @@ -239,17 +220,13 @@ namespace osu.Game.Screens.Multiplayer private void displayGameType(GameType value) { - gameTypeContainer.Children = new[] - { - new DrawableGameType(value) - { - Size = new Vector2(ruleset_height), - }, - }; + modeTypeInfo.Type = value; } private void displayBeatmap(BeatmapInfo value) { + modeTypeInfo.Beatmap = value; + if (value != null) { coverContainer.FadeIn(transition_duration); @@ -264,15 +241,6 @@ namespace osu.Game.Screens.Multiplayer }) { RelativeSizeAxes = Axes.Both } }; - rulesetContainer.FadeIn(transition_duration); - rulesetContainer.Children = new[] - { - new DifficultyIcon(value) - { - Size = new Vector2(ruleset_height), - } - }; - beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); @@ -280,7 +248,6 @@ namespace osu.Game.Screens.Multiplayer else { coverContainer.FadeOut(transition_duration); - rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs new file mode 100644 index 0000000000..07e62d4d2f --- /dev/null +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -0,0 +1,82 @@ +using OpenTK; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps.Drawables; +using osu.Game.Database; +using osu.Game.Online.Multiplayer; + +namespace osu.Game.Screens.Multiplayer +{ + public class ModeTypeInfo : Container + { + private const float height = 30; + private const float transition_duration = 100; + + private readonly Container rulesetContainer, gameTypeContainer; + + public BeatmapInfo Beatmap + { + set + { + if (value != null) + { + rulesetContainer.FadeIn(transition_duration); + rulesetContainer.Children = new[] + { + new DifficultyIcon(value) + { + Size = new Vector2(height), + } + }; + } + else + { + rulesetContainer.FadeOut(transition_duration); + } + } + } + + public GameType Type + { + set + { + gameTypeContainer.Children = new[] + { + new DrawableGameType(value) + { + Size = new Vector2(height), + }, + }; + } + } + + public ModeTypeInfo() + { + AutoSizeAxes = Axes.Both; + + Children = new[] + { + new FillFlowContainer + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + LayoutDuration = transition_duration, + Spacing = new Vector2(5f, 0f), + Children = new[] + { + rulesetContainer = new Container + { + AutoSizeAxes = Axes.Both, + }, + gameTypeContainer = new Container + { + AutoSizeAxes = Axes.Both, + }, + }, + }, + }; + } + } +} diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index d840495765..3ed0b78f36 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -27,11 +27,11 @@ namespace osu.Game.Screens.Multiplayer { private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private const float transition_duration = 100; - private const float ruleset_height = 30; private readonly Box statusStrip; private readonly Container coverContainer, rulesetContainer, gameTypeContainer; private readonly FillFlowContainer topFlow, participantsFlow; + private readonly ModeTypeInfo modeTypeInfo; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; private readonly ParticipantInfo participantInfo; private readonly ScrollContainer participantsScroll; @@ -191,20 +191,13 @@ namespace osu.Game.Screens.Multiplayer new FillFlowContainer { AutoSizeAxes = Axes.X, - Height = ruleset_height, + Height = 30, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { - rulesetContainer = new Container - { - AutoSizeAxes = Axes.Both, - }, - gameTypeContainer = new Container - { - AutoSizeAxes = Axes.Both, - }, + modeTypeInfo = new ModeTypeInfo(), new Container { AutoSizeAxes = Axes.X, @@ -329,17 +322,13 @@ namespace osu.Game.Screens.Multiplayer private void displayGameType(GameType value) { - gameTypeContainer.Children = new[] - { - new DrawableGameType(value) - { - Size = new Vector2(ruleset_height), - }, - }; + modeTypeInfo.Type = value; } private void displayBeatmap(BeatmapInfo value) { + modeTypeInfo.Beatmap = value; + if (value != null) { coverContainer.FadeIn(transition_duration); @@ -354,15 +343,6 @@ namespace osu.Game.Screens.Multiplayer }) { RelativeSizeAxes = Axes.Both } }; - rulesetContainer.FadeIn(transition_duration); - rulesetContainer.Children = new[] - { - new DifficultyIcon(value) - { - Size = new Vector2(ruleset_height), - } - }; - beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); beatmapDash.Text = @" - "; beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist); @@ -371,7 +351,6 @@ namespace osu.Game.Screens.Multiplayer else { coverContainer.FadeOut(transition_duration); - rulesetContainer.FadeOut(transition_duration); beatmapTitle.Current = null; beatmapArtist.Current = null; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 4e015242e2..553e55c83e 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -491,6 +491,7 @@ + From bcd82a02f499308fbe9c7e29be4fe4797e429d74 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:45:34 -0300 Subject: [PATCH 11/59] Licenses. --- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 5 ++++- osu.Game/Screens/Multiplayer/ParticipantInfo.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs index 07e62d4d2f..ca93163ac3 100644 --- a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -1,4 +1,7 @@ -using OpenTK; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs index c1a031f8cb..639f29567f 100644 --- a/osu.Game/Screens/Multiplayer/ParticipantInfo.cs +++ b/osu.Game/Screens/Multiplayer/ParticipantInfo.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; using System.Linq; using OpenTK; using osu.Framework.Allocation; From 9f417743b641a7faf19907ad8ff52e06515f448a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 05:54:00 -0300 Subject: [PATCH 12/59] Cleanup. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 13 ++++--------- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 2 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 5 ++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 8a970427e5..eb66fd3d2a 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -30,14 +30,10 @@ namespace osu.Game.Screens.Multiplayer private readonly Box sideStrip; private readonly Container coverContainer; - private readonly OsuSpriteText name; + private readonly OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist; + private readonly FillFlowContainer beatmapInfoFlow; private readonly ParticipantInfo participantInfo; private readonly ModeTypeInfo modeTypeInfo; - private readonly OsuSpriteText status; - private readonly FillFlowContainer beatmapInfoFlow; - private readonly OsuSpriteText beatmapTitle; - private readonly OsuSpriteText beatmapDash; - private readonly OsuSpriteText beatmapArtist; private readonly Bindable nameBind = new Bindable(); private readonly Bindable hostBind = new Bindable(); @@ -170,6 +166,7 @@ namespace osu.Game.Screens.Multiplayer nameBind.ValueChanged += displayName; hostBind.ValueChanged += displayUser; + typeBind.ValueChanged += displayGameType; participantsBind.ValueChanged += displayParticipants; nameBind.BindTo(Room.Name); @@ -191,11 +188,9 @@ namespace osu.Game.Screens.Multiplayer //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; - typeBind.ValueChanged += displayGameType; beatmapBind.ValueChanged += displayBeatmap; statusBind.TriggerChange(); - typeBind.TriggerChange(); beatmapBind.TriggerChange(); } @@ -238,7 +233,7 @@ namespace osu.Game.Screens.Multiplayer Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), - }) { RelativeSizeAxes = Axes.Both } + }) { RelativeSizeAxes = Axes.Both }, }; beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs index ca93163ac3..fbb15ec2c5 100644 --- a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multiplayer new DifficultyIcon(value) { Size = new Vector2(height), - } + }, }; } else diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 3ed0b78f36..2c9ee9dfe6 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -272,6 +272,7 @@ namespace osu.Game.Screens.Multiplayer nameBind.ValueChanged += displayName; hostBind.ValueChanged += displayUser; + typeBind.ValueChanged += displayGameType; maxParticipantsBind.ValueChanged += displayMaxParticipants; participantsBind.ValueChanged += displayParticipants; } @@ -287,11 +288,9 @@ namespace osu.Game.Screens.Multiplayer //binded here instead of ctor because dependencies are needed statusBind.ValueChanged += displayStatus; - typeBind.ValueChanged += displayGameType; beatmapBind.ValueChanged += displayBeatmap; statusBind.TriggerChange(); - typeBind.TriggerChange(); beatmapBind.TriggerChange(); } @@ -340,7 +339,7 @@ namespace osu.Game.Screens.Multiplayer Origin = Anchor.Centre, FillMode = FillMode.Fill, OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), - }) { RelativeSizeAxes = Axes.Both } + }) { RelativeSizeAxes = Axes.Both }, }; beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title); From 68915d79a6e4f5c42226815174d06d147aadb670 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 06:03:40 -0300 Subject: [PATCH 13/59] Remove unused fields. --- osu.Game/Screens/Multiplayer/RoomInspector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 2c9ee9dfe6..92bb92fbb9 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multiplayer private const float transition_duration = 100; private readonly Box statusStrip; - private readonly Container coverContainer, rulesetContainer, gameTypeContainer; + private readonly Container coverContainer; private readonly FillFlowContainer topFlow, participantsFlow; private readonly ModeTypeInfo modeTypeInfo; private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor; From 091d786d47546d66260b17eb750a89269599ed10 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 18:37:28 -0300 Subject: [PATCH 14/59] Split long MarginPadding onto multiple lines. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index eb66fd3d2a..d1b6b5079b 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -97,7 +97,13 @@ namespace osu.Game.Screens.Multiplayer new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = side_strip_width + cover_width + content_padding, Right = content_padding }, + Padding = new MarginPadding + { + Top = content_padding, + Bottom = content_padding, + Left = side_strip_width + cover_width + content_padding, + Right = content_padding, + }, Children = new Drawable[] { new FillFlowContainer From 5e1cb14e624ccba84795c88762a6aa6aaee69334 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 24 Jun 2017 19:11:02 -0300 Subject: [PATCH 15/59] Use Vertical instead of Top and Bottom. --- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index d1b6b5079b..b88341bee1 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -99,8 +99,7 @@ namespace osu.Game.Screens.Multiplayer RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { - Top = content_padding, - Bottom = content_padding, + Vertical = content_padding, Left = side_strip_width + cover_width + content_padding, Right = content_padding, }, From 714d53f3292e102fe086590cfceaf4cfed0638d9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 27 Jun 2017 05:17:21 +0300 Subject: [PATCH 16/59] Hide "Unranked" text in ModDisplay if play is ranked --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 28 +++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 921accf6ac..1295bcb9f2 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -12,16 +12,20 @@ using osu.Game.Rulesets.UI; using OpenTK; using osu.Framework.Input; using osu.Game.Graphics.Containers; +using System.Linq; namespace osu.Game.Screens.Play.HUD { public class ModDisplay : Container, IHasCurrentValue> { + private const int fade_duration = 1000; + private readonly Bindable> mods = new Bindable>(); public Bindable> Current => mods; private readonly FillFlowContainer iconsContainer; + private readonly OsuSpriteText unrankedText; public ModDisplay() { @@ -35,8 +39,9 @@ namespace osu.Game.Screens.Play.HUD Direction = FillDirection.Horizontal, Margin = new MarginPadding { Left = 10, Right = 10 }, }, - new OsuSpriteText + unrankedText = new OsuSpriteText { + AlwaysPresent = true, Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre, Text = @"/ UNRANKED /", @@ -48,6 +53,7 @@ namespace osu.Game.Screens.Play.HUD mods.ValueChanged += mods => { iconsContainer.Clear(); + foreach (Mod mod in mods) { iconsContainer.Add(new ModIcon(mod) @@ -62,6 +68,19 @@ namespace osu.Game.Screens.Play.HUD }; } + private bool playIsRanked() + { + if (!mods.Value.Any()) return true; + + foreach (var mod in mods.Value) + { + if (!mod.Ranked) + return false; + } + + return true; + } + protected override void LoadComplete() { base.LoadComplete(); @@ -70,8 +89,13 @@ namespace osu.Game.Screens.Play.HUD private void appearTransform() { + if (!playIsRanked()) + unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); + else + unrankedText.FadeTo(0); + iconsContainer.Flush(); - iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint); + iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); expand(); using (iconsContainer.BeginDelayedSequence(1200)) contract(); From 2ad6d3fa77250088d845f5052c9905df161924a4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 27 Jun 2017 05:41:24 +0300 Subject: [PATCH 17/59] Simplify property --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 1295bcb9f2..64a3554762 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -53,7 +53,6 @@ namespace osu.Game.Screens.Play.HUD mods.ValueChanged += mods => { iconsContainer.Clear(); - foreach (Mod mod in mods) { iconsContainer.Add(new ModIcon(mod) @@ -68,28 +67,17 @@ namespace osu.Game.Screens.Play.HUD }; } - private bool playIsRanked() - { - if (!mods.Value.Any()) return true; - - foreach (var mod in mods.Value) - { - if (!mod.Ranked) - return false; - } - - return true; - } - protected override void LoadComplete() { base.LoadComplete(); appearTransform(); } + private bool playIsRanked => !mods.Value.Any(m => !m.Ranked); + private void appearTransform() { - if (!playIsRanked()) + if (!playIsRanked) unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); else unrankedText.FadeTo(0); From 24283b9500c1d7bb59056fc05fc5fe2b1a517ea1 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 27 Jun 2017 22:22:14 -0300 Subject: [PATCH 18/59] Remove animation from ModeTypeInfo layout (was causing visual issues). --- osu.Game/Screens/Multiplayer/ModeTypeInfo.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs index fbb15ec2c5..fff40aeed5 100644 --- a/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multiplayer/ModeTypeInfo.cs @@ -61,11 +61,8 @@ namespace osu.Game.Screens.Multiplayer { new FillFlowContainer { - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new[] { From 33206fcf0e7ae1fe87534f0a0d0cf549b8f6cdfd Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 8 Jul 2017 12:34:24 +0300 Subject: [PATCH 19/59] Use `Hide` instead of `FadeTo(0)` --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 64a3554762..3fad7032a5 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Play.HUD if (!playIsRanked) unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); else - unrankedText.FadeTo(0); + unrankedText.Hide(); iconsContainer.Flush(); iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); From 2ee0f3f5f6606818dc297e7ce20bb8f2177a4bc4 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 11 Jul 2017 02:11:08 -0300 Subject: [PATCH 20/59] Update with framework changes. --- .../Tests/TestCaseMedalOverlay.cs | 4 +--- osu.Game/Overlays/MedalOverlay.cs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs index ac983277a4..e00b2beac4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"medal get!"; - public override void Reset() + public TestCaseMedalOverlay() { - base.Reset(); - Add(new MedalOverlay(new Medal { Name = @"Animations", diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 617a5f7d0b..cc6f23ccdb 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -199,23 +199,25 @@ namespace osu.Game.Overlays getSample.Play(); Delay(200, true); - innerSpin.Transforms.Add(new TransformRotation + var innerRotate = new TransformRotation { - StartValue = 0, EndValue = 359, StartTime = Clock.TimeInfo.Current, EndTime = Clock.TimeInfo.Current + 20000, - LoopCount = -1, - }); + }; - outterSpin.Transforms.Add(new TransformRotation + innerRotate.Loop(0); + innerSpin.Transforms.Add(innerRotate); + + var outerRotate = new TransformRotation { - StartValue = 0, EndValue = 359, StartTime = Clock.TimeInfo.Current, EndTime = Clock.TimeInfo.Current + 40000, - LoopCount = -1, - }); + }; + + outerRotate.Loop(0); + outterSpin.Transforms.Add(outerRotate); disc.FadeIn(duration1); outterSpin.FadeTo(0.1f, duration1 * 2); From 311c2aec1c66bad9b2a652af1a28b6c51785d330 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 17:53:36 +0900 Subject: [PATCH 21/59] Fix next track not automatically playing when music controller is not visible --- osu.Game/Overlays/MusicController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f6190f09af..092082595c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -59,6 +59,9 @@ namespace osu.Game.Overlays { Width = 400; Margin = new MarginPadding(10); + + // required to let MusicController handle beatmap cycling. + AlwaysPresent = true; } protected override bool OnDragStart(InputState state) => true; From 1bd3519ecb97c587ba02fc0aa0ca976f92bf5738 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 18:38:27 +0900 Subject: [PATCH 22/59] Have beatmap return a zero-length TrackVirtual instead of null on load failure --- osu.Game/Database/DatabaseWorkingBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DatabaseWorkingBeatmap.cs b/osu.Game/Database/DatabaseWorkingBeatmap.cs index c56d6cea51..2acae9c340 100644 --- a/osu.Game/Database/DatabaseWorkingBeatmap.cs +++ b/osu.Game/Database/DatabaseWorkingBeatmap.cs @@ -69,7 +69,7 @@ namespace osu.Game.Database var trackData = getReader()?.GetStream(Metadata.AudioFile); return trackData == null ? null : new TrackBass(trackData); } - catch { return null; } + catch { return new TrackVirtual(); } } } -} \ No newline at end of file +} From 773ef26ce339c5f63cac5873066afdd3ad025fda Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 18:38:49 +0900 Subject: [PATCH 23/59] Make MusicController support disabled beatmap bindable --- osu.Game/Overlays/MusicController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 092082595c..baf58ae26c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -255,12 +255,16 @@ namespace osu.Game.Overlays private void prev() { + if (beatmapBacking.Disabled) return; + queuedDirection = TransformDirection.Prev; playlist.PlayPrevious(); } private void next() { + if (beatmapBacking.Disabled) return; + queuedDirection = TransformDirection.Next; playlist.PlayNext(); } From 9bbcc0526de83b6c6845bd8c984e330b7d51d2b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 18:39:10 +0900 Subject: [PATCH 24/59] Disable beatmap changes in specified screens --- osu.Game/Screens/OsuScreen.cs | 9 +++++++-- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 4f8109b4e4..f0e673a739 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -29,7 +29,11 @@ namespace osu.Game.Screens internal virtual bool HasLocalCursorDisplayed => false; - internal virtual bool AllowRulesetChange => true; + /// + /// Whether the beatmap or ruleset should be allowed to be changed by the user or game. + /// Used to mark exclusive areas where this is strongly prohibited, like gameplay. + /// + internal virtual bool AllowBeatmapRulesetChange => true; private readonly Bindable beatmap = new Bindable(); @@ -85,7 +89,8 @@ namespace osu.Game.Screens { if (!IsCurrentScreen) return; - ruleset.Disabled = !AllowRulesetChange; + ruleset.Disabled = !AllowBeatmapRulesetChange; + beatmap.Disabled = !AllowBeatmapRulesetChange; } protected override void OnResuming(Screen last) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d0ffe1de1c..a7ea77c710 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Play public Action RestartRequested; - internal override bool AllowRulesetChange => false; + internal override bool AllowBeatmapRulesetChange => false; public bool HasFailed { get; private set; } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c8ebb1f436..f2ed378e7c 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play private bool showOverlays = true; internal override bool ShowOverlays => showOverlays; - internal override bool AllowRulesetChange => false; + internal override bool AllowBeatmapRulesetChange => false; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index dac83536ed..636851e14d 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Ranking private ResultModeTabControl modeChangeButtons; - internal override bool AllowRulesetChange => false; + internal override bool AllowBeatmapRulesetChange => false; private Container currentPage; From f7c9e449d4728ee8362e8139a00a85042ed9017f Mon Sep 17 00:00:00 2001 From: Jorolf Date: Tue, 11 Jul 2017 20:25:24 +0200 Subject: [PATCH 25/59] add ruleset settings --- osu.Game.Rulesets.Osu/OsuRuleset.cs | 3 ++ osu.Game.Rulesets.Osu/OsuSettings.cs | 33 +++++++++++++++++++ .../osu.Game.Rulesets.Osu.csproj | 1 + .../Settings/Sections/GameplaySection.cs | 15 +++++++++ .../Sections/Graphics/DetailSettings.cs | 22 ------------- osu.Game/Rulesets/Ruleset.cs | 3 ++ 6 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/OsuSettings.cs diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 63fe6aaa59..8e8e186d40 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -15,6 +15,7 @@ using System.Collections.Generic; using System.Linq; using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; +using osu.Game.Overlays.Settings; namespace osu.Game.Rulesets.Osu { @@ -119,6 +120,8 @@ namespace osu.Game.Rulesets.Osu public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(); + public override SettingsSubsection CreateSettings() => new OsuSettings(); + public override int LegacyID => 0; } } diff --git a/osu.Game.Rulesets.Osu/OsuSettings.cs b/osu.Game.Rulesets.Osu/OsuSettings.cs new file mode 100644 index 0000000000..861b7bf73c --- /dev/null +++ b/osu.Game.Rulesets.Osu/OsuSettings.cs @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Configuration; +using osu.Game.Overlays.Settings; + +namespace osu.Game.Rulesets.Osu +{ + public class OsuSettings : SettingsSubsection + { + protected override string Header => "osu"; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + Children = new Drawable[] + { + new SettingsCheckbox + { + LabelText = "Snaking in sliders", + Bindable = config.GetBindable(OsuSetting.SnakingInSliders) + }, + new SettingsCheckbox + { + LabelText = "Snaking out sliders", + Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) + }, + }; + } + } +} diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index f6f565c502..3f60dfaa25 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -78,6 +78,7 @@ + diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index be957912c1..c20519a9b5 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -1,9 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Overlays.Settings.Sections.Gameplay; +using osu.Game.Rulesets; +using System.Linq; namespace osu.Game.Overlays.Settings.Sections { @@ -20,5 +24,16 @@ namespace osu.Game.Overlays.Settings.Sections new SongSelectSettings(), }; } + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + foreach(Ruleset ruleset in rulesets.AllRulesets.Select(info => info.CreateInstance())) + { + SettingsSubsection section = ruleset.CreateSettings(); + if (section != null) + Add(section); + } + } } } \ No newline at end of file diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index 78eab6ebd8..c068da8129 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -1,32 +1,10 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Configuration; - namespace osu.Game.Overlays.Settings.Sections.Graphics { public class DetailSettings : SettingsSubsection { protected override string Header => "Detail Settings"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Snaking in sliders", - Bindable = config.GetBindable(OsuSetting.SnakingInSliders) - }, - new SettingsCheckbox - { - LabelText = "Snaking out sliders", - Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) - }, - }; - } } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 286ff331d2..3dbb39d894 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -8,6 +8,7 @@ using osu.Game.Rulesets.UI; using osu.Game.Screens.Play; using System.Collections.Generic; using osu.Game.Rulesets.Scoring; +using osu.Game.Overlays.Settings; namespace osu.Game.Rulesets { @@ -36,6 +37,8 @@ namespace osu.Game.Rulesets public abstract IEnumerable CreateGameplayKeys(); + public virtual SettingsSubsection CreateSettings() => null; + /// /// Do not override this unless you are a legacy mode. /// From 6b0ba1f98da03f20807dab0166a706e1fe33820b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 11 Jul 2017 20:44:28 -0300 Subject: [PATCH 26/59] Fix merge error. --- osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 6a6ff6be1d..bf7a71a10f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -18,7 +18,6 @@ namespace osu.Desktop.VisualTests.Tests private RulesetDatabase rulesets; - public override void Reset() protected override void LoadComplete() { base.LoadComplete(); From 16bb96e6aa8d1353aab868e093e0238e5773b7be Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 11 Jul 2017 22:12:49 -0300 Subject: [PATCH 27/59] Async medal sprite loading. --- osu.Game/Overlays/MedalOverlay.cs | 11 +++---- .../Overlays/MedalSplash/DrawableMedal.cs | 33 ++++++++++++++++--- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index cc6f23ccdb..f4260a946f 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -56,6 +56,7 @@ namespace osu.Game.Overlays { RelativeSizeAxes = Axes.Both; Alpha = 0f; + AlwaysPresent = true; Children = new Drawable[] { @@ -120,6 +121,7 @@ namespace osu.Game.Overlays Origin = Anchor.Centre, Alpha = 0f, Masking = true, + AlwaysPresent = true, BorderColour = Color4.White, BorderThickness = border_width, Size = new Vector2(DISC_SIZE), @@ -151,6 +153,8 @@ namespace osu.Game.Overlays Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, + AlwaysPresent = true, + OnSpriteLoadComplete = drawable => Show(), }, }, }, @@ -171,12 +175,6 @@ namespace osu.Game.Overlays }; } - protected override void LoadComplete() - { - base.LoadComplete(); - Show(); - } - protected override void Update() { base.Update(); @@ -247,6 +245,7 @@ namespace osu.Game.Overlays { if (drawableMedal.Transforms.Count != 0) return; Hide(); + Expire(); } private class BackgroundStrip : Container diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index e385601f6d..a62f6fd0f8 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using OpenTK; using osu.Framework.Allocation; @@ -21,16 +22,19 @@ namespace osu.Game.Overlays.MedalSplash private readonly Medal medal; private readonly Container medalContainer; - private readonly Sprite medalGlow, medalSprite; + private readonly Sprite medalGlow; private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private readonly FillFlowContainer infoFlow; private readonly IEnumerable descriptionSprites; + public Action OnSpriteLoadComplete; + public DrawableMedal(Medal medal) { this.medal = medal; Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); + AlwaysPresent = true; Children = new Drawable[] { @@ -40,12 +44,17 @@ namespace osu.Game.Overlays.MedalSplash Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Alpha = 0f, - Children = new[] + AlwaysPresent = true, + Children = new Drawable[] { - medalSprite = new Sprite + new AsyncLoadWrapper(new MedalSprite(medal) + { + OnLoadComplete = drawable => OnSpriteLoadComplete?.Invoke(drawable), + }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, + AutoSizeAxes = Axes.Both, Scale = new Vector2(0.81f), }, medalGlow = new Sprite @@ -110,7 +119,6 @@ namespace osu.Game.Overlays.MedalSplash [BackgroundDependencyLoader] private void load(OsuColour colours, TextureStore textures) { - medalSprite.Texture = textures.Get(medal.ImageUrl); medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); foreach (var s in descriptionSprites) @@ -149,5 +157,22 @@ namespace osu.Game.Overlays.MedalSplash MedalUnlocked, Full, } + + private class MedalSprite : Sprite + { + private readonly Medal medal; + + public MedalSprite(Medal medal) + { + this.medal = medal; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + if (medal?.InternalName != null) + Texture = textures.Get(medal.ImageUrl); + } + } } } From aef2a3bddadf372e494202740f2a19ba282e8529 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 11 Jul 2017 22:26:58 -0300 Subject: [PATCH 28/59] Cleanup. --- osu.Game/Overlays/MedalOverlay.cs | 22 +++++++++---------- .../Overlays/MedalSplash/DrawableMedal.cs | 7 ++---- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index f4260a946f..5758097ec2 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -41,17 +41,6 @@ namespace osu.Game.Overlays private SampleChannel getSample; - protected override bool OnClick(InputState state) - { - dismiss(); - return true; - } - - protected override void OnFocusLost(InputState state) - { - if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); - } - public MedalOverlay(Medal medal) { RelativeSizeAxes = Axes.Both; @@ -182,6 +171,17 @@ namespace osu.Game.Overlays particleContainer.Add(new MedalParticle(RNG.Next(0, 359))); } + protected override bool OnClick(InputState state) + { + dismiss(); + return true; + } + + protected override void OnFocusLost(InputState state) + { + if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + } + protected override void PopIn() { base.PopIn(); diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index a62f6fd0f8..c24fe9799c 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -26,7 +26,6 @@ namespace osu.Game.Overlays.MedalSplash private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private readonly FillFlowContainer infoFlow; - private readonly IEnumerable descriptionSprites; public Action OnSpriteLoadComplete; @@ -108,7 +107,7 @@ namespace osu.Game.Overlays.MedalSplash }, }; - descriptionSprites = description.AddText(medal.Description, s => + description.AddText(medal.Description, s => { s.Anchor = Anchor.TopCentre; s.Origin = Anchor.TopCentre; @@ -120,9 +119,7 @@ namespace osu.Game.Overlays.MedalSplash private void load(OsuColour colours, TextureStore textures) { medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); - - foreach (var s in descriptionSprites) - s.Colour = colours.BlueLight; + description.Colour = colours.BlueLight; unlocked.Position = new Vector2(0f, medalContainer.Size.Y / 2 + 10); infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90); From 29cdbc65bc456ef22a8198dc63331b1a96477be6 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 11 Jul 2017 22:38:13 -0300 Subject: [PATCH 29/59] CI fixes. --- osu.Game/Overlays/MedalOverlay.cs | 8 ++++---- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 5758097ec2..17e557b194 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -189,10 +189,10 @@ namespace osu.Game.Overlays FadeIn(200); background.FlashColour(Color4.White.Opacity(0.25f), 400); - double duration1 = 400; - double duration2 = 900; - double duration3 = 900; - double duration4 = 1000; + var duration1 = 400; + var duration2 = 900; + var duration3 = 900; + var duration4 = 1000; getSample.Play(); Delay(200, true); diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index c24fe9799c..8d4b567c27 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -20,7 +19,6 @@ namespace osu.Game.Overlays.MedalSplash private const float scale_when_unlocked = 0.76f; private const float scale_when_full = 0.6f; - private readonly Medal medal; private readonly Container medalContainer; private readonly Sprite medalGlow; private readonly OsuSpriteText unlocked, name; @@ -31,7 +29,6 @@ namespace osu.Game.Overlays.MedalSplash public DrawableMedal(Medal medal) { - this.medal = medal; Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); AlwaysPresent = true; From 204d2ee43d76198e30dd3d7fcb46a13ea7acf79b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 11 Jul 2017 22:43:16 -0300 Subject: [PATCH 30/59] Convert MedalOverlay animation durations to constants. --- osu.Game/Overlays/MedalOverlay.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 17e557b194..bb06ec5362 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -182,6 +182,10 @@ namespace osu.Game.Overlays if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); } + private const double duration1 = 400; + private const double duration2 = 900; + private const double duration3 = 900; + private const double duration4 = 1000; protected override void PopIn() { base.PopIn(); @@ -189,11 +193,6 @@ namespace osu.Game.Overlays FadeIn(200); background.FlashColour(Color4.White.Opacity(0.25f), 400); - var duration1 = 400; - var duration2 = 900; - var duration3 = 900; - var duration4 = 1000; - getSample.Play(); Delay(200, true); From 04e99d1369ca6bf51ae6e982d8ab3e6f1e6ed764 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jul 2017 13:40:17 +0900 Subject: [PATCH 31/59] Only apply disable rules when in a screen stack. --- osu.Game/Screens/OsuScreen.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index f0e673a739..64223db100 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -89,8 +89,13 @@ namespace osu.Game.Screens { if (!IsCurrentScreen) return; - ruleset.Disabled = !AllowBeatmapRulesetChange; - beatmap.Disabled = !AllowBeatmapRulesetChange; + if (ParentScreen != null) + { + // we only want to apply these restrictions when we are inside a screen stack. + // the use case for not applying is in visual/unit tests. + ruleset.Disabled = !AllowBeatmapRulesetChange; + beatmap.Disabled = !AllowBeatmapRulesetChange; + } } protected override void OnResuming(Screen last) From 0b1db1502d386fa7ed291f45682de3a742724373 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 12 Jul 2017 09:42:38 +0300 Subject: [PATCH 32/59] removed useless bool --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 6facc1c349..f8235e5bcf 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -73,11 +73,9 @@ namespace osu.Game.Screens.Play.HUD appearTransform(); } - private bool playIsRanked => !mods.Value.Any(m => !m.Ranked); - private void appearTransform() { - if (!playIsRanked) + if (mods.Value.Any(m => !m.Ranked)) unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); else unrankedText.Hide(); From 9d47dd9ff906f985fbd9d53601fb091e793fcc38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jul 2017 18:57:44 +0900 Subject: [PATCH 33/59] Add support for right mouse absolute scrolling (when enabled) Will likely need to be bindable when hooked up to settings and actually used. --- .../Graphics/Containers/OsuScrollContainer.cs | 72 +++++++++++++++++++ .../Graphics/Containers/SectionsContainer.cs | 2 +- .../Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Chat/DrawableChannel.cs | 3 +- osu.Game/Overlays/Music/PlaylistList.cs | 3 +- osu.Game/Overlays/NotificationManager.cs | 2 +- .../SearchableList/SearchableListOverlay.cs | 3 +- osu.Game/Screens/Multiplayer/RoomInspector.cs | 3 +- .../Select/Leaderboards/Leaderboard.cs | 3 +- osu.Game/osu.Game.csproj | 1 + 10 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 osu.Game/Graphics/Containers/OsuScrollContainer.cs diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs new file mode 100644 index 0000000000..66e21fbf67 --- /dev/null +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -0,0 +1,72 @@ +using osu.Framework.Graphics.Containers; +using osu.Framework.Input; +using OpenTK.Input; + +namespace osu.Game.Graphics.Containers +{ + class OsuScrollContainer : ScrollContainer + { + /// + /// Add the ability to seek to an absolute scroll position when the right mouse button is pressed or dragged. + /// Uses the value of to smoothly scroll to the dragged location. + /// + public bool RightMouseScrollbar = false; + + /// + /// Controls the rate with which the target position is approached when performing a relative drag. Default is 0.02. + /// + public double DistanceDecayOnRightMouseScrollbar = 0.02; + + private bool shouldPerformRelativeDrag(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right); + + private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar); + + private bool mouseScrollBarDragging; + + protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging; + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + if (shouldPerformRelativeDrag(state)) + { + scrollToRelative(state.Mouse.Position[ScrollDim]); + return true; + } + + return base.OnMouseDown(state, args); + } + + protected override bool OnDrag(InputState state) + { + if (mouseScrollBarDragging) + { + scrollToRelative(state.Mouse.Position[ScrollDim]); + return true; + } + + return base.OnDrag(state); + } + + protected override bool OnDragStart(InputState state) + { + if (shouldPerformRelativeDrag(state)) + { + mouseScrollBarDragging = true; + return true; + } + + return base.OnDragStart(state); + } + + protected override bool OnDragEnd(InputState state) + { + if (mouseScrollBarDragging) + { + mouseScrollBarDragging = false; + return true; + } + + return base.OnDragEnd(state); + } + } +} diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 1d792f1b78..37c3804543 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -114,7 +114,7 @@ namespace osu.Game.Graphics.Containers public SectionsContainer() { - Add(ScrollContainer = new ScrollContainer() + Add(ScrollContainer = new OsuScrollContainer() { RelativeSizeAxes = Axes.Both, Masking = false, diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 9f61d13813..135f8f43b9 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Top = 85, Right = WIDTH_PADDING }, Children = new[] { - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Children = new[] diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index f8b7c7e581..e51f931959 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -7,6 +7,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Containers; using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat @@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Chat Children = new Drawable[] { - scroll = new ScrollContainer + scroll = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index eeb072fb00..ca46bdea95 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -7,6 +7,7 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Database; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Music { @@ -49,7 +50,7 @@ namespace osu.Game.Overlays.Music { Children = new Drawable[] { - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] diff --git a/osu.Game/Overlays/NotificationManager.cs b/osu.Game/Overlays/NotificationManager.cs index 382683cbcc..18cb49f335 100644 --- a/osu.Game/Overlays/NotificationManager.cs +++ b/osu.Game/Overlays/NotificationManager.cs @@ -36,7 +36,7 @@ namespace osu.Game.Overlays Colour = Color4.Black, Alpha = 0.6f, }, - scrollContainer = new ScrollContainer + scrollContainer = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT }, diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 25f6b4f60b..c5b8b0cf85 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.SearchableList { @@ -60,7 +61,7 @@ namespace osu.Game.Overlays.SearchableList RelativeSizeAxes = Axes.Both, Children = new[] { - new ScrollContainer + new OsuScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 3a822be791..761204dda4 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -17,6 +17,7 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Online.Multiplayer; using osu.Game.Users; @@ -341,7 +342,7 @@ namespace osu.Game.Screens.Multiplayer }, }, }, - participantsScroll = new ScrollContainer + participantsScroll = new OsuScrollContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs index e560cfe413..2a8e4ca5fb 100644 --- a/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/Leaderboard.cs @@ -12,6 +12,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Threading; using osu.Game.Database; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Scoring; using osu.Game.Online.API; @@ -74,7 +75,7 @@ namespace osu.Game.Screens.Select.Leaderboards { Children = new Drawable[] { - scrollContainer = new ScrollContainer + scrollContainer = new OsuScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarVisible = false, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3d84f287f0..691df1d2d1 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -78,6 +78,7 @@ + From ca12fd304220a6e9279e967da63f8109eb10bb6a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 13 Jul 2017 00:13:18 -0300 Subject: [PATCH 34/59] Better medal sprite loading, fade in particles, visual test update. --- .../Tests/TestCaseMedalOverlay.cs | 13 +++++--- osu.Game/Overlays/MedalOverlay.cs | 21 +++++++----- .../Overlays/MedalSplash/DrawableMedal.cs | 33 +++---------------- 3 files changed, 25 insertions(+), 42 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs index e00b2beac4..f069f089bf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -13,12 +13,15 @@ namespace osu.Desktop.VisualTests.Tests public TestCaseMedalOverlay() { - Add(new MedalOverlay(new Medal + AddStep(@"display", () => { - Name = @"Animations", - InternalName = @"all-intro-doubletime", - Description = @"More complex than you think.", - })); + Add(new MedalOverlay(new Medal + { + Name = @"Animations", + InternalName = @"all-intro-doubletime", + Description = @"More complex than you think.", + })); + }); } } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index bb06ec5362..e58dd2aa40 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -32,17 +32,19 @@ namespace osu.Game.Overlays private const float border_width = 5; + private readonly Medal medal; private readonly Box background; private readonly Container backgroundStrip, particleContainer; private readonly BackgroundStrip leftStrip, rightStrip; private readonly CircularContainer disc; private readonly Sprite innerSpin, outterSpin; - private readonly DrawableMedal drawableMedal; + private DrawableMedal drawableMedal; private SampleChannel getSample; public MedalOverlay(Medal medal) { + this.medal = medal; RelativeSizeAxes = Axes.Both; Alpha = 0f; AlwaysPresent = true; @@ -103,6 +105,7 @@ namespace osu.Game.Overlays particleContainer = new Container { RelativeSizeAxes = Axes.Both, + Alpha = 0f, }, disc = new CircularContainer { @@ -137,14 +140,6 @@ namespace osu.Game.Overlays Size = new Vector2(1.05f), Alpha = 0.25f, }, - drawableMedal = new DrawableMedal(medal) - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AlwaysPresent = true, - OnSpriteLoadComplete = drawable => Show(), - }, }, }, }; @@ -162,6 +157,13 @@ namespace osu.Game.Overlays Colour = colours.Blue.Opacity(0.5f), Radius = 50, }; + + LoadComponentAsync(drawableMedal = new DrawableMedal(medal) + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.X, + }, m => { disc.Add(m); Show(); }); } protected override void Update() @@ -217,6 +219,7 @@ namespace osu.Game.Overlays outterSpin.Transforms.Add(outerRotate); disc.FadeIn(duration1); + particleContainer.FadeIn(duration1); outterSpin.FadeTo(0.1f, duration1 * 2); disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 8d4b567c27..cdc352eff0 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -19,18 +18,17 @@ namespace osu.Game.Overlays.MedalSplash private const float scale_when_unlocked = 0.76f; private const float scale_when_full = 0.6f; + private readonly Medal medal; private readonly Container medalContainer; - private readonly Sprite medalGlow; + private readonly Sprite medalSprite, medalGlow; private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private readonly FillFlowContainer infoFlow; - public Action OnSpriteLoadComplete; - public DrawableMedal(Medal medal) { + this.medal = medal; Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2); - AlwaysPresent = true; Children = new Drawable[] { @@ -40,17 +38,12 @@ namespace osu.Game.Overlays.MedalSplash Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Alpha = 0f, - AlwaysPresent = true, Children = new Drawable[] { - new AsyncLoadWrapper(new MedalSprite(medal) - { - OnLoadComplete = drawable => OnSpriteLoadComplete?.Invoke(drawable), - }) + medalSprite = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, Scale = new Vector2(0.81f), }, medalGlow = new Sprite @@ -115,6 +108,7 @@ namespace osu.Game.Overlays.MedalSplash [BackgroundDependencyLoader] private void load(OsuColour colours, TextureStore textures) { + medalSprite.Texture = textures.Get(medal.ImageUrl); medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow"); description.Colour = colours.BlueLight; @@ -151,22 +145,5 @@ namespace osu.Game.Overlays.MedalSplash MedalUnlocked, Full, } - - private class MedalSprite : Sprite - { - private readonly Medal medal; - - public MedalSprite(Medal medal) - { - this.medal = medal; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - if (medal?.InternalName != null) - Texture = textures.Get(medal.ImageUrl); - } - } } } From 931adcf6774ae71c74251c7100471e2aef9ae1b4 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 13 Jul 2017 00:13:56 -0300 Subject: [PATCH 35/59] Typo. --- osu.Game/Overlays/MedalOverlay.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index e58dd2aa40..8d24b116ab 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays private readonly Container backgroundStrip, particleContainer; private readonly BackgroundStrip leftStrip, rightStrip; private readonly CircularContainer disc; - private readonly Sprite innerSpin, outterSpin; + private readonly Sprite innerSpin, outerSpin; private DrawableMedal drawableMedal; private SampleChannel getSample; @@ -56,7 +56,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(60), }, - outterSpin = new Sprite + outerSpin = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -149,7 +149,7 @@ namespace osu.Game.Overlays private void load(OsuColour colours, TextureStore textures, AudioManager audio) { getSample = audio.Sample.Get(@"MedalSplash/medal-get"); - innerSpin.Texture = outterSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); + innerSpin.Texture = outerSpin.Texture = textures.Get(@"MedalSplash/disc-spin"); disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters { @@ -216,11 +216,11 @@ namespace osu.Game.Overlays }; outerRotate.Loop(0); - outterSpin.Transforms.Add(outerRotate); + outerSpin.Transforms.Add(outerRotate); disc.FadeIn(duration1); particleContainer.FadeIn(duration1); - outterSpin.FadeTo(0.1f, duration1 * 2); + outerSpin.FadeTo(0.1f, duration1 * 2); disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); Delay(duration1 + 200, true); From 321ae423512ae02b57c6db2207b77673fe906d93 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 13 Jul 2017 00:27:41 -0300 Subject: [PATCH 36/59] Formatting. --- osu.Game/Overlays/MedalOverlay.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 8d24b116ab..3677c89727 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -163,7 +163,11 @@ namespace osu.Game.Overlays Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, - }, m => { disc.Add(m); Show(); }); + }, m => + { + disc.Add(m); + Show(); + }); } protected override void Update() From 0624f578eb997a4e7d806ed4e0a43e56ea33f49a Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 13 Jul 2017 01:06:46 -0300 Subject: [PATCH 37/59] Update with online beatmap changes. --- .../Tests/TestCaseDrawableRoom.cs | 20 ++++++++++++++---- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 21 ++++++++++++++++++- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index bf7a71a10f..4f4ef9bbb5 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -49,9 +49,15 @@ namespace osu.Desktop.VisualTests.Tests Title = @"Critical Crystal", Artist = @"Seiryu", }, - OnlineInfo = new BeatmapOnlineInfo + BeatmapSet = new BeatmapSetInfo { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455" }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455", + }, + }, }, }, }, @@ -81,9 +87,15 @@ namespace osu.Desktop.VisualTests.Tests Title = @"Serendipity", Artist = @"ZAQ", }, - OnlineInfo = new BeatmapOnlineInfo + BeatmapSet = new BeatmapSetInfo { - Covers = new[] { @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706" }, + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706", + }, + }, }, }, }, diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index f1b8f95d7b..8e17adc490 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables; @@ -233,7 +234,7 @@ namespace osu.Game.Screens.Multiplayer coverContainer.FadeIn(transition_duration); coverContainer.Children = new[] { - new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null)) + new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(value.BeatmapSet) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -262,5 +263,23 @@ namespace osu.Game.Screens.Multiplayer { participantInfo.Participants = value; } + + private class BeatmapSetBackgroundSprite : Sprite + { + private readonly BeatmapSetInfo set; + public BeatmapSetBackgroundSprite(BeatmapSetInfo set) + { + this.set = set; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + string resource = set.OnlineInfo.Covers.Cover; + + if (resource != null) + Texture = textures.Get(resource); + } + } } } From fea40ccc1a0543d80bd7bfdf57053bc3b1e98dbe Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 13 Jul 2017 01:17:47 -0300 Subject: [PATCH 38/59] Share BeatmapSet cover sprite code. --- .../Beatmaps/Drawables/BeatmapSetCover.cs | 28 +++++++++++++++++++ osu.Game/Overlays/Direct/DirectPanel.cs | 22 +-------------- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 24 +--------------- osu.Game/osu.Game.csproj | 1 + 4 files changed, 31 insertions(+), 44 deletions(-) create mode 100644 osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs new file mode 100644 index 0000000000..502ac59d46 --- /dev/null +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Database; + +namespace osu.Game +{ + public class BeatmapSetCover : Sprite + { + private readonly BeatmapSetInfo set; + public BeatmapSetCover(BeatmapSetInfo set) + { + this.set = set; + } + + [BackgroundDependencyLoader] + private void load(TextureStore textures) + { + string resource = set.OnlineInfo.Covers.Cover; + + if (resource != null) + Texture = textures.Get(resource); + } + } +} diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 02b6e32192..4fc9a922a8 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -3,11 +3,9 @@ using System.Collections.Generic; using OpenTK; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; @@ -34,7 +32,7 @@ namespace osu.Game.Overlays.Direct return icons; } - protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo) + protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetCover(SetInfo) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -89,23 +87,5 @@ namespace osu.Game.Overlays.Direct Value = value; } } - - private class BeatmapSetBackgroundSprite : Sprite - { - private readonly BeatmapSetInfo set; - public BeatmapSetBackgroundSprite(BeatmapSetInfo set) - { - this.set = set; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - string resource = set.OnlineInfo.Covers.Card; - - if (resource != null) - Texture = textures.Get(resource); - } - } } } diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index 8e17adc490..f8c1844615 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -9,10 +9,8 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; -using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -45,7 +43,6 @@ namespace osu.Game.Screens.Multiplayer private readonly Bindable participantsBind = new Bindable(); private OsuColour colours; - private TextureStore textures; private LocalisationEngine localisation; public readonly Room Room; @@ -188,7 +185,6 @@ namespace osu.Game.Screens.Multiplayer private void load(OsuColour colours, TextureStore textures, LocalisationEngine localisation) { this.localisation = localisation; - this.textures = textures; this.colours = colours; beatmapInfoFlow.Colour = colours.Gray9; @@ -234,7 +230,7 @@ namespace osu.Game.Screens.Multiplayer coverContainer.FadeIn(transition_duration); coverContainer.Children = new[] { - new AsyncLoadWrapper(new BeatmapSetBackgroundSprite(value.BeatmapSet) + new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -263,23 +259,5 @@ namespace osu.Game.Screens.Multiplayer { participantInfo.Participants = value; } - - private class BeatmapSetBackgroundSprite : Sprite - { - private readonly BeatmapSetInfo set; - public BeatmapSetBackgroundSprite(BeatmapSetInfo set) - { - this.set = set; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - string resource = set.OnlineInfo.Covers.Cover; - - if (resource != null) - Texture = textures.Get(resource); - } - } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index fc21cbafc0..da3f8fa2eb 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -494,6 +494,7 @@ + From b196b1d3c67411a3a09583d662e0dd8ce18fb39c Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 13 Jul 2017 01:24:59 -0300 Subject: [PATCH 39/59] CI fixes, switch RoomInspector to use BeatmapSetCover. --- .../Beatmaps/Drawables/BeatmapSetCover.cs | 2 +- osu.Game/Screens/Multiplayer/DrawableRoom.cs | 4 ++-- osu.Game/Screens/Multiplayer/RoomInspector.cs | 21 +------------------ 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs index 502ac59d46..4e41424ae8 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Database; -namespace osu.Game +namespace osu.Game.Beatmaps.Drawables { public class BeatmapSetCover : Sprite { diff --git a/osu.Game/Screens/Multiplayer/DrawableRoom.cs b/osu.Game/Screens/Multiplayer/DrawableRoom.cs index f8c1844615..d8963be116 100644 --- a/osu.Game/Screens/Multiplayer/DrawableRoom.cs +++ b/osu.Game/Screens/Multiplayer/DrawableRoom.cs @@ -9,8 +9,8 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; +using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -182,7 +182,7 @@ namespace osu.Game.Screens.Multiplayer } [BackgroundDependencyLoader] - private void load(OsuColour colours, TextureStore textures, LocalisationEngine localisation) + private void load(OsuColour colours, LocalisationEngine localisation) { this.localisation = localisation; this.colours = colours; diff --git a/osu.Game/Screens/Multiplayer/RoomInspector.cs b/osu.Game/Screens/Multiplayer/RoomInspector.cs index 322d74f2b3..9d63fdb948 100644 --- a/osu.Game/Screens/Multiplayer/RoomInspector.cs +++ b/osu.Game/Screens/Multiplayer/RoomInspector.cs @@ -12,8 +12,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; @@ -332,7 +330,7 @@ namespace osu.Game.Screens.Multiplayer coverContainer.FadeIn(transition_duration); coverContainer.Children = new[] { - new AsyncLoadWrapper(new CoverSprite(value.BeatmapSet) + new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, @@ -409,22 +407,5 @@ namespace osu.Game.Screens.Multiplayer }; } } - - private class CoverSprite : Sprite - { - private readonly BeatmapSetInfo set; - - public CoverSprite(BeatmapSetInfo set) - { - this.set = set; - } - - [BackgroundDependencyLoader] - private void load(TextureStore textures) - { - if (set.OnlineInfo?.Covers?.Cover != null) - Texture = textures.Get(set.OnlineInfo.Covers.Cover); - } - } } } From de46f3ab0788091702a0c730d4366020d3e64ae8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 15:02:45 +0900 Subject: [PATCH 40/59] Remove all unnecessary parenthesis where object initialisers are used Enforces at CI. --- osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs | 2 +- osu.Desktop.VisualTests/Tests/TestCaseResults.cs | 2 +- osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- osu.Game/Graphics/Containers/SectionsContainer.cs | 2 +- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/Notifications/ProgressNotification.cs | 2 +- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/Settings/SettingsSlider.cs | 2 +- osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs | 2 +- osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.sln.DotSettings | 4 ++-- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs index 01d7d4ff01..909ee9b134 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs @@ -198,7 +198,7 @@ namespace osu.Desktop.VisualTests.Tests AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); - Add(valueText = new OsuSpriteText() { TextSize = text_size }); + Add(valueText = new OsuSpriteText { TextSize = text_size }); Margin = new MarginPadding(margin); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index 1cfc2fc664..775bfe0f03 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -46,7 +46,7 @@ namespace osu.Desktop.VisualTests.Tests MaxCombo = 123, Rank = ScoreRank.A, Date = DateTimeOffset.Now, - Statistics = new Dictionary() + Statistics = new Dictionary { { "300", 50 }, { "100", 20 }, diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 0a10a60dca..a8ab97ce37 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -186,7 +186,7 @@ namespace osu.Desktop.Overlays { private OsuGame game; - protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification() + protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification { Text = @"Update ready to install. Click to restart!", Activated = () => diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index acf90931ac..e7035880dd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -91,7 +91,7 @@ namespace osu.Game.Beatmaps.ControlPoints if (time < list[0].Time) return prePoint ?? new T(); - int index = list.BinarySearch(new T() { Time = time }); + int index = list.BinarySearch(new T { Time = time }); // Check if we've found an exact match (t == time) if (index >= 0) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 1d792f1b78..90cfa9046a 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -114,7 +114,7 @@ namespace osu.Game.Graphics.Containers public SectionsContainer() { - Add(ScrollContainer = new ScrollContainer() + Add(ScrollContainer = new ScrollContainer { RelativeSizeAxes = Axes.Both, Masking = false, diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index bb6055dc4f..e947895fc2 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Direct { DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark; - Ruleset.BindTo(game?.Ruleset ?? new Bindable() { Value = rulesets.GetRuleset(0) }); + Ruleset.BindTo(game?.Ruleset ?? new Bindable { Value = rulesets.GetRuleset(0) }); foreach (var r in rulesets.AllRulesets) { modeButtons.Add(new RulesetToggleButton(Ruleset, r)); diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 437971337b..f0fa7e6da1 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Notifications private ProgressNotificationState state; - protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification() + protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification { Activated = CompletionClickAction, Text = $"Task \"{Text}\" has completed!" diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 14b67dd6df..f80fef4a99 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Settings if (text == null) { // construct lazily for cases where the label is not needed (may be provided by the Control). - Add(text = new OsuSpriteText() { Depth = 1 }); + Add(text = new OsuSpriteText { Depth = 1 }); } text.Text = value; diff --git a/osu.Game/Overlays/Settings/SettingsSlider.cs b/osu.Game/Overlays/Settings/SettingsSlider.cs index 522d242f2a..2881d02302 100644 --- a/osu.Game/Overlays/Settings/SettingsSlider.cs +++ b/osu.Game/Overlays/Settings/SettingsSlider.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings where T : struct, IEquatable where U : SliderBar, new() { - protected override Drawable CreateControl() => new U() + protected override Drawable CreateControl() => new U { Margin = new MarginPadding { Top = 5, Bottom = 5 }, RelativeSizeAxes = Axes.X diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 7f69d3109c..ea958d05f9 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.ReplaySettings { Children = new Drawable[] { - new ReplaySliderBar() + new ReplaySliderBar { LabelText = "Playback speed", Bindable = config.GetBindable(OsuSetting.PlaybackSpeed) diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs b/osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs index 4992c3a1e7..e80ec092d9 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs +++ b/osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs @@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play.ReplaySettings public class ReplaySliderBar : SettingsSlider where T : struct, IEquatable { - protected override Drawable CreateControl() => new Sliderbar() + protected override Drawable CreateControl() => new Sliderbar { Margin = new MarginPadding { Top = 5, Bottom = 5 }, RelativeSizeAxes = Axes.X diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 481637e2af..9ad932ff26 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -160,7 +160,7 @@ namespace osu.Game.Screens.Select Colour = Color4.Black, Alpha = 0.5f, }, - new FillFlowContainer() + new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 4cc357a01b..35fee9e32d 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -128,7 +128,7 @@ namespace osu.Game.Screens.Select // Bottom = 5 // }, //}, - sortTabs = new OsuTabControl() + sortTabs = new OsuTabControl { RelativeSizeAxes = Axes.X, Width = 0.5f, diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 70bfacd6ef..be78ad39f6 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -66,8 +66,8 @@ DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW - - True + WARNING + WARNING WARNING WARNING From fcfd8b546569779efe0f85b8062a40ae95ddb7ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 15:19:47 +0900 Subject: [PATCH 41/59] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 46a56e0e11..428cb7fcad 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 46a56e0e11d56c788ff8db089582718a606ed158 +Subproject commit 428cb7fcadfdc6656ec4b0398ecfe2820e2e1bdb From 25344d234595f58da7bede44b783b94ff76ba417 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 15:43:18 +0900 Subject: [PATCH 42/59] Fix incorrect header --- osu.Game.Rulesets.Osu/OsuSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/OsuSettings.cs b/osu.Game.Rulesets.Osu/OsuSettings.cs index 861b7bf73c..2fe31b895e 100644 --- a/osu.Game.Rulesets.Osu/OsuSettings.cs +++ b/osu.Game.Rulesets.Osu/OsuSettings.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Osu { public class OsuSettings : SettingsSubsection { - protected override string Header => "osu"; + protected override string Header => "osu!"; [BackgroundDependencyLoader] private void load(OsuConfigManager config) From d3f5de9bf91fa058a5ae97ece2029d718f2106d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 15:44:42 +0900 Subject: [PATCH 43/59] Move to UI namespace --- osu.Game.Rulesets.Osu/{ => UI}/OsuSettings.cs | 2 +- osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename osu.Game.Rulesets.Osu/{ => UI}/OsuSettings.cs (93%) diff --git a/osu.Game.Rulesets.Osu/OsuSettings.cs b/osu.Game.Rulesets.Osu/UI/OsuSettings.cs similarity index 93% rename from osu.Game.Rulesets.Osu/OsuSettings.cs rename to osu.Game.Rulesets.Osu/UI/OsuSettings.cs index 2fe31b895e..b820f33b39 100644 --- a/osu.Game.Rulesets.Osu/OsuSettings.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettings.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Overlays.Settings; -namespace osu.Game.Rulesets.Osu +namespace osu.Game.Rulesets.Osu.UI { public class OsuSettings : SettingsSubsection { diff --git a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj index 3f60dfaa25..684060c981 100644 --- a/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj +++ b/osu.Game.Rulesets.Osu/osu.Game.Rulesets.Osu.csproj @@ -78,7 +78,7 @@ - + From 8460e29bcbb8da5e69a9e800816f8baa41da49b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 16:26:40 +0900 Subject: [PATCH 44/59] Sidebar now pushes full settings out further --- osu.Game/Overlays/Settings/Sidebar.cs | 6 +++--- osu.Game/Overlays/SettingsOverlay.cs | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 6c91f69fd9..ff2386d11b 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -50,10 +50,10 @@ namespace osu.Game.Overlays.Settings protected override bool OnHover(InputState state) { + expandEvent?.Cancel(); expandEvent = Scheduler.AddDelayed(() => { - expandEvent = null; - ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 150, EasingTypes.OutQuad); + ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); }, 750); return true; } @@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Settings protected override void OnHoverLost(InputState state) { expandEvent?.Cancel(); - ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 150, EasingTypes.OutQuad); + ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); base.OnHoverLost(state); } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 4a5a0de890..fa55134c1f 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -148,6 +148,13 @@ namespace osu.Game.Overlays base.OnFocus(state); } + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + + sectionsContainer.Margin = new MarginPadding { Left = sidebar.DrawWidth }; + } + private class SettingsSectionsContainer : SectionsContainer { public SearchContainer SearchContainer; From f4fd263671f8fab8a4d1b943dbac586fd71d3f3d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 16:28:31 +0900 Subject: [PATCH 45/59] Fix settings not offsetting scroll operations by fixed header content --- osu.Game/Graphics/Containers/SectionsContainer.cs | 2 ++ osu.Game/Overlays/SettingsOverlay.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 90cfa9046a..b43f6da8d7 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -123,6 +123,8 @@ namespace osu.Game.Graphics.Containers originalSectionsMargin = sectionsContainer.Margin; } + public void ScrollTo(Drawable section) => ScrollContainer.ScrollTo(ScrollContainer.GetChildPosInContent(section) - FixedHeader.BoundingBox.Height); + private float lastKnownScroll; protected override void UpdateAfterChildren() { diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index fa55134c1f..82dffbb3f7 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = b => sectionsContainer.ScrollContainer.ScrollTo(b), + Action = s => sectionsContainer.ScrollTo(s), } ).ToArray() } From 939e167d6a61623cdf400e4e0cc16e556c41547e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 16:39:27 +0900 Subject: [PATCH 46/59] Correct offset settings vertically based on toolbar visibility --- osu.Game/OsuGame.cs | 4 +++- osu.Game/Overlays/SettingsOverlay.cs | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 961e296050..843861c0da 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -56,6 +56,8 @@ namespace osu.Game } } + public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight; + private OsuScreen screenStack; private VolumeControl volume; @@ -360,7 +362,7 @@ namespace osu.Game { base.UpdateAfterChildren(); - mainContent.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight }; + mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden; } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 82dffbb3f7..2a5aa0390c 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -35,6 +36,8 @@ namespace osu.Game.Overlays private SearchTextBox searchTextBox; + private Func getToolbarHeight; + public SettingsOverlay() { RelativeSizeAxes = Axes.Y; @@ -111,7 +114,7 @@ namespace osu.Game.Overlays searchTextBox.Current.ValueChanged += newValue => sectionsContainer.SearchContainer.SearchTerm = newValue; - sectionsContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 }; + getToolbarHeight = () => game?.ToolbarOffset ?? 0; } protected override void PopIn() @@ -153,6 +156,7 @@ namespace osu.Game.Overlays base.UpdateAfterChildren(); sectionsContainer.Margin = new MarginPadding { Left = sidebar.DrawWidth }; + sectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() }; } private class SettingsSectionsContainer : SectionsContainer From 2ff92ac25a4fd0b172762f683b018becf87eef36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Jul 2017 16:55:48 +0900 Subject: [PATCH 47/59] Contract sidebar on click Also makes queueing of expand more correct. --- osu.Game/Overlays/Settings/Sidebar.cs | 51 +++++++++++++++++++++++---- osu.Game/Overlays/SettingsOverlay.cs | 6 +++- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index ff2386d11b..d7ad212902 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; @@ -12,7 +13,7 @@ using osu.Game.Overlays.Toolbar; namespace osu.Game.Overlays.Settings { - public class Sidebar : Container + public class Sidebar : Container, IStateful { private readonly FillFlowContainer content; internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH; @@ -47,21 +48,18 @@ namespace osu.Game.Overlays.Settings } private ScheduledDelegate expandEvent; + private ExpandedState state; protected override bool OnHover(InputState state) { - expandEvent?.Cancel(); - expandEvent = Scheduler.AddDelayed(() => - { - ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); - }, 750); + queueExpandIfHovering(); return true; } protected override void OnHoverLost(InputState state) { expandEvent?.Cancel(); - ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); + State = ExpandedState.Contracted; base.OnHoverLost(state); } @@ -74,5 +72,44 @@ namespace osu.Game.Overlays.Settings RelativeSizeAxes = Axes.Both; } } + + public ExpandedState State + { + get { return state; } + set + { + // if the state is changed externally, we want to re-queue a delayed expand. + queueExpandIfHovering(); + + if (state == value) return; + + state = value; + + switch (state) + { + default: + ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint); + break; + case ExpandedState.Expanded: + ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint); + break; + } + } + } + + private void queueExpandIfHovering() + { + if (IsHovered) + { + expandEvent?.Cancel(); + expandEvent = Scheduler.AddDelayed(() => State = ExpandedState.Expanded, 750); + } + } + } + + public enum ExpandedState + { + Contracted, + Expanded, } } \ No newline at end of file diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 2a5aa0390c..66b15234c3 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -96,7 +96,11 @@ namespace osu.Game.Overlays new SidebarButton { Section = section, - Action = s => sectionsContainer.ScrollTo(s), + Action = s => + { + sectionsContainer.ScrollTo(s); + sidebar.State = ExpandedState.Contracted; + }, } ).ToArray() } From 8014cd55a24f523203f5b8965a185130cf47dcf4 Mon Sep 17 00:00:00 2001 From: Nabile Rahmani Date: Thu, 13 Jul 2017 21:59:17 +0200 Subject: [PATCH 48/59] Make the skip button clickable only once. --- osu.Game/Screens/Play/SkipButton.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index a3ee2aeb72..c14b33caed 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -182,6 +182,7 @@ namespace osu.Game.Screens.Play private FillFlowContainer flow; private Box background; private AspectContainer aspect; + private bool isClicked; public Button() { @@ -277,6 +278,11 @@ namespace osu.Game.Screens.Play protected override bool OnClick(InputState state) { + if (isClicked) + return false; + + isClicked = true; + box.FlashColour(Color4.White, 500, EasingTypes.OutQuint); aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint); return base.OnClick(state); From a6ac61f735417a9bc877d17c993d373ba88b5ad8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 06:24:07 +0900 Subject: [PATCH 49/59] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 46a56e0e11..991177da4f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 46a56e0e11d56c788ff8db089582718a606ed158 +Subproject commit 991177da4fbed2dd8260c215f2d341ebc858b03e From 840cc918eaecaba9a4663cde6e8fb21fe310463f Mon Sep 17 00:00:00 2001 From: Nabile Rahmani Date: Thu, 13 Jul 2017 23:35:19 +0200 Subject: [PATCH 50/59] Use Enabled instead of a private field. --- osu.Game/Screens/Play/SkipButton.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index c14b33caed..0892bca878 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -182,7 +182,6 @@ namespace osu.Game.Screens.Play private FillFlowContainer flow; private Box background; private AspectContainer aspect; - private bool isClicked; public Button() { @@ -278,14 +277,16 @@ namespace osu.Game.Screens.Play protected override bool OnClick(InputState state) { - if (isClicked) + if (!Enabled) return false; - isClicked = true; - box.FlashColour(Color4.White, 500, EasingTypes.OutQuint); aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint); - return base.OnClick(state); + + bool result = base.OnClick(state); + Enabled.Value = false; + + return result; } } } From bfa6a9aa4ea498689e913a077ca92a61a8fe7aff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 06:43:33 +0900 Subject: [PATCH 51/59] Add missing licence header --- osu.Game/Graphics/Containers/OsuScrollContainer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 66e21fbf67..cfed92866b 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -1,4 +1,7 @@ -using osu.Framework.Graphics.Containers; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics.Containers; using osu.Framework.Input; using OpenTK.Input; From b1d447bf714f5d87a7896a99ff87756c56221bcd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 07:05:39 +0900 Subject: [PATCH 52/59] Add missing access modifier --- osu.Game/Graphics/Containers/OsuScrollContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index cfed92866b..970a0ef0ae 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -7,7 +7,7 @@ using OpenTK.Input; namespace osu.Game.Graphics.Containers { - class OsuScrollContainer : ScrollContainer + internal class OsuScrollContainer : ScrollContainer { /// /// Add the ability to seek to an absolute scroll position when the right mouse button is pressed or dragged. From 6c9219856de60f23803ffd1463ee558ab32fabf9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 09:39:40 +0900 Subject: [PATCH 53/59] Add comment --- osu.Game/Screens/Play/SkipButton.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/SkipButton.cs b/osu.Game/Screens/Play/SkipButton.cs index 0892bca878..b0e3de0ea4 100644 --- a/osu.Game/Screens/Play/SkipButton.cs +++ b/osu.Game/Screens/Play/SkipButton.cs @@ -284,6 +284,9 @@ namespace osu.Game.Screens.Play aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint); bool result = base.OnClick(state); + + // for now, let's disable the skip button after the first press. + // this will likely need to be contextual in the future (bound from external components). Enabled.Value = false; return result; From 20052b060cea6f8d1599bfc32036aeff972ae7d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 13:25:31 +0900 Subject: [PATCH 54/59] Nest delays and implement IStateful, allowing for flushing on early dismiss Note that this will break rotation loops until https://github.com/ppy/osu-framework/issues/900 is addressed. --- osu.Game/Overlays/MedalOverlay.cs | 85 ++++++++++--------- .../Overlays/MedalSplash/DrawableMedal.cs | 60 ++++++++++--- 2 files changed, 92 insertions(+), 53 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 3677c89727..666cccea82 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -16,7 +16,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; using osu.Framework.Input; using OpenTK.Input; using System.Linq; @@ -188,10 +187,9 @@ namespace osu.Game.Overlays if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); } - private const double duration1 = 400; - private const double duration2 = 900; - private const double duration3 = 900; - private const double duration4 = 1000; + private const double initial_duration = 400; + private const double step_duration = 900; + protected override void PopIn() { base.PopIn(); @@ -200,56 +198,63 @@ namespace osu.Game.Overlays background.FlashColour(Color4.White.Opacity(0.25f), 400); getSample.Play(); - Delay(200, true); - var innerRotate = new TransformRotation + using (innerSpin.BeginLoopedSequence()) + innerSpin.RotateTo(360, 20000); + + using (outerSpin.BeginLoopedSequence()) + outerSpin.RotateTo(360, 40000); + + using (BeginDelayedSequence(200, true)) { - EndValue = 359, - StartTime = Clock.TimeInfo.Current, - EndTime = Clock.TimeInfo.Current + 20000, - }; + disc.FadeIn(initial_duration); + particleContainer.FadeIn(initial_duration); + outerSpin.FadeTo(0.1f, initial_duration * 2); + disc.ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic); - innerRotate.Loop(0); - innerSpin.Transforms.Add(innerRotate); + using (BeginDelayedSequence(initial_duration + 200, true)) + { + backgroundStrip.FadeIn(step_duration); + leftStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); + rightStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); + Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Icon; + }); - var outerRotate = new TransformRotation - { - EndValue = 359, - StartTime = Clock.TimeInfo.Current, - EndTime = Clock.TimeInfo.Current + 40000, - }; + using (BeginDelayedSequence(step_duration, true)) + { + Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.MedalUnlocked; + }); - outerRotate.Loop(0); - outerSpin.Transforms.Add(outerRotate); - - disc.FadeIn(duration1); - particleContainer.FadeIn(duration1); - outerSpin.FadeTo(0.1f, duration1 * 2); - disc.ScaleTo(1f, duration1 * 2, EasingTypes.OutElastic); - - Delay(duration1 + 200, true); - backgroundStrip.FadeIn(duration2); - leftStrip.ResizeWidthTo(1f, duration2, EasingTypes.OutQuint); - rightStrip.ResizeWidthTo(1f, duration2, EasingTypes.OutQuint); - drawableMedal.ChangeState(DrawableMedal.DisplayState.Icon, duration2); - - Delay(duration2, true); - drawableMedal.ChangeState(DrawableMedal.DisplayState.MedalUnlocked, duration3); - - Delay(duration3, true); - drawableMedal.ChangeState(DrawableMedal.DisplayState.Full, duration4); + using (BeginDelayedSequence(step_duration, true)) + Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Full; + }); + } + } + } } protected override void PopOut() { base.PopOut(); - FadeOut(200); } private void dismiss() { - if (drawableMedal.Transforms.Count != 0) return; + if (drawableMedal.State != DisplayState.Full) + { + // if we haven't yet, play out the animation fully + drawableMedal.State = DisplayState.Full; + Flush(true); + return; + } + Hide(); Expire(); } diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index cdc352eff0..7d7ffbd12a 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -13,7 +14,7 @@ using osu.Game.Users; namespace osu.Game.Overlays.MedalSplash { - public class DrawableMedal : Container + public class DrawableMedal : Container, IStateful { private const float scale_when_unlocked = 0.76f; private const float scale_when_full = 0.6f; @@ -24,7 +25,7 @@ namespace osu.Game.Overlays.MedalSplash private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private readonly FillFlowContainer infoFlow; - + private DisplayState state; public DrawableMedal(Medal medal) { this.medal = medal; @@ -116,34 +117,67 @@ namespace osu.Game.Overlays.MedalSplash infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90); } - public void ChangeState(DisplayState newState, double duration) + protected override void LoadComplete() { - switch (newState) + base.LoadComplete(); + updateState(); + } + + public DisplayState State + { + get { return state; } + set { + if (state == value) return; + + state = value; + updateState(); + } + } + + private void updateState() + { + if (!IsLoaded) return; + + const double duration = 900; + + switch (state) + { + case DisplayState.None: + medalContainer.ScaleTo(0); + break; case DisplayState.Icon: - medalContainer.Scale = Vector2.Zero; medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic); - medalContainer.FadeInFromZero(duration); + medalContainer.FadeIn(duration); break; case DisplayState.MedalUnlocked: + medalContainer.ScaleTo(1); + medalContainer.Show(); + ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo); MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo); unlocked.FadeInFromZero(duration); break; case DisplayState.Full: + medalContainer.ScaleTo(1); + medalContainer.Show(); + ScaleTo(scale_when_full, duration, EasingTypes.OutExpo); MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo); - name.FadeInFromZero(duration); + name.FadeInFromZero(duration + 100); description.FadeInFromZero(duration * 2); break; } - } - public enum DisplayState - { - Icon, - MedalUnlocked, - Full, + } } + + public enum DisplayState + { + None, + Icon, + MedalUnlocked, + Full, + } } From 980fb18ed60eefa613ca2272a8503232ce23a8d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 14:30:35 +0900 Subject: [PATCH 55/59] Remove unnecessary alpha/alwayspresent changes --- osu.Game/Overlays/MedalOverlay.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 666cccea82..3222d492e9 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -45,8 +45,6 @@ namespace osu.Game.Overlays { this.medal = medal; RelativeSizeAxes = Axes.Both; - Alpha = 0f; - AlwaysPresent = true; Children = new Drawable[] { From 133bcdec7a91cd8a4e85a0cd906a799637b9c170 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 14:39:15 +0900 Subject: [PATCH 56/59] Move async loading to a higher level to simplify logic --- .../Tests/TestCaseMedalOverlay.cs | 4 ++-- osu.Game/Overlays/MedalOverlay.cs | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs index f069f089bf..1533f2141e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs @@ -15,12 +15,12 @@ namespace osu.Desktop.VisualTests.Tests { AddStep(@"display", () => { - Add(new MedalOverlay(new Medal + LoadComponentAsync(new MedalOverlay(new Medal { Name = @"Animations", InternalName = @"all-intro-doubletime", Description = @"More complex than you think.", - })); + }), Add); }); } } diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 3222d492e9..ccde414d37 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -155,18 +155,20 @@ namespace osu.Game.Overlays Radius = 50, }; - LoadComponentAsync(drawableMedal = new DrawableMedal(medal) + disc.Add(drawableMedal = new DrawableMedal(medal) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, - }, m => - { - disc.Add(m); - Show(); }); } + protected override void LoadComplete() + { + base.LoadComplete(); + Show(); + } + protected override void Update() { base.Update(); From bce4b838d88fbe0ecc878ebc4369b0d0a0d1a2bc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 14:40:50 +0900 Subject: [PATCH 57/59] Formatting --- osu.Game/Overlays/MedalOverlay.cs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index ccde414d37..5f85474ede 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -217,23 +217,14 @@ namespace osu.Game.Overlays backgroundStrip.FadeIn(step_duration); leftStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); rightStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint); - Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Icon; - }); + Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Icon; }); using (BeginDelayedSequence(step_duration, true)) { - Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.MedalUnlocked; - }); + Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.MedalUnlocked; }); using (BeginDelayedSequence(step_duration, true)) - Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Full; - }); + Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Full; }); } } } From 9dba363b0888b32bbe155dedb587ed68bec18697 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 17:57:01 +0900 Subject: [PATCH 58/59] Use button boundaries to decide when to expand sidebar --- osu.Game/Overlays/Settings/Sidebar.cs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index d7ad212902..44d296a079 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Framework; using OpenTK; using OpenTK.Graphics; @@ -59,10 +60,18 @@ namespace osu.Game.Overlays.Settings protected override void OnHoverLost(InputState state) { expandEvent?.Cancel(); + lastHoveredButton = null; State = ExpandedState.Contracted; + base.OnHoverLost(state); } + protected override bool OnMouseMove(InputState state) + { + queueExpandIfHovering(); + return base.OnMouseMove(state); + } + private class SidebarScrollContainer : ScrollContainer { public SidebarScrollContainer() @@ -78,9 +87,6 @@ namespace osu.Game.Overlays.Settings get { return state; } set { - // if the state is changed externally, we want to re-queue a delayed expand. - queueExpandIfHovering(); - if (state == value) return; state = value; @@ -97,13 +103,24 @@ namespace osu.Game.Overlays.Settings } } + private Drawable lastHoveredButton; + + private Drawable hoveredButton => content.Children.FirstOrDefault(c => c.IsHovered); + private void queueExpandIfHovering() { - if (IsHovered) + // only expand when we hover a different button. + if (lastHoveredButton == hoveredButton) return; + + if (!IsHovered) return; + + if (State != ExpandedState.Expanded) { expandEvent?.Cancel(); expandEvent = Scheduler.AddDelayed(() => State = ExpandedState.Expanded, 750); } + + lastHoveredButton = hoveredButton; } } From b7612af20cff4ff828011125eb9be7616e12c643 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Jul 2017 18:08:47 +0900 Subject: [PATCH 59/59] Make comment different --- osu.Game/Graphics/Containers/OsuScrollContainer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 970a0ef0ae..e395f1b7bd 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -10,7 +10,7 @@ namespace osu.Game.Graphics.Containers internal class OsuScrollContainer : ScrollContainer { /// - /// Add the ability to seek to an absolute scroll position when the right mouse button is pressed or dragged. + /// Allows controlling the scroll bar from any position in the container using the right mouse button. /// Uses the value of to smoothly scroll to the dragged location. /// public bool RightMouseScrollbar = false; @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.Containers /// public double DistanceDecayOnRightMouseScrollbar = 0.02; - private bool shouldPerformRelativeDrag(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right); + private bool shouldPerformRightMouseScroll(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right); private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar); @@ -30,7 +30,7 @@ namespace osu.Game.Graphics.Containers protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - if (shouldPerformRelativeDrag(state)) + if (shouldPerformRightMouseScroll(state)) { scrollToRelative(state.Mouse.Position[ScrollDim]); return true; @@ -52,7 +52,7 @@ namespace osu.Game.Graphics.Containers protected override bool OnDragStart(InputState state) { - if (shouldPerformRelativeDrag(state)) + if (shouldPerformRightMouseScroll(state)) { mouseScrollBarDragging = true; return true;