mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 21:23:04 +08:00
Merge pull request #11167 from Firmatorenio/mania-legacyskin-scoreposition
Adjust mania judgement position in legacy skins according to their ScorePosition setting
This commit is contained in:
commit
558955d65d
@ -0,0 +1,90 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Animations;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
||||||
|
{
|
||||||
|
public class LegacyManiaJudgementPiece : CompositeDrawable, IAnimatableJudgement
|
||||||
|
{
|
||||||
|
private readonly HitResult result;
|
||||||
|
private readonly Drawable animation;
|
||||||
|
|
||||||
|
public LegacyManiaJudgementPiece(HitResult result, Drawable animation)
|
||||||
|
{
|
||||||
|
this.result = result;
|
||||||
|
this.animation = animation;
|
||||||
|
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ISkinSource skin)
|
||||||
|
{
|
||||||
|
float? scorePosition = skin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.ScorePosition)?.Value;
|
||||||
|
|
||||||
|
if (scorePosition != null)
|
||||||
|
scorePosition -= Stage.HIT_TARGET_POSITION + 150;
|
||||||
|
|
||||||
|
Y = scorePosition ?? 0;
|
||||||
|
|
||||||
|
if (animation != null)
|
||||||
|
{
|
||||||
|
InternalChild = animation.With(d =>
|
||||||
|
{
|
||||||
|
d.Anchor = Anchor.Centre;
|
||||||
|
d.Origin = Anchor.Centre;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PlayAnimation()
|
||||||
|
{
|
||||||
|
if (animation == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
(animation as IFramedAnimation)?.GotoFrame(0);
|
||||||
|
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case HitResult.None:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HitResult.Miss:
|
||||||
|
animation.ScaleTo(1.6f);
|
||||||
|
animation.ScaleTo(1, 100, Easing.In);
|
||||||
|
|
||||||
|
animation.MoveTo(Vector2.Zero);
|
||||||
|
animation.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
|
||||||
|
|
||||||
|
animation.RotateTo(0);
|
||||||
|
animation.RotateTo(40, 800, Easing.InQuint);
|
||||||
|
|
||||||
|
this.FadeOutFromOne(800);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
animation.ScaleTo(0.8f);
|
||||||
|
animation.ScaleTo(1, 250, Easing.OutElastic);
|
||||||
|
|
||||||
|
animation.Delay(50).ScaleTo(0.75f, 250);
|
||||||
|
|
||||||
|
this.Delay(50).FadeOut(200);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable GetAboveHitObjectsProxiedContent() => null;
|
||||||
|
}
|
||||||
|
}
|
@ -136,7 +136,8 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
|||||||
string filename = this.GetManiaSkinConfig<string>(hitresult_mapping[result])?.Value
|
string filename = this.GetManiaSkinConfig<string>(hitresult_mapping[result])?.Value
|
||||||
?? default_hitresult_skin_filenames[result];
|
?? default_hitresult_skin_filenames[result];
|
||||||
|
|
||||||
return this.GetAnimation(filename, true, true);
|
var animation = this.GetAnimation(filename, true, true);
|
||||||
|
return animation == null ? null : new LegacyManiaJudgementPiece(result, animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SampleChannel GetSample(ISampleInfo sampleInfo)
|
public override SampleChannel GetSample(ISampleInfo sampleInfo)
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
@ -20,37 +19,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyMissAnimations()
|
|
||||||
{
|
|
||||||
if (!(JudgementBody.Drawable is DefaultManiaJudgementPiece))
|
|
||||||
{
|
|
||||||
// this is temporary logic until mania's skin transformer returns IAnimatableJudgements
|
|
||||||
JudgementBody.ScaleTo(1.6f);
|
|
||||||
JudgementBody.ScaleTo(1, 100, Easing.In);
|
|
||||||
|
|
||||||
JudgementBody.MoveTo(Vector2.Zero);
|
|
||||||
JudgementBody.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
|
|
||||||
|
|
||||||
JudgementBody.RotateTo(0);
|
|
||||||
JudgementBody.RotateTo(40, 800, Easing.InQuint);
|
|
||||||
JudgementBody.FadeOutFromOne(800);
|
|
||||||
|
|
||||||
LifetimeEnd = JudgementBody.LatestTransformEndTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
base.ApplyMissAnimations();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ApplyHitAnimations()
|
|
||||||
{
|
|
||||||
JudgementBody.ScaleTo(0.8f);
|
|
||||||
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
|
|
||||||
|
|
||||||
JudgementBody.Delay(50)
|
|
||||||
.ScaleTo(0.75f, 250)
|
|
||||||
.FadeOut(200);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result);
|
protected override Drawable CreateDefaultJudgement(HitResult result) => new DefaultManiaJudgementPiece(result);
|
||||||
|
|
||||||
private class DefaultManiaJudgementPiece : DefaultJudgementPiece
|
private class DefaultManiaJudgementPiece : DefaultJudgementPiece
|
||||||
@ -66,6 +34,27 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
JudgementText.Font = JudgementText.Font.With(size: 25);
|
JudgementText.Font = JudgementText.Font.With(size: 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void PlayAnimation()
|
||||||
|
{
|
||||||
|
base.PlayAnimation();
|
||||||
|
|
||||||
|
switch (Result)
|
||||||
|
{
|
||||||
|
case HitResult.None:
|
||||||
|
case HitResult.Miss:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this.ScaleTo(0.8f);
|
||||||
|
this.ScaleTo(1, 250, Easing.OutElastic);
|
||||||
|
|
||||||
|
this.Delay(50)
|
||||||
|
.ScaleTo(0.75f, 250)
|
||||||
|
.FadeOut(200);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Y = HIT_TARGET_POSITION + 150,
|
Y = HIT_TARGET_POSITION + 150
|
||||||
},
|
},
|
||||||
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
|
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR;
|
public float HitPosition = (480 - 402) * POSITION_SCALE_FACTOR;
|
||||||
public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR;
|
public float LightPosition = (480 - 413) * POSITION_SCALE_FACTOR;
|
||||||
|
public float ScorePosition = 300 * POSITION_SCALE_FACTOR;
|
||||||
public bool ShowJudgementLine = true;
|
public bool ShowJudgementLine = true;
|
||||||
public bool KeysUnderNotes;
|
public bool KeysUnderNotes;
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ namespace osu.Game.Skinning
|
|||||||
LeftLineWidth,
|
LeftLineWidth,
|
||||||
RightLineWidth,
|
RightLineWidth,
|
||||||
HitPosition,
|
HitPosition,
|
||||||
|
ScorePosition,
|
||||||
LightPosition,
|
LightPosition,
|
||||||
HitTargetImage,
|
HitTargetImage,
|
||||||
ShowJudgementLine,
|
ShowJudgementLine,
|
||||||
|
@ -94,6 +94,10 @@ namespace osu.Game.Skinning
|
|||||||
currentConfig.LightPosition = (480 - float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
currentConfig.LightPosition = (480 - float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "ScorePosition":
|
||||||
|
currentConfig.ScorePosition = (float.Parse(pair.Value, CultureInfo.InvariantCulture)) * LegacyManiaSkinConfiguration.POSITION_SCALE_FACTOR;
|
||||||
|
break;
|
||||||
|
|
||||||
case "JudgementLine":
|
case "JudgementLine":
|
||||||
currentConfig.ShowJudgementLine = pair.Value == "1";
|
currentConfig.ShowJudgementLine = pair.Value == "1";
|
||||||
break;
|
break;
|
||||||
|
@ -169,6 +169,9 @@ namespace osu.Game.Skinning
|
|||||||
case LegacyManiaSkinConfigurationLookups.HitPosition:
|
case LegacyManiaSkinConfigurationLookups.HitPosition:
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.HitPosition));
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.HitPosition));
|
||||||
|
|
||||||
|
case LegacyManiaSkinConfigurationLookups.ScorePosition:
|
||||||
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.ScorePosition));
|
||||||
|
|
||||||
case LegacyManiaSkinConfigurationLookups.LightPosition:
|
case LegacyManiaSkinConfigurationLookups.LightPosition:
|
||||||
return SkinUtils.As<TValue>(new Bindable<float>(existing.LightPosition));
|
return SkinUtils.As<TValue>(new Bindable<float>(existing.LightPosition));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user