1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 18:42:56 +08:00

Move GamemodeControl to UserProfileOverlay

This commit is contained in:
EVAST9919 2019-06-04 19:33:55 +03:00
parent 8260b61db5
commit e9403bf2f7
4 changed files with 24 additions and 33 deletions

View File

@ -1,10 +1,8 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Overlays.Profile.Header.Components;
using osuTK.Graphics; using osuTK.Graphics;
using System; 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)); 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;
}
} }
} }

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -47,12 +48,14 @@ namespace osu.Game.Overlays.Profile.Header.Components
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(RulesetStore rulesets) private void load(RulesetStore rulesets, OsuColour colours)
{ {
foreach (var r in rulesets.AvailableRulesets) foreach (var r in rulesets.AvailableRulesets)
{ {
AddItem(r); AddItem(r);
} }
AccentColour = colours.Seafoam;
} }
public void SetDefaultGamemode(string gamemode) public void SetDefaultGamemode(string gamemode)

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Profile.Header; using osu.Game.Overlays.Profile.Header;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
@ -19,7 +18,6 @@ namespace osu.Game.Overlays.Profile
public class ProfileHeader : OverlayHeader public class ProfileHeader : OverlayHeader
{ {
private UserCoverBackground coverContainer; private UserCoverBackground coverContainer;
private readonly GamemodeControl gamemodeControl;
public Bindable<User> User = new Bindable<User>(); public Bindable<User> User = new Bindable<User>();
@ -34,21 +32,12 @@ namespace osu.Game.Overlays.Profile
TabControl.AddItem("Modding"); TabControl.AddItem("Modding");
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); 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] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
TabControl.AccentColour = gamemodeControl.AccentColour = colours.Seafoam; TabControl.AccentColour = colours.Seafoam;
} }
protected override Drawable CreateBackground() => protected override Drawable CreateBackground() =>
@ -106,16 +95,7 @@ namespace osu.Game.Overlays.Profile
protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle(); protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle();
private void updateDisplay(User user) private void updateDisplay(User user) => coverContainer.User = user;
{
coverContainer.User = user;
string playMode = user.PlayMode;
gamemodeControl.SetDefaultGamemode(playMode);
gamemodeControl.SelectDefaultGamemode();
gamemodeControl.FadeInFromZero(100, Easing.OutQuint);
}
private class ProfileHeaderTitle : ScreenTitle private class ProfileHeaderTitle : ScreenTitle
{ {

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
@ -25,6 +26,7 @@ namespace osu.Game.Overlays
protected ProfileHeader Header; protected ProfileHeader Header;
private SectionsContainer<ProfileSection> sectionsContainer; private SectionsContainer<ProfileSection> sectionsContainer;
private ProfileTabControl tabs; private ProfileTabControl tabs;
private GamemodeControl gamemodeControl;
public const float CONTENT_X_MARGIN = 70; public const float CONTENT_X_MARGIN = 70;
@ -32,7 +34,8 @@ namespace osu.Game.Overlays
public void ShowUser(User user, bool fetchOnline = true) public void ShowUser(User user, bool fetchOnline = true)
{ {
if (user == User.SYSTEM_USER) return; if (user == User.SYSTEM_USER)
return;
Show(); Show();
@ -77,7 +80,7 @@ namespace osu.Game.Overlays
{ {
Colour = OsuColour.Gray(34), Colour = OsuColour.Gray(34),
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} },
}); });
sectionsContainer.SelectedSection.ValueChanged += section => sectionsContainer.SelectedSection.ValueChanged += section =>
{ {
@ -118,6 +121,15 @@ namespace osu.Game.Overlays
} }
sectionsContainer.ScrollToTop(); 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) 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> private class ProfileTabControl : PageTabControl<ProfileSection>