mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Add explosions.
This commit is contained in:
parent
0cadee998c
commit
3026675f35
@ -13,6 +13,9 @@ using osu.Game.Rulesets.Mania.Timing;
|
|||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Desktop.Tests.Visual
|
namespace osu.Desktop.Tests.Visual
|
||||||
{
|
{
|
||||||
@ -43,6 +46,19 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
AddStep("Notes with input (reversed)", () => createPlayfieldWithNotes(false, true));
|
AddStep("Notes with input (reversed)", () => createPlayfieldWithNotes(false, true));
|
||||||
AddStep("Notes with gravity", () => createPlayfieldWithNotes(true));
|
AddStep("Notes with gravity", () => createPlayfieldWithNotes(true));
|
||||||
AddStep("Notes with gravity (reversed)", () => createPlayfieldWithNotes(true, true));
|
AddStep("Notes with gravity (reversed)", () => createPlayfieldWithNotes(true, true));
|
||||||
|
|
||||||
|
AddStep("Hit explosion", () =>
|
||||||
|
{
|
||||||
|
var playfield = createPlayfield(4, SpecialColumnPosition.Normal);
|
||||||
|
|
||||||
|
var note = new DrawableNote(new Note(), ManiaAction.Key1)
|
||||||
|
{
|
||||||
|
Judgement = new ManiaJudgement { Result = HitResult.Hit },
|
||||||
|
AccentColour = Color4.Green
|
||||||
|
};
|
||||||
|
|
||||||
|
playfield.OnJudgement(note);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -56,7 +72,7 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
TimingPoint = { BeatLength = 1000 }
|
TimingPoint = { BeatLength = 1000 }
|
||||||
}, gravity ? ScrollingAlgorithm.Gravity : ScrollingAlgorithm.Basic);
|
}, gravity ? ScrollingAlgorithm.Gravity : ScrollingAlgorithm.Basic);
|
||||||
|
|
||||||
private void createPlayfield(int cols, SpecialColumnPosition specialPos, bool inverted = false)
|
private ManiaPlayfield createPlayfield(int cols, SpecialColumnPosition specialPos, bool inverted = false)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
@ -72,6 +88,8 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
});
|
});
|
||||||
|
|
||||||
playfield.Inverted.Value = inverted;
|
playfield.Inverted.Value = inverted;
|
||||||
|
|
||||||
|
return playfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createPlayfieldWithNotes(bool gravity, bool inverted = false)
|
private void createPlayfieldWithNotes(bool gravity, bool inverted = false)
|
||||||
|
@ -37,6 +37,17 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int Column
|
||||||
|
{
|
||||||
|
get { return base.Column; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.Column = value;
|
||||||
|
Head.Column = value;
|
||||||
|
Tail.Column = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The head note of the hold.
|
/// The head note of the hold.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -8,6 +8,6 @@ namespace osu.Game.Rulesets.Mania.Objects
|
|||||||
{
|
{
|
||||||
public abstract class ManiaHitObject : HitObject, IHasColumn
|
public abstract class ManiaHitObject : HitObject, IHasColumn
|
||||||
{
|
{
|
||||||
public int Column { get; set; }
|
public virtual int Column { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private readonly Container hitTargetBar;
|
private readonly Container hitTargetBar;
|
||||||
private readonly Container keyIcon;
|
private readonly Container keyIcon;
|
||||||
|
|
||||||
|
internal readonly Container TopLevelContainer;
|
||||||
|
private readonly Container explosionContainer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container<Drawable> content;
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
@ -98,6 +101,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
Pressed = onPressed,
|
Pressed = onPressed,
|
||||||
Released = onReleased
|
Released = onReleased
|
||||||
|
},
|
||||||
|
explosionContainer = new Container
|
||||||
|
{
|
||||||
|
Name = "Hit explosions",
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -136,8 +144,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
TopLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TopLevelContainer.Add(explosionContainer.CreateProxy());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Axes RelativeSizeAxes => Axes.Y;
|
public override Axes RelativeSizeAxes => Axes.Y;
|
||||||
@ -194,6 +205,14 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
HitObjects.Add(hitObject);
|
HitObjects.Add(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnJudgement(DrawableHitObject<ManiaHitObject, ManiaJudgement> judgedObject)
|
||||||
|
{
|
||||||
|
if (judgedObject.Judgement.Result != HitResult.Hit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
explosionContainer.Add(new HitExplosion(judgedObject));
|
||||||
|
}
|
||||||
|
|
||||||
private bool onPressed(ManiaAction action)
|
private bool onPressed(ManiaAction action)
|
||||||
{
|
{
|
||||||
if (action == Action)
|
if (action == Action)
|
||||||
|
55
osu.Game.Rulesets.Mania/UI/HitExplosion.cs
Normal file
55
osu.Game.Rulesets.Mania/UI/HitExplosion.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Rulesets.Mania.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
|
{
|
||||||
|
internal class HitExplosion : CompositeDrawable
|
||||||
|
{
|
||||||
|
private readonly Box inner;
|
||||||
|
|
||||||
|
public HitExplosion(DrawableHitObject<ManiaHitObject, ManiaJudgement> judgedObject)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
FillMode = FillMode.Fit;
|
||||||
|
|
||||||
|
BlendingMode = BlendingMode.Additive;
|
||||||
|
|
||||||
|
InternalChild = new CircularContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
BorderThickness = 1,
|
||||||
|
BorderColour = judgedObject.AccentColour,
|
||||||
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Colour = judgedObject.AccentColour,
|
||||||
|
Radius = 10,
|
||||||
|
Hollow = true
|
||||||
|
},
|
||||||
|
Child = inner = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = judgedObject.AccentColour,
|
||||||
|
Alpha = 1,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
this.ScaleTo(2f, 600, Easing.OutQuint).FadeOut(500);
|
||||||
|
inner.FadeOut(250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -14,6 +14,7 @@ using osu.Framework.Allocation;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -50,8 +51,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container<Drawable> content;
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
private readonly Container topLevelContainer;
|
|
||||||
|
|
||||||
private List<Color4> normalColumnColours = new List<Color4>();
|
private List<Color4> normalColumnColours = new List<Color4>();
|
||||||
private Color4 specialColumnColour;
|
private Color4 specialColumnColour;
|
||||||
|
|
||||||
@ -67,6 +66,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
Inverted.Value = true;
|
Inverted.Value = true;
|
||||||
|
|
||||||
|
Container topLevelContainer;
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -135,6 +135,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
c.IsSpecial = isSpecialColumn(i);
|
c.IsSpecial = isSpecialColumn(i);
|
||||||
c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++;
|
c.Action = c.IsSpecial ? ManiaAction.Special : currentAction++;
|
||||||
|
|
||||||
|
topLevelContainer.Add(c.TopLevelContainer.CreateProxy());
|
||||||
|
|
||||||
columns.Add(c);
|
columns.Add(c);
|
||||||
AddNested(c);
|
AddNested(c);
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
<Compile Include="Timing\GravityScrollingContainer.cs" />
|
<Compile Include="Timing\GravityScrollingContainer.cs" />
|
||||||
<Compile Include="Timing\ScrollingAlgorithm.cs" />
|
<Compile Include="Timing\ScrollingAlgorithm.cs" />
|
||||||
<Compile Include="UI\Column.cs" />
|
<Compile Include="UI\Column.cs" />
|
||||||
|
<Compile Include="UI\HitExplosion.cs" />
|
||||||
<Compile Include="UI\ManiaRulesetContainer.cs" />
|
<Compile Include="UI\ManiaRulesetContainer.cs" />
|
||||||
<Compile Include="UI\ManiaPlayfield.cs" />
|
<Compile Include="UI\ManiaPlayfield.cs" />
|
||||||
<Compile Include="ManiaRuleset.cs" />
|
<Compile Include="ManiaRuleset.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user