Refactor color handling

colour*
This commit is contained in:
Drew DeVault
2017-03-15 20:52:31 -04:00
parent db5a1e241a
commit 01cca1a4d2
5 changed files with 81 additions and 39 deletions

View File

@ -2,6 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface.Tab;
namespace osu.Game.Graphics.UserInterface
@ -20,5 +22,25 @@ namespace osu.Game.Graphics.UserInterface
foreach (var val in (T[])Enum.GetValues(typeof(T)))
AddTab(val);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
if (accentColour == null)
AccentColour = colours.Blue;
}
private Color4? accentColour;
public Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
set
{
accentColour = value;
(DropDown as OsuTabDropDownMenu<T>).AccentColour = value;
foreach (OsuTabItem<T> item in TabContainer.Children)
item.AccentColour = value;
}
}
}
}