2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-02-07 12:59:30 +08:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-10-04 18:41:18 +08:00
|
|
|
|
|
2016-12-01 18:15:34 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-07-26 12:22:46 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2016-12-01 18:15:34 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2016-10-04 18:41:18 +08:00
|
|
|
|
|
2016-12-01 13:22:29 +08:00
|
|
|
|
namespace osu.Game.Overlays.Toolbar
|
2016-10-04 18:41:18 +08:00
|
|
|
|
{
|
|
|
|
|
public class ToolbarModeButton : ToolbarButton
|
|
|
|
|
{
|
2017-04-17 16:43:48 +08:00
|
|
|
|
private RulesetInfo ruleset;
|
|
|
|
|
public RulesetInfo Ruleset
|
2016-10-04 18:41:18 +08:00
|
|
|
|
{
|
2017-04-15 04:22:41 +08:00
|
|
|
|
get { return ruleset; }
|
2016-10-04 18:41:18 +08:00
|
|
|
|
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}";
|
2017-08-03 13:36:21 +08:00
|
|
|
|
SetIcon(rInstance.CreateIcon());
|
2016-10-04 18:41:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Active
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-12-01 18:15:34 +08:00
|
|
|
|
if (value)
|
|
|
|
|
{
|
2017-08-03 13:36:21 +08:00
|
|
|
|
IconContainer.Colour = Color4.White;
|
|
|
|
|
IconContainer.EdgeEffect = new EdgeEffectParameters
|
2016-12-01 18:15:34 +08:00
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
|
Colour = new Color4(255, 194, 224, 100),
|
|
|
|
|
Radius = 15,
|
|
|
|
|
Roundness = 15,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-08-03 13:36:21 +08:00
|
|
|
|
IconContainer.Colour = new Color4(255, 194, 224, 255);
|
|
|
|
|
IconContainer.EdgeEffect = new EdgeEffectParameters();
|
2016-12-01 18:15:34 +08:00
|
|
|
|
}
|
2016-10-04 18:41:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-13 01:34:36 +08:00
|
|
|
|
protected override void LoadComplete()
|
2016-10-04 18:41:18 +08:00
|
|
|
|
{
|
2016-11-13 01:34:36 +08:00
|
|
|
|
base.LoadComplete();
|
2017-08-03 13:36:21 +08:00
|
|
|
|
IconContainer.Scale *= 1.4f;
|
2016-10-04 18:41:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-30 16:12:11 +08:00
|
|
|
|
}
|