1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 19:32:55 +08:00

Merge branch 'master' into android-build-automation

This commit is contained in:
Dean Herbert 2019-08-21 17:20:40 +09:00
commit b30f0d52de
99 changed files with 645 additions and 339 deletions

View File

@ -61,6 +61,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.809.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.814.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.821.0" />
</ItemGroup>
</Project>

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AccentColour = Color4.Red,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0.5f,
Scale = new Vector2(1.333f)
});

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Colour = Color4.White.Opacity(0.9f);
}

View File

@ -201,7 +201,7 @@ namespace osu.Game.Rulesets.Catch.UI
additive.Scale = Scale;
additive.Colour = HyperDashing ? Color4.Red : Color4.White;
additive.RelativePositionAxes = RelativePositionAxes;
additive.Blending = BlendingMode.Additive;
additive.Blending = BlendingParameters.Additive;
AdditiveTarget.Add(additive);

View File

@ -26,14 +26,14 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
public BodyPiece()
{
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Children = new[]
{
Background = new Box { RelativeSizeAxes = Axes.Both },
Foreground = new BufferedContainer
{
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
CacheDrawnFrameBuffer = true,
Children = new Drawable[]

View File

@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
Name = "Top",
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = ColourInfo.GradientVertical(Color4.Transparent, Color4.White.Opacity(alpha))
},
new Box
@ -71,7 +71,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(alpha), Color4.Transparent)
}
};

View File

@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components
Name = "Background Gradient Overlay",
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0
}
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -2,12 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Skinning;
using osu.Game.Tests.Visual;
@ -28,11 +28,11 @@ namespace osu.Game.Rulesets.Osu.Tests
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
var skins = new SkinManager(LocalStorage, ContextFactory, null, audio);
var dllStore = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll");
metricsSkin = getSkinFromResources(skins, "metrics_skin");
defaultSkin = getSkinFromResources(skins, "default_skin");
specialSkin = getSkinFromResources(skins, "special_skin");
metricsSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/metrics_skin"), audio, true);
defaultSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/default_skin"), audio, false);
specialSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true);
}
public void SetContents(Func<Drawable> creationFunction)
@ -43,23 +43,28 @@ namespace osu.Game.Rulesets.Osu.Tests
Cell(3).Child = new LocalSkinOverrideContainer(specialSkin) { RelativeSizeAxes = Axes.Both }.WithChild(creationFunction());
}
private static Skin getSkinFromResources(SkinManager skins, string name)
private class TestLegacySkin : LegacySkin
{
using (var storage = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll"))
private readonly bool extrapolateAnimations;
public TestLegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager, bool extrapolateAnimations)
: base(skin, storage, audioManager, "skin.ini")
{
var tempName = Path.GetTempFileName();
this.extrapolateAnimations = extrapolateAnimations;
}
File.Delete(tempName);
Directory.CreateDirectory(tempName);
public override Texture GetTexture(string componentName)
{
// extrapolate frames to test longer animations
if (extrapolateAnimations)
{
var match = Regex.Match(componentName, "-([0-9]*)");
var files = storage.GetAvailableResources().Where(f => f.StartsWith($"Resources/{name}"));
if (match.Length > 0 && int.TryParse(match.Groups[1].Value, out var number) && number < 60)
return base.GetTexture(componentName.Replace($"-{number}", $"-{number % 2}"));
}
foreach (var file in files)
using (var stream = storage.GetStream(file))
using (var newFile = File.Create(Path.Combine(tempName, Path.GetFileName(file))))
stream.CopyTo(newFile);
return skins.GetSkin(skins.Import(tempName).Result);
return base.GetTexture(componentName);
}
}
}

View File

@ -0,0 +1,34 @@
// 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 System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneDrawableJudgement : SkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableJudgement),
typeof(DrawableOsuJudgement)
};
public TestSceneDrawableJudgement()
{
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
new DrawableOsuJudgement(new JudgementResult(null) { Type = result }, null)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
}
}
}

View File

