Notes now move
This commit is contained in:
1 parent
e1dbbafe99
commit
27082a717c
4 files changed
+19
-12
No files matched your search
@@ -46,7 +46,6 @@ namespace UITypes
|
||||
|
||||
Game game;
|
||||
|
||||
|
||||
List<NoteElement> activeNoteElements = new();
|
||||
|
||||
public void InitGame(Game game)
|
||||
@@ -121,7 +120,8 @@ namespace UITypes
|
||||
foreach (var note in notes)
|
||||
{
|
||||
NoteElement el = new();
|
||||
el.Init(note);
|
||||
el.Init(note, leftUpcomingColumn.resolvedStyle.height);
|
||||
activeNoteElements.Add(el);
|
||||
|
||||
if (note.a == "left")
|
||||
{
|
||||
@@ -150,9 +150,9 @@ namespace UITypes
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckNoteSelf(float timestamp)
|
||||
public void CheckNoteLifetime(float timestamp)
|
||||
{
|
||||
foreach (var note in activeNoteElements)
|
||||
foreach (var note in activeNoteElements.ToList())
|
||||
{
|
||||
if (note.CheckSelf(timestamp))
|
||||
{
|
||||
|
||||
@@ -14,9 +14,11 @@ namespace UITypes
|
||||
public new class UxmlFactory : UxmlFactory<NoteElement> { }
|
||||
|
||||
public Note note;
|
||||
public float ColumnHeight;
|
||||
|
||||
public void Init(Note note)
|
||||
public void Init(Note note, float columnHeight)
|
||||
{
|
||||
this.ColumnHeight = columnHeight;
|
||||
AddToClassList("NoteElement");
|
||||
|
||||
AddToClassList(note.a[..1].ToUpper() + note.a[1..] + "Note");
|
||||
@@ -26,7 +28,7 @@ namespace UITypes
|
||||
|
||||
public void UpdateMargin(float timestamp)
|
||||
{
|
||||
style.marginTop = new((note.t - timestamp) / 1000f);
|
||||
style.marginTop = new(ColumnHeight - (note.t - timestamp) * 1000 - resolvedStyle.height);
|
||||
}
|
||||
|
||||
public bool CheckSelf(float timestamp)
|
||||
|
||||
Reference in new issue
Block a user