mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 10:23:03 +08:00
Merge branch 'master' into verify-abnormal-difficulty-settings
This commit is contained in:
commit
b74f8dba41
@ -75,7 +75,7 @@ namespace osu.Desktop
|
|||||||
};
|
};
|
||||||
|
|
||||||
client.OnReady += onReady;
|
client.OnReady += onReady;
|
||||||
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Code} {e.Message}", LoggingTarget.Network, LogLevel.Error);
|
client.OnError += (_, e) => Logger.Log($"An error occurred with Discord RPC Client: {e.Message} ({e.Code})", LoggingTarget.Network, LogLevel.Error);
|
||||||
|
|
||||||
// A URI scheme is required to support game invitations, as well as informing Discord of the game executable path to support launching the game when a user clicks on join/spectate.
|
// A URI scheme is required to support game invitations, as well as informing Discord of the game executable path to support launching the game when a user clicks on join/spectate.
|
||||||
client.RegisterUriScheme();
|
client.RegisterUriScheme();
|
||||||
@ -94,10 +94,10 @@ namespace osu.Desktop
|
|||||||
activity.BindTo(u.NewValue.Activity);
|
activity.BindTo(u.NewValue.Activity);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
ruleset.BindValueChanged(_ => updatePresence());
|
ruleset.BindValueChanged(_ => schedulePresenceUpdate());
|
||||||
status.BindValueChanged(_ => updatePresence());
|
status.BindValueChanged(_ => schedulePresenceUpdate());
|
||||||
activity.BindValueChanged(_ => updatePresence());
|
activity.BindValueChanged(_ => schedulePresenceUpdate());
|
||||||
privacyMode.BindValueChanged(_ => updatePresence());
|
privacyMode.BindValueChanged(_ => schedulePresenceUpdate());
|
||||||
multiplayerClient.RoomUpdated += onRoomUpdated;
|
multiplayerClient.RoomUpdated += onRoomUpdated;
|
||||||
|
|
||||||
client.Initialize();
|
client.Initialize();
|
||||||
@ -111,14 +111,14 @@ namespace osu.Desktop
|
|||||||
if (client.CurrentPresence != null)
|
if (client.CurrentPresence != null)
|
||||||
client.SetPresence(null);
|
client.SetPresence(null);
|
||||||
|
|
||||||
updatePresence();
|
schedulePresenceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRoomUpdated() => updatePresence();
|
private void onRoomUpdated() => schedulePresenceUpdate();
|
||||||
|
|
||||||
private ScheduledDelegate? presenceUpdateDelegate;
|
private ScheduledDelegate? presenceUpdateDelegate;
|
||||||
|
|
||||||
private void updatePresence()
|
private void schedulePresenceUpdate()
|
||||||
{
|
{
|
||||||
presenceUpdateDelegate?.Cancel();
|
presenceUpdateDelegate?.Cancel();
|
||||||
presenceUpdateDelegate = Scheduler.AddDelayed(() =>
|
presenceUpdateDelegate = Scheduler.AddDelayed(() =>
|
||||||
@ -134,16 +134,14 @@ namespace osu.Desktop
|
|||||||
|
|
||||||
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited || status.Value == UserStatus.DoNotDisturb;
|
bool hideIdentifiableInformation = privacyMode.Value == DiscordRichPresenceMode.Limited || status.Value == UserStatus.DoNotDisturb;
|
||||||
|
|
||||||
updatePresenceStatus(hideIdentifiableInformation);
|
updatePresence(hideIdentifiableInformation);
|
||||||
updatePresenceParty(hideIdentifiableInformation);
|
|
||||||
updatePresenceAssets();
|
|
||||||
|
|
||||||
client.SetPresence(presence);
|
client.SetPresence(presence);
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePresenceStatus(bool hideIdentifiableInformation)
|
private void updatePresence(bool hideIdentifiableInformation)
|
||||||
{
|
{
|
||||||
|
// user activity
|
||||||
if (activity.Value != null)
|
if (activity.Value != null)
|
||||||
{
|
{
|
||||||
presence.State = truncate(activity.Value.GetStatus(hideIdentifiableInformation));
|
presence.State = truncate(activity.Value.GetStatus(hideIdentifiableInformation));
|
||||||
@ -170,10 +168,8 @@ namespace osu.Desktop
|
|||||||
presence.State = "Idle";
|
presence.State = "Idle";
|
||||||
presence.Details = string.Empty;
|
presence.Details = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePresenceParty(bool hideIdentifiableInformation)
|
// user party
|
||||||
{
|
|
||||||
if (!hideIdentifiableInformation && multiplayerClient.Room != null)
|
if (!hideIdentifiableInformation && multiplayerClient.Room != null)
|
||||||
{
|
{
|
||||||
MultiplayerRoom room = multiplayerClient.Room;
|
MultiplayerRoom room = multiplayerClient.Room;
|
||||||
@ -195,17 +191,18 @@ namespace osu.Desktop
|
|||||||
};
|
};
|
||||||
|
|
||||||
presence.Secrets.JoinSecret = JsonConvert.SerializeObject(roomSecret);
|
presence.Secrets.JoinSecret = JsonConvert.SerializeObject(roomSecret);
|
||||||
|
// discord cannot handle both secrets and buttons at the same time, so we need to choose something.
|
||||||
|
// the multiplayer room seems more important.
|
||||||
|
presence.Buttons = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
presence.Party = null;
|
presence.Party = null;
|
||||||
presence.Secrets.JoinSecret = null;
|
presence.Secrets.JoinSecret = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePresenceAssets()
|
// game images:
|
||||||
{
|
// large image tooltip
|
||||||
// update user information
|
|
||||||
if (privacyMode.Value == DiscordRichPresenceMode.Limited)
|
if (privacyMode.Value == DiscordRichPresenceMode.Limited)
|
||||||
presence.Assets.LargeImageText = string.Empty;
|
presence.Assets.LargeImageText = string.Empty;
|
||||||
else
|
else
|
||||||
@ -216,7 +213,7 @@ namespace osu.Desktop
|
|||||||
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
|
presence.Assets.LargeImageText = $"{user.Value.Username}" + (user.Value.Statistics?.GlobalRank > 0 ? $" (rank #{user.Value.Statistics.GlobalRank:N0})" : string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update ruleset
|
// small image
|
||||||
presence.Assets.SmallImageKey = ruleset.Value.IsLegacyRuleset() ? $"mode_{ruleset.Value.OnlineID}" : "mode_custom";
|
presence.Assets.SmallImageKey = ruleset.Value.IsLegacyRuleset() ? $"mode_{ruleset.Value.OnlineID}" : "mode_custom";
|
||||||
presence.Assets.SmallImageText = ruleset.Value.Name;
|
presence.Assets.SmallImageText = ruleset.Value.Name;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
[new Droplet(), 0.01, true],
|
[new Droplet(), 0.01, true],
|
||||||
[new TinyDroplet(), 0, false],
|
[new TinyDroplet(), 0, false],
|
||||||
[new Banana(), 0, false],
|
[new Banana(), 0, false],
|
||||||
|
[new BananaShower(), 0, false]
|
||||||
];
|
];
|
||||||
|
|
||||||
[TestCaseSource(nameof(test_cases))]
|
[TestCaseSource(nameof(test_cases))]
|
||||||
|
@ -32,6 +32,10 @@ namespace osu.Game.Rulesets.Catch.Scoring
|
|||||||
if (result.Type == HitResult.SmallTickMiss)
|
if (result.Type == HitResult.SmallTickMiss)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// on stable, banana showers don't exist as concrete objects themselves, so they can't cause a fail.
|
||||||
|
if (result.HitObject is BananaShower)
|
||||||
|
return false;
|
||||||
|
|
||||||
return base.CheckDefaultFailCondition(result);
|
return base.CheckDefaultFailCondition(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
@ -52,5 +54,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
protected override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
protected override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
public override DrawableHitObject<CatchHitObject>? CreateDrawableRepresentation(CatchHitObject h) => null;
|
public override DrawableHitObject<CatchHitObject>? CreateDrawableRepresentation(CatchHitObject h) => null;
|
||||||
|
|
||||||
|
protected override ResumeOverlay CreateResumeOverlay() => new DelayedResumeOverlay { Scale = new Vector2(0.65f) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
@ -164,6 +165,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
protected override ReplayRecorder CreateReplayRecorder(Score score) => new ManiaReplayRecorder(score);
|
protected override ReplayRecorder CreateReplayRecorder(Score score) => new ManiaReplayRecorder(score);
|
||||||
|
|
||||||
|
protected override ResumeOverlay CreateResumeOverlay() => new DelayedResumeOverlay();
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
@ -6,11 +6,11 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Gameplay;
|
using osu.Game.Tests.Gameplay;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
public partial class TestSceneResumeOverlay : OsuManualInputManagerTestScene
|
public partial class TestSceneResumeOverlay : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private ManualOsuInputManager osuInputManager = null!;
|
private ManualOsuInputManager osuInputManager = null!;
|
||||||
private CursorContainer cursor = null!;
|
private GameplayCursorContainer cursor = null!;
|
||||||
private ResumeOverlay resume = null!;
|
private ResumeOverlay resume = null!;
|
||||||
|
|
||||||
private bool resumeFired;
|
private bool resumeFired;
|
||||||
@ -99,7 +99,17 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private void loadContent()
|
private void loadContent()
|
||||||
{
|
{
|
||||||
Child = osuInputManager = new ManualOsuInputManager(new OsuRuleset().RulesetInfo) { Children = new Drawable[] { cursor = new CursorContainer(), resume = new OsuResumeOverlay { GameplayCursor = cursor }, } };
|
Child = osuInputManager = new ManualOsuInputManager(new OsuRuleset().RulesetInfo)
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
cursor = new GameplayCursorContainer(),
|
||||||
|
resume = new OsuResumeOverlay
|
||||||
|
{
|
||||||
|
GameplayCursor = cursor
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
resumeFired = false;
|
resumeFired = false;
|
||||||
resume.ResumeAction = () => resumeFired = true;
|
resume.ResumeAction = () => resumeFired = true;
|
||||||
|
@ -39,6 +39,13 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
|
// Can't display if the cursor is outside the window.
|
||||||
|
if (GameplayCursor.LastFrameState == Visibility.Hidden || !Contains(GameplayCursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))
|
||||||
|
{
|
||||||
|
Resume();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
base.PopIn();
|
base.PopIn();
|
||||||
|
|
||||||
GameplayCursor.ActiveCursor.Hide();
|
GameplayCursor.ActiveCursor.Hide();
|
||||||
|
@ -95,6 +95,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
case SwellTick:
|
case SwellTick:
|
||||||
scoreIncrease = 300;
|
scoreIncrease = 300;
|
||||||
increaseCombo = false;
|
increaseCombo = false;
|
||||||
|
isBonus = true;
|
||||||
|
bonusResult = HitResult.IgnoreHit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrumRollTick:
|
case DrumRollTick:
|
||||||
|
@ -116,5 +116,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
||||||
|
|
||||||
protected override ReplayRecorder CreateReplayRecorder(Score score) => new TaikoReplayRecorder(score);
|
protected override ReplayRecorder CreateReplayRecorder(Score score) => new TaikoReplayRecorder(score);
|
||||||
|
|
||||||
|
protected override ResumeOverlay CreateResumeOverlay() => new DelayedResumeOverlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
145
osu.Game.Tests/Editing/Checks/CheckUnusedAudioAtEndTest.cs
Normal file
145
osu.Game.Tests/Editing/Checks/CheckUnusedAudioAtEndTest.cs
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Edit.Checks;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
using osuTK;
|
||||||
|
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Editing.Checks
|
||||||
|
{
|
||||||
|
public class CheckUnusedAudioAtEndTest
|
||||||
|
{
|
||||||
|
private CheckUnusedAudioAtEnd check = null!;
|
||||||
|
|
||||||
|
private IBeatmap beatmapNotFullyMapped = null!;
|
||||||
|
|
||||||
|
private IBeatmap beatmapFullyMapped = null!;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
check = new CheckUnusedAudioAtEnd();
|
||||||
|
beatmapNotFullyMapped = new Beatmap<HitObject>
|
||||||
|
{
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 0 },
|
||||||
|
new HitCircle { StartTime = 1_298 },
|
||||||
|
},
|
||||||
|
BeatmapInfo = new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata { AudioFile = "abc123.jpg" }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
beatmapFullyMapped = new Beatmap<HitObject>
|
||||||
|
{
|
||||||
|
HitObjects =
|
||||||
|
{
|
||||||
|
new HitCircle { StartTime = 0 },
|
||||||
|
new HitCircle { StartTime = 9000 },
|
||||||
|
},
|
||||||
|
BeatmapInfo = new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata { AudioFile = "abc123.jpg" },
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestEmptyBeatmap()
|
||||||
|
{
|
||||||
|
var context = getContext(new Beatmap<HitObject>());
|
||||||
|
var issues = check.Run(context).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(issues.Single().Template is CheckUnusedAudioAtEnd.IssueTemplateUnusedAudioAtEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAudioNotFullyUsed()
|
||||||
|
{
|
||||||
|
var context = getContext(beatmapNotFullyMapped);
|
||||||
|
var issues = check.Run(context).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(issues.Single().Template is CheckUnusedAudioAtEnd.IssueTemplateUnusedAudioAtEnd);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAudioNotFullyUsedWithVideo()
|
||||||
|
{
|
||||||
|
var storyboard = new Storyboard();
|
||||||
|
|
||||||
|
var video = new StoryboardVideo("abc123.mp4", 0);
|
||||||
|
|
||||||
|
storyboard.GetLayer("Video").Add(video);
|
||||||
|
|
||||||
|
var mockWorkingBeatmap = getMockWorkingBeatmap(beatmapNotFullyMapped, storyboard);
|
||||||
|
|
||||||
|
var context = getContext(beatmapNotFullyMapped, mockWorkingBeatmap);
|
||||||
|
var issues = check.Run(context).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(issues.Single().Template is CheckUnusedAudioAtEnd.IssueTemplateUnusedAudioAtEndStoryboardOrVideo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAudioNotFullyUsedWithStoryboardElement()
|
||||||
|
{
|
||||||
|
var storyboard = new Storyboard();
|
||||||
|
|
||||||
|
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
|
||||||
|
|
||||||
|
storyboard.GetLayer("Background").Add(sprite);
|
||||||
|
|
||||||
|
var mockWorkingBeatmap = getMockWorkingBeatmap(beatmapNotFullyMapped, storyboard);
|
||||||
|
|
||||||
|
var context = getContext(beatmapNotFullyMapped, mockWorkingBeatmap);
|
||||||
|
var issues = check.Run(context).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(issues.Single().Template is CheckUnusedAudioAtEnd.IssueTemplateUnusedAudioAtEndStoryboardOrVideo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAudioFullyUsed()
|
||||||
|
{
|
||||||
|
var context = getContext(beatmapFullyMapped);
|
||||||
|
var issues = check.Run(context).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private BeatmapVerifierContext getContext(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
return new BeatmapVerifierContext(beatmap, getMockWorkingBeatmap(beatmap, new Storyboard()).Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BeatmapVerifierContext getContext(IBeatmap beatmap, Mock<IWorkingBeatmap> workingBeatmap)
|
||||||
|
{
|
||||||
|
return new BeatmapVerifierContext(beatmap, workingBeatmap.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Mock<IWorkingBeatmap> getMockWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard)
|
||||||
|
{
|
||||||
|
var mockTrack = new TrackVirtualStore(new FramedClock()).GetVirtual(10000, "virtual");
|
||||||
|
|
||||||
|
var mockWorkingBeatmap = new Mock<IWorkingBeatmap>();
|
||||||
|
mockWorkingBeatmap.SetupGet(w => w.Beatmap).Returns(beatmap);
|
||||||
|
mockWorkingBeatmap.SetupGet(w => w.Track).Returns(mockTrack);
|
||||||
|
mockWorkingBeatmap.SetupGet(w => w.Storyboard).Returns(storyboard);
|
||||||
|
|
||||||
|
return mockWorkingBeatmap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
89
osu.Game.Tests/Editing/Checks/CheckVideoResolutionTest.cs
Normal file
89
osu.Game.Tests/Editing/Checks/CheckVideoResolutionTest.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
// 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.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Edit.Checks;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
using osu.Game.Tests.Resources;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Editing.Checks
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class CheckVideoResolutionTest
|
||||||
|
{
|
||||||
|
private CheckVideoResolution check = null!;
|
||||||
|
|
||||||
|
private IBeatmap beatmap = null!;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
check = new CheckVideoResolution();
|
||||||
|
beatmap = new Beatmap<HitObject>
|
||||||
|
{
|
||||||
|
BeatmapInfo = new BeatmapInfo
|
||||||
|
{
|
||||||
|
BeatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
Files =
|
||||||
|
{
|
||||||
|
CheckTestHelpers.CreateMockFile("mp4"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNoVideo()
|
||||||
|
{
|
||||||
|
beatmap.BeatmapInfo.BeatmapSet?.Files.Clear();
|
||||||
|
|
||||||
|
var issues = check.Run(getContext(null)).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestVideoAcceptableResolution()
|
||||||
|
{
|
||||||
|
using (var resourceStream = TestResources.OpenResource("Videos/test-video.mp4"))
|
||||||
|
{
|
||||||
|
var issues = check.Run(getContext(resourceStream)).ToList();
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestVideoHighResolution()
|
||||||
|
{
|
||||||
|
using (var resourceStream = TestResources.OpenResource("Videos/test-video-resolution-high.mp4"))
|
||||||
|
{
|
||||||
|
var issues = check.Run(getContext(resourceStream)).ToList();
|
||||||
|
|
||||||
|
Assert.That(issues, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(issues.Single().Template is CheckVideoResolution.IssueTemplateHighResolution);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BeatmapVerifierContext getContext(Stream? resourceStream)
|
||||||
|
{
|
||||||
|
var storyboard = new Storyboard();
|
||||||
|
var layer = storyboard.GetLayer("Video");
|
||||||
|
layer.Add(new StoryboardVideo("abc123.mp4", 0));
|
||||||
|
|
||||||
|
var mockWorkingBeatmap = new Mock<TestWorkingBeatmap>(beatmap, null, null);
|
||||||
|
mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns(resourceStream);
|
||||||
|
mockWorkingBeatmap.As<IWorkingBeatmap>().SetupGet(w => w.Storyboard).Returns(storyboard);
|
||||||
|
|
||||||
|
return new BeatmapVerifierContext(beatmap, mockWorkingBeatmap.Object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
osu.Game.Tests/Resources/Videos/test-video-resolution-high.mp4
Normal file
BIN
osu.Game.Tests/Resources/Videos/test-video-resolution-high.mp4
Normal file
Binary file not shown.
@ -0,0 +1,44 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Tests.Gameplay;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public partial class TestSceneDelayedResumeOverlay : OsuTestScene
|
||||||
|
{
|
||||||
|
private ResumeOverlay resume = null!;
|
||||||
|
private bool resumeFired;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private GameplayState gameplayState;
|
||||||
|
|
||||||
|
public TestSceneDelayedResumeOverlay()
|
||||||
|
{
|
||||||
|
gameplayState = TestGameplayState.Create(new OsuRuleset());
|
||||||
|
}
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(loadContent);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestResume()
|
||||||
|
{
|
||||||
|
AddStep("show", () => resume.Show());
|
||||||
|
AddUntilStep("dismissed", () => resumeFired && resume.State.Value == Visibility.Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadContent()
|
||||||
|
{
|
||||||
|
Child = resume = new DelayedResumeOverlay();
|
||||||
|
|
||||||
|
resumeFired = false;
|
||||||
|
resume.ResumeAction = () => resumeFired = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -25,9 +25,11 @@ using osu.Game.Rulesets.Osu;
|
|||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
@ -55,6 +57,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly VolumeOverlay volumeOverlay;
|
private readonly VolumeOverlay volumeOverlay;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private readonly OsuLogo logo;
|
||||||
|
|
||||||
[Cached(typeof(BatteryInfo))]
|
[Cached(typeof(BatteryInfo))]
|
||||||
private readonly LocalBatteryInfo batteryInfo = new LocalBatteryInfo();
|
private readonly LocalBatteryInfo batteryInfo = new LocalBatteryInfo();
|
||||||
|
|
||||||
@ -78,7 +83,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
},
|
},
|
||||||
changelogOverlay = new ChangelogOverlay()
|
changelogOverlay = new ChangelogOverlay(),
|
||||||
|
logo = new OsuLogo
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Scale = new Vector2(0.5f),
|
||||||
|
Position = new Vector2(128f),
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,6 +224,36 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddUntilStep("loads after idle", () => !loader.IsCurrentScreen());
|
AddUntilStep("loads after idle", () => !loader.IsCurrentScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestLoadNotBlockedOnOsuLogo()
|
||||||
|
{
|
||||||
|
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||||
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
|
AddUntilStep("wait for load ready", () =>
|
||||||
|
{
|
||||||
|
moveMouse();
|
||||||
|
return player?.LoadState == LoadState.Ready;
|
||||||
|
});
|
||||||
|
|
||||||
|
// move mouse in logo while waiting for load to still proceed (it shouldn't be blocked when hovering logo).
|
||||||
|
AddUntilStep("move mouse in logo", () =>
|
||||||
|
{
|
||||||
|
moveMouse();
|
||||||
|
return !loader.IsCurrentScreen();
|
||||||
|
});
|
||||||
|
|
||||||
|
void moveMouse()
|
||||||
|
{
|
||||||
|
notificationOverlay.State.Value = Visibility.Hidden;
|
||||||
|
|
||||||
|
InputManager.MoveMouseTo(
|
||||||
|
logo.ScreenSpaceDrawQuad.TopLeft
|
||||||
|
+ (logo.ScreenSpaceDrawQuad.BottomRight - logo.ScreenSpaceDrawQuad.TopLeft)
|
||||||
|
* RNG.NextSingle(0.3f, 0.7f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLoadContinuation()
|
public void TestLoadContinuation()
|
||||||
{
|
{
|
||||||
|
@ -666,6 +666,56 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert($"Check {zzz_lowercase} is second last", () => carousel.BeatmapSets.SkipLast(1).Last().Metadata.Artist == zzz_lowercase);
|
AddAssert($"Check {zzz_lowercase} is second last", () => carousel.BeatmapSets.SkipLast(1).Last().Metadata.Artist == zzz_lowercase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSortByArtistUsesTitleAsTiebreaker()
|
||||||
|
{
|
||||||
|
var sets = new List<BeatmapSetInfo>();
|
||||||
|
|
||||||
|
AddStep("Populuate beatmap sets", () =>
|
||||||
|
{
|
||||||
|
sets.Clear();
|
||||||
|
|
||||||
|
for (int i = 0; i < 20; i++)
|
||||||
|
{
|
||||||
|
var set = TestResources.CreateTestBeatmapSetInfo();
|
||||||
|
|
||||||
|
if (i == 4)
|
||||||
|
{
|
||||||
|
set.Beatmaps.ForEach(b =>
|
||||||
|
{
|
||||||
|
b.Metadata.Artist = "ZZZ";
|
||||||
|
b.Metadata.Title = "AAA";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 8)
|
||||||
|
{
|
||||||
|
set.Beatmaps.ForEach(b =>
|
||||||
|
{
|
||||||
|
b.Metadata.Artist = "ZZZ";
|
||||||
|
b.Metadata.Title = "ZZZ";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
sets.Add(set);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
loadBeatmaps(sets);
|
||||||
|
|
||||||
|
AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false));
|
||||||
|
AddAssert("Check last item", () =>
|
||||||
|
{
|
||||||
|
var lastItem = carousel.BeatmapSets.Last();
|
||||||
|
return lastItem.Metadata.Artist == "ZZZ" && lastItem.Metadata.Title == "ZZZ";
|
||||||
|
});
|
||||||
|
AddAssert("Check second last item", () =>
|
||||||
|
{
|
||||||
|
var secondLastItem = carousel.BeatmapSets.SkipLast(1).Last();
|
||||||
|
return secondLastItem.Metadata.Artist == "ZZZ" && secondLastItem.Metadata.Title == "AAA";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ensures stability is maintained on different sort modes for items with equal properties.
|
/// Ensures stability is maintained on different sort modes for items with equal properties.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
@ -85,10 +86,16 @@ namespace osu.Game.Beatmaps
|
|||||||
private bool shouldDiscardLookupResult(OnlineBeatmapMetadata result, BeatmapInfo beatmapInfo)
|
private bool shouldDiscardLookupResult(OnlineBeatmapMetadata result, BeatmapInfo beatmapInfo)
|
||||||
{
|
{
|
||||||
if (beatmapInfo.OnlineID > 0 && result.BeatmapID != beatmapInfo.OnlineID)
|
if (beatmapInfo.OnlineID > 0 && result.BeatmapID != beatmapInfo.OnlineID)
|
||||||
|
{
|
||||||
|
Logger.Log($"Discarding metadata lookup result due to mismatching online ID (expected: {beatmapInfo.OnlineID} actual: {result.BeatmapID})", LoggingTarget.Database);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (beatmapInfo.OnlineID == -1 && result.MD5Hash != beatmapInfo.MD5Hash)
|
if (beatmapInfo.OnlineID == -1 && result.MD5Hash != beatmapInfo.MD5Hash)
|
||||||
|
{
|
||||||
|
Logger.Log($"Discarding metadata lookup result due to mismatching hash (expected: {beatmapInfo.MD5Hash} actual: {result.MD5Hash})", LoggingTarget.Database);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
@ -129,6 +130,7 @@ namespace osu.Game.Beatmaps
|
|||||||
///
|
///
|
||||||
/// It's not super efficient so calls should be kept to a minimum.
|
/// It's not super efficient so calls should be kept to a minimum.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <exception cref="InvalidOperationException">If <paramref name="beatmap"/> has no objects.</exception>
|
||||||
public static double GetLastObjectTime(this IBeatmap beatmap) => beatmap.HitObjects.Max(h => h.GetEndTime());
|
public static double GetLastObjectTime(this IBeatmap beatmap) => beatmap.HitObjects.Max(h => h.GetEndTime());
|
||||||
|
|
||||||
#region Helper methods
|
#region Helper methods
|
||||||
|
@ -125,6 +125,11 @@ Click to see what's new!", version);
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString UpdateReadyToInstall => new TranslatableString(getKey(@"update_ready_to_install"), @"Update ready to install. Click to restart!");
|
public static LocalisableString UpdateReadyToInstall => new TranslatableString(getKey(@"update_ready_to_install"), @"Update ready to install. Click to restart!");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "This is not an official build of the game. Scores will not be submitted and other online systems may not work as intended."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString NotOfficialBuild => new TranslatableString(getKey(@"not_official_build"), @"This is not an official build of the game. Scores will not be submitted and other online systems may not work as intended.");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Downloading update..."
|
/// "Downloading update..."
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
// Resources
|
// Resources
|
||||||
new CheckBackgroundPresence(),
|
new CheckBackgroundPresence(),
|
||||||
new CheckBackgroundQuality(),
|
new CheckBackgroundQuality(),
|
||||||
|
new CheckVideoResolution(),
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
new CheckAudioPresence(),
|
new CheckAudioPresence(),
|
||||||
@ -36,6 +37,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
new CheckConcurrentObjects(),
|
new CheckConcurrentObjects(),
|
||||||
new CheckZeroLengthObjects(),
|
new CheckZeroLengthObjects(),
|
||||||
new CheckDrainLength(),
|
new CheckDrainLength(),
|
||||||
|
new CheckUnusedAudioAtEnd(),
|
||||||
|
|
||||||
// Timing
|
// Timing
|
||||||
new CheckPreviewTime(),
|
new CheckPreviewTime(),
|
||||||
|
80
osu.Game/Rulesets/Edit/Checks/CheckUnusedAudioAtEnd.cs
Normal file
80
osu.Game/Rulesets/Edit/Checks/CheckUnusedAudioAtEnd.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit.Checks
|
||||||
|
{
|
||||||
|
public class CheckUnusedAudioAtEnd : ICheck
|
||||||
|
{
|
||||||
|
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Compose, "More than 20% unused audio at the end");
|
||||||
|
|
||||||
|
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||||
|
{
|
||||||
|
new IssueTemplateUnusedAudioAtEnd(this),
|
||||||
|
new IssueTemplateUnusedAudioAtEndStoryboardOrVideo(this),
|
||||||
|
};
|
||||||
|
|
||||||
|
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
||||||
|
{
|
||||||
|
double mappedLength = context.Beatmap.HitObjects.Any() ? context.Beatmap.GetLastObjectTime() : 0;
|
||||||
|
double trackLength = context.WorkingBeatmap.Track.Length;
|
||||||
|
|
||||||
|
double mappedPercentage = Math.Round(mappedLength / trackLength * 100);
|
||||||
|
|
||||||
|
if (mappedPercentage < 80)
|
||||||
|
{
|
||||||
|
double percentageLeft = Math.Abs(mappedPercentage - 100);
|
||||||
|
|
||||||
|
bool storyboardIsPresent = isAnyStoryboardElementPresent(context.WorkingBeatmap.Storyboard);
|
||||||
|
|
||||||
|
if (storyboardIsPresent)
|
||||||
|
{
|
||||||
|
yield return new IssueTemplateUnusedAudioAtEndStoryboardOrVideo(this).Create(percentageLeft);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
yield return new IssueTemplateUnusedAudioAtEnd(this).Create(percentageLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isAnyStoryboardElementPresent(Storyboard storyboard)
|
||||||
|
{
|
||||||
|
foreach (var layer in storyboard.Layers)
|
||||||
|
{
|
||||||
|
foreach (var _ in layer.Elements)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IssueTemplateUnusedAudioAtEnd : IssueTemplate
|
||||||
|
{
|
||||||
|
public IssueTemplateUnusedAudioAtEnd(ICheck check)
|
||||||
|
: base(check, IssueType.Warning, "Currently there is {0}% unused audio at the end. Ensure the outro significantly contributes to the song, otherwise cut the outro.")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Issue Create(double percentageLeft) => new Issue(this, percentageLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IssueTemplateUnusedAudioAtEndStoryboardOrVideo : IssueTemplate
|
||||||
|
{
|
||||||
|
public IssueTemplateUnusedAudioAtEndStoryboardOrVideo(ICheck check)
|
||||||
|
: base(check, IssueType.Warning, "Currently there is {0}% unused audio at the end. Ensure the outro significantly contributes to the song, or is being occupied by the video or storyboard, otherwise cut the outro.")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Issue Create(double percentageLeft) => new Issue(this, percentageLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
116
osu.Game/Rulesets/Edit/Checks/CheckVideoResolution.cs
Normal file
116
osu.Game/Rulesets/Edit/Checks/CheckVideoResolution.cs
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.IO.FileAbstraction;
|
||||||
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
using TagLib;
|
||||||
|
using File = TagLib.File;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit.Checks
|
||||||
|
{
|
||||||
|
public class CheckVideoResolution : ICheck
|
||||||
|
{
|
||||||
|
private const int max_video_width = 1280;
|
||||||
|
|
||||||
|
private const int max_video_height = 720;
|
||||||
|
|
||||||
|
public CheckMetadata Metadata => new CheckMetadata(CheckCategory.Resources, "Too high video resolution.");
|
||||||
|
|
||||||
|
public IEnumerable<IssueTemplate> PossibleTemplates => new IssueTemplate[]
|
||||||
|
{
|
||||||
|
new IssueTemplateHighResolution(this),
|
||||||
|
new IssueTemplateFileError(this),
|
||||||
|
};
|
||||||
|
|
||||||
|
public IEnumerable<Issue> Run(BeatmapVerifierContext context)
|
||||||
|
{
|
||||||
|
var beatmapSet = context.Beatmap.BeatmapInfo.BeatmapSet;
|
||||||
|
var videoPaths = getVideoPaths(context.WorkingBeatmap.Storyboard);
|
||||||
|
|
||||||
|
foreach (string filename in videoPaths)
|
||||||
|
{
|
||||||
|
string? storagePath = beatmapSet?.GetPathForFile(filename);
|
||||||
|
|
||||||
|
// Don't report any issues for missing video here since another check is already doing that (CheckAudioInVideo)
|
||||||
|
if (storagePath == null) continue;
|
||||||
|
|
||||||
|
Issue issue;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (Stream data = context.WorkingBeatmap.GetStream(storagePath))
|
||||||
|
using (File tagFile = File.Create(new StreamFileAbstraction(filename, data)))
|
||||||
|
{
|
||||||
|
int height = tagFile.Properties.VideoHeight;
|
||||||
|
int width = tagFile.Properties.VideoWidth;
|
||||||
|
|
||||||
|
if (height <= max_video_height || width <= max_video_width)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
issue = new IssueTemplateHighResolution(this).Create(filename, width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (CorruptFileException)
|
||||||
|
{
|
||||||
|
issue = new IssueTemplateFileError(this).Create(filename, "Corrupt file");
|
||||||
|
}
|
||||||
|
catch (UnsupportedFormatException)
|
||||||
|
{
|
||||||
|
issue = new IssueTemplateFileError(this).Create(filename, "Unsupported format");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
issue = new IssueTemplateFileError(this).Create(filename, "Internal failure - see logs for more info");
|
||||||
|
Logger.Log($"Failed when running {nameof(CheckVideoResolution)}: {ex}");
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return issue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> getVideoPaths(Storyboard storyboard)
|
||||||
|
{
|
||||||
|
var videoPaths = new List<string>();
|
||||||
|
|
||||||
|
foreach (var layer in storyboard.Layers)
|
||||||
|
{
|
||||||
|
foreach (var element in layer.Elements)
|
||||||
|
{
|
||||||
|
if (element is not StoryboardVideo video)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!videoPaths.Contains(video.Path))
|
||||||
|
videoPaths.Add(video.Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return videoPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IssueTemplateHighResolution : IssueTemplate
|
||||||
|
{
|
||||||
|
public IssueTemplateHighResolution(ICheck check)
|
||||||
|
: base(check, IssueType.Problem, "\"{0}\" resolution exceeds 1280x720 ({1}x{2})")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Issue Create(string filename, int width, int height) => new Issue(this, filename, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IssueTemplateFileError : IssueTemplate
|
||||||
|
{
|
||||||
|
public IssueTemplateFileError(ICheck check)
|
||||||
|
: base(check, IssueType.Error, "Could not check resolution for \"{0}\" ({1}).")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Issue Create(string filename, string errorReason) => new Issue(this, filename, errorReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,6 +18,7 @@ using osu.Game.Beatmaps.ControlPoints;
|
|||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
|
using System.Buffers;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Legacy
|
namespace osu.Game.Rulesets.Objects.Legacy
|
||||||
{
|
{
|
||||||
@ -264,70 +265,93 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
private PathControlPoint[] convertPathString(string pointString, Vector2 offset)
|
private PathControlPoint[] convertPathString(string pointString, Vector2 offset)
|
||||||
{
|
{
|
||||||
// This code takes on the responsibility of handling explicit segments of the path ("X" & "Y" from above). Implicit segments are handled by calls to convertPoints().
|
// This code takes on the responsibility of handling explicit segments of the path ("X" & "Y" from above). Implicit segments are handled by calls to convertPoints().
|
||||||
string[] pointSplit = pointString.Split('|');
|
string[] pointStringSplit = pointString.Split('|');
|
||||||
|
|
||||||
var controlPoints = new List<Memory<PathControlPoint>>();
|
var pointsBuffer = ArrayPool<Vector2>.Shared.Rent(pointStringSplit.Length);
|
||||||
int startIndex = 0;
|
var segmentsBuffer = ArrayPool<(PathType Type, int StartIndex)>.Shared.Rent(pointStringSplit.Length);
|
||||||
int endIndex = 0;
|
int currentPointsIndex = 0;
|
||||||
bool first = true;
|
int currentSegmentsIndex = 0;
|
||||||
|
|
||||||
while (++endIndex < pointSplit.Length)
|
try
|
||||||
{
|
{
|
||||||
// Keep incrementing endIndex while it's not the start of a new segment (indicated by having an alpha character at position 0).
|
foreach (string s in pointStringSplit)
|
||||||
if (!char.IsLetter(pointSplit[endIndex][0]))
|
{
|
||||||
continue;
|
if (char.IsLetter(s[0]))
|
||||||
|
{
|
||||||
|
// The start of a new segment(indicated by having an alpha character at position 0).
|
||||||
|
var pathType = convertPathType(s);
|
||||||
|
segmentsBuffer[currentSegmentsIndex++] = (pathType, currentPointsIndex);
|
||||||
|
|
||||||
// Multi-segmented sliders DON'T contain the end point as part of the current segment as it's assumed to be the start of the next segment.
|
// First segment is prepended by an extra zero point
|
||||||
// The start of the next segment is the index after the type descriptor.
|
if (currentPointsIndex == 0)
|
||||||
string endPoint = endIndex < pointSplit.Length - 1 ? pointSplit[endIndex + 1] : null;
|
pointsBuffer[currentPointsIndex++] = Vector2.Zero;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pointsBuffer[currentPointsIndex++] = readPoint(s, offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
controlPoints.AddRange(convertPoints(pointSplit.AsMemory().Slice(startIndex, endIndex - startIndex), endPoint, first, offset));
|
int pointsCount = currentPointsIndex;
|
||||||
startIndex = endIndex;
|
int segmentsCount = currentSegmentsIndex;
|
||||||
first = false;
|
var controlPoints = new List<ArraySegment<PathControlPoint>>(pointsCount);
|
||||||
|
var allPoints = new ArraySegment<Vector2>(pointsBuffer, 0, pointsCount);
|
||||||
|
|
||||||
|
for (int i = 0; i < segmentsCount; i++)
|
||||||
|
{
|
||||||
|
if (i < segmentsCount - 1)
|
||||||
|
{
|
||||||
|
int startIndex = segmentsBuffer[i].StartIndex;
|
||||||
|
int endIndex = segmentsBuffer[i + 1].StartIndex;
|
||||||
|
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints.Slice(startIndex, endIndex - startIndex), pointsBuffer[endIndex]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int startIndex = segmentsBuffer[i].StartIndex;
|
||||||
|
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints.Slice(startIndex), null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mergeControlPointsLists(controlPoints);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ArrayPool<Vector2>.Shared.Return(pointsBuffer);
|
||||||
|
ArrayPool<(PathType, int)>.Shared.Return(segmentsBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endIndex > startIndex)
|
static Vector2 readPoint(string value, Vector2 startPos)
|
||||||
controlPoints.AddRange(convertPoints(pointSplit.AsMemory().Slice(startIndex, endIndex - startIndex), null, first, offset));
|
{
|
||||||
|
string[] vertexSplit = value.Split(':');
|
||||||
|
|
||||||
return mergePointsLists(controlPoints);
|
Vector2 pos = new Vector2((int)Parsing.ParseDouble(vertexSplit[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(vertexSplit[1], Parsing.MAX_COORDINATE_VALUE)) - startPos;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a given point list into a set of path segments.
|
/// Converts a given point list into a set of path segments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="type">The path type of the point list.</param>
|
||||||
/// <param name="points">The point list.</param>
|
/// <param name="points">The point list.</param>
|
||||||
/// <param name="endPoint">Any extra endpoint to consider as part of the points. This will NOT be returned.</param>
|
/// <param name="endPoint">Any extra endpoint to consider as part of the points. This will NOT be returned.</param>
|
||||||
/// <param name="first">Whether this is the first segment in the set. If <c>true</c> the first of the returned segments will contain a zero point.</param>
|
/// <returns>The set of points contained by <paramref name="points"/> as one or more segments of the path.</returns>
|
||||||
/// <param name="offset">The positional offset to apply to the control points.</param>
|
private IEnumerable<ArraySegment<PathControlPoint>> convertPoints(PathType type, ArraySegment<Vector2> points, Vector2? endPoint)
|
||||||
/// <returns>The set of points contained by <paramref name="points"/> as one or more segments of the path, prepended by an extra zero point if <paramref name="first"/> is <c>true</c>.</returns>
|
|
||||||
private IEnumerable<Memory<PathControlPoint>> convertPoints(ReadOnlyMemory<string> points, string endPoint, bool first, Vector2 offset)
|
|
||||||
{
|
{
|
||||||
PathType type = convertPathType(points.Span[0]);
|
var vertices = new PathControlPoint[points.Count];
|
||||||
|
|
||||||
int readOffset = first ? 1 : 0; // First control point is zero for the first segment.
|
|
||||||
int readablePoints = points.Length - 1; // Total points readable from the base point span.
|
|
||||||
int endPointLength = endPoint != null ? 1 : 0; // Extra length if an endpoint is given that lies outside the base point span.
|
|
||||||
|
|
||||||
var vertices = new PathControlPoint[readOffset + readablePoints + endPointLength];
|
|
||||||
|
|
||||||
// Fill any non-read points.
|
|
||||||
for (int i = 0; i < readOffset; i++)
|
|
||||||
vertices[i] = new PathControlPoint();
|
|
||||||
|
|
||||||
// Parse into control points.
|
// Parse into control points.
|
||||||
for (int i = 1; i < points.Length; i++)
|
for (int i = 0; i < points.Count; i++)
|
||||||
readPoint(points.Span[i], offset, out vertices[readOffset + i - 1]);
|
vertices[i] = new PathControlPoint { Position = points[i] };
|
||||||
|
|
||||||
// If an endpoint is given, add it to the end.
|
|
||||||
if (endPoint != null)
|
|
||||||
readPoint(endPoint, offset, out vertices[^1]);
|
|
||||||
|
|
||||||
// Edge-case rules (to match stable).
|
// Edge-case rules (to match stable).
|
||||||
if (type == PathType.PERFECT_CURVE)
|
if (type == PathType.PERFECT_CURVE)
|
||||||
{
|
{
|
||||||
if (vertices.Length != 3)
|
int endPointLength = endPoint is null ? 0 : 1;
|
||||||
|
|
||||||
|
if (vertices.Length + endPointLength != 3)
|
||||||
type = PathType.BEZIER;
|
type = PathType.BEZIER;
|
||||||
else if (isLinear(vertices))
|
else if (isLinear(points[0], points[1], endPoint ?? points[2]))
|
||||||
{
|
{
|
||||||
// osu-stable special-cased colinear perfect curves to a linear path
|
// osu-stable special-cased colinear perfect curves to a linear path
|
||||||
type = PathType.LINEAR;
|
type = PathType.LINEAR;
|
||||||
@ -346,7 +370,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
int endIndex = 0;
|
int endIndex = 0;
|
||||||
|
|
||||||
while (++endIndex < vertices.Length - endPointLength)
|
while (++endIndex < vertices.Length)
|
||||||
{
|
{
|
||||||
// Keep incrementing while an implicit segment doesn't need to be started.
|
// Keep incrementing while an implicit segment doesn't need to be started.
|
||||||
if (vertices[endIndex].Position != vertices[endIndex - 1].Position)
|
if (vertices[endIndex].Position != vertices[endIndex - 1].Position)
|
||||||
@ -359,47 +383,39 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// The last control point of each segment is not allowed to start a new implicit segment.
|
// The last control point of each segment is not allowed to start a new implicit segment.
|
||||||
if (endIndex == vertices.Length - endPointLength - 1)
|
if (endIndex == vertices.Length - 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Force a type on the last point, and return the current control point set as a segment.
|
// Force a type on the last point, and return the current control point set as a segment.
|
||||||
vertices[endIndex - 1].Type = type;
|
vertices[endIndex - 1].Type = type;
|
||||||
yield return vertices.AsMemory().Slice(startIndex, endIndex - startIndex);
|
yield return new ArraySegment<PathControlPoint>(vertices, startIndex, endIndex - startIndex);
|
||||||
|
|
||||||
// Skip the current control point - as it's the same as the one that's just been returned.
|
// Skip the current control point - as it's the same as the one that's just been returned.
|
||||||
startIndex = endIndex + 1;
|
startIndex = endIndex + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endIndex > startIndex)
|
if (startIndex < endIndex)
|
||||||
yield return vertices.AsMemory().Slice(startIndex, endIndex - startIndex);
|
yield return new ArraySegment<PathControlPoint>(vertices, startIndex, endIndex - startIndex);
|
||||||
|
|
||||||
static void readPoint(string value, Vector2 startPos, out PathControlPoint point)
|
static bool isLinear(Vector2 p0, Vector2 p1, Vector2 p2)
|
||||||
{
|
=> Precision.AlmostEquals(0, (p1.Y - p0.Y) * (p2.X - p0.X)
|
||||||
string[] vertexSplit = value.Split(':');
|
- (p1.X - p0.X) * (p2.Y - p0.Y));
|
||||||
|
|
||||||
Vector2 pos = new Vector2((int)Parsing.ParseDouble(vertexSplit[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(vertexSplit[1], Parsing.MAX_COORDINATE_VALUE)) - startPos;
|
|
||||||
point = new PathControlPoint { Position = pos };
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isLinear(PathControlPoint[] p) => Precision.AlmostEquals(0, (p[1].Position.Y - p[0].Position.Y) * (p[2].Position.X - p[0].Position.X)
|
|
||||||
- (p[1].Position.X - p[0].Position.X) * (p[2].Position.Y - p[0].Position.Y));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathControlPoint[] mergePointsLists(List<Memory<PathControlPoint>> controlPointList)
|
private PathControlPoint[] mergeControlPointsLists(List<ArraySegment<PathControlPoint>> controlPointList)
|
||||||
{
|
{
|
||||||
int totalCount = 0;
|
int totalCount = 0;
|
||||||
|
|
||||||
foreach (var arr in controlPointList)
|
foreach (var arr in controlPointList)
|
||||||
totalCount += arr.Length;
|
totalCount += arr.Count;
|
||||||
|
|
||||||
var mergedArray = new PathControlPoint[totalCount];
|
var mergedArray = new PathControlPoint[totalCount];
|
||||||
var mergedArrayMemory = mergedArray.AsMemory();
|
|
||||||
int copyIndex = 0;
|
int copyIndex = 0;
|
||||||
|
|
||||||
foreach (var arr in controlPointList)
|
foreach (var arr in controlPointList)
|
||||||
{
|
{
|
||||||
arr.CopyTo(mergedArrayMemory.Slice(copyIndex));
|
arr.AsSpan().CopyTo(mergedArray.AsSpan(copyIndex));
|
||||||
copyIndex += arr.Length;
|
copyIndex += arr.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mergedArray;
|
return mergedArray;
|
||||||
|
@ -76,5 +76,9 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(PathControlPoint other) => Position == other?.Position && Type == other.Type;
|
public bool Equals(PathControlPoint other) => Position == other?.Position && Type == other.Type;
|
||||||
|
|
||||||
|
public override string ToString() => type is null
|
||||||
|
? $"Position={Position}"
|
||||||
|
: $"Position={Position}, Type={type}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,9 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
increaseHp(h);
|
increaseHp(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (topLevelObjectCount == 0)
|
||||||
|
return testDrop;
|
||||||
|
|
||||||
if (!fail && currentHp < lowestHpEnd)
|
if (!fail && currentHp < lowestHpEnd)
|
||||||
{
|
{
|
||||||
fail = true;
|
fail = true;
|
||||||
|
@ -240,7 +240,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public override void RequestResume(Action continueResume)
|
public override void RequestResume(Action continueResume)
|
||||||
{
|
{
|
||||||
if (ResumeOverlay != null && UseResumeOverlay && (Cursor == null || (Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))))
|
if (ResumeOverlay != null && UseResumeOverlay)
|
||||||
{
|
{
|
||||||
ResumeOverlay.GameplayCursor = Cursor;
|
ResumeOverlay.GameplayCursor = Cursor;
|
||||||
ResumeOverlay.ResumeAction = continueResume;
|
ResumeOverlay.ResumeAction = continueResume;
|
||||||
|
@ -46,9 +46,10 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
/// <item><description>30000013: All local scores will use lazer definitions of ranks for consistency. Recalculates the rank of all scores.</description></item>
|
/// <item><description>30000013: All local scores will use lazer definitions of ranks for consistency. Recalculates the rank of all scores.</description></item>
|
||||||
/// <item><description>30000014: Fix edge cases in conversion for osu! scores on selected beatmaps. Reconvert all scores.</description></item>
|
/// <item><description>30000014: Fix edge cases in conversion for osu! scores on selected beatmaps. Reconvert all scores.</description></item>
|
||||||
/// <item><description>30000015: Fix osu! standardised score estimation algorithm violating basic invariants. Reconvert all scores.</description></item>
|
/// <item><description>30000015: Fix osu! standardised score estimation algorithm violating basic invariants. Reconvert all scores.</description></item>
|
||||||
|
/// <item><description>30000016: Fix taiko standardised score estimation algorithm not including swell tick score gain into bonus portion. Reconvert all scores.</description></item>
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public const int LATEST_VERSION = 30000015;
|
public const int LATEST_VERSION = 30000016;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The first stable-compatible YYYYMMDD format version given to lazer usage of replays.
|
/// The first stable-compatible YYYYMMDD format version given to lazer usage of replays.
|
||||||
|
196
osu.Game/Screens/Play/DelayedResumeOverlay.cs
Normal file
196
osu.Game/Screens/Play/DelayedResumeOverlay.cs
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
// 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 osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Simple <see cref="ResumeOverlay"/> that resumes after a short delay.
|
||||||
|
/// </summary>
|
||||||
|
public partial class DelayedResumeOverlay : ResumeOverlay
|
||||||
|
{
|
||||||
|
// todo: this shouldn't define its own colour provider, but nothing in Player screen does, so let's do that for now.
|
||||||
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
|
private const float outer_size = 200;
|
||||||
|
private const float inner_size = 150;
|
||||||
|
private const float progress_stroke_width = 7;
|
||||||
|
private const float progress_size = inner_size + progress_stroke_width / 2f;
|
||||||
|
|
||||||
|
private const double countdown_time = 2000;
|
||||||
|
|
||||||
|
protected override LocalisableString Message => string.Empty;
|
||||||
|
|
||||||
|
private ScheduledDelegate? scheduledResume;
|
||||||
|
private int? countdownCount;
|
||||||
|
private double countdownStartTime;
|
||||||
|
private bool countdownComplete;
|
||||||
|
|
||||||
|
private Drawable outerContent = null!;
|
||||||
|
private Container innerContent = null!;
|
||||||
|
|
||||||
|
private Container countdownComponents = null!;
|
||||||
|
private Drawable countdownBackground = null!;
|
||||||
|
private SpriteText countdownText = null!;
|
||||||
|
private CircularProgress countdownProgress = null!;
|
||||||
|
|
||||||
|
private Sample? sampleCountdown;
|
||||||
|
|
||||||
|
public DelayedResumeOverlay()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
Add(outerContent = new Circle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(outer_size),
|
||||||
|
Colour = colourProvider.Background6,
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(innerContent = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
countdownBackground = new Circle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(inner_size),
|
||||||
|
Colour = colourProvider.Background4,
|
||||||
|
},
|
||||||
|
countdownComponents = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
countdownProgress = new CircularProgress
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(progress_size),
|
||||||
|
InnerRadius = progress_stroke_width / progress_size,
|
||||||
|
RoundedCaps = true
|
||||||
|
},
|
||||||
|
countdownText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
UseFullGlyphHeight = false,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
Font = OsuFont.Torus.With(size: 70, weight: FontWeight.Light)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
sampleCountdown = audio.Samples.Get(@"Gameplay/resume-countdown");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopIn()
|
||||||
|
{
|
||||||
|
this.FadeIn();
|
||||||
|
|
||||||
|
// The transition effects.
|
||||||
|
outerContent.FadeIn().ScaleTo(Vector2.Zero).Then().ScaleTo(Vector2.One, 200, Easing.OutQuint);
|
||||||
|
innerContent.FadeIn().ScaleTo(Vector2.Zero).Then().ScaleTo(Vector2.One, 400, Easing.OutElasticHalf);
|
||||||
|
countdownComponents.FadeOut().Delay(50).FadeTo(1, 100);
|
||||||
|
|
||||||
|
// Reset states for various components.
|
||||||
|
countdownBackground.FadeIn();
|
||||||
|
countdownText.FadeIn();
|
||||||
|
countdownProgress.FadeIn().ScaleTo(1);
|
||||||
|
|
||||||
|
countdownComplete = false;
|
||||||
|
countdownCount = null;
|
||||||
|
countdownStartTime = Time.Current;
|
||||||
|
|
||||||
|
scheduledResume?.Cancel();
|
||||||
|
scheduledResume = Scheduler.AddDelayed(() =>
|
||||||
|
{
|
||||||
|
countdownComplete = true;
|
||||||
|
Resume();
|
||||||
|
}, countdown_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopOut()
|
||||||
|
{
|
||||||
|
this.Delay(300).FadeOut();
|
||||||
|
|
||||||
|
outerContent.FadeOut();
|
||||||
|
countdownBackground.FadeOut();
|
||||||
|
countdownText.FadeOut();
|
||||||
|
|
||||||
|
if (countdownComplete)
|
||||||
|
{
|
||||||
|
countdownProgress.ScaleTo(2f, 300, Easing.OutQuint);
|
||||||
|
countdownProgress.FadeOut(300, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
countdownProgress.FadeOut();
|
||||||
|
|
||||||
|
scheduledResume?.Cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
updateCountdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCountdown()
|
||||||
|
{
|
||||||
|
double amountTimePassed = Math.Min(countdown_time, Time.Current - countdownStartTime) / countdown_time;
|
||||||
|
int newCount = 3 - (int)Math.Floor(amountTimePassed * 3);
|
||||||
|
|
||||||
|
countdownProgress.Progress = amountTimePassed;
|
||||||
|
countdownProgress.InnerRadius = progress_stroke_width / progress_size / countdownProgress.Scale.X;
|
||||||
|
|
||||||
|
if (countdownCount != newCount)
|
||||||
|
{
|
||||||
|
if (newCount > 0)
|
||||||
|
{
|
||||||
|
countdownText.Text = Math.Max(1, newCount).ToString();
|
||||||
|
countdownText.ScaleTo(0.25f).Then().ScaleTo(1, 200, Easing.OutQuint);
|
||||||
|
outerContent.Delay(25).Then().ScaleTo(1.05f, 100).Then().ScaleTo(1f, 200, Easing.Out);
|
||||||
|
|
||||||
|
countdownBackground.FlashColour(colourProvider.Background3, 400, Easing.Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
var chan = sampleCountdown?.GetChannel();
|
||||||
|
|
||||||
|
if (chan != null)
|
||||||
|
{
|
||||||
|
chan.Frequency.Value = newCount == 0 ? 0.5f : 1;
|
||||||
|
chan.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
countdownCount = newCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -110,8 +110,8 @@ namespace osu.Game.Screens.Play
|
|||||||
&& ReadyForGameplay;
|
&& ReadyForGameplay;
|
||||||
|
|
||||||
protected virtual bool ReadyForGameplay =>
|
protected virtual bool ReadyForGameplay =>
|
||||||
// not ready if the user is hovering one of the panes, unless they are idle.
|
// not ready if the user is hovering one of the panes (logo is excluded), unless they are idle.
|
||||||
(IsHovered || idleTracker.IsIdle.Value)
|
(IsHovered || osuLogo?.IsHovered == true || idleTracker.IsIdle.Value)
|
||||||
// not ready if the user is dragging a slider or otherwise.
|
// not ready if the user is dragging a slider or otherwise.
|
||||||
&& inputManager.DraggedDrawable == null
|
&& inputManager.DraggedDrawable == null
|
||||||
// not ready if a focused overlay is visible, like settings.
|
// not ready if a focused overlay is visible, like settings.
|
||||||
@ -335,10 +335,14 @@ namespace osu.Game.Screens.Play
|
|||||||
return base.OnExiting(e);
|
return base.OnExiting(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OsuLogo? osuLogo;
|
||||||
|
|
||||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||||
{
|
{
|
||||||
base.LogoArriving(logo, resuming);
|
base.LogoArriving(logo, resuming);
|
||||||
|
|
||||||
|
osuLogo = logo;
|
||||||
|
|
||||||
const double duration = 300;
|
const double duration = 300;
|
||||||
|
|
||||||
if (!resuming) logo.MoveTo(new Vector2(0.5f), duration, Easing.OutQuint);
|
if (!resuming) logo.MoveTo(new Vector2(0.5f), duration, Easing.OutQuint);
|
||||||
@ -357,6 +361,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.LogoExiting(logo);
|
base.LogoExiting(logo);
|
||||||
content.StopTracking();
|
content.StopTracking();
|
||||||
|
osuLogo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LogoSuspending(OsuLogo logo)
|
protected override void LogoSuspending(OsuLogo logo)
|
||||||
@ -367,6 +372,8 @@ namespace osu.Game.Screens.Play
|
|||||||
logo
|
logo
|
||||||
.FadeOut(CONTENT_OUT_DURATION / 2, Easing.OutQuint)
|
.FadeOut(CONTENT_OUT_DURATION / 2, Easing.OutQuint)
|
||||||
.ScaleTo(logo.Scale * 0.8f, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
.ScaleTo(logo.Scale * 0.8f, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||||
|
|
||||||
|
osuLogo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Cursor;
|
|||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract partial class ResumeOverlay : VisibilityContainer
|
public abstract partial class ResumeOverlay : VisibilityContainer
|
||||||
{
|
{
|
||||||
public CursorContainer GameplayCursor { get; set; }
|
public GameplayCursorContainer GameplayCursor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The action to be performed to complete resuming.
|
/// The action to be performed to complete resuming.
|
||||||
|
@ -69,6 +69,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
default:
|
default:
|
||||||
case SortMode.Artist:
|
case SortMode.Artist:
|
||||||
comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist);
|
comparison = OrdinalSortByCaseStringComparer.DEFAULT.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist);
|
||||||
|
if (comparison == 0)
|
||||||
|
goto case SortMode.Title;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SortMode.Title:
|
case SortMode.Title:
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -11,6 +13,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Updater
|
namespace osu.Game.Updater
|
||||||
@ -51,6 +54,9 @@ namespace osu.Game.Updater
|
|||||||
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
|
// only show a notification if we've previously saved a version to the config file (ie. not the first run).
|
||||||
if (!string.IsNullOrEmpty(lastVersion))
|
if (!string.IsNullOrEmpty(lastVersion))
|
||||||
Notifications.Post(new UpdateCompleteNotification(version));
|
Notifications.Post(new UpdateCompleteNotification(version));
|
||||||
|
|
||||||
|
if (RuntimeInfo.EntryAssembly.GetCustomAttribute<OfficialBuildAttribute>() == null)
|
||||||
|
Notifications.Post(new SimpleNotification { Text = NotificationsStrings.NotOfficialBuild });
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug / local compilations will reset to a non-release string.
|
// debug / local compilations will reset to a non-release string.
|
||||||
|
12
osu.Game/Utils/OfficialBuildAttribute.cs
Normal file
12
osu.Game/Utils/OfficialBuildAttribute.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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 JetBrains.Annotations;
|
||||||
|
|
||||||
|
namespace osu.Game.Utils
|
||||||
|
{
|
||||||
|
[UsedImplicitly]
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly)]
|
||||||
|
public class OfficialBuildAttribute : Attribute;
|
||||||
|
}
|
@ -36,7 +36,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Realm" Version="11.5.0" />
|
<PackageReference Include="Realm" Version="11.5.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2024.306.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2024.306.0" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.309.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.321.0" />
|
||||||
<PackageReference Include="Sentry" Version="3.41.3" />
|
<PackageReference Include="Sentry" Version="3.41.3" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
<PackageReference Include="SharpCompress" Version="0.36.0" />
|
<PackageReference Include="SharpCompress" Version="0.36.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user