mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 01:17:35 +09:00
Merge branch 'master' into fix-mod-buttons-not-copying-settings
This commit is contained in:
commit
d110ed9e95
@ -3,18 +3,13 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Screens.OnlinePlay;
|
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
{
|
{
|
||||||
public class TestSceneCreateMultiplayerMatchButton : MultiplayerTestScene
|
public class TestSceneCreateMultiplayerMatchButton : MultiplayerTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
|
||||||
private OngoingOperationTracker ongoingOperationTracker = new OngoingOperationTracker();
|
|
||||||
|
|
||||||
private CreateMultiplayerMatchButton button;
|
private CreateMultiplayerMatchButton button;
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
@ -36,7 +31,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
assertButtonEnableState(true);
|
assertButtonEnableState(true);
|
||||||
|
|
||||||
AddStep("begin joining room", () => joiningRoomOperation = ongoingOperationTracker.BeginOperation());
|
AddStep("begin joining room", () => joiningRoomOperation = OngoingOperationTracker.BeginOperation());
|
||||||
assertButtonEnableState(false);
|
assertButtonEnableState(false);
|
||||||
|
|
||||||
AddStep("end joining room", () => joiningRoomOperation.Dispose());
|
AddStep("end joining room", () => joiningRoomOperation.Dispose());
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay
|
namespace osu.Game.Screens.OnlinePlay
|
||||||
{
|
{
|
||||||
@ -11,7 +12,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
/// Utility class to track ongoing online operations' progress.
|
/// Utility class to track ongoing online operations' progress.
|
||||||
/// Can be used to disable interactivity while waiting for a response from online sources.
|
/// Can be used to disable interactivity while waiting for a response from online sources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OngoingOperationTracker
|
public class OngoingOperationTracker : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether there is an online operation in progress.
|
/// Whether there is an online operation in progress.
|
||||||
@ -22,6 +23,11 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
private LeasedBindable<bool> leasedInProgress;
|
private LeasedBindable<bool> leasedInProgress;
|
||||||
|
|
||||||
|
public OngoingOperationTracker()
|
||||||
|
{
|
||||||
|
AlwaysPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Begins tracking a new online operation.
|
/// Begins tracking a new online operation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,7 +43,8 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
leasedInProgress = inProgress.BeginLease(true);
|
leasedInProgress = inProgress.BeginLease(true);
|
||||||
leasedInProgress.Value = true;
|
leasedInProgress.Value = true;
|
||||||
|
|
||||||
return new InvokeOnDisposal(endOperation);
|
// for extra safety, marshal the end of operation back to the update thread if necessary.
|
||||||
|
return new InvokeOnDisposal(() => Scheduler.Add(endOperation, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void endOperation()
|
private void endOperation()
|
||||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>(new FilterCriteria());
|
private readonly Bindable<FilterCriteria> currentFilter = new Bindable<FilterCriteria>(new FilterCriteria());
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private readonly OngoingOperationTracker ongoingOperationTracker = new OngoingOperationTracker();
|
private OngoingOperationTracker ongoingOperationTracker { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private MusicController music { get; set; }
|
private MusicController music { get; set; }
|
||||||
@ -144,7 +144,8 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
};
|
};
|
||||||
button.Action = () => OpenNewRoom();
|
button.Action = () => OpenNewRoom();
|
||||||
}),
|
}),
|
||||||
RoomManager = CreateRoomManager()
|
RoomManager = CreateRoomManager(),
|
||||||
|
ongoingOperationTracker = new OngoingOperationTracker()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
public Bindable<FilterCriteria> Filter { get; }
|
public Bindable<FilterCriteria> Filter { get; }
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
public OngoingOperationTracker OngoingOperationTracker { get; } = new OngoingOperationTracker();
|
public OngoingOperationTracker OngoingOperationTracker { get; }
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly TestMultiplayerRoomContainer content;
|
private readonly TestMultiplayerRoomContainer content;
|
||||||
@ -39,6 +39,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Client = content.Client;
|
Client = content.Client;
|
||||||
RoomManager = content.RoomManager;
|
RoomManager = content.RoomManager;
|
||||||
Filter = content.Filter;
|
Filter = content.Filter;
|
||||||
|
OngoingOperationTracker = content.OngoingOperationTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
|
@ -25,6 +25,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
[Cached]
|
[Cached]
|
||||||
public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>(new FilterCriteria());
|
public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>(new FilterCriteria());
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
public readonly OngoingOperationTracker OngoingOperationTracker;
|
||||||
|
|
||||||
public TestMultiplayerRoomContainer()
|
public TestMultiplayerRoomContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -33,6 +36,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
Client = new TestMultiplayerClient(),
|
Client = new TestMultiplayerClient(),
|
||||||
RoomManager = new TestMultiplayerRoomManager(),
|
RoomManager = new TestMultiplayerRoomManager(),
|
||||||
|
OngoingOperationTracker = new OngoingOperationTracker(),
|
||||||
content = new Container { RelativeSizeAxes = Axes.Both }
|
content = new Container { RelativeSizeAxes = Axes.Both }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user