1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Merge remote-tracking branch 'upstream/master' into song-select-filtering

This commit is contained in:
Drew DeVault 2017-01-31 19:00:50 -05:00
commit 637a99e8d0
13 changed files with 133 additions and 83 deletions

@ -1 +1 @@
Subproject commit 0ce37fb5f9847b6889ad69c208ae9e561299fb8e Subproject commit 4880e5425cfa277be56ef87ec4d79a250ecb6d17

View File

@ -28,6 +28,7 @@ namespace osu.Game.Beatmaps.Drawables
public Action<BeatmapPanel> GainedSelection; public Action<BeatmapPanel> GainedSelection;
public Action<BeatmapPanel> StartRequested; public Action<BeatmapPanel> StartRequested;
private Triangles triangles;
protected override void Selected() protected override void Selected()
{ {
@ -37,6 +38,8 @@ namespace osu.Game.Beatmaps.Drawables
background.ColourInfo = ColourInfo.GradientVertical( background.ColourInfo = ColourInfo.GradientVertical(
new Color4(20, 43, 51, 255), new Color4(20, 43, 51, 255),
new Color4(40, 86, 102, 255)); new Color4(40, 86, 102, 255));
triangles.Colour = Color4.White;
} }
protected override void Deselected() protected override void Deselected()
@ -44,6 +47,7 @@ namespace osu.Game.Beatmaps.Drawables
base.Deselected(); base.Deselected();
background.Colour = new Color4(20, 43, 51, 255); background.Colour = new Color4(20, 43, 51, 255);
triangles.Colour = OsuColour.Gray(0.5f);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
@ -65,15 +69,11 @@ namespace osu.Game.Beatmaps.Drawables
{ {
RelativeSizeAxes = Axes.Both, 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, RelativeSizeAxes = Axes.Both,
BlendingMode = BlendingMode.Additive, ColourLight = OsuColour.FromHex(@"3a7285"),
Colour = new Color4(20, 43, 51, 255), ColourDark = OsuColour.FromHex(@"123744")
}, },
new FlowContainer new FlowContainer
{ {

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Graphics.Backgrounds namespace osu.Game.Graphics.Backgrounds
{ {
@ -17,10 +18,8 @@ namespace osu.Game.Graphics.Backgrounds
{ {
public override bool HandleInput => false; public override bool HandleInput => false;
public Triangles() public Color4 ColourLight = Color4.White;
{ public Color4 ColourDark = Color4.Black;
Alpha = 0.3f;
}
private float triangleScale = 1; private float triangleScale = 1;
@ -65,12 +64,14 @@ namespace osu.Game.Graphics.Backgrounds
RelativePositionAxes = Axes.Both, RelativePositionAxes = Axes.Both,
Scale = new Vector2(scale), Scale = new Vector2(scale),
// Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length) // Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length)
Colour = GetTriangleShade(),
Size = new Vector2(size, 0.866f * size), Size = new Vector2(size, 0.866f * size),
Alpha = RNG.NextSingle(),
Depth = scale, Depth = scale,
}; };
} }
protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1);
private void addTriangle(bool randomX) private void addTriangle(bool randomX)
{ {
var sprite = CreateTriangle(); var sprite = CreateTriangle();

View File

@ -16,7 +16,7 @@ namespace osu.Game.Graphics
public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f); public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f);
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); 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) 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 // See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
public Color4 PurpleLighter = FromHex(@"eeeeff"); public Color4 PurpleLighter = FromHex(@"eeeeff");
public Color4 PurpleLight = FromHex(@"aa88ff"); public Color4 PurpleLight = FromHex(@"aa88ff");
public Color4 Purple = FromHex(@"8866ee"); public Color4 Purple = FromHex(@"8866ee");

View File

@ -2,23 +2,34 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
public class OsuButton : Button public class OsuButton : Button
{ {
public OsuButton() public OsuButton()
{ {
Height = 25; Height = 40;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
Colour = colours.BlueDark; Colour = colours.BlueDark;
Masking = true;
CornerRadius = 5;
Add(new Triangles
{
RelativeSizeAxes = Axes.Both,
ColourDark = colours.BlueDarker,
ColourLight = colours.Blue,
});
} }
} }
} }

View File

@ -0,0 +1,48 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//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);
}
}

View File

@ -11,8 +11,8 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Configuration; using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.General namespace osu.Game.Overlays.Options.General
{ {
public class LoginOptions : OptionsSubsection, IOnlineComponent public class LoginOptions : OptionsSubsection, IOnlineComponent
@ -21,8 +21,8 @@ namespace osu.Game.Overlays.Options.General
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api) private void load(APIAccess api)
{ {
api?.Register(this); api?.Register(this);
} }
public void APIStateChanged(APIAccess api, APIState state) public void APIStateChanged(APIAccess api, APIState state)
@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Options.General
class LoginForm : FlowContainer class LoginForm : FlowContainer
{ {
private TextBox username; private TextBox username;
private PasswordTextBox password; private TextBox password;
private APIAccess api; private APIAccess api;
private CheckBoxOption saveUsername; private CheckBoxOption saveUsername;
@ -86,10 +86,10 @@ namespace osu.Game.Overlays.Options.General
api.Login(username.Text, password.Text); api.Login(username.Text, password.Text);
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, OsuConfigManager config) private void load(APIAccess api, OsuConfigManager config)
{ {
this.api = api; this.api = api;
Direction = FlowDirection.VerticalOnly; Direction = FlowDirection.VerticalOnly;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
@ -97,27 +97,25 @@ namespace osu.Game.Overlays.Options.General
Children = new Drawable[] Children = new Drawable[]
{ {
new SpriteText { Text = "Username" }, new SpriteText { Text = "Username" },
username = new TextBox username = new OsuTextBox
{ {
Height = 20, RelativeSizeAxes = Axes.X,
RelativeSizeAxes = Axes.X, Text = api?.Username ?? string.Empty
Text = api?.Username ?? string.Empty
}, },
new SpriteText { Text = "Password" }, new SpriteText { Text = "Password" },
password = new PasswordTextBox password = new OsuPasswordTextBox
{ {
Height = 20, RelativeSizeAxes = Axes.X
RelativeSizeAxes = Axes.X
}, },
saveUsername = new CheckBoxOption saveUsername = new CheckBoxOption
{ {
LabelText = "Remember Username", LabelText = "Remember Username",
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername), Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
}, },
savePassword = new CheckBoxOption savePassword = new CheckBoxOption
{ {
LabelText = "Remember Password", LabelText = "Remember Password",
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword), Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
}, },
new OsuButton new OsuButton
{ {
@ -131,7 +129,7 @@ namespace osu.Game.Overlays.Options.General
Text = "Register", Text = "Register",
//Action = registerLink //Action = registerLink
} }
}; };
} }
} }
} }

