示例#1
0
        public void Deserialize(MyObjectBuilder_ComponentContainer builder)
        {
            var componentsData = builder.Components;

            if (componentsData != null)
            {
                foreach (var data in componentsData)
                {
                    var instance = MyComponentFactory.CreateInstance(data.Component.GetType());
                    instance.Deserialize(data.Component);
                    var dictType = MyComponentTypeFactory.GetType(data.TypeId);
                    Add(dictType, instance);
                }
            }
        }
示例#2
0
        public void Deserialize(MyObjectBuilder_ComponentContainer builder)
        {
            if (builder == null || builder.Components == null)
            {
                return;
            }

            foreach (var data in builder.Components)
            {
                var instance = MyComponentFactory.CreateInstance(data.Component.GetType());
                instance.Deserialize(data.Component);
                var dictType = MyComponentTypeFactory.GetType(data.TypeId);
                Add(dictType, instance);
            }
        }