public static void RegisterPersister(IDataPersister _persister) { var ds = _persister.GetDataSettings(); if (!string.IsNullOrEmpty(ds.data_tag)) { Instance.Register(_persister); } }
public static void DataPersisterGUI(IDataPersister dataPersister) { DataSettings dataSettings = dataPersister.GetDataSettings(); DataSettings.PersistenceType persistenceType = (DataSettings.PersistenceType)EditorGUILayout.EnumPopup("Persistence Type", dataSettings.persistenceType); string dataTag = EditorGUILayout.TextField("Data Tag", dataSettings.dataTag); dataPersister.SetPersistenceDataSettings(dataTag, persistenceType); }
/// <summary> /// Save data of single persister /// </summary> /// <param name="persister"></param> private void SaveData(IDataPersister persister) { DataSettings dataSettings = persister.GetDataSettings(); if (dataSettings.type == DataSettings.PersistenceType.ReadOnly || dataSettings.type == DataSettings.PersistenceType.DoNotPersist) { return; } Store[dataSettings.dataId] = persister.SaveData(); }
public void DataPersisterGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(m_Settings.FindPropertyRelative("type")); if (m_DataPersister.GetDataSettings().type != DataSettings.PersistenceType.DoNotPersist) { EditorGUILayout.PropertyField(m_Settings.FindPropertyRelative("dataId")); } serializedObject.ApplyModifiedProperties(); }
protected void Save(IDataPersister dp) { var dataSettings = dp.GetDataSettings(); if (dataSettings.persistenceType == DataSettings.PersistenceType.ReadOnly || dataSettings.persistenceType == DataSettings.PersistenceType.DoNotPersist) { return; } if (!string.IsNullOrEmpty(dataSettings.dataTag)) { m_Store[dataSettings.dataTag] = dp.SaveData(); } }
protected void Save(IDataPersister _persister) { var dataSettings = _persister.GetDataSettings(); if (dataSettings.persistence_type == DataSettings.PersistenceType.ReadOnly || dataSettings.persistence_type == DataSettings.PersistenceType.DoNotPersist) { return; } if (!string.IsNullOrEmpty(dataSettings.data_tag)) { m_store[dataSettings.data_tag] = _persister.SaveData(); } }
/// <summary> /// Load data of single persister /// </summary> /// <param name="persister"></param> private void LoadData(IDataPersister persister) { DataSettings dataSettings = persister.GetDataSettings(); if (dataSettings.type == DataSettings.PersistenceType.WriteOnly || dataSettings.type == DataSettings.PersistenceType.DoNotPersist) { return; } if (Store.ContainsKey(dataSettings.dataId)) { persister.LoadData(Store[dataSettings.dataId]); } }