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

Improve osu!catch "argon" skin bananas #20993

Merged
merged 7 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1021.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1027.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1028.0" />
</ItemGroup>
<ItemGroup Label="Transitive Dependencies">
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
Expand Down
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Catch/Objects/Drawables/CaughtObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public abstract class CaughtObject : SkinnableDrawable, IHasCatchObjectState

public float DisplayRotation => Rotation;

public double DisplayStartTime => HitObject.StartTime;

/// <summary>
/// Whether this hit object should stay on the catcher plate when the object is caught by the catcher.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public abstract class DrawablePalpableCatchHitObject : DrawableCatchHitObject, I
{
public new PalpableCatchHitObject HitObject => (PalpableCatchHitObject)base.HitObject;

public double DisplayStartTime => LifetimeStart;

Bindable<Color4> IHasCatchObjectState.AccentColour => AccentColour;

public Bindable<bool> HyperDash { get; } = new Bindable<bool>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public interface IHasCatchObjectState
{
PalpableCatchHitObject HitObject { get; }

double DisplayStartTime { get; }

Bindable<Color4> AccentColour { get; }

Bindable<bool> HyperDash { get; }
Expand Down
98 changes: 69 additions & 29 deletions osu.Game.Rulesets.Catch/Skinning/Argon/ArgonBananaPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,67 @@
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Objects;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Rulesets.Catch.Skinning.Argon
{
internal class ArgonBananaPiece : ArgonFruitPiece
{
private Container stabilisedPieceContainer = null!;

private Drawable fadeContent = null!;

[BackgroundDependencyLoader]
private void load()
{
AddInternal(new UprightAspectMaintainingContainer
AddInternal(fadeContent = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new Circle
stabilisedPieceContainer = new Container
{
Colour = Color4.White.Opacity(0.4f),
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Blending = BlendingParameters.Additive,
Size = new Vector2(8),
Scale = new Vector2(30, 1),
},
new Box
{
Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White),
RelativeSizeAxes = Axes.X,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
Width = 1.6f,
Height = 2,
},
new Box
{
Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.White.Opacity(0)),
RelativeSizeAxes = Axes.X,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
Width = 1.6f,
Height = 2,
Children = new Drawable[]
{
new Circle
{
Colour = Color4.White.Opacity(0.4f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Blending = BlendingParameters.Additive,
Size = new Vector2(8),
Scale = new Vector2(25, 1),
},
new Box
{
Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.8f)),
RelativeSizeAxes = Axes.X,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
Width = 1.6f,
Height = 2,
},
new Circle
{
Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0.8f), Color4.White.Opacity(0)),
RelativeSizeAxes = Axes.X,
Blending = BlendingParameters.Additive,
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
Width = 1.6f,
Height = 2,
},
}
},
new Circle
{
Expand All @@ -78,5 +91,32 @@ private void load()
}
});
}

protected override void Update()
{
base.Update();

const float parent_scale_application = 0.4f;

// relative to time on screen
const float lens_flare_start = 0.3f;
const float lens_flare_end = 0.8f;

// Undo some of the parent scale being applied to make the lens flare feel a bit better..
float scale = parent_scale_application + (1 - parent_scale_application) * (1 / (ObjectState.DisplaySize.X / (CatchHitObject.OBJECT_RADIUS * 2)));

stabilisedPieceContainer.Rotation = -ObjectState.DisplayRotation;
stabilisedPieceContainer.Scale = new Vector2(scale, 1);

double duration = ObjectState.HitObject.StartTime - ObjectState.DisplayStartTime;

fadeContent.Alpha = MathHelper.Clamp(
Interpolation.ValueAt(
Time.Current, 1f, 0f,
ObjectState.DisplayStartTime + duration * lens_flare_start,
ObjectState.DisplayStartTime + duration * lens_flare_end,
bdach marked this conversation as resolved.
Show resolved Hide resolved
Easing.OutQuint
), 0, 1);
}
}
}
6 changes: 2 additions & 4 deletions osu.Game.Rulesets.Catch/Skinning/Default/BananaPiece.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using osu.Framework.Graphics;

