mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Move login screen to toolbar and update design (still not fully implemented).
# Conflicts: # osu.Game/Overlays/Options/General/LoginOptions.cs # osu.Game/Overlays/Toolbar/Toolbar.cs
This commit is contained in:
@ -33,31 +33,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
private const float alpha_hovering = 0.8f;
|
||||
private const float alpha_normal = 0.6f;
|
||||
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
MoveToY(0, transition_time, EasingTypes.OutQuint);
|
||||
FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
MoveToY(-DrawSize.Y, transition_time, EasingTypes.InQuint);
|
||||
FadeOut(transition_time, EasingTypes.InQuint);
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
solidBackground.FadeTo(alpha_hovering, transition_time, EasingTypes.OutQuint);
|
||||
gradientBackground.FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
solidBackground.FadeTo(alpha_normal, transition_time, EasingTypes.OutQuint);
|
||||
gradientBackground.FadeOut(transition_time, EasingTypes.OutQuint);
|
||||
}
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
||||
public Toolbar()
|
||||
{
|
||||
@ -96,7 +72,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
new PassThroughFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
@ -124,5 +100,36 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
|
||||
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
MoveToY(0, transition_time, EasingTypes.OutQuint);
|
||||
FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
MoveToY(-DrawSize.Y, transition_time, EasingTypes.InQuint);
|
||||
FadeOut(transition_time, EasingTypes.InQuint);
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
solidBackground.FadeTo(alpha_hovering, transition_time, EasingTypes.OutQuint);
|
||||
gradientBackground.FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
solidBackground.FadeTo(alpha_normal, transition_time, EasingTypes.OutQuint);
|
||||
gradientBackground.FadeOut(transition_time, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
class PassThroughFlowContainer : FlowContainer
|
||||
{
|
||||
//needed to get input to the login overlay.
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,17 +12,18 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarUserButton : ToolbarButton, IOnlineComponent
|
||||
{
|
||||
private Avatar avatar;
|
||||
private LoginOverlay loginOverlay;
|
||||
|
||||
public ToolbarUserButton()
|
||||
{
|
||||
@ -33,10 +34,29 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Flow.Add(avatar = new Avatar());
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || loginOverlay.Contains(screenSpacePos);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(APIAccess api, OsuConfigManager config)
|
||||
private void load(APIAccess api, OsuGameBase game)
|
||||
{
|
||||
api.Register(this);
|
||||
|
||||
(loginOverlay = new LoginOverlay
|
||||
{
|
||||
Position = new Vector2(0, 1),
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}).Preload(game, Add);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
if (!base.Contains(state.Mouse.NativeState.Position)) return false;
|
||||
|
||||
loginOverlay.ToggleVisibility();
|
||||
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
public void APIStateChanged(APIAccess api, APIState state)
|
||||
|
Reference in New Issue
Block a user