1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-18 14:32:54 +08:00
osu-lazer/osu.Game/Screens/Select/FooterButtonMods.cs

61 lines
1.8 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 osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics;
using osuTK;
using osuTK.Input;
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;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
SelectedColour = colours.Yellow;
DeselectedColour = SelectedColour.Opacity(0.5f);
Text = @"mods";
Hotkey = Key.F1;
}
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;
}
}
}
}