1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 03:13:22 +08:00

Merge branch 'master' into beatmap-defaults-match-stable

This commit is contained in:
Bartłomiej Dach 2024-11-25 12:55:08 +01:00
commit 78c01c1b5a
No known key found for this signature in database
14 changed files with 105 additions and 49 deletions

View File

@ -18,6 +18,7 @@ using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Mods;
@ -207,7 +208,25 @@ namespace osu.Game.Tests.Visual.Gameplay
}
[Test]
public void TestBlockLoadViaFocus()
public void TestLoadNotBlockedViaArbitraryFocus()
{
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
AddUntilStep("click settings slider", () =>
{
InputManager.MoveMouseTo(loader.ChildrenOfType<OsuSliderBar<float>>().First());
InputManager.Click(MouseButton.Left);
return InputManager.FocusedDrawable is OsuSliderBar<float>;
});
AddUntilStep("wait for load ready", () => player?.LoadState == LoadState.Ready);
AddUntilStep("loads", () => !loader.IsCurrentScreen());
}
[Test]
public void TestBlockLoadViaOverlayFocus()
{
AddStep("load dummy beatmap", () => resetPlayer(false));
AddUntilStep("wait for current", () => loader.IsCurrentScreen());

View File

@ -7,7 +7,7 @@ using osu.Game.Online.API;
namespace osu.Game.Online.Rooms
{
public class JoinRoomRequest : APIRequest
public class JoinRoomRequest : APIRequest<Room>
{
public readonly Room Room;
public readonly string? Password;

View File

@ -366,12 +366,8 @@ namespace osu.Game.Online.Rooms
{
RoomID = other.RoomID;
Name = other.Name;
Category = other.Category;
if (other.Host != null && Host?.Id != other.Host.Id)
Host = other.Host;
Host = other.Host;
ChannelId = other.ChannelId;
Status = other.Status;
Availability = other.Availability;
@ -387,22 +383,10 @@ namespace osu.Game.Online.Rooms
PlaylistItemStats = other.PlaylistItemStats;
CurrentPlaylistItem = other.CurrentPlaylistItem;
AutoSkip = other.AutoSkip;
other.RemoveExpiredPlaylistItems();
Playlist = other.Playlist;
RecentParticipants = other.RecentParticipants;
}
public void RemoveExpiredPlaylistItems()
{
// Todo: This is not the best way/place to do this, but the intention is to display all playlist items when the room has ended,
// and display only the non-expired playlist items while the room is still active. In order to achieve this, all expired items are removed from the source Room.
// More refactoring is required before this can be done locally instead - DrawableRoomPlaylist is currently directly bound to the playlist to display items in the room.
if (Status is not RoomStatusEnded)
Playlist = Playlist.Where(i => !i.Expired).ToArray();
}
[JsonObject(MemberSerialization.OptIn)]
public class RoomPlaylistItemStats
{

View File

@ -268,7 +268,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private void updateScreenModeWarning()
{
if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS)
// Can be removed once we stop supporting SDL2.
if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS && !FrameworkEnvironment.UseSDL3)
{
if (windowModeDropdown.Current.Value == WindowMode.Fullscreen)
windowModeDropdown.SetNoticeText(LayoutSettingsStrings.FullscreenMacOSNote, true);

View File

@ -118,7 +118,6 @@ namespace osu.Game.Screens.Menu
"You can create mod presets to make toggling your favorite mod combinations easier!",
"Many mods have customisation settings that drastically change how they function. Click the Mod Customisation button in mod select to view settings!",
"Press Ctrl-Shift-R to switch to a random skin!",
"Press Ctrl-Shift-F to toggle the FPS Counter. But make sure not to pay too much attention to it!",
"While watching a replay, press Ctrl-H to toggle replay settings!",
"You can easily copy the mods from scores on a leaderboard by right-clicking on them!",
"Ctrl-Enter at song select will start a beatmap in autoplay mode!"

View File

@ -8,6 +8,9 @@ using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
@ -27,26 +30,60 @@ namespace osu.Game.Screens.Menu
public SongTicker()
{
AutoSizeAxes = Axes.Both;
Child = new FillFlowContainer
InternalChildren = new Drawable[]
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 3),
Children = new Drawable[]
new Container
{
title = new OsuSpriteText
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Position = new Vector2(5, -5),
Padding = new MarginPadding(-5),
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light, italics: true)
},
artist = new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.GetFont(size: 16)
new CircularContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
EdgeEffect = new EdgeEffectParameters
{
Radius = 75,
Type = EdgeEffectType.Shadow,
Colour = OsuColour.Gray(0.04f).Opacity(0.3f),
},
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
Alpha = 0,
},
}
},
}
}
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 3),
Children = new Drawable[]
{
title = new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light, italics: true)
},
artist = new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.GetFont(size: 16)
}
}
},
};
}

