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