public static LoadEffectsList ( IEnumerable |
||
effects | IEnumerable |
|
Résultat | void |
private void LoadFile(string path, List <string> pathArgs = null) { var projectLoader = new GameLoader(); this.FileReaderProvider = projectLoader.Load(path); project = FileReaderProvider.GetProjectReader().Load(); BasePath = project.BaseDir; PixelsDown = project.ScreenHeight; PixelsAcross = project.ScreenWidth; if (ScreenSizeChanged != null) { ScreenSizeChangedEventArgs args = new ScreenSizeChangedEventArgs(PixelsAcross, PixelsDown); ScreenSizeChanged(this, args); } if (project.MusicNSF != null) { Engine.Instance.SoundSystem.LoadMusicNSF(project.MusicNSF.Absolute); } if (project.EffectsNSF != null) { Engine.Instance.SoundSystem.LoadSfxNSF(project.EffectsNSF.Absolute); } foreach (var stageInfo in project.Stages) { stageFactory.Load(stageInfo); } _tileProperties.LoadProperties(project.EntityProperties); _entitySource.LoadEntities(project.Entities); EffectParser.LoadEffectsList(project.Functions); Engine.Instance.SoundSystem.LoadEffectsFromInfo(project.Sounds); Scene.LoadScenes(project.Scenes); Menu.LoadMenus(project.Menus); FontSystem.Load(project.Fonts); PaletteSystem.LoadPalettes(project.Palettes); currentPath = path; if (pathArgs != null && pathArgs.Any()) { ProcessCommandLineArgs(pathArgs); } else if (project.StartHandler != null) { _stateMachine.ProcessHandler(project.StartHandler); } else { throw new GameRunException("The game file loaded correctly, but it failed to specify a starting point!"); } Player = new Player(); }
private void IncludeXmlFile(string path) { try { XDocument document = XDocument.Load(path, LoadOptions.SetLineInfo); foreach (XElement element in document.Elements()) { switch (element.Name.LocalName) { case "Entities": _entitySource.LoadEntities(element); _tileProperties.LoadProperties(element); break; case "Functions": EffectParser.LoadEffectsList(element); break; case "Sounds": case "Scenes": case "Scene": case "Menus": case "Menu": case "Fonts": case "Palettes": break; default: throw new GameXmlException(element, string.Format("Unrecognized XML type: \"{0}\"", element.Name.LocalName)); } } } catch (GameXmlException ex) { ex.File = path; throw; } }