internal void SetDataFromDisk(SerializedContainer p_data, bool p_hardReload = false) { _backContainer = p_data; if (p_hardReload || !_initialized) { // TODO: (Daniel) check if the containers are ident before overwriting the session data _frontContainer = p_data; _initialized = true; } }
//private void DrawField(FieldInfo p_field, ref SerializedContainer p_object) //{ // System.Type type = p_field.FieldType; // if (type == typeof(float)) // { // float tmp = (float)p_field.GetValue(p_object); // p_field.SetValue(p_object, EditorGUILayout.FloatField(p_field.Name, tmp)); // } // else if (type == typeof(int)) // { // int tmp = (int)p_field.GetValue(p_object); // p_field.SetValue(p_object, EditorGUILayout.IntField(p_field.Name, tmp)); // } // else if (type == typeof(string)) // { // string tmp = (string)p_field.GetValue(p_object); // p_field.SetValue(p_object, EditorGUILayout.TextField(p_field.Name, tmp)); // } // else if (type == typeof(bool)) // { // bool tmp = (bool)p_field.GetValue(p_object); // p_field.SetValue(p_object, EditorGUILayout.Toggle(p_field.Name, tmp)); // } //} private void ReadFile(string path) { bool exists = File.Exists(path); if (exists) { try { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); _data = (SerializedContainer)bf.Deserialize(file); file.Close(); } catch (System.Exception e) { Debug.LogError("Failed to read File.\n" + e.StackTrace); } _saveFileLocation = path; } }