public void RevealGridNums()
 {
     // PopulateGrid();
     numsCorrect = SaveManager.LoadNumsFilled(lvl);
     if (numsCorrect == null)
     {
         SaveManager.SaveNumsFilled(GridFI.RevealSpotsFilled(lvl), lvl);
     }
     PopulateGridChecker();
     LogRevealedGrid();
 }
Example #2
0
    public static bool[] LoadNumsFilled(int saveSlot)
    {
        string path = Application.persistentDataPath + "/numsFilled" + saveSlot.ToString() + ".bin";

        if (File.Exists(path))
        {
            BinaryFormatter formatter      = new BinaryFormatter();
            FileStream      stream         = new FileStream(path, FileMode.Open);
            bool[]          gridNumsFilled = (bool[])formatter.Deserialize(stream);
            stream.Close();
            // Debug.Log("Loaded nums correct in save slot: " + saveSlot.ToString());
            return(gridNumsFilled);
        }
        else
        {
            BinaryFormatter formatter      = new BinaryFormatter();
            FileStream      stream1        = new FileStream(path, FileMode.Create);
            bool[]          gridNumsFilled = GridFI.RevealSpotsFilled(saveSlot);
            Debugger.LogBoolGrid(gridNumsFilled, "Saved numbers filled:");
            formatter.Serialize(stream1, gridNumsFilled);
            stream1.Close();
            return(gridNumsFilled);
        }
    }