1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 13:33:03 +08:00

Merge branch 'master' into fix-scroll-speeds

This commit is contained in:
Dean Herbert 2018-10-12 18:25:24 +09:00 committed by GitHub
commit e09e38148b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
178 changed files with 1172 additions and 1076 deletions

View File

@ -27,9 +27,6 @@ namespace osu.Desktop.Overlays
private NotificationOverlay notificationOverlay; private NotificationOverlay notificationOverlay;
private GameHost host; private GameHost host;
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host)
{ {

View File

@ -27,9 +27,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="System.IO.Packaging" Version="4.5.0" /> <PackageReference Include="System.IO.Packaging" Version="4.5.0" />
<PackageReference Include="ppy.squirrel.windows" Version="1.8.0.6" /> <PackageReference Include="ppy.squirrel.windows" Version="1.8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.3" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.4" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Resources"> <ItemGroup Label="Resources">
<EmbeddedResource Include="lazer.ico" /> <EmbeddedResource Include="lazer.ico" />

View File

@ -2,8 +2,8 @@
<Import Project="..\osu.TestProject.props" /> <Import Project="..\osu.TestProject.props" />
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Project"> <PropertyGroup Label="Project">

View File

@ -5,6 +5,7 @@ using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
@ -24,6 +25,8 @@ namespace osu.Game.Rulesets.Catch.UI
protected override bool UserScrollSpeedAdjustment => false; protected override bool UserScrollSpeedAdjustment => false;
protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Constant;
public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> getVisualRepresentation) public CatchPlayfield(BeatmapDifficulty difficulty, Func<CatchHitObject, DrawableHitObject<CatchHitObject>> getVisualRepresentation)
: base(BASE_WIDTH) : base(BASE_WIDTH)
{ {
@ -55,6 +58,8 @@ namespace osu.Game.Rulesets.Catch.UI
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
}); });
VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450);
} }
public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj); public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj);

View File

@ -3,7 +3,7 @@
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Project"> <PropertyGroup Label="Project">

View File

@ -30,10 +30,11 @@ namespace osu.Game.Rulesets.Mania.UI
if (Result.IsHit) if (Result.IsHit)
{ {
this.ScaleTo(0.8f); JudgementBody.ScaleTo(0.8f);
this.ScaleTo(1, 250, Easing.OutElastic); JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250); JudgementBody.Delay(50).ScaleTo(0.75f, 250);
this.Delay(50).FadeOut(200);
} }
Expire(); Expire();

View File

@ -3,7 +3,7 @@
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Project"> <PropertyGroup Label="Project">

View File

@ -10,6 +10,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
{ {
public class OsuBeatmapProcessor : BeatmapProcessor public class OsuBeatmapProcessor : BeatmapProcessor
{ {
private const int stack_distance = 3;
public OsuBeatmapProcessor(IBeatmap beatmap) public OsuBeatmapProcessor(IBeatmap beatmap)
: base(beatmap) : base(beatmap)
{ {
@ -18,17 +20,21 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
public override void PostProcess() public override void PostProcess()
{ {
base.PostProcess(); base.PostProcess();
applyStacking((Beatmap<OsuHitObject>)Beatmap);
var osuBeatmap = (Beatmap<OsuHitObject>)Beatmap;
// Reset stacking
foreach (var h in osuBeatmap.HitObjects)
h.StackHeight = 0;
if (Beatmap.BeatmapInfo.BeatmapVersion >= 6)
applyStacking(osuBeatmap);
else
applyStackingOld(osuBeatmap);
} }
private void applyStacking(Beatmap<OsuHitObject> beatmap) private void applyStacking(Beatmap<OsuHitObject> beatmap)
{ {
const int stack_distance = 3;
// Reset stacking
for (int i = 0; i <= beatmap.HitObjects.Count - 1; i++)
beatmap.HitObjects[i].StackHeight = 0;
// Extend the end index to include objects they are stacked on // Extend the end index to include objects they are stacked on
int extendedEndIndex = beatmap.HitObjects.Count - 1; int extendedEndIndex = beatmap.HitObjects.Count - 1;
for (int i = beatmap.HitObjects.Count - 1; i >= 0; i--) for (int i = beatmap.HitObjects.Count - 1; i >= 0; i--)
@ -167,5 +173,40 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
} }
} }
} }
private void applyStackingOld(Beatmap<OsuHitObject> beatmap)
{
for (int i = 0; i < beatmap.HitObjects.Count; i++)
{
OsuHitObject currHitObject = beatmap.HitObjects[i];
if (currHitObject.StackHeight != 0 && !(currHitObject is Slider))
continue;
double startTime = (currHitObject as IHasEndTime)?.EndTime ?? currHitObject.StartTime;
int sliderStack = 0;
for (int j = i + 1; j < beatmap.HitObjects.Count; j++)
{
double stackThreshold = beatmap.HitObjects[i].TimePreempt * beatmap.BeatmapInfo.StackLeniency;
if (beatmap.HitObjects[j].StartTime - stackThreshold > startTime)
break;
if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.Position) < stack_distance)
{
currHitObject.StackHeight++;
startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime;
}
else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.EndPosition) < stack_distance)
{
//Case for sliders - bump notes down and right, rather than up and left.
sliderStack++;
beatmap.HitObjects[j].StackHeight -= sliderStack;
startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime;
}
}
}
}
} }
} }

View File

@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
double sectionLength = section_length * timeRate; double sectionLength = section_length * timeRate;
// The first object doesn't generate a strain, so we begin with an incremented section end // The first object doesn't generate a strain, so we begin with an incremented section end
double currentSectionEnd = 2 * sectionLength; double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength;
foreach (OsuDifficultyHitObject h in difficultyBeatmap) foreach (OsuDifficultyHitObject h in difficultyBeatmap)
{ {

View File

@ -3,6 +3,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
@ -23,8 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
{ {
// Sort OsuHitObjects by StartTime - they are not correctly ordered in some cases. // Sort OsuHitObjects by StartTime - they are not correctly ordered in some cases.
// This should probably happen before the objects reach the difficulty calculator. // This should probably happen before the objects reach the difficulty calculator.
objects.Sort((a, b) => a.StartTime.CompareTo(b.StartTime)); difficultyObjects = createDifficultyObjectEnumerator(objects.OrderBy(h => h.StartTime).ToList(), timeRate);
difficultyObjects = createDifficultyObjectEnumerator(objects, timeRate);
} }
/// <summary> /// <summary>

View File

@ -21,15 +21,25 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
public OsuHitObject BaseObject { get; } public OsuHitObject BaseObject { get; }
/// <summary> /// <summary>
/// Normalized distance from the <see cref="OsuHitObject.StackedPosition"/> of the previous <see cref="OsuDifficultyHitObject"/>. /// Normalized distance from the end position of the previous <see cref="OsuDifficultyHitObject"/> to the start position of this <see cref="OsuDifficultyHitObject"/>.
/// </summary> /// </summary>
public double Distance { get; private set; } public double JumpDistance { get; private set; }
/// <summary>
/// Normalized distance between the start and end position of the previous <see cref="OsuDifficultyHitObject"/>.
/// </summary>
public double TravelDistance { get; private set; }
/// <summary> /// <summary>
/// Milliseconds elapsed since the StartTime of the previous <see cref="OsuDifficultyHitObject"/>. /// Milliseconds elapsed since the StartTime of the previous <see cref="OsuDifficultyHitObject"/>.
/// </summary> /// </summary>
public double DeltaTime { get; private set; } public double DeltaTime { get; private set; }
/// <summary>
/// Milliseconds elapsed since the start time of the previous <see cref="OsuDifficultyHitObject"/>, with a minimum of 50ms.
/// </summary>
public double StrainTime { get; private set; }
private readonly OsuHitObject lastObject; private readonly OsuHitObject lastObject;
private readonly double timeRate; private readonly double timeRate;
@ -51,31 +61,37 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
private void setDistances() private void setDistances()
{ {
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps. // We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
double scalingFactor = normalized_radius / BaseObject.Radius; float scalingFactor = normalized_radius / (float)BaseObject.Radius;
if (BaseObject.Radius < 30) if (BaseObject.Radius < 30)
{ {
double smallCircleBonus = Math.Min(30 - BaseObject.Radius, 5) / 50; float smallCircleBonus = Math.Min(30 - (float)BaseObject.Radius, 5) / 50;
scalingFactor *= 1 + smallCircleBonus; scalingFactor *= 1 + smallCircleBonus;
} }
Vector2 lastCursorPosition = lastObject.StackedPosition; Vector2 lastCursorPosition = lastObject.StackedPosition;
float lastTravelDistance = 0;
var lastSlider = lastObject as Slider; var lastSlider = lastObject as Slider;
if (lastSlider != null) if (lastSlider != null)
{ {
computeSliderCursorPosition(lastSlider); computeSliderCursorPosition(lastSlider);
lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition; lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition;
lastTravelDistance = lastSlider.LazyTravelDistance;
} }
Distance = (lastTravelDistance + (BaseObject.StackedPosition - lastCursorPosition).Length) * scalingFactor; // Don't need to jump to reach spinners
if (!(BaseObject is Spinner))
JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length;
// Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also a slider!
if (BaseObject is Slider)
TravelDistance = (lastSlider?.LazyTravelDistance ?? 0) * scalingFactor;
} }
private void setTimingValues() private void setTimingValues()
{ {
// Every timing inverval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure. DeltaTime = (BaseObject.StartTime - lastObject.StartTime) / timeRate;
DeltaTime = Math.Max(50, (BaseObject.StartTime - lastObject.StartTime) / timeRate);
// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
StrainTime = Math.Max(50, DeltaTime);
} }
private void computeSliderCursorPosition(Slider slider) private void computeSliderCursorPosition(Slider slider)
@ -87,8 +103,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
float approxFollowCircleRadius = (float)(slider.Radius * 3); float approxFollowCircleRadius = (float)(slider.Radius * 3);
var computeVertex = new Action<double>(t => var computeVertex = new Action<double>(t =>
{ {
double progress = ((int)t - (int)slider.StartTime) / (float)(int)slider.SpanDuration;
if (progress % 2 > 1)
progress = 1 - progress % 1;
else
progress = progress % 1;
// ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version)
var diff = slider.StackedPositionAt(t) - slider.LazyEndPosition.Value; var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value;
float dist = diff.Length; float dist = diff.Length;
if (dist > approxFollowCircleRadius) if (dist > approxFollowCircleRadius)

View File

@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
protected override double SkillMultiplier => 26.25; protected override double SkillMultiplier => 26.25;
protected override double StrainDecayBase => 0.15; protected override double StrainDecayBase => 0.15;
protected override double StrainValueOf(OsuDifficultyHitObject current) => Math.Pow(current.Distance, 0.99) / current.DeltaTime; protected override double StrainValueOf(OsuDifficultyHitObject current)
=> (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.StrainTime;
} }
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
protected override double StrainValueOf(OsuDifficultyHitObject current) protected override double StrainValueOf(OsuDifficultyHitObject current)
{ {
double distance = current.Distance; double distance = current.TravelDistance + current.JumpDistance;
double speedValue; double speedValue;
if (distance > single_spacing_threshold) if (distance > single_spacing_threshold)
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
else else
speedValue = 0.95; speedValue = 0.95;
return speedValue / current.DeltaTime; return speedValue / current.StrainTime;
} }
} }
} }

View File

@ -37,6 +37,11 @@ namespace osu.Game.Rulesets.Osu.Mods
var osuObject = (OsuHitObject)drawable.HitObject; var osuObject = (OsuHitObject)drawable.HitObject;
Vector2 origin = drawable.Position; Vector2 origin = drawable.Position;
// Wiggle the repeat points with the slider instead of independently.
// Also fixes an issue with repeat points being positioned incorrectly.
if (osuObject is RepeatPoint)
return;
Random objRand = new Random((int)osuObject.StartTime); Random objRand = new Random((int)osuObject.StartTime);
// Wiggle all objects during TimePreempt // Wiggle all objects during TimePreempt

View File

@ -12,6 +12,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
public class CirclePiece : Container, IKeyBindingHandler<OsuAction> public class CirclePiece : Container, IKeyBindingHandler<OsuAction>
{ {
// IsHovered is used
public override bool HandlePositionalInput => true;
public Func<bool> Hit; public Func<bool> Hit;
public CirclePiece() public CirclePiece()

View File

@ -5,11 +5,11 @@ using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Skinning; using osu.Game.Skinning;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
@ -102,24 +102,24 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}; };
} }
private InputState lastState; private Vector2? lastScreenSpaceMousePosition;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
lastState = state; lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
lastState = state; lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
lastState = state; lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition;
return base.OnMouseMove(state); return base.OnMouseMove(e);
} }
public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null)
@ -155,8 +155,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
// Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position.
Tracking = canCurrentlyTrack Tracking = canCurrentlyTrack
&& lastState != null && lastScreenSpaceMousePosition.HasValue
&& ReceivePositionalInputAt(lastState.Mouse.NativeState.Position) && ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value)
&& (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
} }
} }

