mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Move offset into legacy mania judgement
This commit is contained in:
parent
ca11eeefdf
commit
1794bfeddb
@ -0,0 +1,84 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ using osu.Game.Rulesets.Judgements;
|
|||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.Skinning;
|
|
||||||
using osu.Game.Rulesets.Mania.UI.Components;
|
using osu.Game.Rulesets.Mania.UI.Components;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -107,6 +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
|
||||||
},
|
},
|
||||||
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
|
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
|
||||||
}
|
}
|
||||||
@ -181,12 +181,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSkinChanged()
|
|
||||||
{
|
|
||||||
judgements.Y = CurrentSkin.GetManiaSkinConfig<float>(LegacyManiaSkinConfigurationLookups.ScorePosition)
|
|
||||||
?.Value ?? HIT_TARGET_POSITION + 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
// Due to masking differences, it is not possible to get the width of the columns container automatically
|
// Due to masking differences, it is not possible to get the width of the columns container automatically
|
||||||
|
@ -20,20 +20,11 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IScrollingInfo ScrollingInfo { get; private set; }
|
protected IScrollingInfo ScrollingInfo { get; private set; }
|
||||||
protected ISkinSource CurrentSkin { get; private set; }
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin)
|
private void load(ISkinSource skin)
|
||||||
{
|
{
|
||||||
Direction.BindTo(ScrollingInfo.Direction);
|
Direction.BindTo(ScrollingInfo.Direction);
|
||||||
CurrentSkin = skin;
|
|
||||||
|
|
||||||
skin.SourceChanged += OnSkinChanged;
|
|
||||||
OnSkinChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnSkinChanged()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user