diff --git a/osu-framework b/osu-framework index 0ce37fb5f9..4880e5425c 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0ce37fb5f9847b6889ad69c208ae9e561299fb8e +Subproject commit 4880e5425cfa277be56ef87ec4d79a250ecb6d17 diff --git a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs index ed402858a6..fdbf7430fb 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapPanel.cs @@ -28,6 +28,7 @@ namespace osu.Game.Beatmaps.Drawables public Action GainedSelection; public Action StartRequested; + private Triangles triangles; protected override void Selected() { @@ -37,6 +38,8 @@ namespace osu.Game.Beatmaps.Drawables background.ColourInfo = ColourInfo.GradientVertical( new Color4(20, 43, 51, 255), new Color4(40, 86, 102, 255)); + + triangles.Colour = Color4.White; } protected override void Deselected() @@ -44,6 +47,7 @@ namespace osu.Game.Beatmaps.Drawables base.Deselected(); background.Colour = new Color4(20, 43, 51, 255); + triangles.Colour = OsuColour.Gray(0.5f); } protected override bool OnClick(InputState state) @@ -65,15 +69,11 @@ namespace osu.Game.Beatmaps.Drawables { RelativeSizeAxes = Axes.Both, }, - new Triangles + triangles = new Triangles { - // The border is drawn in the shader of the children. Being additive, triangles would over-emphasize - // the border wherever they cross it, and thus they get their own masking container without a border. - Masking = true, - CornerRadius = Content.CornerRadius, RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = new Color4(20, 43, 51, 255), + ColourLight = OsuColour.FromHex(@"3a7285"), + ColourDark = OsuColour.FromHex(@"123744") }, new FlowContainer { diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index b68b5ebc4a..f9bcf56d12 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.MathUtils; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Graphics.Backgrounds { @@ -17,10 +18,8 @@ namespace osu.Game.Graphics.Backgrounds { public override bool HandleInput => false; - public Triangles() - { - Alpha = 0.3f; - } + public Color4 ColourLight = Color4.White; + public Color4 ColourDark = Color4.Black; private float triangleScale = 1; @@ -65,12 +64,14 @@ namespace osu.Game.Graphics.Backgrounds RelativePositionAxes = Axes.Both, Scale = new Vector2(scale), // Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length) + Colour = GetTriangleShade(), Size = new Vector2(size, 0.866f * size), - Alpha = RNG.NextSingle(), Depth = scale, }; } + protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1); + private void addTriangle(bool randomX) { var sprite = CreateTriangle(); diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 2d434fb9b4..9a1d0110f1 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); - private static Color4 FromHex(string hex) + public static Color4 FromHex(string hex) { switch (hex.Length) { @@ -38,7 +38,6 @@ namespace osu.Game.Graphics } // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less - public Color4 PurpleLighter = FromHex(@"eeeeff"); public Color4 PurpleLight = FromHex(@"aa88ff"); public Color4 Purple = FromHex(@"8866ee"); diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 2afcf56140..7314d0006e 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -2,23 +2,34 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Graphics.UserInterface; - +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.Backgrounds; + namespace osu.Game.Graphics.UserInterface { public class OsuButton : Button { public OsuButton() { - Height = 25; + Height = 40; } [BackgroundDependencyLoader] private void load(OsuColour colours) { Colour = colours.BlueDark; + Masking = true; + CornerRadius = 5; + + Add(new Triangles + { + RelativeSizeAxes = Axes.Both, + ColourDark = colours.BlueDarker, + ColourLight = colours.Blue, + }); } } } \ No newline at end of file diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs new file mode 100644 index 0000000000..5041e7ded9 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -0,0 +1,48 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input; +using OpenTK.Graphics; + +namespace osu.Game.Graphics.UserInterface +{ + public class OsuTextBox : TextBox + { + public OsuTextBox() + { + Height = 40; + TextContainer.Height = 0.6f; + CornerRadius = 5; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colour) + { + BorderColour = colour.Yellow; + } + + protected override bool OnFocus(InputState state) + { + BorderThickness = 3; + + return base.OnFocus(state); + } + + protected override void OnFocusLost(InputState state) + { + BorderThickness = 0; + + base.OnFocusLost(state); + } + } + + public class OsuPasswordTextBox : OsuTextBox + { + protected virtual char MaskCharacter => '*'; + + protected override Drawable AddCharacterToFlow(char c) => base.AddCharacterToFlow(MaskCharacter); + } +} diff --git a/osu.Game/Overlays/Options/General/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs index 333b794d58..b15518f3c3 100644 --- a/osu.Game/Overlays/Options/General/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -11,8 +11,8 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; -using osu.Game.Configuration; - +using osu.Game.Configuration; + namespace osu.Game.Overlays.Options.General { public class LoginOptions : OptionsSubsection, IOnlineComponent @@ -21,8 +21,8 @@ namespace osu.Game.Overlays.Options.General [BackgroundDependencyLoader(permitNulls: true)] private void load(APIAccess api) - { - api?.Register(this); + { + api?.Register(this); } public void APIStateChanged(APIAccess api, APIState state) @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Options.General class LoginForm : FlowContainer { private TextBox username; - private PasswordTextBox password; + private TextBox password; private APIAccess api; private CheckBoxOption saveUsername; @@ -86,10 +86,10 @@ namespace osu.Game.Overlays.Options.General api.Login(username.Text, password.Text); } - [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api, OsuConfigManager config) - { - this.api = api; + [BackgroundDependencyLoader(permitNulls: true)] + private void load(APIAccess api, OsuConfigManager config) + { + this.api = api; Direction = FlowDirection.VerticalOnly; AutoSizeAxes = Axes.Y; RelativeSizeAxes = Axes.X; @@ -97,27 +97,25 @@ namespace osu.Game.Overlays.Options.General Children = new Drawable[] { new SpriteText { Text = "Username" }, - username = new TextBox - { - Height = 20, - RelativeSizeAxes = Axes.X, - Text = api?.Username ?? string.Empty + username = new OsuTextBox + { + RelativeSizeAxes = Axes.X, + Text = api?.Username ?? string.Empty }, new SpriteText { Text = "Password" }, - password = new PasswordTextBox - { - Height = 20, - RelativeSizeAxes = Axes.X + password = new OsuPasswordTextBox + { + RelativeSizeAxes = Axes.X }, - saveUsername = new CheckBoxOption - { - LabelText = "Remember Username", - Bindable = config.GetBindable(OsuConfig.SaveUsername), + saveUsername = new CheckBoxOption + { + LabelText = "Remember Username", + Bindable = config.GetBindable(OsuConfig.SaveUsername), }, - savePassword = new CheckBoxOption - { - LabelText = "Remember Password", - Bindable = config.GetBindable(OsuConfig.SavePassword), + savePassword = new CheckBoxOption + { + LabelText = "Remember Password", + Bindable = config.GetBindable(OsuConfig.SavePassword), }, new OsuButton { @@ -131,7 +129,7 @@ namespace osu.Game.Overlays.Options.General Text = "Register", //Action = registerLink } - }; + }; } } } diff --git a/osu.Game/Overlays/Options/Online/InGameChatOptions.cs b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs index 098fe39546..8a04d2cec3 100644 --- a/osu.Game/Overlays/Options/Online/InGameChatOptions.cs +++ b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs @@ -43,13 +43,11 @@ namespace osu.Game.Overlays.Options.Online }, new SpriteText { Text = "Chat ignore list (space-seperated list)" }, chatIgnoreList = new TextBoxOption { - Height = 20, RelativeSizeAxes = Axes.X, Bindable = config.GetBindable(OsuConfig.IgnoreList) }, new SpriteText { Text = "Chat highlight words (space-seperated list)" }, chatHighlightWords = new TextBoxOption { - Height = 20, RelativeSizeAxes = Axes.X, Bindable = config.GetBindable(OsuConfig.HighlightWords) }, diff --git a/osu.Game/Overlays/Options/TextBoxOption.cs b/osu.Game/Overlays/Options/TextBoxOption.cs index c0ac08d149..6edd34e318 100644 --- a/osu.Game/Overlays/Options/TextBoxOption.cs +++ b/osu.Game/Overlays/Options/TextBoxOption.cs @@ -2,12 +2,13 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Configuration; -using osu.Framework.Graphics.UserInterface; - +using osu.Framework.Configuration; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.UserInterface; + namespace osu.Game.Overlays.Options { - public class TextBoxOption : TextBox + public class TextBoxOption : OsuTextBox { private Bindable bindable; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 719d75b018..ebdb89b169 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -249,6 +249,8 @@ namespace osu.Game.Screens.Menu { sampleClick.Play(); + box.FlashColour(Color4.White, 500, EasingTypes.OutExpo); + clickAction?.Invoke(); } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 323b23b920..af552c6bb6 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Transformations; using osu.Framework.Input; using osu.Framework.MathUtils; +using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using OpenTK; using OpenTK.Graphics; @@ -23,6 +24,8 @@ namespace osu.Game.Screens.Menu /// public partial class OsuLogo : Container { + public Color4 OsuPink = OsuColour.FromHex(@"e967a1"); + private Sprite logo; private CircularContainer logoContainer; private Container logoBounceContainer; @@ -62,6 +65,7 @@ namespace osu.Game.Screens.Menu } public bool Interactive = true; + private Box flashLayer; public OsuLogo() { @@ -104,15 +108,24 @@ namespace osu.Game.Screens.Menu new Box { RelativeSizeAxes = Axes.Both, - Colour = new Color4(233, 103, 161, 255), + Colour = OsuPink, }, - new OsuLogoTriangles + new Triangles { + TriangleScale = 4, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), RelativeSizeAxes = Axes.Both, }, } }, - + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = Color4.White, + Alpha = 0, + }, }, }, logo = new Sprite @@ -189,6 +202,10 @@ namespace osu.Game.Screens.Menu { if (!Interactive) return false; + flashLayer.ClearTransformations(); + flashLayer.Alpha = 0.4f; + flashLayer.FadeOut(1500, EasingTypes.OutExpo); + Action?.Invoke(); return true; } @@ -204,31 +221,5 @@ namespace osu.Game.Screens.Menu { logoHoverContainer.ScaleTo(1, 500, EasingTypes.OutElastic); } - - class OsuLogoTriangles : Triangles - { - public OsuLogoTriangles() - { - TriangleScale = 4; - Alpha = 1; - } - - protected override Triangle CreateTriangle() - { - var triangle = base.CreateTriangle(); - triangle.Alpha = 1; - triangle.Colour = getTriangleShade(); - return triangle; - } - - private Color4 getTriangleShade() - { - float val = RNG.NextSingle(); - return Interpolation.ValueAt(val, - new Color4(222, 91, 149, 255), - new Color4(255, 125, 183, 255), - 0, 1); - } - } } } \ No newline at end of file diff --git a/osu.Game/Screens/Select/CarouselContainer.cs b/osu.Game/Screens/Select/CarouselContainer.cs index 5f431e4a88..6d43b538a1 100644 --- a/osu.Game/Screens/Select/CarouselContainer.cs +++ b/osu.Game/Screens/Select/CarouselContainer.cs @@ -187,7 +187,7 @@ namespace osu.Game.Screens.Select private static float offsetX(float dist, float halfHeight) { // The radius of the circle the carousel moves on. - const float CIRCLE_RADIUS = 4; + const float CIRCLE_RADIUS = 3; double discriminant = Math.Max(0, CIRCLE_RADIUS * CIRCLE_RADIUS - dist * dist); float x = (CIRCLE_RADIUS - (float)Math.Sqrt(discriminant)) * halfHeight; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 93091ff677..b2d61b2b05 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -67,6 +67,7 @@ +