View File

@ -8,26 +8,23 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Lines; using osu.Framework.Graphics.Lines;
using osu.Framework.Graphics.Textures;
using OpenTK.Graphics.ES30; using OpenTK.Graphics.ES30;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using OpenTK; using OpenTK;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
public class SliderBody : Container, ISliderProgress public class SliderBody : Container, ISliderProgress
{ {
private readonly Path path; private readonly SliderPath path;
private readonly BufferedContainer container; private readonly BufferedContainer container;
public float PathWidth public float PathWidth
{ {
get { return path.PathWidth; } get => path.PathWidth;
set { path.PathWidth = value; } set => path.PathWidth = value;
} }
/// <summary> /// <summary>
@ -43,48 +40,40 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
public double? SnakedStart { get; private set; } public double? SnakedStart { get; private set; }
public double? SnakedEnd { get; private set; } public double? SnakedEnd { get; private set; }
private Color4 accentColour = Color4.White;
/// <summary> /// <summary>
/// Used to colour the path. /// Used to colour the path.
/// </summary> /// </summary>
public Color4 AccentColour public Color4 AccentColour
{ {
get { return accentColour; } get => path.AccentColour;
set set
{ {
if (accentColour == value) if (path.AccentColour == value)
return; return;
accentColour = value; path.AccentColour = value;
if (LoadState >= LoadState.Ready) container.ForceRedraw();
reloadTexture();
} }
} }
private Color4 borderColour = Color4.White;
/// <summary> /// <summary>
/// Used to colour the path border. /// Used to colour the path border.
/// </summary> /// </summary>
public new Color4 BorderColour public new Color4 BorderColour
{ {
get { return borderColour; } get => path.BorderColour;
set set
{ {
if (borderColour == value) if (path.BorderColour == value)
return; return;
borderColour = value; path.BorderColour = value;
if (LoadState >= LoadState.Ready) container.ForceRedraw();
reloadTexture();
} }
} }
public Quad PathDrawQuad => container.ScreenSpaceDrawQuad; public Quad PathDrawQuad => container.ScreenSpaceDrawQuad;
private int textureWidth => (int)PathWidth * 2;
private Vector2 topLeftOffset; private Vector2 topLeftOffset;
private readonly Slider slider; private readonly Slider slider;
@ -101,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
CacheDrawnFrameBuffer = true, CacheDrawnFrameBuffer = true,
Children = new Drawable[] Children = new Drawable[]
{ {
path = new Path path = new SliderPath
{ {
Blending = BlendingMode.None, Blending = BlendingMode.None,
}, },
@ -134,46 +123,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
reloadTexture();
computeSize(); computeSize();
} }
private void reloadTexture()
{
var texture = new Texture(textureWidth, 1);
//initialise background
var raw = new Image<Rgba32>(textureWidth, 1);
const float aa_portion = 0.02f;
const float border_portion = 0.128f;
const float gradient_portion = 1 - border_portion;
const float opacity_at_centre = 0.3f;
const float opacity_at_edge = 0.8f;
for (int i = 0; i < textureWidth; i++)
{
float progress = (float)i / (textureWidth - 1);
if (progress <= border_portion)
{
raw[i, 0] = new Rgba32(BorderColour.R, BorderColour.G, BorderColour.B, Math.Min(progress / aa_portion, 1) * BorderColour.A);
}
else
{
progress -= border_portion;
raw[i, 0] = new Rgba32(AccentColour.R, AccentColour.G, AccentColour.B,
(opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * AccentColour.A);
}
}
texture.SetData(new TextureUpload(raw));
path.Texture = texture;
container.ForceRedraw();
}
private void computeSize() private void computeSize()
{ {
// Generate the entire curve // Generate the entire curve
@ -226,5 +178,53 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
SetRange(start, end); SetRange(start, end);
} }
private class SliderPath : SmoothPath
{
private const float border_portion = 0.128f;
private const float gradient_portion = 1 - border_portion;
private const float opacity_at_centre = 0.3f;
private const float opacity_at_edge = 0.8f;
private Color4 borderColour = Color4.White;
public Color4 BorderColour
{
get => borderColour;
set
{
if (borderColour == value)
return;
borderColour = value;
InvalidateTexture();
}
}
private Color4 accentColour = Color4.White;
public Color4 AccentColour
{
get => accentColour;
set
{
if (accentColour == value)
return;
accentColour = value;
InvalidateTexture();
}
}
protected override Color4 ColourAt(float position)
{
if (position <= border_portion)
return BorderColour;
position -= border_portion;
return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A);
}
}
} }
} }

View File

@ -11,9 +11,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
public class SpinnerBackground : CircularContainer, IHasAccentColour public class SpinnerBackground : CircularContainer, IHasAccentColour
{ {
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;
protected Box Disc; protected Box Disc;
public Color4 AccentColour public Color4 AccentColour

View File

@ -4,7 +4,7 @@
using System; using System;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -68,10 +68,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
} }
} }
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
mousePosition = Parent.ToLocalSpace(state.Mouse.NativeState.Position); mousePosition = Parent.ToLocalSpace(e.ScreenSpaceMousePosition);
return base.OnMouseMove(state); return base.OnMouseMove(e);
} }
private Vector2 mousePosition; private Vector2 mousePosition;

View File

@ -4,8 +4,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu namespace osu.Game.Rulesets.Osu
@ -36,22 +35,20 @@ namespace osu.Game.Rulesets.Osu
{ {
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => AllowUserPresses && base.OnKeyDown(state, args); protected override bool Handle(UIEvent e)
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => AllowUserPresses && base.OnKeyUp(state, args); {
protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(state, args); if (!AllowUserPresses) return false;
protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(state, args); return base.Handle(e);
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => AllowUserPresses && base.OnMouseDown(state, args); }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => AllowUserPresses && base.OnMouseUp(state, args);
protected override bool OnScroll(InputState state) => AllowUserPresses && base.OnScroll(state);
} }
} }
public enum OsuAction public enum OsuAction
{ {
[Description("Left Button")] [Description("Left button")]
LeftButton, LeftButton,
[Description("Right Button")] [Description("Right button")]
RightButton RightButton
} }
} }

View File

@ -12,7 +12,7 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Shaders;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.Timing; using osu.Framework.Timing;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -117,15 +117,15 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
timeOffset = Time.Current; timeOffset = Time.Current;
} }
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
Vector2 pos = state.Mouse.NativeState.Position; Vector2 pos = e.ScreenSpaceMousePosition;
if (lastPosition == null) if (lastPosition == null)
{ {
lastPosition = pos; lastPosition = pos;
resampler.AddPosition(lastPosition.Value); resampler.AddPosition(lastPosition.Value);
return base.OnMouseMove(state); return base.OnMouseMove(e);
} }
foreach (Vector2 pos2 in resampler.AddPosition(pos)) foreach (Vector2 pos2 in resampler.AddPosition(pos))
@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
} }
} }
return base.OnMouseMove(state); return base.OnMouseMove(e);
} }
private void addPosition(Vector2 pos) private void addPosition(Vector2 pos)

View File

@ -3,7 +3,7 @@
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Project"> <PropertyGroup Label="Project">

View File

@ -17,13 +17,13 @@ namespace osu.Game.Rulesets.Taiko
public enum TaikoAction public enum TaikoAction
{ {
[Description("Left (Rim)")] [Description("Left (rim)")]
LeftRim, LeftRim,
[Description("Left (Centre)")] [Description("Left (centre)")]
LeftCentre, LeftCentre,
[Description("Right (Centre)")] [Description("Right (centre)")]
RightCentre, RightCentre,
[Description("Right (Rim)")] [Description("Right (rim)")]
RightRim RightRim
} }
} }

View File

