Пример #1
0
    private void HandleLoadSaveFromDrop(string file)
    {
        GD.Print("Trying to load dropped save file...");

        // TODO: would be nice to have some kind of popup box showing the errors from here to the user
        try
        {
            var info = Save.LoadJustInfoFromSave(file);

            if (info.Type == SaveInformation.SaveType.Invalid)
            {
                GD.PrintErr("Given file (", file, ") is not a valid Thrive save");
                return;
            }

            if (SaveHelper.IsKnownIncompatible(info.ThriveVersion))
            {
                GD.Print("Dropped save file is known incompatible, not loading it");
                return;
            }

            if (info.ThriveVersion != Constants.Version)
            {
                // TODO: would be nice to show a confirmation dialog here
                GD.Print("The dropped save version is not exactly the same as current game version");
            }

            SaveHelper.LoadSave(file);
        }
        catch (Exception e)
        {
            GD.PrintErr("Exception while trying to load dropped save: ", e);
        }
    }