namespace osu.Game.Rulesets.Catch.Skinning.Default
{
public class BananaPiece : CatchHitObjectPiece
{
protected override BorderPiece BorderPiece { get; }
protected override Drawable BorderPiece { get; }

public BananaPiece()
{
RelativeSizeAxes = Axes.Both;

InternalChildren = new Drawable[]
InternalChildren = new[]
{
new BananaPulpFormation
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class CatchHitObjectPiece : CompositeDrawable
/// A part of this piece that will be faded out while falling in the playfield.
/// </summary>
[CanBeNull]
protected virtual BorderPiece BorderPiece => null;
protected virtual Drawable BorderPiece => null;

/// <summary>
/// A part of this piece that will be only visible when <see cref="HyperDash"/> is true.
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Catch/Skinning/Default/FruitPiece.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class FruitPiece : CatchHitObjectPiece

public readonly Bindable<FruitVisualRepresentation> VisualRepresentation = new Bindable<FruitVisualRepresentation>();

protected override BorderPiece BorderPiece { get; }
protected override Drawable BorderPiece { get; }
protected override Drawable HyperBorderPiece { get; }

public FruitPiece()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public override void ClearTransformsAfter(double time, bool propagateChildren =
public override void ApplyTransformsAt(double time, bool propagateChildren = false)
{
// For the same reasons as above w.r.t rewinding, we shouldn't propagate to children here either.
// ReSharper disable once RedundantArgumentDefaultValue - removing the "redundant" default value triggers BaseMethodCallWithDefaultParameter

// ReSharper disable once RedundantArgumentDefaultValue
base.ApplyTransformsAt(time, false);
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tests/Collections/IO/ImportCollectionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public async Task TestSaveAndReload()
}

// Name matches the automatically chosen name from `CleanRunHeadlessGameHost` above, so we end up using the same storage location.
using (HeadlessGameHost host = new TestRunHeadlessGameHost(firstRunName, null))
using (HeadlessGameHost host = new TestRunHeadlessGameHost(firstRunName))
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void TestDefaultDirectory()
[Test]
public void TestCustomDirectory()
{
using (HeadlessGameHost host = new TestRunHeadlessGameHost(nameof(TestCustomDirectory), null)) // don't use clean run as we are writing a config file.
using (HeadlessGameHost host = new TestRunHeadlessGameHost(nameof(TestCustomDirectory))) // don't use clean run as we are writing a config file.
{
string osuDesktopStorage = Path.Combine(host.UserStoragePaths.First(), nameof(TestCustomDirectory));
const string custom_tournament = "custom";
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tournament.Tests/NonVisual/IPCLocationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class IPCLocationTest : TournamentHostTest
public void CheckIPCLocation()
{
// don't use clean run because files are being written before osu! launches.
using (var host = new TestRunHeadlessGameHost(nameof(CheckIPCLocation), null))
using (var host = new TestRunHeadlessGameHost(nameof(CheckIPCLocation)))
{
string basePath = Path.Combine(host.UserStoragePaths.First(), nameof(CheckIPCLocation));

Expand Down
2 changes: 1 addition & 1 deletion osu.Game/osu.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Realm" Version="10.17.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1027.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1028.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1021.0" />
<PackageReference Include="Sentry" Version="3.22.0" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
Expand Down
4 changes: 2 additions & 2 deletions osu.iOS.props
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1021.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.1027.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.1028.0" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
<PropertyGroup>
Expand All @@ -82,7 +82,7 @@
<PackageReference Include="DiffPlex" Version="1.7.1" />
<PackageReference Include="Humanizer" Version="2.14.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1027.0" />
<PackageReference Include="ppy.osu.Framework" Version="2022.1028.0" />
<PackageReference Include="SharpCompress" Version="0.32.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
Expand Down