@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Taiko.UI
switch (Result.Type) switch (Result.Type)
{ {
case HitResult.Good: case HitResult.Good:
Colour = colours.GreenLight; JudgementBody.Colour = colours.GreenLight;
break; break;
case HitResult.Great: case HitResult.Great:
Colour = colours.BlueLight; JudgementBody.Colour = colours.BlueLight;
break; break;
} }
} }

View File

@ -1,23 +1,24 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Taiko.Objects;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Extensions.Color4Extensions;
using System.Linq; using System.Linq;
using osu.Game.Rulesets.Judgements; using osu.Framework.Allocation;
using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI
{ {
@ -40,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.UI
protected override bool UserScrollSpeedAdjustment => false; protected override bool UserScrollSpeedAdjustment => false;
protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Overlapping;
private readonly Container<HitExplosion> hitExplosionContainer; private readonly Container<HitExplosion> hitExplosionContainer;
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer; private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;
private readonly JudgementContainer<DrawableTaikoJudgement> judgementContainer; private readonly JudgementContainer<DrawableTaikoJudgement> judgementContainer;

View File

@ -165,7 +165,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
} }
[Test] [Test]
public void TestDecodeBeatmapColors() public void TestDecodeBeatmapColours()
{ {
var decoder = new LegacySkinDecoder(); var decoder = new LegacySkinDecoder();
using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
@ -181,6 +181,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
new Color4(128, 255, 128, 255), new Color4(128, 255, 128, 255),
new Color4(255, 187, 255, 255), new Color4(255, 187, 255, 255),
new Color4(255, 177, 140, 255), new Color4(255, 177, 140, 255),
new Color4(100, 100, 100, 100),
}; };
Assert.AreEqual(expectedColors.Length, comboColors.Count); Assert.AreEqual(expectedColors.Length, comboColors.Count);
for (int i = 0; i < expectedColors.Length; i++) for (int i = 0; i < expectedColors.Length; i++)

View File

@ -101,6 +101,7 @@ Combo3 : 128,255,255
Combo4 : 128,255,128 Combo4 : 128,255,128
Combo5 : 255,187,255 Combo5 : 255,187,255
Combo6 : 255,177,140 Combo6 : 255,177,140
Combo7 : 100,100,100,100
[HitObjects] [HitObjects]
192,168,956,6,0,P|184:128|200:80,1,90,4|0,1:2|0:0,0:0:0:0: 192,168,956,6,0,P|184:128|200:80,1,90,4|0,1:2|0:0,0:0:0:0:

View File

@ -7,7 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -184,7 +184,7 @@ namespace osu.Game.Tests.Visual
/// </summary> /// </summary>
/// <param name="cursorContainer">The cursor to check.</param> /// <param name="cursorContainer">The cursor to check.</param>
private bool checkAtMouse(CursorContainer cursorContainer) private bool checkAtMouse(CursorContainer cursorContainer)
=> Precision.AlmostEquals(InputManager.CurrentState.Mouse.NativeState.Position, cursorContainer.ToScreenSpace(cursorContainer.ActiveCursor.DrawPosition)); => Precision.AlmostEquals(InputManager.CurrentState.Mouse.Position, cursorContainer.ToScreenSpace(cursorContainer.ActiveCursor.DrawPosition));
private class CustomCursorBox : Container, IProvideCursor private class CustomCursorBox : Container, IProvideCursor
{ {
@ -224,16 +224,16 @@ namespace osu.Game.Tests.Visual
}; };
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
background.FadeTo(0.4f, 250, Easing.OutQuint); background.FadeTo(0.4f, 250, Easing.OutQuint);
return false; return false;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
background.FadeTo(0.1f, 250); background.FadeTo(0.1f, 250);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }

View File

@ -3,7 +3,7 @@
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" /> <PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="NUnit" Version="3.10.1" /> <PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Project"> <PropertyGroup Label="Project">

View File

@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps.ControlPoints
/// <summary> /// <summary>
/// The beat length at this control point. /// The beat length at this control point.
/// </summary> /// </summary>
public double BeatLength public virtual double BeatLength
{ {
get => beatLength; get => beatLength;
set => beatLength = MathHelper.Clamp(value, 6, 60000); set => beatLength = MathHelper.Clamp(value, 6, 60000);

View File

@ -318,12 +318,12 @@ namespace osu.Game.Beatmaps.Formats
if (timingChange) if (timingChange)
{ {
handleTimingControlPoint(new TimingControlPoint var controlPoint = CreateTimingControlPoint();
{ controlPoint.Time = time;
Time = time, controlPoint.BeatLength = beatLength;
BeatLength = beatLength, controlPoint.TimeSignature = timeSignature;
TimeSignature = timeSignature
}); handleTimingControlPoint(controlPoint);
} }
handleDifficultyControlPoint(new DifficultyControlPoint handleDifficultyControlPoint(new DifficultyControlPoint
@ -418,6 +418,8 @@ namespace osu.Game.Beatmaps.Formats
private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0); private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0);
protected virtual TimingControlPoint CreateTimingControlPoint() => new TimingControlPoint();
[Flags] [Flags]
internal enum EffectFlags internal enum EffectFlags
{ {

View File

@ -85,13 +85,19 @@ namespace osu.Game.Beatmaps.Formats
string[] split = pair.Value.Split(','); string[] split = pair.Value.Split(',');
if (split.Length != 3) if (split.Length != 3 && split.Length != 4)
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}");
if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) Color4 colour;
try
{
colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : (byte)255);
}
catch (Exception e)
{
throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); throw new InvalidOperationException(@"Color must be specified with 8-bit integer components");
}
Color4 colour = new Color4(r, g, b, 255);
if (isCombo) if (isCombo)
{ {

View File

@ -0,0 +1,37 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Beatmaps.Formats
{
/// <summary>
/// A <see cref="LegacyBeatmapDecoder"/> built for difficulty calculation of legacy <see cref="Beatmap"/>s
/// <remarks>
/// To use this, the decoder must be registered by the application through <see cref="LegacyDifficultyCalculatorBeatmapDecoder.Register"/>.
/// Doing so will override any existing <see cref="Beatmap"/> decoders.
/// </remarks>
/// </summary>
public class LegacyDifficultyCalculatorBeatmapDecoder : LegacyBeatmapDecoder
{
public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION)
: base(version)
{
ApplyOffsets = false;
}
public new static void Register()
{
AddDecoder<Beatmap>(@"osu file format v", m => new LegacyDifficultyCalculatorBeatmapDecoder(int.Parse(m.Split('v').Last())));
}
protected override TimingControlPoint CreateTimingControlPoint()
=> new LegacyDifficultyCalculatorControlPoint();
private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint
{
public override double BeatLength { get; set; } = 1000;
}
}
}

View File

@ -83,8 +83,6 @@ namespace osu.Game.Configuration
Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised); Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised);
Set(OsuSetting.SpeedChangeVisualisation, SpeedChangeVisualisationMethod.Sequential);
Set(OsuSetting.IncreaseFirstObjectVisibility, true); Set(OsuSetting.IncreaseFirstObjectVisibility, true);
// Update // Update
@ -143,7 +141,6 @@ namespace osu.Game.Configuration
ChatDisplayHeight, ChatDisplayHeight,
Version, Version,
ShowConvertedBeatmaps, ShowConvertedBeatmaps,
SpeedChangeVisualisation,
Skin, Skin,
ScreenshotFormat, ScreenshotFormat,
ScreenshotCaptureMenuCursor, ScreenshotCaptureMenuCursor,

View File

@ -10,6 +10,8 @@ namespace osu.Game.Configuration
[Description("Sequential")] [Description("Sequential")]
Sequential, Sequential,
[Description("Overlapping")] [Description("Overlapping")]
Overlapping Overlapping,
[Description("Constant")]
Constant
} }
} }

View File

@ -30,10 +30,6 @@ namespace osu.Game.Graphics.Backgrounds
/// </summary> /// </summary>
private const float edge_smoothness = 1; private const float edge_smoothness = 1;
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;
public Color4 ColourLight = Color4.White; public Color4 ColourLight = Color4.White;
public Color4 ColourDark = Color4.Black; public Color4 ColourDark = Color4.Black;

View File

@ -20,8 +20,6 @@ namespace osu.Game.Graphics.Containers
{ {
} }
public override bool HandlePositionalInput => true;
private OsuGame game; private OsuGame game;
private Action showNotImplementedError; private Action showNotImplementedError;

View File

@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers;
using OpenTK; using OpenTK;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -59,15 +59,15 @@ namespace osu.Game.Graphics.Containers
// receive input outside our bounds so we can trigger a close event on ourselves. // receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos);
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
{ {
State = Visibility.Hidden; State = Visibility.Hidden;
return true; return true;
} }
return base.OnClick(state); return base.OnClick(e);
} }
public virtual bool OnPressed(GlobalAction action) public virtual bool OnPressed(GlobalAction action)

View File

@ -6,7 +6,7 @@ using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
{ {
@ -18,16 +18,16 @@ namespace osu.Game.Graphics.Containers
protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content }; protected virtual IEnumerable<Drawable> EffectTargets => new[] { Content };
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
EffectTargets.ForEach(d => d.FadeColour(HoverColour, 500, Easing.OutQuint)); EffectTargets.ForEach(d => d.FadeColour(HoverColour, 500, Easing.OutQuint));
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
EffectTargets.ForEach(d => d.FadeColour(IdleColour, 500, Easing.OutQuint)); EffectTargets.ForEach(d => d.FadeColour(IdleColour, 500, Easing.OutQuint));
base.OnHoverLost(state); base.OnHoverLost(e);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -2,8 +2,7 @@
// 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 osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using OpenTK.Input; using OpenTK.Input;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
@ -21,7 +20,7 @@ namespace osu.Game.Graphics.Containers
/// </summary> /// </summary>
public double DistanceDecayOnRightMouseScrollbar = 0.02; public double DistanceDecayOnRightMouseScrollbar = 0.02;
private bool shouldPerformRightMouseScroll(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right); private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right;
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar); private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
@ -29,40 +28,40 @@ namespace osu.Game.Graphics.Containers
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging; protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
if (shouldPerformRightMouseScroll(state)) if (shouldPerformRightMouseScroll(e))
{ {
scrollToRelative(state.Mouse.Position[ScrollDim]); scrollToRelative(e.MousePosition[ScrollDim]);
return true; return true;
} }
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnDrag(InputState state) protected override bool OnDrag(DragEvent e)
{ {
if (mouseScrollBarDragging) if (mouseScrollBarDragging)
{ {
scrollToRelative(state.Mouse.Position[ScrollDim]); scrollToRelative(e.MousePosition[ScrollDim]);
return true; return true;
} }
return base.OnDrag(state); return base.OnDrag(e);
} }
protected override bool OnDragStart(InputState state) protected override bool OnDragStart(DragStartEvent e)
{ {
if (shouldPerformRightMouseScroll(state)) if (shouldPerformRightMouseScroll(e))
{ {
mouseScrollBarDragging = true; mouseScrollBarDragging = true;
return true; return true;
} }
return base.OnDragStart(state); return base.OnDragStart(e);
} }
protected override bool OnDragEnd(InputState state) protected override bool OnDragEnd(DragEndEvent e)
{ {
if (mouseScrollBarDragging) if (mouseScrollBarDragging)
{ {
@ -70,7 +69,7 @@ namespace osu.Game.Graphics.Containers
return true; return true;
} }
return base.OnDragEnd(state); return base.OnDragEnd(e);
} }
} }
} }

