public void Load()
    {
        if (File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + currentPlayerName + ".fmc"))
        {
            saveload        sl   = new saveload();
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + Path.DirectorySeparatorChar + currentPlayerName + ".fmc", FileMode.Open);
            sl = (saveload)bf.Deserialize(file);
            file.Close();

            // Anwendung der geladenen Daten
            storyModeSettings.createSettingsFromLoadedData(sl.storyModeSettings.step, sl.storyModeSettings.level);
            oneTimesOneSettings.setSettings(sl.oneTimesOneSettings);
            freestyleSettings.setSettings(sl.freestyleSettings);

            statistics.setStatisticsFromLoadedData(sl.statistics);

            //Debug.Log("One times One Settings");
            //oneTimesOneSettings.logAllSettings();
            //Debug.Log("FreestyleSettings");
            //freestyleSettings.logAllSettings();
        }
        else
        {
            if (FMC_GameDataController.instance)
            {
                FMC_GameDataController.instance.resetPlayerData();
            }
        }
    }
示例#2
0
    private void Save()
    {
        saveload sl = new saveload();

        sl.players    = playerNames;
        sl.playerIDs  = playerIDs;
        sl.playerAges = playerAges;

        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/playerData.data");

        bf.Serialize(file, sl);
        file.Close();
    }
示例#3
0
    private void Load()
    {
        if (File.Exists(Application.persistentDataPath + "/playerData.data"))
        {
            saveload        sl   = new saveload();
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/playerData.data", FileMode.Open);
            sl = (saveload)bf.Deserialize(file);
            file.Close();

            playerNames = sl.players;
            playerIDs   = sl.playerIDs;
            playerAges  = sl.playerAges;
        }
    }
    public void Save()
    {
        saveload sl = new saveload();

        sl.storyModeSettings   = storyModeSettings;
        sl.oneTimesOneSettings = oneTimesOneSettings;
        sl.freestyleSettings   = freestyleSettings;
        sl.statistics          = statistics;

        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + Path.DirectorySeparatorChar + currentPlayerName + ".fmc");

        bf.Serialize(file, sl);
        file.Close();
    }