Merge remote-tracking branch 'refs/remotes/ppy/master' into profile-scores-update-new

This commit is contained in:
Andrei Zavatski
2020-01-27 12:37:44 +03:00
181 changed files with 2395 additions and 1204 deletions

View File

@ -76,12 +76,12 @@ namespace osu.Game.Graphics.Containers
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
if (closeOnMouseUp && !base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
Hide();
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
public virtual bool OnPressed(GlobalAction action)
@ -99,7 +99,9 @@ namespace osu.Game.Graphics.Containers
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
protected override void UpdateState(ValueChangedEvent<Visibility> state)
{

View File

@ -50,15 +50,15 @@ namespace osu.Game.Graphics.Containers
return base.OnMouseDown(e);
}
protected override bool OnDrag(DragEvent e)
protected override void OnDrag(DragEvent e)
{
if (rightMouseDragging)
{
scrollFromMouseEvent(e);
return true;
return;
}
return base.OnDrag(e);
base.OnDrag(e);
}
protected override bool OnDragStart(DragStartEvent e)
@ -72,15 +72,15 @@ namespace osu.Game.Graphics.Containers
return base.OnDragStart(e);
}
protected override bool OnDragEnd(DragEndEvent e)
protected override void OnDragEnd(DragEndEvent e)
{
if (rightMouseDragging)
{
rightMouseDragging = false;
return true;
return;
}
return base.OnDragEnd(e);
base.OnDragEnd(e);
}
protected override bool OnScroll(ScrollEvent e)
@ -162,13 +162,13 @@ namespace osu.Game.Graphics.Containers
return true;
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
if (e.Button != MouseButton.Left) return false;
if (e.Button != MouseButton.Left) return;
box.FadeColour(Color4.White, 100);
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
}
}

View File

@ -92,7 +92,7 @@ namespace osu.Game.Graphics.Cursor
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right))
{
@ -107,7 +107,7 @@ namespace osu.Game.Graphics.Cursor
dragRotationState = DragRotationState.NotDragging;
}
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
protected override void PopIn()

View File

@ -3,7 +3,6 @@
using System;
using osu.Game.Beatmaps;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Graphics
@ -36,6 +35,20 @@ namespace osu.Game.Graphics
Convert.ToByte(hex.Substring(2, 2), 16),
Convert.ToByte(hex.Substring(4, 2), 16),
255);
case 4:
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),
(byte)(Convert.ToByte(hex.Substring(3, 1), 16) * 17));
case 8:
return new Color4(
Convert.ToByte(hex.Substring(0, 2), 16),
Convert.ToByte(hex.Substring(2, 2), 16),
Convert.ToByte(hex.Substring(4, 2), 16),
Convert.ToByte(hex.Substring(6, 2), 16));
}
}
@ -64,46 +77,6 @@ namespace osu.Game.Graphics
}
}
public Color4 ForOverlayElement(OverlayColourScheme colourScheme, float saturation, float lightness, float opacity = 1) => Color4.FromHsl(new Vector4(getBaseHue(colourScheme), saturation, lightness, opacity));
// See https://github.com/ppy/osu-web/blob/4218c288292d7c810b619075471eaea8bbb8f9d8/app/helpers.php#L1463
private static float getBaseHue(OverlayColourScheme colourScheme)
{
float hue;
switch (colourScheme)
{
default:
throw new ArgumentException($@"{colourScheme} colour scheme does not provide a hue value in {nameof(getBaseHue)}.");
case OverlayColourScheme.Red:
hue = 0;
break;
case OverlayColourScheme.Pink:
hue = 333;
break;
case OverlayColourScheme.Orange:
hue = 46;
break;
case OverlayColourScheme.Green:
hue = 115;
break;
case OverlayColourScheme.Purple:
hue = 255;
break;
case OverlayColourScheme.Blue:
hue = 200;
break;
}
return hue / 360f;
}
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
public readonly Color4 PurpleLighter = FromHex(@"eeeeff");
public readonly Color4 PurpleLight = FromHex(@"aa88ff");
@ -206,14 +179,4 @@ namespace osu.Game.Graphics
public readonly Color4 ContextMenuGray = FromHex(@"223034");
}
public enum OverlayColourScheme
{
Red,
Pink,
Orange,
Green,
Purple,
Blue
}
}

