mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 06:12:55 +08:00
Move GamemodeControl to UserProfileOverlay
This commit is contained in:
parent
8260b61db5
commit
e9403bf2f7
@ -1,10 +1,8 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Profile.Header.Components;
|
||||
using osuTK.Graphics;
|
||||
using System;
|
||||
@ -38,11 +36,5 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
AddStep("set random colour", () => control.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1));
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
control.AccentColour = colours.Seafoam;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
@ -47,12 +48,14 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore rulesets)
|
||||
private void load(RulesetStore rulesets, OsuColour colours)
|
||||
{
|
||||
foreach (var r in rulesets.AvailableRulesets)
|
||||
{
|
||||
AddItem(r);
|
||||
}
|
||||
|
||||
AccentColour = colours.Seafoam;
|
||||
}
|
||||
|
||||
public void SetDefaultGamemode(string gamemode)
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Profile.Header;
|
||||
using osu.Game.Overlays.Profile.Header.Components;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Profile
|
||||
@ -19,7 +18,6 @@ namespace osu.Game.Overlays.Profile
|
||||
public class ProfileHeader : OverlayHeader
|
||||
{
|
||||
private UserCoverBackground coverContainer;
|
||||
private readonly GamemodeControl gamemodeControl;
|
||||
|
||||
public Bindable<User> User = new Bindable<User>();
|
||||
|
||||
@ -34,21 +32,12 @@ namespace osu.Game.Overlays.Profile
|
||||
TabControl.AddItem("Modding");
|
||||
|
||||
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
|
||||
|
||||
Add(gamemodeControl = new GamemodeControl
|
||||
{
|
||||
Alpha = 0,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Y = 100,
|
||||
Margin = new MarginPadding { Right = 30 },
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
TabControl.AccentColour = gamemodeControl.AccentColour = colours.Seafoam;
|
||||
TabControl.AccentColour = colours.Seafoam;
|
||||
}
|
||||
|
||||
protected override Drawable CreateBackground() =>
|
||||
@ -106,16 +95,7 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle();
|
||||
|
||||
private void updateDisplay(User user)
|
||||
{
|
||||
coverContainer.User = user;
|
||||
|
||||
string playMode = user.PlayMode;
|
||||
|
||||
gamemodeControl.SetDefaultGamemode(playMode);
|
||||
gamemodeControl.SelectDefaultGamemode();
|
||||
gamemodeControl.FadeInFromZero(100, Easing.OutQuint);
|
||||
}
|
||||
private void updateDisplay(User user) => coverContainer.User = user;
|
||||
|
||||
private class ProfileHeaderTitle : ScreenTitle
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Profile;
|
||||
using osu.Game.Overlays.Profile.Header.Components;
|
||||
using osu.Game.Overlays.Profile.Sections;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
@ -25,6 +26,7 @@ namespace osu.Game.Overlays
|
||||
protected ProfileHeader Header;
|
||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
||||
private ProfileTabControl tabs;
|
||||
private GamemodeControl gamemodeControl;
|
||||
|
||||
public const float CONTENT_X_MARGIN = 70;
|
||||
|
||||
@ -32,7 +34,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
public void ShowUser(User user, bool fetchOnline = true)
|
||||
{
|
||||
if (user == User.SYSTEM_USER) return;
|
||||
if (user == User.SYSTEM_USER)
|
||||
return;
|
||||
|
||||
Show();
|
||||
|
||||
@ -77,7 +80,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Colour = OsuColour.Gray(34),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}
|
||||
},
|
||||
});
|
||||
sectionsContainer.SelectedSection.ValueChanged += section =>
|
||||
{
|
||||
@ -118,6 +121,15 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
sectionsContainer.ScrollToTop();
|
||||
|
||||
Header.Add(gamemodeControl = new GamemodeControl
|
||||
{
|
||||
Alpha = 0,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Y = 100,
|
||||
Margin = new MarginPadding { Right = 30 },
|
||||
});
|
||||
}
|
||||
|
||||
private void userLoadComplete(User user)
|
||||
@ -139,6 +151,10 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gamemodeControl.SetDefaultGamemode(user.PlayMode);
|
||||
gamemodeControl.SelectDefaultGamemode();
|
||||
gamemodeControl.FadeInFromZero(100, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private class ProfileTabControl : PageTabControl<ProfileSection>
|
||||
|
Loading…
Reference in New Issue
Block a user