1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Merge branch 'single-osu-logo' into intro-v2

This commit is contained in:
Dean Herbert 2017-11-03 15:37:24 +09:00
commit 2f205d1f63
13 changed files with 297 additions and 98 deletions

@ -1 +1 @@
Subproject commit 715a8328a80af072c31dbc807b3119b3c58df8c6
Subproject commit 3c074a0981844fbaa9f2ecbf879c542f07e2b94d

View File

@ -118,6 +118,7 @@ namespace osu.Game.Online.API
//NotificationOverlay.ShowMessage("Login failed!");
log.Add(@"Login failed!");
Password = null;
authentication.Clear();
continue;
}

View File

@ -27,6 +27,9 @@ namespace osu.Game.Online.API
internal bool AuthenticateWithLogin(string username, string password)
{
if (string.IsNullOrEmpty(username)) return false;
if (string.IsNullOrEmpty(password)) return false;
using (var req = new AccessTokenRequestPassword(username, password)
{
Url = $@"{endpoint}/oauth/token",

View File

@ -2,7 +2,9 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Screens.Menu;
using OpenTK;
namespace osu.Game.Screens
{
@ -15,6 +17,18 @@ namespace osu.Game.Screens
ValidForResume = false;
}
protected override void LogoSetup(OsuLogo logo, bool resuming)
{
base.LogoSetup(logo, resuming);
logo.RelativePositionAxes = Axes.Both;
logo.Triangles = false;
logo.Position = new Vector2(0.9f);
logo.Scale = new Vector2(0.2f);
logo.FadeInFromZero(5000, Easing.OutQuint);
}
[BackgroundDependencyLoader]
private void load(OsuGame game)
{

View File

@ -39,12 +39,25 @@ namespace osu.Game.Screens.Menu
//todo: make these non-internal somehow.
internal const float BUTTON_AREA_HEIGHT = 100;
internal const float BUTTON_WIDTH = 140f;
internal const float WEDGE_WIDTH = 20;
public const int EXIT_DELAY = 3000;
private OsuLogo logo;
public void SetOsuLogo(OsuLogo logo)
{
this.logo = logo;
if (this.logo != null)
{
this.logo.Action = onOsuLogo;
// osuLogo.SizeForFlow relies on loading to be complete.
buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0);
}
}
private readonly OsuLogo osuLogo;
private readonly Drawable iconFacade;
private readonly Container buttonArea;
private readonly Box buttonAreaBackground;
@ -99,12 +112,6 @@ namespace osu.Game.Screens.Menu
}
}
},
osuLogo = new OsuLogo
{
Action = onOsuLogo,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
};
buttonsPlay.Add(new Button(@"solo", @"select-6", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
@ -127,14 +134,6 @@ namespace osu.Game.Screens.Menu
sampleBack = audio.Sample.Get(@"Menu/select-4");
}
protected override void LoadComplete()
{
base.LoadComplete();
// osuLogo.SizeForFlow relies on loading to be complete.
buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + osuLogo.SizeForFlow / 4), 0);
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Repeat) return false;
@ -142,7 +141,7 @@ namespace osu.Game.Screens.Menu
switch (args.Key)
{
case Key.Space:
osuLogo.TriggerOnClick(state);
logo?.TriggerOnClick(state);
return true;
case Key.Escape:
switch (State)
@ -215,24 +214,31 @@ namespace osu.Game.Screens.Menu
backButton.ContractStyle = 0;
settingsButton.ContractStyle = 0;
bool fromInitial = lastState == MenuState.Initial;
if (state == MenuState.TopLevel)
buttonArea.FinishTransforms(true);
using (buttonArea.BeginDelayedSequence(fromInitial ? 150 : 0, true))
using (buttonArea.BeginDelayedSequence(lastState == MenuState.Initial ? 150 : 0, true))
{
switch (state)
{
case MenuState.Exit:
case MenuState.Initial:
trackingPosition = false;
buttonAreaBackground.ScaleTo(Vector2.One, 500, Easing.Out);
buttonArea.FadeOut(300);
osuLogo.Delay(150)
.Schedule(() => toolbar?.Hide())
.ScaleTo(1, 800, Easing.OutExpo)
.MoveTo(Vector2.Zero, 800, Easing.OutExpo);
logo?.Delay(150)
.Schedule(() =>
{
toolbar?.Hide();
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
logo.MoveTo(new Vector2(0.5f), 800, Easing.OutExpo);
logo.ScaleTo(1, 800, Easing.OutExpo);
});
foreach (Button b in buttonsTopLevel)
b.State = ButtonState.Contracted;
@ -240,27 +246,40 @@ namespace osu.Game.Screens.Menu
foreach (Button b in buttonsPlay)
b.State = ButtonState.Contracted;
if (state == MenuState.Exit)
{
osuLogo.RotateTo(20, EXIT_DELAY * 1.5f);
osuLogo.FadeOut(EXIT_DELAY);
}
else if (lastState == MenuState.TopLevel)
if (state != MenuState.Exit && lastState == MenuState.TopLevel)
sampleBack?.Play();
break;
case MenuState.TopLevel:
buttonAreaBackground.ScaleTo(Vector2.One, 200, Easing.Out);
var sequence = osuLogo
.ScaleTo(0.5f, 200, Easing.In)
.MoveTo(buttonFlow.DrawPosition, 200, Easing.In);
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.None;
if (fromInitial && osuLogo.Scale.X > 0.5f)
sequence.OnComplete(o =>
{
o.Impact();
toolbar?.Show();
});
trackingPosition = true;
switch (lastState)
{
case MenuState.Initial:
logo.ScaleTo(0.5f, 200, Easing.In);
trackingPosition = false;
logo
.MoveTo(iconTrackingPosition, lastState == MenuState.EnteringMode ? 0 : 200, Easing.In)
.OnComplete(o =>
{
trackingPosition = true;
if (logo.Scale.X > 0.5f)
{
o.Impact();
toolbar?.Show();
}
});
break;
default:
logo.ScaleTo(0.5f, 200, Easing.OutQuint);
break;
}
buttonArea.FadeIn(300);
@ -280,6 +299,8 @@ namespace osu.Game.Screens.Menu
case MenuState.EnteringMode:
buttonAreaBackground.ScaleTo(new Vector2(2, 0), 300, Easing.InSine);
trackingPosition = true;
buttonsTopLevel.ForEach(b => b.ContractStyle = 1);
buttonsPlay.ForEach(b => b.ContractStyle = 1);
backButton.ContractStyle = 1;
@ -301,15 +322,26 @@ namespace osu.Game.Screens.Menu
}
}
private Vector2 iconTrackingPosition => logo.Parent.ToLocalSpace(iconFacade.ScreenSpaceDrawQuad.Centre);
private bool trackingPosition;
public void SetLogoTracking(bool value) => trackingPosition = value;
protected override void Update()
{
//if (OsuGame.IdleTime > 6000 && State != MenuState.Exit)
// State = MenuState.Initial;
osuLogo.Interactive = Alpha > 0.2f;
iconFacade.Width = osuLogo.SizeForFlow * 0.5f;
base.Update();
if (logo != null)
{
if (trackingPosition)
logo.Position = iconTrackingPosition;
iconFacade.Width = logo.SizeForFlow * 0.5f;
}
}
}

