Exemplo n.º 1
0
        static IResource load(ResourceDescriptor desc)
        {
            IResource res;

            res = desc.create();

            if (res != null)
            {
                myResources[desc.name] = res;
            }

            return(res);
        }
Exemplo n.º 2
0
        public static IResource getResource(ResourceDescriptor desc)
        {
            IResource res;

            if (myResources.TryGetValue(desc.name, out res))
            {
                return(res);
            }

            //need to try and load the IResource here
            res = load(desc);

            return(res);
        }
Exemplo n.º 3
0
        public IResource getResource(ResourceDescriptor desc)
        {
            IResource res;

            if (myResources.TryGetValue(desc.name, out res))
            {
                return(res);
            }

            //need to try and load the IResource here
            res = load(desc);

            if (res == null)
            {
                throw new Exception("Failed to create resource");
            }

            return(res);
        }