From 39160d895ce7412a5a6f1117f429b70713e5ab06 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 2 Feb 2018 15:18:39 +0900 Subject: [PATCH 1/3] Update design of "revert to default" button Also fixes some inconsistencies in padding --- osu.Game/Overlays/Settings/SettingsItem.cs | 98 ++++++++++++---------- osu.Game/Overlays/SettingsOverlay.cs | 2 +- 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index b58b99f1e3..adb7c509c0 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -7,7 +7,6 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; @@ -16,6 +15,7 @@ using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using OpenTK; namespace osu.Game.Overlays.Settings { @@ -33,22 +33,10 @@ public abstract class SettingsItem : Container, IFilterable private SpriteText text; - private readonly RestoreDefaultValueButton restoreDefaultValueButton = new RestoreDefaultValueButton(); + private readonly RestoreDefaultValueButton restoreDefaultButton; public bool ShowsDefaultIndicator = true; - private Color4? restoreDefaultValueColour; - - public Color4 RestoreDefaultValueColour - { - get { return restoreDefaultValueColour ?? Color4.White; } - set - { - restoreDefaultValueColour = value; - restoreDefaultValueButton?.SetButtonColour(RestoreDefaultValueColour); - } - } - public virtual string LabelText { get { return text?.Text ?? string.Empty; } @@ -69,10 +57,7 @@ public virtual string LabelText public virtual Bindable Bindable { - get - { - return bindable; - } + get { return bindable; } set { @@ -80,8 +65,8 @@ public virtual Bindable Bindable controlWithCurrent?.Current.BindTo(bindable); if (ShowsDefaultIndicator) { - restoreDefaultValueButton.Bindable = bindable.GetBoundCopy(); - restoreDefaultValueButton.Bindable.TriggerChange(); + restoreDefaultButton.Bindable = bindable.GetBoundCopy(); + restoreDefaultButton.Bindable.TriggerChange(); } } } @@ -103,38 +88,30 @@ protected SettingsItem() AutoSizeAxes = Axes.Y; Padding = new MarginPadding { Right = SettingsOverlay.CONTENT_MARGINS }; - FlowContent = new FillFlowContainer + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = 5 }, + restoreDefaultButton = new RestoreDefaultValueButton(), + FlowContent = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS }, + Child = Control = CreateControl() + }, }; - - if ((Control = CreateControl()) != null) - { - if (controlWithCurrent != null) - controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; }; - FlowContent.Add(Control); - } } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { - AddInternal(FlowContent); - - if (restoreDefaultValueButton != null) - { - if (!restoreDefaultValueColour.HasValue) - restoreDefaultValueColour = colours.Yellow; - restoreDefaultValueButton.SetButtonColour(RestoreDefaultValueColour); - AddInternal(restoreDefaultValueButton); - } + if (controlWithCurrent != null) + controlWithCurrent.Current.DisabledChanged += disabled => { Colour = disabled ? Color4.Gray : Color4.White; }; } - private class RestoreDefaultValueButton : Box, IHasTooltip + private class RestoreDefaultValueButton : Container, IHasTooltip { private Bindable bindable; + public Bindable Bindable { get { return bindable; } @@ -157,6 +134,36 @@ public RestoreDefaultValueButton() Alpha = 0f; } + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + buttonColour = colour.Yellow; + + Child = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + CornerRadius = 3, + Masking = true, + Colour = buttonColour, + EdgeEffect = new EdgeEffectParameters + { + Colour = buttonColour.Opacity(0.1f), + Type = EdgeEffectType.Glow, + Radius = 2, + }, + Size = new Vector2(0.33f, 0.8f), + Child = new Box { RelativeSizeAxes = Axes.Both }, + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + UpdateState(); + } + public string TooltipText => "Revert to default"; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; @@ -193,9 +200,10 @@ public void UpdateState() { if (bindable == null) return; - var colour = bindable.Disabled ? Color4.Gray : buttonColour; - this.FadeTo(bindable.IsDefault ? 0f : hovering && !bindable.Disabled ? 1f : 0.5f, 200, Easing.OutQuint); - this.FadeColour(ColourInfo.GradientHorizontal(colour.Opacity(0.8f), colour.Opacity(0)), 200, Easing.OutQuint); + + this.FadeTo(bindable.IsDefault ? 0f : + hovering && !bindable.Disabled ? 1f : 0.65f, 200, Easing.OutQuint); + this.FadeColour(bindable.Disabled ? Color4.Gray : buttonColour, 200, Easing.OutQuint); } } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 277ed81ce8..c003046242 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays { public abstract class SettingsOverlay : OsuFocusedOverlayContainer { - public const float CONTENT_MARGINS = 10; + public const float CONTENT_MARGINS = 15; public const float TRANSITION_LENGTH = 600; From c4f3223e342bf4bc067d3372e19fbece78c7895f Mon Sep 17 00:00:00 2001 From: Imnooby Date: Sat, 3 Feb 2018 18:24:49 -0600 Subject: [PATCH 2/3] Stops non-url text from being hyperlinks Fixed crash when you attempted to click one --- osu.Game/Overlays/Profile/ProfileHeader.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 60723ad29e..d085800f41 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -433,7 +433,13 @@ private void tryAddInfoRightLine(FontAwesome icon, string str, string url = null if (string.IsNullOrEmpty(str)) return; infoTextRight.AddIcon(icon); - infoTextRight.AddLink(" " + str, url); + if (url != null) + { + infoTextRight.AddLink(" " + str, url); + } else + { + infoTextRight.AddText(" " + str); + } infoTextRight.NewLine(); } From cf39236fc15151c8538fbbd7d48ae7b6852b2707 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 5 Feb 2018 18:29:58 +0900 Subject: [PATCH 3/3] Make NUnit tests run locally again --- osu.Game.Tests/osu.Game.Tests.csproj | 23 +++++++++++++++++++++++ osu.Game.Tests/packages.config | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 8301f1f734..2f8bc5522d 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -45,6 +45,18 @@ $(SolutionDir)\packages\ppy.OpenTK.3.0.11\lib\net45\OpenTK.dll True + + $(SolutionDir)\packages\SQLitePCLRaw.bundle_green.1.1.8\lib\net45\SQLitePCLRaw.batteries_green.dll + + + $(SolutionDir)\packages\SQLitePCLRaw.bundle_green.1.1.8\lib\net45\SQLitePCLRaw.batteries_v2.dll + + + $(SolutionDir)\packages\SQLitePCLRaw.core.1.1.8\lib\net45\SQLitePCLRaw.core.dll + + + $(SolutionDir)\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.8\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll + $(SolutionDir)\packages\System.ValueTuple.4.4.0\lib\net461\System.ValueTuple.dll @@ -171,4 +183,15 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/osu.Game.Tests/packages.config b/osu.Game.Tests/packages.config index c16d10bf45..9b125da215 100644 --- a/osu.Game.Tests/packages.config +++ b/osu.Game.Tests/packages.config @@ -8,5 +8,11 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + + + + + + \ No newline at end of file