More consts, less crap (probably)

This commit is contained in:
stanriders 2016-11-29 05:36:48 +03:00
parent 775e8ac5d6
commit 2ecf72d0d7
2 changed files with 31 additions and 31 deletions

@ -1 +1 @@
Subproject commit 24af3b161da9447b678edd8ec32193df54f71e3b Subproject commit cc28af53d93e2f1c5f0707c5616ed601e0cf9339

View File

@ -12,40 +12,45 @@ using osu.Framework.Input;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
// Basic back button as it was on stable (kinda). No skinning possible for now // Basic back button as it was on stable (kinda). No skinning possible for now
class BackButton : ClickableContainer public class BackButton : ClickableContainer
{ {
private TextAwesome icon; private TextAwesome icon;
private Container leftContainer; private Container leftContainer;
private Container rightContainer; private Container rightContainer;
public Vector2 ExtendLength = new Vector2(60, 0);
public Vector2 InitialExtendLength = new Vector2(40, 0);
private Color4 colorBright = new Color4(238, 51, 153, 255);
private Color4 colorDark = new Color4(195, 40, 140, 255);
private const double transform_time = 300.0; private const double transform_time = 300.0;
private const int pulse_length = 250; private const int pulse_length = 250;
private const float shear = 0.1f;
private const int extend_length = 60;
private const int initial_extend_length = 40;
private const int width_extended = 140;
private const int width_retracted = 120;
public BackButton() public BackButton()
{ {
RelativeSizeAxes = Axes.None; RelativeSizeAxes = Axes.None;
Width = 120; Width = width_retracted;
Height = 50; // same as bottomToolHeight in PlaySongSelect Height = 50; // same as bottomToolHeight in PlaySongSelect
Children = new Drawable[] Children = new Drawable[]
{ {
leftContainer = new Container leftContainer = new Container
{ {
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = InitialExtendLength.X, Width = initial_extend_length,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colorDark, Colour = new Color4(195, 40, 140, 255),
Shear = new Vector2(0.1f, 0), Shear = new Vector2(shear, 0),
}, },
icon = new TextAwesome icon = new TextAwesome
{ {
@ -61,16 +66,16 @@ namespace osu.Game.Graphics.UserInterface
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = 80, Width = 80,
Position = Position + InitialExtendLength, Position = Position + new Vector2(initial_extend_length, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
Colour = colorBright, Colour = new Color4(238, 51, 153, 255),
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Shear = new Vector2(0.1f, 0), Shear = new Vector2(shear, 0),
EdgeSmoothness = new Vector2(1.5f, 0), EdgeSmoothness = new Vector2(1.5f, 0),
}, },
new SpriteText new SpriteText
@ -87,10 +92,10 @@ namespace osu.Game.Graphics.UserInterface
{ {
icon.ClearTransformations(); icon.ClearTransformations();
rightContainer.MoveTo(Position + ExtendLength, transform_time, EasingTypes.OutElastic); rightContainer.MoveToX(Position.X + extend_length, transform_time, EasingTypes.OutElastic);
leftContainer.ResizeTo(new Vector2(ExtendLength.X, 1.0f), transform_time, EasingTypes.OutElastic); leftContainer.ResizeTo(new Vector2(extend_length, 1.0f), transform_time, EasingTypes.OutElastic);
Width = 140; // right container + ExtendLength Width = width_extended; // right container + ExtendLength
int duration = 0; //(int)(Game.Audio.BeatLength / 2); int duration = 0; //(int)(Game.Audio.BeatLength / 2);
if (duration == 0) duration = pulse_length; if (duration == 0) duration = pulse_length;
@ -117,10 +122,10 @@ namespace osu.Game.Graphics.UserInterface
{ {
icon.ClearTransformations(); icon.ClearTransformations();
rightContainer.MoveTo(Position + InitialExtendLength, transform_time, EasingTypes.OutElastic); rightContainer.MoveToX(Position.X + initial_extend_length, transform_time, EasingTypes.OutElastic);
leftContainer.ResizeTo(new Vector2(InitialExtendLength.X, 1.0f), transform_time, EasingTypes.OutElastic); leftContainer.ResizeTo(new Vector2(initial_extend_length, 1.0f), transform_time, EasingTypes.OutElastic);
Width = 120; // right container + InitialExtendLength Width = width_retracted; // right container + InitialExtendLength
int duration = 0; //(int)(Game.Audio.BeatLength / 2); int duration = 0; //(int)(Game.Audio.BeatLength / 2);
if (duration == 0) duration = pulse_length * 2; if (duration == 0) duration = pulse_length * 2;
@ -145,17 +150,12 @@ namespace osu.Game.Graphics.UserInterface
{ {
var flash = new Box var flash = new Box
{ {
RelativeSizeAxes = Axes.None, RelativeSizeAxes = Axes.Both,
Width = 140, Shear = new Vector2(shear, 0),
Height = 50, Colour = new Color4(255,255,255,128),
Shear = new Vector2(0.1f, 0),
Colour = new Color4(255,255,255,255),
BlendingMode = BlendingMode.Additive,
Alpha = 0.3f
}; };
Add(flash); Add(flash);
flash.ResizeTo(new Vector2(120, 50), transform_time, EasingTypes.OutElastic);
flash.FadeOutFromOne(200); flash.FadeOutFromOne(200);
flash.Expire(); flash.Expire();