View File

@ -14,6 +14,8 @@ using osu.Game.Beatmaps.IO;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Screens.Menu
{
@ -38,24 +40,10 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
public Intro()
{
Children = new Drawable[]
{
new ParallaxContainer
{
ParallaxAmount = 0.01f,
Child = introSequence = new IntroSequence
{
Blending = BlendingMode.Additive,
},
}
};
}
private Bindable<bool> menuVoice;
private Bindable<bool> menuMusic;
private Track track;
private readonly ParallaxContainer parallax;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
@ -112,10 +100,48 @@ namespace osu.Game.Screens.Menu
{
DidLoadMenu = true;
Push(mainMenu);
}, 3500);
}, 600);
}, delay_step_one);
}, delay_step_two);
}
introSequence.Start();
private const double delay_step_one = 2300;
private const double delay_step_two = 600;
public const int EXIT_DELAY = 3000;
protected override void LogoSetup(OsuLogo logo, bool resuming)
{
base.LogoSetup(logo, resuming);
logo.RelativePositionAxes = Axes.Both;
logo.Triangles = false;
logo.Colour = Color4.DarkGray;
logo.Ripple = false;
const int quick_appear = 350;
int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
if (!resuming)
{
logo.ScaleTo(0.4f);
logo.FadeOut();
logo.ScaleTo(1, delay_step_one + delay_step_two, Easing.OutQuint);
logo.FadeIn(delay_step_one + delay_step_two, Easing.OutQuint);
}
else
{
logo
.ScaleTo(1, initialMovementTime, Easing.OutQuint)
.FadeIn(quick_appear, Easing.OutQuint)
.Then()
.RotateTo(20, EXIT_DELAY * 1.5f)
.FadeOut(EXIT_DELAY);
}
}
protected override void OnSuspending(Screen next)
@ -135,7 +161,7 @@ namespace osu.Game.Screens.Menu
if (!(last is MainMenu))
Content.FadeIn(300);
double fadeOutTime = 2000;
double fadeOutTime = EXIT_DELAY;
//we also handle the exit transition.
if (menuVoice)
seeya.Play();

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -102,6 +103,29 @@ namespace osu.Game.Screens.Menu
Beatmap.ValueChanged += beatmap_ValueChanged;
}
protected override void LogoSetup(OsuLogo logo, bool resuming)
{
base.LogoSetup(logo, resuming);
buttons.SetOsuLogo(logo);
logo.Triangles = true;
logo.Ripple = false;
logo.FadeColour(Color4.White, 100, Easing.OutQuint);
logo.FadeIn(100, Easing.OutQuint);
if (resuming)
buttons.State = MenuState.TopLevel;
}
protected override void LogoOnSuspending(OsuLogo logo)
{
logo.FadeOut(300, Easing.InSine)
.ScaleTo(0.2f, 300, Easing.InSine)
.OnComplete(l => buttons.SetOsuLogo(null));
}
private void beatmap_ValueChanged(WorkingBeatmap newValue)
{
if (!IsCurrentScreen)
@ -135,8 +159,6 @@ namespace osu.Game.Screens.Menu
const float length = 300;
buttons.State = MenuState.TopLevel;
Content.FadeIn(length, Easing.OutQuint);
Content.MoveTo(new Vector2(0, 0), length, Easing.OutQuint);

View File

@ -29,6 +29,8 @@ namespace osu.Game.Screens.Menu
{
public readonly Color4 OsuPink = OsuColour.FromHex(@"e967a1");
private const double transition_length = 300;
private readonly Sprite logo;
private readonly CircularContainer logoContainer;
private readonly Container logoBounceContainer;
@ -54,7 +56,7 @@ namespace osu.Game.Screens.Menu
public bool Triangles
{
set { colourAndTriangles.Alpha = value ? 1 : 0; }
set { colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); }
}
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos);
@ -62,10 +64,9 @@ namespace osu.Game.Screens.Menu
public bool Ripple
{
get { return rippleContainer.Alpha > 0; }
set { rippleContainer.Alpha = value ? 1 : 0; }
set { rippleContainer.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); }
}
public bool Interactive = true;
private readonly Box flashLayer;
private readonly Container impactContainer;
@ -76,11 +77,12 @@ namespace osu.Game.Screens.Menu
public OsuLogo()
{
AlwaysPresent = true;
EarlyActivationMilliseconds = early_activation;
Size = new Vector2(default_size);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
@ -222,6 +224,27 @@ namespace osu.Game.Screens.Menu
ripple.Texture = textures.Get(@"Menu/logo");
}
private double? reservationEndTime;
private Action<OsuLogo> reservationCallback;
private bool canFulfillReservation => !reservationEndTime.HasValue || reservationEndTime <= Time.Current;
public void RequestUsage(Action<OsuLogo> callback)
{
reservationCallback = callback;
}
private void fulfillReservation()
{
reservationCallback(this);
reservationCallback = null;
}
public void ReserveFor(float duration)
{
reservationEndTime = Time.Current + duration;
}
private int lastBeatIndex;
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
@ -288,11 +311,16 @@ namespace osu.Game.Screens.Menu
{
triangles.Velocity = paused_velocity;
}
if (reservationCallback != null && canFulfillReservation)
fulfillReservation();
}
private bool interactive => Action != null && Alpha > 0.2f;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
if (!Interactive) return false;
if (!interactive) return false;
logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out);
return true;
@ -306,7 +334,7 @@ namespace osu.Game.Screens.Menu
protected override bool OnClick(InputState state)
{
if (!Interactive) return false;
if (!interactive) return false;
sampleClick.Play();
@ -320,7 +348,7 @@ namespace osu.Game.Screens.Menu
protected override bool OnHover(InputState state)
{
if (!Interactive) return false;
if (!interactive) return false;
logoHoverContainer.ScaleTo(1.1f, 500, Easing.OutElastic);
return true;

View File

@ -10,7 +10,9 @@ using osu.Game.Graphics.Containers;
using OpenTK;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio;
using osu.Framework.Graphics;
using osu.Game.Rulesets;
using osu.Game.Screens.Menu;
namespace osu.Game.Screens
{
@ -30,6 +32,8 @@ namespace osu.Game.Screens
public virtual bool HasLocalCursorDisplayed => false;
private OsuLogo logo;
/// <summary>
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
@ -72,9 +76,16 @@ namespace osu.Game.Screens
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
logo.DelayUntilTransformsFinished().Schedule(() => logoSetup(true));
sampleExit?.Play();
}
protected override void OnSuspending(Screen next)
{
base.OnSuspending(next);
logoOnSuspending();
}
protected override void OnEntering(Screen last)
{
OsuScreen lastOsu = last as OsuScreen;
@ -106,11 +117,19 @@ namespace osu.Game.Screens
});
}
if ((logo = lastOsu?.logo) == null)
AddInternal(logo = new OsuLogo());
base.OnEntering(last);
logo.DelayUntilTransformsFinished().Schedule(() => logoSetup(false));
}
protected override bool OnExiting(Screen next)
{
if (ValidForResume && logo != null)
logoOnExiting();
OsuScreen nextOsu = next as OsuScreen;
if (Background != null && !Background.Equals(nextOsu?.Background))
@ -128,5 +147,33 @@ namespace osu.Game.Screens
Beatmap.UnbindAll();
return false;
}
private void logoSetup(bool resuming) => LogoSetup(logo, resuming);
protected virtual void LogoSetup(OsuLogo logo, bool resuming)
{
logo.Action = null;
logo.FadeOut(300, Easing.OutQuint);
}
private void logoOnExiting()
{
logo.ClearTransforms();
LogoOnExiting(logo);
}
protected virtual void LogoOnExiting(OsuLogo logo)
{
}
private void logoOnSuspending()
{
logo.ClearTransforms();
LogoOnSuspending(logo);
}
protected virtual void LogoOnSuspending(OsuLogo logo)
{
}
}
}

