This commit is contained in:
EVAST9919
2017-05-04 17:29:52 +03:00
parent 57c4232416
commit 475eb6fe5f
5 changed files with 31 additions and 50 deletions

View File

@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.UI
set { modIcon.Icon = value; }
}
public ModIcon(Mod m)
public ModIcon(Mod mod)
{
Children = new Drawable[]
{
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.UI
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Icon = FontAwesome.fa_osu_mod_bg,
Colour = pickColour(m),
Colour = getBackgroundColourFromMod(mod),
Shadow = true,
TextSize = 20
},
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.UI
Anchor = Anchor.Centre,
Colour = OsuColour.Gray(84),
TextSize = 20,
Icon = m?.Icon ?? FontAwesome.fa_question,
Icon = (mod != null) ? mod.Icon : FontAwesome.fa_question,
},
};
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.UI
modIcon.TextSize = iconSize - 35;
}
private Color4 pickColour(Mod mod)
private Color4 getBackgroundColourFromMod(Mod mod)
{
switch (mod?.Type)
{

View File

@ -7,6 +7,8 @@ using osu.Game.Rulesets.UI;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
using System.Collections.Generic;
using osu.Framework.Configuration;
namespace osu.Game.Screens.Play
{
@ -14,15 +16,23 @@ namespace osu.Game.Screens.Play
{
private readonly FillFlowContainer<ModIcon> iconsContainer;
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>();
private bool showMods;
public bool ShowMods
{
get
{
return showMods;
}
set
{
showMods = value;
if (!showMods) Hide();
if (!showMods)
Hide();
else
Show();
}
get { return showMods; }
}
public ModsContainer()
@ -46,20 +56,19 @@ namespace osu.Game.Screens.Play
TextSize = 12,
}
};
}
public void Add(Mod mod)
{
iconsContainer.Add(new ModIcon(mod)
Mods.ValueChanged += mods =>
{
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.7f),
});
}
public void Clear()
{
iconsContainer.Clear();
iconsContainer.Clear();
foreach (Mod mod in mods)
{
iconsContainer.Add(new ModIcon(mod)
{
AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.7f),
});
}
};
}
}
}

View File

@ -170,8 +170,7 @@ namespace osu.Game.Screens.Play
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
hudOverlay.ModsContainer.ShowMods = HitRenderer.HasReplayLoaded;
foreach (var mod in Beatmap.Mods.Value)
hudOverlay.ModsContainer.Add(mod);
hudOverlay.ModsContainer.Mods.BindTo(Beatmap.Mods);
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
HitRenderer.OnAllJudged += onCompletion;