From 2ecf72d0d7f3fa439d41c750afb935e5adaba71d Mon Sep 17 00:00:00 2001 From: stanriders Date: Tue, 29 Nov 2016 05:36:48 +0300 Subject: [PATCH] More consts, less crap (probably) --- osu-framework | 2 +- osu.Game/Graphics/UserInterface/BackButton.cs | 60 +++++++++---------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/osu-framework b/osu-framework index 24af3b161d..cc28af53d9 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 24af3b161da9447b678edd8ec32193df54f71e3b +Subproject commit cc28af53d93e2f1c5f0707c5616ed601e0cf9339 diff --git a/osu.Game/Graphics/UserInterface/BackButton.cs b/osu.Game/Graphics/UserInterface/BackButton.cs index 06aa21f2b0..f87e469b4a 100644 --- a/osu.Game/Graphics/UserInterface/BackButton.cs +++ b/osu.Game/Graphics/UserInterface/BackButton.cs @@ -12,40 +12,45 @@ using osu.Framework.Input; namespace osu.Game.Graphics.UserInterface { // 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 Container leftContainer; - private Container rightContainer; + private Container leftContainer; + 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 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() { RelativeSizeAxes = Axes.None; - Width = 120; + Width = width_retracted; Height = 50; // same as bottomToolHeight in PlaySongSelect Children = new Drawable[] { leftContainer = new Container { + Origin = Anchor.TopLeft, + Anchor = Anchor.TopLeft, RelativeSizeAxes = Axes.Y, - Width = InitialExtendLength.X, + Width = initial_extend_length, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, - Colour = colorDark, - Shear = new Vector2(0.1f, 0), + Colour = new Color4(195, 40, 140, 255), + Shear = new Vector2(shear, 0), }, icon = new TextAwesome { @@ -61,16 +66,16 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.TopLeft, RelativeSizeAxes = Axes.Y, Width = 80, - Position = Position + InitialExtendLength, + Position = Position + new Vector2(initial_extend_length, 0), Children = new Drawable[] { new Box { - Colour = colorBright, + Colour = new Color4(238, 51, 153, 255), Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, - Shear = new Vector2(0.1f, 0), + Shear = new Vector2(shear, 0), EdgeSmoothness = new Vector2(1.5f, 0), }, new SpriteText @@ -87,10 +92,10 @@ namespace osu.Game.Graphics.UserInterface { icon.ClearTransformations(); - rightContainer.MoveTo(Position + ExtendLength, transform_time, EasingTypes.OutElastic); - leftContainer.ResizeTo(new Vector2(ExtendLength.X, 1.0f), transform_time, EasingTypes.OutElastic); + rightContainer.MoveToX(Position.X + extend_length, 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); if (duration == 0) duration = pulse_length; @@ -117,10 +122,10 @@ namespace osu.Game.Graphics.UserInterface { icon.ClearTransformations(); - rightContainer.MoveTo(Position + InitialExtendLength, transform_time, EasingTypes.OutElastic); - leftContainer.ResizeTo(new Vector2(InitialExtendLength.X, 1.0f), transform_time, EasingTypes.OutElastic); + rightContainer.MoveToX(Position.X + initial_extend_length, 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); if (duration == 0) duration = pulse_length * 2; @@ -145,17 +150,12 @@ namespace osu.Game.Graphics.UserInterface { var flash = new Box { - RelativeSizeAxes = Axes.None, - Width = 140, - Height = 50, - Shear = new Vector2(0.1f, 0), - Colour = new Color4(255,255,255,255), - BlendingMode = BlendingMode.Additive, - Alpha = 0.3f + RelativeSizeAxes = Axes.Both, + Shear = new Vector2(shear, 0), + Colour = new Color4(255,255,255,128), }; Add(flash); - flash.ResizeTo(new Vector2(120, 50), transform_time, EasingTypes.OutElastic); flash.FadeOutFromOne(200); flash.Expire();