2016-08-26 12:28:23 +09:00
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
2016-08-26 17:27:49 +09:00
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-08-26 12:28:23 +09:00
|
|
|
|
|
|
|
using osu.Framework.GameModes;
|
2016-09-29 20:13:58 +09:00
|
|
|
using osu.Framework.GameModes.Testing;
|
2016-09-17 21:33:46 +01:00
|
|
|
using osu.Framework.Graphics;
|
2016-10-01 17:02:20 +09:00
|
|
|
using osu.Framework.Graphics.Transformations;
|
2016-10-06 23:32:35 +09:00
|
|
|
using osu.Game.GameModes.Backgrounds;
|
2016-09-29 20:13:58 +09:00
|
|
|
using osu.Game.GameModes.Charts;
|
|
|
|
using osu.Game.GameModes.Direct;
|
|
|
|
using osu.Game.GameModes.Edit;
|
|
|
|
using osu.Game.GameModes.Multiplayer;
|
|
|
|
using osu.Game.GameModes.Play;
|
2016-09-30 13:30:55 +09:00
|
|
|
using osu.Game.Graphics.Containers;
|
2016-10-01 17:02:20 +09:00
|
|
|
using OpenTK;
|
2016-10-10 17:17:26 +09:00
|
|
|
using osu.Framework;
|
2016-10-13 22:27:37 +08:00
|
|
|
using osu.Game.Overlays;
|
2016-08-26 12:28:23 +09:00
|
|
|
|
|
|
|
namespace osu.Game.GameModes.Menu
|
|
|
|
{
|
2016-10-05 16:35:10 +09:00
|
|
|
public class MainMenu : OsuGameMode
|
2016-08-26 12:28:23 +09:00
|
|
|
{
|
2016-10-01 17:02:20 +09:00
|
|
|
private ButtonSystem buttons;
|
2016-08-26 12:28:23 +09:00
|
|
|
public override string Name => @"Main Menu";
|
|
|
|
|
2016-10-05 16:35:10 +09:00
|
|
|
protected override BackgroundMode CreateBackground() => new BackgroundModeDefault();
|
|
|
|
|
2016-10-10 17:17:26 +09:00
|
|
|
public override void Load(BaseGame game)
|
2016-09-30 13:31:05 +09:00
|
|
|
{
|
2016-10-10 17:17:26 +09:00
|
|
|
base.Load(game);
|
2016-09-17 21:33:46 +01:00
|
|
|
|
2016-10-10 17:17:26 +09:00
|
|
|
OsuGame osu = (OsuGame)game;
|
2016-10-01 15:02:38 +09:00
|
|
|
|
2016-09-30 13:31:05 +09:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2016-10-01 17:02:20 +09:00
|
|
|
new ParallaxContainer
|
2016-09-29 20:13:58 +09:00
|
|
|
{
|
2016-10-01 17:02:20 +09:00
|
|
|
ParallaxAmount = 0.01f,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
buttons = new ButtonSystem()
|
|
|
|
{
|
2016-10-06 21:10:01 +09:00
|
|
|
Alpha = 0,
|
2016-10-01 17:02:20 +09:00
|
|
|
OnChart = delegate { Push(new ChartListing()); },
|
|
|
|
OnDirect = delegate { Push(new OnlineListing()); },
|
2016-10-05 20:03:52 +09:00
|
|
|
OnEdit = delegate { Push(new EditSongSelect()); },
|
|
|
|
OnSolo = delegate { Push(new PlaySongSelect()); },
|
2016-10-01 17:02:20 +09:00
|
|
|
OnMulti = delegate { Push(new Lobby()); },
|
|
|
|
OnTest = delegate { Push(new TestBrowser()); },
|
2016-10-08 11:33:24 +02:00
|
|
|
OnExit = delegate { Scheduler.AddDelayed(Exit, ButtonSystem.EXIT_DELAY); },
|
2016-10-14 05:02:13 +08:00
|
|
|
OnSettings = osu.Options.ToggleVisibility,
|
2016-10-01 17:02:20 +09:00
|
|
|
}
|
|
|
|
}
|
2016-09-29 20:13:58 +09:00
|
|
|
}
|
2016-09-30 13:31:05 +09:00
|
|
|
};
|
2016-10-06 21:10:01 +09:00
|
|
|
|
|
|
|
buttons.FadeIn(500);
|
2016-09-30 13:31:05 +09:00
|
|
|
}
|
2016-10-01 17:01:29 +09:00
|
|
|
|
2016-10-05 16:35:10 +09:00
|
|
|
protected override void OnSuspending(GameMode next)
|
2016-10-01 17:01:29 +09:00
|
|
|
{
|
2016-10-05 16:35:10 +09:00
|
|
|
base.OnSuspending(next);
|
|
|
|
|
2016-10-01 17:01:29 +09:00
|
|
|
const float length = 400;
|
|
|
|
|
2016-10-08 12:53:46 +09:00
|
|
|
buttons.State = MenuState.EnteringMode;
|
2016-10-01 17:01:29 +09:00
|
|
|
|
|
|
|
Content.FadeOut(length, EasingTypes.InSine);
|
|
|
|
Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine);
|
|
|
|
}
|
|
|
|
|
2016-10-05 16:35:10 +09:00
|
|
|
protected override void OnResuming(GameMode last)
|
2016-10-01 17:01:29 +09:00
|
|
|
{
|
2016-10-05 16:35:10 +09:00
|
|
|
base.OnResuming(last);
|
|
|
|
|
2016-10-01 17:01:29 +09:00
|
|
|
const float length = 300;
|
|
|
|
|
2016-10-08 12:53:46 +09:00
|
|
|
buttons.State = MenuState.TopLevel;
|
2016-10-01 17:01:29 +09:00
|
|
|
|
|
|
|
Content.FadeIn(length, EasingTypes.OutQuint);
|
|
|
|
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
|
|
|
|
}
|
2016-08-26 12:28:23 +09:00
|
|
|
}
|
|
|
|
}
|