2024-06-15 21:03:21 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using BangerTypes;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
|
|
|
|
namespace UITypes
|
|
|
|
{
|
|
|
|
|
|
|
|
public class NoteElement : VisualElement
|
|
|
|
{
|
|
|
|
[UnityEngine.Scripting.Preserve]
|
|
|
|
public new class UxmlFactory : UxmlFactory<NoteElement> { }
|
|
|
|
|
|
|
|
public Note note;
|
2024-06-16 22:07:02 +02:00
|
|
|
public float ColumnHeight;
|
2024-06-15 21:03:21 +02:00
|
|
|
|
2024-06-16 22:07:02 +02:00
|
|
|
public void Init(Note note, float columnHeight)
|
2024-06-15 21:03:21 +02:00
|
|
|
{
|
2024-06-16 22:07:02 +02:00
|
|
|
this.ColumnHeight = columnHeight;
|
2024-06-15 21:03:21 +02:00
|
|
|
AddToClassList("NoteElement");
|
|
|
|
|
|
|
|
AddToClassList(note.a[..1].ToUpper() + note.a[1..] + "Note");
|
|
|
|
|
|
|
|
this.note = note;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void UpdateMargin(float timestamp)
|
|
|
|
{
|
2024-06-16 22:07:02 +02:00
|
|
|
style.marginTop = new(ColumnHeight - (note.t - timestamp) * 1000 - resolvedStyle.height);
|
2024-06-15 21:03:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public bool CheckSelf(float timestamp)
|
|
|
|
{
|
|
|
|
return note.t - timestamp < 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|