mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Move overlay ruleset selectors to tab control
This commit is contained in:
parent
ad2582a3ab
commit
5750d82c0a
@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
protected override OverlayTitle CreateTitle() => new TestTitle();
|
||||
|
||||
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector();
|
||||
protected override Drawable CreateTabControlContent() => new OverlayRulesetSelector();
|
||||
|
||||
public TestStringTabControlHeader()
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osu.Game.Rulesets;
|
||||
@ -16,7 +17,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class BeatmapSetHeader : OverlayHeader
|
||||
public partial class BeatmapSetHeader : TabControlOverlayHeader<BeatmapSetTabs>
|
||||
{
|
||||
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||
|
||||
@ -46,7 +47,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
BeatmapSet = { BindTarget = BeatmapSet }
|
||||
};
|
||||
|
||||
protected override Drawable CreateTitleContent() => RulesetSelector = new BeatmapRulesetSelector
|
||||
protected override Drawable CreateTabControlContent() => RulesetSelector = new BeatmapRulesetSelector
|
||||
{
|
||||
Current = ruleset
|
||||
};
|
||||
@ -62,4 +63,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum BeatmapSetTabs
|
||||
{
|
||||
[LocalisableDescription(typeof(LayoutStrings), nameof(LayoutStrings.HeaderBeatmapsetsShow))]
|
||||
Info,
|
||||
}
|
||||
}
|
||||
|
@ -75,19 +75,11 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new[]
|
||||
Child = Title = CreateTitle().With(title =>
|
||||
{
|
||||
Title = CreateTitle().With(title =>
|
||||
{
|
||||
title.Anchor = Anchor.CentreLeft;
|
||||
title.Origin = Anchor.CentreLeft;
|
||||
}),
|
||||
CreateTitleContent().With(content =>
|
||||
{
|
||||
content.Anchor = Anchor.CentreRight;
|
||||
content.Origin = Anchor.CentreRight;
|
||||
})
|
||||
}
|
||||
title.Anchor = Anchor.CentreLeft;
|
||||
title.Origin = Anchor.CentreLeft;
|
||||
}),
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -112,12 +104,6 @@ namespace osu.Game.Overlays
|
||||
[NotNull]
|
||||
protected virtual Drawable CreateBackground() => Empty();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="OverlayTitle"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
protected virtual Drawable CreateTitleContent() => Empty();
|
||||
|
||||
protected abstract OverlayTitle CreateTitle();
|
||||
}
|
||||
}
|
||||
|
@ -36,13 +36,6 @@ namespace osu.Game.Overlays.Profile
|
||||
// todo: pending implementation.
|
||||
// TabControl.AddItem(LayoutStrings.HeaderUsersModding);
|
||||
|
||||
TabControlContainer.Add(new ProfileRulesetSelector
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
User = { BindTarget = User }
|
||||
});
|
||||
|
||||
// Haphazardly guaranteed by OverlayHeader constructor (see CreateBackground / CreateContent).
|
||||
Debug.Assert(centreHeaderContainer != null);
|
||||
Debug.Assert(detailHeaderContainer != null);
|
||||
@ -107,6 +100,11 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
|
||||
|
||||
protected override Drawable CreateTabControlContent() => new ProfileRulesetSelector
|
||||
{
|
||||
User = { BindTarget = User }
|
||||
};
|
||||
|
||||
private void updateDisplay(UserProfileData? user) => coverContainer.User = user?.User;
|
||||
|
||||
private partial class ProfileHeaderTitle : OverlayTitle
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Rankings
|
||||
|
||||
protected override OverlayTitle CreateTitle() => new RankingsTitle();
|
||||
|
||||
protected override Drawable CreateTitleContent() => rulesetSelector = new OverlayRulesetSelector();
|
||||
protected override Drawable CreateTabControlContent() => rulesetSelector = new OverlayRulesetSelector();
|
||||
|
||||
protected override Drawable CreateContent() => countryFilter = new CountryFilter();
|
||||
|
||||
|
@ -62,10 +62,18 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Horizontal = ContentSidePadding },
|
||||
Child = TabControl = CreateTabControl().With(control =>
|
||||
Children = new[]
|
||||
{
|
||||
control.Current = Current;
|
||||
})
|
||||
TabControl = CreateTabControl().With(control =>
|
||||
{
|
||||
control.Current = Current;
|
||||
}),
|
||||
CreateTabControlContent().With(content =>
|
||||
{
|
||||
content.Anchor = Anchor.CentreRight;
|
||||
content.Origin = Anchor.CentreRight;
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -80,6 +88,12 @@ namespace osu.Game.Overlays
|
||||
[NotNull]
|
||||
protected virtual OsuTabControl<T> CreateTabControl() => new OverlayHeaderTabControl();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="OsuTabControl{T}"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
protected virtual Drawable CreateTabControlContent() => Empty();
|
||||
|
||||
public partial class OverlayHeaderTabControl : OverlayTabControl<T>
|
||||
{
|
||||
private const float bar_height = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user