mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-13 10:17:39 +02:00
Integration of Jukebox Library (#451)
* 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
This commit is contained in:
@ -7,6 +7,8 @@ using UnityEngine.EventSystems;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
|
||||
namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
@ -184,11 +186,11 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
eventObjs.Clear();
|
||||
|
||||
for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++)
|
||||
for (int i = 0; i < GameManager.instance.Beatmap.Entities.Count; i++)
|
||||
{
|
||||
var e = GameManager.instance.Beatmap.entities[i];
|
||||
var e = GameManager.instance.Beatmap.Entities[i];
|
||||
|
||||
AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * LayerHeight()), e, false, RandomID());
|
||||
AddEventObject(e.datamodel, false, new Vector3((float)e.beat, -e["track"] * LayerHeight()), e, false);
|
||||
}
|
||||
|
||||
SpecialInfo.Setup();
|
||||
@ -319,7 +321,7 @@ namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
Debug.Log("what");
|
||||
// DrawWaveform();
|
||||
StartCoroutine(DrawWaveformRealtime());
|
||||
// StartCoroutine(DrawWaveformRealtime());
|
||||
}
|
||||
|
||||
public void AutoBtnUpdate()
|
||||
@ -366,11 +368,11 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
private void Update()
|
||||
{
|
||||
waveform.rectTransform.anchoredPosition = new Vector2(
|
||||
-(GameManager.instance.Beatmap.firstBeatOffset / (60.0f / GameManager.instance.Beatmap.bpm)),
|
||||
waveform.rectTransform.anchoredPosition.y);
|
||||
// waveform.rectTransform.anchoredPosition = new Vector2(
|
||||
// -(GameManager.instance.Beatmap.data.offset / (60.0f / GameManager.instance.Beatmap.bpm)),
|
||||
// waveform.rectTransform.anchoredPosition.y);
|
||||
|
||||
WaveformBTN.transform.GetChild(0).GetComponent<Image>().color = (Conductor.instance.musicSource.clip != null && waveform.gameObject.activeInHierarchy) ? Color.white : Color.gray;
|
||||
// WaveformBTN.transform.GetChild(0).GetComponent<Image>().color = (Conductor.instance.musicSource.clip != null && waveform.gameObject.activeInHierarchy) ? Color.white : Color.gray;
|
||||
|
||||
if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused)
|
||||
{
|
||||
@ -638,7 +640,8 @@ namespace HeavenStudio.Editor.Track
|
||||
{
|
||||
if (Conductor.instance.musicSource.clip == null) return;
|
||||
|
||||
waveform.gameObject.SetActive(!waveform.gameObject.activeInHierarchy);
|
||||
// waveform.gameObject.SetActive(!waveform.gameObject.activeInHierarchy);
|
||||
waveform.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public IEnumerator DrawWaveformRealtime()
|
||||
@ -731,7 +734,7 @@ namespace HeavenStudio.Editor.Track
|
||||
return tex2D;
|
||||
}
|
||||
|
||||
public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), DynamicBeatmap.DynamicEntity entity = null, bool addEvent = false, string eventId = "")
|
||||
public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), RiqEntity entity = null, bool addEvent = false)
|
||||
{
|
||||
var game = EventCaller.instance.GetMinigame(eventName.Split(0));
|
||||
var action = EventCaller.instance.GetGameAction(game, eventName.Split(1));
|
||||
@ -742,9 +745,9 @@ namespace HeavenStudio.Editor.Track
|
||||
TimelineEventObj eventObj = g.GetComponent<TimelineEventObj>();
|
||||
|
||||
if (eventName.Split(1) == "switchGame")
|
||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2));
|
||||
else
|
||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(2));
|
||||
else
|
||||
eventObj.Icon.sprite = Editor.GameIcon(eventName.Split(0));
|
||||
|
||||
Minigames.GameAction gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(eventName.Split(0)), eventName.Split(1));
|
||||
|
||||
@ -770,8 +773,6 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
}
|
||||
|
||||
g.SetActive(true);
|
||||
|
||||
if (dragNDrop)
|
||||
{
|
||||
var mousePos = Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition);
|
||||
@ -782,22 +783,16 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.eventObj = g.GetComponent<TimelineEventObj>();
|
||||
entity.track = entity.eventObj.GetTrack();
|
||||
entity["track"] = eventObj.GetTrack();
|
||||
}
|
||||
|
||||
|
||||
if (addEvent)
|
||||
{
|
||||
DynamicBeatmap.DynamicEntity tempEntity = entity;
|
||||
RiqEntity tempEntity = entity;
|
||||
|
||||
if (entity == null)
|
||||
{
|
||||
DynamicBeatmap.DynamicEntity en = new DynamicBeatmap.DynamicEntity();
|
||||
en.datamodel = eventName;
|
||||
en.eventObj = eventObj;
|
||||
|
||||
GameManager.instance.Beatmap.entities.Add(en);
|
||||
RiqEntity en = GameManager.instance.Beatmap.AddNewEntity(eventName, g.transform.localPosition.x, gameAction.defaultLength);
|
||||
GameManager.instance.SortEventsList();
|
||||
|
||||
tempEntity = en;
|
||||
@ -832,14 +827,21 @@ namespace HeavenStudio.Editor.Track
|
||||
}
|
||||
else
|
||||
{
|
||||
GameManager.instance.Beatmap.entities.Add(entity);
|
||||
GameManager.instance.Beatmap.Entities.Add(tempEntity);
|
||||
GameManager.instance.SortEventsList();
|
||||
}
|
||||
|
||||
eventObj.entity = tempEntity;
|
||||
}
|
||||
else
|
||||
{
|
||||
eventObj.entity = entity;
|
||||
}
|
||||
|
||||
eventObjs.Add(eventObj);
|
||||
eventObj.eventObjID = eventObj.entity.uid;
|
||||
|
||||
eventObj.eventObjID = eventId;
|
||||
g.SetActive(true);
|
||||
|
||||
return eventObj;
|
||||
}
|
||||
@ -847,8 +849,8 @@ namespace HeavenStudio.Editor.Track
|
||||
private List<TimelineEventObj> duplicatedEventObjs = new List<TimelineEventObj>();
|
||||
public TimelineEventObj CopyEventObject(TimelineEventObj e)
|
||||
{
|
||||
DynamicBeatmap.DynamicEntity clone = e.entity.DeepCopy();
|
||||
TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID());
|
||||
RiqEntity clone = e.entity.DeepCopy();
|
||||
TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3((float)clone.beat, -clone["track"] * Timeline.instance.LayerHeight()), clone, true);
|
||||
duplicatedEventObjs.Add(dup);
|
||||
|
||||
return dup;
|
||||
@ -860,16 +862,23 @@ namespace HeavenStudio.Editor.Track
|
||||
duplicatedEventObjs = new List<TimelineEventObj>();
|
||||
}
|
||||
|
||||
public void DestroyEventObject(DynamicBeatmap.DynamicEntity entity)
|
||||
public void DestroyEventObject(RiqEntity entity)
|
||||
{
|
||||
if (EventParameterManager.instance.entity == entity)
|
||||
EventParameterManager.instance.Disable();
|
||||
|
||||
eventObjs.Remove(entity.eventObj);
|
||||
GameManager.instance.Beatmap.entities.Remove(entity);
|
||||
Timeline.instance.eventObjs.Remove(entity.eventObj);
|
||||
|
||||
Destroy(entity.eventObj.gameObject);
|
||||
// eventObjs.Remove(entity.eventObj);
|
||||
foreach (TimelineEventObj e in eventObjs)
|
||||
{
|
||||
if (e.entity == entity)
|
||||
{
|
||||
Destroy(e.gameObject);
|
||||
eventObjs.Remove(e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
GameManager.instance.Beatmap.Entities.Remove(entity);
|
||||
|
||||
GameManager.instance.SortEventsList();
|
||||
}
|
||||
|
||||
@ -915,7 +924,7 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
public void UpdateOffsetText()
|
||||
{
|
||||
FirstBeatOffset.text = (GameManager.instance.Beatmap.firstBeatOffset * 1000f).ToString("G");
|
||||
FirstBeatOffset.text = (GameManager.instance.Beatmap.data.offset * 1000f).ToString("G");
|
||||
}
|
||||
|
||||
public void UpdateOffsetFromText()
|
||||
@ -930,14 +939,15 @@ namespace HeavenStudio.Editor.Track
|
||||
// Limit decimal places to 4.
|
||||
newOffset = (float)System.Math.Round(newOffset, 4);
|
||||
|
||||
GameManager.instance.Beatmap.firstBeatOffset = newOffset;
|
||||
GameManager.instance.Beatmap.data.offset = newOffset;
|
||||
|
||||
UpdateOffsetText();
|
||||
FitToSong();
|
||||
}
|
||||
|
||||
public void UpdateStartingBPMText()
|
||||
{
|
||||
StartingTempoSpecialAll.text = GameManager.instance.Beatmap.bpm.ToString("G");
|
||||
StartingTempoSpecialAll.text = GameManager.instance.Beatmap.TempoChanges[0]["tempo"].ToString("G");
|
||||
StartingTempoSpecialTempo.text = StartingTempoSpecialAll.text;
|
||||
}
|
||||
|
||||
@ -960,7 +970,9 @@ namespace HeavenStudio.Editor.Track
|
||||
// Limit decimal places to 4.
|
||||
newBPM = System.Math.Round(newBPM, 4);
|
||||
|
||||
GameManager.instance.Beatmap.bpm = (float) newBPM;
|
||||
RiqEntity tempoChange = GameManager.instance.Beatmap.TempoChanges[0];
|
||||
tempoChange["tempo"] = (float) newBPM;
|
||||
GameManager.instance.Beatmap.TempoChanges[0] = tempoChange;
|
||||
|
||||
// In case the newBPM ended up differing from the inputted string.
|
||||
UpdateStartingBPMText();
|
||||
@ -970,7 +982,7 @@ namespace HeavenStudio.Editor.Track
|
||||
|
||||
public void UpdateStartingVolText()
|
||||
{
|
||||
StartingVolumeSpecialVolume.text = (GameManager.instance.Beatmap.musicVolume).ToString("G");
|
||||
StartingVolumeSpecialVolume.text = (GameManager.instance.Beatmap.VolumeChanges[0]["volume"]).ToString("G");
|
||||
}
|
||||
|
||||
public void UpdateStartingVolFromText()
|
||||
@ -982,7 +994,9 @@ namespace HeavenStudio.Editor.Track
|
||||
var newVol = Convert.ToInt32(StartingVolumeSpecialVolume.text);
|
||||
newVol = Mathf.Clamp(newVol, 0, 100);
|
||||
|
||||
GameManager.instance.Beatmap.musicVolume = newVol;
|
||||
RiqEntity volChange = GameManager.instance.Beatmap.VolumeChanges[0];
|
||||
volChange["volume"] = newVol;
|
||||
GameManager.instance.Beatmap.VolumeChanges[0] = volChange;
|
||||
|
||||
UpdateStartingVolText();
|
||||
}
|
||||
|
Reference in New Issue
Block a user