Пример #1
0
        private static ComponentDocument MakeComponentDocument(EntityComponent entityComponent)
        {
            ComponentDocument componentDocument = new ComponentDocument()
            {
                id         = entityComponent.ID,
                name       = entityComponent.Name,
                attributes = MakeAttributeDocuments(entityComponent.Properties.Values)
            };

            return(componentDocument);
        }
Пример #2
0
        private static EntityComponent ParseComponent(ComponentDocument componentDocument)
        {
            EntityComponent component = new EntityComponent(componentDocument.id,
                                                            componentDocument.name,
                                                            new Dictionary <string, Property>());

            if (componentDocument.attributes != null)
            {
                foreach (PropertyDocument propertyDocument in componentDocument.attributes)
                {
                    Property property = ParseProperty(propertyDocument);

                    component.SetProperty(property.Name, property.Value);
                }
            }

            return(component);
        }