1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 00:52: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();
Add(new Drawable[]
Children = new Drawable[]
{
osuLogo = new OsuLogo(onOsuLogo)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
},
buttonArea = new Container()
buttonArea = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -66,12 +66,12 @@ namespace osu.Game.GameModes.Menu
Alpha = 0,
Children = new Drawable[]
{
new Box()
new Box
{
SizeMode = InheritMode.XY,
Colour = new Color4(50, 50, 50, 255)
},
buttonFlow = new FlowContainerWithOrigin()
buttonFlow = new FlowContainerWithOrigin
{
Anchor = Anchor.Centre,
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),
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)
}
@ -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(@"multi", @"multiplayer", FontAwesome.users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)));
@ -290,36 +290,41 @@ namespace osu.Game.GameModes.Menu
{
base.Load();
Sprite ripple = new Sprite(Game.Textures.Get(@"menu-osu"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0.4f
};
ripple.ScaleTo(1.1f, 500);
ripple.FadeOut(500);
ripple.Loop(300);
Sprite ripple;
Add(logoBounceContainer = new AutoSizeContainer()
{
Children = new Drawable[]
{
logo = new Sprite(Game.Textures.Get(@"menu-osu"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
ripple,
vis = new MenuVisualisation()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = logo.Size,
Additive = true,
Alpha = 0.2f,
}
}
});
Children = new Drawable[]
{
logoBounceContainer = new AutoSizeContainer
{
Children = new Drawable[]
{
logo = new Sprite(Game.Textures.Get(@"menu-osu"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
ripple = new Sprite(Game.Textures.Get(@"menu-osu"))
{
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)
@ -422,7 +427,7 @@ namespace osu.Game.GameModes.Menu
base.Load();
Alpha = 0;
Add(new Drawable[]
Children = new Drawable[]
{
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,
Scale = new Vector2(0, 2)
},
iconText = new AutoSizeContainer()
iconText = new AutoSizeContainer
{
Position = new Vector2(extraWidth / 2, 0),
Anchor = Anchor.Centre,
@ -439,7 +444,7 @@ namespace osu.Game.GameModes.Menu
Children = new Drawable[]
{
icon = new TextAwesome(symbol, 40, Vector2.Zero),
new SpriteText()
new SpriteText
{
Direction = FlowDirection.HorizontalOnly,
Anchor = Anchor.Centre,
@ -449,7 +454,7 @@ namespace osu.Game.GameModes.Menu
}
}
}
});
};
}
protected override bool OnHover(InputState state)

View File

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

View File

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