Add judgement text displays to osu!mania

This commit is contained in:
smoogipooo 2017-09-11 17:53:27 +09:00
parent 54aff432fe
commit df0a31bf2a
4 changed files with 64 additions and 3 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Extensions;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
@ -33,9 +34,9 @@ public class ManiaJudgement : Judgement
/// </summary>
public int MaxResultValueForAccuracy => NumericResultForAccuracy(MAX_HIT_RESULT);
public override string ResultString => string.Empty;
public override string ResultString => ManiaResult.GetDescription();
public override string MaxResultString => string.Empty;
public override string MaxResultString => MAX_HIT_RESULT.GetDescription();
/// <summary>
/// The hit result.

View File

@ -0,0 +1,38 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.UI
{
internal class DrawableManiaJudgement : DrawableJudgement<ManiaJudgement>
{
public DrawableManiaJudgement(ManiaJudgement judgement)
: base(judgement)
{
JudgementText.TextSize = 25;
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeInFromZero(50, Easing.OutQuint);
switch (Judgement.Result)
{
case HitResult.Hit:
this.ScaleTo(0.8f);
this.ScaleTo(1, 250, Easing.OutElastic);
this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250);
break;
}
Expire();
}
}
}

View File

@ -53,6 +53,8 @@ public SpecialColumnPosition SpecialColumnPosition
private List<Color4> normalColumnColours = new List<Color4>();
private Color4 specialColumnColour;
private readonly Container<DrawableManiaJudgement> judgements;
private readonly int columnCount;
public ManiaPlayfield(int columnCount)
@ -120,6 +122,14 @@ public ManiaPlayfield(int columnCount)
Padding = new MarginPadding { Top = HIT_TARGET_POSITION }
}
},
judgements = new Container<DrawableManiaJudgement>
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Y = HIT_TARGET_POSITION + 150,
BypassAutoSizeAxes = Axes.Both
},
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
}
}
@ -147,6 +157,7 @@ public ManiaPlayfield(int columnCount)
private void invertedChanged(bool newValue)
{
Scale = new Vector2(1, newValue ? -1 : 1);
judgements.Scale = Scale;
}
[BackgroundDependencyLoader]
@ -181,7 +192,17 @@ private void load(OsuColour colours)
}
}
public override void OnJudgement(DrawableHitObject<ManiaHitObject, ManiaJudgement> judgedObject) => columns[judgedObject.HitObject.Column].OnJudgement(judgedObject);
public override void OnJudgement(DrawableHitObject<ManiaHitObject, ManiaJudgement> judgedObject)
{
columns[judgedObject.HitObject.Column].OnJudgement(judgedObject);
judgements.Clear();
judgements.Add(new DrawableManiaJudgement(judgedObject.Judgement)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
}
/// <summary>
/// Whether the column index is a special column for this playfield.

View File

@ -83,6 +83,7 @@
<Compile Include="Timing\GravityScrollingContainer.cs" />
<Compile Include="Timing\ScrollingAlgorithm.cs" />
<Compile Include="UI\Column.cs" />
<Compile Include="UI\DrawableManiaJudgement.cs" />
<Compile Include="UI\HitExplosion.cs" />
<Compile Include="UI\ManiaRulesetContainer.cs" />
<Compile Include="UI\ManiaPlayfield.cs" />