mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Finish it up, slightly hackishly, but that's ok.
This commit is contained in:
parent
5f3e484353
commit
9d731af01b
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Tournament.Components;
|
||||
using System;
|
||||
@ -13,6 +14,10 @@ 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;
|
||||
|
||||
namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
@ -20,48 +25,175 @@ namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||
|
||||
private ScrollingTeamContainer teamsContainer;
|
||||
private GroupsContainer groupsContainer;
|
||||
|
||||
public Drawings()
|
||||
{
|
||||
GroupsContainer gc;
|
||||
ScrollingTeamContainer stc;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(Framework.Game game)
|
||||
{
|
||||
Container visualiserContainer;
|
||||
SpriteText st;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// Visualiser
|
||||
visualiserContainer = new Container()
|
||||
new FlowContainer()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(1, 10),
|
||||
|
||||
Colour = new Color4(255, 204, 34, 255)
|
||||
},
|
||||
// Groups
|
||||
gc = new GroupsContainer(8)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
|
||||
Padding = new MarginPadding()
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Top = 35f,
|
||||
Bottom = 35f
|
||||
}
|
||||
},
|
||||
stc = new ScrollingTeamContainer()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
// Main container
|
||||
new Container()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.85f,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.75f
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// Visualiser
|
||||
visualiserContainer = new Container()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(1, 10),
|
||||
|
||||
Colour = new Color4(255, 204, 34, 255)
|
||||
},
|
||||
// Groups
|
||||
groupsContainer = new GroupsContainer(8)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
|
||||
Padding = new MarginPadding()
|
||||
{
|
||||
Top = 35f,
|
||||
Bottom = 35f
|
||||
}
|
||||
},
|
||||
// Scrolling teams
|
||||
teamsContainer = new ScrollingTeamContainer()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
// Scrolling team name
|
||||
st = new SpriteText()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Position = new Vector2(0, 45f),
|
||||
|
||||
Alpha = 0,
|
||||
|
||||
Font = "Exo2.0-Light",
|
||||
TextSize = 42f
|
||||
}
|
||||
}
|
||||
},
|
||||
// Control panel container
|
||||
new Container()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.15f,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(54, 54, 54, 255)
|
||||
},
|
||||
new SpriteText()
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Text = "Control Panel",
|
||||
TextSize = 22f,
|
||||
Font = "Exo2.0-Boldd"
|
||||
},
|
||||
new FlowContainer()
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 0.75f,
|
||||
|
||||
Position = new Vector2(0, 35f),
|
||||
|
||||
Direction = FlowDirections.Vertical,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Begin random",
|
||||
Action = teamsContainer.StartScrolling,
|
||||
},
|
||||
new OsuButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Stop random",
|
||||
Action = teamsContainer.StopScrolling,
|
||||
},
|
||||
new OsuButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Reload",
|
||||
Action = reloadTeams
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer()
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 0.75f,
|
||||
|
||||
Position = new Vector2(0, -5f),
|
||||
|
||||
Direction = FlowDirections.Vertical,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Reset",
|
||||
Action = reset
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
float offset = 0;
|
||||
@ -75,26 +207,55 @@ namespace osu.Game.Screens.Tournament
|
||||
offset += (float)Math.PI / 6f;
|
||||
}
|
||||
|
||||
|
||||
Team t = new Team()
|
||||
teamsContainer.OnSelected += t =>
|
||||
{
|
||||
FullName = "Australia",
|
||||
Acronym = "AUS",
|
||||
FlagName = "AU"
|
||||
groupsContainer.AddTeam(t.Team);
|
||||
|
||||
st.Text = t.Team.FullName;
|
||||
st.FadeIn(200);
|
||||
};
|
||||
|
||||
List<Team> teams = new List<Team>();
|
||||
teamsContainer.OnScrollStarted += () => st.FadeOut(200);
|
||||
|
||||
for (int i = 0; i < 17; i++)
|
||||
reloadTeams();
|
||||
}
|
||||
|
||||
private void reloadTeams()
|
||||
{
|
||||
teamsContainer.ClearTeams();
|
||||
|
||||
try
|
||||
{
|
||||
gc.AddTeam(t);
|
||||
teams.Add(t);
|
||||
foreach (string s in File.ReadAllLines("drawings.txt"))
|
||||
{
|
||||
string[] split = s.Split(':');
|
||||
string flagName = split[0].Trim();
|
||||
string name = split[1].Trim();
|
||||
|
||||
string acronym = name.Substring(0, Math.Min(3, name.Length));
|
||||
if (split.Length >= 3)
|
||||
acronym = split[2].Trim();
|
||||
|
||||
if (groupsContainer.ContainsTeam(name))
|
||||
continue;
|
||||
|
||||
teamsContainer.AddTeam(new Team()
|
||||
{
|
||||
FlagName = flagName,
|
||||
FullName = name,
|
||||
Acronym = acronym
|
||||
});
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
stc.AvailableTeams = teams;
|
||||
private void reset()
|
||||
{
|
||||
groupsContainer.ClearTeams();
|
||||
teamsContainer.ClearTeams();
|
||||
|
||||
stc.StartScrolling();
|
||||
Delay(3000).Schedule(() => stc.StopScrolling());
|
||||
reloadTeams();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Timing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -23,6 +24,8 @@ namespace osu.Game.Screens.Tournament
|
||||
private FlowContainer<GroupTeam> topTeams;
|
||||
private FlowContainer<GroupTeam> bottomTeams;
|
||||
|
||||
private List<GroupTeam> allTeams = new List<GroupTeam>();
|
||||
|
||||
private int topTeamsCount;
|
||||
private int bottomTeamsCount;
|
||||
|
||||
@ -95,20 +98,31 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
public void AddTeam(Team team)
|
||||
{
|
||||
|
||||
GroupTeam gt = new GroupTeam(team);
|
||||
if (topTeamsCount < 4)
|
||||
{
|
||||
topTeams.Add(new GroupTeam(team));
|
||||
topTeams.Add(gt);
|
||||
allTeams.Add(gt);
|
||||
topTeamsCount++;
|
||||
}
|
||||
else if (bottomTeamsCount < 4)
|
||||
{
|
||||
bottomTeams.Add(new GroupTeam(team));
|
||||
bottomTeams.Add(gt);
|
||||
allTeams.Add(gt);
|
||||
bottomTeamsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsTeam(string fullName)
|
||||
{
|
||||
return allTeams.Any(t => t.Team.FullName == fullName);
|
||||
}
|
||||
|
||||
public bool RemoveTeam(Team team)
|
||||
{
|
||||
allTeams.RemoveAll(gt => gt.Team == team);
|
||||
|
||||
if (topTeams.RemoveAll(gt => gt.Team == team) > 0)
|
||||
{
|
||||
topTeamsCount--;
|
||||
@ -125,6 +139,7 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
public void ClearTeams()
|
||||
{
|
||||
allTeams.Clear();
|
||||
topTeams.Clear();
|
||||
bottomTeams.Clear();
|
||||
|
||||
@ -132,10 +147,11 @@ namespace osu.Game.Screens.Tournament
|
||||
bottomTeamsCount = 0;
|
||||
}
|
||||
|
||||
class GroupTeam : FlowContainer
|
||||
class GroupTeam : Container
|
||||
{
|
||||
public Team Team;
|
||||
|
||||
private FlowContainer innerContainer;
|
||||
private Sprite flagSprite;
|
||||
|
||||
public GroupTeam(Team team)
|
||||
@ -144,31 +160,51 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
Size = new Vector2(36, 0);
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FlowDirections.Vertical;
|
||||
|
||||
Spacing = new Vector2(0, 5f);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flagSprite = new Sprite()
|
||||
innerContainer = new FlowContainer()
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
FillMode = FillMode.Fit
|
||||
},
|
||||
new SpriteText()
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
|
||||
Text = team.Acronym.ToUpper(),
|
||||
TextSize = 10f,
|
||||
Font = @"Exo2.0-Bold"
|
||||
Direction = FlowDirections.Vertical,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
|
||||
Scale = new Vector2(1.5f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flagSprite = new Sprite()
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
FillMode = FillMode.Fit
|
||||
},
|
||||
new SpriteText()
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Text = team.Acronym.ToUpper(),
|
||||
TextSize = 10f,
|
||||
Font = @"Exo2.0-Bold"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
innerContainer.ScaleTo(1f, 200);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
|
@ -68,6 +68,11 @@ namespace osu.Game.Screens.Tournament
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsTeam(string fullName)
|
||||
{
|
||||
return allGroups.Any(g => g.ContainsTeam(fullName));
|
||||
}
|
||||
|
||||
public bool RemoveTeam(Team team)
|
||||
{
|
||||
for (int i = 0; i < allGroups.Count; i++)
|
||||
|
@ -21,8 +21,10 @@ namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
public class ScrollingTeamContainer : Container
|
||||
{
|
||||
public Action<ScrollingTeam> OnSelected;
|
||||
public List<Team> AvailableTeams;
|
||||
public event Action OnScrollStarted;
|
||||
public event Action<ScrollingTeam> OnSelected;
|
||||
|
||||
private readonly List<Team> availableTeams = new List<Team>();
|
||||
|
||||
private Container tracker;
|
||||
|
||||
@ -35,14 +37,54 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
private double lastTime;
|
||||
|
||||
private ScheduledDelegate idleDelegate;
|
||||
|
||||
public ScrollingTeamContainer()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
tracker = new Container()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
||||
Masking = true,
|
||||
CornerRadius = 10f,
|
||||
Alpha = 0,
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new Box()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(2, 55),
|
||||
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.Transparent, Color4.White)
|
||||
},
|
||||
new Box()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Size = new Vector2(2, 55),
|
||||
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.Transparent)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private ScrollState _scrollState;
|
||||
private ScrollState scrollState
|
||||
{
|
||||
get { return _scrollState; }
|
||||
set
|
||||
{
|
||||
if (_scrollState == value)
|
||||
return;
|
||||
_scrollState = value;
|
||||
|
||||
switch (value)
|
||||
@ -52,7 +94,9 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
resetSelected();
|
||||
|
||||
speedTo(600f, 200);
|
||||
OnScrollStarted?.Invoke();
|
||||
|
||||
speedTo(1000f, 200);
|
||||
tracker.FadeOut(100);
|
||||
break;
|
||||
case ScrollState.Stopping:
|
||||
@ -60,7 +104,6 @@ namespace osu.Game.Screens.Tournament
|
||||
tracker.FadeIn(200);
|
||||
|
||||
Delay(2300).Schedule(() => scrollState = ScrollState.Stopped);
|
||||
DelayReset();
|
||||
break;
|
||||
case ScrollState.Stopped:
|
||||
// Find closest to center
|
||||
@ -85,14 +128,20 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
offset += DrawWidth / 2f - (closest.Position.X + closest.DrawWidth / 2f);
|
||||
|
||||
(closest as ScrollingTeam).Selected = true;
|
||||
OnSelected?.Invoke(closest as ScrollingTeam);
|
||||
ScrollingTeam st = closest as ScrollingTeam;
|
||||
|
||||
availableTeams.RemoveAll(at => at == st.Team);
|
||||
|
||||
st.Selected = true;
|
||||
OnSelected?.Invoke(st);
|
||||
|
||||
idleDelegate = Delay(10000).Schedule(() => scrollState = ScrollState.Idle);
|
||||
break;
|
||||
case ScrollState.Idle:
|
||||
resetSelected();
|
||||
|
||||
OnScrollStarted?.Invoke();
|
||||
|
||||
speedTo(40f, 200);
|
||||
tracker.FadeOut(100);
|
||||
break;
|
||||
@ -100,111 +149,22 @@ namespace osu.Game.Screens.Tournament
|
||||
}
|
||||
}
|
||||
|
||||
private ScheduledDelegate idleDelegate;
|
||||
|
||||
public ScrollingTeamContainer()
|
||||
public void AddTeam(Team team)
|
||||
{
|
||||
Masking = true;
|
||||
Clock = new FramedClock();
|
||||
if (availableTeams.Contains(team))
|
||||
return;
|
||||
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
tracker = new Container()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
Masking = true,
|
||||
CornerRadius = 10f,
|
||||
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new Box()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(2, 100),
|
||||
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.Transparent, Color4.White)
|
||||
},
|
||||
new Box()
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Size = new Vector2(2, 100),
|
||||
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.Transparent)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
availableTeams.Add(team);
|
||||
|
||||
RemoveAll(c => c is ScrollingTeam);
|
||||
scrollState = ScrollState.Idle;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
public void ClearTeams()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if ((AvailableTeams?.Count ?? 0) == 0)
|
||||
return;
|
||||
|
||||
timeOffset -= (float)(Time.Current - lastTime) / 1000 * speed;
|
||||
lastTime = Time.Current;
|
||||
|
||||
// Fill more than required to account for transformation + scrolling speed
|
||||
while (Children.Count(c => c is ScrollingTeam) < DrawWidth * 2 / ScrollingTeam.WIDTH)
|
||||
addFlags();
|
||||
|
||||
float pos = leftPos;
|
||||
|
||||
foreach (var c in Children)
|
||||
{
|
||||
if (!(c is ScrollingTeam))
|
||||
continue;
|
||||
|
||||
if (c.Position.X + c.DrawWidth < 0)
|
||||
{
|
||||
c.ClearTransforms();
|
||||
c.Expire();
|
||||
expiredCount++;
|
||||
}
|
||||
else
|
||||
c.MoveToX(pos, 100);
|
||||
|
||||
pos += ScrollingTeam.WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFlags()
|
||||
{
|
||||
for (int i = 0; i < AvailableTeams.Count; i++)
|
||||
{
|
||||
Add(new ScrollingTeam(AvailableTeams[i])
|
||||
{
|
||||
X = leftPos + DrawWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void resetSelected()
|
||||
{
|
||||
foreach (var c in Children)
|
||||
{
|
||||
ScrollingTeam st = c as ScrollingTeam;
|
||||
if (st == null)
|
||||
continue;
|
||||
|
||||
if (st.Selected)
|
||||
st.Selected = false;
|
||||
|
||||
RemoveTeam(st.Team);
|
||||
AvailableTeams.Remove(st.Team);
|
||||
}
|
||||
availableTeams.Clear();
|
||||
RemoveAll(c => c is ScrollingTeam);
|
||||
scrollState = ScrollState.Idle;
|
||||
}
|
||||
|
||||
public void RemoveTeam(Team team)
|
||||
@ -234,6 +194,76 @@ namespace osu.Game.Screens.Tournament
|
||||
scrollState = ScrollState.Stopping;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
scrollState = ScrollState.Idle;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
timeOffset -= (float)(Time.Current - lastTime) / 1000 * speed;
|
||||
lastTime = Time.Current;
|
||||
|
||||
if (availableTeams.Count > 0)
|
||||
{
|
||||
// Fill more than required to account for transformation + scrolling speed
|
||||
while (Children.Count(c => c is ScrollingTeam) < DrawWidth * 2 / ScrollingTeam.WIDTH)
|
||||
addFlags();
|
||||
}
|
||||
|
||||
float pos = leftPos;
|
||||
|
||||
foreach (var c in Children)
|
||||
{
|
||||
if (!(c is ScrollingTeam))
|
||||
continue;
|
||||
|
||||
if (c.Position.X + c.DrawWidth < 0)
|
||||
{
|
||||
c.ClearTransforms();
|
||||
c.Expire();
|
||||
expiredCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
c.MoveToX(pos, 100);
|
||||
c.FadeTo(1.0f - Math.Abs(pos - DrawWidth / 2f) / (DrawWidth / 2.5f), 100);
|
||||
}
|
||||
|
||||
pos += ScrollingTeam.WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFlags()
|
||||
{
|
||||
for (int i = 0; i < availableTeams.Count; i++)
|
||||
{
|
||||
Add(new ScrollingTeam(availableTeams[i])
|
||||
{
|
||||
X = leftPos + DrawWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void resetSelected()
|
||||
{
|
||||
foreach (var c in Children)
|
||||
{
|
||||
ScrollingTeam st = c as ScrollingTeam;
|
||||
if (st == null)
|
||||
continue;
|
||||
|
||||
if (st.Selected)
|
||||
{
|
||||
st.Selected = false;
|
||||
RemoveTeam(st.Team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None)
|
||||
{
|
||||
DelayReset();
|
||||
@ -295,6 +325,8 @@ namespace osu.Game.Screens.Tournament
|
||||
Masking = true;
|
||||
CornerRadius = 8f;
|
||||
|
||||
Alpha = 0;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
outline = new Box()
|
||||
|
Loading…
Reference in New Issue
Block a user