Пример #1
0
    public void LoadWinPoints()
    {
        WinPointData winPointData = SaveSystem.LoadWinPoints();

        winPointCounter.winPoints          = winPointData.winPoints;
        winPointCounter.purchaseUnlockCost = winPointData.purchaseUnlockCost;
        winPointCounter.UpdateWinTrackers();
    }
Пример #2
0
    //vvv SAVE vvv

    public static void SaveWinPoints(WinPointCounter winPointCounter)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/winPoints.save";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        WinPointData data = new WinPointData(winPointCounter);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Пример #3
0
    //vvv LOAD vvv

    public static WinPointData LoadWinPoints()
    {
        string path = Application.persistentDataPath + "/winPoints.save";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            WinPointData data = formatter.Deserialize(stream) as WinPointData;
            stream.Close();

            return(data);
        }
        else
        {
            Debug.LogError("No Save File in: " + path);
            return(null);
        }
    }