View File

@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers
if (parallaxEnabled) if (parallaxEnabled)
{ {
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount; Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount;
double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000); double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000);

View File

@ -12,8 +12,7 @@ using osu.Game.Configuration;
using System; using System;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using OpenTK.Input; using OpenTK.Input;
namespace osu.Game.Graphics.Cursor namespace osu.Game.Graphics.Cursor
@ -40,11 +39,11 @@ namespace osu.Game.Graphics.Cursor
screenshotCursorVisibility.BindTo(screenshotManager.CursorVisibility); screenshotCursorVisibility.BindTo(screenshotManager.CursorVisibility);
} }
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
if (dragRotationState != DragRotationState.NotDragging) if (dragRotationState != DragRotationState.NotDragging)
{ {
var position = state.Mouse.Position; var position = e.MousePosition;
var distance = Vector2Extensions.Distance(position, positionMouseDown); var distance = Vector2Extensions.Distance(position, positionMouseDown);
// don't start rotating until we're moved a minimum distance away from the mouse down location, // don't start rotating until we're moved a minimum distance away from the mouse down location,
// else it can have an annoying effect. // else it can have an annoying effect.
@ -53,7 +52,7 @@ namespace osu.Game.Graphics.Cursor
// don't rotate when distance is zero to avoid NaN // don't rotate when distance is zero to avoid NaN
if (dragRotationState == DragRotationState.Rotating && distance > 0) if (dragRotationState == DragRotationState.Rotating && distance > 0)
{ {
Vector2 offset = state.Mouse.Position - positionMouseDown; Vector2 offset = e.MousePosition - positionMouseDown;
float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f;
// Always rotate in the direction of least distance // Always rotate in the direction of least distance
@ -66,13 +65,13 @@ namespace osu.Game.Graphics.Cursor
} }
} }
return base.OnMouseMove(state); return base.OnMouseMove(e);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
// only trigger animation for main mouse buttons // only trigger animation for main mouse buttons
if (args.Button <= MouseButton.Right) if (e.Button <= MouseButton.Right)
{ {
activeCursor.Scale = new Vector2(1); activeCursor.Scale = new Vector2(1);
activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint); activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint);
@ -81,29 +80,29 @@ namespace osu.Game.Graphics.Cursor
activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint);
} }
if (args.Button == MouseButton.Left && cursorRotate) if (e.Button == MouseButton.Left && cursorRotate)
{ {
dragRotationState = DragRotationState.DragStarted; dragRotationState = DragRotationState.DragStarted;
positionMouseDown = state.Mouse.Position; positionMouseDown = e.MousePosition;
} }
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
if (!state.Mouse.HasMainButtonPressed) if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right))
{ {
activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint);
activeCursor.ScaleTo(1, 500, Easing.OutElastic); activeCursor.ScaleTo(1, 500, Easing.OutElastic);
} }
if (args.Button == MouseButton.Left) if (e.Button == MouseButton.Left)
{ {
if (dragRotationState == DragRotationState.Rotating) if (dragRotationState == DragRotationState.Rotating)
activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf);
dragRotationState = DragRotationState.NotDragging; dragRotationState = DragRotationState.NotDragging;
} }
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
protected override void PopIn() protected override void PopIn()

View File

@ -54,8 +54,6 @@ namespace osu.Game.Graphics
Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate);
} }
public override bool HandlePositionalInput => true;
protected virtual string Format() => Date.Humanize(); protected virtual string Format() => Date.Humanize();
private void updateTime() => Text = Format(); private void updateTime() => Text = Format();

View File

@ -13,7 +13,7 @@ using osu.Game.Graphics.Sprites;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -213,7 +213,7 @@ namespace osu.Game.Graphics.UserInterface
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos);
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, Easing.In); colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, Easing.In);
flash(); flash();
@ -225,20 +225,20 @@ namespace osu.Game.Graphics.UserInterface
glowContainer.FadeOut(); glowContainer.FadeOut();
}); });
return base.OnClick(state); return base.OnClick(e);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
base.OnHover(state); base.OnHover(e);
Selected.Value = true; Selected.Value = true;
return true; return true;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
base.OnHoverLost(state); base.OnHoverLost(e);
Selected.Value = false; Selected.Value = false;
} }

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.Platform; using osu.Framework.Platform;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -37,19 +37,19 @@ namespace osu.Game.Graphics.UserInterface
this.host = host; this.host = host;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint); InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint); InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
if(Link != null) if(Link != null)
host.OpenUrlExternally(Link); host.OpenUrlExternally(Link);

View File

@ -3,8 +3,7 @@
using OpenTK.Graphics; using OpenTK.Graphics;
using System; using System;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using OpenTK.Input; using OpenTK.Input;
@ -36,20 +35,20 @@ namespace osu.Game.Graphics.UserInterface
// We may not be focused yet, but we need to handle keyboard input to be able to request focus // We may not be focused yet, but we need to handle keyboard input to be able to request focus
public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput;
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
base.OnFocus(state); base.OnFocus(e);
BorderThickness = 0; BorderThickness = 0;
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (!HasFocus) return false; if (!HasFocus) return false;
if (args.Key == Key.Escape) if (e.Key == Key.Escape)
return false; // disable the framework-level handling of escape key for confority (we use GlobalAction.Back). return false; // disable the framework-level handling of escape key for confority (we use GlobalAction.Back).
return base.OnKeyDown(state, args); return base.OnKeyDown(e);
} }
public override bool OnPressed(GlobalAction action) public override bool OnPressed(GlobalAction action)

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -21,10 +21,10 @@ namespace osu.Game.Graphics.UserInterface
{ {
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
sampleClick?.Play(); sampleClick?.Play();
return base.OnClick(state); return base.OnClick(e);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -8,7 +8,7 @@ using osu.Framework.Audio.Sample;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -28,10 +28,10 @@ namespace osu.Game.Graphics.UserInterface
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
sampleHover?.Play(); sampleHover?.Play();
return base.OnHover(state); return base.OnHover(e);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -4,7 +4,7 @@
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -84,16 +84,16 @@ namespace osu.Game.Graphics.UserInterface
}); });
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
icon.FadeColour(IconHoverColour, 500, Easing.OutQuint); icon.FadeColour(IconHoverColour, 500, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
icon.FadeColour(IconColour, 500, Easing.OutQuint); icon.FadeColour(IconColour, 500, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }
} }

View File

@ -69,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
Masking = true, Masking = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = path = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 } Child = path = new SmoothPath { RelativeSizeAxes = Axes.Both, PathWidth = 1 }
}); });
} }

View File

@ -6,8 +6,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -77,34 +76,34 @@ namespace osu.Game.Graphics.UserInterface
Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
hover.FadeIn(500, Easing.OutQuint); hover.FadeIn(500, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
hover.FadeOut(500, Easing.OutQuint); hover.FadeOut(500, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
hover.FlashColour(FlashColour, 800, Easing.OutQuint); hover.FlashColour(FlashColour, 800, Easing.OutQuint);
return base.OnClick(state); return base.OnClick(e);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
Content.ScaleTo(0.75f, 2000, Easing.OutQuint); Content.ScaleTo(0.75f, 2000, Easing.OutQuint);
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
Content.ScaleTo(1, 1000, Easing.OutElastic); Content.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
} }
} }

View File

@ -7,8 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -56,28 +55,28 @@ namespace osu.Game.Graphics.UserInterface
this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
hover.FadeIn(200); hover.FadeIn(200);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
hover.FadeOut(200); hover.FadeOut(200);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
Content.ScaleTo(0.9f, 4000, Easing.OutQuint); Content.ScaleTo(0.9f, 4000, Easing.OutQuint);
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
Content.ScaleTo(1, 1000, Easing.OutElastic); Content.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
protected override SpriteText CreateText() => new OsuSpriteText protected override SpriteText CreateText() => new OsuSpriteText

View File