@ -10,7 +10,6 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Graphics;
using osu.Game.Rulesets.Mods;
@ -27,83 +26,96 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestSceneSlider : OsuTestScene
public class TestSceneSlider : SkinnableTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(Slider),
typeof(SliderTick),
typeof(SliderTailCircle),
typeof(SliderBall),
typeof(SliderBody),
typeof(SliderTick),
typeof(SnakingSliderBody),
typeof(DrawableSlider),
typeof(DrawableSliderTick),
typeof(DrawableSliderTail),
typeof(DrawableSliderHead),
typeof(DrawableRepeatPoint),
typeof(DrawableOsuHitObject)
};
private readonly Container content;
protected override Container<Drawable> Content => content;
private Container content;
protected override Container<Drawable> Content
{
get
{
if (content == null)
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
return content;
}
}
private int depthIndex;
public TestSceneSlider()
{
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
AddStep("Big Single", () => SetContents(() => testSimpleBig()));
AddStep("Medium Single", () => SetContents(() => testSimpleMedium()));
AddStep("Small Single", () => SetContents(() => testSimpleSmall()));
AddStep("Big 1 Repeat", () => SetContents(() => testSimpleBig(1)));
AddStep("Medium 1 Repeat", () => SetContents(() => testSimpleMedium(1)));
AddStep("Small 1 Repeat", () => SetContents(() => testSimpleSmall(1)));
AddStep("Big 2 Repeats", () => SetContents(() => testSimpleBig(2)));
AddStep("Medium 2 Repeats", () => SetContents(() => testSimpleMedium(2)));
AddStep("Small 2 Repeats", () => SetContents(() => testSimpleSmall(2)));
AddStep("Big Single", () => testSimpleBig());
AddStep("Medium Single", () => testSimpleMedium());
AddStep("Small Single", () => testSimpleSmall());
AddStep("Big 1 Repeat", () => testSimpleBig(1));
AddStep("Medium 1 Repeat", () => testSimpleMedium(1));
AddStep("Small 1 Repeat", () => testSimpleSmall(1));
AddStep("Big 2 Repeats", () => testSimpleBig(2));
AddStep("Medium 2 Repeats", () => testSimpleMedium(2));
AddStep("Small 2 Repeats", () => testSimpleSmall(2));
AddStep("Slow Slider", () => SetContents(testSlowSpeed)); // slow long sliders take ages already so no repeat steps
AddStep("Slow Short Slider", () => SetContents(() => testShortSlowSpeed()));
AddStep("Slow Short Slider 1 Repeats", () => SetContents(() => testShortSlowSpeed(1)));
AddStep("Slow Short Slider 2 Repeats", () => SetContents(() => testShortSlowSpeed(2)));
AddStep("Slow Slider", testSlowSpeed); // slow long sliders take ages already so no repeat steps
AddStep("Slow Short Slider", () => testShortSlowSpeed());
AddStep("Slow Short Slider 1 Repeats", () => testShortSlowSpeed(1));
AddStep("Slow Short Slider 2 Repeats", () => testShortSlowSpeed(2));
AddStep("Fast Slider", () => SetContents(() => testHighSpeed()));
AddStep("Fast Slider 1 Repeat", () => SetContents(() => testHighSpeed(1)));
AddStep("Fast Slider 2 Repeats", () => SetContents(() => testHighSpeed(2)));
AddStep("Fast Short Slider", () => SetContents(() => testShortHighSpeed()));
AddStep("Fast Short Slider 1 Repeat", () => SetContents(() => testShortHighSpeed(1)));
AddStep("Fast Short Slider 2 Repeats", () => SetContents(() => testShortHighSpeed(2)));
AddStep("Fast Short Slider 6 Repeats", () => SetContents(() => testShortHighSpeed(6)));
AddStep("Fast Slider", () => testHighSpeed());
AddStep("Fast Slider 1 Repeat", () => testHighSpeed(1));
AddStep("Fast Slider 2 Repeats", () => testHighSpeed(2));
AddStep("Fast Short Slider", () => testShortHighSpeed());
AddStep("Fast Short Slider 1 Repeat", () => testShortHighSpeed(1));
AddStep("Fast Short Slider 2 Repeats", () => testShortHighSpeed(2));
AddStep("Fast Short Slider 6 Repeats", () => testShortHighSpeed(6));
AddStep("Perfect Curve", () => SetContents(() => testPerfect()));
AddStep("Perfect Curve 1 Repeat", () => SetContents(() => testPerfect(1)));
AddStep("Perfect Curve 2 Repeats", () => SetContents(() => testPerfect(2)));
AddStep("Perfect Curve", () => testPerfect());
AddStep("Perfect Curve 1 Repeat", () => testPerfect(1));
AddStep("Perfect Curve 2 Repeats", () => testPerfect(2));
AddStep("Linear Slider", () => SetContents(() => testLinear()));
AddStep("Linear Slider 1 Repeat", () => SetContents(() => testLinear(1)));
AddStep("Linear Slider 2 Repeats", () => SetContents(() => testLinear(2)));
AddStep("Linear Slider", () => testLinear());
AddStep("Linear Slider 1 Repeat", () => testLinear(1));
AddStep("Linear Slider 2 Repeats", () => testLinear(2));
AddStep("Bezier Slider", () => SetContents(() => testBezier()));
AddStep("Bezier Slider 1 Repeat", () => SetContents(() => testBezier(1)));
AddStep("Bezier Slider 2 Repeats", () => SetContents(() => testBezier(2)));
AddStep("Bezier Slider", () => testBezier());
AddStep("Bezier Slider 1 Repeat", () => testBezier(1));
AddStep("Bezier Slider 2 Repeats", () => testBezier(2));
AddStep("Linear Overlapping", () => SetContents(() => testLinearOverlapping()));
AddStep("Linear Overlapping 1 Repeat", () => SetContents(() => testLinearOverlapping(1)));
AddStep("Linear Overlapping 2 Repeats", () => SetContents(() => testLinearOverlapping(2)));
AddStep("Linear Overlapping", () => testLinearOverlapping());
AddStep("Linear Overlapping 1 Repeat", () => testLinearOverlapping(1));
AddStep("Linear Overlapping 2 Repeats", () => testLinearOverlapping(2));
AddStep("Catmull Slider", () => SetContents(() => testCatmull()));
AddStep("Catmull Slider 1 Repeat", () => SetContents(() => testCatmull(1)));
AddStep("Catmull Slider 2 Repeats", () => SetContents(() => testCatmull(2)));
AddStep("Catmull Slider", () => testCatmull());
AddStep("Catmull Slider 1 Repeat", () => testCatmull(1));
AddStep("Catmull Slider 2 Repeats", () => testCatmull(2));
AddStep("Big Single, Large StackOffset", () => SetContents(() => testSimpleBigLargeStackOffset()));
AddStep("Big 1 Repeat, Large StackOffset", () => SetContents(() => testSimpleBigLargeStackOffset(1)));
AddStep("Big Single, Large StackOffset", () => testSimpleBigLargeStackOffset());
AddStep("Big 1 Repeat, Large StackOffset", () => testSimpleBigLargeStackOffset(1));
AddStep("Distance Overflow", () => testDistanceOverflow());
AddStep("Distance Overflow 1 Repeat", () => testDistanceOverflow(1));
AddStep("Distance Overflow", () => SetContents(() => testDistanceOverflow()));
AddStep("Distance Overflow 1 Repeat", () => SetContents(() => testDistanceOverflow(1)));
}
private void testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats);
private Drawable testSimpleBig(int repeats = 0) => createSlider(2, repeats: repeats);
private void testSimpleBigLargeStackOffset(int repeats = 0) => createSlider(2, repeats: repeats, stackHeight: 10);
private Drawable testSimpleBigLargeStackOffset(int repeats = 0) => createSlider(2, repeats: repeats, stackHeight: 10);
private void testDistanceOverflow(int repeats = 0)
private Drawable testDistanceOverflow(int repeats = 0)
{
var slider = new Slider
{
@ -120,22 +132,22 @@ namespace osu.Game.Rulesets.Osu.Tests
StackHeight = 10
};
addSlider(slider, 2, 2);
return createDrawable(slider, 2, 2);
}
private void testSimpleMedium(int repeats = 0) => createSlider(5, repeats: repeats);
private Drawable testSimpleMedium(int repeats = 0) => createSlider(5, repeats: repeats);
private void testSimpleSmall(int repeats = 0) => createSlider(7, repeats: repeats);
private Drawable testSimpleSmall(int repeats = 0) => createSlider(7, repeats: repeats);
private void testSlowSpeed() => createSlider(speedMultiplier: 0.5);
private Drawable testSlowSpeed() => createSlider(speedMultiplier: 0.5);
private void testShortSlowSpeed(int repeats = 0) => createSlider(distance: 100, repeats: repeats, speedMultiplier: 0.5);
private Drawable testShortSlowSpeed(int repeats = 0) => createSlider(distance: 100, repeats: repeats, speedMultiplier: 0.5);
private void testHighSpeed(int repeats = 0) => createSlider(repeats: repeats, speedMultiplier: 15);
private Drawable testHighSpeed(int repeats = 0) => createSlider(repeats: repeats, speedMultiplier: 15);
private void testShortHighSpeed(int repeats = 0) => createSlider(distance: 100, repeats: repeats, speedMultiplier: 15);
private Drawable testShortHighSpeed(int repeats = 0) => createSlider(distance: 100, repeats: repeats, speedMultiplier: 15);
private void createSlider(float circleSize = 2, float distance = 400, int repeats = 0, double speedMultiplier = 2, int stackHeight = 0)
private Drawable createSlider(float circleSize = 2, float distance = 400, int repeats = 0, double speedMultiplier = 2, int stackHeight = 0)
{
var slider = new Slider
{
@ -151,10 +163,10 @@ namespace osu.Game.Rulesets.Osu.Tests
StackHeight = stackHeight
};
addSlider(slider, circleSize, speedMultiplier);
return createDrawable(slider, circleSize, speedMultiplier);
}
private void testPerfect(int repeats = 0)
private Drawable testPerfect(int repeats = 0)
{
var slider = new Slider
{
@ -170,12 +182,12 @@ namespace osu.Game.Rulesets.Osu.Tests
NodeSamples = createEmptySamples(repeats)
};
addSlider(slider, 2, 3);
return createDrawable(slider, 2, 3);
}
private void testLinear(int repeats = 0) => createLinear(repeats);
private Drawable testLinear(int repeats = 0) => createLinear(repeats);
private void createLinear(int repeats)
private Drawable createLinear(int repeats)
{
var slider = new Slider
{
@ -194,12 +206,12 @@ namespace osu.Game.Rulesets.Osu.Tests
NodeSamples = createEmptySamples(repeats)
};
addSlider(slider, 2, 3);
return createDrawable(slider, 2, 3);
}
private void testBezier(int repeats = 0) => createBezier(repeats);
private Drawable testBezier(int repeats = 0) => createBezier(repeats);
private void createBezier(int repeats)
private Drawable createBezier(int repeats)
{
var slider = new Slider
{
@ -217,12 +229,12 @@ namespace osu.Game.Rulesets.Osu.Tests
NodeSamples = createEmptySamples(repeats)
};
addSlider(slider, 2, 3);
return createDrawable(slider, 2, 3);
}
private void testLinearOverlapping(int repeats = 0) => createOverlapping(repeats);
private Drawable testLinearOverlapping(int repeats = 0) => createOverlapping(repeats);
private void createOverlapping(int repeats)
private Drawable createOverlapping(int repeats)
{
var slider = new Slider
{
@ -241,12 +253,12 @@ namespace osu.Game.Rulesets.Osu.Tests
NodeSamples = createEmptySamples(repeats)
};
addSlider(slider, 2, 3);
return createDrawable(slider, 2, 3);
}
private void testCatmull(int repeats = 0) => createCatmull(repeats);
private Drawable testCatmull(int repeats = 0) => createCatmull(repeats);
private void createCatmull(int repeats = 0)
private Drawable createCatmull(int repeats = 0)
{
var repeatSamples = new List<List<HitSampleInfo>>();
for (int i = 0; i < repeats; i++)
@ -267,7 +279,7 @@ namespace osu.Game.Rulesets.Osu.Tests
NodeSamples = repeatSamples
};
addSlider(slider, 3, 1);
return createDrawable(slider, 3, 1);
}
private List<List<HitSampleInfo>> createEmptySamples(int repeats)
@ -278,7 +290,7 @@ namespace osu.Game.Rulesets.Osu.Tests
return repeatSamples;
}
private void addSlider(Slider slider, float circleSize, double speedMultiplier)
private Drawable createDrawable(Slider slider, float circleSize, double speedMultiplier)
{
var cpi = new ControlPointInfo();
cpi.DifficultyPoints.Add(new DifficultyControlPoint { SpeedMultiplier = speedMultiplier });
@ -296,7 +308,7 @@ namespace osu.Game.Rulesets.Osu.Tests
drawable.OnNewResult += onNewResult;
Add(drawable);
return drawable;
}
private float judgementOffsetDirection = 1;

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
Child = new Box
{
Size = new Vector2(width),
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Alpha = 0.5f,

View File

@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Origin = Anchor.Centre;
InternalChild = scaleContainer = new SkinnableDrawable("Play/osu/reversearrow", _ => new SpriteIcon

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
new TrianglesPiece
{
RelativeSizeAxes = Axes.Both,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0.5f,
}
};

View File

@ -17,12 +17,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Alpha = 0;
Child = new SkinnableDrawable("Play/osu/hitcircle-explode", _ => new TrianglesPiece
{
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
Alpha = 0.2f,
}, s => s.GetTexture("Play/osu/hitcircle") == null);

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Alpha = 0;
Child = new SkinnableDrawable("Play/osu/hitcircle-flash", name => new CircularContainer

View File

@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = textures.Get(name),
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0.5f
}, s => s.GetTexture("Play/osu/hitcircle") == null);
}

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
this.drawableSlider = drawableSlider;
this.slider = slider;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Origin = Anchor.Centre;
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
@ -55,7 +55,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Child = new Container
{
RelativeSizeAxes = Axes.Both,
// TODO: support skin filename animation (sliderb0, sliderb1...)
Child = new SkinnableDrawable("Play/osu/sliderball", _ => new DefaultSliderBall()),
}
}
@ -168,9 +167,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return action == OsuAction.LeftButton || action == OsuAction.RightButton;
}
private Vector2? lastPosition;
public void UpdateProgress(double completionProgress)
{
Position = slider.CurvePositionAt(completionProgress);
var newPos = slider.CurvePositionAt(completionProgress);
var diff = lastPosition.HasValue ? lastPosition.Value - newPos : newPos - slider.CurvePositionAt(completionProgress + 0.01f);
if (diff == Vector2.Zero)
return;
Position = newPos;
Rotation = -90 + (float)(-Math.Atan2(diff.X, diff.Y) * 180 / Math.PI);
lastPosition = newPos;
}
private class FollowCircleContainer : Container
@ -190,7 +200,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
Masking = true,
BorderThickness = 5,
BorderColour = Color4.Orange,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Child = new Box
{
Colour = Color4.Orange,

View File

@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
Origin = Anchor.Centre,
Alpha = 0,
RelativeSizeAxes = Axes.Both,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Masking = true,
Children = new[]
{
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = target_ring_thick_border,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Children = new Drawable[]
{
new Box

View File

@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0,
AlwaysPresent = true
}

View File

@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Taiko.UI
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
},
centre = new Sprite
{
@ -124,7 +124,7 @@ namespace osu.Game.Rulesets.Taiko.UI
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.7f),
Alpha = 0,
Blending = BlendingMode.Additive
Blending = BlendingParameters.Additive
}
};
}

