mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:04:06 +08:00
Add ruleset selector to profile overlay
This commit is contained in:
parent
7683ab68b0
commit
a2e726502f
@ -98,6 +98,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Title = "osu!volunteer",
|
Title = "osu!volunteer",
|
||||||
Colour = "ff0000",
|
Colour = "ff0000",
|
||||||
Achievements = Array.Empty<APIUserAchievement>(),
|
Achievements = Array.Empty<APIUserAchievement>(),
|
||||||
|
PlayMode = "osu"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Header.Components
|
namespace osu.Game.Overlays.Profile.Header.Components
|
||||||
@ -21,7 +23,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
|
|
||||||
private void updateState(UserProfile? userProfile)
|
private void updateState(UserProfile? userProfile)
|
||||||
{
|
{
|
||||||
Current.Value = userProfile?.Ruleset;
|
Current.Value = Items.SingleOrDefault(ruleset => userProfile?.Ruleset.MatchesOnlineID(ruleset) == true);
|
||||||
SetDefaultRuleset(Rulesets.GetRuleset(userProfile?.User.PlayMode ?? @"osu").AsNonNull());
|
SetDefaultRuleset(Rulesets.GetRuleset(userProfile?.User.PlayMode ?? @"osu").AsNonNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Overlays.Profile.Header;
|
using osu.Game.Overlays.Profile.Header;
|
||||||
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
using osu.Game.Resources.Localisation.Web;
|
using osu.Game.Resources.Localisation.Web;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
@ -35,6 +36,13 @@ 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,
|
||||||
|
UserProfile = { BindTarget = UserProfile }
|
||||||
|
});
|
||||||
|
|
||||||
// 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);
|
||||||
|
@ -23,10 +23,10 @@ namespace osu.Game.Overlays
|
|||||||
/// <typeparam name="T">The type of item to be represented by tabs.</typeparam>
|
/// <typeparam name="T">The type of item to be represented by tabs.</typeparam>
|
||||||
public abstract partial class TabControlOverlayHeader<T> : OverlayHeader, IHasCurrentValue<T>
|
public abstract partial class TabControlOverlayHeader<T> : OverlayHeader, IHasCurrentValue<T>
|
||||||
{
|
{
|
||||||
protected OsuTabControl<T> TabControl;
|
protected OsuTabControl<T> TabControl { get; }
|
||||||
|
protected Container TabControlContainer { get; }
|
||||||
|
|
||||||
private readonly Box controlBackground;
|
private readonly Box controlBackground;
|
||||||
private readonly Container tabControlContainer;
|
|
||||||
private readonly BindableWithCurrent<T> current = new BindableWithCurrent<T>();
|
private readonly BindableWithCurrent<T> current = new BindableWithCurrent<T>();
|
||||||
|
|
||||||
public Bindable<T> Current
|
public Bindable<T> Current
|
||||||
@ -41,7 +41,7 @@ namespace osu.Game.Overlays
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.ContentSidePadding = value;
|
base.ContentSidePadding = value;
|
||||||
tabControlContainer.Padding = new MarginPadding { Horizontal = value };
|
TabControlContainer.Padding = new MarginPadding { Horizontal = value };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
tabControlContainer = new Container
|
TabControlContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Loading…
Reference in New Issue
Block a user