@ -8,7 +8,7 @@ using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -95,18 +95,18 @@ namespace osu.Game.Graphics.UserInterface
}; };
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
Nub.Glowing = true; Nub.Glowing = true;
Nub.Expanded = true; Nub.Expanded = true;
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
Nub.Glowing = false; Nub.Glowing = false;
Nub.Expanded = false; Nub.Expanded = false;
base.OnHoverLost(state); base.OnHoverLost(e);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -51,6 +51,8 @@ namespace osu.Game.Graphics.UserInterface
#region OsuDropdownMenu #region OsuDropdownMenu
protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour
{ {
public override bool HandleNonPositionalInput => State == MenuState.Open;
// todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring // todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring
public OsuDropdownMenu() public OsuDropdownMenu()
{ {
@ -97,6 +99,9 @@ namespace osu.Game.Graphics.UserInterface
#region DrawableOsuDropdownMenuItem #region DrawableOsuDropdownMenuItem
public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour
{ {
// IsHovered is used
public override bool HandlePositionalInput => true;
private Color4? accentColour; private Color4? accentColour;
public Color4 AccentColour public Color4 AccentColour
{ {

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using OpenTK; using OpenTK;
@ -97,25 +97,25 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
sampleHover.Play(); sampleHover.Play();
text.BoldText.FadeIn(transition_length, Easing.OutQuint); text.BoldText.FadeIn(transition_length, Easing.OutQuint);
text.NormalText.FadeOut(transition_length, Easing.OutQuint); text.NormalText.FadeOut(transition_length, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
text.BoldText.FadeOut(transition_length, Easing.OutQuint); text.BoldText.FadeOut(transition_length, Easing.OutQuint);
text.NormalText.FadeIn(transition_length, Easing.OutQuint); text.NormalText.FadeIn(transition_length, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
sampleClick.Play(); sampleClick.Play();
return base.OnClick(state); return base.OnClick(e);
} }
protected sealed override Drawable CreateContent() => text = CreateTextContainer(); protected sealed override Drawable CreateContent() => text = CreateTextContainer();

View File

@ -9,8 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Framework.Platform; using osu.Framework.Platform;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -43,23 +42,23 @@ namespace osu.Game.Graphics.UserInterface
this.host = host; this.host = host;
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (args.Key == Key.CapsLock) if (e.Key == Key.CapsLock)
updateCapsWarning(host.CapsLockEnabled); updateCapsWarning(host.CapsLockEnabled);
return base.OnKeyDown(state, args); return base.OnKeyDown(e);
} }
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
updateCapsWarning(host.CapsLockEnabled); updateCapsWarning(host.CapsLockEnabled);
base.OnFocus(state); base.OnFocus(e);
} }
protected override void OnFocusLost(InputState state) protected override void OnFocusLost(FocusLostEvent e)
{ {
updateCapsWarning(false); updateCapsWarning(false);
base.OnFocusLost(state); base.OnFocusLost(e);
} }
private void updateCapsWarning(bool visible) => warning.FadeTo(visible ? 1 : 0, 250, Easing.OutQuint); private void updateCapsWarning(bool visible) => warning.FadeTo(visible ? 1 : 0, 250, Easing.OutQuint);

View File

@ -13,8 +13,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -125,16 +124,16 @@ namespace osu.Game.Graphics.UserInterface
AccentColour = colours.Pink; AccentColour = colours.Pink;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
Nub.Glowing = true; Nub.Glowing = true;
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
Nub.Glowing = false; Nub.Glowing = false;
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override void OnUserChange() protected override void OnUserChange()
@ -164,16 +163,16 @@ namespace osu.Game.Graphics.UserInterface
sample.Play(); sample.Play();
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
Nub.Current.Value = true; Nub.Current.Value = true;
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
Nub.Current.Value = false; Nub.Current.Value = false;
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()

View File

@ -14,7 +14,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -126,14 +126,14 @@ namespace osu.Game.Graphics.UserInterface
Text.FadeColour(AccentColour, transition_length, Easing.OutQuint); Text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
if (!Active) if (!Active)
fadeActive(); fadeActive();
return true; return true;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Active) if (!Active)
fadeInactive(); fadeInactive();
@ -265,16 +265,16 @@ namespace osu.Game.Graphics.UserInterface
Padding = new MarginPadding { Left = 5, Right = 5 }; Padding = new MarginPadding { Left = 5, Right = 5 };
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
Foreground.Colour = BackgroundColour; Foreground.Colour = BackgroundColour;
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
Foreground.Colour = BackgroundColourHover; Foreground.Colour = BackgroundColourHover;
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }
} }

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -59,18 +59,18 @@ namespace osu.Game.Graphics.UserInterface
text.FadeColour(AccentColour, transition_length, Easing.OutQuint); text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
fadeIn(); fadeIn();
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Current) if (!Current)
fadeOut(); fadeOut();
base.OnHoverLost(state); base.OnHoverLost(e);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -9,7 +9,7 @@ using osu.Game.Graphics.Sprites;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -44,17 +44,17 @@ namespace osu.Game.Graphics.UserInterface
BorderColour = colour.Yellow; BorderColour = colour.Yellow;
} }
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
BorderThickness = 3; BorderThickness = 3;
base.OnFocus(state); base.OnFocus(e);
} }
protected override void OnFocusLost(InputState state) protected override void OnFocusLost(FocusLostEvent e)
{ {
BorderThickness = 0; BorderThickness = 0;
base.OnFocusLost(state); base.OnFocusLost(e);
} }
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), TextSize = CalculatedTextSize }; protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), TextSize = CalculatedTextSize };

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
@ -67,14 +67,14 @@ namespace osu.Game.Graphics.UserInterface
box.Colour = colours.Yellow; box.Colour = colours.Yellow;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
if (!Active) if (!Active)
slideActive(); slideActive();
return true; return true;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Active) if (!Active)
slideInactive(); slideInactive();

View File

@ -2,8 +2,7 @@
// 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 osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using OpenTK; using OpenTK;
using OpenTK.Input; using OpenTK.Input;
@ -33,11 +32,11 @@ namespace osu.Game.Graphics.UserInterface
PlaceholderText = "type to search"; PlaceholderText = "type to search";
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (!state.Keyboard.ControlPressed && !state.Keyboard.ShiftPressed) if (!e.ControlPressed && !e.ShiftPressed)
{ {
switch (args.Key) switch (e.Key)
{ {
case Key.Left: case Key.Left:
case Key.Right: case Key.Right:
@ -49,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface
if (!AllowCommit) if (!AllowCommit)
{ {
switch (args.Key) switch (e.Key)
{ {
case Key.KeypadEnter: case Key.KeypadEnter:
case Key.Enter: case Key.Enter:
@ -57,16 +56,16 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
if (state.Keyboard.ShiftPressed) if (e.ShiftPressed)
{ {
switch (args.Key) switch (e.Key)
{ {
case Key.Delete: case Key.Delete:
return false; return false;
} }
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(e);
} }
} }
} }

View File

@ -13,8 +13,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Framework.Audio.Track; using osu.Framework.Audio.Track;
using System; using System;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
namespace osu.Game.Graphics.UserInterface namespace osu.Game.Graphics.UserInterface
{ {
@ -172,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos);
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic); this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic);
IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic);
@ -182,7 +181,7 @@ namespace osu.Game.Graphics.UserInterface
return true; return true;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic); this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic);
IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic); IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic);
@ -190,12 +189,12 @@ namespace osu.Game.Graphics.UserInterface
bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic); bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic);
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
return true; return true;
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
var flash = new Box var flash = new Box
{ {
@ -209,7 +208,7 @@ namespace osu.Game.Graphics.UserInterface
flash.FadeOut(500, Easing.OutQuint); flash.FadeOut(500, Easing.OutQuint);
flash.Expire(); flash.Expire();
return base.OnClick(state); return base.OnClick(e);
} }
private class BouncingIcon : BeatSyncedContainer private class BouncingIcon : BeatSyncedContainer

View File

@ -71,17 +71,17 @@ namespace osu.Game.Input.Bindings
ToggleSettings, ToggleSettings,
[Description("Toggle osu!direct")] [Description("Toggle osu!direct")]
ToggleDirect, ToggleDirect,
[Description("Increase Volume")] [Description("Increase volume")]
IncreaseVolume, IncreaseVolume,
[Description("Decrease Volume")] [Description("Decrease volume")]
DecreaseVolume, DecreaseVolume,
[Description("Toggle mute")] [Description("Toggle mute")]
ToggleMute, ToggleMute,
// In-Game Keybindings // In-Game Keybindings
[Description("Skip Cutscene")] [Description("Skip cutscene")]
SkipCutscene, SkipCutscene,
[Description("Quick Retry (Hold)")] [Description("Quick retry (hold)")]
QuickRetry, QuickRetry,
[Description("Take screenshot")] [Description("Take screenshot")]

View File

@ -65,7 +65,8 @@ namespace osu.Game
private BeatmapSetOverlay beatmapSetOverlay; private BeatmapSetOverlay beatmapSetOverlay;
private ScreenshotManager screenshotManager; [Cached]
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
protected RavenLogger RavenLogger; protected RavenLogger RavenLogger;
@ -289,9 +290,6 @@ namespace osu.Game
protected override void LoadComplete() protected override void LoadComplete()
{ {
// this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer.
dependencies.Cache(screenshotManager = new ScreenshotManager());
base.LoadComplete(); base.LoadComplete();
// The next time this is updated is in UpdateAfterChildren, which occurs too late and results // The next time this is updated is in UpdateAfterChildren, which occurs too late and results

View File

@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -174,9 +174,9 @@ namespace osu.Game.Overlays.BeatmapSet
{ {
public Action OnLostHover; public Action OnLostHover;
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
base.OnHoverLost(state); base.OnHoverLost(e);
OnLostHover?.Invoke(); OnLostHover?.Invoke();
} }
} }
@ -241,24 +241,24 @@ namespace osu.Game.Overlays.BeatmapSet
}; };
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
fadeIn(); fadeIn();
OnHovered?.Invoke(Beatmap); OnHovered?.Invoke(Beatmap);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (State == DifficultySelectorState.NotSelected) if (State == DifficultySelectorState.NotSelected)
fadeOut(); fadeOut();
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
OnClicked?.Invoke(Beatmap); OnClicked?.Invoke(Beatmap);
return base.OnClick(state); return base.OnClick(e);
} }
private void fadeIn() private void fadeIn()

View File

@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -89,16 +89,16 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
progress.Width = 0; progress.Width = 0;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
bg.FadeColour(Color4.Black.Opacity(0.5f), 100); bg.FadeColour(Color4.Black.Opacity(0.5f), 100);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
bg.FadeColour(Color4.Black.Opacity(0.25f), 100); bg.FadeColour(Color4.Black.Opacity(0.25f), 100);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }
} }

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
this.profile = profile; this.profile = profile;
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
profile?.ShowUser(user); profile?.ShowUser(user);
return true; return true;

View File

@ -6,7 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
@ -125,18 +125,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
background.Colour = colours.Gray4; background.Colour = colours.Gray4;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
background.FadeIn(fade_duration, Easing.OutQuint); background.FadeIn(fade_duration, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
background.FadeOut(fade_duration, Easing.OutQuint); background.FadeOut(fade_duration, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) => true; protected override bool OnClick(ClickEvent e) => true;
} }
} }

View File