View File

@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
},
HitTarget = new HitTarget
{
@ -127,14 +127,14 @@ namespace osu.Game.Rulesets.Taiko.UI
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
Blending = BlendingMode.Additive
Blending = BlendingParameters.Additive
},
judgementContainer = new JudgementContainer<DrawableTaikoJudgement>
{
Name = "Judgements",
RelativeSizeAxes = Axes.Y,
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
Blending = BlendingMode.Additive
Blending = BlendingParameters.Additive
},
}
},

View File

@ -249,7 +249,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Size = new Vector2(50);
Masking = true;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
Alpha = 0.5f;
Child = new Box { RelativeSizeAxes = Axes.Both };

View File

@ -125,7 +125,7 @@ namespace osu.Game.Tournament.Components
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Gray,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0,
},
});

View File

@ -129,6 +129,23 @@ namespace osu.Game.Beatmaps
/// </summary>
public List<ScoreInfo> Scores { get; set; }
[JsonIgnore]
public DifficultyRating DifficultyRating
{
get
{
var rating = StarDifficulty;
if (rating < 2.0) return DifficultyRating.Easy;
if (rating < 2.7) return DifficultyRating.Normal;
if (rating < 4.0) return DifficultyRating.Hard;
if (rating < 5.3) return DifficultyRating.Insane;
if (rating < 6.5) return DifficultyRating.Expert;
return DifficultyRating.ExpertPlus;
}
}
public override string ToString() => $"{Metadata} [{Version}]".Trim();
public bool Equals(BeatmapInfo other)

