1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Merge branch 'master' into editor-escape-deselects

This commit is contained in:
Bartłomiej Dach 2023-05-24 20:18:44 +02:00
commit 8b6cd1310a
No known key found for this signature in database
3 changed files with 19 additions and 68 deletions

View File

@ -23,7 +23,6 @@ namespace osu.Game.Screens.Play
public Func<Task<ScoreInfo>> SaveReplay; public Func<Task<ScoreInfo>> SaveReplay;
public override string Header => "failed"; public override string Header => "failed";
public override string Description => "you're dead, try again?";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)

View File

@ -1,12 +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.
#nullable disable
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Humanizer;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -38,8 +35,8 @@ namespace osu.Game.Screens.Play
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public Action OnRetry; public Action? OnRetry;
public Action OnQuit; public Action? OnQuit;
/// <summary> /// <summary>
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered. /// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
@ -53,12 +50,13 @@ namespace osu.Game.Screens.Play
public abstract string Header { get; } public abstract string Header { get; }
public abstract string Description { get; } protected SelectionCycleFillFlowContainer<DialogButton> InternalButtons = null!;
protected SelectionCycleFillFlowContainer<DialogButton> InternalButtons;
public IReadOnlyList<DialogButton> Buttons => InternalButtons; public IReadOnlyList<DialogButton> Buttons => InternalButtons;
private FillFlowContainer retryCounterContainer; private TextFlowContainer playInfoText = null!;
[Resolved]
private GlobalActionContainer globalAction { get; set; } = null!;
protected GameplayMenuOverlay() protected GameplayMenuOverlay()
{ {
@ -85,37 +83,14 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Children = new Drawable[] Children = new Drawable[]
{
new FillFlowContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{ {
new OsuSpriteText new OsuSpriteText
{ {
Text = Header, Text = Header,
Font = OsuFont.GetFont(size: 30), Font = OsuFont.GetFont(size: 48),
Spacing = new Vector2(5, 0),
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Colour = colours.Yellow, Colour = colours.Yellow,
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f)
},
new OsuSpriteText
{
Text = Description,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f)
}
}
}, },
InternalButtons = new SelectionCycleFillFlowContainer<DialogButton> InternalButtons = new SelectionCycleFillFlowContainer<DialogButton>
{ {
@ -132,10 +107,11 @@ namespace osu.Game.Screens.Play
Radius = 50 Radius = 50
}, },
}, },
retryCounterContainer = new FillFlowContainer playInfoText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.GetFont(size: 18))
{ {
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
TextAnchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
} }
} }
@ -157,7 +133,8 @@ namespace osu.Game.Screens.Play
return; return;
retries = value; retries = value;
if (retryCounterContainer != null)
if (IsLoaded)
updateRetryCount(); updateRetryCount();
} }
} }
@ -170,7 +147,7 @@ namespace osu.Game.Screens.Play
protected override bool OnMouseMove(MouseMoveEvent e) => true; protected override bool OnMouseMove(MouseMoveEvent e) => true;
protected void AddButton(string text, Color4 colour, Action action) protected void AddButton(string text, Color4 colour, Action? action)
{ {
var button = new Button var button = new Button
{ {
@ -222,30 +199,9 @@ namespace osu.Game.Screens.Play
// "You've retried 1,065 times in this session" // "You've retried 1,065 times in this session"
// "You've retried 1 time in this session" // "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[] playInfoText.Clear();
{ playInfoText.AddText("Retry count: ");
new OsuSpriteText playInfoText.AddText(retries.ToString(), cp => cp.Font = cp.Font.With(weight: FontWeight.Bold));
{
Text = "You've retried ",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
Font = OsuFont.GetFont(size: 18),
},
new OsuSpriteText
{
Text = "time".ToQuantity(retries),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
},
new OsuSpriteText
{
Text = " in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
Font = OsuFont.GetFont(size: 18),
}
};
} }
private partial class Button : DialogButton private partial class Button : DialogButton
@ -260,9 +216,6 @@ namespace osu.Game.Screens.Play
} }
} }
[Resolved]
private GlobalActionContainer globalAction { get; set; }
protected override bool Handle(UIEvent e) protected override bool Handle(UIEvent e)
{ {
switch (e) switch (e)

View File

@ -24,7 +24,6 @@ namespace osu.Game.Screens.Play
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying; public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
public override string Header => "paused"; public override string Header => "paused";
public override string Description => "you're not going to do what i think you're going to do, are ya?";
private SkinnableSound pauseLoop; private SkinnableSound pauseLoop;