mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Move beat divisor tick size retrieval to static methods
This commit is contained in:
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit
|
namespace osu.Game.Screens.Edit
|
||||||
@ -100,6 +101,32 @@ namespace osu.Game.Screens.Edit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a relative display size for the specified divisor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="beatDivisor">The beat divisor.</param>
|
||||||
|
/// <returns>A relative size which can be used to display ticks.</returns>
|
||||||
|
public static Vector2 GetSize(int beatDivisor)
|
||||||
|
{
|
||||||
|
switch (beatDivisor)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
return new Vector2(0.6f, 0.9f);
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
return new Vector2(0.5f, 0.8f);
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
case 8:
|
||||||
|
return new Vector2(0.4f, 0.7f);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return new Vector2(0.3f, 0.6f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the applicable divisor for a specific beat index.
|
/// Retrieves the applicable divisor for a specific beat index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||||
{
|
{
|
||||||
@ -132,10 +133,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
|
|
||||||
// even though "bar lines" take up the full vertical space, we render them in two pieces because it allows for less anchor/origin churn.
|
// even though "bar lines" take up the full vertical space, we render them in two pieces because it allows for less anchor/origin churn.
|
||||||
|
|
||||||
|
Vector2 size = Vector2.One;
|
||||||
|
|
||||||
|
if (indexInBar != 1)
|
||||||
|
size = BindableBeatDivisor.GetSize(divisor);
|
||||||
|
|
||||||
var line = getNextUsableLine();
|
var line = getNextUsableLine();
|
||||||
line.X = xPos;
|
line.X = xPos;
|
||||||
line.Width = PointVisualisation.MAX_WIDTH * getWidth(indexInBar, divisor);
|
line.Width = PointVisualisation.MAX_WIDTH * size.X;
|
||||||
line.Height = 0.9f * getHeight(indexInBar, divisor);
|
line.Height = 0.9f * size.Y;
|
||||||
line.Colour = colour;
|
line.Colour = colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,54 +176,6 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float getWidth(int indexInBar, int divisor)
|
|
||||||
{
|
|
||||||
if (indexInBar == 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
switch (divisor)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
return 0.6f;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
return 0.5f;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
case 8:
|
|
||||||
return 0.4f;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0.3f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static float getHeight(int indexInBar, int divisor)
|
|
||||||
{
|
|
||||||
if (indexInBar == 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
switch (divisor)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
return 0.9f;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
case 4:
|
|
||||||
return 0.8f;
|
|
||||||
|
|
||||||
case 6:
|
|
||||||
case 8:
|
|
||||||
return 0.7f;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0.6f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
Reference in New Issue
Block a user