Beispiel #1
0
    public void LoadDates()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Open(nameRute, FileMode.Open);

        DatesToSave datos = (DatesToSave)bf.Deserialize(file);

        lifes       = datos.lifes;
        starsLevels = datos.starsLevels;

        float days    = datos.timeToSave.Day;
        float hours   = datos.timeToSave.Hour;
        float minutes = datos.timeToSave.Minute;
        float seconds = datos.timeToSave.Second;

        file.Close();

        days    = timeToEnter.Day - days;
        hours   = timeToEnter.Hour - hours;
        minutes = timeToEnter.Minute - minutes;
        seconds = timeToEnter.Second - seconds;

        if (days > 1)
        {
            dataManager.ModifyLifes(maxLifes);
        }
        else
        {
            float timeTotal = (days * 3600 * 24) + (hours * 3600) + (minutes * 60) + seconds + currentTimeRecoverLife;
            int   lifesToUP = Mathf.RoundToInt(timeTotal / timeToRecoverLife);
            currentTimeRecoverLife = timeTotal % timeToRecoverLife;
            dataManager.ModifyLifes(lifesToUP);
        }
    }
    private void SaveDates()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(nameRute);

        DatesToSave datos = new DatesToSave();

        datos.globalKarma = globalKarma; //cambiar datos para guardar

        bf.Serialize(file, datos);
        file.Close();
    }
Beispiel #3
0
    public void SaveDates()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(nameRute);

        DatesToSave datos = new DatesToSave();

        datos.ChangeDates(lifes, starsLevels);

        bf.Serialize(file, datos);

        file.Close();
    }
    private void LoadDates()
    {
        if (File.Exists(nameRute))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(nameRute, FileMode.Open);

            DatesToSave datos = (DatesToSave)bf.Deserialize(file);
            globalKarma = datos.globalKarma; //Coger Datos

            file.Close();
        }
        else
        {
            ResetData();
        }
    }