private UABComponent Pack(Component component, List <ISerializer> serializers)
        {
            var uComponent = new UABComponent();

            uComponent.instanceId = component.GetInstanceID();
            uComponent.type       = Builder.GetTypeString(component.GetType());

            var found = false;

            for (int j = 0; j < serializers.Count; ++j)
            {
                if (serializers[j].IsValid(component) == true)
                {
                    var field        = new UABField();
                    var componentObj = (object)component;
                    serializers[j].Serialize(this, field, ref componentObj, serializers);
                    uComponent.fields = field.fields;
                    found             = true;
                    break;
                }
            }

            if (found == false)
            {
                var uFields = this.Serialize(component, serializers);
                uComponent.fields = uFields;
            }

            return(uComponent);
        }
Exemplo n.º 2
0
        public void Unpack(Component component, UABComponent uComponent, List <ISerializer> serializers)
        {
            var found = false;

            for (int j = 0; j < serializers.Count; ++j)
            {
                if (serializers[j].IsValid(component) == true)
                {
                    var field = new UABField();
                    field.fields = uComponent.fields;
                    var componentObj = (object)component;
                    serializers[j].DeserializeBeforeRef(this, field, ref componentObj, serializers);
                    found = true;
                    break;
                }
            }

            if (found == false)
            {
                this.Deserialize(component, uComponent.fields, serializers);
            }
        }
Exemplo n.º 3
0
 public void RegisterReferenceUnpack(UABComponent component, Object obj)
 {
     this.tempReferencesUnpack.Add(component.instanceId, obj);
 }