View File

@ -10,9 +10,9 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Menu;
using OpenTK;
using osu.Framework.Localisation;
using osu.Game.Screens.Menu;
namespace osu.Game.Screens.Play
{
@ -20,7 +20,6 @@ namespace osu.Game.Screens.Play
{
private Player player;
private readonly OsuLogo logo;
private BeatmapMetadataDisplay info;
private bool showOverlays = true;
@ -39,15 +38,6 @@ namespace osu.Game.Screens.Play
showOverlays = false;
ValidForResume = true;
};
Children = new Drawable[]
{
logo = new OsuLogo
{
Scale = new Vector2(0.15f),
Interactive = false,
},
};
}
[BackgroundDependencyLoader]
@ -101,11 +91,24 @@ namespace osu.Game.Screens.Play
contentIn();
logo.Delay(500).MoveToOffset(new Vector2(0, -180), 500, Easing.InOutExpo);
info.Delay(750).FadeIn(500);
this.Delay(2150).Schedule(pushWhenLoaded);
}
protected override void LogoSetup(OsuLogo logo, bool resuming)
{
base.LogoSetup(logo, resuming);
logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.Both;
logo.ScaleTo(new Vector2(0.15f), 300, Easing.In);
logo.MoveTo(new Vector2(0.5f), 300, Easing.In);
logo.FadeIn(350);
logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo);
}
private void pushWhenLoaded()
{
if (player.LoadState != LoadState.Ready)

View File

@ -13,7 +13,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Menu;
namespace osu.Game.Screens.Select
{
@ -31,12 +30,9 @@ namespace osu.Game.Screens.Select
private const float padding = 80;
public Action OnBack;
public Action OnStart;
private readonly FillFlowContainer<FooterButton> buttons;
public OsuLogo StartButton;
/// <param name="text">Text on the button.</param>
/// <param name="colour">Colour of the button.</param>
/// <param name="hotkey">Hotkey of the button.</param>
@ -106,13 +102,6 @@ namespace osu.Game.Screens.Select
Height = 3,
Position = new Vector2(0, -3),
},
StartButton = new OsuLogo
{
Anchor = Anchor.BottomRight,
Scale = new Vector2(0.4f),
Position = new Vector2(-70, -25),
Action = () => OnStart?.Invoke()
},
new BackButton
{
Anchor = Anchor.BottomLeft,
@ -143,8 +132,6 @@ namespace osu.Game.Screens.Select
updateModeLight();
}
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || StartButton.ReceiveMouseInputAt(screenSpacePos);
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
protected override bool OnClick(InputState state) => true;

View File

@ -20,6 +20,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Select.Options;
namespace osu.Game.Screens.Select
@ -153,7 +154,6 @@ namespace osu.Game.Screens.Select
Add(Footer = new Footer
{
OnBack = Exit,
OnStart = () => carouselRaisedStart(),
});
FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
@ -309,6 +309,41 @@ namespace osu.Game.Screens.Select
FilterControl.Activate();
}
private const double logo_transition = 250;
protected override void LogoSetup(OsuLogo logo, bool resuming)
{
base.LogoSetup(logo, resuming);
logo.ClearTransforms();
logo.RelativePositionAxes = Axes.Both;
Vector2 position = new Vector2(0.95f, 0.96f);
if (logo.Alpha > 0.8f)
{
logo.MoveTo(position, 500, Easing.OutQuint);
}
else
{
logo.Hide();
logo.ScaleTo(0.2f);
logo.MoveTo(position);
}
logo.FadeIn(logo_transition, Easing.OutQuint);
logo.ScaleTo(0.4f, logo_transition, Easing.OutQuint);
logo.Action = () => carouselRaisedStart();
}
protected override void LogoOnExiting(OsuLogo logo)
{
base.LogoOnExiting(logo);
logo.ScaleTo(0.2f, logo_transition, Easing.OutQuint);
logo.FadeOut(logo_transition, Easing.OutQuint);
}
private void beatmap_ValueChanged(WorkingBeatmap beatmap)
{
if (!IsCurrentScreen) return;
@ -350,6 +385,7 @@ namespace osu.Game.Screens.Select
Content.FadeOut(100);
FilterControl.Deactivate();
return base.OnExiting(next);
}

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 15.0.27004.2006
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game", "osu.Game\osu.Game.csproj", "{2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "osu.Framework", "osu-framework\osu.Framework\osu.Framework.csproj", "{C76BF5B3-985E-4D39-95FE-97C9C879B83A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework", "osu-framework\osu.Framework\osu.Framework.csproj", "{C76BF5B3-985E-4D39-95FE-97C9C879B83A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Resources", "osu-resources\osu.Game.Resources\osu.Game.Resources.csproj", "{D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}"
EndProject