public ResourceBundle AddBundleFromProjectPath(string projectPath) { // TODO: Throw out the entire resource system. It's shit. Also there is a race condition here... if (_bundlesByProjectPath.ContainsKey(projectPath)) return _bundlesByProjectPath[projectPath]; var bundle = new ResourceBundle(projectPath); Console.WriteLine(@"Need to load all .xassets in the folder here..."); _bundlesByGuid.TryAdd(bundle.Guid, bundle); _bundlesByProjectPath.TryAdd(projectPath, bundle); return bundle; }
internal static Resource GetDerivedResouceFromFileType(ResourceBundle resourceBundle, string fullPath) { switch (GetResourceTypeFromFile(fullPath)) { case ResourceType.Model: return(new ModelResource(resourceBundle)); case ResourceType.Texture: return(new TextureResource(resourceBundle)); default: throw new ResourceImportException("Unhandled file type"); } }
internal Resource(ResourceBundle bundle) { ResourceBundle = bundle; }
internal ModelResource(ResourceBundle bundle) : base(bundle) { DataBlock = new ModelDataBlock(); }
internal TextureResource(ResourceBundle bundle) : base(bundle) { DataBlock = new TextureDataBlock(); }