mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 22:23:32 +08:00
Add a way to calculate length of IHasEndTime objects
This commit is contained in:
parent
a7aab21a29
commit
585df22c88
@ -4,7 +4,9 @@
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI.Scrolling
|
namespace osu.Game.Rulesets.UI.Scrolling
|
||||||
{
|
{
|
||||||
@ -35,9 +37,8 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
|
|
||||||
foreach (var obj in AliveObjects)
|
foreach (var obj in AliveObjects)
|
||||||
{
|
{
|
||||||
var relativePosition = (Time.Current - obj.HitObject.StartTime) / (TimeRange / currentMultiplier.Multiplier);
|
|
||||||
|
|
||||||
// Todo: We may need to consider scale here
|
// Todo: We may need to consider scale here
|
||||||
|
var relativePosition = (Time.Current - obj.HitObject.StartTime) * currentMultiplier.Multiplier / TimeRange;
|
||||||
var finalPosition = (float)relativePosition * DrawSize;
|
var finalPosition = (float)relativePosition * DrawSize;
|
||||||
|
|
||||||
switch (direction)
|
switch (direction)
|
||||||
@ -55,6 +56,27 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
obj.X = finalPosition.X;
|
obj.X = finalPosition.X;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(obj.HitObject is IHasEndTime endTime))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Todo: We may need to consider scale here
|
||||||
|
var relativeEndPosition = (Time.Current - endTime.EndTime) * currentMultiplier.Multiplier / TimeRange;
|
||||||
|
var finalEndPosition = (float)relativeEndPosition * DrawSize;
|
||||||
|
|
||||||
|
float length = Vector2.Distance(finalPosition, finalEndPosition);
|
||||||
|
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case ScrollingDirection.Up:
|
||||||
|
case ScrollingDirection.Down:
|
||||||
|
obj.Height = length;
|
||||||
|
break;
|
||||||
|
case ScrollingDirection.Left:
|
||||||
|
case ScrollingDirection.Right:
|
||||||
|
obj.Width = length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user