コード例 #1
0
 public void Load()
 {
     if (File.Exists(Application.dataPath + "/matchData.dat"))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open(Application.dataPath + "/matchData.dat", FileMode.Open);
         Infoo           info = (Infoo)bf.Deserialize(file);
         file.Close();
         scoreToWin  = info.scoreToWin;
         sceneToLoad = info.levelToLoad;
         Debug.Log("Loaded");
     }
 }
コード例 #2
0
    public void HostSave()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.dataPath + "/matchData.dat");
        Infoo           inf  = new Infoo();

        if (gameObject.GetComponent <Canvas>() != null)
        {
            inf.scoreToWin  = int.Parse(transform.GetComponentInChildren <InputField> ().text);
            inf.levelToLoad = transform.GetComponentInChildren <Dropdown> ().captionText.text;
        }
        bf.Serialize(file, inf);
        Debug.Log("Saved");
        file.Close();
    }
コード例 #3
0
ファイル: Infoo.cs プロジェクト: ruanxianzhi/Dark-Forest
 public void Awake()
 {
     S = this;
 }