1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 10:33:07 +08:00

Basic section management of userpage.

This commit is contained in:
Huo Yaoyuan 2017-05-25 02:11:07 +08:00
parent 16212fce19
commit 9bc1eece0a
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.UserPage
{
public class UserPageHeader : Container
{
}
}

View File

@ -0,0 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Game.Users;
namespace osu.Game.Overlays.UserPage
{
public abstract class UserPageSection : Container
{
protected readonly User User;
public abstract string Title { get; }
protected UserPageSection(User user)
{
User = user;
}
}
}

View File

@ -0,0 +1,54 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.UserPage;
using osu.Game.Users;
namespace osu.Game.Overlays
{
public class UserPageOverlay : FocusedOverlayContainer
{
private readonly User user;
private UserPageSection lastSection;
public UserPageOverlay(User user)
{
this.user = user;
var tab = new OsuTabControl<UserPageSection>();
var sections = new UserPageSection[] { };
var sectionsContainer = new SectionsContainer
{
ExpandableHeader = new UserPageHeader(),
FixedHeader = tab,
Sections = sections
};
Add(sectionsContainer);
sectionsContainer.SelectedSection.ValueChanged += s =>
{
if (lastSection != s)
{
lastSection = s as UserPageSection;
tab.Current.Value = lastSection;
}
};
tab.Current.ValueChanged += s =>
{
if (lastSection != s)
{
lastSection = s;
sectionsContainer.ScrollContainer.ScrollIntoView(lastSection);
}
};
}
}
}

View File

@ -85,6 +85,9 @@
<Compile Include="Overlays\Settings\SettingsHeader.cs" />
<Compile Include="Overlays\Settings\Sections\Audio\MainMenuSettings.cs" />
<Compile Include="Overlays\Toolbar\ToolbarChatButton.cs" />
<Compile Include="Overlays\UserPageOverlay.cs" />
<Compile Include="Overlays\UserPage\UserPageHeader.cs" />
<Compile Include="Overlays\UserPage\UserPageSection.cs" />
<Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" />
<Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" />
<Compile Include="Beatmaps\ControlPoints\ControlPoint.cs" />