@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
@ -184,16 +184,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
BorderColour = rankText.Colour = colours.Yellow; BorderColour = rankText.Colour = colours.Yellow;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
background.FadeIn(fade_duration, Easing.OutQuint); background.FadeIn(fade_duration, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
background.FadeOut(fade_duration, Easing.OutQuint); background.FadeOut(fade_duration, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
private class InfoColumn : FillFlowContainer private class InfoColumn : FillFlowContainer

View File

@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -127,7 +127,7 @@ namespace osu.Game.Overlays
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null); FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
State = Visibility.Hidden; State = Visibility.Hidden;
return true; return true;

View File

@ -9,7 +9,7 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
@ -155,15 +155,15 @@ namespace osu.Game.Overlays.Chat
FinishTransforms(true); FinishTransforms(true);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
if (!channel.Joined.Value) if (!channel.Joined.Value)
name.FadeColour(hoverColour, 50, Easing.OutQuint); name.FadeColour(hoverColour, 50, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!channel.Joined.Value) if (!channel.Joined.Value)
name.FadeColour(Color4.White, transition_duration); name.FadeColour(Color4.White, transition_duration);

View File

@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -150,10 +150,10 @@ namespace osu.Game.Overlays.Chat
headerBg.Colour = colours.Gray2.Opacity(0.75f); headerBg.Colour = colours.Gray2.Opacity(0.75f);
} }
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
GetContainingInputManager().ChangeFocus(search); GetContainingInputManager().ChangeFocus(search);
base.OnFocus(state); base.OnFocus(e);
} }
protected override void PopIn() protected override void PopIn()

View File

@ -17,8 +17,7 @@ using OpenTK.Input;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using System; using System;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Chat namespace osu.Game.Overlays.Chat
@ -144,9 +143,9 @@ namespace osu.Game.Overlays.Chat
textBold.FadeOut(transition_length, Easing.OutQuint); textBold.FadeOut(transition_length, Easing.OutQuint);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
if (args.Button == MouseButton.Middle) if (e.Button == MouseButton.Middle)
{ {
closeButton.Action(); closeButton.Action();
return true; return true;
@ -155,7 +154,7 @@ namespace osu.Game.Overlays.Chat
return false; return false;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
if (IsRemovable) if (IsRemovable)
closeButton.FadeIn(200, Easing.OutQuint); closeButton.FadeIn(200, Easing.OutQuint);
@ -165,7 +164,7 @@ namespace osu.Game.Overlays.Chat
return true; return true;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
closeButton.FadeOut(200, Easing.OutQuint); closeButton.FadeOut(200, Easing.OutQuint);
updateState(); updateState();
@ -291,28 +290,28 @@ namespace osu.Game.Overlays.Chat
}; };
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
icon.ScaleTo(0.5f, 1000, Easing.OutQuint); icon.ScaleTo(0.5f, 1000, Easing.OutQuint);
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
icon.ScaleTo(0.75f, 1000, Easing.OutElastic); icon.ScaleTo(0.75f, 1000, Easing.OutElastic);
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
icon.FadeColour(Color4.Red, 200, Easing.OutQuint); icon.FadeColour(Color4.Red, 200, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
icon.FadeColour(Color4.White, 200, Easing.OutQuint); icon.FadeColour(Color4.White, 200, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -13,7 +12,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -52,7 +51,7 @@ namespace osu.Game.Overlays
private readonly ChatTabControl channelTabs; private readonly ChatTabControl channelTabs;
private readonly Container chatContainer; private readonly Container chatContainer;
private readonly Container tabsArea; private readonly TabsArea tabsArea;
private readonly Box chatBackground; private readonly Box chatBackground;
private readonly Box tabBackground; private readonly Box tabBackground;
@ -146,11 +145,8 @@ namespace osu.Game.Overlays
loading = new LoadingAnimation(), loading = new LoadingAnimation(),
} }
}, },
tabsArea = new Container tabsArea = new TabsArea
{ {
Name = @"tabs area",
RelativeSizeAxes = Axes.X,
Height = TAB_AREA_HEIGHT,
Children = new Drawable[] Children = new Drawable[]
{ {
tabBackground = new Box tabBackground = new Box
@ -191,25 +187,22 @@ namespace osu.Game.Overlays
public void OpenChannel(Channel channel) => addChannel(channel); public void OpenChannel(Channel channel) => addChannel(channel);
protected override bool OnDragStart(InputState state) protected override bool OnDragStart(DragStartEvent e)
{ {
isDragging = tabsArea.IsHovered; isDragging = tabsArea.IsHovered;
if (!isDragging) if (!isDragging)
return base.OnDragStart(state); return base.OnDragStart(e);
startDragChatHeight = ChatHeight.Value; startDragChatHeight = ChatHeight.Value;
return true; return true;
} }
protected override bool OnDrag(InputState state) protected override bool OnDrag(DragEvent e)
{ {
if (isDragging) if (isDragging)
{ {
Trace.Assert(state.Mouse.PositionMouseDown != null); double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y;
// ReSharper disable once PossibleInvalidOperationException
double targetChatHeight = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y;
// If the channel selection screen is shown, mind its minimum height // If the channel selection screen is shown, mind its minimum height
if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height)
@ -221,10 +214,10 @@ namespace osu.Game.Overlays
return true; return true;
} }
protected override bool OnDragEnd(InputState state) protected override bool OnDragEnd(DragEndEvent e)
{ {
isDragging = false; isDragging = false;
return base.OnDragEnd(state); return base.OnDragEnd(e);
} }
public void APIStateChanged(APIAccess api, APIState state) public void APIStateChanged(APIAccess api, APIState state)
@ -242,11 +235,11 @@ namespace osu.Game.Overlays
public override bool AcceptsFocus => true; public override bool AcceptsFocus => true;
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
//this is necessary as textbox is masked away and therefore can't get focus :( //this is necessary as textbox is masked away and therefore can't get focus :(
GetContainingInputManager().ChangeFocus(textbox); GetContainingInputManager().ChangeFocus(textbox);
base.OnFocus(state); base.OnFocus(e);
} }
protected override void PopIn() protected override void PopIn()
@ -298,7 +291,7 @@ namespace osu.Game.Overlays
messageRequest?.Cancel(); messageRequest?.Cancel();
ListChannelsRequest req = new ListChannelsRequest(); ListChannelsRequest req = new ListChannelsRequest();
req.Success += delegate (List<Channel> channels) req.Success += delegate(List<Channel> channels)
{ {
AvailableChannels = channels; AvailableChannels = channels;
@ -330,10 +323,7 @@ namespace osu.Game.Overlays
protected Channel CurrentChannel protected Channel CurrentChannel
{ {
get get { return currentChannel; }
{
return currentChannel;
}
set set
{ {
@ -452,13 +442,7 @@ namespace osu.Game.Overlays
if (updates?.Presence != null) if (updates?.Presence != null)
{ {
foreach (var channel in updates.Presence) foreach (var channel in updates.Presence)
{ addChannel(AvailableChannels.Find(c => c.Id == channel.Id));
if (careChannels.Find(c => c.Id == channel.Id) == null)
{
channel.Joined.Value = true;
addChannel(channel);
}
}
foreach (var group in updates.Messages.GroupBy(m => m.ChannelId)) foreach (var group in updates.Messages.GroupBy(m => m.ChannelId))
careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray());
@ -469,10 +453,7 @@ namespace osu.Game.Overlays
fetchReq = null; fetchReq = null;
}; };
fetchReq.Failure += delegate fetchReq.Failure += delegate { fetchReq = null; };
{
fetchReq = null;
};
api.Queue(fetchReq); api.Queue(fetchReq);
} }
@ -545,5 +526,18 @@ namespace osu.Game.Overlays
api.Queue(req); api.Queue(req);
} }
private class TabsArea : Container
{
// IsHovered is used
public override bool HandlePositionalInput => true;
public TabsArea()
{
Name = @"tabs area";
RelativeSizeAxes = Axes.X;
Height = TAB_AREA_HEIGHT;
}
}
} }
} }

View File

