Merge branch 'master' into tournament-design-gameplay

This commit is contained in:
Dan Balasescu
2020-03-09 19:33:53 +09:00
committed by GitHub
7 changed files with 110 additions and 262 deletions

View File

@ -64,6 +64,12 @@ namespace osu.Game.Tournament.Components
} }
} }
public void Reset()
{
if (manualClock != null)
manualClock.CurrentTime = 0;
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();

View File

@ -27,12 +27,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private readonly bool losers; private readonly bool losers;
private TournamentSpriteText scoreText; private TournamentSpriteText scoreText;
private Box background; private Box background;
private Box backgroundRight;
private readonly Bindable<int?> score = new Bindable<int?>(); private readonly Bindable<int?> score = new Bindable<int?>();
private readonly BindableBool completed = new BindableBool(); private readonly BindableBool completed = new BindableBool();
private Color4 colourWinner; private Color4 colourWinner;
private Color4 colourNormal;
private readonly Func<bool> isWinner; private readonly Func<bool> isWinner;
private LadderEditorScreen ladderEditor; private LadderEditorScreen ladderEditor;
@ -62,15 +62,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
this.losers = losers; this.losers = losers;
Size = new Vector2(150, 40); Size = new Vector2(150, 40);
Masking = true;
CornerRadius = 5;
Flag.Scale = new Vector2(0.9f); Flag.Scale = new Vector2(0.9f);
Flag.Anchor = Flag.Origin = Anchor.CentreLeft; Flag.Anchor = Flag.Origin = Anchor.CentreLeft;
AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft; AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
AcronymText.Padding = new MarginPadding { Left = 50 }; AcronymText.Padding = new MarginPadding { Left = 50 };
AcronymText.Font = OsuFont.Torus.With(size: 24); AcronymText.Font = OsuFont.Torus.With(size: 22, weight: FontWeight.Bold);
if (match != null) if (match != null)
{ {
@ -87,8 +84,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
this.ladderEditor = ladderEditor; this.ladderEditor = ladderEditor;
colourWinner = losers ? colours.YellowDarker : colours.BlueDarker; colourWinner = losers
colourNormal = OsuColour.Gray(0.2f); ? OsuColour.FromHex("#8E7F48")
: OsuColour.FromHex("#1462AA");
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -104,17 +102,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
AcronymText, AcronymText,
Flag, Flag,
}
},
new Container new Container
{ {
Masking = true, Masking = true,
CornerRadius = 5,
Width = 0.3f, Width = 0.3f,
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box backgroundRight = new Box
{ {
Colour = OsuColour.Gray(0.1f), Colour = OsuColour.Gray(0.1f),
Alpha = 0.8f, Alpha = 0.8f,
@ -124,9 +123,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.Torus.With(size: 20), Font = OsuFont.Torus.With(size: 22),
}
}
} }
} }
} }
@ -183,9 +180,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
bool winner = completed.Value && isWinner?.Invoke() == true; bool winner = completed.Value && isWinner?.Invoke() == true;
background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); background.FadeColour(winner ? Color4.White : OsuColour.FromHex("#444"), winner ? 500 : 0, Easing.OutQuint);
backgroundRight.FadeColour(winner ? colourWinner : OsuColour.FromHex("#333"), winner ? 500 : 0, Easing.OutQuint);
scoreText.Font = AcronymText.Font = OsuFont.Torus.With(weight: winner ? FontWeight.Bold : FontWeight.Regular); AcronymText.Colour = winner ? Color4.Black : Color4.White;
scoreText.Font = scoreText.Font.With(weight: winner ? FontWeight.Bold : FontWeight.Regular);
} }
public MenuItem[] ContextMenuItems public MenuItem[] ContextMenuItems

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -45,9 +46,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
selectionBox = new Container selectionBox = new Container
{ {
CornerRadius = 5, Scale = new Vector2(1.1f),
Masking = true,
Scale = new Vector2(1.05f),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -57,14 +56,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
}, },
currentMatchSelectionBox = new Container currentMatchSelectionBox = new Container
{ {
CornerRadius = 5, Scale = new Vector2(1.1f),
Masking = true,
Scale = new Vector2(1.05f),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Alpha = 0, Alpha = 0,
Colour = Color4.OrangeRed, Colour = OsuColour.FromHex("#D24747"),
Child = new Box { RelativeSizeAxes = Axes.Both } Child = new Box { RelativeSizeAxes = Axes.Both }
}, },
Flow = new FillFlowContainer<DrawableMatchTeam> Flow = new FillFlowContainer<DrawableMatchTeam>

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Ladder.Components namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
@ -33,14 +32,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
textDescription = new TournamentSpriteText textDescription = new TournamentSpriteText
{ {
Colour = Color4.Black, Colour = TournamentGame.TEXT_COLOUR,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre
}, },
textName = new TournamentSpriteText textName = new TournamentSpriteText
{ {
Font = OsuFont.Torus.With(weight: FontWeight.Bold), Font = OsuFont.Torus.With(weight: FontWeight.Bold),
Colour = Color4.Black, Colour = TournamentGame.TEXT_COLOUR,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre
}, },

