2017-05-03 03:34:07 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
|
{
|
|
|
|
|
public class ModsContainer : Container
|
|
|
|
|
{
|
|
|
|
|
private readonly FillFlowContainer<ModIcon> iconsContainer;
|
|
|
|
|
|
|
|
|
|
public bool ShowMods
|
|
|
|
|
{
|
2017-05-03 03:59:36 +08:00
|
|
|
|
set { if (!value) Hide(); }
|
2017-05-03 03:34:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ModsContainer()
|
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
iconsContainer = new FillFlowContainer<ModIcon>
|
|
|
|
|
{
|
2017-05-03 03:46:18 +08:00
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
2017-05-03 03:34:07 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Text = @"/UNRANKED/",
|
|
|
|
|
Font = @"Venera",
|
|
|
|
|
TextSize = 15,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Add(Mod mod)
|
|
|
|
|
{
|
|
|
|
|
iconsContainer.Add(new ModIcon
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Icon = mod.Icon,
|
|
|
|
|
Colour = selectColour(mod),
|
|
|
|
|
IconSize = 60,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Color4 selectColour(Mod mod)
|
|
|
|
|
{
|
|
|
|
|
switch (mod.Type)
|
|
|
|
|
{
|
|
|
|
|
case ModType.DifficultyIncrease:
|
|
|
|
|
return OsuColour.FromHex(@"ffcc22");
|
|
|
|
|
case ModType.DifficultyReduction:
|
|
|
|
|
return OsuColour.FromHex(@"88b300");
|
|
|
|
|
case ModType.Special:
|
|
|
|
|
return OsuColour.FromHex(@"66ccff");
|
|
|
|
|
|
|
|
|
|
default: return Color4.White;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|