First commit for private source control. Older commits available on Github.
This commit is contained in:
13
Assets/Scripts/Data/IO/FilePaths.cs
Normal file
13
Assets/Scripts/Data/IO/FilePaths.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Data.IO
|
||||
{
|
||||
public static class FilePaths
|
||||
{
|
||||
private static readonly string ApplicationData = Application.persistentDataPath;
|
||||
public static readonly string SaveDataFolder = Path.Combine(ApplicationData, "Saves");
|
||||
public static readonly string SaveBackupDataFolder = Path.Combine(Application.persistentDataPath, "Backups");
|
||||
public static readonly string ConfigFolder = Path.Combine(Application.persistentDataPath, "Configs");
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Data/IO/FilePaths.cs.meta
Normal file
3
Assets/Scripts/Data/IO/FilePaths.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 437ea8a487054abc95c09442f73f0374
|
||||
timeCreated: 1769703501
|
||||
3
Assets/Scripts/Data/IO/Saves.meta
Normal file
3
Assets/Scripts/Data/IO/Saves.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 377fc30dd8794b1a8fa98f9842272263
|
||||
timeCreated: 1769703058
|
||||
150
Assets/Scripts/Data/IO/Saves/SaveGame.cs
Normal file
150
Assets/Scripts/Data/IO/Saves/SaveGame.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
// ==============================
|
||||
// SaveGame.cs (refactored)
|
||||
// ==============================
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using MemoryPack;
|
||||
|
||||
namespace BriarQueen.Data.IO.Saves
|
||||
{
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class SaveGame
|
||||
{
|
||||
public string SaveVersion = "0.0.2-alpha";
|
||||
public string SaveFileName;
|
||||
|
||||
// Inventory & item tracking
|
||||
public List<ItemSaveData> InventoryData = new();
|
||||
public List<ItemSaveData> CollectedItems = new();
|
||||
public List<ItemSaveData> RemovedItems = new();
|
||||
|
||||
public Dictionary<ToolID, bool> Tools = new();
|
||||
|
||||
// Codex
|
||||
public List<CodexSaveData> DiscoveredCodexEntries = new();
|
||||
|
||||
// Current location
|
||||
public string CurrentSceneID;
|
||||
public string CurrentLevelID;
|
||||
|
||||
// Per-puzzle persisted state (resume progress when revisiting)
|
||||
public List<PuzzleStateSaveData> PuzzleStates = new();
|
||||
|
||||
public bool OpeningCinematicPlayed;
|
||||
|
||||
// Centralized game variables
|
||||
public PersistentGameVariables PersistentVariables = new();
|
||||
|
||||
// Level-specific hints
|
||||
public Dictionary<string, int> LevelHintStages = new();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class ItemSaveData
|
||||
{
|
||||
public string UniqueIdentifier;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class CodexSaveData
|
||||
{
|
||||
public string UniqueIdentifier;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class PuzzleStateSaveData
|
||||
{
|
||||
public string PuzzleID;
|
||||
public byte[] State;
|
||||
public bool Completed;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class PersistentGameVariables
|
||||
{
|
||||
public GameVariables Game = new();
|
||||
public TutorialPopupVariables TutorialPopupVariables = new();
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class TutorialPopupVariables
|
||||
{
|
||||
// Tracks which popups have been shown
|
||||
public HashSet<TutorialPopupID> DisplayedPopups = new();
|
||||
|
||||
public bool HasBeenDisplayed(TutorialPopupID id)
|
||||
{
|
||||
return DisplayedPopups.Contains(id);
|
||||
}
|
||||
|
||||
public void MarkDisplayed(TutorialPopupID id)
|
||||
{
|
||||
DisplayedPopups.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public enum LevelFlag
|
||||
{
|
||||
None = 0,
|
||||
FountainVinesCut,
|
||||
PumpHouseOpened,
|
||||
PumpHousePipesFixed,
|
||||
PumpWaterRestored,
|
||||
WorkshopBagHoleDug,
|
||||
WorkshopSafeUnlocked,
|
||||
WorkshopDownstairsDoorOpen,
|
||||
WorkshopDownstairsLightOn,
|
||||
WorkshopGrindstoneRepaired,
|
||||
StreetGateOpen,
|
||||
StreetVinesCut,
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[MemoryPackable]
|
||||
public partial class GameVariables
|
||||
{
|
||||
// Type-safe level flags using enum
|
||||
public Dictionary<LevelFlag, bool> LevelFlags = new();
|
||||
|
||||
// Tracks completed puzzles
|
||||
public Dictionary<string, bool> PuzzleCompleted = new();
|
||||
|
||||
// Candle slots
|
||||
public Dictionary<int, string> WorkshopCandleSlotsFilled = new()
|
||||
{
|
||||
{ 0, ItemIDs.Pickups[ItemKey.BlueCandle] },
|
||||
{ 3, ItemIDs.Pickups[ItemKey.OrangeCandle] },
|
||||
{ 5, ItemIDs.Pickups[ItemKey.RedCandle] }
|
||||
};
|
||||
|
||||
// -------- Helper Methods --------
|
||||
public bool IsPuzzleCompleted(PuzzleKey puzzle)
|
||||
{
|
||||
return PuzzleCompleted.TryGetValue(PuzzleIdentifiers.AllPuzzles[puzzle], out var completed) && completed;
|
||||
}
|
||||
|
||||
public void SetPuzzleCompleted(PuzzleKey puzzle, bool completed = true)
|
||||
{
|
||||
PuzzleCompleted[PuzzleIdentifiers.AllPuzzles[puzzle]] = completed;
|
||||
}
|
||||
|
||||
public bool GetLevelFlag(LevelFlag flag)
|
||||
{
|
||||
return LevelFlags.TryGetValue(flag, out var value) && value;
|
||||
}
|
||||
|
||||
public void SetLevelFlag(LevelFlag flag, bool value = true)
|
||||
{
|
||||
LevelFlags[flag] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Data/IO/Saves/SaveGame.cs.meta
Normal file
3
Assets/Scripts/Data/IO/Saves/SaveGame.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc844b48999c44058fe4696c9841c339
|
||||
timeCreated: 1769703058
|
||||
Reference in New Issue
Block a user