View File

@ -32,8 +32,8 @@ namespace osu.Game.Tournament.Screens.Ladder
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, Storage storage) private void load(OsuColour colours, Storage storage)
{ {
normalPathColour = colours.BlueDarker.Darken(2); normalPathColour = OsuColour.FromHex("#66D1FF");
losersPathColour = colours.YellowDarker.Darken(2); losersPathColour = OsuColour.FromHex("#FFC700");
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -47,6 +47,12 @@ namespace osu.Game.Tournament.Screens.Ladder
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
new DrawableTournamentTitleText
{
Y = 100,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
ScrollContent = new LadderDragContainer ScrollContent = new LadderDragContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
@ -49,141 +48,33 @@ namespace osu.Game.Tournament.Screens.TeamIntro
return; return;
} }
const float y_flag_offset = 292;
const float y_offset = 460;
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamWithPlayers(match.NewValue.Team1.Value, true)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight
},
new TeamWithPlayers(match.NewValue.Team2.Value)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft
},
new RoundDisplay(match.NewValue) new RoundDisplay(match.NewValue)
{ {
RelativeSizeAxes = Axes.Both, Position = new Vector2(100, 100)
Height = 0.25f,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Y = 180,
}
};
}
private class RoundDisplay : CompositeDrawable
{
public RoundDisplay(TournamentMatch match)
{
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new TournamentSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = OsuColour.Gray(0.33f),
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.Light)
}, },
} new DrawableTeamFlag(match.NewValue.Team1.Value)
}
};
}
}
private class TeamWithPlayers : CompositeDrawable
{ {
public TeamWithPlayers(TournamentTeam team, bool left = false) Position = new Vector2(165, y_flag_offset),
{
FillFlowContainer players;
var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
InternalChildren = new Drawable[]
{
new TeamDisplay(team)
{
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.Both,
X = (left ? -1 : 1) * 0.3145f,
Y = -0.077f,
}, },
players = new FillFlowContainer new DrawableTeamWithPlayers(match.NewValue.Team1.Value, TeamColour.Red)
{ {
Direction = FillDirection.Vertical, Position = new Vector2(165, y_offset),
AutoSizeAxes = Axes.Both, },
Spacing = new Vector2(0, 5), new DrawableTeamFlag(match.NewValue.Team2.Value)
Padding = new MarginPadding(20), {
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Position = new Vector2(740, y_flag_offset),
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, },
RelativePositionAxes = Axes.Both, new DrawableTeamWithPlayers(match.NewValue.Team2.Value, TeamColour.Blue)
X = (left ? -1 : 1) * 0.58f, {
Position = new Vector2(740, y_offset),
}, },
}; };
if (team != null)
{
foreach (var p in team.Players)
{
players.Add(new TournamentSpriteText
{
Text = p.Username,
Font = OsuFont.Torus.With(size: 24),
Colour = colour,
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
});
}
}
}
private class TeamDisplay : DrawableTournamentTeam
{
public TeamDisplay(TournamentTeam team)
: base(team)
{
AutoSizeAxes = Axes.Both;
Flag.Anchor = Flag.Origin = Anchor.TopCentre;
Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(300, 200);
Flag.Scale = new Vector2(0.32f);
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(160),
Children = new Drawable[]
{
Flag,
new TournamentSpriteText
{
Text = team?.FullName.Value ?? "???",
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.Regular),
Colour = OsuColour.Gray(0.2f),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
}
};
}
}
} }
} }
} }

