mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 02:27:25 +08:00
Use mania-specific judgement sprites for mania (#7365)
Use mania-specific judgement sprites for mania Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
84c10728d8
@ -53,7 +53,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1215.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.1225.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
46
osu.Game.Rulesets.Mania.Tests/SkinnableTestScene.cs
Normal file
46
osu.Game.Rulesets.Mania.Tests/SkinnableTestScene.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// 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.Audio;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
public abstract class SkinnableTestScene : OsuGridTestScene
|
||||||
|
{
|
||||||
|
private Skin defaultSkin;
|
||||||
|
|
||||||
|
protected SkinnableTestScene()
|
||||||
|
: base(1, 2)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio, SkinManager skinManager)
|
||||||
|
{
|
||||||
|
defaultSkin = skinManager.GetSkin(DefaultLegacySkin.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetContents(Func<Drawable> creationFunction)
|
||||||
|
{
|
||||||
|
Cell(0).Child = createProvider(null, creationFunction);
|
||||||
|
Cell(1).Child = createProvider(defaultSkin, creationFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable createProvider(Skin skin, Func<Drawable> creationFunction)
|
||||||
|
{
|
||||||
|
var mainProvider = new SkinProvidingContainer(skin);
|
||||||
|
|
||||||
|
return mainProvider
|
||||||
|
.WithChild(new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider))
|
||||||
|
{
|
||||||
|
Child = creationFunction()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
37
osu.Game.Rulesets.Mania.Tests/TestSceneDrawableJudgement.cs
Normal file
37
osu.Game.Rulesets.Mania.Tests/TestSceneDrawableJudgement.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// 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.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests
|
||||||
|
{
|
||||||
|
public class TestSceneDrawableJudgement : SkinnableTestScene
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(DrawableJudgement),
|
||||||
|
typeof(DrawableManiaJudgement)
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestSceneDrawableJudgement()
|
||||||
|
{
|
||||||
|
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
|
||||||
|
{
|
||||||
|
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
|
||||||
|
new DrawableManiaJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,9 @@ using osu.Game.Rulesets.Mania.Configuration;
|
|||||||
using osu.Game.Rulesets.Mania.Difficulty;
|
using osu.Game.Rulesets.Mania.Difficulty;
|
||||||
using osu.Game.Rulesets.Mania.Edit;
|
using osu.Game.Rulesets.Mania.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
|
using osu.Game.Rulesets.Mania.Skinning;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania
|
namespace osu.Game.Rulesets.Mania
|
||||||
@ -47,6 +49,8 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
|
|
||||||
public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this);
|
public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this);
|
||||||
|
|
||||||
|
public override ISkin CreateLegacySkinProvider(ISkinSource source) => new ManiaLegacySkinTransformer(source);
|
||||||
|
|
||||||
public override IEnumerable<Mod> ConvertLegacyMods(LegacyMods mods)
|
public override IEnumerable<Mod> ConvertLegacyMods(LegacyMods mods)
|
||||||
{
|
{
|
||||||
if (mods.HasFlag(LegacyMods.Nightcore))
|
if (mods.HasFlag(LegacyMods.Nightcore))
|
||||||
|
@ -0,0 +1,67 @@
|
|||||||
|
// 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 osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Audio;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Skinning
|
||||||
|
{
|
||||||
|
public class ManiaLegacySkinTransformer : ISkin
|
||||||
|
{
|
||||||
|
private readonly ISkin source;
|
||||||
|
|
||||||
|
public ManiaLegacySkinTransformer(ISkin source)
|
||||||
|
{
|
||||||
|
this.source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable GetDrawableComponent(ISkinComponent component)
|
||||||
|
{
|
||||||
|
switch (component)
|
||||||
|
{
|
||||||
|
case GameplaySkinComponent<HitResult> resultComponent:
|
||||||
|
return getResult(resultComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Drawable getResult(GameplaySkinComponent<HitResult> resultComponent)
|
||||||
|
{
|
||||||
|
switch (resultComponent.Component)
|
||||||
|
{
|
||||||
|
case HitResult.Miss:
|
||||||
|
return this.GetAnimation("mania-hit0", true, true);
|
||||||
|
|
||||||
|
case HitResult.Meh:
|
||||||
|
return this.GetAnimation("mania-hit50", true, true);
|
||||||
|
|
||||||
|
case HitResult.Ok:
|
||||||
|
return this.GetAnimation("mania-hit100", true, true);
|
||||||
|
|
||||||
|
case HitResult.Good:
|
||||||
|
return this.GetAnimation("mania-hit200", true, true);
|
||||||
|
|
||||||
|
case HitResult.Great:
|
||||||
|
return this.GetAnimation("mania-hit300", true, true);
|
||||||
|
|
||||||
|
case HitResult.Perfect:
|
||||||
|
return this.GetAnimation("mania-hit300g", true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Texture GetTexture(string componentName) => source.GetTexture(componentName);
|
||||||
|
|
||||||
|
public SampleChannel GetSample(ISampleInfo sample) => source.GetSample(sample);
|
||||||
|
|
||||||
|
public IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) =>
|
||||||
|
source.GetConfig<TLookup, TValue>(lookup);
|
||||||
|
}
|
||||||
|
}
|
@ -22,7 +22,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1215.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.1225.0" />
|
||||||
<PackageReference Include="Sentry" Version="1.2.0" />
|
<PackageReference Include="Sentry" Version="1.2.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
<PackageReference Include="SharpCompress" Version="0.24.0" />
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1215.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.1227.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1225.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.1225.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
|
Loading…
Reference in New Issue
Block a user