mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 14:23:14 +08:00
Remvoe ctor argument and fallback to storage-based TeamList if no custom list has been provided.
This commit is contained in:
parent
ca73b77a9a
commit
4a109fcc55
@ -1,13 +1,11 @@
|
|||||||
using osu.Framework.Allocation;
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens.Testing;
|
using osu.Framework.Screens.Testing;
|
||||||
using osu.Game.Screens.Tournament;
|
using osu.Game.Screens.Tournament;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -25,74 +23,71 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
Add(new Drawings(new TestTeamList()));
|
Add(new Drawings
|
||||||
|
{
|
||||||
|
TeamList = new TestTeamList(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestTeamList : ITeamList
|
class TestTeamList : ITeamList
|
||||||
{
|
{
|
||||||
public IEnumerable<Team> Teams
|
public IEnumerable<Team> Teams { get; } = new[]
|
||||||
{
|
{
|
||||||
get
|
new Team
|
||||||
{
|
{
|
||||||
return new Team[]
|
FlagName = "GB",
|
||||||
{
|
FullName = "United Kingdom",
|
||||||
new Team()
|
Acronym = "UK"
|
||||||
{
|
},
|
||||||
FlagName = "GB",
|
new Team
|
||||||
FullName = "United Kingdom",
|
{
|
||||||
Acronym = "UK"
|
FlagName = "FR",
|
||||||
},
|
FullName = "France",
|
||||||
new Team()
|
Acronym = "FRA"
|
||||||
{
|
},
|
||||||
FlagName = "FR",
|
new Team
|
||||||
FullName = "France",
|
{
|
||||||
Acronym = "FRA"
|
FlagName = "CN",
|
||||||
},
|
FullName = "China",
|
||||||
new Team()
|
Acronym = "CHN"
|
||||||
{
|
},
|
||||||
FlagName = "CN",
|
new Team
|
||||||
FullName = "China",
|
{
|
||||||
Acronym = "CHN"
|
FlagName = "AU",
|
||||||
},
|
FullName = "Australia",
|
||||||
new Team()
|
Acronym = "AUS"
|
||||||
{
|
},
|
||||||
FlagName = "AU",
|
new Team
|
||||||
FullName = "Australia",
|
{
|
||||||
Acronym = "AUS"
|
FlagName = "JP",
|
||||||
},
|
FullName = "Japan",
|
||||||
new Team()
|
Acronym = "JPN"
|
||||||
{
|
},
|
||||||
FlagName = "JP",
|
new Team
|
||||||
FullName = "Japan",
|
{
|
||||||
Acronym = "JPN"
|
FlagName = "RO",
|
||||||
},
|
FullName = "Romania",
|
||||||
new Team()
|
Acronym = "ROM"
|
||||||
{
|
},
|
||||||
FlagName = "RO",
|
new Team
|
||||||
FullName = "Romania",
|
{
|
||||||
Acronym = "ROM"
|
FlagName = "IT",
|
||||||
},
|
FullName = "Italy",
|
||||||
new Team()
|
Acronym = "PIZZA"
|
||||||
{
|
},
|
||||||
FlagName = "IT",
|
new Team
|
||||||
FullName = "Italy",
|
{
|
||||||
Acronym = "PIZZA"
|
FlagName = "VE",
|
||||||
},
|
FullName = "Venezuela",
|
||||||
new Team()
|
Acronym = "VNZ"
|
||||||
{
|
},
|
||||||
FlagName = "VE",
|
new Team
|
||||||
FullName = "Venezuela",
|
{
|
||||||
Acronym = "VNZ"
|
FlagName = "US",
|
||||||
},
|
FullName = "United States of America",
|
||||||
new Team()
|
Acronym = "USA"
|
||||||
{
|
},
|
||||||
FlagName = "US",
|
};
|
||||||
FullName = "United States of America",
|
|
||||||
Acronym = "USA"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
if (!args.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && args.Key == Key.D)
|
if (!args.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && args.Key == Key.D)
|
||||||
{
|
{
|
||||||
Push(new Drawings(new FileTeamList(Game.Host.Storage)));
|
Push(new Drawings());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,30 +1,24 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using System;
|
||||||
using OpenTK.Graphics;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osu.Game.Screens.Tournament.Components;
|
using osu.Game.Screens.Tournament.Components;
|
||||||
using System;
|
using OpenTK;
|
||||||
using System.Collections.Generic;
|
using OpenTK.Graphics;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
using System.IO;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.IO.Stores;
|
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Framework.Logging;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
@ -48,19 +42,17 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
private Storage storage;
|
private Storage storage;
|
||||||
|
|
||||||
private ITeamList teamList;
|
public ITeamList TeamList;
|
||||||
|
|
||||||
public Drawings(ITeamList teamList)
|
|
||||||
{
|
|
||||||
this.teamList = teamList;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures, Storage storage)
|
private void load(TextureStore textures, Storage storage)
|
||||||
{
|
{
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
|
|
||||||
if (teamList.Teams.Count() == 0)
|
if (TeamList == null)
|
||||||
|
TeamList = new FileTeamList(storage);
|
||||||
|
|
||||||
|
if (!TeamList.Teams.Any())
|
||||||
{
|
{
|
||||||
Exit();
|
Exit();
|
||||||
return;
|
return;
|
||||||
@ -70,17 +62,17 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box()
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(77, 77, 77, 255)
|
Colour = new Color4(77, 77, 77, 255)
|
||||||
},
|
},
|
||||||
new Sprite()
|
new Sprite
|
||||||
{
|
{
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
Texture = textures.Get(@"Backgrounds/Drawings/background.png")
|
Texture = textures.Get(@"Backgrounds/Drawings/background.png")
|
||||||
},
|
},
|
||||||
new FillFlowContainer()
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Right,
|
Direction = FillDirection.Right,
|
||||||
@ -88,7 +80,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
// Main container
|
// Main container
|
||||||
new Container()
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Width = 0.85f,
|
Width = 0.85f,
|
||||||
@ -96,7 +88,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
// Visualiser
|
// Visualiser
|
||||||
new VisualiserContainer()
|
new VisualiserContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -117,14 +109,14 @@ namespace osu.Game.Screens.Tournament
|
|||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
|
|
||||||
Padding = new MarginPadding()
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = 35f,
|
Top = 35f,
|
||||||
Bottom = 35f
|
Bottom = 35f
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Scrolling teams
|
// Scrolling teams
|
||||||
teamsContainer = new ScrollingTeamContainer()
|
teamsContainer = new ScrollingTeamContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -132,7 +124,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
},
|
||||||
// Scrolling team name
|
// Scrolling team name
|
||||||
fullTeamNameText = new SpriteText()
|
fullTeamNameText = new SpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
@ -147,19 +139,19 @@ namespace osu.Game.Screens.Tournament
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Control panel container
|
// Control panel container
|
||||||
new Container()
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Width = 0.15f,
|
Width = 0.15f,
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box()
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(54, 54, 54, 255)
|
Colour = new Color4(54, 54, 54, 255)
|
||||||
},
|
},
|
||||||
new SpriteText()
|
new SpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
@ -168,7 +160,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
TextSize = 22f,
|
TextSize = 22f,
|
||||||
Font = "Exo2.0-Boldd"
|
Font = "Exo2.0-Boldd"
|
||||||
},
|
},
|
||||||
new FillFlowContainer()
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
@ -184,21 +176,21 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuButton()
|
new OsuButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
|
||||||
Text = "Begin random",
|
Text = "Begin random",
|
||||||
Action = teamsContainer.StartScrolling,
|
Action = teamsContainer.StartScrolling,
|
||||||
},
|
},
|
||||||
new OsuButton()
|
new OsuButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
|
||||||
Text = "Stop random",
|
Text = "Stop random",
|
||||||
Action = teamsContainer.StopScrolling,
|
Action = teamsContainer.StopScrolling,
|
||||||
},
|
},
|
||||||
new OsuButton()
|
new OsuButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
|
||||||
@ -207,7 +199,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer()
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
@ -223,7 +215,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuButton()
|
new OsuButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
|
||||||
@ -284,9 +276,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
teamsContainer.ClearTeams();
|
teamsContainer.ClearTeams();
|
||||||
allTeams.Clear();
|
allTeams.Clear();
|
||||||
|
|
||||||
List<Team> newTeams = teamList.Teams.ToList();
|
foreach (Team t in TeamList.Teams)
|
||||||
|
|
||||||
foreach (Team t in newTeams)
|
|
||||||
{
|
{
|
||||||
if (groupsContainer.ContainsTeam(t.FullName))
|
if (groupsContainer.ContainsTeam(t.FullName))
|
||||||
continue;
|
continue;
|
||||||
|
@ -6,9 +6,6 @@ using osu.Framework.Platform;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
@ -27,7 +24,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<Team> teams = new List<Team>();
|
var teams = new List<Team>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Tournament
|
namespace osu.Game.Screens.Tournament
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user