Updates to latest osu-framework, Updates existing Load() methods to use Children = new Drawable[]{} syntax

This commit is contained in:
Remie Richards
2016-09-17 21:33:46 +01:00
parent b52c3074ef
commit 1a5c2b5221
6 changed files with 260 additions and 260 deletions

View File

@ -50,42 +50,47 @@ namespace osu.Game.GameModes.Menu
{
base.Load();
osuLogo = new OsuLogo(onOsuLogo)
Add(new Drawable[]
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
};
Add(buttonArea = new Container()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
SizeMode = InheritMode.X,
Size = new Vector2(1, button_area_height),
Alpha = 0
osuLogo = new OsuLogo(onOsuLogo)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre
},
buttonArea = new Container()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
SizeMode = InheritMode.X,
Size = new Vector2(1, button_area_height),
Alpha = 0,
Children = new Drawable[]
{
new Box()
{
SizeMode = InheritMode.XY,
Colour = new Color4(50, 50, 50, 255)
},
buttonFlow = new FlowContainerWithOrigin()
{
Anchor = Anchor.Centre,
Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0),
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),
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.
{
Size = new Vector2(0, button_area_height)
}
},
CentreTarget = iconFacade
}
}
}
});
Add(osuLogo);
buttonArea.Add(new Box()
{
SizeMode = InheritMode.XY,
Colour = new Color4(50, 50, 50, 255)
});
buttonArea.Add(buttonFlow = new FlowContainerWithOrigin()
{
Anchor = Anchor.Centre,
Position = new Vector2(wedge_width * 2 - (button_width + osuLogo.SizeForFlow / 4), 0),
Padding = new Vector2(-wedge_width, 0)
});
buttonFlow.Add(settingsButton = new Button(@"settings", @"options", FontAwesome.gear, new Color4(85, 85, 85, 255), onSettings, -wedge_width, Key.O));
buttonFlow.Add(backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -wedge_width, Key.Escape));
//need a container to make the osu! icon flow properly.
buttonFlow.Add(iconFacade = new Container() { Size = new Vector2(0, button_area_height) });
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)));
@ -285,37 +290,35 @@ namespace osu.Game.GameModes.Menu
{
base.Load();
Add(logoBounceContainer = new AutoSizeContainer());
logo = new Sprite(Game.Textures.Get(@"menu-osu"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
logoBounceContainer.Add(logo);
Sprite ripple = new Sprite(Game.Textures.Get(@"menu-osu"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Alpha = 0.4f
};
logoBounceContainer.Add(ripple);
ripple.ScaleTo(1.1f, 500);
ripple.FadeOut(500);
ripple.Loop(300);
logoBounceContainer.Add(vis = new MenuVisualisation()
Add(logoBounceContainer = new AutoSizeContainer()
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = logo.Size,
Additive = true,
//Radius = logo.Size.X / 2 * 0.96f,
Alpha = 0.2f,
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,
}
}
});
}
@ -414,46 +417,40 @@ namespace osu.Game.GameModes.Menu
this.text = text;
}
public override void Load()
{
base.Load();
Alpha = 0;
public override void Load()
{
base.Load();
Alpha = 0;
Add(box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = colour,
Scale = new Vector2(0, 1)
});
iconText = new AutoSizeContainer
{
Position = new Vector2(extraWidth / 2, 0),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
Add(iconText);
icon = new TextAwesome(symbol, 40, Vector2.Zero)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.7f),
};
iconText.Add(icon);
SpriteText ft = new SpriteText()
{
Direction = FlowDirection.HorizontalOnly,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Position = new Vector2(0, 25),
Text = text
};
iconText.Add(ft);
}
Add(new Drawable[]
{
box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = colour,
Scale = new Vector2(0, 2)
},
iconText = new AutoSizeContainer()
{
Position = new Vector2(extraWidth / 2, 0),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
icon = new TextAwesome(symbol, 40, Vector2.Zero),
new SpriteText()
{
Direction = FlowDirection.HorizontalOnly,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Position = new Vector2(0, 25),
Text = text
}
}
}
});
}
protected override bool OnHover(InputState state)
{