1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +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 override string Header => "failed";
public override string Description => "you're dead, try again?";
[BackgroundDependencyLoader]
private void load(OsuColour colours)

View File

@ -1,12 +1,9 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using System.Collections.Generic;
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -38,8 +35,8 @@ namespace osu.Game.Screens.Play
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public Action OnRetry;
public Action OnQuit;
public Action? OnRetry;
public Action? OnQuit;
/// <summary>
/// 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 Description { get; }
protected SelectionCycleFillFlowContainer<DialogButton> InternalButtons;
protected SelectionCycleFillFlowContainer<DialogButton> InternalButtons = null!;
public IReadOnlyList<DialogButton> Buttons => InternalButtons;
private FillFlowContainer retryCounterContainer;
private TextFlowContainer playInfoText = null!;
[Resolved]
private GlobalActionContainer globalAction { get; set; } = null!;
protected GameplayMenuOverlay()
{
@ -85,37 +83,14 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
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
{
Text = Header,
Font = OsuFont.GetFont(size: 30),
Spacing = new Vector2(5, 0),
Font = OsuFont.GetFont(size: 48),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
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>
{
@ -132,10 +107,11 @@ namespace osu.Game.Screens.Play
Radius = 50
},
},
retryCounterContainer = new FillFlowContainer
playInfoText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.GetFont(size: 18))
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
TextAnchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
}
}
@ -157,7 +133,8 @@ namespace osu.Game.Screens.Play
return;
retries = value;
if (retryCounterContainer != null)
if (IsLoaded)
updateRetryCount();
}
}
@ -170,7 +147,7 @@ namespace osu.Game.Screens.Play
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
{
@ -222,30 +199,9 @@ namespace osu.Game.Screens.Play
// "You've retried 1,065 times in this session"
// "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[]
{
new OsuSpriteText
{
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),
}
};
playInfoText.Clear();
playInfoText.AddText("Retry count: ");
playInfoText.AddText(retries.ToString(), cp => cp.Font = cp.Font.With(weight: FontWeight.Bold));
}
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)
{
switch (e)

View File

@ -24,7 +24,6 @@ namespace osu.Game.Screens.Play
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
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;