Esempio n. 1
0
    public void create(string s) {
        if (s=="") {
            throw new Exception("Empty file name exception");
        }
        s=s.Replace(' ', '_');
        foreach (char c in Path.GetInvalidFileNameChars()) {
            s=s.Replace(c, '_');
        }

        BinaryFormatter bf=new BinaryFormatter();
        FileStream file=File.Create(Application.persistentDataPath+"/saves/"+s+".save");
        playerSave save=new playerSave();
        save.fileName=s;
        bf.Serialize(file, save);
        Application.LoadLevel(1);
    }
Esempio n. 2
0
    public void create(string s)
    {
        if (s == "")
        {
            throw new Exception("Empty file name exception");
        }
        s = s.Replace(' ', '_');
        foreach (char c in Path.GetInvalidFileNameChars())
        {
            s = s.Replace(c, '_');
        }

        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/saves/" + s + ".save");
        playerSave      save = new playerSave();

        save.fileName = s;
        bf.Serialize(file, save);
        Application.LoadLevel(1);
    }
	// Use this for initialization
	void Start () {
        current = this;
    }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     current = this;
 }