View File

@ -0,0 +1,15 @@
// 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.
namespace osu.Game.Beatmaps
{
public enum DifficultyRating
{
Easy,
Normal,
Hard,
Insane,
Expert,
ExpertPlus
}
}

View File

@ -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 System;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public abstract class DifficultyColouredContainer : Container, IHasAccentColour
{
public Color4 AccentColour { get; set; }
private readonly BeatmapInfo beatmap;
private OsuColour palette;
protected DifficultyColouredContainer(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
}
[BackgroundDependencyLoader]
private void load(OsuColour palette)
{
if (palette == null)
throw new ArgumentNullException(nameof(palette));
this.palette = palette;
AccentColour = getColour(beatmap);
}
private enum DifficultyRating
{
Easy,
Normal,
Hard,
Insane,
Expert,
ExpertPlus
}
private DifficultyRating getDifficultyRating(BeatmapInfo beatmap)
{
if (beatmap == null)
throw new ArgumentNullException(nameof(beatmap));
var rating = beatmap.StarDifficulty;
if (rating < 2.0) return DifficultyRating.Easy;
if (rating < 2.7) return DifficultyRating.Normal;
if (rating < 4.0) return DifficultyRating.Hard;
if (rating < 5.3) return DifficultyRating.Insane;
if (rating < 6.5) return DifficultyRating.Expert;
return DifficultyRating.ExpertPlus;
}
private Color4 getColour(BeatmapInfo beatmap)
{
switch (getDifficultyRating(beatmap))
{
case DifficultyRating.Easy:
return palette.Green;
default:
case DifficultyRating.Normal:
return palette.Blue;
case DifficultyRating.Hard:
return palette.Yellow;
case DifficultyRating.Insane:
return palette.Pink;
case DifficultyRating.Expert:
return palette.Purple;
case DifficultyRating.ExpertPlus:
return palette.Gray0;
}
}
}
}

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// 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 System;
@ -6,33 +6,46 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class DifficultyIcon : DifficultyColouredContainer
public class DifficultyIcon : Container, IHasCustomTooltip
{
private readonly BeatmapInfo beatmap;
private readonly RulesetInfo ruleset;
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null)
: base(beatmap)
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null, bool shouldShowTooltip = true)
{
if (beatmap == null)
throw new ArgumentNullException(nameof(beatmap));
this.beatmap = beatmap;
this.ruleset = ruleset ?? beatmap.Ruleset;
if (shouldShowTooltip)
TooltipContent = beatmap;
Size = new Vector2(20);
}
public string TooltipText { get; set; }
public ITooltip GetCustomTooltip() => new DifficultyIconTooltip();
public object TooltipContent { get; set; }
[BackgroundDependencyLoader]
private void load()
private void load(OsuColour colours)
{
Children = new Drawable[]
{
@ -52,7 +65,7 @@ namespace osu.Game.Beatmaps.Drawables
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = AccentColour,
Colour = colours.ForDifficultyRating(beatmap.DifficultyRating),
},
},
new ConstrainedIconContainer
@ -65,5 +78,96 @@ namespace osu.Game.Beatmaps.Drawables
}
};
}
private class DifficultyIconTooltip : VisibilityContainer, ITooltip
{
private readonly OsuSpriteText difficultyName, starRating;
private readonly Box background;
private readonly FillFlowContainer difficultyFlow;
public DifficultyIconTooltip()
{
AutoSizeAxes = Axes.Both;
Masking = true;
CornerRadius = 5;
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
AutoSizeDuration = 200,
AutoSizeEasing = Easing.OutQuint,
Direction = FillDirection.Vertical,
Padding = new MarginPadding(10),
Children = new Drawable[]
{
difficultyName = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
},
difficultyFlow = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
starRating = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding { Left = 4 },
Icon = FontAwesome.Solid.Star,
Size = new Vector2(12),
},
}
}
}
}
};
}
private OsuColour colours;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
this.colours = colours;
background.Colour = colours.Gray3;
}
public bool SetContent(object content)
{
if (!(content is BeatmapInfo beatmap))
return false;
difficultyName.Text = beatmap.Version;
starRating.Text = $"{beatmap.StarDifficulty:0.##}";
difficultyFlow.Colour = colours.ForDifficultyRating(beatmap.DifficultyRating);
return true;
}
public void Move(Vector2 pos) => Position = pos;
protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
}
}
}

