コード例 #1
0
        public void LoadMusic(bool forceReplace = false)
        {
            foreach (var musicFile in new ContentFolder().MusicFolder.GetAllMusicFiles())
            {
                var fileName = musicFile.InContentLocalPathWithoutExtension.Replace("\\", "|").ToLowerInvariant();
                AddMusic(fileName, musicFile, forceReplace);
            }

            if (Core.GameOptions.ContentPackNames.Any())
            {
                foreach (var contentPackName in Core.GameOptions.ContentPackNames)
                {
                    var contentPackMusicFolder = new ContentPacksFolder().GetContentPack(contentPackName).MusicFolder;
                    foreach (var musicFile in contentPackMusicFolder.GetAllMusicFiles())
                    {
                        var fileName = musicFile.InContentLocalPathWithoutExtension.Replace("\\", "|").ToLowerInvariant();
                        AddMusic(fileName, musicFile, forceReplace);
                    }
                }
            }
            if (!GameModeManager.ActiveGameMode.IsDefaultGamemode && !Equals(GameModeManager.ActiveGameMode.ContentFolder, new ContentFolder()))
            {
                var gameModeMusicFolder = GameModeManager.ActiveGameMode.ContentFolder.MusicFolder;
                foreach (var musicFile in gameModeMusicFolder.GetAllMusicFiles())
                {
                    var fileName = musicFile.InContentLocalPathWithoutExtension.Replace("\\", "|").ToLowerInvariant();
                    AddMusic(fileName, musicFile, forceReplace);
                }
            }
        }
コード例 #2
0
        public void Parse()
        {
            if (WindowSize.X == 0 && WindowSize.Y == 0)
            {
                WindowSize = new Vector2(1200, 680);
            }


            MusicManager.Volume = Music / 100.0f;

            SoundEffectManager.Volume = Sound / 100.0f;

            SoundEffectManager.Mute(Muted);
            MusicManager.Mute(Muted);

            Localization.Load(Language);

            if (ContentPackNames.Any())
            {
                var contentPackNames = new List <string>(ContentPackNames);
                foreach (var contentPack in ContentPackNames)
                {
                    if (new ContentPacksFolder().CheckExists(contentPack) != ExistenceCheckResult.FolderExists)
                    {
                        contentPackNames.Remove(contentPack);
                    }
                    else
                    {
                        var contentPackFolder    = new ContentPacksFolder().GetFolder(contentPack);
                        var contentPackException = contentPackFolder.CreateFile("exceptions.dat", CreationCollisionOption.OpenIfExists);
                        // TODO: Check
                        ContentPackManager.Load(contentPackException.Path);
                    }
                }
                ContentPackNames = contentPackNames.ToArray();
            }

            Core.GraphicsManager.PreferMultiSampling = PreferMultiSampling;
        }
コード例 #3
0
        //we can maybe put language specific fonts in via localization system, we have a place to start at least

        //this sub looks for all fonts that should be in the system (base files, mode files, pack files) and shoves them into FontList
        public static void LoadFonts()
        {
            HasLoaded = false;
            FontList.Clear();

            //because the pack manager will hoover up replacements from packs and mods already we just load every font name contained in our base files
            foreach (var fontFile in new ContentFolder().FontFolder.GetFontFiles())
            {
                var fileName = fontFile.InContentLocalPathWithoutExtension.Replace("\\", "|").ToLowerInvariant();
                FontList.Add(fileName, fontFile);
            }
            //then look for ADDITIONAL fonts in packs, the ones that exist will have the user's prefered copy already
            if (Core.GameOptions.ContentPackNames.Any())
            {
                foreach (var contentPackName in Core.GameOptions.ContentPackNames)
                {
                    var contentPackFontFolder = new ContentPacksFolder().GetContentPack(contentPackName).FontFolder;
                    foreach (var fontFile in contentPackFontFolder.GetFontFiles())
                    {
                        var fileName = fontFile.InContentLocalPathWithoutExtension.Replace("\\", "|").ToLowerInvariant();
                        FontList.Add(fileName, fontFile);
                    }
                }
            }
            //if there's a game mode loaded, look in that too for additional fonts
            if (!GameModeManager.ActiveGameMode.IsDefaultGamemode && !Equals(GameModeManager.ActiveGameMode.ContentFolder, new ContentFolder()))
            {
                var gameModeFontFolder = GameModeManager.ActiveGameMode.ContentFolder.FontFolder;
                foreach (var fontFile in gameModeFontFolder.GetFontFiles())
                {
                    var fileName = fontFile.InContentLocalPathWithoutExtension.Replace("\\", "|").ToLowerInvariant();
                    FontList.Add(fileName, fontFile);
                }
            }

            HasLoaded = true;
        }