1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 05:03:20 +08:00

Create wireframe for team editor

This commit is contained in:
Dean Herbert 2019-06-14 20:32:02 +09:00
parent c9bd62e815
commit e58d259498
3 changed files with 175 additions and 1 deletions

View File

@ -0,0 +1,15 @@
// 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.Game.Tournament.Screens.Teams;
namespace osu.Game.Tournament.Tests
{
public class TestSceneTeamsEditorScreen : LadderTestScene
{
public TestSceneTeamsEditorScreen()
{
Add(new TeamsEditorScreen());
}
}
}

View File

@ -0,0 +1,156 @@
// 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 System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Settings;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Ladder.Components;
using osuTK;
namespace osu.Game.Tournament.Screens.Teams
{
public class TeamsEditorScreen : TournamentScreen, IProvideVideo
{
private readonly FillFlowContainer<TeamRow> items;
public TeamsEditorScreen()
{
AddRangeInternal(new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.2f),
},
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Width = 0.9f,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Child = items = new FillFlowContainer<TeamRow>
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
},
},
new ControlPanel
{
Children = new Drawable[]
{
new TriangleButton
{
RelativeSizeAxes = Axes.X,
Text = "Add new",
Action = addNew
},
}
}
});
}
[BackgroundDependencyLoader]
private void load()
{
foreach (var g in LadderInfo.Teams)
items.Add(new TeamRow(g));
}
private void addNew()
{
var team = new TournamentTeam
{
StartDate =
{
Value = DateTimeOffset.UtcNow
}
};
items.Add(new TeamRow(team));
LadderInfo.Teams.Add(team);
}
public class TeamRow : CompositeDrawable
{
public readonly TournamentTeam Team;
[Resolved]
private LadderInfo ladderInfo { get; set; }
public TeamRow(TournamentTeam team)
{
Margin = new MarginPadding(10);
Team = team;
InternalChildren = new Drawable[]
{
new Box
{
Colour = OsuColour.Gray(0.1f),
RelativeSizeAxes = Axes.Both,
},
new FillFlowContainer
{
Margin = new MarginPadding(5),
Padding = new MarginPadding { Right = 160 },
Spacing = new Vector2(5),
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new SettingsTextBox
{
LabelText = "Name",
Width = 0.33f,
Bindable = Team.Acronym
},
new SettingsTextBox
{
LabelText = "Description",
Width = 0.33f,
Bindable = Team.Description
},
new DateTextBox
{
LabelText = "Start Time",
Width = 0.33f,
Bindable = Team.StartDate
},
new SettingsSlider<int>
{
LabelText = "Best of",
Width = 0.33f,
Bindable = Team.BestOf
},
}
},
new DangerousSettingsButton
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.None,
Width = 150,
Text = "Delete",
Action = () =>
{
Expire();
ladderInfo.Teams.Remove(Team);
},
}
};
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
}
}
}

View File

@ -19,6 +19,7 @@ using osu.Game.Tournament.Screens.MapPool;
using osu.Game.Tournament.Screens.Schedule;
using osu.Game.Tournament.Screens.Showcase;
using osu.Game.Tournament.Screens.TeamIntro;
using osu.Game.Tournament.Screens.Teams;
using osu.Game.Tournament.Screens.TeamWin;
using osuTK;
using osuTK.Graphics;
@ -72,6 +73,7 @@ namespace osu.Game.Tournament.Screens
new ScheduleScreen(),
new LadderScreen(),
new LadderEditorScreen(),
new TeamsEditorScreen(),
new GroupingsEditorScreen(),
new ShowcaseScreen(),
new MapPoolScreen(),
@ -105,8 +107,9 @@ namespace osu.Game.Tournament.Screens
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Team Editor", Action = () => SetScreen(typeof(TeamsEditorScreen)) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Groupings Editor", Action = () => SetScreen(typeof(GroupingsEditorScreen)) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Bracket Editor", Action = () => SetScreen(typeof(LadderEditorScreen)) },
new Container { RelativeSizeAxes = Axes.X, Height = 50 },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Drawings", Action = () => SetScreen(typeof(DrawingsScreen)) },
new OsuButton { RelativeSizeAxes = Axes.X, Text = "Showcase", Action = () => SetScreen(typeof(ShowcaseScreen)) },