Пример #1
0
        /// <summary>
        /// Saves the <see cref="NPCChatDialogBase"/>s in this <see cref="NPCChatManagerBase"/> to file.
        /// </summary>
        /// <param name="contentPath">The content path.</param>
        public void Save(ContentPaths contentPath)
        {
            var dialogs = _npcChatDialogs.Where(x => x != null);

            // Write
            var filePath = GetFilePath(contentPath);

            using (var writer = GenericValueWriter.Create(filePath, _rootNodeName, EncodingFormat))
            {
                writer.WriteManyNodes(_chatDialogsNodeName, dialogs, ((w, item) => item.Write(w)));
            }
        }
Пример #2
0
        /// <summary>
        /// Writes the state of the object to an <see cref="IValueWriter"/>.
        /// </summary>
        /// <param name="writer">The <see cref="IValueWriter"/> to write the values to.</param>
        void IPersistable.WriteState(IValueWriter writer)
        {
            var items = _items.Where(x => x != null).ToArray();

            writer.WriteManyNodes(_rootNodeName, items, (w, item) => ((IPersistable)item).WriteState(w));
        }
 /// <summary>
 /// Returns an enumerator that iterates through the collection.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
 /// </returns>
 public IEnumerator <IQuestDescription> GetEnumerator()
 {
     return(_questDescriptions.Where(x => x != null).GetEnumerator());
 }