mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
ModIcon refactor
This commit is contained in:
@ -5,6 +5,7 @@ using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
@ -29,25 +30,42 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
public new Color4 Colour
|
||||
{
|
||||
get
|
||||
{
|
||||
return background.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
background.Colour = value;
|
||||
}
|
||||
get { return background?.Colour ?? Color4.Transparent; }
|
||||
set { background.Colour = value; }
|
||||
}
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get
|
||||
get { return modIcon.Icon; }
|
||||
set { modIcon.Icon = value; }
|
||||
}
|
||||
|
||||
public ModIcon(Mod m)
|
||||
{
|
||||
if(m!= null)
|
||||
{
|
||||
return modIcon.Icon;
|
||||
}
|
||||
set
|
||||
{
|
||||
modIcon.Icon = value;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_osu_mod_bg,
|
||||
Colour = selectColour(m),
|
||||
Shadow = true,
|
||||
TextSize = 20
|
||||
},
|
||||
modIcon = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Colour = OsuColour.Gray(84),
|
||||
TextSize = 20,
|
||||
Icon = m.Icon,
|
||||
},
|
||||
};
|
||||
|
||||
reapplySize();
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,28 +75,19 @@ namespace osu.Game.Rulesets.UI
|
||||
modIcon.TextSize = iconSize - 35;
|
||||
}
|
||||
|
||||
public ModIcon()
|
||||
private Color4 selectColour(Mod mod)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
switch (mod.Type)
|
||||
{
|
||||
background = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_osu_mod_bg,
|
||||
Shadow = true,
|
||||
TextSize = 20
|
||||
},
|
||||
modIcon = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Colour = OsuColour.Gray(84),
|
||||
TextSize = 20
|
||||
},
|
||||
};
|
||||
case ModType.DifficultyIncrease:
|
||||
return OsuColour.FromHex(@"ffcc22");
|
||||
case ModType.DifficultyReduction:
|
||||
return OsuColour.FromHex(@"88b300");
|
||||
case ModType.Special:
|
||||
return OsuColour.FromHex(@"66ccff");
|
||||
|
||||
reapplySize();
|
||||
default: return Color4.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user