static IResource load(ResourceDescriptor desc) { IResource res; res = desc.create(); if (res != null) { myResources[desc.name] = res; } return(res); }
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); }
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); }