View File

@ -43,13 +43,11 @@ namespace osu.Game.Overlays.Options.Online
}, },
new SpriteText { Text = "Chat ignore list (space-seperated list)" }, new SpriteText { Text = "Chat ignore list (space-seperated list)" },
chatIgnoreList = new TextBoxOption { chatIgnoreList = new TextBoxOption {
Height = 20,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Bindable = config.GetBindable<string>(OsuConfig.IgnoreList) Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
}, },
new SpriteText { Text = "Chat highlight words (space-seperated list)" }, new SpriteText { Text = "Chat highlight words (space-seperated list)" },
chatHighlightWords = new TextBoxOption { chatHighlightWords = new TextBoxOption {
Height = 20,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Bindable = config.GetBindable<string>(OsuConfig.HighlightWords) Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
}, },

View File

@ -2,12 +2,13 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options namespace osu.Game.Overlays.Options
{ {
public class TextBoxOption : TextBox public class TextBoxOption : OsuTextBox
{ {
private Bindable<string> bindable; private Bindable<string> bindable;

View File

@ -249,6 +249,8 @@ namespace osu.Game.Screens.Menu
{ {
sampleClick.Play(); sampleClick.Play();
box.FlashColour(Color4.White, 500, EasingTypes.OutExpo);
clickAction?.Invoke(); clickAction?.Invoke();
} }

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -23,6 +24,8 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public partial class OsuLogo : Container public partial class OsuLogo : Container
{ {
public Color4 OsuPink = OsuColour.FromHex(@"e967a1");
private Sprite logo; private Sprite logo;
private CircularContainer logoContainer; private CircularContainer logoContainer;
private Container logoBounceContainer; private Container logoBounceContainer;
@ -62,6 +65,7 @@ namespace osu.Game.Screens.Menu
} }
public bool Interactive = true; public bool Interactive = true;
private Box flashLayer;
public OsuLogo() public OsuLogo()
{ {
@ -104,15 +108,24 @@ namespace osu.Game.Screens.Menu
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, 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, RelativeSizeAxes = Axes.Both,
}, },
} }
}, },
flashLayer = new Box
{
RelativeSizeAxes = Axes.Both,
BlendingMode = BlendingMode.Additive,
Colour = Color4.White,
Alpha = 0,
},
}, },
}, },
logo = new Sprite logo = new Sprite
@ -189,6 +202,10 @@ namespace osu.Game.Screens.Menu
{ {
if (!Interactive) return false; if (!Interactive) return false;
flashLayer.ClearTransformations();
flashLayer.Alpha = 0.4f;
flashLayer.FadeOut(1500, EasingTypes.OutExpo);
Action?.Invoke(); Action?.Invoke();
return true; return true;
} }
@ -204,31 +221,5 @@ namespace osu.Game.Screens.Menu
{ {
logoHoverContainer.ScaleTo(1, 500, EasingTypes.OutElastic); 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);
}
}
} }
} }

View File

@ -187,7 +187,7 @@ namespace osu.Game.Screens.Select
private static float offsetX(float dist, float halfHeight) private static float offsetX(float dist, float halfHeight)
{ {
// The radius of the circle the carousel moves on. // 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); double discriminant = Math.Max(0, CIRCLE_RADIUS * CIRCLE_RADIUS - dist * dist);
float x = (CIRCLE_RADIUS - (float)Math.Sqrt(discriminant)) * halfHeight; float x = (CIRCLE_RADIUS - (float)Math.Sqrt(discriminant)) * halfHeight;

View File

@ -67,6 +67,7 @@
<Compile Include="Graphics\Backgrounds\Triangles.cs" /> <Compile Include="Graphics\Backgrounds\Triangles.cs" />
<Compile Include="Graphics\Cursor\CursorTrail.cs" /> <Compile Include="Graphics\Cursor\CursorTrail.cs" />
<Compile Include="Graphics\UserInterface\BackButton.cs" /> <Compile Include="Graphics\UserInterface\BackButton.cs" />
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
<Compile Include="Modes\Objects\HitObjectParser.cs" /> <Compile Include="Modes\Objects\HitObjectParser.cs" />
<Compile Include="Modes\Score.cs" /> <Compile Include="Modes\Score.cs" />
<Compile Include="Modes\ScoreProcesssor.cs" /> <Compile Include="Modes\ScoreProcesssor.cs" />