View File

@ -60,10 +60,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
}
foreach (var incoming in result)
{
incoming.RemoveExpiredPlaylistItems();
RoomManager.AddOrUpdateRoom(incoming);
}
initialRoomsReceived.Value = true;
tcs.SetResult(true);

View File

@ -72,9 +72,13 @@ namespace osu.Game.Screens.OnlinePlay.Components
currentJoinRoomRequest?.Cancel();
currentJoinRoomRequest = new JoinRoomRequest(room, password);
currentJoinRoomRequest.Success += () =>
currentJoinRoomRequest.Success += result =>
{
joinedRoom.Value = room;
AddOrUpdateRoom(result);
room.CopyFrom(result); // Also copy back to the source model, since this is likely to have been stored elsewhere.
onSuccess?.Invoke(room);
};

View File

@ -36,7 +36,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
req.Success += result =>
{
result.RemoveExpiredPlaylistItems();
RoomManager.AddOrUpdateRoom(result);
tcs.SetResult(true);
};

View File

@ -438,7 +438,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
=> MaxParticipantsField.Text = room.MaxParticipants?.ToString();
private void updateRoomAutoStartDuration()
=> typeLabel.Text = room.AutoStartDuration.GetLocalisableDescription();
=> startModeDropdown.Current.Value = (StartMode)room.AutoStartDuration.TotalSeconds;
private void updateRoomPlaylist()
=> drawablePlaylist.Items.ReplaceRange(0, drawablePlaylist.Items.Count, room.Playlist);

View File

@ -299,7 +299,13 @@ namespace osu.Game.Screens.Play.HUD
{
case GlobalAction.Back:
if (!pendingAnimation)
Confirm();
{
if (IsDangerousAction)
BeginConfirm();
else
Confirm();
}
return true;
case GlobalAction.PauseGameplay:
@ -307,7 +313,13 @@ namespace osu.Game.Screens.Play.HUD
if (ReplayLoaded.Value) return false;
if (!pendingAnimation)
Confirm();
{
if (IsDangerousAction)
BeginConfirm();
else
Confirm();
}
return true;
}

View File

@ -976,7 +976,9 @@ namespace osu.Game.Screens.Play
if (PauseOverlay.State.Value == Visibility.Visible)
PauseOverlay.Hide();
failAnimationContainer.Start();
bool restartOnFail = GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail);
if (!restartOnFail)
failAnimationContainer.Start();
// Failures can be triggered either by a judgement, or by a mod.
//
@ -990,7 +992,7 @@ namespace osu.Game.Screens.Play
ScoreProcessor.FailScore(Score.ScoreInfo);
OnFail();
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
if (restartOnFail)
Restart(true);
});
}

View File

@ -122,7 +122,9 @@ namespace osu.Game.Screens.Play
// not ready if the user is dragging a slider or otherwise.
&& (inputManager.DraggedDrawable == null || inputManager.DraggedDrawable is OsuLogo)
// not ready if a focused overlay is visible, like settings.
&& inputManager.FocusedDrawable == null;
&& inputManager.FocusedDrawable is not OsuFocusedOverlayContainer
// or if a child of a focused overlay is focused, like settings' search textbox.
&& inputManager.FocusedDrawable?.FindClosestParent<OsuFocusedOverlayContainer>() == null;
private readonly Func<Player> createPlayer;

View File

@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
return true;
}
joinRoomRequest.TriggerSuccess();
joinRoomRequest.TriggerSuccess(createResponseRoom(room, true));
return true;
}