diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 1d657b8664..90f3999ddd 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Threading; -using osu.Framework; using osu.Framework.Configuration; using osu.Framework.Logging; using osu.Framework.Threading; @@ -16,7 +15,7 @@ using osu.Game.Users; namespace osu.Game.Online.API { - public class APIAccess : IUpdateable + public class APIAccess : IAPIProvider { private readonly OAuth authentication; @@ -34,7 +33,7 @@ namespace osu.Game.Online.API public string Password; - public Bindable LocalUser = new Bindable(createGuestUser()); + public Bindable LocalUser { get; } = new Bindable(createGuestUser()); public string Token { diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs new file mode 100644 index 0000000000..fc0dc0ef8b --- /dev/null +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Game.Users; + +namespace osu.Game.Online.API +{ + public class DummyAPIAccess : IAPIProvider + { + public Bindable LocalUser { get; } = new Bindable(new User + { + Username = @"Dummy", + Id = 1, + }); + + public bool IsLoggedIn => true; + + public void Update() + { + } + + public virtual void Queue(APIRequest request) + { + } + + public void Register(IOnlineComponent component) + { + } + } +} diff --git a/osu.Game/Online/API/IAPIProvider.cs b/osu.Game/Online/API/IAPIProvider.cs new file mode 100644 index 0000000000..b3c8774209 --- /dev/null +++ b/osu.Game/Online/API/IAPIProvider.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework; +using osu.Framework.Configuration; +using osu.Game.Users; + +namespace osu.Game.Online.API +{ + public interface IAPIProvider : IUpdateable + { + /// + /// The local user. + /// + Bindable LocalUser { get; } + + /// + /// Returns whether the local user is logged in. + /// + bool IsLoggedIn { get; } + + /// + /// Queue a new request. + /// + /// The request to perform. + void Queue(APIRequest request); + + /// + /// Register a component to receive state changes. + /// + /// The component to register. + void Register(IOnlineComponent component); + } +} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 8974275da2..b70055cc00 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -108,6 +108,7 @@ namespace osu.Game Username = LocalConfig.Get(OsuSetting.Username), Token = LocalConfig.Get(OsuSetting.Token) }); + dependencies.CacheAs(API); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); diff --git a/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs b/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs index 48f6393ccc..269dd79bf7 100644 --- a/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs +++ b/osu.Game/Rulesets/Edit/Layers/Selection/CaptureBox.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection this.capturedObjects = capturedObjects; Masking = true; - BorderThickness = 3; + BorderThickness = SelectionBox.BORDER_RADIUS; InternalChild = new Box { diff --git a/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs b/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs index 8eee15d0b2..1c25846ee3 100644 --- a/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs +++ b/osu.Game/Rulesets/Edit/Layers/Selection/SelectionBox.cs @@ -14,32 +14,21 @@ namespace osu.Game.Rulesets.Edit.Layers.Selection /// public class SelectionBox : VisibilityContainer { + public const float BORDER_RADIUS = 2; + /// /// Creates a new . /// public SelectionBox() { - InternalChildren = new Drawable[] + Masking = true; + BorderColour = Color4.White; + BorderThickness = BORDER_RADIUS; + + Child = new Box { - new Container - { - RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(-1), - Child = new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - BorderColour = Color4.White, - BorderThickness = 2, - MaskingSmoothness = 1, - Child = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0.1f, - AlwaysPresent = true - }, - } - } + RelativeSizeAxes = Axes.Both, + Alpha = 0.1f }; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 70c904e8b9..39261fbe57 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -290,6 +290,8 @@ + +