Fix issues with puzzle loading order and add saving state when using Menu

This commit is contained in:
Michal Pikulski
2025-11-05 20:17:32 +01:00
committed by Michal Pikulski
parent c527ba334d
commit 717deee0cd
8 changed files with 201 additions and 19 deletions

View File

@@ -102,7 +102,13 @@ namespace Levels
isUnlocked = true;
gameObject.SetActive(true);
// Save will happen automatically on next save cycle via ISaveParticipant
// Add to global unlocked minigames list
if (switchData != null && !string.IsNullOrEmpty(switchData.targetLevelSceneName))
{
Core.SaveLoad.SaveLoadManager.Instance?.UnlockMinigame(switchData.targetLevelSceneName);
}
// Save will happen automatically on next save cycle via SaveableInteractable
}
#if UNITY_EDITOR
@@ -231,6 +237,12 @@ namespace Levels
isUnlocked = data.isUnlocked;
// Sync with global unlocked minigames list
if (isUnlocked && switchData != null && !string.IsNullOrEmpty(switchData.targetLevelSceneName))
{
Core.SaveLoad.SaveLoadManager.Instance?.UnlockMinigame(switchData.targetLevelSceneName);
}
// Show/hide based on unlock state
gameObject.SetActive(isUnlocked);
}