Update usage design.

This commit is contained in:
Huo Yaoyuan 2017-06-15 20:01:46 +08:00
parent 13d9f3b9bb
commit 53bd22cf9c
2 changed files with 23 additions and 10 deletions

View File

@ -16,21 +16,31 @@ namespace osu.Desktop.VisualTests.Tests
public override void Reset()
{
base.Reset();
var userpage = new UserProfileOverlay(new User
{
Username = @"peppy",
Id = 2,
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
})
var profile = new UserProfileOverlay
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 50 },
State = Visibility.Visible
};
Add(userpage);
Add(profile);
AddStep("Show ppy", () => profile.ShowUser(new User
{
Username = @"peppy",
Id = 2,
Country = new Country { FullName = @"Australia", FlagName = @"AU" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg"
}));
AddStep("Show flyte", () => profile.ShowUser(new User
{
Username = @"flyte",
Id = 3103765,
Country = new Country { FullName = @"Japan", FlagName = @"JP" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg"
}));
AddStep("Hide", profile.Hide);
AddStep("Show without reload", profile.Show);
}
}
}

View File

@ -22,8 +22,10 @@ namespace osu.Game.Overlays
public const float CONTENT_X_MARGIN = 50;
public UserProfileOverlay(User user)
public void ShowUser(User user)
{
Clear();
lastSection = null;
var sections = new ProfileSection[]
{
new AboutSection(),
@ -87,6 +89,7 @@ namespace osu.Game.Overlays
sectionsContainer.ScrollContainer.ScrollIntoView(lastSection);
}
};
Show();
}
private class ProfileTabControl : PageTabControl<ProfileSection>