osu/osu.Game/Modes/UI/ModIcon.cs

84 lines
2.0 KiB
C#
Raw Normal View History

2017-03-08 06:50:52 +00:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
2017-02-16 20:05:03 +00:00
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
namespace osu.Game.Modes.UI
{
public class ModIcon : Container
{
private readonly TextAwesome modIcon;
private readonly TextAwesome background;
2017-02-16 20:05:03 +00:00
private float iconSize = 80;
public float IconSize
{
get
{
return iconSize;
}
set
{
iconSize = value;
reapplySize();
}
}
2017-03-06 09:14:41 +00:00
public new Color4 Colour
2017-02-16 20:05:03 +00:00
{
get
{
2017-03-06 09:14:41 +00:00
return background.Colour;
2017-02-16 20:05:03 +00:00
}
set
{
background.Colour = value;
}
}
2017-03-06 09:14:41 +00:00
2017-02-16 20:05:03 +00:00
public FontAwesome Icon
{
get
{
2017-03-06 09:14:41 +00:00
return modIcon.Icon;
2017-02-16 20:05:03 +00:00
}
set
{
modIcon.Icon = value;
}
}
private void reapplySize()
{
background.TextSize = iconSize;
modIcon.TextSize = iconSize - 35;
}
public ModIcon()
{
Children = new Drawable[]
{
background = new TextAwesome
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Icon = FontAwesome.fa_osu_mod_bg,
Shadow = true,
TextSize = 20
2017-02-16 20:05:03 +00:00
},
modIcon = new TextAwesome
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Colour = OsuColour.Gray(84),
TextSize = 20
2017-02-16 20:05:03 +00:00
},
};
reapplySize();
}
}
}