using System.Collections.Generic; using UnityEngine; namespace BulletHellTemplate { /// /// Handles saving and loading reward data from Firebase and PlayerPrefs. /// Prevents multiple calls to Firebase during initialization. /// public static class RewardSaveManager { /// /// Loads rewards from Firestore for a specified collection and invokes a callback with the data. /// public static void LoadRewards(string collectionName, System.Action> onLoaded) { } /// /// Saves rewards to Firestore for a specified collection, and also stores them locally in PlayerPrefs. /// public static void SaveRewards(string collectionName, Dictionary data) { SaveRewardsLocally(collectionName, data); } /// /// Saves rewards data locally in PlayerPrefs as JSON. /// private static void SaveRewardsLocally(string collectionName, Dictionary data) { string json = JsonUtility.ToJson(data); PlayerPrefs.SetString(collectionName, json); PlayerPrefs.Save(); } /// /// Loads rewards data from PlayerPrefs if available. /// public static Dictionary LoadRewardsLocally(string collectionName) { string json = PlayerPrefs.GetString(collectionName, null); return string.IsNullOrEmpty(json) ? null : JsonUtility.FromJson>(json); } } }