1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Implement a login placeholder (#7438)

Implement a login placeholder
This commit is contained in:
Dean Herbert 2020-01-08 16:55:41 +08:00 committed by GitHub
commit d33a507d96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 3 deletions

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards;
using osu.Game.Online.Placeholders;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards;

View File

@ -14,6 +14,7 @@ using osu.Framework.Threading;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.Placeholders;
using osuTK;
using osuTK.Graphics;
@ -150,7 +151,7 @@ namespace osu.Game.Online.Leaderboards
break;
case PlaceholderState.NotLoggedIn:
replacePlaceholder(new MessagePlaceholder(@"Please sign in to view online leaderboards!"));
replacePlaceholder(new LoginPlaceholder());
break;
case PlaceholderState.NotSupporter:

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers;
using osu.Game.Online.Placeholders;
using osuTK;
namespace osu.Game.Online.Leaderboards

View File

@ -0,0 +1,46 @@
// 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.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Game.Overlays;
namespace osu.Game.Online.Placeholders
{
public sealed class LoginPlaceholder : Placeholder
{
[Resolved(CanBeNull = true)]
private LoginOverlay login { get; set; }
public LoginPlaceholder()
{
AddIcon(FontAwesome.Solid.UserLock, cp =>
{
cp.Font = cp.Font.With(size: TEXT_SIZE);
cp.Padding = new MarginPadding { Right = 10 };
});
AddText(@"Please sign in to view online leaderboards!");
}
protected override bool OnMouseDown(MouseDownEvent e)
{
this.ScaleTo(0.8f, 4000, Easing.OutQuint);
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
{
this.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(e);
}
protected override bool OnClick(ClickEvent e)
{
login?.Show();
return base.OnClick(e);
}
}
}

View File

@ -4,7 +4,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Online.Leaderboards
namespace osu.Game.Online.Placeholders
{
public class MessagePlaceholder : Placeholder
{

View File

@ -5,7 +5,7 @@ using System;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Online.Leaderboards
namespace osu.Game.Online.Placeholders
{
public abstract class Placeholder : OsuTextFlowContainer, IEquatable<Placeholder>
{