2018-01-05 19:21:19 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-04-18 21:35:21 +08:00
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
2017-04-11 13:01:13 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using OpenTK;
|
|
|
|
using OpenTK.Graphics;
|
2017-06-20 13:54:23 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2017-04-11 13:01:13 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking
|
|
|
|
{
|
|
|
|
public class ResultModeButton : TabItem<ResultMode>
|
|
|
|
{
|
|
|
|
private readonly FontAwesome icon;
|
|
|
|
private Color4 activeColour;
|
|
|
|
private Color4 inactiveColour;
|
|
|
|
private CircularContainer colouredPart;
|
|
|
|
|
|
|
|
public ResultModeButton(ResultMode mode) : base(mode)
|
|
|
|
{
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case ResultMode.Summary:
|
|
|
|
icon = FontAwesome.fa_asterisk;
|
|
|
|
break;
|
|
|
|
case ResultMode.Ranking:
|
|
|
|
icon = FontAwesome.fa_list;
|
|
|
|
break;
|
|
|
|
case ResultMode.Share:
|
|
|
|
icon = FontAwesome.fa_camera;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
|
|
|
Size = new Vector2(50);
|
|
|
|
|
|
|
|
Masking = true;
|
|
|
|
CornerRadius = 25;
|
|
|
|
|
|
|
|
activeColour = colours.PinkDarker;
|
|
|
|
inactiveColour = OsuColour.Gray(0.8f);
|
|
|
|
|
2017-06-12 11:48:47 +08:00
|
|
|
EdgeEffect = new EdgeEffectParameters
|
2017-04-11 13:01:13 +08:00
|
|
|
{
|
|
|
|
Colour = Color4.Black.Opacity(0.4f),
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
Radius = 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4.White,
|
|
|
|
},
|
|
|
|
colouredPart = new CircularContainer
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Size = new Vector2(0.8f),
|
|
|
|
BorderThickness = 4,
|
|
|
|
BorderColour = Color4.White,
|
|
|
|
Colour = inactiveColour,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
AlwaysPresent = true, //for border rendering
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4.Transparent,
|
|
|
|
},
|
2017-08-03 13:36:21 +08:00
|
|
|
new SpriteIcon
|
2017-04-11 13:01:13 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Shadow = false,
|
|
|
|
Colour = OsuColour.Gray(0.95f),
|
|
|
|
Icon = icon,
|
2017-08-03 13:36:21 +08:00
|
|
|
Size = new Vector2(20),
|
2017-04-11 13:01:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2017-06-12 17:39:22 +08:00
|
|
|
|
2017-07-23 02:50:25 +08:00
|
|
|
protected override void OnActivated() => colouredPart.FadeColour(activeColour, 200, Easing.OutQuint);
|
2017-06-12 17:39:22 +08:00
|
|
|
|
2017-07-23 02:50:25 +08:00
|
|
|
protected override void OnDeactivated() => colouredPart.FadeColour(inactiveColour, 200, Easing.OutQuint);
|
2017-04-11 13:01:13 +08:00
|
|
|
}
|
|
|
|
}
|