1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Add drawings config.

This commit is contained in:
smoogipooo 2017-02-27 23:09:26 +09:00
parent 9d731af01b
commit fc33bf4761
4 changed files with 46 additions and 3 deletions

View File

@ -0,0 +1,34 @@
using osu.Framework.Configuration;
using osu.Framework.Platform;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Screens.Tournament.Components
{
public class DrawingsConfigManager : ConfigManager<DrawingsConfig>
{
public override string Filename => @"drawings.ini";
protected override void InitialiseDefaults()
{
#pragma warning disable CS0612 // Type or member is obsolete
Set(DrawingsConfig.Groups, 8, 1, 8);
Set(DrawingsConfig.TeamsPerGroup, 8, 1, 8);
#pragma warning restore CS0612 // Type or member is obsolete
}
public DrawingsConfigManager(Storage storage)
: base(storage)
{
}
}
public enum DrawingsConfig
{
Groups,
TeamsPerGroup
}
}

View File

@ -28,6 +28,8 @@ namespace osu.Game.Screens.Tournament
private ScrollingTeamContainer teamsContainer;
private GroupsContainer groupsContainer;
private DrawingsConfigManager drawingsConfig;
public Drawings()
{
}
@ -35,6 +37,8 @@ namespace osu.Game.Screens.Tournament
[BackgroundDependencyLoader]
private void load(Framework.Game game)
{
drawingsConfig = new DrawingsConfigManager(Game.Host.Storage);
Container visualiserContainer;
SpriteText st;
@ -67,7 +71,7 @@ namespace osu.Game.Screens.Tournament
Colour = new Color4(255, 204, 34, 255)
},
// Groups
groupsContainer = new GroupsContainer(8)
groupsContainer = new GroupsContainer(drawingsConfig.Get<int>(DrawingsConfig.Groups), drawingsConfig.Get<int>(DrawingsConfig.TeamsPerGroup))
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,

View File

@ -16,8 +16,12 @@ namespace osu.Game.Screens.Tournament
private List<Group> allGroups = new List<Group>();
public GroupsContainer(int numGroups)
private int maxTeams;
public GroupsContainer(int numGroups, int teamsPerGroup)
{
maxTeams = teamsPerGroup;
char nextGroupName = 'A';
Children = new[]
@ -60,7 +64,7 @@ namespace osu.Game.Screens.Tournament
{
for (int i = 0; i < allGroups.Count; i++)
{
if (allGroups[i].TeamsCount == 8)
if (allGroups[i].TeamsCount == maxTeams)
continue;
allGroups[i].AddTeam(team);

View File

@ -209,6 +209,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Screens\Select\BeatmapInfoWedge.cs" />
<Compile Include="Screens\Select\WedgeBackground.cs" />
<Compile Include="Screens\Tournament\Components\DrawingsConfigManager.cs" />
<Compile Include="Screens\Tournament\Components\VisualiserLine.cs" />
<Compile Include="Screens\Tournament\Drawings.cs" />
<Compile Include="Screens\Tournament\Group.cs" />