mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Add judgement texts.
This commit is contained in:
parent
4c398b106d
commit
1ac9898a36
@ -35,6 +35,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
playfield.OnJudgement(new DrawableTestHit(new TaikoHitObject())
|
||||
{
|
||||
X = RNG.NextSingle(score == TaikoScoreResult.Good ? -0.1f : -0.05f, score == TaikoScoreResult.Good ? 0.1f : 0.05f),
|
||||
Judgement = new TaikoJudgementInfo
|
||||
{
|
||||
Result = HitResult.Hit,
|
||||
|
126
osu.Game.Modes.Taiko/UI/JudgementText.cs
Normal file
126
osu.Game.Modes.Taiko/UI/JudgementText.cs
Normal file
@ -0,0 +1,126 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.UI
|
||||
{
|
||||
public class JudgementText : Container
|
||||
{
|
||||
public TaikoJudgementInfo Judgement;
|
||||
|
||||
private Container textContainer;
|
||||
private OsuSpriteText glowText;
|
||||
private OsuSpriteText normalText;
|
||||
|
||||
private int movementDirection;
|
||||
|
||||
public JudgementText()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
textContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new BufferedContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
BlurSigma = new Vector2(10),
|
||||
CacheDrawnFrameBuffer = true,
|
||||
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(3),
|
||||
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
glowText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
Font = "Venera",
|
||||
TextSize = 22f,
|
||||
}
|
||||
}
|
||||
},
|
||||
normalText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
Font = "Venera",
|
||||
TextSize = 22f,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Color4 judgementColour = Color4.White;
|
||||
string judgementText = string.Empty;
|
||||
|
||||
switch (Judgement.Result)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
judgementColour = colours.Red;
|
||||
judgementText = "MISS";
|
||||
movementDirection = 1;
|
||||
break;
|
||||
case HitResult.Hit:
|
||||
switch (Judgement.Score)
|
||||
{
|
||||
case TaikoScoreResult.Good:
|
||||
judgementColour = colours.Green;
|
||||
judgementText = "GOOD";
|
||||
textContainer.Scale = new Vector2(0.45f);
|
||||
break;
|
||||
case TaikoScoreResult.Great:
|
||||
judgementColour = colours.Blue;
|
||||
judgementText = "GREAT";
|
||||
break;
|
||||
}
|
||||
|
||||
movementDirection = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
glowText.Colour = judgementColour;
|
||||
glowText.Text = normalText.Text = judgementText;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScaleTo(1.5f, 250, EasingTypes.OutQuint);
|
||||
MoveToY(movementDirection * 100, 500);
|
||||
|
||||
Delay(250);
|
||||
ScaleTo(0.75f, 250);
|
||||
FadeOut(250);
|
||||
|
||||
Expire();
|
||||
}
|
||||
}
|
||||
}
|
@ -49,7 +49,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
private HitTarget hitTarget;
|
||||
private Container<RingExplosion> ringExplosionContainer;
|
||||
//private Container<DrawableBarLine> barLineContainer;
|
||||
//private Container<JudgementText> judgementContainer;
|
||||
private Container<JudgementText> judgementContainer;
|
||||
|
||||
private Container hitObjectContainer;
|
||||
private Container topLevelHitContainer;
|
||||
@ -126,11 +126,11 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
//judgementContainer = new Container<JudgementText>
|
||||
//{
|
||||
// RelativeSizeAxes = Axes.Both,
|
||||
// BlendingMode = BlendingMode.Additive
|
||||
//},
|
||||
judgementContainer = new Container<JudgementText>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BlendingMode = BlendingMode.Additive
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -203,6 +203,19 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
ScoreResult = judgedObject.Judgement.Score
|
||||
});
|
||||
}
|
||||
|
||||
float judgementOffset = judgedObject.Judgement.Result == HitResult.Hit ? judgedObject.Position.X : 0;
|
||||
|
||||
judgementContainer.Add(new JudgementText
|
||||
{
|
||||
Anchor = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.TopLeft : Anchor.BottomLeft,
|
||||
Origin = judgedObject.Judgement.Result == HitResult.Hit ? Anchor.BottomCentre : Anchor.TopCentre,
|
||||
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = judgementOffset,
|
||||
|
||||
Judgement = judgedObject.Judgement
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -58,6 +58,7 @@
|
||||
<Compile Include="TaikoScoreProcessor.cs" />
|
||||
<Compile Include="UI\HitTarget.cs" />
|
||||
<Compile Include="UI\InputDrum.cs" />
|
||||
<Compile Include="UI\JudgementText.cs" />
|
||||
<Compile Include="UI\RingExplosion.cs" />
|
||||
<Compile Include="UI\TaikoHitRenderer.cs" />
|
||||
<Compile Include="UI\TaikoPlayfield.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user