public override void OnEnter() { DwarfGame.GumInputMapper.GetInputQueue(); CurrentScroll = 0; CreditsFont = GameState.Game.Content.Load <SpriteFont>(AssetManager.ResolveContentPath(ContentPaths.Fonts.Default)); Entries = FileUtils.LoadJsonFromResolvedPath <List <CreditEntry> >("credits.json"); IsInitialized = true; IsDone = false; base.OnEnter(); }
public ParticleManager(ComponentManager Components) { // Todo: Better modding support - make it a list of named emitters. Effects = new Dictionary <string, ParticleEffect>(); Load(Components, FileUtils.LoadJsonFromResolvedPath <Dictionary <string, List <EmitterData> > >(ContentPaths.Particles.particles)); }
public static void LoadDefaultSounds() { try { string[] defaultSounds = { ContentPaths.Audio.pick, ContentPaths.Audio.hit, ContentPaths.Audio.jump, ContentPaths.Audio.ouch, ContentPaths.Audio.gravel, ContentPaths.Audio.river }; foreach (string name in defaultSounds) { SoundEffect effect = Content.Load <SoundEffect>(AssetManager.ResolveContentPath(name)); EffectLibrary[name] = effect; } try { Mixer = FileUtils.LoadJsonFromResolvedPath <SFXMixer>(ContentPaths.mixer); } catch (FileNotFoundException) { Console.Out.WriteLine("Mixer file didn't exist. Creating a new mixer."); Mixer = new SFXMixer() { Gains = new Dictionary <string, SFXMixer.Levels>() }; } SoundEffect.DistanceScale = 0.25f; //SoundEffect.DopplerScale = 0.1f; AudioEngine = new AudioEngine("Content\\Audio\\XACT\\Win\\Sounds.xgs"); SoundBank = new SoundBank(AudioEngine, "Content\\Audio\\XACT\\Win\\SoundBank.xsb"); WaveBank = new WaveBank(AudioEngine, "Content\\Audio\\XACT\\Win\\WaveBank.xwb"); CurrentMusic = new FancyMusic(); CurrentMusic.AddTrack("main_theme_day", new MusicTrack(SoundBank) { Intro = "music_1_intro", Loop = "music_1_loop", PlayLoopOverIntro = false }); CurrentMusic.AddTrack("main_theme_night", new MusicTrack(SoundBank) { Intro = "music_1_night_intro", Loop = "music_1_night", PlayLoopOverIntro = true }); CurrentMusic.AddTrack("menu_music", new MusicTrack(SoundBank) { Loop = "music_menu", PlayLoopOverIntro = true }); CurrentMusic.AddTrack("molemen", new MusicTrack(SoundBank) { Loop = "molemen", PlayLoopOverIntro = true }); CurrentMusic.AddTrack("elf", new MusicTrack(SoundBank) { Loop = "elf", PlayLoopOverIntro = true }); CurrentMusic.AddTrack("undead", new MusicTrack(SoundBank) { Loop = "undead", PlayLoopOverIntro = true }); CurrentMusic.AddTrack("goblin", new MusicTrack(SoundBank) { Loop = "goblin", PlayLoopOverIntro = true }); foreach (var cue in ActiveCues) { cue.Value.Stop(AudioStopOptions.Immediate); } ActiveCues.Clear(); } catch (Exception exception) { Console.Error.WriteLine(exception); HasAudioDevice = false; AudioError = exception.Message; } }
public static void InitializeDefaultLibrary() { // Todo: Better modding support - load list with names. Embarkments = FileUtils.LoadJsonFromResolvedPath <Dictionary <string, Embarkment> >(ContentPaths.World.embarks); DefaultEmbarkment = Embarkments["Normal"]; }
public static List <Animation> LoadCompositeAnimationSet(String Path, String CompositeName) { if (!Animations.ContainsKey(Path)) { try { var descriptor = FileUtils.LoadJsonFromResolvedPath <AnimationSetDescriptor>(Path); Animations.Add(Path, GenerateAnimations(CompositeName, descriptor).Select(a => { bool simplify = true; string asset = null; foreach (var frame in a.CompositeFrames) { if (frame.Cells.Count != 1) { simplify = false; break; } if (asset == null) { asset = frame.Cells[0].Sheet.AssetName; } else if (asset != frame.Cells[0].Sheet.AssetName) { simplify = false; break; } } if (simplify) { var sheet = a.CompositeFrames[0].Cells[0].Sheet; return(new Animation() { SpriteSheet = sheet, Name = a.Name, Speeds = a.Speeds, YOffset = a.YOffset, Loops = a.Loops, FrameHZ = a.FrameHZ, SpeedMultiplier = a.SpeedMultiplier, //Todo: Support per-cell tint in standard animation? Tint = a.CompositeFrames[0].Cells[0].Tint, Flipped = a.Flipped, Frames = a.CompositeFrames.Select(f => f.Cells[0].Tile).ToList(), }); } a.PushFrames(); return(a as Animation); }).ToList()); } catch (Exception) { var errorAnimations = new List <Animation>(); errorAnimations.Add( new Animation() { SpriteSheet = new SpriteSheet(ContentPaths.Error, 32), Frames = new List <Point> { Point.Zero }, Name = "ERROR" }); Animations.Add(Path, errorAnimations); } } return(Animations[Path]); }