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

Add maximum dimensions limit to skinnable gameplay elements #24706

Merged
merged 23 commits into from
Sep 26, 2023
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2c81fe5
Make gameplay skin elements in `special-skin` awfully large
frenzibyte Sep 1, 2023
6674c70
Add support for limiting skin texture/animation dimensions
frenzibyte Sep 2, 2023
351081e
Add limit to osu! hit circle elements
frenzibyte Sep 2, 2023
d286816
Add limit to taiko hit elements
frenzibyte Sep 2, 2023
f182f57
Add limit to catch palpable object elements
frenzibyte Sep 2, 2023
96f12cf
Update `GetTexture` signature rather than creating new overload
peppy Sep 5, 2023
9d17539
Add size limitations for taiko drum rolls
peppy Sep 5, 2023
57dc76b
Revert "Update `GetTexture` signature rather than creating new overload"
frenzibyte Sep 19, 2023
291a91b
Change extension from retrieval to post-processing instead
frenzibyte Sep 19, 2023
a373d71
Add basic test scene upscaling all skin elements
frenzibyte Sep 19, 2023
fc1a39e
Add size limitations for slider balls
frenzibyte Sep 19, 2023
f963a92
Add size limitation for slider follow circle
frenzibyte Sep 19, 2023
b823507
Add size limitation for approach circles
frenzibyte Sep 19, 2023
ab52268
Add size limitation for slider reverse arrow piece
frenzibyte Sep 19, 2023
922f6f3
Add size limitation for hit object numbers
frenzibyte Sep 19, 2023
8f5d1b5
Revert "Make gameplay skin elements in `special-skin` awfully large"
frenzibyte Sep 19, 2023
8e16b1d
Simplify some maximum size specs
peppy Sep 20, 2023
bd66285
Rename parameter on `LegacySpriteText` to better imply the maximum si…
peppy Sep 20, 2023
1316403
Fix inspection in new test scene
peppy Sep 20, 2023
c4fc419
Use correct maximum size for droplets
frenzibyte Sep 21, 2023
ad86bf2
Revert redundant size limitations
frenzibyte Sep 21, 2023
b1561b6
Rename test scene, add xmldoc and increase scale factor to something …
peppy Sep 26, 2023
990c545
Merge branch 'master' into limit-gameplay-sprite-dimensions
peppy Sep 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Framework.Testing;
using osu.Game.IO;
using osu.Game.Rulesets;
using osu.Game.Screens.Play;
using osu.Game.Skinning;

namespace osu.Game.Tests.Visual.Gameplay
{
public partial class TestSceneGameplayElementDimensions : TestSceneAllRulesetPlayers
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What on earth is this naming..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I...don't know?

{
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));

// for now this only applies to legacy skins, as modern skins don't have texture-based gameplay elements yet.
dependencies.CacheAs<ISkinSource>(new UpscaledLegacySkin(dependencies.Get<SkinManager>()));

return dependencies;
}

protected override void AddCheckSteps()
{
}

protected override Player CreatePlayer(Ruleset ruleset)
{
var player = base.CreatePlayer(ruleset);
player.OnLoadComplete += _ =>
{
// this test scene focuses on gameplay elements, so let's hide the hud.
var hudOverlay = player.ChildrenOfType<HUDOverlay>().Single();
hudOverlay.ShowHud.Value = false;
hudOverlay.ShowHud.Disabled = true;
};
return player;
}

private class UpscaledLegacySkin : DefaultLegacySkin, ISkinSource
{
public UpscaledLegacySkin(IStorageResourceProvider resources)
: base(resources)
{
}

public event Action? SourceChanged
{
add { }
remove { }
}

public override Texture? GetTexture(string componentName, WrapMode wrapModeS, WrapMode wrapModeT)
{
var texture = base.GetTexture(componentName, wrapModeS, wrapModeT);

if (texture != null)
texture.ScaleAdjust /= 5f;

return texture;
}

public ISkin? FindProvider(Func<ISkin, bool> lookupFunction) => this;

Check failure on line 69 in osu.Game.Tests/Visual/Gameplay/TestSceneGameplayElementDimensions.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Return type of 'FindProvider' can be non-nullable in osu.Game.Tests\Visual\Gameplay\TestSceneGameplayElementDimensions.cs on line 69
public IEnumerable<ISkin> AllSources => new[] { this };
}
}
}