Example #1
0
        public override void SyncData(IDataStore dataStore)
        {
            var trace = new List <string>();

            if (dataStore.IsSaving)
            {
                trace.Add("Saving data...");
                SavedValues.Snapshot();
            }
            else
            {
                trace.Add("Loading saved data...");
            }

            dataStore.SyncData("PacemakerSavedValues", ref _savedValues);
            _savedValues ??= new SavedValues();

            trace.Add($"Stored values: {SavedValues}");

            if (dataStore.IsSaving)
            {
                Main.ExternalSavedValues.Serialize();
            }
            else
            {
                OnLoad(isVanilla: false, trace); // Cannot be a vanilla save if SyncData was called on deserialization
            }
            Util.Log.ToFile(trace);
        }
 internal void Set(string charName, string clanName, SavedValues savedValues) =>
 _map[PackKey(charName, clanName)] = savedValues;