1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-26 10:07:19 +08:00

Wire up CircleSize to hitobjects.

Note, that circle sizes still are wrong compared to stable osu. In order to fix this, the base radius of hitcircles needs to become 64, but it currently is 72.
This commit is contained in:
Thomas Müller 2016-12-11 10:11:22 +01:00
parent 882d5edf7d
commit eef697d842
8 changed files with 41 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;
}