mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Re-implement support for small ticks
This commit is contained in:
parent
7f2e554ad4
commit
00821e7b65
@ -6,6 +6,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -63,7 +64,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
|||||||
explosion.Anchor = direction.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
explosion.Anchor = direction.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Animate()
|
public void Animate(JudgementResult result)
|
||||||
{
|
{
|
||||||
(explosion as IFramedAnimation)?.GotoFrame(0);
|
(explosion as IFramedAnimation)?.GotoFrame(0);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
|
if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
HitObjectArea.Explosions.Add(hitExplosionPool.Get());
|
HitObjectArea.Explosions.Add(hitExplosionPool.Get(e => e.Apply(result)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnPressed(ManiaAction action)
|
public bool OnPressed(ManiaAction action)
|
||||||
|
@ -8,6 +8,8 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -21,31 +23,30 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public override bool RemoveWhenNotAlive => true;
|
public override bool RemoveWhenNotAlive => true;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private Column column { get; set; }
|
||||||
|
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
private readonly CircularContainer largeFaint;
|
private CircularContainer largeFaint;
|
||||||
private readonly CircularContainer mainGlow1;
|
private CircularContainer mainGlow1;
|
||||||
|
|
||||||
public DefaultHitExplosion(Color4 objectColour, bool isSmall = false)
|
public DefaultHitExplosion()
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = DefaultNotePiece.NOTE_HEIGHT;
|
Height = DefaultNotePiece.NOTE_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
// scale roughly in-line with visual appearance of notes
|
[BackgroundDependencyLoader]
|
||||||
Scale = new Vector2(1f, 0.6f);
|
private void load(IScrollingInfo scrollingInfo)
|
||||||
|
{
|
||||||
if (isSmall)
|
|
||||||
Scale *= 0.5f;
|
|
||||||
|
|
||||||
const float angle_variangle = 15; // should be less than 45
|
const float angle_variangle = 15; // should be less than 45
|
||||||
|
|
||||||
const float roundness = 80;
|
const float roundness = 80;
|
||||||
|
|
||||||
const float initial_height = 10;
|
const float initial_height = 10;
|
||||||
|
|
||||||
var colour = Interpolation.ValueAt(0.4f, objectColour, Color4.White, 0, 1);
|
var colour = Interpolation.ValueAt(0.4f, column.AccentColour, Color4.White, 0, 1);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -61,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Colour = Interpolation.ValueAt(0.1f, objectColour, Color4.White, 0, 1).Opacity(0.3f),
|
Colour = Interpolation.ValueAt(0.1f, column.AccentColour, Color4.White, 0, 1).Opacity(0.3f),
|
||||||
Roundness = 160,
|
Roundness = 160,
|
||||||
Radius = 200,
|
Radius = 200,
|
||||||
},
|
},
|
||||||
@ -76,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Colour = Interpolation.ValueAt(0.6f, objectColour, Color4.White, 0, 1),
|
Colour = Interpolation.ValueAt(0.6f, column.AccentColour, Color4.White, 0, 1),
|
||||||
Roundness = 20,
|
Roundness = 20,
|
||||||
Radius = 50,
|
Radius = 50,
|
||||||
},
|
},
|
||||||
@ -116,11 +117,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(IScrollingInfo scrollingInfo)
|
|
||||||
{
|
|
||||||
direction.BindTo(scrollingInfo.Direction);
|
direction.BindTo(scrollingInfo.Direction);
|
||||||
direction.BindValueChanged(onDirectionChanged, true);
|
direction.BindValueChanged(onDirectionChanged, true);
|
||||||
}
|
}
|
||||||
@ -139,8 +136,16 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Animate()
|
public void Animate(JudgementResult result)
|
||||||
{
|
{
|
||||||
|
// scale roughly in-line with visual appearance of notes
|
||||||
|
Vector2 scale = new Vector2(1, 0.6f);
|
||||||
|
|
||||||
|
if (result.Judgement is HoldNoteTickJudgement)
|
||||||
|
scale *= 0.5f;
|
||||||
|
|
||||||
|
this.ScaleTo(scale);
|
||||||
|
|
||||||
largeFaint
|
largeFaint
|
||||||
.ResizeTo(default_large_faint_size)
|
.ResizeTo(default_large_faint_size)
|
||||||
.Then()
|
.Then()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -11,6 +13,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Begins animating this <see cref="IHitExplosion"/>.
|
/// Begins animating this <see cref="IHitExplosion"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Animate();
|
/// <param name="result">The type of <see cref="JudgementResult"/> that caused this explosion.</param>
|
||||||
|
void Animate(JudgementResult result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Pooling;
|
using osu.Framework.Graphics.Pooling;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
@ -12,6 +13,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
public const double DURATION = 200;
|
public const double DURATION = 200;
|
||||||
|
|
||||||
|
public JudgementResult Result { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private Column column { get; set; }
|
private Column column { get; set; }
|
||||||
|
|
||||||
@ -25,18 +28,22 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, column.Index),
|
InternalChild = skinnableExplosion = new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.HitExplosion, column.Index), _ => new DefaultHitExplosion())
|
||||||
_ => new DefaultHitExplosion(column.AccentColour, false /*todo */))
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Apply(JudgementResult result)
|
||||||
|
{
|
||||||
|
Result = result;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void PrepareForUse()
|
protected override void PrepareForUse()
|
||||||
{
|
{
|
||||||
base.PrepareForUse();
|
base.PrepareForUse();
|
||||||
|
|
||||||
(skinnableExplosion?.Drawable as IHitExplosion)?.Animate();
|
(skinnableExplosion?.Drawable as IHitExplosion)?.Animate(Result);
|
||||||
|
|
||||||
this.Delay(DURATION).Then().Expire();
|
this.Delay(DURATION).Then().Expire();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user