Пример #1
0
    public void load_expdata()
    {
        if (File.Exists(Application.persistentDataPath + "/" + juego + savefile + "expdata0911.dat"))
        {
            BinaryFormatter bf      = new BinaryFormatter();
            FileStream      my_file = File.Open(Application.persistentDataPath + "/" + juego + savefile + "expdata0911.dat", FileMode.Open);
            experiencedata  my_data = (experiencedata)bf.Deserialize(my_file);

            base_nivel  = my_data.base_nivel;
            experience  = my_data.experience;
            fuerza      = my_data.fuerza;
            speed       = my_data.speed;
            defensa     = my_data.defensa;
            autocura    = my_data.autocura;
            autopotion  = my_data.autopotion;
            skillpoints = my_data.skillpoints;


            my_file.Close();
            Debug.Log("exp datos cargadas");
        }
        else
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Create(Application.persistentDataPath + "/" + juego + savefile + "expdata0911.dat");
            experiencedata  data = new experiencedata();


            data.base_nivel  = base_nivel;
            data.experience  = experience;
            data.fuerza      = fuerza;
            data.speed       = speed;
            data.defensa     = defensa;
            data.autocura    = autocura;
            data.autopotion  = autopotion;
            data.skillpoints = skillpoints;



            bf.Serialize(file, data);
            file.Close();
            Debug.Log("exp datos guardadas");
        }
    }
Пример #2
0
    public void save_expdata()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/" + juego + savefile + "expdata0911.dat");
        experiencedata  data = new experiencedata();



        data.base_nivel  = base_nivel;
        data.experience  = experience;
        data.fuerza      = fuerza;
        data.speed       = speed;
        data.defensa     = defensa;
        data.autocura    = autocura;
        data.autopotion  = autopotion;
        data.skillpoints = skillpoints;


        bf.Serialize(file, data);
        file.Close();
        Debug.Log("exp datos guardadas");
    }
Пример #3
0
    public void Reset_playerdata(Dictionary <int, mision_data> _catalogo_misiones, Dictionary <int, inventario_data> _catalogo_inventario, Dictionary <int, mision_orbes_data> _catalogo_orbes_misiones, string _savefile)
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/" + juego + _savefile + "094.dat");
        PlayerData      data = new PlayerData();

        data.puntos = puntos;

        data.currentarmor    = 0;
        data.currentespecial = 0;
        data.armorunlocked   = 0;
        data.espunlocked     = 0;

        data.historiainicialoida = 0;

        data.catalogo_misiones   = _catalogo_misiones;
        data.catalogo_inventario = _catalogo_inventario;
        data.catalogo_skills     = catalogo_skills;


        bf.Serialize(file, data);
        file.Close();
        Debug.Log("datos player guardadas");

        BinaryFormatter bf2   = new BinaryFormatter();
        FileStream      file2 = File.Create(Application.persistentDataPath + "/" + juego + _savefile + "especialdata.dat");
        EspData         data2 = new EspData();

        data2.bossrushcelared = 0;
        data2.gamecleared     = 0;

        bf2.Serialize(file2, data2);
        file2.Close();
        Debug.Log("datos especial guardadas");

        BinaryFormatter bf3   = new BinaryFormatter();
        FileStream      file3 = File.Create(Application.persistentDataPath + "/" + juego + _savefile + "expdata0911.dat");
        experiencedata  data3 = new experiencedata();



        data3.base_nivel  = 1;
        data3.experience  = 0;
        data3.fuerza      = 1;
        data3.speed       = 1;
        data3.defensa     = 1;
        data3.autocura    = 0;
        data3.autopotion  = 0;
        data3.skillpoints = 0;


        bf3.Serialize(file3, data3);
        file3.Close();
        Debug.Log("exp datos guardadas");

        BinaryFormatter bf4   = new BinaryFormatter();
        FileStream      file4 = File.Create(Application.persistentDataPath + "/" + juego + savefile + "idiomasetup07.dat");
        IdiomaData      data4 = new IdiomaData();

        data4.idioma           = idioma;
        data4.languageselected = languageselected;
        bf4.Serialize(file4, data4);
        file4.Close();
        Debug.Log("datos idioma guardadas");


        BinaryFormatter bf5   = new BinaryFormatter();
        FileStream      file5 = File.Create(Application.persistentDataPath + "/" + juego + savefile + "orbes03.dat");
        main_orbes_data data5 = new main_orbes_data();



        data5.catalogo_orbes_misiones = _catalogo_orbes_misiones;
        bf5.Serialize(file5, data5);
        file5.Close();
        Debug.Log("datos orbes guardadas");
    }