mirror of
https://github.com/ppy/osu
synced 2024-12-14 19:06:07 +00:00
Merge remote-tracking branch 'upstream/master' into medals-fix
This commit is contained in:
commit
fadd53106c
@ -4,7 +4,7 @@
|
||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -1,68 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
||||
{
|
||||
public class GlowPiece : CompositeDrawable, IHasAccentColour
|
||||
{
|
||||
private const float glow_alpha = 0.7f;
|
||||
private const float glow_radius = 5;
|
||||
|
||||
public GlowPiece()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
|
||||
InternalChild = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
updateGlow();
|
||||
}
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
if (accentColour == value)
|
||||
return;
|
||||
|
||||
accentColour = value;
|
||||
|
||||
updateGlow();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateGlow()
|
||||
{
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour.Opacity(glow_alpha),
|
||||
Radius = glow_radius,
|
||||
Hollow = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
|
||||
{
|
||||
public class LaneGlowPiece : CompositeDrawable, IHasAccentColour
|
||||
{
|
||||
private const float total_height = 100;
|
||||
private const float glow_height = 50;
|
||||
private const float glow_alpha = 0.4f;
|
||||
private const float edge_alpha = 0.3f;
|
||||
|
||||
public LaneGlowPiece()
|
||||
{
|
||||
BypassAutoSizeAxes = Axes.Both;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = total_height;
|
||||
|
||||
InternalChildren = new[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Name = "Left edge",
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 1,
|
||||
Children = createGradient(edge_alpha)
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Right edge",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = 1,
|
||||
Children = createGradient(edge_alpha)
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Glow",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = glow_height,
|
||||
Children = createGradient(glow_alpha)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Drawable[] createGradient(float alpha) => new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Name = "Top",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.5f,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Colour = ColourInfo.GradientVertical(Color4.Transparent, Color4.White.Opacity(alpha))
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Name = "Bottom",
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.5f,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(alpha), Color4.Transparent)
|
||||
}
|
||||
};
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get => Colour;
|
||||
set => Colour = value;
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -8,6 +8,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.IO.Stores;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Tests.Resources;
|
||||
@ -15,6 +16,7 @@ using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Tests.Gameplay
|
||||
{
|
||||
[HeadlessTest]
|
||||
public class TestSceneStoryboardSamples : OsuTestScene
|
||||
{
|
||||
[Test]
|
||||
|
51
osu.Game.Tests/Online/TestSceneBeatmapManager.cs
Normal file
51
osu.Game.Tests/Online/TestSceneBeatmapManager.cs
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Tests.Online
|
||||
{
|
||||
[HeadlessTest]
|
||||
public class TestSceneBeatmapManager : OsuTestScene
|
||||
{
|
||||
private BeatmapManager beatmaps;
|
||||
private ProgressNotification recentNotification;
|
||||
|
||||
private static readonly BeatmapSetInfo test_model = new BeatmapSetInfo { OnlineBeatmapSetID = 1 };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapManager beatmaps)
|
||||
{
|
||||
this.beatmaps = beatmaps;
|
||||
|
||||
beatmaps.PostNotification = n => recentNotification = n as ProgressNotification;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCancelDownloadFromRequest()
|
||||
{
|
||||
AddStep("download beatmap", () => beatmaps.Download(test_model));
|
||||
|
||||
AddStep("cancel download from request", () => beatmaps.GetExistingDownload(test_model).Cancel());
|
||||
|
||||
AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null);
|
||||
AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCancelDownloadFromNotification()
|
||||
{
|
||||
AddStep("download beatmap", () => beatmaps.Download(test_model));
|
||||
|
||||
AddStep("cancel download from notification", () => recentNotification.Close());
|
||||
|
||||
AddUntilStep("is removed from download list", () => beatmaps.GetExistingDownload(test_model) == null);
|
||||
AddAssert("is notification cancelled", () => recentNotification.State == ProgressNotificationState.Cancelled);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
|
@ -7,7 +7,7 @@
|
||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Project">
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -92,8 +92,6 @@ namespace osu.Game.Database
|
||||
notification.CancelRequested += () =>
|
||||
{
|
||||
request.Cancel();
|
||||
currentDownloads.Remove(request);
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
return true;
|
||||
};
|
||||
|
||||
@ -109,11 +107,11 @@ namespace osu.Game.Database
|
||||
{
|
||||
DownloadFailed?.Invoke(request);
|
||||
|
||||
if (error is OperationCanceledException) return;
|
||||
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!");
|
||||
currentDownloads.Remove(request);
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
|
||||
if (!(error is OperationCanceledException))
|
||||
Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,33 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// </summary>
|
||||
private const float edge_smoothness = 1;
|
||||
|
||||
public Color4 ColourLight = Color4.White;
|
||||
public Color4 ColourDark = Color4.Black;
|
||||
private Color4 colourLight = Color4.White;
|
||||
|
||||
public Color4 ColourLight
|
||||
{
|
||||
get => colourLight;
|
||||
set
|
||||
{
|
||||
if (colourLight == value) return;
|
||||
|
||||
colourLight = value;
|
||||
updateColours();
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 colourDark = Color4.Black;
|
||||
|
||||
public Color4 ColourDark
|
||||
{
|
||||
get => colourDark;
|
||||
set
|
||||
{
|
||||
if (colourDark == value) return;
|
||||
|
||||
colourDark = value;
|
||||
updateColours();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether we want to expire triangles as they exit our draw area completely.
|
||||
@ -151,7 +176,8 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
TriangleParticle particle = CreateTriangle();
|
||||
|
||||
particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1);
|
||||
particle.Colour = CreateTriangleShade();
|
||||
particle.ColourShade = RNG.NextSingle();
|
||||
particle.Colour = CreateTriangleShade(particle.ColourShade);
|
||||
|
||||
return particle;
|
||||
}
|
||||
@ -177,7 +203,17 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// Creates a shade of colour for the triangles.
|
||||
/// </summary>
|
||||
/// <returns>The colour.</returns>
|
||||
protected virtual Color4 CreateTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1);
|
||||
protected virtual Color4 CreateTriangleShade(float shade) => Interpolation.ValueAt(shade, colourDark, colourLight, 0, 1);
|
||||
|
||||
private void updateColours()
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
TriangleParticle newParticle = parts[i];
|
||||
newParticle.Colour = CreateTriangleShade(newParticle.ColourShade);
|
||||
parts[i] = newParticle;
|
||||
}
|
||||
}
|
||||
|
||||
protected override DrawNode CreateDrawNode() => new TrianglesDrawNode(this);
|
||||
|
||||
@ -264,6 +300,12 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// </summary>
|
||||
public Vector2 Position;
|
||||
|
||||
/// <summary>
|
||||
/// The colour shade of the triangle.
|
||||
/// This is needed for colour recalculation of visible triangles when <see cref="ColourDark"/> or <see cref="ColourLight"/> is changed.
|
||||
/// </summary>
|
||||
public float ColourShade;
|
||||
|
||||
/// <summary>
|
||||
/// The colour of the triangle.
|
||||
/// </summary>
|
||||
|
@ -32,6 +32,7 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.D }, GlobalAction.ToggleDirect),
|
||||
|
||||
new KeyBinding(InputKey.Escape, GlobalAction.Back),
|
||||
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
|
||||
|
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using System.Linq;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
@ -28,10 +29,16 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
private readonly BindableBool childrenExpanded = new BindableBool(true);
|
||||
|
||||
private readonly FillFlowContainer childCommentsVisibilityContainer;
|
||||
private FillFlowContainer childCommentsVisibilityContainer;
|
||||
private readonly Comment comment;
|
||||
|
||||
public DrawableComment(Comment comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
LinkFlowContainer username;
|
||||
FillFlowContainer childCommentsContainer;
|
||||
@ -41,8 +48,6 @@ namespace osu.Game.Overlays.Comments
|
||||
GridContainer content;
|
||||
VotePill votePill;
|
||||
|
||||
this.comment = comment;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
InternalChild = new FillFlowContainer
|
||||
|
Loading…
Reference in New Issue
Block a user