mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix ongoing operation being begun in an async context
This commit is contained in:
@ -66,10 +66,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(200, 50),
|
Size = new Vector2(200, 50),
|
||||||
OnReadyClick = () => Task.Run(async () =>
|
OnReadyClick = () =>
|
||||||
{
|
{
|
||||||
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
if (Client.IsHost && Client.LocalUser?.State == MultiplayerUserState.Ready)
|
if (Client.IsHost && Client.LocalUser?.State == MultiplayerUserState.Ready)
|
||||||
{
|
{
|
||||||
await Client.StartMatch();
|
await Client.StartMatch();
|
||||||
@ -77,8 +79,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
await Client.ToggleReady();
|
await Client.ToggleReady();
|
||||||
|
|
||||||
readyClickOperation.Dispose();
|
readyClickOperation.Dispose();
|
||||||
})
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -70,22 +70,28 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(200, 50),
|
Size = new Vector2(200, 50),
|
||||||
OnSpectateClick = () => Task.Run(async () =>
|
OnSpectateClick = () =>
|
||||||
{
|
{
|
||||||
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
await Client.ToggleSpectate();
|
await Client.ToggleSpectate();
|
||||||
readyClickOperation.Dispose();
|
readyClickOperation.Dispose();
|
||||||
})
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
readyButton = new MultiplayerReadyButton
|
readyButton = new MultiplayerReadyButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(200, 50),
|
Size = new Vector2(200, 50),
|
||||||
OnReadyClick = () => Task.Run(async () =>
|
OnReadyClick = () =>
|
||||||
{
|
{
|
||||||
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
readyClickOperation = OngoingOperationTracker.BeginOperation();
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
if (Client.IsHost && Client.LocalUser?.State == MultiplayerUserState.Ready)
|
if (Client.IsHost && Client.LocalUser?.State == MultiplayerUserState.Ready)
|
||||||
{
|
{
|
||||||
await Client.StartMatch();
|
await Client.StartMatch();
|
||||||
@ -93,8 +99,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
await Client.ToggleReady();
|
await Client.ToggleReady();
|
||||||
|
|
||||||
readyClickOperation.Dispose();
|
readyClickOperation.Dispose();
|
||||||
})
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user