osu/osu.Game/Overlays/BeatmapSet/BeatmapSetHeader.cs

64 lines
1.9 KiB
C#
Raw Normal View History

2020-02-03 11:35:07 +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.Allocation;
2020-02-03 11:35:07 +00:00
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
2020-02-03 11:35:07 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Game.Beatmaps;
2021-08-03 07:34:21 +00:00
using osu.Game.Resources.Localisation.Web;
2020-02-03 11:35:07 +00:00
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
2020-02-03 11:35:07 +00:00
namespace osu.Game.Overlays.BeatmapSet
{
public class BeatmapSetHeader : OverlayHeader
{
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
public BeatmapSetHeaderContent HeaderContent { get; private set; }
2020-02-04 03:55:09 +00:00
[Cached]
2020-02-04 03:55:09 +00:00
public BeatmapRulesetSelector RulesetSelector { get; private set; }
2020-02-03 11:35:07 +00:00
[Cached(typeof(IBindable<RulesetInfo>))]
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
public BeatmapSetHeader()
{
Masking = true;
EdgeEffect = new EdgeEffectParameters
{
Colour = Color4.Black.Opacity(0.25f),
Type = EdgeEffectType.Shadow,
Radius = 3,
Offset = new Vector2(0f, 1f),
};
}
protected override Drawable CreateContent() => HeaderContent = new BeatmapSetHeaderContent
{
BeatmapSet = { BindTarget = BeatmapSet }
};
2020-02-03 11:35:07 +00:00
protected override Drawable CreateTitleContent() => RulesetSelector = new BeatmapRulesetSelector
{
Current = ruleset
2020-02-03 11:35:07 +00:00
};
protected override OverlayTitle CreateTitle() => new BeatmapHeaderTitle();
private class BeatmapHeaderTitle : OverlayTitle
2020-02-03 11:35:07 +00:00
{
public BeatmapHeaderTitle()
{
2021-08-03 07:34:21 +00:00
Title = PageTitleStrings.MainBeatmapsetsControllerShow;
2020-09-03 08:05:45 +00:00
IconTexture = "Icons/Hexacons/beatmap";
2020-02-03 11:35:07 +00:00
}
}
}
}