コード例 #1
0
        public static void RegisterPersister(IDataPersister _persister)
        {
            var ds = _persister.GetDataSettings();

            if (!string.IsNullOrEmpty(ds.data_tag))
            {
                Instance.Register(_persister);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
    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();
        }
    }
コード例 #6
0
        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();
            }
        }
コード例 #7
0
        /// <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]);
            }
        }