mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'master' into fix-spectator-seeks
This commit is contained in:
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
bool loadThemedIntro()
|
||||
{
|
||||
var setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
|
||||
var setInfo = beatmaps.QueryBeatmapSet(b => b.Protected && b.Hash == BeatmapHash);
|
||||
|
||||
if (setInfo == null)
|
||||
return false;
|
||||
|
@ -418,10 +418,16 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
var retrievedBeatmap = task.GetResultSafely();
|
||||
|
||||
statusText.Text = "Currently playing ";
|
||||
beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(),
|
||||
LinkAction.OpenBeatmap,
|
||||
retrievedBeatmap.OnlineID.ToString(),
|
||||
creationParameters: s => s.Truncate = true);
|
||||
|
||||
if (retrievedBeatmap != null)
|
||||
{
|
||||
beatmapText.AddLink(retrievedBeatmap.GetDisplayTitleRomanisable(),
|
||||
LinkAction.OpenBeatmap,
|
||||
retrievedBeatmap.OnlineID.ToString(),
|
||||
creationParameters: s => s.Truncate = true);
|
||||
}
|
||||
else
|
||||
beatmapText.AddText("unknown beatmap");
|
||||
}), cancellationSource.Token);
|
||||
}
|
||||
}
|
||||
|
@ -114,18 +114,17 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
|
||||
bool isReady() => Client.LocalUser?.State == MultiplayerUserState.Ready || Client.LocalUser?.State == MultiplayerUserState.Spectating;
|
||||
|
||||
void toggleReady() => Client.ToggleReady().ContinueWith(_ => endOperation());
|
||||
void toggleReady() => Client.ToggleReady().FireAndForget(
|
||||
onSuccess: endOperation,
|
||||
onError: _ => endOperation());
|
||||
|
||||
void startMatch() => Client.StartMatch().ContinueWith(t =>
|
||||
void startMatch() => Client.StartMatch().FireAndForget(onSuccess: () =>
|
||||
{
|
||||
// accessing Exception here silences any potential errors from the antecedent task
|
||||
if (t.Exception != null)
|
||||
{
|
||||
// gameplay was not started due to an exception; unblock button.
|
||||
endOperation();
|
||||
}
|
||||
|
||||
// gameplay is starting, the button will be unblocked on load requested.
|
||||
}, onError: _ =>
|
||||
{
|
||||
// gameplay was not started due to an exception; unblock button.
|
||||
endOperation();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -30,13 +30,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
private MultiplayerRoom room => multiplayerClient.Room;
|
||||
|
||||
private Sample countdownTickSample;
|
||||
private Sample countdownWarnSample;
|
||||
private Sample countdownWarnFinalSample;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
countdownTickSample = audio.Samples.Get(@"Multiplayer/countdown-tick");
|
||||
// disabled for now pending further work on sound effect
|
||||
// countdownTickFinalSample = audio.Samples.Get(@"Multiplayer/countdown-tick-final");
|
||||
countdownWarnSample = audio.Samples.Get(@"Multiplayer/countdown-warn");
|
||||
countdownWarnFinalSample = audio.Samples.Get(@"Multiplayer/countdown-warn-final");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -102,8 +104,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
private void playTickSound(int secondsRemaining)
|
||||
{
|
||||
if (secondsRemaining < 10) countdownTickSample?.Play();
|
||||
// disabled for now pending further work on sound effect
|
||||
// if (secondsRemaining <= 3) countdownTickFinalSample?.Play();
|
||||
|
||||
if (secondsRemaining <= 3)
|
||||
{
|
||||
if (secondsRemaining > 0)
|
||||
countdownWarnSample?.Play();
|
||||
else
|
||||
countdownWarnFinalSample?.Play();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateButtonText()
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match.Playlist
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
RequestDeletion = item => multiplayerClient.RemovePlaylistItem(item.ID);
|
||||
RequestDeletion = item => multiplayerClient.RemovePlaylistItem(item.ID).FireAndForget();
|
||||
|
||||
multiplayerClient.RoomUpdated += onRoomUpdated;
|
||||
onRoomUpdated();
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
// If gameplay wasn't finished, then we have a simple path back to the idle state by aborting gameplay.
|
||||
if (!playerLoader.GameplayPassed)
|
||||
{
|
||||
client.AbortGameplay();
|
||||
client.AbortGameplay().FireAndForget();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,9 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -76,40 +72,18 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
Task task = itemToEdit != null ? client.EditPlaylistItem(multiplayerItem) : client.AddPlaylistItem(multiplayerItem);
|
||||
|
||||
task.ContinueWith(t =>
|
||||
task.FireAndForget(onSuccess: () => Schedule(() =>
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
// If an error or server side trigger occurred this screen may have already exited by external means.
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
loadingLayer.Hide();
|
||||
|
||||
if (t.IsFaulted)
|
||||
{
|
||||
Exception exception = t.Exception;
|
||||
|
||||
if (exception is AggregateException ae)
|
||||
exception = ae.InnerException;
|
||||
|
||||
Debug.Assert(exception != null);
|
||||
|
||||
string message = exception is HubException
|
||||
// HubExceptions arrive with additional message context added, but we want to display the human readable message:
|
||||
// "An unexpected error occurred invoking 'AddPlaylistItem' on the server.InvalidStateException: Can't enqueue more than 3 items at once."
|
||||
// We generally use the message field for a user-parseable error (eventually to be replaced), so drop the first part for now.
|
||||
? exception.Message.Substring(exception.Message.IndexOf(':') + 1).Trim()
|
||||
: exception.Message;
|
||||
|
||||
Logger.Log(message, level: LogLevel.Important);
|
||||
Carousel.AllowSelection = true;
|
||||
return;
|
||||
}
|
||||
loadingLayer.Hide();
|
||||
|
||||
// If an error or server side trigger occurred this screen may have already exited by external means.
|
||||
if (this.IsCurrentScreen())
|
||||
this.Exit();
|
||||
});
|
||||
});
|
||||
}), onError: _ => Schedule(() =>
|
||||
{
|
||||
loadingLayer.Hide();
|
||||
Carousel.AllowSelection = true;
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
if (client.Room == null)
|
||||
return;
|
||||
|
||||
client.ChangeUserMods(mods.NewValue);
|
||||
client.ChangeUserMods(mods.NewValue).FireAndForget();
|
||||
|
||||
modSettingChangeTracker = new ModSettingChangeTracker(mods.NewValue);
|
||||
modSettingChangeTracker.SettingChanged += onModSettingsChanged;
|
||||
@ -296,7 +296,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
if (client.Room == null)
|
||||
return;
|
||||
|
||||
client.ChangeUserMods(UserMods.Value);
|
||||
client.ChangeUserMods(UserMods.Value).FireAndForget();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
if (client.Room == null)
|
||||
return;
|
||||
|
||||
client.ChangeBeatmapAvailability(availability.NewValue);
|
||||
client.ChangeBeatmapAvailability(availability.NewValue).FireAndForget();
|
||||
|
||||
if (availability.NewValue.State != DownloadState.LocallyAvailable)
|
||||
{
|
||||
|
@ -133,6 +133,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
failAndBail();
|
||||
}
|
||||
}), true);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Debug.Assert(client.Room != null);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0,
|
||||
Margin = new MarginPadding(4),
|
||||
Action = () => Client.KickUser(User.UserID),
|
||||
Action = () => Client.KickUser(User.UserID).FireAndForget(),
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -231,7 +231,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
if (!Client.IsHost)
|
||||
return;
|
||||
|
||||
Client.TransferHost(targetUser);
|
||||
Client.TransferHost(targetUser).FireAndForget();
|
||||
}),
|
||||
new OsuMenuItem("Kick", MenuItemType.Destructive, () =>
|
||||
{
|
||||
@ -239,7 +239,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
if (!Client.IsHost)
|
||||
return;
|
||||
|
||||
Client.KickUser(targetUser);
|
||||
Client.KickUser(targetUser).FireAndForget();
|
||||
})
|
||||
};
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
Client.SendMatchRequest(new ChangeTeamRequest
|
||||
{
|
||||
TeamID = ((Client.LocalUser?.MatchState as TeamVersusUserState)?.TeamID + 1) % 2 ?? 0,
|
||||
});
|
||||
}).FireAndForget();
|
||||
}
|
||||
|
||||
public int? DisplayedTeam { get; private set; }
|
||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
@ -80,13 +79,16 @@ namespace osu.Game.Screens.Play.HUD
|
||||
difficultyCache.GetTimedDifficultyAttributesAsync(gameplayWorkingBeatmap, gameplayState.Ruleset, clonedMods, loadCancellationSource.Token)
|
||||
.ContinueWith(task => Schedule(() =>
|
||||
{
|
||||
if (task.Exception != null)
|
||||
return;
|
||||
|
||||
timedAttributes = task.GetResultSafely();
|
||||
|
||||
IsValid = true;
|
||||
|
||||
if (lastJudgement != null)
|
||||
onJudgementChanged(lastJudgement);
|
||||
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,31 +87,33 @@ namespace osu.Game.Screens.Ranking
|
||||
});
|
||||
}
|
||||
|
||||
button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
|
||||
updateTooltip();
|
||||
updateState();
|
||||
}, true);
|
||||
|
||||
State.BindValueChanged(state =>
|
||||
{
|
||||
button.State.Value = state.NewValue;
|
||||
updateTooltip();
|
||||
updateState();
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void updateTooltip()
|
||||
private void updateState()
|
||||
{
|
||||
switch (replayAvailability)
|
||||
{
|
||||
case ReplayAvailability.Local:
|
||||
button.TooltipText = @"watch replay";
|
||||
button.Enabled.Value = true;
|
||||
break;
|
||||
|
||||
case ReplayAvailability.Online:
|
||||
button.TooltipText = @"download replay";
|
||||
button.Enabled.Value = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
button.TooltipText = @"replay unavailable";
|
||||
button.Enabled.Value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user