2016-10-27 18:52:48 +08:00
|
|
|
|
//Copyright (c) 2007-2016 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;
|
|
|
|
|
using osu.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawable
|
|
|
|
|
{
|
|
|
|
|
class Panel : Container, IStateful<PanelSelectedState>
|
|
|
|
|
{
|
|
|
|
|
public Panel()
|
|
|
|
|
{
|
|
|
|
|
Height = 80;
|
|
|
|
|
|
|
|
|
|
Masking = true;
|
|
|
|
|
CornerRadius = 10;
|
|
|
|
|
BorderColour = new Color4(221, 255, 255, 0);
|
|
|
|
|
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private PanelSelectedState state;
|
|
|
|
|
|
|
|
|
|
public PanelSelectedState State
|
|
|
|
|
{
|
|
|
|
|
get { return state; }
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (state == value) return;
|
|
|
|
|
state = value;
|
|
|
|
|
|
|
|
|
|
switch (state)
|
|
|
|
|
{
|
|
|
|
|
case PanelSelectedState.NotSelected:
|
|
|
|
|
Deselected();
|
|
|
|
|
break;
|
|
|
|
|
case PanelSelectedState.Selected:
|
|
|
|
|
Selected();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Selected()
|
|
|
|
|
{
|
|
|
|
|
BorderColour = new Color4(BorderColour.R, BorderColour.G, BorderColour.B, 255);
|
|
|
|
|
BorderThickness = 2.5f;
|
2016-11-02 05:57:11 +08:00
|
|
|
|
|
|
|
|
|
EdgeEffect = new EdgeEffect
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
|
Colour = new Color4(150, 204, 255, 150),
|
|
|
|
|
Radius = 20,
|
|
|
|
|
Roundness = 10,
|
|
|
|
|
};
|
2016-10-27 18:52:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void Deselected()
|
|
|
|
|
{
|
|
|
|
|
BorderColour = new Color4(BorderColour.R, BorderColour.G, BorderColour.B, 0);
|
|
|
|
|
BorderThickness = 0;
|
2016-11-02 05:57:11 +08:00
|
|
|
|
|
|
|
|
|
EdgeEffect = new EdgeEffect { Type = EdgeEffectType.None };
|
2016-10-27 18:52:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 05:57:11 +08:00
|
|
|
|
protected override bool OnClick(InputState state)
|
|
|
|
|
{
|
|
|
|
|
State = PanelSelectedState.Selected;
|
|
|
|
|
return true;
|
2016-10-27 18:52:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum PanelSelectedState
|
|
|
|
|
{
|
|
|
|
|
NotSelected,
|
|
|
|
|
Selected
|
|
|
|
|
}
|
|
|
|
|
}
|