1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-20 04:33:52 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into page-selector

This commit is contained in:
Andrei Zavatski 2019-09-10 01:18:04 +03:00
commit f5d54f8830
29 changed files with 78 additions and 38 deletions

View File

@ -1,5 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputPath>bin\$(Configuration)</OutputPath> <OutputPath>bin\$(Configuration)</OutputPath>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
@ -35,7 +37,7 @@
<DebugType>None</DebugType> <DebugType>None</DebugType>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<EnableLLVM>true</EnableLLVM> <EnableLLVM>true</EnableLLVM>
<AndroidManagedSymbols>false</AndroidManagedSymbols> <AndroidManagedSymbols>false</AndroidManagedSymbols>
<AndroidLinkMode>SdkOnly</AndroidLinkMode> <AndroidLinkMode>SdkOnly</AndroidLinkMode>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@ -26,12 +26,12 @@ namespace osu.Game.Rulesets.Osu.Tests
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio, SkinManager skinManager)
{ {
var dllStore = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll"); var dllStore = new DllResourceStore("osu.Game.Rulesets.Osu.Tests.dll");
metricsSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/metrics_skin"), audio, true); 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); defaultSkin = skinManager.GetSkin(DefaultLegacySkin.Info);
specialSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true); specialSkin = new TestLegacySkin(new SkinInfo(), new NamespacedResourceStore<byte[]>(dllStore, "Resources/special_skin"), audio, true);
} }

View File

@ -6,23 +6,68 @@ using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Testing.Input;
using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Rulesets.Osu.UI.Cursor;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests namespace osu.Game.Rulesets.Osu.Tests
{ {
[TestFixture] [TestFixture]
public class TestSceneGameplayCursor : SkinnableTestScene public class TestSceneGameplayCursor : SkinnableTestScene
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) }; public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(OsuCursorContainer),
typeof(CursorTrail)
};
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new OsuCursorContainer SetContents(() => new MovingCursorInputManager
{ {
RelativeSizeAxes = Axes.Both, Child = new ClickingCursorContainer
Masking = true, {
RelativeSizeAxes = Axes.Both,
Masking = true,
}
}); });
} }
private class ClickingCursorContainer : OsuCursorContainer
{
protected override void Update()
{
base.Update();
double currentTime = Time.Current;
if (((int)(currentTime / 1000)) % 2 == 0)
OnPressed(OsuAction.LeftButton);
else
OnReleased(OsuAction.LeftButton);
}
}
private class MovingCursorInputManager : ManualInputManager
{
public MovingCursorInputManager()
{
UseParentInput = false;
}
protected override void Update()
{
base.Update();
const double spin_duration = 5000;
double currentTime = Time.Current;
double angle = (currentTime % spin_duration) / spin_duration * 2 * Math.PI;
Vector2 rPos = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));
MoveMouseTo(ToScreenSpace(DrawSize / 2 + DrawSize / 3 * rPos));
}
}
} }
} }

View File

@ -22,28 +22,14 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
internal class CursorTrail : Drawable, IRequireHighFrequencyMousePosition internal class CursorTrail : Drawable, IRequireHighFrequencyMousePosition
{ {
private int currentIndex;
private IShader shader;
private Texture texture;
private Vector2 size => texture.Size * Scale;
private double timeOffset;
private float time;
public override bool IsPresent => true;
private const int max_sprites = 2048; private const int max_sprites = 2048;
private readonly TrailPart[] parts = new TrailPart[max_sprites]; private readonly TrailPart[] parts = new TrailPart[max_sprites];
private int currentIndex;
private Vector2? lastPosition; private IShader shader;
private Texture texture;
private readonly InputResampler resampler = new InputResampler(); private double timeOffset;
private float time;
protected override DrawNode CreateDrawNode() => new TrailDrawNode(this);
public CursorTrail() public CursorTrail()
{ {
@ -60,8 +46,6 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
} }
} }
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures) private void load(ShaderManager shaders, TextureStore textures)
{ {
@ -76,6 +60,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
resetTime(); resetTime();
} }
public override bool IsPresent => true;
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -101,6 +87,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
timeOffset = Time.Current; timeOffset = Time.Current;
} }
private Vector2 size => texture.Size * Scale;
private Vector2? lastPosition;
private readonly InputResampler resampler = new InputResampler();
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
protected override bool OnMouseMove(MouseMoveEvent e) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
Vector2 pos = e.ScreenSpaceMousePosition; Vector2 pos = e.ScreenSpaceMousePosition;
@ -127,21 +120,19 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
for (float d = interval; d < distance; d += interval) for (float d = interval; d < distance; d += interval)
{ {
lastPosition = pos1 + direction * d; lastPosition = pos1 + direction * d;
addPosition(lastPosition.Value);
parts[currentIndex].Position = lastPosition.Value;
parts[currentIndex].Time = time;
++parts[currentIndex].InvalidationID;
currentIndex = (currentIndex + 1) % max_sprites;
} }
} }
return base.OnMouseMove(e); return base.OnMouseMove(e);
} }
private void addPosition(Vector2 pos) protected override DrawNode CreateDrawNode() => new TrailDrawNode(this);
{
parts[currentIndex].Position = pos;
parts[currentIndex].Time = time;
++parts[currentIndex].InvalidationID;
currentIndex = (currentIndex + 1) % max_sprites;
}
private struct TrailPart private struct TrailPart
{ {

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Scoring
/// <summary> /// <summary>
/// The current health. /// The current health.
/// </summary> /// </summary>
public readonly BindableDouble Health = new BindableDouble { MinValue = 0, MaxValue = 1 }; public readonly BindableDouble Health = new BindableDouble(1) { MinValue = 0, MaxValue = 1 };
/// <summary> /// <summary>
/// The current combo. /// The current combo.
@ -233,6 +233,8 @@ namespace osu.Game.Rulesets.Scoring
drawableRuleset.OnRevertResult += revertResult; drawableRuleset.OnRevertResult += revertResult;
ApplyBeatmap(drawableRuleset.Beatmap); ApplyBeatmap(drawableRuleset.Beatmap);
Reset(false);
SimulateAutoplay(drawableRuleset.Beatmap); SimulateAutoplay(drawableRuleset.Beatmap);
Reset(true); Reset(true);