Beispiel #1
0
 public static void LoadDataToRankData()
 {
     if (System.IO.File.Exists(baseSavePath + "/rank.dat"))
     {
         RankData.scores = FileReadWrite.ReadFromBinaryFile <List <int> >(baseSavePath + "/rank.dat");
     }
 }
Beispiel #2
0
    public static CurrencySaveData LoadCurrency(string path)
    {
        string filePath = baseSavePath + "/" + path + ".dat";

        if (System.IO.File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <CurrencySaveData>(filePath));
        }
        return(null);
    }
Beispiel #3
0
    public static ItemContainerSaveData _LoadItems(string path)
    {
        string filePath = baseSavePath + "/" + path + ".dat";

        if (System.IO.File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <ItemContainerSaveData>(filePath));
        }
        return(null);
    }
    public static DataHero LoadData(string fileName)
    {
        string filePath = baseSavePath + "/" + fileName + ".dat";

        if (System.IO.File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <DataHero>(filePath));
        }
        return(null);
    }
Beispiel #5
0
    public static GameProgressSaveData LoadGameProgress()
    {
        var filePath = Path.Combine(baseSavePath, "progress.dat");

        if (File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <GameProgressSaveData>(filePath));
        }
        return(null);
    }
Beispiel #6
0
    public static List <MyConfiguration> LoadItems(string path)
    {
        string filePath = baseSavePath + "/" + path + ".dat";

        if (System.IO.File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <List <MyConfiguration> >(filePath));
        }
        return(null);
    }
Beispiel #7
0
    public static T loadData <T>(string path)
    {
        string filePath = baseSavePath + "/" + path + ".dat";

        if (System.IO.File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <T>(filePath));
        }

        return(default(T));
    }
    public static ItemContainerSaveData LoadItems(string fileName)
    {
        string filePath = baseSavePath + "/" + fileName + ".dat";

        if (System.IO.File.Exists(filePath))
        {
            return(FileReadWrite.ReadFromBinaryFile <ItemContainerSaveData>(filePath));
        }
        else
        {
            Debug.LogError("Save file not found in" + filePath);
            return(null);
        }
    }
Beispiel #9
0
    public bool LoadGeneration(string filePath)
    {
        if (!System.IO.File.Exists(filePath))
        {
            return(false);
        }
        GeneticSaveData <T> save = FileReadWrite.ReadFromBinaryFile <GeneticSaveData <T> >(filePath);

        Generation = save.Generation;
        for (int i = 0; i < save.PopulationGenes.Count; i++)
        {
            if (i >= Population.Count)
            {
                Population.Add(new DNA <T>(dnaSize, random, getRandomGene, fitnessFunction, crossoverType, shouldInitGenes: false));
            }
            Array.Copy(save.PopulationGenes[i], Population[i].Genes, dnaSize);
        }
        return(true);
    }