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
This commit is contained in:
minenice55
2023-06-10 15:17:06 -04:00
committed by GitHub
parent b7afd697ce
commit b1fab52ad9
176 changed files with 4868 additions and 3013 deletions

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -11,7 +12,7 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
{
private DoubleDate game;
private SuperCurveObject.Path path;
private float pathStartBeat = float.MinValue;
private double pathStartBeat = double.MinValue;
private Conductor conductor;
private GameObject shadow;
@ -23,20 +24,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Update()
{
float beat = conductor.songPositionInBeats;
float height = 0f;
if (pathStartBeat > float.MinValue)
double beat = conductor.songPositionInBeatsAsDouble;
double height = 0f;
if (pathStartBeat > double.MinValue)
{
Vector3 pos = GetPathPositionFromBeat(path, Mathf.Max(beat, pathStartBeat), out height, pathStartBeat);
Vector3 pos = GetPathPositionFromBeat(path, Math.Max(beat, pathStartBeat), out height, pathStartBeat);
transform.position = pos;
float rot = GetPathValue("rot");
transform.rotation = Quaternion.Euler(0f, 0f, transform.rotation.eulerAngles.z - (rot * Time.deltaTime * (1f/conductor.pitchedSecPerBeat)));
}
shadow.transform.position = new Vector3(transform.position.x, Mathf.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.position = new Vector3(transform.position.x, (float) Math.Min(transform.position.y - height, game.floorHeight), transform.position.z);
shadow.transform.localScale = Vector3.one * Mathf.Clamp(((transform.position.y) - game.shadowDepthScaleMin) / (game.shadowDepthScaleMax - game.shadowDepthScaleMin), 0f, 1f);
}
public void Init(float beat)
public void Init(double beat)
{
game.ScheduleInput(beat, 1f, InputType.STANDARD_DOWN, Just, Miss, Empty);
path = game.GetPath("SoccerIn");
@ -56,17 +57,17 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
{
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 3f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 3f, delegate
{
Destroy(gameObject);
}),
});
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
if (state >= 1f || state <= -1f)
{
path = game.GetPath("SoccerNg" + (state > 0 ? "Late" : "Early"));
Jukebox.PlayOneShot("miss");
SoundByte.PlayOneShot("miss");
game.Kick(false);
GetComponent<SpriteRenderer>().sortingOrder = 8;
return;
@ -77,20 +78,20 @@ namespace HeavenStudio.Games.Scripts_DoubleDate
void Hit()
{
UpdateLastRealPos();
pathStartBeat = conductor.songPositionInBeats;
pathStartBeat = conductor.songPositionInBeatsAsDouble;
path = game.GetPath("SoccerJust");
game.Kick();
Jukebox.PlayOneShotGame("doubleDate/kick");
SoundByte.PlayOneShotGame("doubleDate/kick");
}
void Miss(PlayerActionEvent caller)
{
Jukebox.PlayOneShotGame("doubleDate/weasel_hide");
SoundByte.PlayOneShotGame("doubleDate/weasel_hide");
game.MissKick(pathStartBeat + 2.25f);
BeatAction.New(gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(conductor.songPositionInBeats + 4f, delegate
new BeatAction.Action(conductor.songPositionInBeatsAsDouble + 4f, delegate
{
Destroy(gameObject);
}),