public static void SyncNewCampaign() //fired when player starts a new campaign { DeserializeStorageJson(); if (metaTrackers != null)//we were unable to find a tracker, add our own { MetaTracker tracker = new MetaTracker(); tracker.SetTrackedPilots(TrackedPilots); metaTrackers.Add(tracker); CurrentIndex = metaTrackers.Count - 1; // -1 due to zero-based arrays } }
public static void Resync(DateTime previousSaveTime) //fired before a save deserializes itself through a patch on GameInstanceSave's PostDeserialization { DeserializeStorageJson(); int index = FindTrackerByTime(previousSaveTime); if (index > -1) { if (metaTrackers[index].TrackedPilots != null) //part where everything seems to fall apart? { TrackedPilots = metaTrackers[index].TrackedPilots; } CurrentIndex = index; } else if (metaTrackers != null)//we were unable to find a tracker, add our own { MetaTracker tracker = new MetaTracker(); tracker.SetTrackedPilots(TrackedPilots); metaTrackers.Add(tracker); CurrentIndex = metaTrackers.Count - 1; // -1 due to zero-based arrays } }