1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 14:12:55 +08:00

Add showcase screen

This commit is contained in:
Dean Herbert 2018-11-04 07:12:07 +09:00
parent 2e348edd8d
commit 54a02ee2d7
4 changed files with 168 additions and 1 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Video;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Screens.Drawings;
using osu.Game.Tournament.Screens.Ladder;
using osu.Game.Tournament.Screens.Showcase;
using osu.Game.Tournament.Screens.TeamIntro;
using OpenTK;
using OpenTK.Graphics;
@ -23,6 +24,7 @@ namespace osu.Game.Tournament.Tests
private TeamIntroScreen teamIntro;
private DrawingsScreen drawings;
private Container screens;
private ShowcaseScreen showcase;
[BackgroundDependencyLoader]
private void load()
@ -47,6 +49,7 @@ namespace osu.Game.Tournament.Tests
Children = new Drawable[]
{
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => setScreen(drawings) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => setScreen(showcase) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "TeamIntro", Action = () => setScreen(teamIntro) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "MapPool", Action = () => setScreen(mapPool) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket", Action = () => setScreen(bracket) },
@ -79,6 +82,7 @@ namespace osu.Game.Tournament.Tests
Children = new Drawable[]
{
bracket = new LadderManager(Ladder),
showcase = new ShowcaseScreen(),
mapPool = new MapPoolScreen(Ladder.Groupings.First(g => g.Name == "Finals")),
teamIntro = new TeamIntroScreen(Ladder.Teams.First(t => t.Acronym == "USA"), Ladder.Teams.First(t => t.Acronym == "JPN"),
Ladder.Groupings.First(g => g.Name == "Finals")),

View File

@ -0,0 +1,18 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Game.Tests.Visual;
using osu.Game.Tournament.Screens.Showcase;
namespace osu.Game.Tournament.Tests
{
public class TestCaseShowcase : OsuTestCase
{
[BackgroundDependencyLoader]
private void load()
{
Add(new ShowcaseScreen());
}
}
}

View File

@ -20,11 +20,13 @@ namespace osu.Game.Tournament.Components
private const float horizontal_padding = 10;
private const float vertical_padding = 5;
public const float HEIGHT = 50;
public TournamentBeatmapPanel(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
Width = 400;
Height = 50;
Height = HEIGHT;
}
[BackgroundDependencyLoader]

View File

@ -0,0 +1,143 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Tournament.Components;
using OpenTK;
namespace osu.Game.Tournament.Screens.Showcase
{
public class ShowcaseScreen : OsuScreen
{
private readonly Container panelContainer;
[Resolved]
private APIAccess api { get; set; } = null;
[Resolved]
private RulesetStore rulesets { get; set; } = null;
[BackgroundDependencyLoader]
private void load()
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 });
req.Success += success;
api.Queue(req);
}
private void success(APIBeatmap apiBeatmap)
{
var beatmap = apiBeatmap.ToBeatmap(rulesets);
panelContainer.Children = new Drawable[]
{
new OsuSpriteText
{
Text = $"Length {beatmap.OnlineInfo.Length}s",
Margin = new MarginPadding { Horizontal = 15, Vertical = 5 },
Colour = OsuColour.Gray(0.33f),
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
},
new OsuSpriteText
{
Text = $"BPM {beatmap.BeatmapSet.OnlineInfo.BPM:0.#}",
Margin = new MarginPadding { Horizontal = 15, Vertical = 5 },
Colour = OsuColour.Gray(0.33f),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new OsuSpriteText
{
Text = $"AR {beatmap.BaseDifficulty.ApproachRate:0.#}",
Margin = new MarginPadding { Horizontal = 15, Vertical = 5 },
Colour = OsuColour.Gray(0.33f),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
new OsuSpriteText
{
Text = $"Star Rating {beatmap.StarDifficulty:0.#}",
Margin = new MarginPadding { Horizontal = 15, Vertical = 5 },
Colour = OsuColour.Gray(0.33f),
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight
},
new TournamentBeatmapPanel(beatmap)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
}
};
}
public ShowcaseScreen()
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
new Container
{
Masking = true,
RelativeSizeAxes = Axes.X,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Y = -10,
Width = 0.9f,
Height = TournamentBeatmapPanel.HEIGHT,
CornerRadius = TournamentBeatmapPanel.HEIGHT / 2,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.93f),
},
new Container
{
Masking = true,
CornerRadius = TournamentBeatmapPanel.HEIGHT / 2,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Width = 0.7f,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.86f),
},
panelContainer = new Container
{
RelativeSizeAxes = Axes.Both,
}
}
},
new OsuLogo()
{
Triangles = false,
Colour = OsuColour.Gray(0.33f),
Scale = new Vector2(0.08f),
Margin = new MarginPadding(50),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}
}
}
};
}
}
}