2019-03-04 04:24:19 +00:00
|
|
|
// 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.
|
2018-09-24 15:57:44 +00:00
|
|
|
|
2019-06-14 11:30:09 +00:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
using osu.Framework.Bindables;
|
2018-09-24 15:57:44 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-05-15 04:10:58 +00:00
|
|
|
using osu.Game.Graphics;
|
2019-06-18 05:51:48 +00:00
|
|
|
using osu.Game.Tournament.Models;
|
2018-09-24 15:57:44 +00:00
|
|
|
|
2018-09-24 19:21:48 +00:00
|
|
|
namespace osu.Game.Tournament.Screens.Ladder.Components
|
2018-09-24 15:57:44 +00:00
|
|
|
{
|
2019-06-18 05:44:15 +00:00
|
|
|
public class DrawableTournamentRound : CompositeDrawable
|
2018-09-24 15:57:44 +00:00
|
|
|
{
|
2019-06-14 11:30:09 +00:00
|
|
|
[UsedImplicitly]
|
|
|
|
private readonly Bindable<string> name;
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
private readonly Bindable<string> description;
|
|
|
|
|
2019-06-18 05:44:15 +00:00
|
|
|
public DrawableTournamentRound(TournamentRound round, bool losers = false)
|
2018-09-24 15:57:44 +00:00
|
|
|
{
|
2020-03-03 10:14:44 +00:00
|
|
|
TournamentSpriteText textName;
|
|
|
|
TournamentSpriteText textDescription;
|
2019-06-14 11:30:09 +00:00
|
|
|
|
2018-09-24 15:57:44 +00:00
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2020-03-03 10:14:44 +00:00
|
|
|
textDescription = new TournamentSpriteText
|
2018-09-24 15:57:44 +00:00
|
|
|
{
|
2020-03-06 16:37:15 +00:00
|
|
|
Colour = TournamentGame.TEXT_COLOUR,
|
2018-09-24 15:57:44 +00:00
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Anchor = Anchor.TopCentre
|
|
|
|
},
|
2020-03-03 10:14:44 +00:00
|
|
|
textName = new TournamentSpriteText
|
2018-09-24 15:57:44 +00:00
|
|
|
{
|
2020-03-03 10:14:44 +00:00
|
|
|
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
|
2020-03-06 16:37:15 +00:00
|
|
|
Colour = TournamentGame.TEXT_COLOUR,
|
2018-09-24 15:57:44 +00:00
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Anchor = Anchor.TopCentre
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
2019-06-14 11:30:09 +00:00
|
|
|
|
2019-06-18 05:44:15 +00:00
|
|
|
name = round.Name.GetBoundCopy();
|
|
|
|
name.BindValueChanged(n => textName.Text = ((losers ? "Losers " : "") + round.Name).ToUpper(), true);
|
2019-06-14 11:30:09 +00:00
|
|
|
|
2019-06-21 11:29:24 +00:00
|
|
|
description = round.Description.GetBoundCopy();
|
|
|
|
description.BindValueChanged(n => textDescription.Text = round.Description.Value?.ToUpper(), true);
|
2018-09-24 15:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|