osu/osu.Game/Screens/Select/FooterButtonMods.cs

43 lines
1.3 KiB
C#
Raw Normal View History

2019-05-08 09:43:06 +00:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2019-04-13 23:22:31 +00:00
using osu.Game.Screens.Play.HUD;
using osu.Game.Rulesets.Mods;
using System.Collections.Generic;
using osuTK;
namespace osu.Game.Screens.Select
{
public class FooterButtonMods : FooterButton
{
2019-05-08 09:43:06 +00:00
public FooterButtonMods(Bindable<IReadOnlyList<Mod>> mods)
{
2019-04-13 23:55:15 +00:00
FooterModDisplay modDisplay;
2019-04-13 23:22:31 +00:00
Add(new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2019-05-08 09:43:06 +00:00
Child = modDisplay = new FooterModDisplay
{
2019-04-13 23:22:31 +00:00
DisplayUnrankedText = false,
Scale = new Vector2(0.8f)
},
AutoSizeAxes = Axes.Both,
2019-04-13 23:22:31 +00:00
Margin = new MarginPadding { Left = 70 }
});
if (mods != null)
2019-04-13 23:22:31 +00:00
modDisplay.Current = mods;
}
2019-04-13 23:22:31 +00:00
private class FooterModDisplay : ModDisplay
{
2019-04-13 23:22:31 +00:00
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
}
}
}