2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Rulesets;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Toolbar
|
|
|
|
|
{
|
2018-07-10 00:20:21 +08:00
|
|
|
|
public class ToolbarRulesetButton : ToolbarButton
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
private RulesetInfo ruleset;
|
|
|
|
|
public RulesetInfo Ruleset
|
|
|
|
|
{
|
|
|
|
|
get { return ruleset; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ruleset = value;
|
|
|
|
|
|
|
|
|
|
var rInstance = ruleset.CreateInstance();
|
|
|
|
|
|
|
|
|
|
TooltipMain = rInstance.Description;
|
|
|
|
|
TooltipSub = $"Play some {rInstance.Description}";
|
|
|
|
|
SetIcon(rInstance.CreateIcon());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Active
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
IconContainer.Colour = Color4.White;
|
|
|
|
|
IconContainer.EdgeEffect = new EdgeEffectParameters
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
|
Colour = new Color4(255, 194, 224, 100),
|
|
|
|
|
Radius = 15,
|
|
|
|
|
Roundness = 15,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
IconContainer.Colour = new Color4(255, 194, 224, 255);
|
|
|
|
|
IconContainer.EdgeEffect = new EdgeEffectParameters();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
IconContainer.Scale *= 1.4f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|