private void ThreadedAssetLoader() { // Spin through the attribute list and load based on type foreach (XElement at in _assetsForThreadedLoad.Element("assets").Elements()) { // Expected XML structure is "assets" - "[assettype]s" - "[asset]" foreach (XElement asset in at.Elements()) { switch (at.Name.ToString()) { case "textures": TextureManager.AddTexture(asset.Attribute("name").Value, Game.Content.Load <Texture2D>(asset.Attribute("file").Value)); break; case "music": MusicManager.AddTune(asset.Attribute("name").Value, Game.Content.Load <Song>(asset.Attribute("file").Value)); break; case "sound-effects": if (asset.Attribute("use-instance") != null) { SoundEffectManager.AddEffect( asset.Attribute("name").Value, Game.Content.Load <SoundEffect>(asset.Attribute("file").Value), (bool)asset.Attribute("use-instance")); } else { SoundEffectManager.AddEffect( asset.Attribute("name").Value, Game.Content.Load <SoundEffect>(asset.Attribute("file").Value), false); } break; case "custom": LoadCustomContent(asset); break; } _loadedAssetCount++; } } }