2023-03-11 04:51:22 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
using TMPro;
|
|
|
|
|
|
|
|
using HeavenStudio.Editor;
|
2023-06-10 19:13:29 +00:00
|
|
|
using Jukebox;
|
|
|
|
using Jukebox.Legacy;
|
2023-03-11 04:51:22 +00:00
|
|
|
|
|
|
|
namespace HeavenStudio.Common
|
|
|
|
{
|
|
|
|
public class ChartSectionDisplay : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private TMP_Text SectionText;
|
|
|
|
[SerializeField] private Slider SectionProgress;
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
GameManager.instance.onSectionChange += OnSectionChange;
|
|
|
|
GameManager.instance.onBeatChanged += OnBeatChanged;
|
2023-12-26 05:22:51 +00:00
|
|
|
gameObject.SetActive(GameManager.instance.lastSection != null);
|
2023-03-11 04:51:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
2023-12-26 05:22:51 +00:00
|
|
|
SectionProgress.value = (float) GameManager.instance.SectionProgress;
|
2023-03-11 04:51:22 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:13:29 +00:00
|
|
|
public void OnBeatChanged(double beat)
|
2023-03-11 04:51:22 +00:00
|
|
|
{
|
2023-12-26 05:22:51 +00:00
|
|
|
gameObject.SetActive(GameManager.instance.lastSection != null);
|
|
|
|
SectionProgress.value = (float) GameManager.instance.SectionProgress;
|
2023-03-11 04:51:22 +00:00
|
|
|
}
|
|
|
|
|
2023-12-26 05:22:51 +00:00
|
|
|
public void OnSectionChange(RiqEntity newSection, RiqEntity lastSection)
|
2023-03-11 04:51:22 +00:00
|
|
|
{
|
2023-12-26 05:22:51 +00:00
|
|
|
if (newSection != null)
|
2023-03-11 04:51:22 +00:00
|
|
|
{
|
|
|
|
gameObject.SetActive(true);
|
2023-12-26 05:22:51 +00:00
|
|
|
SectionText.text = newSection["sectionName"];
|
|
|
|
SectionProgress.value = (float) GameManager.instance.SectionProgress;
|
2023-03-11 04:51:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|