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