complete refactor
This commit is contained in:
parent
65fe0e5c5d
commit
de2e8b1e50
71 changed files with 212 additions and 137 deletions
|
|
@ -1,9 +1,11 @@
|
|||
using Godot;
|
||||
using Godot.Collections;
|
||||
using Newlon;
|
||||
|
||||
using Newlon.Resources;
|
||||
using System.Text.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Newlon;
|
||||
|
||||
public partial class SaveSerializer : Node
|
||||
{
|
||||
const string SAVE_PATH = "user://save.json";
|
||||
|
|
@ -24,21 +26,21 @@ public partial class SaveSerializer : Node
|
|||
public static void SaveGame()
|
||||
{
|
||||
var access = FileAccess.Open(SAVE_PATH, FileAccess.ModeFlags.Write);
|
||||
var playerProgress = PlayerProgress.Instance;
|
||||
var save = new SaveData
|
||||
{
|
||||
var playerProgress = PlayerProgress.Instance;
|
||||
var save = new SaveData
|
||||
{
|
||||
|
||||
SFXVolume = (float)Settings.SFX,
|
||||
MusicVolume = (float)Settings.Music,
|
||||
SplashSeen = Settings.Splash,
|
||||
Money = playerProgress.Money,
|
||||
SeedpacketSlots = playerProgress.MaxSeedpackets,
|
||||
PlayerPlants = [],
|
||||
SFXVolume = (float)Settings.SFX,
|
||||
MusicVolume = (float)Settings.Music,
|
||||
SplashSeen = Settings.Splash,
|
||||
Money = playerProgress.Money,
|
||||
SeedpacketSlots = playerProgress.MaxSeedpackets,
|
||||
PlayerPlants = [],
|
||||
|
||||
SaveGameVersion = (string)ProjectSettings.GetSetting("application/config/version")
|
||||
};
|
||||
SaveGameVersion = (string)ProjectSettings.GetSetting("application/config/version")
|
||||
};
|
||||
|
||||
foreach (var plant in playerProgress.PlayerPlants)
|
||||
foreach (var plant in playerProgress.PlayerPlants)
|
||||
{
|
||||
save.PlayerPlants.Add(plant.internal_id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue