Files
WacK/Scripts/Things/TunnelObjects/THNotePlay.cs
T

42 lines
846 B
C#
Raw Normal View History

2023-09-16 00:40:36 -07:00
using Godot;
using WacK.Data.Chart;
namespace WacK.Things.TunnelObjects
{
public partial class THNotePlay : Control
{
2023-09-29 17:58:32 -07:00
[Export]
private NinePatchRect noteBase;
2023-09-16 00:40:36 -07:00
public NotePlay noteData;
public void Init(NotePlay noteData)
{
this.noteData = noteData;
SetSizePos((int)noteData.pos, (int)noteData.size);
2023-09-16 00:40:36 -07:00
}
public void SetSizePos(int pos, int size)
{
if (3 <= size && size <= 59)
{
pos += 1;
size -= 2;
}
2023-09-17 23:51:50 -07:00
else if (size >= 60)
{
size = 60;
2023-09-29 17:58:32 -07:00
noteBase.RegionRect = new Rect2(12, 0, new Vector2(488, 36));
noteBase.PatchMarginLeft = 0;
noteBase.PatchMarginRight = 0;
2023-09-17 23:51:50 -07:00
}
2023-09-16 00:40:36 -07:00
var nPos = Position;
2023-09-17 23:51:50 -07:00
nPos.X = pos * (Constants.BASE_2D_RESOLUTION/60) - 12;
2023-09-16 00:40:36 -07:00
Position = nPos;
var nSize = Size;
2023-09-17 23:51:50 -07:00
nSize.X = size * (Constants.BASE_2D_RESOLUTION/60) + 24;
2023-09-16 00:40:36 -07:00
Size = nSize;
}
}
}