@ -8,8 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -206,12 +205,12 @@ namespace osu.Game.Overlays.Dialog
return base.OnPressed(action); return base.OnPressed(action);
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (args.Repeat) return false; if (e.Repeat) return false;
// press button at number if 1-9 on number row or keypad are pressed // press button at number if 1-9 on number row or keypad are pressed
var k = args.Key; var k = e.Key;
if (k >= Key.Number1 && k <= Key.Number9) if (k >= Key.Number1 && k <= Key.Number9)
{ {
pressButtonAtIndex(k - Key.Number1); pressButtonAtIndex(k - Key.Number1);
@ -224,7 +223,7 @@ namespace osu.Game.Overlays.Dialog
return true; return true;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(e);
} }
protected override void PopIn() protected override void PopIn()

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
@ -227,15 +227,15 @@ namespace osu.Game.Overlays.Direct
PreviewPlaying.ValueChanged += _ => updateStatusContainer(); PreviewPlaying.ValueChanged += _ => updateStatusContainer();
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
updateStatusContainer(); updateStatusContainer();
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
base.OnHoverLost(state); base.OnHoverLost(e);
updateStatusContainer(); updateStatusContainer();
} }

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables; using osu.Game.Beatmaps.Drawables;
@ -121,27 +121,27 @@ namespace osu.Game.Overlays.Direct
} }
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint);
content.MoveToY(-4, hover_transition_time, Easing.OutQuint); content.MoveToY(-4, hover_transition_time, Easing.OutQuint);
if (FadePlayButton) if (FadePlayButton)
PlayButton.FadeIn(120, Easing.InOutQuint); PlayButton.FadeIn(120, Easing.InOutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint);
content.MoveToY(0, hover_transition_time, Easing.OutQuint); content.MoveToY(0, hover_transition_time, Easing.OutQuint);
if (FadePlayButton && !PreviewPlaying) if (FadePlayButton && !PreviewPlaying)
PlayButton.FadeOut(120, Easing.InOutQuint); PlayButton.FadeOut(120, Easing.InOutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
ShowInformation(); ShowInformation();
return true; return true;

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -93,23 +93,23 @@ namespace osu.Game.Overlays.Direct
hoverColour = colour.Yellow; hoverColour = colour.Yellow;
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
Playing.Toggle(); Playing.Toggle();
return true; return true;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
icon.FadeColour(hoverColour, 120, Easing.InOutQuint); icon.FadeColour(hoverColour, 120, Easing.InOutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (!Playing.Value) if (!Playing.Value)
icon.FadeColour(Color4.White, 120, Easing.InOutQuint); icon.FadeColour(Color4.White, 120, Easing.InOutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
private void playingStateChanged(bool playing) private void playingStateChanged(bool playing)

View File

@ -10,15 +10,13 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Input; using osu.Game.Input;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
using JoystickEventArgs = osu.Framework.Input.EventArgs.JoystickEventArgs;
namespace osu.Game.Overlays.KeyBinding namespace osu.Game.Overlays.KeyBinding
{ {
@ -125,18 +123,18 @@ namespace osu.Game.Overlays.KeyBinding
} }
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
FadeEdgeEffectTo(1, transition_time, Easing.OutQuint); FadeEdgeEffectTo(1, transition_time, Easing.OutQuint);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
FadeEdgeEffectTo(0, transition_time, Easing.OutQuint); FadeEdgeEffectTo(0, transition_time, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
public override bool AcceptsFocus => bindTarget == null; public override bool AcceptsFocus => bindTarget == null;
@ -149,16 +147,16 @@ namespace osu.Game.Overlays.KeyBinding
private bool isModifier(Key k) => k < Key.F1; private bool isModifier(Key k) => k < Key.F1;
protected override bool OnClick(InputState state) => true; protected override bool OnClick(ClickEvent e) => true;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
if (!HasFocus || !bindTarget.IsHovered) if (!HasFocus || !bindTarget.IsHovered)
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
if (!AllowMainMouseButtons) if (!AllowMainMouseButtons)
{ {
switch (args.Button) switch (e.Button)
{ {
case MouseButton.Left: case MouseButton.Left:
case MouseButton.Right: case MouseButton.Right:
@ -166,15 +164,15 @@ namespace osu.Game.Overlays.KeyBinding
} }
} }
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState));
return true; return true;
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
// don't do anything until the last button is released. // don't do anything until the last button is released.
if (!HasFocus || state.Mouse.Buttons.Any()) if (!HasFocus || e.HasAnyButtonPressed)
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
if (bindTarget.IsHovered) if (bindTarget.IsHovered)
finalise(); finalise();
@ -183,31 +181,31 @@ namespace osu.Game.Overlays.KeyBinding
return true; return true;
} }
protected override bool OnScroll(InputState state) protected override bool OnScroll(ScrollEvent e)
{ {
if (HasFocus) if (HasFocus)
{ {
if (bindTarget.IsHovered) if (bindTarget.IsHovered)
{ {
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state, state.Mouse.ScrollDelta)); bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState, e.ScrollDelta));
finalise(); finalise();
return true; return true;
} }
} }
return base.OnScroll(state); return base.OnScroll(e);
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (!HasFocus) if (!HasFocus)
return false; return false;
switch (args.Key) switch (e.Key)
{ {
case Key.Delete: case Key.Delete:
{ {
if (state.Keyboard.ShiftPressed) if (e.ShiftPressed)
{ {
bindTarget.UpdateKeyCombination(InputKey.None); bindTarget.UpdateKeyCombination(InputKey.None);
finalise(); finalise();
@ -218,35 +216,35 @@ namespace osu.Game.Overlays.KeyBinding
} }
} }
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState));
if (!isModifier(args.Key)) finalise(); if (!isModifier(e.Key)) finalise();
return true; return true;
} }
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) protected override bool OnKeyUp(KeyUpEvent e)
{ {
if (!HasFocus) return base.OnKeyUp(state, args); if (!HasFocus) return base.OnKeyUp(e);
finalise(); finalise();
return true; return true;
} }
protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) protected override bool OnJoystickPress(JoystickPressEvent e)
{ {
if (!HasFocus) if (!HasFocus)
return false; return false;
bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState));
finalise(); finalise();
return true; return true;
} }
protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) protected override bool OnJoystickRelease(JoystickReleaseEvent e)
{ {
if (!HasFocus) if (!HasFocus)
return base.OnJoystickRelease(state, args); return base.OnJoystickRelease(e);
finalise(); finalise();
return true; return true;
@ -273,7 +271,7 @@ namespace osu.Game.Overlays.KeyBinding
pressAKey.BypassAutoSizeAxes |= Axes.Y; pressAKey.BypassAutoSizeAxes |= Axes.Y;
} }
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
AutoSizeDuration = 500; AutoSizeDuration = 500;
AutoSizeEasing = Easing.OutQuint; AutoSizeEasing = Easing.OutQuint;
@ -282,13 +280,13 @@ namespace osu.Game.Overlays.KeyBinding
pressAKey.BypassAutoSizeAxes &= ~Axes.Y; pressAKey.BypassAutoSizeAxes &= ~Axes.Y;
updateBindTarget(); updateBindTarget();
base.OnFocus(state); base.OnFocus(e);
} }
protected override void OnFocusLost(InputState state) protected override void OnFocusLost(FocusLostEvent e)
{ {
finalise(); finalise();
base.OnFocusLost(state); base.OnFocusLost(e);
} }
private void updateBindTarget() private void updateBindTarget()
@ -367,16 +365,16 @@ namespace osu.Game.Overlays.KeyBinding
hoverColour = colours.YellowDark; hoverColour = colours.YellowDark;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
updateHoverState(); updateHoverState();
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
updateHoverState(); updateHoverState();
base.OnHoverLost(state); base.OnHoverLost(e);
} }
private void updateHoverState() private void updateHoverState()

View File

@ -6,8 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -138,16 +137,16 @@ namespace osu.Game.Overlays
}; };
} }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); aspect.ScaleTo(0.75f, 2000, Easing.OutQuint);
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
aspect.ScaleTo(1, 1000, Easing.OutElastic); aspect.ScaleTo(1, 1000, Easing.OutElastic);
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
public bool OnPressed(GlobalAction action) public bool OnPressed(GlobalAction action)

View File

@ -19,8 +19,7 @@ using osu.Framework.Graphics.Textures;
using OpenTK.Input; using OpenTK.Input;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using System; using System;
using System.Linq; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
namespace osu.Game.Overlays namespace osu.Game.Overlays
@ -176,15 +175,15 @@ namespace osu.Game.Overlays
particleContainer.Add(new MedalParticle(RNG.Next(0, 359))); particleContainer.Add(new MedalParticle(RNG.Next(0, 359)));
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
dismiss(); dismiss();
return true; return true;
} }
protected override void OnFocusLost(InputState state) protected override void OnFocusLost(FocusLostEvent e)
{ {
if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); if (e.CurrentState.Keyboard.Keys.IsPressed(Key.Escape)) dismiss();
} }
private const double initial_duration = 400; private const double initial_duration = 400;

View File

@ -13,8 +13,7 @@ using osu.Game.Rulesets.UI;
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
@ -149,20 +148,20 @@ namespace osu.Game.Overlays.Mods
public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
scaleContainer.ScaleTo(0.9f, 800, Easing.Out); scaleContainer.ScaleTo(0.9f, 800, Easing.Out);
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
scaleContainer.ScaleTo(1, 500, Easing.OutElastic); scaleContainer.ScaleTo(1, 500, Easing.OutElastic);
// only trigger the event if we are inside the area of the button // only trigger the event if we are inside the area of the button
if (Contains(ToScreenSpace(state.Mouse.Position - Position))) if (Contains(e.ScreenSpaceMousePosition))
{ {
switch (args.Button) switch (e.Button)
{ {
case MouseButton.Left: case MouseButton.Left:
SelectNext(1); SelectNext(1);

View File

@ -10,8 +10,7 @@ using osu.Game.Rulesets.Mods;
using System; using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
@ -55,16 +54,16 @@ namespace osu.Game.Overlays.Mods
private ModButton[] buttons = { }; private ModButton[] buttons = { };
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(KeyDownEvent e)
{ {
if (ToggleKeys != null) if (ToggleKeys != null)
{ {
var index = Array.IndexOf(ToggleKeys, args.Key); var index = Array.IndexOf(ToggleKeys, e.Key);
if (index > -1 && index < buttons.Length) if (index > -1 && index < buttons.Length)
buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); buttons[index].SelectNext(e.ShiftPressed ? -1 : 1);
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(e);
} }
public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null)); public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null));

View File

@ -8,8 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.EventArgs; using osu.Framework.Input.Events;
using osu.Framework.Input.States;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -37,16 +36,16 @@ namespace osu.Game.Overlays.Music
public bool IsDraggable { get; private set; } public bool IsDraggable { get; private set; }
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) protected override bool OnMouseDown(MouseDownEvent e)
{ {
IsDraggable = handle.IsHovered; IsDraggable = handle.IsHovered;
return base.OnMouseDown(state, args); return base.OnMouseDown(e);
} }
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) protected override bool OnMouseUp(MouseUpEvent e)
{ {
IsDraggable = false; IsDraggable = false;
return base.OnMouseUp(state, args); return base.OnMouseUp(e);
} }
private bool selected; private bool selected;
@ -123,19 +122,19 @@ namespace osu.Game.Overlays.Music
}); });
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
handle.FadeIn(fade_duration); handle.FadeIn(fade_duration);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
handle.FadeOut(fade_duration); handle.FadeOut(fade_duration);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
OnSelect?.Invoke(BeatmapSetInfo); OnSelect?.Invoke(BeatmapSetInfo);
return true; return true;

View File

