Merge pull request #3505 from qwewqa/judgement-cleanup

Move judgement text to internal container
This commit is contained in:
Dan Balasescu 2018-10-02 09:50:30 +09:00 committed by GitHub
commit 0d70306794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 23 deletions

View File

@ -30,10 +30,11 @@ namespace osu.Game.Rulesets.Mania.UI
if (Result.IsHit)
{
this.ScaleTo(0.8f);
this.ScaleTo(1, 250, Easing.OutElastic);
JudgementBody.ScaleTo(0.8f);
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250);
JudgementBody.Delay(50).ScaleTo(0.75f, 250);
this.Delay(50).FadeOut(200);
}
Expire();

View File

@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Taiko.UI
switch (Result.Type)
{
case HitResult.Good:
Colour = colours.GreenLight;
JudgementBody.Colour = colours.GreenLight;
break;
case HitResult.Great:
Colour = colours.BlueLight;
JudgementBody.Colour = colours.BlueLight;
break;
}
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Judgements
/// <summary>
/// A drawable object which visualises the hit result of a <see cref="Judgements.Judgement"/>.
/// </summary>
public class DrawableJudgement : Container
public class DrawableJudgement : CompositeDrawable
{
private const float judgement_size = 80;
@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.Judgements
public readonly DrawableHitObject JudgedObject;
protected Container JudgementBody;
protected SpriteText JudgementText;
/// <summary>
@ -49,14 +50,20 @@ namespace osu.Game.Rulesets.Judgements
{
this.colours = colours;
Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText
InternalChild = JudgementBody = new Container
{
Text = Result.Type.GetDescription().ToUpperInvariant(),
Font = @"Venera",
Colour = judgementColour(Result.Type),
Scale = new Vector2(0.85f, 1),
TextSize = 12
}, restrictSize: false);
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText
{
Text = Result.Type.GetDescription().ToUpperInvariant(),
Font = @"Venera",
Colour = judgementColour(Result.Type),
Scale = new Vector2(0.85f, 1),
TextSize = 12
}, restrictSize: false)
};
}
protected override void LoadComplete()
@ -65,24 +72,22 @@ namespace osu.Game.Rulesets.Judgements
this.FadeInFromZero(100, Easing.OutQuint);
var origScale = Scale;
switch (Result.Type)
{
case HitResult.None:
break;
case HitResult.Miss:
this.ScaleTo(origScale * 1.6f);
this.ScaleTo(origScale, 100, Easing.In);
JudgementBody.ScaleTo(1.6f);
JudgementBody.ScaleTo(1, 100, Easing.In);
this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
this.RotateTo(40, 800, Easing.InQuint);
JudgementBody.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint);
JudgementBody.RotateTo(40, 800, Easing.InQuint);
this.Delay(600).FadeOut(200);
break;
default:
this.ScaleTo(origScale * 0.9f);
this.ScaleTo(origScale, 500, Easing.OutElastic);
JudgementBody.ScaleTo(0.9f);
JudgementBody.ScaleTo(1, 500, Easing.OutElastic);
this.Delay(100).FadeOut(400);
break;
@ -105,9 +110,9 @@ namespace osu.Game.Rulesets.Judgements
return colours.Yellow;
case HitResult.Miss:
return colours.Red;
default:
return Color4.White;
}
return Color4.White;
}
}
}