Add combo numbers.

This commit is contained in:
Dean Herbert 2017-02-15 23:23:55 +09:00
parent bab219c428
commit 7fbc5990d1
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
5 changed files with 44 additions and 10 deletions

View File

@ -49,7 +49,10 @@ public DrawableHitCircle(OsuHitObject h) : base(h)
return true;
},
},
number = new NumberPiece(),
number = new NumberPiece()
{
Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(),
},
ring = new RingPiece(),
flash = new FlashPiece(),
explode = new ExplodePiece

View File

@ -49,8 +49,10 @@ public DrawableSlider(Slider s) : base(s)
},
initialCircle = new DrawableHitCircle(new HitCircle
{
//todo: avoid creating this temporary HitCircle.
StartTime = s.StartTime,
Position = s.StackedPosition,
ComboIndex = s.ComboIndex,
Scale = s.Scale,
Colour = s.Colour,
Sample = s.Sample,

View File

@ -6,33 +6,54 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class NumberPiece : Container
{
private Sprite number;
private SpriteText number;
public string Text
{
get { return number.Text; }
set { number.Text = value; }
}
public NumberPiece()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Children = new Drawable[]
{
new CircularContainer
{
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Glow,
Radius = 60,
Colour = Color4.White.Opacity(0.5f),
},
Children = new[]
{
number = new Sprite
new Box()
}
},
number = new OsuSpriteText
{
Text = @"1",
Font = @"Venera",
UseFullGlyphHeight = false,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 40,
Alpha = 1
}
};
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
number.Texture = textures.Get(@"Play/osu/number");
}
}
}

View File

@ -15,8 +15,14 @@ public override List<OsuHitObject> Convert(Beatmap beatmap)
{
List<OsuHitObject> output = new List<OsuHitObject>();
int combo = 0;
foreach (HitObject h in beatmap.HitObjects)
{
if (h.NewCombo) combo = 0;
h.ComboIndex = combo++;
output.Add(h as OsuHitObject);
}
UpdateStacking(output, beatmap.BeatmapInfo?.StackLeniency ?? 0.7f);

View File

@ -24,6 +24,8 @@ public abstract class HitObject
public HitSampleInfo Sample;
public int ComboIndex;
public virtual void SetDefaultsFromBeatmap(Beatmap beatmap) { }
}
}