mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 16:12:54 +08:00
Merge pull request #41 from peppy/game-modes-layout
Basic white-boxing of all game modes.
This commit is contained in:
commit
2b905df58c
@ -1 +1 @@
|
||||
Subproject commit 3f68cf9d03d47d07d4c804027f45d32432e08ee6
|
||||
Subproject commit 4d78fdfbe01e3ecb213c19a3f3243c80a71bb668
|
@ -1 +1 @@
|
||||
Subproject commit fd4a3dd5223af6eb1c261af070b4220c9ff9ec2d
|
||||
Subproject commit cc107f9bcfc8efeeff88f19c2df8cec9755eda39
|
@ -54,7 +54,7 @@ namespace osu.Desktop.Tests
|
||||
flow = new FlowContainer
|
||||
{
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
SizeMode = InheritMode.X,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
LayoutDuration = 100,
|
||||
LayoutEasing = EasingTypes.Out,
|
||||
Padding = new Vector2(1, 1)
|
||||
|
@ -31,8 +31,10 @@ namespace osu.Desktop.Tests
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
///create a new clock offset to 0.
|
||||
localClock = new FramedOffsetClock(base.Clock) { Offset = -base.Clock.CurrentTime };
|
||||
//ensure we are at offset 0
|
||||
if (localClock == null)
|
||||
localClock = new FramedOffsetClock(base.Clock);
|
||||
localClock.Offset = -base.Clock.CurrentTime;
|
||||
|
||||
List<HitObject> objects = new List<HitObject>();
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Desktop.Tests
|
||||
|
||||
Add(flow = new FlowContainer()
|
||||
{
|
||||
SizeMode = InheritMode.XY,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
|
@ -6,12 +6,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.GameModes;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
namespace osu.Game.GameModes.Charts
|
||||
{
|
||||
class OsuGameMode : GameMode
|
||||
class ChartInfo : GameModeWhiteBox
|
||||
{
|
||||
public new OsuGame Game => base.Game as OsuGame;
|
||||
}
|
||||
}
|
15
osu.Game/GameModes/Charts/ChartListing.cs
Normal file
15
osu.Game/GameModes/Charts/ChartListing.cs
Normal file
@ -0,0 +1,15 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.GameModes.Charts
|
||||
{
|
||||
class ChartListing : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(ChartInfo)
|
||||
};
|
||||
}
|
||||
}
|
9
osu.Game/GameModes/Direct/OnlineListing.cs
Normal file
9
osu.Game/GameModes/Direct/OnlineListing.cs
Normal file
@ -0,0 +1,9 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.GameModes.Direct
|
||||
{
|
||||
class OnlineListing : GameModeWhiteBox
|
||||
{
|
||||
}
|
||||
}
|
15
osu.Game/GameModes/Edit/Editor.cs
Normal file
15
osu.Game/GameModes/Edit/Editor.cs
Normal file
@ -0,0 +1,15 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Edit
|
||||
{
|
||||
class Editor : GameModeWhiteBox
|
||||
{
|
||||
}
|
||||
}
|
15
osu.Game/GameModes/Edit/SongSelectEdit.cs
Normal file
15
osu.Game/GameModes/Edit/SongSelectEdit.cs
Normal file
@ -0,0 +1,15 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.GameModes.Edit
|
||||
{
|
||||
class SongSelectEdit : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(Editor)
|
||||
};
|
||||
}
|
||||
}
|
156
osu.Game/GameModes/GameModeWhiteBox.cs
Normal file
156
osu.Game/GameModes/GameModeWhiteBox.cs
Normal file
@ -0,0 +1,156 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.GameModes;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Drawables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.GameModes
|
||||
{
|
||||
public class GameModeWhiteBox : GameMode
|
||||
{
|
||||
private Button popButton;
|
||||
|
||||
const int transition_time = 1000;
|
||||
|
||||
protected virtual IEnumerable<Type> PossibleChildren => null;
|
||||
|
||||
private FlowContainer childModeButtons;
|
||||
private Container textContainer;
|
||||
|
||||
protected override double OnEntering(GameMode last)
|
||||
{
|
||||
//only show the pop button if we are entered form another gamemode.
|
||||
if (last != null)
|
||||
popButton.Alpha = 1;
|
||||
|
||||
Content.Alpha = 0;
|
||||
textContainer.Position = new Vector2(Size.X / 16, 0);
|
||||
|
||||
Content.Delay(300);
|
||||
textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo);
|
||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||
return 0;// transition_time * 1000;
|
||||
}
|
||||
|
||||
protected override double OnExiting(GameMode next)
|
||||
{
|
||||
textContainer.MoveTo(new Vector2((Size.X / 16), 0), transition_time, EasingTypes.OutExpo);
|
||||
Content.FadeOut(transition_time, EasingTypes.OutExpo);
|
||||
return transition_time;
|
||||
}
|
||||
|
||||
protected override double OnSuspending(GameMode next)
|
||||
{
|
||||
textContainer.MoveTo(new Vector2(-(Size.X / 16), 0), transition_time, EasingTypes.OutExpo);
|
||||
Content.FadeOut(transition_time, EasingTypes.OutExpo);
|
||||
return transition_time;
|
||||
}
|
||||
|
||||
protected override double OnResuming(GameMode last)
|
||||
{
|
||||
textContainer.MoveTo(Vector2.Zero, transition_time, EasingTypes.OutExpo);
|
||||
Content.FadeIn(transition_time, EasingTypes.OutExpo);
|
||||
return transition_time;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.7f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Colour = getColourFor(GetType()),
|
||||
Alpha = 0.6f,
|
||||
Additive = true
|
||||
},
|
||||
textContainer = new AutoSizeContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Text = GetType().Name,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 50,
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = GetType().Namespace,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Position = new Vector2(0, 30)
|
||||
},
|
||||
}
|
||||
},
|
||||
popButton = new Button
|
||||
{
|
||||
Text = @"Back",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(0.1f, 40),
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Colour = new Color4(235, 51, 153, 255),
|
||||
Alpha = 0,
|
||||
Action = delegate {
|
||||
Exit();
|
||||
}
|
||||
},
|
||||
childModeButtons = new FlowContainer
|
||||
{
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.1f, 1)
|
||||
}
|
||||
};
|
||||
|
||||
if (PossibleChildren != null)
|
||||
{
|
||||
foreach (Type t in PossibleChildren)
|
||||
{
|
||||
childModeButtons.Add(new Button
|
||||
{
|
||||
Text = $@"{t.Name}",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(1, 40),
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Colour = getColourFor(t),
|
||||
Action = delegate
|
||||
{
|
||||
Push(Activator.CreateInstance(t) as GameMode);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 getColourFor(Type type)
|
||||
{
|
||||
int hash = type.Name.GetHashCode();
|
||||
byte r = (byte)MathHelper.Clamp(((hash & 0xFF0000) >> 16) * 0.8f, 20, 255);
|
||||
byte g = (byte)MathHelper.Clamp(((hash & 0x00FF00) >> 8) * 0.8f, 20, 255);
|
||||
byte b = (byte)MathHelper.Clamp((hash & 0x0000FF) * 0.8f, 20, 255);
|
||||
return new Color4(r, g, b, 255);
|
||||
}
|
||||
}
|
||||
}
|
@ -19,17 +19,29 @@ using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.GameModes.Menu
|
||||
{
|
||||
public class ButtonSystem : OsuLargeComponent
|
||||
public class ButtonSystem : Container
|
||||
{
|
||||
public Action OnEdit;
|
||||
public Action OnExit;
|
||||
public Action OnDirect;
|
||||
public Action OnSolo;
|
||||
public Action OnSettings;
|
||||
public Action OnMulti;
|
||||
public Action OnChart;
|
||||
public Action OnTest;
|
||||
|
||||
private FlowContainerWithOrigin buttonFlow;
|
||||
|
||||
const float button_area_height = 128;
|
||||
const float button_width = 180f;
|
||||
const float wedge_width = 25.6f;
|
||||
const float button_area_height = 100;
|
||||
const float button_width = 140f;
|
||||
const float wedge_width = 20;
|
||||
|
||||
public const int EXIT_DELAY = 3000;
|
||||
|
||||
private OsuLogo osuLogo;
|
||||
private Drawable iconFacade;
|
||||
private Container buttonArea;
|
||||
private Box buttonAreaBackground;
|
||||
|
||||
private Button backButton;
|
||||
private Button settingsButton;
|
||||
@ -40,9 +52,15 @@ namespace osu.Game.GameModes.Menu
|
||||
public enum MenuState
|
||||
{
|
||||
Initial,
|
||||
Exit,
|
||||
TopLevel,
|
||||
Play,
|
||||
EnteringMode,
|
||||
Exit,
|
||||
}
|
||||
|
||||
public ButtonSystem()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
@ -55,15 +73,18 @@ namespace osu.Game.GameModes.Menu
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
SizeMode = InheritMode.X,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(1, button_area_height),
|
||||
Alpha = 0,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
buttonAreaBackground = new Box
|
||||
{
|
||||
SizeMode = InheritMode.XY,
|
||||
Colour = new Color4(50, 50, 50, 255)
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(2, 1),
|
||||
Colour = new Color4(50, 50, 50, 255),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
buttonFlow = new FlowContainerWithOrigin
|
||||
{
|
||||
@ -71,7 +92,7 @@ namespace osu.Game.GameModes.Menu
|
||||
Padding = new Vector2(-wedge_width, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
settingsButton = new Button(@"settings", @"options", FontAwesome.gear, new Color4(85, 85, 85, 255), onSettings, -wedge_width, Key.O),
|
||||
settingsButton = new Button(@"settings", @"options", FontAwesome.gear, new Color4(85, 85, 85, 255), OnSettings, -wedge_width, Key.O),
|
||||
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -wedge_width, Key.Escape),
|
||||
iconFacade = new Container //need a container to make the osu! icon flow properly.
|
||||
{
|
||||
@ -91,14 +112,14 @@ namespace osu.Game.GameModes.Menu
|
||||
|
||||
buttonFlow.Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0);
|
||||
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"solo", @"freeplay", FontAwesome.user, new Color4(102, 68, 204, 255), onSolo, wedge_width, Key.P)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"multi", @"multiplayer", FontAwesome.users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), onChart)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"tests", @"tests", FontAwesome.terminal, new Color4(80, 53, 160, 255), onTest, 0, Key.T)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"solo", @"freeplay", FontAwesome.user, new Color4(102, 68, 204, 255), OnSolo, wedge_width, Key.P)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"multi", @"multiplayer", FontAwesome.users, new Color4(94, 63, 186, 255), OnMulti, 0, Key.M)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), OnChart)));
|
||||
buttonsPlay.Add((Button)buttonFlow.Add(new Button(@"tests", @"tests", FontAwesome.terminal, new Color4(80, 53, 160, 255), OnTest, 0, Key.T)));
|
||||
|
||||
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, wedge_width, Key.P)));
|
||||
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), onEdit, 0, Key.E)));
|
||||
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), onDirect, 0, Key.D)));
|
||||
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), OnEdit, 0, Key.E)));
|
||||
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), OnDirect, 0, Key.D)));
|
||||
buttonsTopLevel.Add((Button)buttonFlow.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q)));
|
||||
}
|
||||
|
||||
@ -108,31 +129,15 @@ namespace osu.Game.GameModes.Menu
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onSettings()
|
||||
{
|
||||
//OsuGame.Options.LoginOnly = false;
|
||||
//OsuGame.Options.Expanded = true;
|
||||
}
|
||||
|
||||
private void onPlay()
|
||||
{
|
||||
State = MenuState.Play;
|
||||
}
|
||||
|
||||
private void onEdit()
|
||||
{
|
||||
//OsuGame.ChangeMode(OsuModes.SelectEdit);
|
||||
}
|
||||
|
||||
private void onDirect()
|
||||
{
|
||||
//OsuGame.ChangeMode(OsuModes.OnlineSelection);
|
||||
}
|
||||
|
||||
private void onExit()
|
||||
{
|
||||
//OsuGame.ChangeMode(OsuModes.Exit);
|
||||
State = MenuState.Exit;
|
||||
OnExit?.Invoke();
|
||||
}
|
||||
|
||||
private void onBack()
|
||||
@ -140,27 +145,6 @@ namespace osu.Game.GameModes.Menu
|
||||
State = MenuState.TopLevel;
|
||||
}
|
||||
|
||||
private void onSolo()
|
||||
{
|
||||
//OsuGame.ChangeMode(OsuModes.SelectPlay);
|
||||
}
|
||||
|
||||
private void onMulti()
|
||||
{
|
||||
//OsuGame.ChangeMode(OsuModes.Lobby);
|
||||
}
|
||||
|
||||
private void onChart()
|
||||
{
|
||||
//OsuGame.ChangeMode(OsuModes.Charts);
|
||||
}
|
||||
|
||||
private void onTest()
|
||||
{
|
||||
|
||||
//OsuGame.ChangeMode(OsuModes.FieldTest);
|
||||
}
|
||||
|
||||
private void onOsuLogo()
|
||||
{
|
||||
switch (state)
|
||||
@ -195,11 +179,16 @@ namespace osu.Game.GameModes.Menu
|
||||
MenuState lastState = state;
|
||||
state = value;
|
||||
|
||||
//todo: figure a more elegant way of doing this.
|
||||
buttonsTopLevel.ForEach(b => b.ContractStyle = 0);
|
||||
buttonsPlay.ForEach(b => b.ContractStyle = 0);
|
||||
backButton.ContractStyle = 0;
|
||||
settingsButton.ContractStyle = 0;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case MenuState.Initial:
|
||||
backButton.State = Button.ButtonState.Contracted;
|
||||
|
||||
buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out);
|
||||
buttonArea.FadeOut(500);
|
||||
|
||||
osuLogo.Delay(150);
|
||||
@ -213,7 +202,7 @@ namespace osu.Game.GameModes.Menu
|
||||
b.State = Button.ButtonState.Contracted;
|
||||
break;
|
||||
case MenuState.TopLevel:
|
||||
backButton.State = Button.ButtonState.Contracted;
|
||||
buttonAreaBackground.ScaleTo(Vector2.One, 200, EasingTypes.Out);
|
||||
|
||||
osuLogo.MoveTo(buttonFlow.Position, 200, EasingTypes.In);
|
||||
osuLogo.ScaleTo(0.5f, 200, EasingTypes.In);
|
||||
@ -231,14 +220,26 @@ namespace osu.Game.GameModes.Menu
|
||||
b.State = Button.ButtonState.Contracted;
|
||||
break;
|
||||
case MenuState.Play:
|
||||
backButton.State = Button.ButtonState.Expanded;
|
||||
|
||||
foreach (Button b in buttonsTopLevel)
|
||||
b.State = Button.ButtonState.Exploded;
|
||||
|
||||
foreach (Button b in buttonsPlay)
|
||||
b.State = Button.ButtonState.Expanded;
|
||||
break;
|
||||
case MenuState.EnteringMode:
|
||||
buttonAreaBackground.ScaleTo(new Vector2(2, 0), 300, EasingTypes.InSine);
|
||||
|
||||
buttonsTopLevel.ForEach(b => b.ContractStyle = 1);
|
||||
buttonsPlay.ForEach(b => b.ContractStyle = 1);
|
||||
backButton.ContractStyle = 1;
|
||||
settingsButton.ContractStyle = 1;
|
||||
|
||||
foreach (Button b in buttonsTopLevel)
|
||||
b.State = Button.ButtonState.Contracted;
|
||||
|
||||
foreach (Button b in buttonsPlay)
|
||||
b.State = Button.ButtonState.Contracted;
|
||||
break;
|
||||
case MenuState.Exit:
|
||||
buttonArea.FadeOut(200);
|
||||
|
||||
@ -249,13 +250,14 @@ namespace osu.Game.GameModes.Menu
|
||||
b.State = Button.ButtonState.Contracted;
|
||||
|
||||
osuLogo.Delay(150);
|
||||
osuLogo.ScaleTo(1f, 4000);
|
||||
osuLogo.RotateTo(20, 4000);
|
||||
osuLogo.FadeOut(4000);
|
||||
|
||||
osuLogo.ScaleTo(1f, EXIT_DELAY * 1.5f);
|
||||
osuLogo.RotateTo(20, EXIT_DELAY * 1.5f);
|
||||
osuLogo.FadeOut(EXIT_DELAY);
|
||||
break;
|
||||
}
|
||||
|
||||
backButton.State = state >= MenuState.Play ? Button.ButtonState.Expanded : Button.ButtonState.Contracted;
|
||||
backButton.State = state == MenuState.Play ? Button.ButtonState.Expanded : Button.ButtonState.Contracted;
|
||||
settingsButton.State = state == MenuState.TopLevel ? Button.ButtonState.Expanded : Button.ButtonState.Contracted;
|
||||
|
||||
if (lastState == MenuState.Initial)
|
||||
@ -275,14 +277,14 @@ namespace osu.Game.GameModes.Menu
|
||||
/// <summary>
|
||||
/// osu! logo and its attachments (pulsing, visualiser etc.)
|
||||
/// </summary>
|
||||
class OsuLogo : OsuComponent
|
||||
class OsuLogo : AutoSizeContainer
|
||||
{
|
||||
private Sprite logo;
|
||||
private Container logoBounceContainer;
|
||||
private MenuVisualisation vis;
|
||||
private Action clickAction;
|
||||
|
||||
public float SizeForFlow => logo == null ? 0 : logo.ActualSize.X * logo.Scale.X * logoBounceContainer.Scale.X * 0.8f;
|
||||
public float SizeForFlow => logo == null ? 0 : logo.Size.X * logo.Scale.X * logoBounceContainer.Scale.X * 0.8f;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
@ -298,13 +300,13 @@ namespace osu.Game.GameModes.Menu
|
||||
{
|
||||
logo = new Sprite()
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
ripple = new Sprite()
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0.4f
|
||||
@ -395,7 +397,7 @@ namespace osu.Game.GameModes.Menu
|
||||
/// Button designed specifically for the osu!next main menu.
|
||||
/// In order to correctly flow, we have to use a negative margin on the parent container (due to the parallelogram shape).
|
||||
/// </summary>
|
||||
private class Button : OsuComponent
|
||||
private class Button : AutoSizeContainer
|
||||
{
|
||||
private Container iconText;
|
||||
private WedgedBox box;
|
||||
@ -445,7 +447,7 @@ namespace osu.Game.GameModes.Menu
|
||||
icon = new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
TextSize = 40,
|
||||
TextSize = 30,
|
||||
Position = new Vector2(0, 0),
|
||||
Icon = symbol
|
||||
},
|
||||
@ -454,6 +456,7 @@ namespace osu.Game.GameModes.Menu
|
||||
Direction = FlowDirection.HorizontalOnly,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 16,
|
||||
Position = new Vector2(0, 35),
|
||||
Text = text
|
||||
}
|
||||
@ -601,8 +604,9 @@ namespace osu.Game.GameModes.Menu
|
||||
base.Update();
|
||||
}
|
||||
|
||||
ButtonState state;
|
||||
public int ContractStyle;
|
||||
|
||||
ButtonState state;
|
||||
public ButtonState State
|
||||
{
|
||||
get { return state; }
|
||||
@ -612,15 +616,25 @@ namespace osu.Game.GameModes.Menu
|
||||
if (state == value)
|
||||
return;
|
||||
|
||||
ButtonState lastState = state;
|
||||
state = value;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case ButtonState.Contracted:
|
||||
const int contract_duration = 500;
|
||||
box.ScaleTo(new Vector2(0, 1), contract_duration, EasingTypes.OutExpo);
|
||||
FadeOut(contract_duration);
|
||||
switch (ContractStyle)
|
||||
{
|
||||
default:
|
||||
box.ScaleTo(new Vector2(0, 1), 500, EasingTypes.OutExpo);
|
||||
FadeOut(500);
|
||||
break;
|
||||
case 1:
|
||||
box.ScaleTo(new Vector2(0, 1), 400, EasingTypes.InSine);
|
||||
FadeOut(800);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ButtonState.Contracted2:
|
||||
|
||||
break;
|
||||
case ButtonState.Expanded:
|
||||
const int expand_duration = 500;
|
||||
@ -641,6 +655,7 @@ namespace osu.Game.GameModes.Menu
|
||||
public enum ButtonState
|
||||
{
|
||||
Contracted,
|
||||
Contracted2,
|
||||
Expanded,
|
||||
Exploded
|
||||
}
|
||||
|
@ -4,26 +4,87 @@
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.GameModes;
|
||||
using osu.Framework.GameModes.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
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;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.GameModes.Menu
|
||||
{
|
||||
internal class MainMenu : GameMode
|
||||
{
|
||||
private ButtonSystem buttons;
|
||||
public override string Name => @"Main Menu";
|
||||
|
||||
//private AudioTrackBass bgm;
|
||||
//private AudioTrack bgm;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
|
||||
AudioSample welcome = Game.Audio.Sample.Get(@"welcome");
|
||||
OsuGame osu = (OsuGame)Game;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ButtonSystem(),
|
||||
};
|
||||
}
|
||||
AudioSample welcome = Game.Audio.Sample.Get(@"welcome");
|
||||
welcome.Play();
|
||||
|
||||
//bgm = Game.Audio.Track.Get(@"circles");
|
||||
//bgm.Start();
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ParallaxContainer
|
||||
{
|
||||
ParallaxAmount = 0.01f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
buttons = new ButtonSystem()
|
||||
{
|
||||
OnChart = delegate { Push(new ChartListing()); },
|
||||
OnDirect = delegate { Push(new OnlineListing()); },
|
||||
OnEdit = delegate { Push(new SongSelectEdit()); },
|
||||
OnSolo = delegate { Push(new SongSelectPlay()); },
|
||||
OnMulti = delegate { Push(new Lobby()); },
|
||||
OnTest = delegate { Push(new TestBrowser()); },
|
||||
OnExit = delegate {
|
||||
Game.Scheduler.AddDelayed(delegate {
|
||||
Game.Host.Exit();
|
||||
}, ButtonSystem.EXIT_DELAY);
|
||||
},
|
||||
OnSettings = delegate {
|
||||
osu.Options.PoppedOut = !osu.Options.PoppedOut;
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override double OnSuspending(GameMode next)
|
||||
{
|
||||
const float length = 400;
|
||||
|
||||
buttons.State = ButtonSystem.MenuState.EnteringMode;
|
||||
|
||||
Content.FadeOut(length, EasingTypes.InSine);
|
||||
Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine);
|
||||
|
||||
return base.OnSuspending(next);
|
||||
}
|
||||
|
||||
protected override double OnResuming(GameMode last)
|
||||
{
|
||||
const float length = 300;
|
||||
|
||||
buttons.State = ButtonSystem.MenuState.TopLevel;
|
||||
|
||||
Content.FadeIn(length, EasingTypes.OutQuint);
|
||||
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
|
||||
return base.OnResuming(last);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
19
osu.Game/GameModes/Multiplayer/Lobby.cs
Normal file
19
osu.Game/GameModes/Multiplayer/Lobby.cs
Normal file
@ -0,0 +1,19 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Multiplayer
|
||||
{
|
||||
class Lobby : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(MatchCreate),
|
||||
typeof(Match)
|
||||
};
|
||||
}
|
||||
}
|
20
osu.Game/GameModes/Multiplayer/Match.cs
Normal file
20
osu.Game/GameModes/Multiplayer/Match.cs
Normal file
@ -0,0 +1,20 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Game.GameModes.Play;
|
||||
|
||||
namespace osu.Game.GameModes.Multiplayer
|
||||
{
|
||||
class Match : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(MatchSongSelect),
|
||||
typeof(Player),
|
||||
};
|
||||
}
|
||||
}
|
18
osu.Game/GameModes/Multiplayer/MatchCreate.cs
Normal file
18
osu.Game/GameModes/Multiplayer/MatchCreate.cs
Normal file
@ -0,0 +1,18 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Multiplayer
|
||||
{
|
||||
class MatchCreate : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(Match)
|
||||
};
|
||||
}
|
||||
}
|
15
osu.Game/GameModes/Multiplayer/MatchSongSelect.cs
Normal file
15
osu.Game/GameModes/Multiplayer/MatchSongSelect.cs
Normal file
@ -0,0 +1,15 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Multiplayer
|
||||
{
|
||||
class MatchSongSelect : GameModeWhiteBox
|
||||
{
|
||||
}
|
||||
}
|
@ -66,10 +66,10 @@ namespace osu.Game.GameModes.Play.Catch
|
||||
//render stuff!
|
||||
Sprite s = new Sprite
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.1f),
|
||||
PositionMode = InheritMode.Y,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Position = new Vector2(h.Position, -0.1f)
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.GameModes.Play.Catch
|
||||
{
|
||||
public CatchPlayfield()
|
||||
{
|
||||
SizeMode = InheritMode.Y;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Size = new Vector2(512, 0.9f);
|
||||
Anchor = Anchor.BottomCentre;
|
||||
Origin = Anchor.BottomCentre;
|
||||
@ -24,7 +24,7 @@ namespace osu.Game.GameModes.Play.Catch
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Add(new Box { SizeMode = InheritMode.XY, Alpha = 0.5f });
|
||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
}
|
||||
}
|
||||
}
|
@ -11,15 +11,20 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.GameModes.Play
|
||||
{
|
||||
public abstract class HitRenderer : LargeContainer
|
||||
public abstract class HitRenderer : Container
|
||||
{
|
||||
public abstract List<HitObject> Objects { set; }
|
||||
|
||||
public HitRenderer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Add(new Box() { SizeMode = InheritMode.XY, Alpha = 0.1f, Scale = new Vector2(0.99f) });
|
||||
Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.1f, Scale = new Vector2(0.99f) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,10 +72,10 @@ namespace osu.Game.GameModes.Play.Mania
|
||||
//render stuff!
|
||||
Sprite s = new Sprite
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.1f),
|
||||
PositionMode = InheritMode.XY,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2((float)(h.Column + 0.5) / columns, -0.1f)
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.GameModes.Play.Mania
|
||||
public ManiaPlayfield(int columns)
|
||||
{
|
||||
this.columns = columns;
|
||||
SizeMode = InheritMode.XY;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Size = new Vector2(columns / 20f, 1f);
|
||||
Anchor = Anchor.BottomCentre;
|
||||
Origin = Anchor.BottomCentre;
|
||||
@ -27,14 +27,14 @@ namespace osu.Game.GameModes.Play.Mania
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Add(new Box() { SizeMode = InheritMode.XY, Alpha = 0.5f });
|
||||
Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
|
||||
for (int i = 0; i < columns; i++)
|
||||
Add(new Box()
|
||||
{
|
||||
SizeMode = InheritMode.Y,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Size = new Vector2(2, 1),
|
||||
PositionMode = InheritMode.XY,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2((float)i / columns, 0),
|
||||
Alpha = 0.5f,
|
||||
Colour = Color4.Black
|
||||
|
15
osu.Game/GameModes/Play/ModSelect.cs
Normal file
15
osu.Game/GameModes/Play/ModSelect.cs
Normal file
@ -0,0 +1,15 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Play
|
||||
{
|
||||
class ModSelect : GameModeWhiteBox
|
||||
{
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ namespace osu.Game.GameModes.Play.Osu
|
||||
//render stuff!
|
||||
Sprite s = new Sprite
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.1f),
|
||||
Alpha = 0,
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.GameModes.Play.Osu
|
||||
{
|
||||
public OsuPlayfield()
|
||||
{
|
||||
SizeMode = InheritMode.None;
|
||||
RelativeSizeAxes = Axes.None;
|
||||
Size = new Vector2(512, 384);
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
@ -26,7 +26,7 @@ namespace osu.Game.GameModes.Play.Osu
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
SizeMode = InheritMode.XY,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.5f
|
||||
});
|
||||
}
|
||||
|
18
osu.Game/GameModes/Play/Player.cs
Normal file
18
osu.Game/GameModes/Play/Player.cs
Normal file
@ -0,0 +1,18 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Play
|
||||
{
|
||||
class Player : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(Results)
|
||||
};
|
||||
}
|
||||
}
|
15
osu.Game/GameModes/Play/Results.cs
Normal file
15
osu.Game/GameModes/Play/Results.cs
Normal file
@ -0,0 +1,15 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.GameModes.Play
|
||||
{
|
||||
class Results : GameModeWhiteBox
|
||||
{
|
||||
}
|
||||
}
|
16
osu.Game/GameModes/Play/SongSelectPlay.cs
Normal file
16
osu.Game/GameModes/Play/SongSelectPlay.cs
Normal file
@ -0,0 +1,16 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.GameModes.Play
|
||||
{
|
||||
class SongSelectPlay : GameModeWhiteBox
|
||||
{
|
||||
protected override IEnumerable<Type> PossibleChildren => new[] {
|
||||
typeof(ModSelect),
|
||||
typeof(Player)
|
||||
};
|
||||
}
|
||||
}
|
@ -65,10 +65,10 @@ namespace osu.Game.GameModes.Play.Taiko
|
||||
//render stuff!
|
||||
Sprite s = new Sprite
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.2f),
|
||||
PositionMode = InheritMode.XY,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(1.1f, 0.5f)
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.GameModes.Play.Taiko
|
||||
{
|
||||
public TaikoPlayfield()
|
||||
{
|
||||
SizeMode = InheritMode.X;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Size = new Vector2(1, 100);
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
@ -24,14 +24,14 @@ namespace osu.Game.GameModes.Play.Taiko
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Add(new Box { SizeMode = InheritMode.XY, Alpha = 0.5f });
|
||||
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
|
||||
|
||||
Add(new Sprite
|
||||
{
|
||||
Texture = Game.Textures.Get(@"menu-osu"),
|
||||
Texture = Game.Textures.Get(@"Menu/logo"),
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.2f),
|
||||
PositionMode = InheritMode.XY,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(0.1f, 0.5f),
|
||||
Colour = Color4.Gray
|
||||
});
|
||||
|
42
osu.Game/Graphics/Background/Background.cs
Normal file
42
osu.Game/Graphics/Background/Background.cs
Normal file
@ -0,0 +1,42 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.Background
|
||||
{
|
||||
class Background : Container
|
||||
{
|
||||
protected Sprite BackgroundSprite;
|
||||
|
||||
public Background()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Add(BackgroundSprite = new Sprite
|
||||
{
|
||||
Texture = Game.Textures.Get(@"Menu/background"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Colour = Color4.DarkGray
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
BackgroundSprite.Scale = new Vector2(Math.Max(Size.X / BackgroundSprite.Size.X, Size.Y / BackgroundSprite.Size.Y));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
class OsuComponent : AutoSizeContainer
|
||||
{
|
||||
public new OsuGameBase Game => base.Game as OsuGameBase;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public class OsuLargeComponent : LargeContainer
|
||||
{
|
||||
public new OsuGameBase Game => base.Game as OsuGameBase;
|
||||
}
|
||||
}
|
46
osu.Game/Graphics/Containers/ParallaxContainer.cs
Normal file
46
osu.Game/Graphics/Containers/ParallaxContainer.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
class ParallaxContainer : Container
|
||||
{
|
||||
public float ParallaxAmount = 0.02f;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
||||
public ParallaxContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
private Container content = new Container()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
};
|
||||
|
||||
protected override Container AddTarget => content;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
Add(content);
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
{
|
||||
content.Position = (state.Mouse.Position - Size / 2) * ParallaxAmount;
|
||||
return base.OnMouseMove(state);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
content.Scale = new Vector2(1 + ParallaxAmount);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,28 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.Processing
|
||||
{
|
||||
class RatioAdjust : LargeContainer
|
||||
class RatioAdjust : Container
|
||||
{
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
||||
public RatioAdjust()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
Scale = new Vector2(Parent.ActualSize.Y / 768f);
|
||||
Vector2 parent = Parent.Size;
|
||||
|
||||
Scale = new Vector2(Math.Min(parent.Y / 768f, parent.X / 1024f));
|
||||
Size = new Vector2(1 / Scale.X);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
SizeMode = InheritMode.XY,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Text = Name,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
PositionMode = InheritMode.XY,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(0, -0.25f),
|
||||
Colour = KeyUpTextColor
|
||||
},
|
||||
@ -97,7 +97,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Text = Count.ToString(@"#,0"),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
PositionMode = InheritMode.XY,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(0, 0.25f),
|
||||
Colour = KeyUpTextColor
|
||||
}
|
||||
|
@ -25,11 +25,11 @@ namespace osu.Game.Online.Chat.Display
|
||||
{
|
||||
base.Load();
|
||||
|
||||
SizeMode = InheritMode.X;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
Add(new Box
|
||||
{
|
||||
SizeMode = InheritMode.XY,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Aqua,
|
||||
Alpha = 0.2f
|
||||
});
|
||||
@ -44,16 +44,16 @@ namespace osu.Game.Online.Chat.Display
|
||||
{
|
||||
Text = msg.User.Name,
|
||||
Origin = Anchor.TopRight,
|
||||
PositionMode = InheritMode.X,
|
||||
RelativePositionAxes = Axes.X,
|
||||
Position = new Vector2(0.14f,0),
|
||||
});
|
||||
|
||||
Add(new SpriteText
|
||||
{
|
||||
Text = msg.Content,
|
||||
PositionMode = InheritMode.X,
|
||||
RelativePositionAxes = Axes.X,
|
||||
Position = new Vector2(0.15f, 0),
|
||||
SizeMode = InheritMode.X,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(0.85f, 1),
|
||||
});
|
||||
}
|
||||
|
@ -5,13 +5,19 @@ using osu.Game.Configuration;
|
||||
using osu.Game.GameModes.Menu;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.OS;
|
||||
using osu.Game.Graphics.Background;
|
||||
using osu.Game.GameModes.Play;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
public class OsuGame : OsuGameBase
|
||||
{
|
||||
public Toolbar Toolbar;
|
||||
|
||||
public override void SetHost(BasicGameHost host)
|
||||
{
|
||||
base.SetHost(host);
|
||||
@ -23,7 +29,18 @@ namespace osu.Game
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Add(new MainMenu());
|
||||
ShowPerformanceOverlay = true;
|
||||
|
||||
Add(new Drawable[] {
|
||||
new ParallaxContainer
|
||||
{
|
||||
Children = new [] {
|
||||
new Background()
|
||||
}
|
||||
},
|
||||
new MainMenu(),
|
||||
Toolbar = new Toolbar(),
|
||||
});
|
||||
}
|
||||
|
||||
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
||||
@ -32,8 +49,8 @@ namespace osu.Game
|
||||
|
||||
if (Parent != null)
|
||||
{
|
||||
Config.Set(OsuConfig.Width, ActualSize.X);
|
||||
Config.Set(OsuConfig.Height, ActualSize.Y);
|
||||
Config.Set(OsuConfig.Width, Size.X);
|
||||
Config.Set(OsuConfig.Height, Size.Y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.GameModes;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
@ -7,6 +8,7 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.Processing;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
@ -16,6 +18,7 @@ namespace osu.Game
|
||||
|
||||
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
||||
|
||||
public Options Options;
|
||||
public APIAccess API;
|
||||
|
||||
protected override Container AddTarget => ratioContainer?.IsLoaded == true ? ratioContainer : base.AddTarget;
|
||||
@ -45,6 +48,7 @@ namespace osu.Game
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Options = new Options(),
|
||||
new OsuCursorContainer()
|
||||
}
|
||||
}
|
||||
|
75
osu.Game/Overlays/Options.cs
Normal file
75
osu.Game/Overlays/Options.cs
Normal file
@ -0,0 +1,75 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Drawables;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class Options : Container
|
||||
{
|
||||
const float width = 300;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
|
||||
Depth = float.MaxValue;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Size = new Vector2(width, 1);
|
||||
Position = new Vector2(-width, 0);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Escape:
|
||||
if (!poppedOut) return false;
|
||||
|
||||
PoppedOut = false;
|
||||
return true;
|
||||
}
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
private bool poppedOut;
|
||||
|
||||
public bool PoppedOut
|
||||
{
|
||||
get { return poppedOut; }
|
||||
|
||||
set
|
||||
{
|
||||
if (value == poppedOut) return;
|
||||
|
||||
poppedOut = value;
|
||||
|
||||
if (poppedOut)
|
||||
{
|
||||
MoveTo(new Vector2(0, 0), 300, EasingTypes.Out);
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveTo(new Vector2(-width, 0), 300, EasingTypes.Out);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
osu.Game/Overlays/Toolbar.cs
Normal file
38
osu.Game/Overlays/Toolbar.cs
Normal file
@ -0,0 +1,38 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Drawables;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class Toolbar : Container
|
||||
{
|
||||
const float height = 50;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
base.Load();
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Size = new Vector2(1, height);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(0.1f, 0.1f, 0.1f, 0.9f)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -69,8 +69,21 @@
|
||||
<Compile Include="Beatmaps\Timing\SampleChange.cs" />
|
||||
<Compile Include="Beatmaps\Timing\TimingChange.cs" />
|
||||
<Compile Include="Configuration\OsuConfigManager.cs" />
|
||||
<Compile Include="GameModes\Charts\ChartInfo.cs" />
|
||||
<Compile Include="GameModes\Edit\Editor.cs" />
|
||||
<Compile Include="GameModes\GameModeWhiteBox.cs" />
|
||||
<Compile Include="GameModes\Menu\ButtonSystem.cs" />
|
||||
<Compile Include="GameModes\Menu\MainMenu.cs" />
|
||||
<Compile Include="GameModes\Multiplayer\Lobby.cs" />
|
||||
<Compile Include="GameModes\Multiplayer\Match.cs" />
|
||||
<Compile Include="GameModes\Multiplayer\MatchCreate.cs" />
|
||||
<Compile Include="GameModes\Multiplayer\MatchSongSelect.cs" />
|
||||
<Compile Include="GameModes\Play\ModSelect.cs" />
|
||||
<Compile Include="GameModes\Play\Player.cs" />
|
||||
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
||||
<Compile Include="GameModes\Play\Results.cs" />
|
||||
<Compile Include="GameModes\Direct\OnlineListing.cs" />
|
||||
<Compile Include="GameModes\Play\SongSelectPlay.cs" />
|
||||
<Compile Include="GameModes\Play\Catch\CatchHitRenderer.cs" />
|
||||
<Compile Include="GameModes\Play\Catch\CatchPlayfield.cs" />
|
||||
<Compile Include="GameModes\Play\HitRenderer.cs" />
|
||||
@ -81,9 +94,9 @@
|
||||
<Compile Include="GameModes\Play\Playfield.cs" />
|
||||
<Compile Include="GameModes\Play\Taiko\TaikoHitRenderer.cs" />
|
||||
<Compile Include="GameModes\Play\Taiko\TaikoPlayfield.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuComponent.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuGameMode.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuLargeComponent.cs" />
|
||||
<Compile Include="GameModes\Edit\SongSelectEdit.cs" />
|
||||
<Compile Include="Graphics\Background\Background.cs" />
|
||||
<Compile Include="Graphics\Containers\ParallaxContainer.cs" />
|
||||
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
|
||||
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
||||
<Compile Include="Graphics\TextAwesome.cs" />
|
||||
@ -104,6 +117,8 @@
|
||||
<Compile Include="Online\User.cs" />
|
||||
<Compile Include="OsuGame.cs" />
|
||||
<Compile Include="OsuGameBase.cs" />
|
||||
<Compile Include="Overlays\Options.cs" />
|
||||
<Compile Include="Overlays\Toolbar.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Users\User.cs" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user