View File

@ -67,7 +67,9 @@ namespace osu.Game.Graphics
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
private volatile int screenShotTasks;
@ -88,7 +90,7 @@ namespace osu.Game.Graphics
{
ScheduledDelegate waitDelegate = host.DrawThread.Scheduler.AddDelayed(() =>
{
if (framesWaited++ < frames_to_wait)
if (framesWaited++ >= frames_to_wait)
// ReSharper disable once AccessToDisposedClosure
framesWaitedEvent.Set();
}, 10, true);

View File

@ -67,7 +67,9 @@ namespace osu.Game.Graphics.UserInterface
return false;
}
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back;
public void OnReleased(GlobalAction action)
{
}
}
}
}

View File

@ -34,13 +34,13 @@ namespace osu.Game.Graphics.UserInterface
var tIndex = TabContainer.IndexOf(t);
var tabIndex = TabContainer.IndexOf(TabMap[index.NewValue]);
t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible;
t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint);
t.State = tIndex > tabIndex ? Visibility.Hidden : Visibility.Visible;
t.Chevron.FadeTo(tIndex >= tabIndex ? 0f : 1f, 500, Easing.OutQuint);
}
};
}
protected class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
public class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
{
protected virtual float ChevronSize => 10;

View File

@ -232,11 +232,11 @@ namespace osu.Game.Graphics.UserInterface
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
if (Selected.Value)
colourContainer.ResizeWidthTo(hover_width, click_duration, Easing.In);
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
protected override bool OnHover(HoverEvent e)

View File

@ -80,7 +80,9 @@ namespace osu.Game.Graphics.UserInterface
return false;
}
public bool OnReleased(GlobalAction action) => false;
public void OnReleased(GlobalAction action)
{
}
public override bool RequestsFocus => HoldFocus;
}

View File

@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface
/// <summary>
/// Length of debounce for hover sound playback, in milliseconds. Default is 50ms.
/// </summary>
public double HoverDebounceTime { get; set; } = 50;
public double HoverDebounceTime { get; } = 50;
protected readonly HoverSampleSet SampleSet;

View File

@ -107,10 +107,10 @@ namespace osu.Game.Graphics.UserInterface
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
Content.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
}
}

View File

@ -129,10 +129,10 @@ namespace osu.Game.Graphics.UserInterface
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
Content.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
protected virtual SpriteText CreateText() => new OsuSpriteText

View File

@ -128,10 +128,10 @@ namespace osu.Game.Graphics.UserInterface
return base.OnMouseDown(e);
}
protected override bool OnMouseUp(MouseUpEvent e)
protected override void OnMouseUp(MouseUpEvent e)
{
Nub.Current.Value = false;
return base.OnMouseUp(e);
base.OnMouseUp(e);
}
protected override void OnUserChange(T value)

View File

@ -10,7 +10,6 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@ -84,14 +83,6 @@ namespace osu.Game.Graphics.UserInterface
set => strip.Colour = value;
}
protected override TabFillFlowContainer CreateTabFlow() => new OsuTabFillFlowContainer
{
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.Both,
Depth = -1,
Masking = true
};
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
@ -283,10 +274,5 @@ namespace osu.Game.Graphics.UserInterface
}
}
}
private class OsuTabFillFlowContainer : TabFillFlowContainer
{
protected override int Compare(Drawable x, Drawable y) => CompareReverseChildID(x, y);
}
}
}

View File

@ -16,11 +16,7 @@ namespace osu.Game.Graphics.UserInterface
/// <summary>
/// How many leading zeroes the counter has.
/// </summary>
public uint LeadingZeroes
{
get;
protected set;
}
public uint LeadingZeroes { get; }
/// <summary>
/// Displays score.