-
-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save jukebox state #1346
Comments
Hi hhyyrylainen, I would like to work on this issue. Regarding saving the state of Jukebox class, should I use the same approach with the already-written RandomConverter class where I save Jukebox as a JSON object that saves the state-determining private fields of Jukebox? |
I think there is no need for a custom converter here, just add a new property that on read: finds all the playing tracks and returns their positions, and on set stores that info in a temporary list. Then when the jukebox starts playing that temporary list is inspected and if found the tracks in it are set to play again from their existing positions. |
Got it. Do you think it would be more suitable to make the property a type of Dictionary<string, float> to store tracks as strings with their corresponding PreviousPlayedPositions? |
Whatever data structure that contains enough information to restart the playing tracks should be used.
I mean that once the game state is loaded, the jukebox should continue playing where it left off. Similarly to how the jukebox continues the microbe stage track when returning from the editor. |
On master I don't think the jukebox object is saved at all. Are you sure that is properly saved? |
What might be happening is that if you were in the stage, and then loaded a game, the jukebox may remember the tracks that were playing before you loaded the save and not the tracks that were playing when the save was made. |
To resume the playing music when loading.
The text was updated successfully, but these errors were encountered: