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