1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 06:12:56 +08:00

Replaced all Add() calls in Load()s with direct Children = new Drawable[] {} settings, for consistency

This commit is contained in:
Remie Richards 2016-09-18 20:41:53 +01:00
parent 4732a4db19
commit 314b0dfc04
3 changed files with 58 additions and 48 deletions

View File

@ -50,14 +50,14 @@ namespace osu.Game.GameModes.Menu
{ {
base.Load(); base.Load();
Add(new Drawable[] Children = new Drawable[]
{ {
osuLogo = new OsuLogo(onOsuLogo) osuLogo = new OsuLogo(onOsuLogo)
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre Anchor = Anchor.Centre
}, },
buttonArea = new Container() buttonArea = new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -66,12 +66,12 @@ namespace osu.Game.GameModes.Menu
Alpha = 0, Alpha = 0,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box() new Box
{ {
SizeMode = InheritMode.XY, SizeMode = InheritMode.XY,
Colour = new Color4(50, 50, 50, 255) Colour = new Color4(50, 50, 50, 255)
}, },
buttonFlow = new FlowContainerWithOrigin() buttonFlow = new FlowContainerWithOrigin
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0), Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0),
@ -80,7 +80,7 @@ namespace osu.Game.GameModes.Menu
{ {
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), 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. iconFacade = new Container //need a container to make the osu! icon flow properly.
{ {
Size = new Vector2(0, button_area_height) Size = new Vector2(0, button_area_height)
} }
@ -89,7 +89,7 @@ namespace osu.Game.GameModes.Menu
} }
} }
} }
}); };
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(@"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(@"multi", @"multiplayer", FontAwesome.users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)));
@ -290,17 +290,12 @@ namespace osu.Game.GameModes.Menu
{ {
base.Load(); base.Load();
Sprite ripple = new Sprite(Game.Textures.Get(@"menu-osu")) Sprite ripple;
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0.4f
};
ripple.ScaleTo(1.1f, 500);
ripple.FadeOut(500);
ripple.Loop(300);
Add(logoBounceContainer = new AutoSizeContainer()
Children = new Drawable[]
{
logoBounceContainer = new AutoSizeContainer
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
@ -309,7 +304,12 @@ namespace osu.Game.GameModes.Menu
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
}, },
ripple, ripple = new Sprite(Game.Textures.Get(@"menu-osu"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0.4f
},
vis = new MenuVisualisation() vis = new MenuVisualisation()
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -319,7 +319,12 @@ namespace osu.Game.GameModes.Menu
Alpha = 0.2f, Alpha = 0.2f,
} }
} }
}); }
};
ripple.ScaleTo(1.1f, 500);
ripple.FadeOut(500);
ripple.Loop(300);
} }
public OsuLogo(Action action) public OsuLogo(Action action)
@ -422,7 +427,7 @@ namespace osu.Game.GameModes.Menu
base.Load(); base.Load();
Alpha = 0; Alpha = 0;
Add(new Drawable[] Children = new Drawable[]
{ {
box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width) box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width)
{ {
@ -431,7 +436,7 @@ namespace osu.Game.GameModes.Menu
Colour = colour, Colour = colour,
Scale = new Vector2(0, 2) Scale = new Vector2(0, 2)
}, },
iconText = new AutoSizeContainer() iconText = new AutoSizeContainer
{ {
Position = new Vector2(extraWidth / 2, 0), Position = new Vector2(extraWidth / 2, 0),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -439,7 +444,7 @@ namespace osu.Game.GameModes.Menu
Children = new Drawable[] Children = new Drawable[]
{ {
icon = new TextAwesome(symbol, 40, Vector2.Zero), icon = new TextAwesome(symbol, 40, Vector2.Zero),
new SpriteText() new SpriteText
{ {
Direction = FlowDirection.HorizontalOnly, Direction = FlowDirection.HorizontalOnly,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -449,7 +454,7 @@ namespace osu.Game.GameModes.Menu
} }
} }
} }
}); };
} }
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)

View File

@ -23,22 +23,22 @@ namespace osu.Game.GameModes.Menu
AudioSample welcome = Game.Audio.Sample.Get(@"welcome"); AudioSample welcome = Game.Audio.Sample.Get(@"welcome");
Add(new Drawable[] Children = new Drawable[]
{ {
new ButtonSystem(), new ButtonSystem(),
new TextBox() new TextBox
{ {
Text = @"The quick brown fox jumped over the lazy dog.", Text = @"The quick brown fox jumped over the lazy dog.",
Position = new Vector2(50, 50), Position = new Vector2(50, 50),
Size = new Vector2(300, 20) Size = new Vector2(300, 20)
}, },
new SpriteText() new SpriteText
{ {
Text = @"The quick brown fox jumped over the lazy dog.", Text = @"The quick brown fox jumped over the lazy dog.",
Position = new Vector2(50, 80), Position = new Vector2(50, 80),
Size = new Vector2(300, 20) Size = new Vector2(300, 20)
} }
}); };
} }
} }
} }

View File

@ -46,12 +46,17 @@ namespace osu.Game
//}; //};
//API.Queue(req); //API.Queue(req);
Add(new Drawable[] Children = new Drawable[]
{
new RatioAdjust
{
Children = new Drawable[]
{ {
new RatioAdjust(),
new MainMenu(), new MainMenu(),
new CursorContainer() new CursorContainer()
}); }
}
};
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)