View File

@ -246,7 +246,7 @@ namespace osu.Game.Beatmaps.Formats
switch (type)
{
case "A":
timelineGroup?.BlendingMode.Add(easing, startTime, endTime, BlendingMode.Additive, startTime == endTime ? BlendingMode.Additive : BlendingMode.Inherit);
timelineGroup?.BlendingParameters.Add(easing, startTime, endTime, BlendingParameters.Additive, startTime == endTime ? BlendingParameters.Additive : BlendingParameters.Inherit);
break;
case "H":

View File

@ -98,7 +98,7 @@ namespace osu.Game.Graphics.Containers
public OsuScrollbar(Direction scrollDir)
: base(scrollDir)
{
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
CornerRadius = 5;

View File

@ -150,7 +150,7 @@ namespace osu.Game.Graphics.Cursor
},
AdditiveLayer = new Sprite
{
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = colour.Pink,
Alpha = 0,
Texture = textures.Get(@"Cursor/menu-cursor-additive"),

View File

@ -30,22 +30,24 @@ namespace osu.Game.Graphics.Cursor
private readonly OsuSpriteText text;
private bool instantMovement = true;
public override string TooltipText
public override bool SetContent(object content)
{
set
if (!(content is string contentString))
return false;
if (contentString == text.Text) return true;
text.Text = contentString;
if (IsPresent)
{
if (value == text.Text) return;
text.Text = value;
if (IsPresent)
{
AutoSizeDuration = 250;
background.FlashColour(OsuColour.Gray(0.4f), 1000, Easing.OutQuint);
}
else
AutoSizeDuration = 0;
AutoSizeDuration = 250;
background.FlashColour(OsuColour.Gray(0.4f), 1000, Easing.OutQuint);
}
else
AutoSizeDuration = 0;
return true;
}
public OsuTooltip()

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Beatmaps;
using osuTK.Graphics;
namespace osu.Game.Graphics
@ -37,6 +38,31 @@ namespace osu.Game.Graphics
}
}
public Color4 ForDifficultyRating(DifficultyRating difficulty)
{
switch (difficulty)
{
case DifficultyRating.Easy:
return Green;
default:
case DifficultyRating.Normal:
return Blue;
case DifficultyRating.Hard:
return Yellow;
case DifficultyRating.Insane:
return Pink;
case DifficultyRating.Expert:
return Purple;
case DifficultyRating.ExpertPlus:
return Gray0;
}
}
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
public readonly Color4 PurpleLighter = FromHex(@"eeeeff");
public readonly Color4 PurpleLight = FromHex(@"aa88ff");

View File

@ -56,7 +56,7 @@ namespace osu.Game.Graphics.Sprites
BlurSigma = new Vector2(4),
CacheDrawnFrameBuffer = true,
RelativeSizeAxes = Axes.Both,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Size = new Vector2(3f),
Children = new[]
{

View File

@ -254,7 +254,7 @@ namespace osu.Game.Graphics.UserInterface
colourContainer.Add(flash);
flash.Colour = ButtonColour;
flash.Blending = BlendingMode.Additive;
flash.Blending = BlendingParameters.Additive;
flash.Alpha = 0.3f;
flash.FadeOutFromOne(click_duration);
flash.Expire();

View File

@ -64,7 +64,7 @@ namespace osu.Game.Graphics.UserInterface
{
RelativeSizeAxes = Axes.Both,
Colour = HoverColour,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0,
},
}

View File

@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
hover = new Box
{
RelativeSizeAxes = Axes.Both,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = Color4.White.Opacity(0.1f),
Alpha = 0,
Depth = -1

View File

@ -72,17 +72,11 @@ namespace osu.Game.Graphics.UserInterface
Current.DisabledChanged += disabled => labelText.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
}
protected override void LoadComplete()
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
base.LoadComplete();
Current.ValueChanged += enabled =>
{
if (enabled.NewValue)
sampleChecked?.Play();
else
sampleUnchecked?.Play();
};
sampleChecked = audio.Samples.Get(@"UI/check-on");
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
}
protected override bool OnHover(HoverEvent e)
@ -99,11 +93,13 @@ namespace osu.Game.Graphics.UserInterface
base.OnHoverLost(e);
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
protected override void OnUserChange(bool value)
{
sampleChecked = audio.Samples.Get(@"UI/check-on");
sampleUnchecked = audio.Samples.Get(@"UI/check-off");
base.OnUserChange(value);
if (value)
sampleChecked?.Play();
else
sampleUnchecked?.Play();
}
}
}

View File

@ -122,6 +122,7 @@ namespace osu.Game.Online.Chat
return new LinkDetails(LinkAction.OpenBeatmapSet, args[3]);
case "u":
case "users":
return new LinkDetails(LinkAction.OpenUserProfile, args[3]);
}
}

View File

@ -234,7 +234,7 @@ namespace osu.Game.Overlays.BeatmapSet
Colour = Color4.Black.Opacity(0.5f),
},
},
icon = new DifficultyIcon(beatmap)
icon = new DifficultyIcon(beatmap, shouldShowTooltip: false)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -92,6 +92,15 @@ namespace osu.Game.Overlays
});
}
/// <summary>
/// Start playing the current track (if not already playing).
/// </summary>
public void Play()
{
if (!IsPlaying)
TogglePause();
}
/// <summary>
/// Toggle pause / play.
/// </summary>

View File

@ -196,17 +196,30 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
}
public string TooltipText => Statistics.Value?.Ranks.Global == null ? "" : $"#{ranks[dayIndex].Value:#,##0}|{ranked_days - ranks[dayIndex].Key + 1}";
public object TooltipContent
{
get
{
if (Statistics.Value?.Ranks.Global == null)
return null;
var days = ranked_days - ranks[dayIndex].Key + 1;
return new TooltipDisplayContent
{
Rank = $"#{ranks[dayIndex].Value:#,##0}",
Time = days == 0 ? "now" : $"{days} days ago"
};
}
}
public ITooltip GetCustomTooltip() => new RankGraphTooltip();
public class RankGraphTooltip : VisibilityContainer, ITooltip
private class RankGraphTooltip : VisibilityContainer, ITooltip
{
private readonly OsuSpriteText globalRankingText, timeText;
private readonly Box background;
public string TooltipText { get; set; }
public RankGraphTooltip()
{
AutoSizeAxes = Axes.Both;
@ -260,11 +273,14 @@ namespace osu.Game.Overlays.Profile.Header.Components
background.Colour = colours.GreySeafoamDark;
}
public void Refresh()
public bool SetContent(object content)
{
var info = TooltipText.Split('|');
globalRankingText.Text = info[0];
timeText.Text = info[1] == "0" ? "now" : $"{info[1]} days ago";
if (!(content is TooltipDisplayContent info))
return false;
globalRankingText.Text = info.Rank;
timeText.Text = info.Time;
return true;
}
private bool instantMove = true;
@ -284,5 +300,11 @@ namespace osu.Game.Overlays.Profile.Header.Components
protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
}
private class TooltipDisplayContent
{
public string Rank;
public string Time;
}
}
}

