1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 12:47:25 +08:00
osu-lazer/osu.Game/Screens/Select/FooterButtonMods.cs

48 lines
1.4 KiB
C#
Raw Normal View History

2019-05-08 17:43:15 +08: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-14 07:22:31 +08: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 17:43:06 +08:00
public FooterButtonMods(Bindable<IReadOnlyList<Mod>> mods)
{
2019-04-14 07:55:15 +08:00
FooterModDisplay modDisplay;
2019-04-14 07:22:31 +08:00
Add(new Container
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
2019-05-08 17:43:06 +08:00
Child = modDisplay = new FooterModDisplay
{
2019-04-14 07:22:31 +08:00
DisplayUnrankedText = false,
Scale = new Vector2(0.8f)
},
AutoSizeAxes = Axes.Both,
2019-04-14 07:22:31 +08:00
Margin = new MarginPadding { Left = 70 }
});
if (mods != null)
2019-04-14 07:22:31 +08:00
modDisplay.Current = mods;
}
2019-04-14 07:22:31 +08:00
private class FooterModDisplay : ModDisplay
{
2019-04-14 07:22:31 +08:00
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
2019-05-08 17:43:15 +08:00
public FooterModDisplay()
{
AllowExpand = false;
}
}
}
}