@ -8,7 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using OpenTK; using OpenTK;
@ -115,25 +115,25 @@ namespace osu.Game.Overlays.Music
private Vector2 nativeDragPosition; private Vector2 nativeDragPosition;
private PlaylistItem draggedItem; private PlaylistItem draggedItem;
protected override bool OnDragStart(InputState state) protected override bool OnDragStart(DragStartEvent e)
{ {
nativeDragPosition = state.Mouse.NativeState.Position; nativeDragPosition = e.ScreenSpaceMousePosition;
draggedItem = items.FirstOrDefault(d => d.IsDraggable); draggedItem = items.FirstOrDefault(d => d.IsDraggable);
return draggedItem != null || base.OnDragStart(state); return draggedItem != null || base.OnDragStart(e);
} }
protected override bool OnDrag(InputState state) protected override bool OnDrag(DragEvent e)
{ {
nativeDragPosition = state.Mouse.NativeState.Position; nativeDragPosition = e.ScreenSpaceMousePosition;
if (draggedItem == null) if (draggedItem == null)
return base.OnDrag(state); return base.OnDrag(e);
return true; return true;
} }
protected override bool OnDragEnd(InputState state) protected override bool OnDragEnd(DragEndEvent e)
{ {
nativeDragPosition = state.Mouse.NativeState.Position; nativeDragPosition = e.ScreenSpaceMousePosition;
var handled = draggedItem != null || base.OnDragEnd(state); var handled = draggedItem != null || base.OnDragEnd(e);
draggedItem = null; draggedItem = null;
return handled; return handled;

View File

@ -13,7 +13,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -196,10 +196,16 @@ namespace osu.Game.Overlays
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
} }
private ScheduledDelegate seekDelegate;
private void attemptSeek(double progress) private void attemptSeek(double progress)
{
seekDelegate?.Cancel();
seekDelegate = Schedule(() =>
{ {
if (!beatmap.Disabled) if (!beatmap.Disabled)
current?.Track.Seek(progress); current?.Track.Seek(progress);
});
} }
private void playlistOrderChanged(BeatmapSetInfo beatmapSetInfo, int index) private void playlistOrderChanged(BeatmapSetInfo beatmapSetInfo, int index)
@ -457,20 +463,14 @@ namespace osu.Game.Overlays
private class DragContainer : Container private class DragContainer : Container
{ {
private Vector2 dragStart; protected override bool OnDragStart(DragStartEvent e)
protected override bool OnDragStart(InputState state)
{ {
base.OnDragStart(state);
dragStart = state.Mouse.Position;
return true; return true;
} }
protected override bool OnDrag(InputState state) protected override bool OnDrag(DragEvent e)
{ {
if (base.OnDrag(state)) return true; Vector2 change = e.MousePosition - e.MouseDownPosition;
Vector2 change = state.Mouse.Position - dragStart;
// Diminish the drag distance as we go further to simulate "rubber band" feeling. // Diminish the drag distance as we go further to simulate "rubber band" feeling.
change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length; change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length;
@ -479,10 +479,10 @@ namespace osu.Game.Overlays
return true; return true;
} }
protected override bool OnDragEnd(InputState state) protected override bool OnDragEnd(DragEndEvent e)
{ {
this.MoveTo(Vector2.Zero, 800, Easing.OutElastic); this.MoveTo(Vector2.Zero, 800, Easing.OutElastic);
return base.OnDragEnd(state); return base.OnDragEnd(e);
} }
} }
} }

View File

@ -11,7 +11,7 @@ using osu.Game.Graphics;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Notifications namespace osu.Game.Overlays.Notifications
@ -118,19 +118,19 @@ namespace osu.Game.Overlays.Notifications
}); });
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
closeButton.FadeIn(75); closeButton.FadeIn(75);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
closeButton.FadeOut(75); closeButton.FadeOut(75);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
protected override bool OnClick(InputState state) protected override bool OnClick(ClickEvent e)
{ {
if (Activated?.Invoke() ?? true) if (Activated?.Invoke() ?? true)
Close(); Close();
@ -185,16 +185,16 @@ namespace osu.Game.Overlays.Notifications
hoverColour = colours.Yellow; hoverColour = colours.Yellow;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
this.FadeColour(hoverColour, 200); this.FadeColour(hoverColour, 200);
return base.OnHover(state); return base.OnHover(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
this.FadeColour(OsuColour.Gray(0.2f), 200); this.FadeColour(OsuColour.Gray(0.2f), 200);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }

View File

@ -25,9 +25,6 @@ namespace osu.Game.Overlays
{ {
private readonly Container box; private readonly Container box;
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;
private readonly SpriteText textLine1; private readonly SpriteText textLine1;
private readonly SpriteText textLine2; private readonly SpriteText textLine2;
private readonly SpriteText textLine3; private readonly SpriteText textLine3;

View File

@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
@ -153,13 +153,13 @@ namespace osu.Game.Overlays.Profile.Header
this.hoverLostAction = hoverLostAction; this.hoverLostAction = hoverLostAction;
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
hoverAction(); hoverAction();
return true; return true;
} }
protected override void OnHoverLost(InputState state) => hoverLostAction(); protected override void OnHoverLost(HoverLostEvent e) => hoverLostAction();
} }
private class DrawableBadge : Container, IHasTooltip private class DrawableBadge : Container, IHasTooltip

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -137,25 +137,25 @@ namespace osu.Game.Overlays.Profile.Header
relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago"; relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago";
} }
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
if (ranks?.Length > 1) if (ranks?.Length > 1)
{ {
graph.UpdateBallPosition(state.Mouse.Position.X); graph.UpdateBallPosition(e.MousePosition.X);
graph.ShowBall(); graph.ShowBall();
} }
return base.OnHover(state); return base.OnHover(e);
} }
protected override bool OnMouseMove(InputState state) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
if (ranks?.Length > 1) if (ranks?.Length > 1)
graph.UpdateBallPosition(state.Mouse.Position.X); graph.UpdateBallPosition(e.MousePosition.X);
return base.OnMouseMove(state); return base.OnMouseMove(e);
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
if (ranks?.Length > 1) if (ranks?.Length > 1)
{ {
@ -163,7 +163,7 @@ namespace osu.Game.Overlays.Profile.Header
updateRankTexts(); updateRankTexts();
} }
base.OnHoverLost(state); base.OnHoverLost(e);
} }
private class RankChartLineGraph : LineGraph private class RankChartLineGraph : LineGraph

View File

@ -386,10 +386,13 @@ namespace osu.Game.Overlays.Profile
infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic);
} }
if (user.LastVisit.HasValue)
{
infoTextLeft.NewLine(); infoTextLeft.NewLine();
infoTextLeft.AddText("Last seen ", lightText); infoTextLeft.AddText("Last seen ", lightText);
infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); infoTextLeft.AddText(new DrawableDate(user.LastVisit.Value), boldItalic);
infoTextLeft.NewParagraph(); infoTextLeft.NewParagraph();
}
if (user.PlayStyle?.Length > 0) if (user.PlayStyle?.Length > 0)
{ {

View File

@ -6,7 +6,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -105,20 +105,20 @@ namespace osu.Game.Overlays.Profile.Sections
coloredBackground.Colour = underscoreLine.Colour = colour.Gray4; coloredBackground.Colour = underscoreLine.Colour = colour.Gray4;
} }
protected override bool OnClick(InputState state) => true; protected override bool OnClick(ClickEvent e) => true;
protected override bool OnHover(InputState state) protected override bool OnHover(HoverEvent e)
{ {
background.FadeIn(fade_duration, Easing.OutQuint); background.FadeIn(fade_duration, Easing.OutQuint);
underscoreLine.FadeOut(fade_duration, Easing.OutQuint); underscoreLine.FadeOut(fade_duration, Easing.OutQuint);
return true; return true;
} }
protected override void OnHoverLost(InputState state) protected override void OnHoverLost(HoverLostEvent e)
{ {
background.FadeOut(fade_duration, Easing.OutQuint); background.FadeOut(fade_duration, Easing.OutQuint);
underscoreLine.FadeIn(fade_duration, Easing.OutQuint); underscoreLine.FadeIn(fade_duration, Easing.OutQuint);
base.OnHoverLost(state); base.OnHoverLost(e);
} }
} }
} }

View File

@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
}; };
} }
protected override bool OnClick(InputState state) => true; protected override bool OnClick(ClickEvent e) => true;
private class CountSection : Container private class CountSection : Container
{ {

View File

@ -5,7 +5,7 @@ using OpenTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.SearchableList
scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height }; scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height };
} }
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
GetContainingInputManager().ChangeFocus(Filter.Search); GetContainingInputManager().ChangeFocus(Filter.Search);
} }

View File

@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
{ {
new SettingsSlider<double, OffsetSlider> new SettingsSlider<double, OffsetSlider>
{ {
LabelText = "Audio Offset", LabelText = "Audio offset",
Bindable = config.GetBindable<double>(OsuSetting.AudioOffset), Bindable = config.GetBindable<double>(OsuSetting.AudioOffset),
KeyboardStep = 1f KeyboardStep = 1f
}, },

View File

@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
Children = new Drawable[] Children = new Drawable[]
{ {
new SettingsSlider<double> { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, new SettingsSlider<double> { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f },
new SettingsSlider<double> { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable<double>(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, new SettingsSlider<double> { LabelText = "Master (window inactive)", Bindable = config.GetBindable<double>(OsuSetting.VolumeInactive), KeyboardStep = 0.01f },
new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, new SettingsSlider<double> { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f },
new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, new SettingsSlider<double> { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f },
}; };

View File

@ -1,26 +0,0 @@
// Copyright (c) 2007-2018 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.Game.Configuration;
namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
public class ScrollingSettings : SettingsSubsection
{
protected override string Header => "Scrolling";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new[]
{
new SettingsEnumDropdown<SpeedChangeVisualisationMethod>
{
LabelText = "Visualise speed changes as",
Bindable = config.GetBindable<SpeedChangeVisualisationMethod>(OsuSetting.SpeedChangeVisualisation),
}
};
}
}
}

View File

@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Settings.Sections
{ {
new GeneralSettings(), new GeneralSettings(),
new SongSelectSettings(), new SongSelectSettings(),
new ScrollingSettings(),
new ModsSettings(), new ModsSettings(),
}; };
} }
@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(RulesetStore rulesets) private void load(RulesetStore rulesets)
{ {
foreach(Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance())) foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
{ {
SettingsSubsection section = ruleset.CreateSettings(); SettingsSubsection section = ruleset.CreateSettings();
if (section != null) if (section != null)

View File

@ -16,7 +16,7 @@ using System.ComponentModel;
using osu.Game.Graphics; using osu.Game.Graphics;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Input.States; using osu.Framework.Input.Events;
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
using Container = osu.Framework.Graphics.Containers.Container; using Container = osu.Framework.Graphics.Containers.Container;
@ -175,12 +175,12 @@ namespace osu.Game.Overlays.Settings.Sections.General
public override bool AcceptsFocus => true; public override bool AcceptsFocus => true;
protected override bool OnClick(InputState state) => true; protected override bool OnClick(ClickEvent e) => true;
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
if (form != null) GetContainingInputManager().ChangeFocus(form); if (form != null) GetContainingInputManager().ChangeFocus(form);
base.OnFocus(state); base.OnFocus(e);
} }
private class LoginForm : FillFlowContainer private class LoginForm : FillFlowContainer
@ -244,9 +244,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
public override bool AcceptsFocus => true; public override bool AcceptsFocus => true;
protected override bool OnClick(InputState state) => true; protected override bool OnClick(ClickEvent e) => true;
protected override void OnFocus(InputState state) protected override void OnFocus(FocusEvent e)
{ {
Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
} }

Some files were not shown because too many files have changed in this diff Show More