mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:02:55 +08:00
Merge branch 'master' into fix-selection-border-radius
This commit is contained in:
commit
cce7855bf9
@ -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<User> LocalUser = new Bindable<User>(createGuestUser());
|
||||
public Bindable<User> LocalUser { get; } = new Bindable<User>(createGuestUser());
|
||||
|
||||
public string Token
|
||||
{
|
||||
|
31
osu.Game/Online/API/DummyAPIAccess.cs
Normal file
31
osu.Game/Online/API/DummyAPIAccess.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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<User> LocalUser { get; } = new Bindable<User>(new User
|
||||
{
|
||||
Username = @"Dummy",
|
||||
Id = 1,
|
||||
});
|
||||
|
||||
public bool IsLoggedIn => true;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Queue(APIRequest request)
|
||||
{
|
||||
}
|
||||
|
||||
public void Register(IOnlineComponent component)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
34
osu.Game/Online/API/IAPIProvider.cs
Normal file
34
osu.Game/Online/API/IAPIProvider.cs
Normal file
@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// The local user.
|
||||
/// </summary>
|
||||
Bindable<User> LocalUser { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the local user is logged in.
|
||||
/// </summary>
|
||||
bool IsLoggedIn { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Queue a new request.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to perform.</param>
|
||||
void Queue(APIRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Register a component to receive state changes.
|
||||
/// </summary>
|
||||
/// <param name="component">The component to register.</param>
|
||||
void Register(IOnlineComponent component);
|
||||
}
|
||||
}
|
@ -108,6 +108,7 @@ namespace osu.Game
|
||||
Username = LocalConfig.Get<string>(OsuSetting.Username),
|
||||
Token = LocalConfig.Get<string>(OsuSetting.Token)
|
||||
});
|
||||
dependencies.CacheAs<IAPIProvider>(API);
|
||||
|
||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
||||
|
@ -290,6 +290,8 @@
|
||||
<Compile Include="IO\Archives\ArchiveReader.cs" />
|
||||
<Compile Include="IO\Archives\LegacyFilesystemReader.cs" />
|
||||
<Compile Include="IO\Archives\ZipArchiveReader.cs" />
|
||||
<Compile Include="Online\API\DummyAPIAccess.cs" />
|
||||
<Compile Include="Online\API\IAPIProvider.cs" />
|
||||
<Compile Include="Online\API\APIDownloadRequest.cs" />
|
||||
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
||||
<Compile Include="Migrations\20180125143340_Settings.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user