1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 12:02:55 +08:00

Merge pull request #239 from Tom94/hitobject-improvements

Hitobject improvements
This commit is contained in:
Dean Herbert 2016-12-11 19:43:17 +09:00 committed by GitHub
commit b93ebea5c1
9 changed files with 43 additions and 23 deletions

View File

@ -42,7 +42,8 @@ namespace osu.Desktop.VisualTests.Tests
objects.Add(new HitCircle()
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384))
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)),
Scale = RNG.NextSingle(0.5f, 1.0f),
});
time += RNG.Next(50, 500);

View File

@ -13,7 +13,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
public class DrawableHitCircle : DrawableOsuHitObject
{
private OsuHitObject osuObject;
private HitCircle osuObject;
public ApproachCircle ApproachCircle;
private CirclePiece circle;
@ -23,12 +23,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
private NumberPiece number;
private GlowPiece glow;
public DrawableHitCircle(OsuHitObject h) : base(h)
public DrawableHitCircle(HitCircle h) : base(h)
{
osuObject = h;
Origin = Anchor.Centre;
Position = osuObject.Position;
Scale = new Vector2(osuObject.Scale);
Children = new Drawable[]
{
@ -104,7 +105,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
ApproachCircle.Alpha = 0;
ApproachCircle.Scale = new Vector2(2);
explode.Alpha = 0;
Scale = new Vector2(0.5f); //this will probably need to be moved to DrawableHitObject at some point.
}
protected override void UpdatePreemptState()

View File

@ -1,12 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Objects.Drawables;

View File

@ -27,24 +27,32 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
slider = s;
Origin = Anchor.TopLeft;
Position = Vector2.Zero;
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
body = new SliderBody(s)
{
Position = s.Position,
PathWidth = 36,
PathWidth = s.Scale * 72,
},
bouncer1 = new SliderBouncer(s, false)
{
Position = s.Curve.PositionAt(1),
Scale = new Vector2(s.Scale),
},
bouncer2 = new SliderBouncer(s, true)
{
Position = s.Position,
Scale = new Vector2(s.Scale),
},
ball = new SliderBall(s)
{
Scale = new Vector2(s.Scale),
},
bouncer1 = new SliderBouncer(slider, false) { Position = slider.Curve.PositionAt(1) },
bouncer2 = new SliderBouncer(slider, true) { Position = slider.Position },
ball = new SliderBall(slider),
initialCircle = new DrawableHitCircle(new HitCircle
{
StartTime = s.StartTime,
Position = s.Position,
Scale = s.Scale,
Colour = s.Colour,
})
{
@ -58,6 +66,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
components.Add(bouncer2);
}
// Since the DrawableSlider itself is just a container without a size we need to
// pass all input through.
public override bool Contains(Vector2 screenSpacePos) => true;
protected override void Update()
{
base.Update();

View File

@ -16,7 +16,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
private readonly Slider slider;
private Box follow;
const float width = 70;
const float width = 140;
public SliderBall(Slider slider)
{
@ -25,7 +25,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
AutoSizeAxes = Axes.Both;
BlendingMode = BlendingMode.Additive;
Origin = Anchor.Centre;
BorderThickness = 5;
BorderThickness = 10;
BorderColour = Color4.Orange;
Children = new Drawable[]
@ -45,7 +45,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
BorderThickness = 7,
BorderThickness = 14,
BorderColour = Color4.White,
Alpha = 1,
CornerRadius = width / 2,

View File

@ -35,7 +35,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
Icon = FontAwesome.fa_eercast,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 24,
TextSize = 48,
}
};
}

View File

@ -5,6 +5,7 @@ using System;
using osu.Game.Beatmaps.Samples;
using osu.Game.Modes.Objects;
using OpenTK;
using osu.Game.Beatmaps;
namespace osu.Game.Modes.Osu.Objects
{
@ -12,8 +13,17 @@ namespace osu.Game.Modes.Osu.Objects
{
public Vector2 Position { get; set; }
public float Scale { get; set; } = 1;
public virtual Vector2 EndPosition => Position;
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
{
base.SetDefaultsFromBeatmap(beatmap);
Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2;
}
[Flags]
internal enum HitObjectType
{

View File

@ -1,9 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Database;
using osu.Game.Beatmaps;
using System;
using OpenTK;
namespace osu.Game.Modes.Osu.Objects
@ -18,6 +16,8 @@ namespace osu.Game.Modes.Osu.Objects
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
{
base.SetDefaultsFromBeatmap(beatmap);
Velocity = 100 / beatmap.BeatLengthAt(StartTime, true) * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
}

View File

@ -35,6 +35,8 @@ namespace osu.Game.Modes.UI
public class ScaledContainer : Container
{
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
public override bool Contains(Vector2 screenSpacePos) => true;
}
public class HitObjectContainer : Container<DrawableHitObject>