1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 03:17:28 +08:00
osu-lazer/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs

58 lines
1.7 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
2017-07-26 12:22:46 +08:00
using osu.Game.Rulesets;
using OpenTK.Graphics;
2016-12-01 13:22:29 +08:00
namespace osu.Game.Overlays.Toolbar
{
public class ToolbarModeButton : ToolbarButton
{
2017-04-17 16:43:48 +08:00
private RulesetInfo ruleset;
public RulesetInfo Ruleset
{
2017-04-15 04:22:41 +08:00
get { return ruleset; }
set
{
2017-04-15 04:22:41 +08:00
ruleset = value;
2017-04-17 16:43:48 +08:00
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;
}
}
2017-05-30 16:12:11 +08:00
}