public static void SaveData(UITests myBehaviour) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Create); DataManagerTest saveData = new DataManagerTest(myBehaviour); formatter.Serialize(stream, saveData); stream.Close(); }
private void Update() { if (Input.GetKeyDown(KeyCode.S)) { SaveSystem.SaveData(this); } if (Input.GetKeyDown(KeyCode.L)) { DataManagerTest data = SaveSystem.LoadData(); if (data == null) { return; } img.color = new Color(data.colorData[0], data.colorData[1], data.colorData[2]); img.GetComponent <RectTransform>().anchoredPosition = new Vector2(data.positionData[0], data.positionData[1]); img.GetComponent <RectTransform>().rotation = Quaternion.Euler(0, 0, data.zRotationData); } }
public static DataManagerTest LoadData() { if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); DataManagerTest loadData = formatter.Deserialize(stream) as DataManagerTest; stream.Close(); return(loadData); } else { Debug.Log("ERROR LOADING DATA"); return(null); } }
public ReportController() { dataManager = new DataManagerTest(); }