View File

@ -46,8 +46,11 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
if (!s.OnlineBeatmapSetID.HasValue)
continue;
var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
ItemsContainer.Add(panel);
ItemsContainer.Add(new DirectGridPanel(s.ToBeatmapSet(Rulesets))
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
});
}
});

View File

@ -79,7 +79,7 @@ namespace osu.Game.Overlays.Toolbar
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(80).Opacity(180),
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0,
},
Flow = new FillFlowContainer

View File

@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Toolbar
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(150).Opacity(180),
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Depth = 2,
Alpha = 0,
});

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
@ -57,7 +58,12 @@ namespace osu.Game.Rulesets.Edit
this.drawableRuleset = drawableRuleset;
InternalChild = drawableRuleset;
}
[BackgroundDependencyLoader]
private void load()
{
drawableRuleset.FrameStablePlayback = false;
Playfield.DisplayJudgements.Value = false;
}

View File

@ -325,9 +325,6 @@ namespace osu.Game.Rulesets.Scoring
JudgedHits++;
if (result.Type != HitResult.None)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1;
if (result.Judgement.AffectsCombo)
{
switch (result.Type)
@ -352,6 +349,9 @@ namespace osu.Game.Rulesets.Scoring
}
else
{
if (result.HasResult)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) + 1;
baseScore += result.Judgement.NumericResultFor(result);
rollingMaxBaseScore += result.Judgement.MaxNumericResult;
}
@ -371,9 +371,6 @@ namespace osu.Game.Rulesets.Scoring
JudgedHits--;
if (result.Type != HitResult.None)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) - 1;
if (result.Judgement.IsBonus)
{
if (result.IsHit)
@ -381,6 +378,9 @@ namespace osu.Game.Rulesets.Scoring
}
else
{
if (result.HasResult)
scoreResultCounts[result.Type] = scoreResultCounts.GetOrDefault(result.Type) - 1;
baseScore -= result.Judgement.NumericResultFor(result);
rollingMaxBaseScore -= result.Judgement.MaxNumericResult;
}

View File

@ -62,6 +62,15 @@ namespace osu.Game.Rulesets.UI
public override GameplayClock FrameStableClock => frameStabilityContainer.GameplayClock;
/// <summary>
/// Whether to enable frame-stable playback.
/// </summary>
internal bool FrameStablePlayback
{
get => frameStabilityContainer.FrameStablePlayback;
set => frameStabilityContainer.FrameStablePlayback = value;
}
/// <summary>
/// Invoked when a <see cref="JudgementResult"/> has been applied by a <see cref="DrawableHitObject"/>.
/// </summary>

View File

@ -24,6 +24,11 @@ namespace osu.Game.Rulesets.UI
/// </summary>
public int MaxCatchUpFrames { get; set; } = 5;
/// <summary>
/// Whether to enable frame-stable playback.
/// </summary>
internal bool FrameStablePlayback = true;
[Cached]
public GameplayClock GameplayClock { get; }
@ -113,7 +118,13 @@ namespace osu.Game.Rulesets.UI
try
{
if (firstConsumption)
if (!FrameStablePlayback)
{
manualClock.CurrentTime = newProposedTime;
requireMoreUpdateLoops = false;
return;
}
else if (firstConsumption)
{
// On the first update, frame-stability seeking would result in unexpected/unwanted behaviour.
// Instead we perform an initial seek to the proposed time.

View File

@ -51,7 +51,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
Scale = new Vector2(0.5f),
X = 10,
Masking = true,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Child = new Box { RelativeSizeAxes = Axes.Both }
};
}

View File

@ -360,7 +360,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0.2f), Color4.White),
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
},
new EquilateralTriangle
{

View File

@ -92,7 +92,7 @@ namespace osu.Game.Screens.Menu
{
EdgeSmoothness = new Vector2(1.5f, 0),
RelativeSizeAxes = Axes.Both,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = Color4.White,
Alpha = 0,
},

View File

@ -28,11 +28,18 @@ namespace osu.Game.Screens.Menu
private Bindable<bool> menuVoice;
private LeasedBindable<WorkingBeatmap> beatmap;
public new Bindable<WorkingBeatmap> Beatmap => beatmap;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBlack();
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
{
// prevent user from changing beatmap while the intro is still runnning.
beatmap = base.Beatmap.BeginLease(false);
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
seeya = audio.Samples.Get(@"seeya");
}
@ -107,6 +114,8 @@ namespace osu.Game.Screens.Menu
protected void LoadMenu()
{
beatmap.Return();
DidLoadMenu = true;
this.Push(mainMenu);
}

View File

@ -296,7 +296,7 @@ namespace osu.Game.Screens.Menu
{
Colour = Color4.White;
RelativeSizeAxes = Axes.Both;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
}
protected override void LoadComplete()
@ -399,11 +399,11 @@ namespace osu.Game.Screens.Menu
Origin = Anchor.Centre,
Colour = Color4.Black,
Size = new Vector2(size - 5),
Blending = BlendingMode.None,
Blending = BlendingParameters.None,
});
}
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
CacheDrawnFrameBuffer = true;
}
}

View File

@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu
public LogoVisualisation()
{
texture = Texture.WhitePixel;
Blending = BlendingMode.Additive;
Blending = BlendingParameters.Additive;
}
[BackgroundDependencyLoader]

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Menu
// align off-screen to make sure our edges don't become visible during parallax.
X = -box_width,
Alpha = 0,
Blending = BlendingMode.Additive
Blending = BlendingParameters.Additive
},
rightBox = new Box
{
@ -81,7 +81,7 @@ namespace osu.Game.Screens.Menu
Height = 1.5f,
X = box_width,
Alpha = 0,
Blending = BlendingMode.Additive
Blending = BlendingParameters.Additive
}
};

