Пример #1
0
        public void LoadState(string filePath)
        {
            DebugConsole.Log($"Loading save file for an existing game session ({filePath})");
            SaveUtil.DecompressToDirectory(filePath, SaveUtil.TempPath, null);

            string    gamesessionDocPath = Path.Combine(SaveUtil.TempPath, "gamesession.xml");
            XDocument doc = XMLExtensions.TryLoadXml(gamesessionDocPath);

            if (doc == null)
            {
                DebugConsole.ThrowError($"Failed to load the state of a multiplayer campaign. Could not open the file \"{gamesessionDocPath}\".");
                return;
            }
            Load(doc.Root.Element("MultiPlayerCampaign"));
            GameMain.GameSession.OwnedSubmarines = SaveUtil.LoadOwnedSubmarines(doc, out SubmarineInfo selectedSub);
            GameMain.GameSession.SubmarineInfo   = selectedSub;
        }