public void SetStorage(object provider, object storeValue, PropertyInfo pi, ResourceOperationContext context)
        {
            ResourceReference[] references = (ResourceReference[])storeValue;
            ICollection <T>     collection = (ICollection <T>)pi.GetValue(provider);

            var referenceManager = context.ReferenceManager;

            if (referenceManager == null)
            {
                Debug.Assert(referenceManager != null);
            }

            for (int index = 0; index < references.Length; index++)
            {
                var refe = references[index];
                if (refe != null)
                {
                    collection.Add((T)referenceManager.GetResource(refe, context));
                }
            }
        }
Beispiel #2
0
        public object GetStorage(object provider, object value, PropertyInfo pi, ResourceOperationContext context)
        {
            T[] collection       = (T[])value;
            var references       = new ResourceReference[collection.Length];
            int i                = 0;
            var referenceManager = context.ReferenceManager;

            if (referenceManager == null)
            {
                Debug.Assert(referenceManager != null);
            }

            foreach (var item in collection)
            {
                if (item != null)
                {
                    references[i++] = referenceManager.GetReference(item, context);
                }
            }

            return(references);
        }
Beispiel #3
0
        public void SetStorage(object provider, object storeValue, PropertyInfo pi, ResourceOperationContext context)
        {
            ResourceReference[] referenes = (ResourceReference[])storeValue;
            T[] array = new T[referenes.Length];

            var referenceManager = context.ReferenceManager;

            if (referenceManager == null)
            {
                Debug.Assert(referenceManager != null);
            }

            for (int i = 0; i < referenes.Length; i++)
            {
                if (referenes[i] != null)
                {
                    array[i] = (T)referenceManager.GetResource(referenes[i], context);
                }
            }

            array = array.Where(x => x != null).ToArray();
            pi.SetValue(provider, array);
        }
Beispiel #4
0
        public object GetStorage(object provider, object propValue, System.Reflection.PropertyInfo pi, ResourceOperationContext context)
        {
            StateStore state = new StateStore(propValue);

            return(state);
        }
Beispiel #5
0
        public void SetStorage(object provider, object storeValue, System.Reflection.PropertyInfo pi, ResourceOperationContext context)
        {
            StateStore state = (StateStore)storeValue;
            var        obj   = pi.GetValue(provider);

            state.Restore(obj);
        }
Beispiel #6
0
 public object OnCreateResource(ResourceOperationContext context)
 {
     return(new SkyDome());
 }
Beispiel #7
0
 public void OnAssetCreated(object provider, ResourceOperationContext context)
 {
 }
Beispiel #8
0
 public object OnCreateResource(ResourceOperationContext context)
 {
     return(null);
 }
Beispiel #9
0
 public object OnCreateResource(ResourceOperationContext context)
 {
     return(new Mesh(VertexDescriptor.GetDescriptor(_vertexType)));
 }
Beispiel #10
0
            public void OnAssetCreated(object provider, ResourceOperationContext context)
            {
                var mesh = (Mesh)provider;

                _vertexType = mesh.VertexDescriptor.VertexType;
            }
Beispiel #11
0
        public void SetStorage(object provider, object storeValue, System.Reflection.PropertyInfo pi, ResourceOperationContext context)
        {
            Data data = (Data)storeValue;
            var  mesh = (Mesh)provider;

            mesh.CreateIndexBuffer(data.Buffer, data.SixteenBits?IndexFormat.Index16: IndexFormat.Index32);
        }
Beispiel #12
0
        public object GetStorage(object provider, object propValue, System.Reflection.PropertyInfo pi, ResourceOperationContext context)
        {
            var ibuffer = (GraphicBuffer)propValue;

            byte[] buffer = ibuffer.ToArray <byte>();
            return(new Data {
                Buffer = buffer, SixteenBits = ibuffer.Stride == 2
            });
        }
Beispiel #13
0
        public void SetStorage(object provider, object storeValue, System.Reflection.PropertyInfo pi, ResourceOperationContext context)
        {
            byte[] vbuffer = (byte[])storeValue;
            var    mesh    = (Mesh)provider;

            mesh.CreateVertexBuffer(vbuffer);
        }
Beispiel #14
0
        public object GetStorage(object provider, object propValue, System.Reflection.PropertyInfo pi, ResourceOperationContext context)
        {
            var vb = (GraphicBuffer)propValue;

            byte[] vbuffer = vb.ToArray <byte>();
            return(vbuffer);
        }