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

@ -2,6 +2,7 @@ using System.Collections.Generic;
using UnityEngine;
using HeavenStudio.Util;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
@ -57,7 +58,7 @@ namespace HeavenStudio.Games.Loaders
parameters = new List<Param>()
{
new Param("valA", new EntityTypes.Integer(1, 320, 10), "Zoom", "The camera's zoom level (Lower value = Zoomed in)"),
new Param("ease", EasingFunction.Ease.Linear, "Ease", "The easing function to use while zooming")
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "The easing function to use while zooming")
}
},
new GameAction("prepare dispenser", "Dispenser Prepare")
@ -108,15 +109,15 @@ namespace HeavenStudio.Games
[SerializeField] Sprite[] BallSprites;
[SerializeField] Material[] CostumeColors;
private List<DynamicBeatmap.DynamicEntity> _allCameraEvents = new List<DynamicBeatmap.DynamicEntity>();
private List<RiqEntity> _allCameraEvents = new List<RiqEntity>();
public Alien alien;
private EasingFunction.Ease lastEase;
private Util.EasingFunction.Ease lastEase;
public static Spaceball instance { get; set; }
public override void OnGameSwitch(float beat)
public override void OnGameSwitch(double beat)
{
for (int i = 1; i < BallsHolder.transform.childCount; i++)
Destroy(BallsHolder.transform.GetChild(i).gameObject);
@ -135,10 +136,10 @@ namespace HeavenStudio.Games
{
instance = this;
var camEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" });
List<DynamicBeatmap.DynamicEntity> tempEvents = new List<DynamicBeatmap.DynamicEntity>();
List<RiqEntity> tempEvents = new List<RiqEntity>();
for (int i = 0; i < camEvents.Count; i++)
{
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats)
if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeatsAsDouble)
{
tempEvents.Add(camEvents[i]);
}
@ -155,7 +156,7 @@ namespace HeavenStudio.Games
{
if (currentZoomIndex < _allCameraEvents.Count && currentZoomIndex >= 0)
{
if (Conductor.instance.songPositionInBeats >= _allCameraEvents[currentZoomIndex].beat)
if (Conductor.instance.songPositionInBeatsAsDouble >= _allCameraEvents[currentZoomIndex].beat)
{
UpdateCameraZoom();
currentZoomIndex++;
@ -178,7 +179,7 @@ namespace HeavenStudio.Games
}
else
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(lastEase);
Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction(lastEase);
float newPosZ = func(lastCamDistance + 10, currentZoomCamDistance + 10, normalizedBeat);
GameCamera.additionalPosition = new Vector3(0, 0, newPosZ);
@ -210,7 +211,7 @@ namespace HeavenStudio.Games
lastCamDistance = _allCameraEvents[0]["valA"] * -1;
}
currentZoomCamBeat = _allCameraEvents[currentZoomIndex].beat;
currentZoomCamBeat = (float)_allCameraEvents[currentZoomIndex].beat;
currentZoomCamLength = _allCameraEvents[currentZoomIndex].length;
float dist = _allCameraEvents[currentZoomIndex]["valA"] * -1;
@ -220,11 +221,11 @@ namespace HeavenStudio.Games
else
currentZoomCamDistance = dist;
lastEase = (EasingFunction.Ease) _allCameraEvents[currentZoomIndex]["ease"];
lastEase = (Util.EasingFunction.Ease) _allCameraEvents[currentZoomIndex]["ease"];
}
}
public void Shoot(float beat, bool high, int type)
public void Shoot(double beat, bool high, int type)
{
GameObject ball = Instantiate(Ball);
ball.transform.parent = Ball.transform.parent;
@ -234,11 +235,11 @@ namespace HeavenStudio.Games
if (high)
{
ball.GetComponent<SpaceballBall>().high = true;
Jukebox.PlayOneShotGame("spaceball/longShoot");
SoundByte.PlayOneShotGame("spaceball/longShoot");
}
else
{
Jukebox.PlayOneShotGame("spaceball/shoot");
SoundByte.PlayOneShotGame("spaceball/shoot");
}
ball.GetComponent<SpaceballBall>().Sprite.sprite = BallSprites[type];