mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Move and use shared components
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Screens.Drawings;
|
using osu.Game.Tournament.Screens.Drawings;
|
||||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
using osu.Game.Tournament.Screens.Drawings.Components;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests
|
namespace osu.Game.Tournament.Tests
|
||||||
|
@ -7,9 +7,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Ladder.Components
|
namespace osu.Game.Tournament.Components
|
||||||
{
|
{
|
||||||
public abstract class DrawableTournamentTeam : CompositeDrawable
|
public abstract class DrawableTournamentTeam : CompositeDrawable
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 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
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Drawings.Components
|
namespace osu.Game.Tournament.Components
|
||||||
{
|
{
|
||||||
public class TournamentTeam
|
public class TournamentTeam
|
||||||
{
|
{
|
@ -4,13 +4,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
@ -119,21 +117,26 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GroupTeam : Container
|
private class GroupTeam : DrawableTournamentTeam
|
||||||
{
|
{
|
||||||
public readonly TournamentTeam Team;
|
|
||||||
|
|
||||||
private readonly FillFlowContainer innerContainer;
|
private readonly FillFlowContainer innerContainer;
|
||||||
private readonly Sprite flagSprite;
|
|
||||||
|
|
||||||
public GroupTeam(TournamentTeam team)
|
public GroupTeam(TournamentTeam team) : base(team)
|
||||||
{
|
{
|
||||||
Team = team;
|
|
||||||
|
|
||||||
Width = 36;
|
Width = 36;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
|
Flag.Anchor = Anchor.TopCentre;
|
||||||
|
Flag.Origin = Anchor.TopCentre;
|
||||||
|
|
||||||
|
AcronymText.Anchor = Anchor.TopCentre;
|
||||||
|
AcronymText.Origin = Anchor.TopCentre;
|
||||||
|
AcronymText.Text = team.Acronym.ToUpperInvariant();
|
||||||
|
AcronymText.TextSize = 10f;
|
||||||
|
AcronymText.Font = @"Exo2.0-Bold";
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
innerContainer = new FillFlowContainer
|
innerContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -148,22 +151,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
flagSprite = new Sprite
|
Flag,
|
||||||
{
|
AcronymText
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
FillMode = FillMode.Fit
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
|
|
||||||
Text = team.Acronym.ToUpperInvariant(),
|
|
||||||
TextSize = 10f,
|
|
||||||
Font = @"Exo2.0-Bold"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -175,12 +164,6 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
innerContainer.ScaleTo(1.5f);
|
innerContainer.ScaleTo(1.5f);
|
||||||
innerContainer.ScaleTo(1f, 200);
|
innerContainer.ScaleTo(1f, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Drawings.Components
|
namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// 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.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Drawings.Components
|
namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||||
{
|
{
|
||||||
|
@ -5,14 +5,12 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
@ -315,14 +313,11 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
Scrolling
|
Scrolling
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScrollingTeam : Container
|
public class ScrollingTeam : DrawableTournamentTeam
|
||||||
{
|
{
|
||||||
public const float WIDTH = 58;
|
public const float WIDTH = 58;
|
||||||
public const float HEIGHT = 41;
|
public const float HEIGHT = 41;
|
||||||
|
|
||||||
public TournamentTeam Team;
|
|
||||||
|
|
||||||
private readonly Sprite flagSprite;
|
|
||||||
private readonly Box outline;
|
private readonly Box outline;
|
||||||
|
|
||||||
private bool selected;
|
private bool selected;
|
||||||
@ -343,9 +338,8 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ScrollingTeam(TournamentTeam team)
|
public ScrollingTeam(TournamentTeam team)
|
||||||
|
: base(team)
|
||||||
{
|
{
|
||||||
Team = team;
|
|
||||||
|
|
||||||
Anchor = Anchor.CentreLeft;
|
Anchor = Anchor.CentreLeft;
|
||||||
Origin = Anchor.CentreLeft;
|
Origin = Anchor.CentreLeft;
|
||||||
|
|
||||||
@ -355,28 +349,20 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
|
|
||||||
Alpha = 0;
|
Alpha = 0;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Flag.Anchor = Anchor.Centre;
|
||||||
|
Flag.Origin = Anchor.Centre;
|
||||||
|
Flag.Scale = new Vector2(0.9f);
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
outline = new Box
|
outline = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0
|
Alpha = 0
|
||||||
},
|
},
|
||||||
flagSprite = new Sprite
|
Flag
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
|
|
||||||
Size = new Vector2(WIDTH, HEIGHT) - new Vector2(8)
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(TextureStore textures)
|
|
||||||
{
|
|
||||||
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Drawings.Components
|
namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
using osu.Game.Tournament.Screens.Drawings.Components;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// 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 osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Game.Tournament.Screens.Drawings.Components;
|
using osu.Game.Tournament.Components;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Screens.Ladder.Components
|
namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user