HeavenStudio/Assets/Scripts/DebugUI.cs
minenice55 b1fab52ad9
Integration of Jukebox Library (#451) (#457)
* add Jukebox library

todo:
- saving / loading of new format
- inferrence of unknown data like past versions
- move the temporary float casts to proper use of double
- make sound related functions take double for timing
- inform people that the Jukebox sound player was renamed to SoundByte lol

* make sound, input scheduling, and super curve use double precision

* successfully load charts

* editor works again

v1 riqs can be saved and loaded

* first tempo and volume markers are unmovable

fix loading of charts' easing values

* use gsync / freesync

* update Jukebox refs to SoundByte

* game events use double part 1

Air Rally - Glee Club converted

* don't load song if chart load fails

* finish conversion of all minigames

* remove editor waveform toggle

* timeline now respects added song offset length

clear cache files on app close
prepped notes for dsp sync

* update timeline length when offset changed

* update to latest Jukebox

* make error panel object in global game manager

* improve conductor music scheduling

* added error message box

fix first game events sometimes not playing
2023-06-10 19:17:06 +00:00

113 lines
3.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
namespace HeavenStudio
{
public class DebugUI : MonoBehaviour
{
public GameObject Template;
private int indexL;
private int indexR;
private TMP_Text Title;
private TMP_Text SongPosBeats;
private TMP_Text SecPerBeat;
private TMP_Text SongPos;
private TMP_Text BPM;
private TMP_Text currEvent;
private TMP_Text eventLength;
private TMP_Text eventType;
private TMP_Text currentGame;
private TMP_Text graphicsDeviceName;
private TMP_Text operatingSystem;
private TMP_Text fps;
private void Start()
{
CreateDebugUI(out Title); SetText(Title, $"Heaven Studio {GlobalGameManager.buildTime}");
CreateDebugUI(out SongPosBeats);
CreateDebugUI(out SongPos);
CreateDebugUI(out SecPerBeat);
CreateDebugUI(out BPM);
Separate();
CreateDebugUI(out currEvent);
CreateDebugUI(out eventLength);
CreateDebugUI(out eventType);
CreateDebugUI(out currentGame);
CreateDebugUI(out operatingSystem, true); SetText(operatingSystem, SystemInfo.operatingSystem);
CreateDebugUI(out graphicsDeviceName, true); SetText(graphicsDeviceName, SystemInfo.graphicsDeviceName);
CreateDebugUI(out fps, true);
transform.GetChild(0).GetComponent<Canvas>().worldCamera = GameManager.instance.CursorCam;
}
private void Update()
{
SetText(SongPosBeats, $"Song Position In Beats: {Conductor.instance.songPositionInBeats}");
SetText(SongPos, $"Song Position: {Conductor.instance.songPosition}");
SetText(BPM, $"BPM: {Conductor.instance.songBpm}");
SetText(fps, $"FPS: {1.0f / Time.smoothDeltaTime}");
SetText(SecPerBeat, $"Seconds Per Beat: {Conductor.instance.secPerBeat}");
SetText(currentGame, $"Current Game: {GameManager.instance.currentGame}");
int minus = 0;
if (GameManager.instance.Beatmap.Entities.Count > 0)
{
if (GameManager.instance.currentEvent - 1 >= 0) minus = 1;
SetText(currEvent, $"CurrentEvent: {GameManager.instance.Beatmap.Entities[GameManager.instance.currentEvent - minus].datamodel}");
SetText(eventLength, $"Event Length: {GameManager.instance.Beatmap.Entities[GameManager.instance.currentEvent - minus].length}");
}
}
private void CreateDebugUI(out TMP_Text t, bool right = false)
{
GameObject debug = Instantiate(Template, Template.transform.parent);
debug.SetActive(true);
if (right)
{
debug.transform.localPosition = new Vector3(322.69f, Template.transform.localPosition.y - 34f * indexR);
debug.GetComponent<TMP_Text>().alignment = TextAlignmentOptions.Right;
debug.transform.GetChild(0).GetComponent<TMP_Text>().alignment = TextAlignmentOptions.Right;
indexR++;
}
else
{
debug.transform.localPosition = new Vector3(Template.transform.localPosition.x, Template.transform.localPosition.y - 34f * indexL);
indexL++;
}
t = debug.transform.GetChild(0).GetComponent<TMP_Text>();
}
private void Separate(bool right = false)
{
if (right)
indexR++;
else
indexL++;
}
private void SetText(TMP_Text t, string text)
{
t.transform.parent.GetComponent<TMP_Text>().text = $"<mark=#3d3d3d padding=\"44.9301, 44.9301, 44.9301, 44.9301\">{text}</mark>";
t.text = text;
}
}
}