mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Refactor logic slightly to display team seed everywhere
This change makes the team seed display in "team intro" screen as well.
This commit is contained in:
parent
81c1634d44
commit
7083c04c59
@ -101,7 +101,7 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
Cell(i).AddRange(new Drawable[]
|
||||
{
|
||||
new TournamentSpriteText { Text = "TeamDisplay" },
|
||||
new TeamDisplay(team, TeamColour.Red, new Bindable<int?>(2), 6, true)
|
||||
new TeamDisplay(team, TeamColour.Red, new Bindable<int?>(2), 6)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
39
osu.Game.Tournament/Components/DrawableTeamSeed.cs
Normal file
39
osu.Game.Tournament/Components/DrawableTeamSeed.cs
Normal file
@ -0,0 +1,39 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Tournament.Models;
|
||||
|
||||
namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public partial class DrawableTeamSeed : TournamentSpriteTextWithBackground
|
||||
{
|
||||
private readonly TournamentTeam? team;
|
||||
|
||||
private IBindable<string> seed = null!;
|
||||
private Bindable<bool> displaySeed = null!;
|
||||
|
||||
public DrawableTeamSeed(TournamentTeam? team)
|
||||
{
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private LadderInfo ladder { get; set; } = null!;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
seed = team.Seed.GetBoundCopy();
|
||||
seed.BindValueChanged(s => Text.Text = s.NewValue, true);
|
||||
|
||||
displaySeed = ladder.DisplayTeamSeeds.GetBoundCopy();
|
||||
displaySeed.BindValueChanged(v => Alpha = v.NewValue ? 1 : 0, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,17 @@ namespace osu.Game.Tournament.Components
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DrawableTeamHeader(colour),
|
||||
new DrawableTeamTitle(team),
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DrawableTeamTitle(team),
|
||||
new DrawableTeamSeed(team),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Tournament.Components;
|
||||
@ -17,8 +16,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
private TeamScoreDisplay teamDisplay2 = null!;
|
||||
private DrawableTournamentHeaderLogo logo = null!;
|
||||
|
||||
public readonly BindableBool DisplaySeeds = new BindableBool();
|
||||
|
||||
private bool showScores = true;
|
||||
|
||||
public bool ShowScores
|
||||
@ -91,13 +88,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
DisplaySeed = { BindTarget = DisplaySeeds },
|
||||
},
|
||||
teamDisplay2 = new TeamScoreDisplay(TeamColour.Blue)
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
DisplaySeed = { BindTarget = DisplaySeeds },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -15,10 +15,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
private readonly TeamScore score;
|
||||
|
||||
private readonly TournamentSpriteTextWithBackground teamNameText;
|
||||
private readonly TournamentSpriteTextWithBackground teamSeedText;
|
||||
|
||||
private readonly Bindable<string> teamName = new Bindable<string>("???");
|
||||
private readonly Bindable<string> teamSeed = new Bindable<string>();
|
||||
|
||||
private bool showScore;
|
||||
|
||||
@ -37,7 +35,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
}
|
||||
}
|
||||
|
||||
public TeamDisplay(TournamentTeam? team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin, bool displaySeed)
|
||||
public TeamDisplay(TournamentTeam? team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin)
|
||||
: base(team)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
@ -112,13 +110,12 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
},
|
||||
teamSeedText = new TournamentSpriteTextWithBackground
|
||||
new DrawableTeamSeed(Team)
|
||||
{
|
||||
Scale = new Vector2(0.5f),
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
Alpha = displaySeed ? 1 : 0,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -137,13 +134,9 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
FinishTransforms(true);
|
||||
|
||||
if (Team != null)
|
||||
{
|
||||
teamName.BindTo(Team.FullName);
|
||||
teamSeed.BindTo(Team.Seed);
|
||||
}
|
||||
|
||||
teamName.BindValueChanged(name => teamNameText.Text.Text = name.NewValue, true);
|
||||
teamSeed.BindValueChanged(seed => teamSeedText.Text.Text = seed.NewValue, true);
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
private TeamDisplay? teamDisplay;
|
||||
|
||||
public readonly BindableBool DisplaySeed = new BindableBool();
|
||||
|
||||
public bool ShowScore
|
||||
{
|
||||
get => teamDisplay?.ShowScore ?? false;
|
||||
@ -50,7 +48,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
|
||||
currentTeam.BindValueChanged(teamChanged);
|
||||
DisplaySeed.BindValueChanged(_ => currentTeam.TriggerChange());
|
||||
|
||||
updateMatch();
|
||||
}
|
||||
@ -104,7 +101,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0, DisplaySeed.Value),
|
||||
teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
|
||||
};
|
||||
|
||||
teamDisplay.ShowScore = wasShowingScores;
|
||||
|
@ -50,7 +50,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
header = new MatchHeader
|
||||
{
|
||||
ShowLogo = false,
|
||||
DisplaySeeds = { BindTarget = LadderInfo.DisplayTeamSeeds },
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
@ -50,7 +50,6 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
new MatchHeader
|
||||
{
|
||||
ShowScores = true,
|
||||
DisplaySeeds = { BindTarget = LadderInfo.DisplayTeamSeeds },
|
||||
},
|
||||
mapFlows = new FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user