1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:47:25 +08:00

Merge remote-tracking branch 'upstream/master' into login-updates

# Conflicts:
#	osu.Game/Overlays/Options/General/LoginOptions.cs
This commit is contained in:
Dean Herbert 2017-01-31 17:05:33 +09:00
commit 62c5ad907a
12 changed files with 116 additions and 66 deletions

View File

@ -28,6 +28,7 @@ namespace osu.Game.Beatmaps.Drawables
public Action<BeatmapPanel> GainedSelection;
public Action<BeatmapPanel> 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
{

View File

@ -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();

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(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");

View File

@ -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,
});
}
}
}

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

@ -12,8 +12,8 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Configuration;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Primitives;
namespace osu.Game.Overlays.Options.General
{
public class LoginOptions : OptionsSubsection, IOnlineComponent
@ -27,10 +27,10 @@ namespace osu.Game.Overlays.Options.General
public bool Bounding
{
get { return bounding; }
set
{
bounding = value;
Invalidate(Invalidation.SizeInParentSpace);
set
{
bounding = value;
Invalidate(Invalidation.SizeInParentSpace);
}
}
@ -89,7 +89,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;
@ -112,16 +112,14 @@ namespace osu.Game.Overlays.Options.General
Children = new Drawable[]
{
new SpriteText { Text = "Username" },
username = new TextBox
username = new OsuTextBox
{
Height = 20,
RelativeSizeAxes = Axes.X,
Text = api?.Username ?? string.Empty
},
new SpriteText { Text = "Password" },
password = new PasswordTextBox
password = new OsuPasswordTextBox
{
Height = 20,
RelativeSizeAxes = Axes.X
},
saveUsername = new CheckBoxOption

View File

@ -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<string>(OsuConfig.IgnoreList)
},
new SpriteText { Text = "Chat highlight words (space-seperated list)" },
chatHighlightWords = new TextBoxOption {
Height = 20,
RelativeSizeAxes = Axes.X,
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
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<string> bindable;

View File

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

View File

@ -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
/// </summary>
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);
}
}
}
}

View File

@ -186,7 +186,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;

View File

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