Ejemplo n.º 1
0
    public static void OrignSave2(GameManagerOrign gameManagerOrign)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/Orign2.data";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        OrignSave2 data = new OrignSave2(gameManagerOrign);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Ejemplo n.º 2
0
    public static OrignSave2 OrignLoad2()
    {
        string path = Application.persistentDataPath + "/Orign2.data";

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

            OrignSave2 data = formatter.Deserialize(stream) as OrignSave2;
            stream.Close();
            return(data);
        }
        else
        {
            Debug.Log("Save File Cannot be found in " + path);
            return(null);
        }
    }
Ejemplo n.º 3
0
    public void LoadGame2(int index)
    {
        OrignSave2 data = SavingSystem.OrignLoad2();
        string     Tile = "Tiles";

        if (PlayerPrefs.GetInt("Theme") == 0 || PlayerPrefs.GetInt("FirstTimeO") == 1)
        {
            foreach (Transform tile in PlayGrid)
            {
                Destroy(tile.gameObject);
            }
        }
        else if (PlayerPrefs.GetInt("Theme") == 1)
        {
            foreach (Transform tile in PlayGrid)
            {
                Destroy(tile.gameObject);
            }
        }
        for (i = 0; i < data.posX2.Count; i++)
        {
            x = data.posX2[index];
            y = data.posY2[index];

            Grid[x, y] = (GameObject)Instantiate(Resources.Load(Tile), new Vector2(data.posX2[index] * 1.1f, data.posY2[index] * 1.1f), Quaternion.identity);
            if (PlayerPrefs.GetInt("Theme") == 0 || PlayerPrefs.GetInt("FirstTimeO") == 1)
            {
                Grid[x, y].transform.SetParent(PlayGrid);
            }
            else if (PlayerPrefs.GetInt("Theme") == 1)
            {
                Grid[x, y].transform.SetParent(PlayGrid);
            }
            Grid[x, y].GetComponent <Tiles>().Number = data.tileNumber2[index];
            index++;
        }
        theScore = data.score2;
    }