mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09: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 OverlayTitle CreateTitle() => new TestTitle();
|
||||||
|
|
||||||
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector();
|
protected override Drawable CreateTabControlContent() => new OverlayRulesetSelector();
|
||||||
|
|
||||||
public TestStringTabControlHeader()
|
public TestStringTabControlHeader()
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -16,7 +17,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
public partial class BeatmapSetHeader : OverlayHeader
|
public partial class BeatmapSetHeader : TabControlOverlayHeader<BeatmapSetTabs>
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
BeatmapSet = { BindTarget = BeatmapSet }
|
BeatmapSet = { BindTarget = BeatmapSet }
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override Drawable CreateTitleContent() => RulesetSelector = new BeatmapRulesetSelector
|
protected override Drawable CreateTabControlContent() => RulesetSelector = new BeatmapRulesetSelector
|
||||||
{
|
{
|
||||||
Current = ruleset
|
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,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new[]
|
Child = Title = CreateTitle().With(title =>
|
||||||
{
|
{
|
||||||
Title = CreateTitle().With(title =>
|
title.Anchor = Anchor.CentreLeft;
|
||||||
{
|
title.Origin = Anchor.CentreLeft;
|
||||||
title.Anchor = Anchor.CentreLeft;
|
}),
|
||||||
title.Origin = Anchor.CentreLeft;
|
|
||||||
}),
|
|
||||||
CreateTitleContent().With(content =>
|
|
||||||
{
|
|
||||||
content.Anchor = Anchor.CentreRight;
|
|
||||||
content.Origin = Anchor.CentreRight;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -112,12 +104,6 @@ namespace osu.Game.Overlays
|
|||||||
[NotNull]
|
[NotNull]
|
||||||
protected virtual Drawable CreateBackground() => Empty();
|
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();
|
protected abstract OverlayTitle CreateTitle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,13 +36,6 @@ namespace osu.Game.Overlays.Profile
|
|||||||
// todo: pending implementation.
|
// todo: pending implementation.
|
||||||
// TabControl.AddItem(LayoutStrings.HeaderUsersModding);
|
// 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).
|
// Haphazardly guaranteed by OverlayHeader constructor (see CreateBackground / CreateContent).
|
||||||
Debug.Assert(centreHeaderContainer != null);
|
Debug.Assert(centreHeaderContainer != null);
|
||||||
Debug.Assert(detailHeaderContainer != null);
|
Debug.Assert(detailHeaderContainer != null);
|
||||||
@ -107,6 +100,11 @@ namespace osu.Game.Overlays.Profile
|
|||||||
|
|
||||||
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
|
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 void updateDisplay(UserProfileData? user) => coverContainer.User = user?.User;
|
||||||
|
|
||||||
private partial class ProfileHeaderTitle : OverlayTitle
|
private partial class ProfileHeaderTitle : OverlayTitle
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Rankings
|
|||||||
|
|
||||||
protected override OverlayTitle CreateTitle() => new RankingsTitle();
|
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();
|
protected override Drawable CreateContent() => countryFilter = new CountryFilter();
|
||||||
|
|
||||||
|
@ -62,10 +62,18 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding { Horizontal = ContentSidePadding },
|
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]
|
[NotNull]
|
||||||
protected virtual OsuTabControl<T> CreateTabControl() => new OverlayHeaderTabControl();
|
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>
|
public partial class OverlayHeaderTabControl : OverlayTabControl<T>
|
||||||
{
|
{
|
||||||
private const float bar_height = 1;
|
private const float bar_height = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user