1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 11:33:22 +08:00

Add repeat graphics, fine-tune scale of various elements.

This commit is contained in:
Dean Herbert 2016-12-07 00:02:27 +09:00
parent ae72f91975
commit 7ab08945e4
6 changed files with 96 additions and 14 deletions

View File

@ -29,7 +29,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
if (!IsLoaded) return; if (!IsLoaded) return;
Flush(true); Flush();
UpdateInitialState(); UpdateInitialState();

View File

@ -3,9 +3,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects.Drawables.Pieces; using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
@ -13,13 +16,16 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
private Slider slider; private Slider slider;
private DrawableHitCircle startCircle; private DrawableHitCircle initialCircle;
private List<ISliderProgress> components = new List<ISliderProgress>(); private List<ISliderProgress> components = new List<ISliderProgress>();
SliderBody body;
SliderBouncer bouncer1, bouncer2;
public DrawableSlider(Slider s) : base(s) public DrawableSlider(Slider s) : base(s)
{ {
SliderBody body;
SliderBall ball; SliderBall ball;
slider = s; slider = s;
@ -35,8 +41,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
Position = s.Position, Position = s.Position,
PathWidth = 36, PathWidth = 36,
}, },
bouncer1 = new SliderBouncer(slider, false) { Position = slider.Curve.PositionAt(1) },
bouncer2 = new SliderBouncer(slider, true) { Position = slider.Position },
ball = new SliderBall(slider), ball = new SliderBall(slider),
startCircle = new DrawableHitCircle(new HitCircle initialCircle = new DrawableHitCircle(new HitCircle
{ {
StartTime = s.StartTime, StartTime = s.StartTime,
Position = s.Position, Position = s.Position,
@ -49,6 +57,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
components.Add(body); components.Add(body);
components.Add(ball); components.Add(ball);
components.Add(bouncer1);
components.Add(bouncer2);
} }
protected override void Update() protected override void Update()
@ -63,13 +73,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
if (repeat % 2 == 1) if (repeat % 2 == 1)
progress = 1 - progress; progress = 1 - progress;
bouncer2.Position = slider.Curve.PositionAt(body.SnakedAmount);
components.ForEach(c => c.UpdateProgress(progress, repeat)); components.ForEach(c => c.UpdateProgress(progress, repeat));
} }
protected override void CheckJudgement(bool userTriggered) protected override void CheckJudgement(bool userTriggered)
{ {
var j = Judgement as OsuJudgementInfo; var j = Judgement as OsuJudgementInfo;
var sc = startCircle.Judgement as OsuJudgementInfo; var sc = initialCircle.Judgement as OsuJudgementInfo;
if (!userTriggered && Time.Current >= HitObject.EndTime) if (!userTriggered && Time.Current >= HitObject.EndTime)
{ {
@ -78,12 +90,19 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
} }
} }
protected override void UpdateInitialState()
{
base.UpdateInitialState();
body.Alpha = 1;
}
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)
{ {
base.UpdateState(state); base.UpdateState(state);
Delay(HitObject.Duration); Delay(HitObject.Duration, true);
FadeOut(100); body.FadeOut(160);
FadeOut(800);
} }
} }

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
@ -30,8 +31,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Colour = Color4.Orange, Colour = Color4.Orange,
Width = 64, Width = 80,
Height = 64, Height = 80,
}, },
new Container new Container
{ {
@ -51,8 +52,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
}, },
} }
} }
}; };
Scale = new Vector2(0.94f);
} }
private InputState lastState; private InputState lastState;

View File

@ -58,7 +58,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
}, },
} }
}, },
}; };
container.Attach(RenderbufferInternalFormat.DepthComponent16); container.Attach(RenderbufferInternalFormat.DepthComponent16);
@ -91,6 +90,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders); snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
} }
public double SnakedAmount { get; private set; }
private List<Vector2> currentCurve = new List<Vector2>(); private List<Vector2> currentCurve = new List<Vector2>();
private bool updateSnaking(double p0, double p1) private bool updateSnaking(double p0, double p1)
{ {
@ -123,7 +124,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
public void UpdateProgress(double progress, int repeat) public void UpdateProgress(double progress, int repeat)
{ {
double start = 0; double start = 0;
double end = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1; double end = SnakedAmount = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1;
if (repeat >= slider.RepeatCount - 1) if (repeat >= slider.RepeatCount - 1)
{ {
@ -188,12 +189,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.White, Colour = Color4.White,
Size = new Vector2(0.13f, 1), Size = new Vector2(0.16f, 1),
}, },
gradientPortion = new Box gradientPortion = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.85f, 1), Size = new Vector2(0.82f, 1),
}, },
}, },
} }

View File

@ -0,0 +1,58 @@
//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.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class SliderBouncer : Container, ISliderProgress
{
private readonly Slider slider;
private readonly bool isEnd;
public SliderBouncer(Slider slider, bool isEnd)
{
this.slider = slider;
this.isEnd = isEnd;
Masking = true;
AutoSizeAxes = Axes.Both;
BlendingMode = BlendingMode.Additive;
Origin = Anchor.Centre;
Children = new Drawable[]
{
new Container
{
Masking = true,
AutoSizeAxes = Axes.Both,
CornerRadius = 16,
Children = new[]
{
new Box
{
Width = 32,
Height = 32,
},
}
}
};
}
public void UpdateProgress(double progress, int repeat)
{
if (Time.Current < slider.StartTime)
Alpha = 0;
Alpha = repeat + 1 < slider.RepeatCount && repeat % 2 == (isEnd ? 0 : 1) ? 1 : 0;
}
}
}

View File

@ -52,6 +52,7 @@
<Compile Include="Objects\Drawables\HitExplosion.cs" /> <Compile Include="Objects\Drawables\HitExplosion.cs" />
<Compile Include="Objects\Drawables\Pieces\NumberPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\NumberPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\RingPiece.cs" /> <Compile Include="Objects\Drawables\Pieces\RingPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBouncer.cs" />
<Compile Include="Objects\Drawables\Pieces\Triangles.cs" /> <Compile Include="Objects\Drawables\Pieces\Triangles.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBall.cs" /> <Compile Include="Objects\Drawables\Pieces\SliderBall.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBody.cs" /> <Compile Include="Objects\Drawables\Pieces\SliderBody.cs" />