コード例 #1
0
 void Awake()
 {
     shameData = SaveSystem.LoadShameData();
     if (shameData == null)
     {
         shameData = new ShameData(0, new List <byte[]>(), new List <string>(), new List <string>(), new List <string>());
         Debug.Log("ShameData created from none");
     }
     else if (shameData != null)
     {
         Debug.Log("Number of Shames to Load is: " + shameData.numberOfShames);
         LoadShameImages();
     }
 }
コード例 #2
0
ファイル: SaveSystem.cs プロジェクト: Orlokun/TruCounter
    public static ShameData LoadShameData()
    {
        string path = Application.persistentDataPath + "/shameBytes.dog";

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

            ShameData shameData = (ShameData)bFormatter.Deserialize(fStream);
            fStream.Close();
            return(shameData);
        }
        else
        {
            Debug.LogError("Save file not found in " + path + "");
            return(null);
        }
    }