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:17:06 +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;
|
|
|
|
gameObject.SetActive(GameManager.instance.currentSection != null);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
2023-06-10 19:17:06 +00:00
|
|
|
SectionProgress.value = (float) GameManager.instance.sectionProgress;
|
2023-03-11 04:51:22 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void OnBeatChanged(double beat)
|
2023-03-11 04:51:22 +00:00
|
|
|
{
|
|
|
|
gameObject.SetActive(GameManager.instance.currentSection != null);
|
2023-06-10 19:17:06 +00:00
|
|
|
SectionProgress.value = (float) GameManager.instance.sectionProgress;
|
2023-03-11 04:51:22 +00:00
|
|
|
}
|
|
|
|
|
2023-06-10 19:17:06 +00:00
|
|
|
public void OnSectionChange(RiqEntity section)
|
2023-03-11 04:51:22 +00:00
|
|
|
{
|
|
|
|
if (section != null)
|
|
|
|
{
|
|
|
|
gameObject.SetActive(true);
|
2023-06-10 19:17:06 +00:00
|
|
|
SectionText.text = section["sectionName"];
|
|
|
|
SectionProgress.value = (float) GameManager.instance.sectionProgress;
|
2023-03-11 04:51:22 +00:00
|
|
|
|
|
|
|
if (PersistentDataManager.gameSettings.perfectChallengeType == PersistentDataManager.PerfectChallengeType.Off) return;
|
|
|
|
if (!OverlaysManager.OverlaysEnabled) return;
|
2023-06-10 19:17:06 +00:00
|
|
|
if (section["startPerfect"] && GoForAPerfect.instance != null && GoForAPerfect.instance.perfect && !GoForAPerfect.instance.gameObject.activeSelf)
|
2023-03-11 04:51:22 +00:00
|
|
|
{
|
|
|
|
GoForAPerfect.instance.Enable(section.beat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|