mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 08:27:49 +08:00
Merge branch 'master' into non-concurrent-sample-playback
This commit is contained in:
commit
2e646882fa
@ -20,7 +20,7 @@ namespace osu.Android
|
|||||||
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false, LaunchMode = LaunchMode.SingleInstance)]
|
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false, LaunchMode = LaunchMode.SingleInstance)]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osz", DataHost = "*", DataMimeType = "*/*")]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osz", DataHost = "*", DataMimeType = "*/*")]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osk", DataHost = "*", DataMimeType = "*/*")]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault }, DataScheme = "content", DataPathPattern = ".*\\\\.osk", DataHost = "*", DataMimeType = "*/*")]
|
||||||
[IntentFilter(new[] { Intent.ActionSend, Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "application/zip", "application/octet-stream" })]
|
[IntentFilter(new[] { Intent.ActionSend, Intent.ActionSendMultiple }, Categories = new[] { Intent.CategoryDefault }, DataMimeTypes = new[] { "application/zip", "application/octet-stream", "application/download", "application/x-zip", "application/x-zip-compressed" })]
|
||||||
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault }, DataSchemes = new[] { "osu", "osump" })]
|
[IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryBrowsable, Intent.CategoryDefault }, DataSchemes = new[] { "osu", "osump" })]
|
||||||
public class OsuGameActivity : AndroidGameActivity
|
public class OsuGameActivity : AndroidGameActivity
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,6 @@ using osu.Framework.Testing;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Replays.Legacy;
|
using osu.Game.Replays.Legacy;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -244,8 +243,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HubClientConnector CreateConnector(string name, string endpoint, IAPIProvider api) => null;
|
|
||||||
|
|
||||||
public void StartPlay(int beatmapId)
|
public void StartPlay(int beatmapId)
|
||||||
{
|
{
|
||||||
this.beatmapId = beatmapId;
|
this.beatmapId = beatmapId;
|
||||||
|
@ -13,7 +13,6 @@ using osu.Framework.Testing;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Replays.Legacy;
|
using osu.Game.Replays.Legacy;
|
||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
@ -106,8 +105,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
this.totalUsers = totalUsers;
|
this.totalUsers = totalUsers;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override HubClientConnector CreateConnector(string name, string endpoint, IAPIProvider api) => null;
|
|
||||||
|
|
||||||
public void Start(int beatmapId)
|
public void Start(int beatmapId)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < totalUsers; i++)
|
for (int i = 0; i < totalUsers; i++)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -163,7 +164,13 @@ namespace osu.Game.Tournament.Tests
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
|
public void RunTestBlocking(TestScene test)
|
||||||
|
{
|
||||||
|
while (runner?.IsLoaded != true && Host.ExecutionState == ExecutionState.Running)
|
||||||
|
Thread.Sleep(10);
|
||||||
|
|
||||||
|
runner?.RunTestBlocking(test);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,8 @@ namespace osu.Game.Online.API
|
|||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IHubClientConnector GetHubConnector(string clientName, string endpoint) => new HubClientConnector(clientName, endpoint, this);
|
||||||
|
|
||||||
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
||||||
{
|
{
|
||||||
Debug.Assert(State.Value == APIState.Offline);
|
Debug.Assert(State.Value == APIState.Offline);
|
||||||
|
@ -83,6 +83,8 @@ namespace osu.Game.Online.API
|
|||||||
state.Value = APIState.Offline;
|
state.Value = APIState.Offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IHubClientConnector GetHubConnector(string clientName, string endpoint) => null;
|
||||||
|
|
||||||
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
|
||||||
{
|
{
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
@ -95,6 +97,13 @@ namespace osu.Game.Online.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
void Logout();
|
void Logout();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new <see cref="IHubClientConnector"/>. May be null if not supported.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="clientName">The name of the client this connector connects for, used for logging.</param>
|
||||||
|
/// <param name="endpoint">The endpoint to the hub.</param>
|
||||||
|
IHubClientConnector? GetHubConnector(string clientName, string endpoint);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new user account. This is a blocking operation.
|
/// Create a new user account. This is a blocking operation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -102,6 +111,6 @@ namespace osu.Game.Online.API
|
|||||||
/// <param name="username">The username to create the account with.</param>
|
/// <param name="username">The username to create the account with.</param>
|
||||||
/// <param name="password">The password to create the account with.</param>
|
/// <param name="password">The password to create the account with.</param>
|
||||||
/// <returns>Any errors encoutnered during account creation.</returns>
|
/// <returns>Any errors encoutnered during account creation.</returns>
|
||||||
RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password);
|
RegistrationRequest.RegistrationRequestErrors? CreateAccount(string email, string username, string password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,12 @@ using osu.Game.Online.API;
|
|||||||
|
|
||||||
namespace osu.Game.Online
|
namespace osu.Game.Online
|
||||||
{
|
{
|
||||||
/// <summary>
|
public class HubClientConnector : IHubClientConnector
|
||||||
/// A component that manages the life cycle of a connection to a SignalR Hub.
|
|
||||||
/// </summary>
|
|
||||||
public class HubClientConnector : IDisposable
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked whenever a new hub connection is built, to configure it before it's started.
|
/// Invoked whenever a new hub connection is built, to configure it before it's started.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<HubConnection>? ConfigureConnection;
|
public Action<HubConnection>? ConfigureConnection { get; set; }
|
||||||
|
|
||||||
private readonly string clientName;
|
private readonly string clientName;
|
||||||
private readonly string endpoint;
|
private readonly string endpoint;
|
||||||
|
34
osu.Game/Online/IHubClientConnector.cs
Normal file
34
osu.Game/Online/IHubClientConnector.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable enable
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.SignalR.Client;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
|
namespace osu.Game.Online
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A component that manages the life cycle of a connection to a SignalR Hub.
|
||||||
|
/// Should generally be retrieved from an <see cref="IAPIProvider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHubClientConnector : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The current connection opened by this connector.
|
||||||
|
/// </summary>
|
||||||
|
HubConnection? CurrentConnection { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this is connected to the hub, use <see cref="CurrentConnection"/> to access the connection, if this is <c>true</c>.
|
||||||
|
/// </summary>
|
||||||
|
IBindable<bool> IsConnected { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked whenever a new hub connection is built, to configure it before it's started.
|
||||||
|
/// </summary>
|
||||||
|
public Action<HubConnection>? ConfigureConnection { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,8 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
public class MultiplayerClient : StatefulMultiplayerClient
|
public class MultiplayerClient : StatefulMultiplayerClient
|
||||||
{
|
{
|
||||||
private readonly string endpoint;
|
private readonly string endpoint;
|
||||||
private HubClientConnector? connector;
|
|
||||||
|
private IHubClientConnector? connector;
|
||||||
|
|
||||||
public override IBindable<bool> IsConnected { get; } = new BindableBool();
|
public override IBindable<bool> IsConnected { get; } = new BindableBool();
|
||||||
|
|
||||||
@ -31,9 +32,11 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
connector = new HubClientConnector(nameof(MultiplayerClient), endpoint, api)
|
connector = api.GetHubConnector(nameof(MultiplayerClient), endpoint);
|
||||||
|
|
||||||
|
if (connector != null)
|
||||||
{
|
{
|
||||||
ConfigureConnection = connection =>
|
connector.ConfigureConnection = connection =>
|
||||||
{
|
{
|
||||||
// this is kind of SILLY
|
// this is kind of SILLY
|
||||||
// https://github.com/dotnet/aspnetcore/issues/15198
|
// https://github.com/dotnet/aspnetcore/issues/15198
|
||||||
@ -48,10 +51,10 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
|
connection.On(nameof(IMultiplayerClient.ResultsReady), ((IMultiplayerClient)this).ResultsReady);
|
||||||
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
|
connection.On<int, IEnumerable<APIMod>>(nameof(IMultiplayerClient.UserModsChanged), ((IMultiplayerClient)this).UserModsChanged);
|
||||||
connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged);
|
connection.On<int, BeatmapAvailability>(nameof(IMultiplayerClient.UserBeatmapAvailabilityChanged), ((IMultiplayerClient)this).UserBeatmapAvailabilityChanged);
|
||||||
},
|
};
|
||||||
};
|
|
||||||
|
|
||||||
IsConnected.BindTo(connector.IsConnected);
|
IsConnected.BindTo(connector.IsConnected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task<MultiplayerRoom> JoinRoom(long roomId)
|
protected override Task<MultiplayerRoom> JoinRoom(long roomId)
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Online.Spectator
|
|||||||
private readonly string endpoint;
|
private readonly string endpoint;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private HubClientConnector connector;
|
private IHubClientConnector connector;
|
||||||
|
|
||||||
private readonly IBindable<bool> isConnected = new BindableBool();
|
private readonly IBindable<bool> isConnected = new BindableBool();
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Online.Spectator
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
connector = CreateConnector(nameof(SpectatorStreamingClient), endpoint, api);
|
connector = api.GetHubConnector(nameof(SpectatorStreamingClient), endpoint);
|
||||||
|
|
||||||
if (connector != null)
|
if (connector != null)
|
||||||
{
|
{
|
||||||
@ -129,8 +129,6 @@ namespace osu.Game.Online.Spectator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual HubClientConnector CreateConnector(string name, string endpoint, IAPIProvider api) => new HubClientConnector(name, endpoint, api);
|
|
||||||
|
|
||||||
Task ISpectatorClient.UserBeganPlaying(int userId, SpectatorState state)
|
Task ISpectatorClient.UserBeganPlaying(int userId, SpectatorState state)
|
||||||
{
|
{
|
||||||
if (!playingUsers.Contains(userId))
|
if (!playingUsers.Contains(userId))
|
||||||
|
@ -176,6 +176,7 @@ namespace osu.Game.Overlays.Volume
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Bindable.ValueChanged += volume =>
|
Bindable.ValueChanged += volume =>
|
||||||
{
|
{
|
||||||
this.TransformTo("DisplayVolume",
|
this.TransformTo("DisplayVolume",
|
||||||
@ -183,6 +184,7 @@ namespace osu.Game.Overlays.Volume
|
|||||||
400,
|
400,
|
||||||
Easing.OutQuint);
|
Easing.OutQuint);
|
||||||
};
|
};
|
||||||
|
|
||||||
bgProgress.Current.Value = 0.75f;
|
bgProgress.Current.Value = 0.75f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,15 +68,19 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
this.FadeOut(transition_length, Easing.OutExpo);
|
if (IsLoaded)
|
||||||
this.MoveToX(x_movement_amount, transition_length, Easing.OutExpo);
|
{
|
||||||
|
this.FadeOut(transition_length, Easing.OutExpo);
|
||||||
|
this.MoveToX(x_movement_amount, transition_length, Easing.OutExpo);
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
this.MoveToX(0, transition_length, Easing.OutExpo);
|
if (IsLoaded)
|
||||||
|
this.MoveToX(0, transition_length, Easing.OutExpo);
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user