View File

@ -10,7 +10,6 @@ using osu.Game.Graphics;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.TeamWin namespace osu.Game.Tournament.Screens.TeamWin
{ {
@ -63,7 +62,9 @@ namespace osu.Game.Tournament.Screens.TeamWin
update(); update();
} }
private void update() private bool firstDisplay = true;
private void update() => Schedule(() =>
{ {
var match = currentMatch.Value; var match = currentMatch.Value;
@ -73,105 +74,53 @@ namespace osu.Game.Tournament.Screens.TeamWin
return; return;
} }
bool redWin = match.Winner == match.Team1.Value; redWinVideo.Alpha = match.WinnerColour == TeamColour.Red ? 1 : 0;
redWinVideo.Alpha = redWin ? 1 : 0; blueWinVideo.Alpha = match.WinnerColour == TeamColour.Blue ? 1 : 0;
blueWinVideo.Alpha = redWin ? 0 : 1;
if (firstDisplay)
{
if (match.WinnerColour == TeamColour.Red)
redWinVideo.Reset();
else
blueWinVideo.Reset();
firstDisplay = false;
}
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamFlagDisplay(match.Winner) new DrawableTeamFlag(match.Winner)
{ {
Size = new Vector2(300, 200), Size = new Vector2(300, 200),
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
X = -387, Position = new Vector2(-300, 10),
}, },
new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.TopLeft,
Position = new Vector2(78, -70),
Colour = OsuColour.Gray(0.33f),
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 30, weight: FontWeight.Regular)
},
new TeamWithPlayers(match.Winner, redWin)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.TopLeft,
Position = new Vector2(78, 0),
},
};
}
private class TeamWithPlayers : CompositeDrawable
{
public TeamWithPlayers(TournamentTeam team, bool left = false)
{
FillFlowContainer players;
var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
InternalChildren = new Drawable[]
{
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
X = 260,
Children = new Drawable[] Children = new Drawable[]
{ {
new RoundDisplay(match)
{
Margin = new MarginPadding { Bottom = 30 },
},
new TournamentSpriteText new TournamentSpriteText
{ {
Text = "WINNER", Text = "WINNER",
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 100, weight: FontWeight.Bold),
Colour = Color4.Black, Margin = new MarginPadding { Bottom = 50 },
},
new TournamentSpriteText
{
Text = team?.FullName.Value ?? "???",
Font = OsuFont.Torus.With(size: 30, weight: FontWeight.SemiBold),
Colour = Color4.Black,
},
players = new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 10 },
}, },
new DrawableTeamWithPlayers(match.Winner, match.WinnerColour)
} }
}, },
}; };
mainContainer.FadeOut();
if (team != null) mainContainer.Delay(2000).FadeIn(1600, Easing.OutQuint);
{
foreach (var p in team.Players)
{
players.Add(new TournamentSpriteText
{
Text = p.Username,
Font = OsuFont.Torus.With(size: 24),
Colour = colour,
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
}); });
} }
}
}
}
private class TeamFlagDisplay : DrawableTournamentTeam
{
public TeamFlagDisplay(TournamentTeam team)
: base(team)
{
InternalChildren = new Drawable[]
{
Flag
};
}
}
}
} }