Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resume cursor 2 #5

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f0114d7
Use interface to access API
peppy Mar 13, 2019
6aa3dc9
Use non-real domain
smoogipoo Mar 13, 2019
7d63769
Use non-guest user ID for non-guest user
peppy Mar 13, 2019
8c6caf0
Update framework
peppy Mar 15, 2019
771d676
Split RulesetInputManager out to FrameStabilityContainer
peppy Mar 16, 2019
c496f6e
Fix usages of OnLoadComplete
peppy Mar 17, 2019
9ca4d9d
Remove regions
peppy Mar 18, 2019
107fb55
Merge pull request #4475 from peppy/frame-stability-container
smoogipoo Mar 18, 2019
e0b3149
Merge branch 'master' into api-testability
smoogipoo Mar 18, 2019
5692b85
Merge pull request #4465 from peppy/api-testability
smoogipoo Mar 18, 2019
392a0a1
Merge branch 'master' into update-framework
peppy Mar 18, 2019
9cabd12
Merge pull request #4473 from peppy/update-framework
smoogipoo Mar 18, 2019
8df47bc
Increase flexibility of player test cases
peppy Mar 18, 2019
a81461b
Add ability to test without nofail enabled
peppy Mar 18, 2019
15dd132
Use SetUpSteps attribute
peppy Mar 18, 2019
465c95e
Refactor pause logic so GameplayClockContainer is in control
peppy Mar 16, 2019
bcaff9f
Add basic pause tests
peppy Mar 17, 2019
f13003c
Simplify and localise storyboard logic in Player.cs
peppy Mar 18, 2019
536b5e0
Remove PausableGameplayContainer
peppy Mar 18, 2019
9433a97
Add resume requesting support and fix exit scenarios
peppy Mar 18, 2019
4f075f4
Add more comprehensive testing
peppy Mar 18, 2019
f56e8d9
Make tests better
peppy Mar 18, 2019
f35be9b
Move osu! cursor to its own class
peppy Mar 19, 2019
82f3ee6
osu! resume overlay
peppy Mar 19, 2019
fb5d19e
Ruleset implementation
peppy Mar 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace osu.Game.Rulesets.Catch.Tests
{
public class TestCaseAutoJuiceStream : TestCasePlayer
public class TestCaseAutoJuiceStream : PlayerTestCase
{
public TestCaseAutoJuiceStream()
: base(new CatchRuleset())
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestCaseBananaShower : Game.Tests.Visual.TestCasePlayer
public class TestCaseBananaShower : PlayerTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestCaseCatchPlayer : Game.Tests.Visual.TestCasePlayer
public class TestCaseCatchPlayer : PlayerTestCase
{
public TestCaseCatchPlayer()
: base(new CatchRuleset())
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Catch.Tests/TestCaseCatchStacker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestCaseCatchStacker : Game.Tests.Visual.TestCasePlayer
public class TestCaseCatchStacker : PlayerTestCase
{
public TestCaseCatchStacker()
: base(new CatchRuleset())
Expand Down
20 changes: 10 additions & 10 deletions osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Screens.Play;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestCaseHyperDash : Game.Tests.Visual.TestCasePlayer
public class TestCaseHyperDash : PlayerTestCase
{
public TestCaseHyperDash()
: base(new CatchRuleset())
{
}

[BackgroundDependencyLoader]
private void load()
{
AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash);
}

protected override IBeatmap CreateBeatmap(Ruleset ruleset)
{
var beatmap = new Beatmap
Expand All @@ -28,7 +34,7 @@ protected override IBeatmap CreateBeatmap(Ruleset ruleset)
}
};

// Should produce a hperdash
// Should produce a hyper-dash
beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true });
beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, });

Expand All @@ -38,11 +44,5 @@ protected override IBeatmap CreateBeatmap(Ruleset ruleset)

return beatmap;
}

protected override void AddCheckSteps(Func<Player> player)
{
base.AddCheckSteps(player);
AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash);
}
}
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch/UI/CatcherArea.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void runAfterLoaded(Action action)
if (lastPlateableFruit.IsLoaded)
action();
else
lastPlateableFruit.OnLoadComplete = _ => action();
lastPlateableFruit.OnLoadComplete += _ => action();
}

if (result.IsHit && fruit.CanBePlated)
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Visual;
using osuTK;

namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestCaseHitCircleLongCombo : Game.Tests.Visual.TestCasePlayer
public class TestCaseHitCircleLongCombo : PlayerTestCase
{
public TestCaseHitCircleLongCombo()
: base(new OsuRuleset())
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Game.Tests.Visual;

namespace osu.Game.Rulesets.Osu.Tests
{
[TestFixture]
public class TestCaseOsuPlayer : Game.Tests.Visual.TestCasePlayer
public class TestCaseOsuPlayer : PlayerTestCase
{
public TestCaseOsuPlayer()
: base(new OsuRuleset())
Expand Down
140 changes: 0 additions & 140 deletions osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursorContainer.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Bindings;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Osu.UI.Cursor
{
Expand Down Expand Up @@ -88,136 +79,5 @@ protected override void PopOut()
fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint);
ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint);
}

public class OsuCursor : SkinReloadableDrawable
{
private bool cursorExpand;

private Bindable<double> cursorScale;
private Bindable<bool> autoCursorScale;
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();

private Container expandTarget;
private Drawable scaleTarget;

public OsuCursor()
{
Origin = Anchor.Centre;
Size = new Vector2(28);
}

protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{
cursorExpand = skin.GetValue<SkinConfiguration, bool>(s => s.CursorExpand ?? true);
}

[BackgroundDependencyLoader]
private void load(OsuConfigManager config, IBindable<WorkingBeatmap> beatmap)
{
InternalChild = expandTarget = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Child = scaleTarget = new SkinnableDrawable("cursor", _ => new CircularContainer
{
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = Size.X / 6,
BorderColour = Color4.White,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Pink.Opacity(0.5f),
Radius = 5,
},
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true,
},
new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = Size.X / 3,
BorderColour = Color4.White.Opacity(0.5f),
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
AlwaysPresent = true,
},
},
},
new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.1f),
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
},
},
}
}, restrictSize: false)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
}
};

this.beatmap.BindTo(beatmap);
this.beatmap.ValueChanged += _ => calculateScale();

cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
cursorScale.ValueChanged += _ => calculateScale();

autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
autoCursorScale.ValueChanged += _ => calculateScale();

calculateScale();
}

private void calculateScale()
{
float scale = (float)cursorScale.Value;

if (autoCursorScale.Value && beatmap.Value != null)
{
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY);
}

scaleTarget.Scale = new Vector2(scale);
}

private const float pressed_scale = 1.2f;
private const float released_scale = 1f;

public void Expand()
{
if (!cursorExpand) return;

expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad);
}

public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
}
}
}
Loading