mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into skip-button
# Conflicts: # osu.Game/Graphics/UserInterface/BackButton.cs # osu.Game/Screens/Play/Player.cs # osu.Game/osu.Game.csproj
This commit is contained in:
@ -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();
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
|
||||
@ -15,17 +16,28 @@ 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)
|
||||
{
|
||||
return new Color4(
|
||||
Convert.ToByte(hex.Substring(0, 2), 16),
|
||||
Convert.ToByte(hex.Substring(2, 2), 16),
|
||||
Convert.ToByte(hex.Substring(4, 2), 16),
|
||||
255);
|
||||
switch (hex.Length)
|
||||
{
|
||||
default:
|
||||
throw new Exception(@"Invalid hex string length!");
|
||||
case 3:
|
||||
return new Color4(
|
||||
(byte)(Convert.ToByte(hex.Substring(0, 1), 16) * 17),
|
||||
(byte)(Convert.ToByte(hex.Substring(1, 1), 16) * 17),
|
||||
(byte)(Convert.ToByte(hex.Substring(2, 1), 16) * 17),
|
||||
255);
|
||||
case 6:
|
||||
return new Color4(
|
||||
Convert.ToByte(hex.Substring(0, 2), 16),
|
||||
Convert.ToByte(hex.Substring(2, 2), 16),
|
||||
Convert.ToByte(hex.Substring(4, 2), 16),
|
||||
255);
|
||||
}
|
||||
}
|
||||
|
||||
// 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");
|
||||
@ -56,6 +68,23 @@ namespace osu.Game.Graphics
|
||||
public Color4 GreenDark = FromHex(@"668800");
|
||||
public Color4 GreenDarker = FromHex(@"445500");
|
||||
|
||||
public Color4 Gray0 = FromHex(@"000");
|
||||
public Color4 Gray1 = FromHex(@"111");
|
||||
public Color4 Gray2 = FromHex(@"222");
|
||||
public Color4 Gray3 = FromHex(@"333");
|
||||
public Color4 Gray4 = FromHex(@"444");
|
||||
public Color4 Gray5 = FromHex(@"555");
|
||||
public Color4 Gray6 = FromHex(@"666");
|
||||
public Color4 Gray7 = FromHex(@"777");
|
||||
public Color4 Gray8 = FromHex(@"888");
|
||||
public Color4 Gray9 = FromHex(@"999");
|
||||
public Color4 GrayA = FromHex(@"aaa");
|
||||
public Color4 GrayB = FromHex(@"bbb");
|
||||
public Color4 GrayC = FromHex(@"ccc");
|
||||
public Color4 GrayD = FromHex(@"ddd");
|
||||
public Color4 GrayE = FromHex(@"eee");
|
||||
public Color4 GrayF = FromHex(@"fff");
|
||||
|
||||
public Color4 Red = FromHex(@"fc4549");
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
48
osu.Game/Graphics/UserInterface/OsuTextBox.cs
Normal file
48
osu.Game/Graphics/UserInterface/OsuTextBox.cs
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user