Add message box in bracket editor explaining how to get started

This commit is contained in:
Dean Herbert 2020-09-02 15:18:51 +09:00
parent dda776d15f
commit 5195da3ceb
3 changed files with 53 additions and 24 deletions

View File

@ -26,6 +26,8 @@ public class LadderEditorScreen : LadderScreen, IHasContextMenu
[Cached] [Cached]
private LadderEditorInfo editorInfo = new LadderEditorInfo(); private LadderEditorInfo editorInfo = new LadderEditorInfo();
private WarningBox rightClickMessage;
protected override bool DrawLoserPaths => true; protected override bool DrawLoserPaths => true;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -37,6 +39,16 @@ private void load()
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Margin = new MarginPadding(5) Margin = new MarginPadding(5)
}); });
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
LadderInfo.Matches.CollectionChanged += (_, __) => updateMessage();
updateMessage();
}
private void updateMessage()
{
rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;
} }
public void BeginJoin(TournamentMatch match, bool losers) public void BeginJoin(TournamentMatch match, bool losers)

View File

@ -87,30 +87,7 @@ private void load(FrameworkConfigManager frameworkConfig)
}, },
} }
}, },
heightWarning = new Container heightWarning = new WarningBox("Please make the window wider"),
{
Masking = true,
CornerRadius = 5,
Depth = float.MinValue,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Red,
RelativeSizeAxes = Axes.Both,
},
new TournamentSpriteText
{
Text = "Please make the window wider",
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
Colour = Color4.White,
Padding = new MarginPadding(20)
}
}
},
new OsuContextMenuContainer new OsuContextMenuContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -0,0 +1,40 @@
// 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 osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Tournament
{
internal class WarningBox : Container
{
public WarningBox(string text)
{
Masking = true;
CornerRadius = 5;
Depth = float.MinValue;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new Box
{
Colour = Color4.Red,
RelativeSizeAxes = Axes.Both,
},
new TournamentSpriteText
{
Text = text,
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
Colour = Color4.White,
Padding = new MarginPadding(20)
}
};
}
}
}