diff --git a/osu.Game/GameModes/Menu/ButtonSystem.cs b/osu.Game/GameModes/Menu/ButtonSystem.cs index 6a0c2bc29e..dcb13dbbab 100644 --- a/osu.Game/GameModes/Menu/ButtonSystem.cs +++ b/osu.Game/GameModes/Menu/ButtonSystem.cs @@ -19,7 +19,7 @@ using OpenTK.Input; namespace osu.Game.GameModes.Menu { - public class ButtonSystem : Container + public partial class ButtonSystem : Container { public Action OnEdit; public Action OnExit; @@ -103,8 +103,9 @@ namespace osu.Game.GameModes.Menu } } }, - osuLogo = new OsuLogo(onOsuLogo) + osuLogo = new OsuLogo { + Action = onOsuLogo, Origin = Anchor.Centre, Anchor = Anchor.Centre } @@ -273,95 +274,6 @@ namespace osu.Game.GameModes.Menu base.Update(); } - /// - /// osu! logo and its attachments (pulsing, visualiser etc.) - /// - class OsuLogo : AutoSizeContainer - { - private Sprite logo; - private Container logoBounceContainer; - private MenuVisualisation vis; - private Action clickAction; - - public float SizeForFlow => logo == null ? 0 : logo.Size.X * logo.Scale.X * logoBounceContainer.Scale.X * 0.8f; - - public override void Load() - { - base.Load(); - - Sprite ripple; - - Children = new Drawable[] - { - logoBounceContainer = new AutoSizeContainer - { - Children = new Drawable[] - { - logo = new Sprite() - { - Texture = Game.Textures.Get(@"Menu/logo"), - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }, - ripple = new Sprite() - { - Texture = Game.Textures.Get(@"Menu/logo"), - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0.4f - }, - vis = new MenuVisualisation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = logo.Size, - Additive = true, - Alpha = 0.2f, - } - } - } - }; - - ripple.ScaleTo(1.1f, 500); - ripple.FadeOut(500); - ripple.Loop(300); - } - - public OsuLogo(Action action) - { - clickAction = action; - } - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - logoBounceContainer.ScaleTo(1.1f, 1000, EasingTypes.Out); - return true; - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - logoBounceContainer.ScaleTo(1.2f, 500, EasingTypes.OutElastic); - return true; - } - - protected override bool OnClick(InputState state) - { - clickAction?.Invoke(); - return true; - } - - protected override bool OnHover(InputState state) - { - logoBounceContainer.ScaleTo(1.2f, 500, EasingTypes.OutElastic); - return true; - } - - protected override void OnHoverLost(InputState state) - { - logoBounceContainer.ScaleTo(1, 500, EasingTypes.OutElastic); - } - } - /// /// A flow container with an origin based on one of its contained drawables. /// diff --git a/osu.Game/GameModes/Menu/Intro.cs b/osu.Game/GameModes/Menu/Intro.cs index 40f4a93d87..5bc41572e3 100644 --- a/osu.Game/GameModes/Menu/Intro.cs +++ b/osu.Game/GameModes/Menu/Intro.cs @@ -5,24 +5,46 @@ using System; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; using osu.Framework.GameModes; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transformations; using osu.Game.GameModes.Backgrounds; +using OpenTK.Graphics; namespace osu.Game.GameModes.Menu { class Intro : OsuGameMode { + private OsuLogo logo; protected override BackgroundMode CreateBackground() => new BackgroundModeEmpty(); public override void Load() { base.Load(); + Children = new Drawable[] + { + logo = new OsuLogo() + { + Alpha = 0, + Additive = true, + Interactive = false, + Colour = Color4.DarkGray, + Ripple = false + } + }; + AudioSample welcome = Game.Audio.Sample.Get(@"welcome"); welcome.Play(); AudioTrack bgm = Game.Audio.Track.Get(@"circles"); bgm.Looping = true; + Game.Scheduler.Add(delegate + { + welcome.Play(); + }, true); + + Game.Scheduler.AddDelayed(delegate { bgm.Start(); @@ -32,6 +54,17 @@ namespace osu.Game.GameModes.Menu { Push(new MainMenu()); }, 2900); + + logo.ScaleTo(0); + + logo.ScaleTo(1,5900, EasingTypes.OutQuint); + logo.FadeIn(30000, EasingTypes.OutQuint); + } + + protected override void OnSuspending(GameMode next) + { + Content.FadeOut(300); + base.OnSuspending(next); } } } diff --git a/osu.Game/GameModes/Menu/OsuLogo.cs b/osu.Game/GameModes/Menu/OsuLogo.cs new file mode 100644 index 0000000000..5e50ae5db4 --- /dev/null +++ b/osu.Game/GameModes/Menu/OsuLogo.cs @@ -0,0 +1,132 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transformations; +using osu.Framework.Input; + +namespace osu.Game.GameModes.Menu +{ + /// + /// osu! logo and its attachments (pulsing, visualiser etc.) + /// + public partial class OsuLogo : AutoSizeContainer + { + private Sprite logo; + private Container logoBounceContainer; + private ButtonSystem.MenuVisualisation vis; + + public Action Action; + + public float SizeForFlow => logo == null ? 0 : logo.Size.X * logo.Scale.X * logoBounceContainer.Scale.X * 0.8f; + + private Sprite ripple; + + private Container rippleContainer; + + public bool Ripple + { + get { return rippleContainer.Alpha > 0; } + set + { + rippleContainer.Alpha = value ? 1 : 0; + } + } + + public bool Interactive = true; + + public OsuLogo() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Children = new Drawable[] + { + logoBounceContainer = new AutoSizeContainer + { + Children = new Drawable[] + { + logo = new Sprite() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }, + rippleContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + ripple = new Sprite() + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Additive = true, + Alpha = 0.05f + } + } + }, + vis = new ButtonSystem.MenuVisualisation + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = logo.Size, + Additive = true, + Alpha = 0.2f, + } + } + } + }; + } + + public override void Load() + { + base.Load(); + + logo.Texture = Game.Textures.Get(@"Menu/logo"); + ripple.Texture = Game.Textures.Get(@"Menu/logo"); + + ripple.ScaleTo(1.1f, 500); + ripple.FadeOut(500); + ripple.Loop(300); + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + if (!Interactive) return false; + + logoBounceContainer.ScaleTo(1.1f, 1000, EasingTypes.Out); + return true; + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + + logoBounceContainer.ScaleTo(1.2f, 500, EasingTypes.OutElastic); + return true; + } + + protected override bool OnClick(InputState state) + { + if (!Interactive) return false; + + Action?.Invoke(); + return true; + } + + protected override bool OnHover(InputState state) + { + if (!Interactive) return false; + logoBounceContainer.ScaleTo(1.2f, 500, EasingTypes.OutElastic); + return true; + } + + protected override void OnHoverLost(InputState state) + { + logoBounceContainer.ScaleTo(1, 500, EasingTypes.OutElastic); + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e9fa92d984..7852d68e33 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -79,6 +79,7 @@ +