mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 09:42:54 +08:00
Merge branch 'ppy:master' into stat_acc_no_lazer
This commit is contained in:
commit
b8b8607085
@ -268,11 +268,14 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
ApplyMaxResult();
|
||||
else
|
||||
MissForcefully();
|
||||
}
|
||||
|
||||
// Make sure that the hold note is fully judged by giving the body a judgement.
|
||||
if (Tail.AllJudged && !Body.AllJudged)
|
||||
Body.TriggerResult(Tail.IsHit);
|
||||
// Make sure that the hold note is fully judged by giving the body a judgement.
|
||||
if (!Body.AllJudged)
|
||||
Body.TriggerResult(Tail.IsHit);
|
||||
|
||||
// Important that this is always called when a result is applied.
|
||||
endHold();
|
||||
}
|
||||
}
|
||||
|
||||
public override void MissForcefully()
|
||||
|
@ -99,6 +99,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
Scheduler.AddDelayed(applyMiss, 500 + 30);
|
||||
});
|
||||
AddUntilStep("wait for sequence", () => !Scheduler.HasPendingTasks);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -120,6 +121,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
}
|
||||
}
|
||||
});
|
||||
AddUntilStep("wait for sequence", () => !Scheduler.HasPendingTasks);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -122,8 +122,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Anchor = Anchor.Centre,
|
||||
}
|
||||
};
|
||||
|
||||
Padding = new MarginPadding { Left = 5, Right = 5 };
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -164,6 +164,8 @@ namespace osu.Game.Online.API
|
||||
|
||||
public string AccessToken => authentication.RequestAccessToken();
|
||||
|
||||
public Guid SessionIdentifier { get; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Number of consecutive requests which failed due to network issues.
|
||||
/// </summary>
|
||||
|
@ -39,6 +39,8 @@ namespace osu.Game.Online.API
|
||||
|
||||
public string AccessToken => "token";
|
||||
|
||||
public Guid SessionIdentifier { get; } = Guid.NewGuid();
|
||||
|
||||
/// <seealso cref="APIAccess.IsLoggedIn"/>
|
||||
public bool IsLoggedIn => State.Value > APIState.Offline;
|
||||
|
||||
|
@ -44,6 +44,12 @@ namespace osu.Game.Online.API
|
||||
/// </summary>
|
||||
string AccessToken { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Used as an identifier of a single local lazer session.
|
||||
/// Sent across the wire for the purposes of concurrency control to spectator server.
|
||||
/// </summary>
|
||||
Guid SessionIdentifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether the local user is logged in.
|
||||
/// </summary>
|
||||
|
@ -19,6 +19,9 @@ namespace osu.Game.Online
|
||||
{
|
||||
public const string SERVER_SHUTDOWN_MESSAGE = "Server is shutting down.";
|
||||
|
||||
public const string VERSION_HASH_HEADER = @"X-Osu-Version-Hash";
|
||||
public const string CLIENT_SESSION_ID_HEADER = @"X-Client-Session-ID";
|
||||
|
||||
/// <summary>
|
||||
/// Invoked whenever a new hub connection is built, to configure it before it's started.
|
||||
/// </summary>
|
||||
@ -68,8 +71,11 @@ namespace osu.Game.Online
|
||||
options.Proxy.Credentials = CredentialCache.DefaultCredentials;
|
||||
}
|
||||
|
||||
options.Headers.Add("Authorization", $"Bearer {API.AccessToken}");
|
||||
options.Headers.Add("OsuVersionHash", versionHash);
|
||||
options.Headers.Add(@"Authorization", @$"Bearer {API.AccessToken}");
|
||||
// non-standard header name kept for backwards compatibility, can be removed after server side has migrated to `VERSION_HASH_HEADER`
|
||||
options.Headers.Add(@"OsuVersionHash", versionHash);
|
||||
options.Headers.Add(VERSION_HASH_HEADER, versionHash);
|
||||
options.Headers.Add(CLIENT_SESSION_ID_HEADER, API.SessionIdentifier.ToString());
|
||||
});
|
||||
|
||||
if (RuntimeFeature.IsDynamicCodeCompiled && preferMessagePack)
|
||||
|
@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Music
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
beatmapSubscription = realm.RegisterForNotifications(r => r.All<BeatmapSetInfo>().Where(s => !s.DeletePending), beatmapsChanged);
|
||||
beatmapSubscription = realm.RegisterForNotifications(r => r.All<BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected), beatmapsChanged);
|
||||
|
||||
list.Items.BindTo(beatmapSets);
|
||||
beatmap.BindValueChanged(working => list.SelectedSet.Value = working.NewValue.BeatmapSetInfo.ToLive(realm), true);
|
||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Overlays
|
||||
return;
|
||||
|
||||
Logger.Log($"{nameof(MusicController)} skipping next track to {nameof(EnsurePlayingSomething)}");
|
||||
NextTrack();
|
||||
NextTrack(allowProtectedTracks: true);
|
||||
}
|
||||
else if (!IsPlaying)
|
||||
{
|
||||
@ -207,9 +207,10 @@ namespace osu.Game.Overlays
|
||||
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
|
||||
/// </summary>
|
||||
/// <param name="onSuccess">Invoked when the operation has been performed successfully.</param>
|
||||
public void PreviousTrack(Action<PreviousTrackResult>? onSuccess = null) => Schedule(() =>
|
||||
/// <param name="allowProtectedTracks">Whether to include <see cref="BeatmapSetInfo.Protected"/> beatmap sets when navigating.</param>
|
||||
public void PreviousTrack(Action<PreviousTrackResult>? onSuccess = null, bool allowProtectedTracks = false) => Schedule(() =>
|
||||
{
|
||||
PreviousTrackResult res = prev();
|
||||
PreviousTrackResult res = prev(allowProtectedTracks);
|
||||
if (res != PreviousTrackResult.None)
|
||||
onSuccess?.Invoke(res);
|
||||
});
|
||||
@ -217,8 +218,9 @@ namespace osu.Game.Overlays
|
||||
/// <summary>
|
||||
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
|
||||
/// </summary>
|
||||
/// <param name="allowProtectedTracks">Whether to include <see cref="BeatmapSetInfo.Protected"/> beatmap sets when navigating.</param>
|
||||
/// <returns>The <see cref="PreviousTrackResult"/> that indicate the decided action.</returns>
|
||||
private PreviousTrackResult prev()
|
||||
private PreviousTrackResult prev(bool allowProtectedTracks)
|
||||
{
|
||||
if (beatmap.Disabled || !AllowTrackControl.Value)
|
||||
return PreviousTrackResult.None;
|
||||
@ -233,8 +235,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
queuedDirection = TrackChangeDirection.Prev;
|
||||
|
||||
var playableSet = getBeatmapSets().AsEnumerable().TakeWhile(i => !i.Equals(current?.BeatmapSetInfo)).LastOrDefault()
|
||||
?? getBeatmapSets().LastOrDefault();
|
||||
var playableSet = getBeatmapSets().AsEnumerable().TakeWhile(i => !i.Equals(current?.BeatmapSetInfo)).LastOrDefault(s => !s.Protected || allowProtectedTracks)
|
||||
?? getBeatmapSets().AsEnumerable().LastOrDefault(s => !s.Protected || allowProtectedTracks);
|
||||
|
||||
if (playableSet != null)
|
||||
{
|
||||
@ -250,10 +252,11 @@ namespace osu.Game.Overlays
|
||||
/// Play the next random or playlist track.
|
||||
/// </summary>
|
||||
/// <param name="onSuccess">Invoked when the operation has been performed successfully.</param>
|
||||
/// <param name="allowProtectedTracks">Whether to include <see cref="BeatmapSetInfo.Protected"/> beatmap sets when navigating.</param>
|
||||
/// <returns>A <see cref="ScheduledDelegate"/> of the operation.</returns>
|
||||
public void NextTrack(Action? onSuccess = null) => Schedule(() =>
|
||||
public void NextTrack(Action? onSuccess = null, bool allowProtectedTracks = false) => Schedule(() =>
|
||||
{
|
||||
bool res = next();
|
||||
bool res = next(allowProtectedTracks);
|
||||
if (res)
|
||||
onSuccess?.Invoke();
|
||||
});
|
||||
@ -306,15 +309,15 @@ namespace osu.Game.Overlays
|
||||
Scheduler.AddDelayed(() => duckOperation.Dispose(), delayUntilRestore);
|
||||
}
|
||||
|
||||
private bool next()
|
||||
private bool next(bool allowProtectedTracks)
|
||||
{
|
||||
if (beatmap.Disabled || !AllowTrackControl.Value)
|
||||
return false;
|
||||
|
||||
queuedDirection = TrackChangeDirection.Next;
|
||||
|
||||
var playableSet = getBeatmapSets().AsEnumerable().SkipWhile(i => !i.Equals(current?.BeatmapSetInfo)).ElementAtOrDefault(1)
|
||||
?? getBeatmapSets().FirstOrDefault();
|
||||
var playableSet = getBeatmapSets().AsEnumerable().SkipWhile(i => !i.Equals(current?.BeatmapSetInfo) && (!i.Protected || allowProtectedTracks)).ElementAtOrDefault(1)
|
||||
?? getBeatmapSets().AsEnumerable().FirstOrDefault(i => !i.Protected || allowProtectedTracks);
|
||||
|
||||
var playableBeatmap = playableSet?.Beatmaps.FirstOrDefault();
|
||||
|
||||
@ -432,7 +435,7 @@ namespace osu.Game.Overlays
|
||||
private void onTrackCompleted()
|
||||
{
|
||||
if (!CurrentTrack.Looping && !beatmap.Disabled && AllowTrackControl.Value)
|
||||
NextTrack();
|
||||
NextTrack(allowProtectedTracks: true);
|
||||
}
|
||||
|
||||
private bool applyModTrackAdjustments;
|
||||
|
@ -505,6 +505,13 @@ namespace osu.Game.Screens.Select
|
||||
var beatmap = e?.NewValue ?? Beatmap.Value;
|
||||
if (beatmap is DummyWorkingBeatmap || !this.IsCurrentScreen()) return;
|
||||
|
||||
if (beatmap.BeatmapSetInfo.Protected && e != null)
|
||||
{
|
||||
Logger.Log($"Denying working beatmap switch to protected beatmap {beatmap}");
|
||||
Beatmap.Value = e.OldValue;
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.Log($"Song select working beatmap updated to {beatmap}");
|
||||
|
||||
if (!Carousel.SelectBeatmap(beatmap.BeatmapInfo, false))
|
||||
|
@ -100,14 +100,15 @@ namespace osu.Game.Storyboards.Drawables
|
||||
skinSourceChanged();
|
||||
}
|
||||
else
|
||||
Texture = textureStore.Get(Sprite.Path);
|
||||
Texture = textureStore.Get(Sprite.Path, WrapMode.ClampToEdge, WrapMode.ClampToEdge);
|
||||
|
||||
Sprite.ApplyTransforms(this);
|
||||
}
|
||||
|
||||
private void skinSourceChanged()
|
||||
{
|
||||
Texture = skin.GetTexture(Sprite.Path) ?? textureStore.Get(Sprite.Path);
|
||||
Texture = skin.GetTexture(Sprite.Path, WrapMode.ClampToEdge, WrapMode.ClampToEdge) ??
|
||||
textureStore.Get(Sprite.Path, WrapMode.ClampToEdge, WrapMode.ClampToEdge);
|
||||
|
||||
// Setting texture will only update the size if it's zero.
|
||||
// So let's force an explicit update.
|
||||
|
Loading…
Reference in New Issue
Block a user