View File

@ -124,7 +124,7 @@ namespace osu.Game.Screens.Menu
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Alpha = 0
}
}
@ -185,7 +185,7 @@ namespace osu.Game.Screens.Menu
flashLayer = new Box
{
RelativeSizeAxes = Axes.Both,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = Color4.White,
Alpha = 0,
},

View File

@ -31,7 +31,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.15f,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
},
});
}

View File

@ -95,7 +95,7 @@ namespace osu.Game.Screens
Colour = getColourFor(GetType()),
Alpha = 0.2f,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
},
textContainer = new FillFlowContainer
{

View File

@ -402,31 +402,35 @@ namespace osu.Game.Screens.Select
}
}
private class DifficultyColourBar : DifficultyColouredContainer
private class DifficultyColourBar : Container
{
private readonly BeatmapInfo beatmap;
public DifficultyColourBar(BeatmapInfo beatmap)
: base(beatmap)
{
this.beatmap = beatmap;
}
[BackgroundDependencyLoader]
private void load()
private void load(OsuColour colours)
{
const float full_opacity_ratio = 0.7f;
var difficultyColour = colours.ForDifficultyRating(beatmap.DifficultyRating);
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = AccentColour,
Colour = difficultyColour,
Width = full_opacity_ratio,
},
new Box
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Colour = AccentColour,
Colour = difficultyColour,
Alpha = 0.5f,
X = full_opacity_ratio,
Width = 1 - full_opacity_ratio,

View File

@ -82,7 +82,7 @@ namespace osu.Game.Screens.Select.Carousel
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new DifficultyIcon(beatmap)
new DifficultyIcon(beatmap, shouldShowTooltip: false)
{
Scale = new Vector2(1.8f),
},

View File

@ -64,7 +64,7 @@ namespace osu.Game.Screens.Select.Carousel
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
},
}
};

View File

@ -121,7 +121,7 @@ namespace osu.Game.Screens.Select.Options
{
RelativeSizeAxes = Axes.Both,
EdgeSmoothness = new Vector2(1.5f, 0),
Blending = BlendingMode.Additive,
Blending = BlendingParameters.Additive,
Colour = Color4.White,
Alpha = 0,
},

View File

@ -359,6 +359,7 @@ namespace osu.Game.Screens.Select
return;
beatmapNoDebounce = beatmap;
performUpdateSelected();
}
@ -586,10 +587,18 @@ namespace osu.Game.Screens.Select
{
Track track = Beatmap.Value.Track;
if ((!track.IsRunning || restart) && music?.IsUserPaused != true)
if (!track.IsRunning || restart)
{
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
track.Restart();
if (music != null)
{
// use the global music controller (when available) to cancel a potential local user paused state.
music.SeekTo(track.RestartPoint);
music.Play();
}
else
track.Restart();
}
}

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// 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 System;
@ -11,10 +11,12 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Framework.Text;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@ -42,6 +44,8 @@ namespace osu.Game.Skinning
public LegacySkin(SkinInfo skin, IResourceStore<byte[]> storage, AudioManager audioManager)
: this(skin, new LegacySkinResourceStore<SkinFileInfo>(skin, storage), audioManager, "skin.ini")
{
// defaults should only be applied for non-beatmap skins (which are parsed via this constructor).
if (!Configuration.CustomColours.ContainsKey("SliderBall")) Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255);
}
private readonly bool hasHitCircle;
@ -59,7 +63,7 @@ namespace osu.Game.Skinning
Samples = audioManager.GetSampleStore(storage);
Textures = new TextureStore(new TextureLoaderStore(storage));
using (var testStream = storage.GetStream("hitcircle"))
using (var testStream = storage.GetStream("hitcircle@2x") ?? storage.GetStream("hitcircle"))
hasHitCircle |= testStream != null;
if (hasHitCircle)
@ -75,8 +79,13 @@ namespace osu.Game.Skinning
Samples?.Dispose();
}
private const double default_frame_time = 1000 / 60d;
public override Drawable GetDrawableComponent(string componentName)
{
bool animatable = false;
bool looping = true;
switch (componentName)
{
case "Play/osu/cursor":
@ -86,8 +95,20 @@ namespace osu.Game.Skinning
return null;
case "Play/osu/sliderball":
if (GetTexture("sliderb") != null)
return new LegacySliderBall();
var sliderBallContent = getAnimation("sliderb", true, true, "");
if (sliderBallContent != null)
{
var size = sliderBallContent.Size;
sliderBallContent.RelativeSizeAxes = Axes.Both;
sliderBallContent.Size = Vector2.One;
return new LegacySliderBall(sliderBallContent)
{
Size = size
};
}
return null;
@ -97,26 +118,38 @@ namespace osu.Game.Skinning
return null;
case "Play/osu/sliderfollowcircle":
animatable = true;
break;
case "Play/Miss":
componentName = "hit0";
animatable = true;
looping = false;
break;
case "Play/Meh":
componentName = "hit50";
animatable = true;
looping = false;
break;
case "Play/Good":
componentName = "hit100";
animatable = true;
looping = false;
break;
case "Play/Great":
componentName = "hit300";
animatable = true;
looping = false;
break;
case "Play/osu/number-text":
return !hasFont(Configuration.HitCircleFont)
? null
: new LegacySpriteText(Textures, Configuration.HitCircleFont)
: new LegacySpriteText(this, Configuration.HitCircleFont)
{
Scale = new Vector2(0.96f),
// Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size
@ -124,25 +157,42 @@ namespace osu.Game.Skinning
};
}
// temporary allowance is given for skins the fact that stable handles non-animatable items such as hitcircles (incorrectly)
// by (incorrectly) displaying the first frame of animation rather than the non-animated version.
// users have used this to "hide" certain elements like hit300.
var texture = GetTexture($"{componentName}-0") ?? GetTexture(componentName);
if (texture == null)
return null;
return new Sprite { Texture = texture };
return getAnimation(componentName, animatable, looping);
}
public class LegacySliderBall : Sprite
private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-")
{
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
Texture texture;
Texture getFrameTexture(int frame) => GetTexture($"{componentName}{animationSeparator}{frame}");
TextureAnimation animation = null;
if (animatable)
{
Texture = skin.GetTexture("sliderb");
Colour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Color4.White;
for (int i = 0;; i++)
{
if ((texture = getFrameTexture(i)) == null)
break;
if (animation == null)
animation = new TextureAnimation
{
DefaultFrameLength = default_frame_time,
Repeat = looping
};
animation.AddFrame(texture);
}
}
if (animation != null)
return animation;
if ((texture = GetTexture(componentName)) != null)
return new Sprite { Texture = texture };
return null;
}
public override Texture GetTexture(string componentName)
@ -234,37 +284,43 @@ namespace osu.Game.Skinning
private class LegacySpriteText : OsuSpriteText
{
private readonly TextureStore textures;
private readonly string font;
private readonly LegacyGlyphStore glyphStore;
public LegacySpriteText(TextureStore textures, string font)
public LegacySpriteText(ISkin skin, string font)
{
this.textures = textures;
this.font = font;
Shadow = false;
UseFullGlyphHeight = false;
Font = new FontUsage(font, OsuFont.DEFAULT_FONT_SIZE);
glyphStore = new LegacyGlyphStore(skin);
}
protected override Texture GetTextureForCharacter(char c)
protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);
private class LegacyGlyphStore : ITexturedGlyphLookupStore
{
string textureName = $"{font}-{c}";
private readonly ISkin skin;
// Approximate value that brings character sizing roughly in-line with stable
float ratio = 36;
var texture = textures.Get($"{textureName}@2x");
if (texture == null)
public LegacyGlyphStore(ISkin skin)
{
ratio = 18;
texture = textures.Get(textureName);
this.skin = skin;
}
if (texture != null)
texture.ScaleAdjust = ratio;
public ITexturedCharacterGlyph Get(string fontName, char character)
{
var texture = skin.GetTexture($"{fontName}-{character}");
return texture;
if (texture != null)
// Approximate value that brings character sizing roughly in-line with stable
texture.ScaleAdjust *= 18;
if (texture == null)
return null;
return new TexturedCharacterGlyph(new CharacterGlyph(character, 0, 0, texture.Width, null), texture, 1f / texture.ScaleAdjust);
}
public Task<ITexturedCharacterGlyph> GetAsync(string fontName, char character) => Task.Run(() => Get(fontName, character));
}
}
@ -299,6 +355,37 @@ namespace osu.Game.Skinning
}
}
public class LegacySliderBall : CompositeDrawable
{
private readonly Drawable animationContent;
public LegacySliderBall(Drawable animationContent)
{
this.animationContent = animationContent;
}
[BackgroundDependencyLoader]
private void load(ISkinSource skin, DrawableHitObject drawableObject)
{
animationContent.Colour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? Color4.White;
InternalChildren = new[]
{
new Sprite
{
Texture = skin.GetTexture("sliderb-nd"),
Colour = new Color4(5, 5, 5, 255),
},
animationContent,
new Sprite
{
Texture = skin.GetTexture("sliderb-spec"),
Blending = BlendingParameters.Additive,
},
};
}
}
public class LegacyMainCirclePiece : CompositeDrawable
{
public LegacyMainCirclePiece()

View File

@ -20,7 +20,7 @@ namespace osu.Game.Storyboards
public CommandTimeline<float> Rotation = new CommandTimeline<float>();
public CommandTimeline<Color4> Colour = new CommandTimeline<Color4>();
public CommandTimeline<float> Alpha = new CommandTimeline<float>();
public CommandTimeline<BlendingMode> BlendingMode = new CommandTimeline<BlendingMode>();
public CommandTimeline<BlendingParameters> BlendingParameters = new CommandTimeline<BlendingParameters>();
public CommandTimeline<bool> FlipH = new CommandTimeline<bool>();
public CommandTimeline<bool> FlipV = new CommandTimeline<bool>();
@ -35,7 +35,7 @@ namespace osu.Game.Storyboards
yield return Rotation;
yield return Colour;
yield return Alpha;
yield return BlendingMode;
yield return BlendingParameters;
yield return FlipH;
yield return FlipV;
}

View File

@ -12,19 +12,19 @@ namespace osu.Game.Storyboards.Drawables
/// Adjusts <see cref="Drawable.Blending"/> after a delay.
/// </summary>
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
public static TransformSequence<T> TransformBlendingMode<T>(this T drawable, BlendingMode newValue, double delay = 0)
public static TransformSequence<T> TransformBlendingMode<T>(this T drawable, BlendingParameters newValue, double delay = 0)
where T : Drawable
=> drawable.TransformTo(drawable.PopulateTransform(new TransformBlendingMode(), newValue, delay));
=> drawable.TransformTo(drawable.PopulateTransform(new TransformBlendingParameters(), newValue, delay));
}
public class TransformBlendingMode : Transform<BlendingMode, Drawable>
public class TransformBlendingParameters : Transform<BlendingParameters, Drawable>
{
private BlendingMode valueAt(double time)
private BlendingParameters valueAt(double time)
=> time < EndTime ? StartValue : EndValue;
public override string TargetMember => nameof(Drawable.Blending);
protected override void Apply(Drawable d, double time) => d.Blending = valueAt(time);
protected override void ReadIntoStartValue(Drawable d) => StartValue = d.Blending.Mode;
protected override void ReadIntoStartValue(Drawable d) => StartValue = d.Blending;
}
}

View File

@ -69,7 +69,7 @@ namespace osu.Game.Storyboards
applyCommands(drawable, getCommands(g => g.Rotation, triggeredGroups), (d, value) => d.Rotation = value, (d, value, duration, easing) => d.RotateTo(value, duration, easing));
applyCommands(drawable, getCommands(g => g.Colour, triggeredGroups), (d, value) => d.Colour = value, (d, value, duration, easing) => d.FadeColour(value, duration, easing));
applyCommands(drawable, getCommands(g => g.Alpha, triggeredGroups), (d, value) => d.Alpha = value, (d, value, duration, easing) => d.FadeTo(value, duration, easing));
applyCommands(drawable, getCommands(g => g.BlendingMode, triggeredGroups), (d, value) => d.Blending = value, (d, value, duration, easing) => d.TransformBlendingMode(value, duration), false);
applyCommands(drawable, getCommands(g => g.BlendingParameters, triggeredGroups), (d, value) => d.Blending = value, (d, value, duration, easing) => d.TransformBlendingMode(value, duration), false);
if (drawable is IFlippable flippable)
{

View File

@ -15,7 +15,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.809.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.814.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.821.0" />
<PackageReference Include="SharpCompress" Version="0.23.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />

View File

@ -118,8 +118,8 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.809.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.814.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.814.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.821.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.821.0" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.11.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />