示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            List <SpriteFont> fontList = new List <SpriteFont>
            {
                Content.Load <SpriteFont>("fonts/Generic")
            };
            Dictionary <StoryGraphicCode, Texture2D> storyGraphics = new Dictionary <StoryGraphicCode, Texture2D>
            {
                { StoryGraphicCode.Mochi, Content.Load <Texture2D>("graphics/Mochi") },
                { StoryGraphicCode.MochiCrazy, Content.Load <Texture2D>("graphics/MochiCrazy") },
                { StoryGraphicCode.KingCrab, Content.Load <Texture2D>("graphics/KingCrab") },
                { StoryGraphicCode.CrazyKing, Content.Load <Texture2D>("graphics/CrazyKing") }
            };
            Dictionary <BackgroundCode, Texture2D> bgs = new Dictionary <BackgroundCode, Texture2D>
            {
            };

            // TODO: use this.Content to load your game content here
            GraphicBuilder.LoadExternalGraphic(storyGraphics, bgs);
            GameFonts.LoadFonts(fontList);
            GraphicBuilder.BuildObjects(GraphicsDevice);
            _root = new RootComponent(GraphicsDevice, spriteBatch);
        }
示例#2
0
文件: Game1.cs 项目: zazati99/Gahame
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Load spriteFonts here
            GameFonts.LoadFonts(Content);

            // Load all fo that sweet sweet content right here
            ScreenManager.Instance.LoadContent(Content);
        }
示例#3
0
        public GameContent(ContentManager content)
        {
            if (_gameAssets != null)
            {
                throw new Exception("This class is a singleton; use GameContent.GameAssets.");
            }

            Fonts  = new GameFonts(content);
            Images = new GameImages(content);
            Music  = new GameMusic(content);

            _gameAssets = this;
        }
示例#4
0
 public static void RemoveFont(GameFonts obj)
 {
     try
     {
         if (Fonts.ContainsKey(obj))
         {
             Fonts.Remove(obj);
         }
     }
     catch (Exception exception)
     {
         ErrorLog.Add(exception);
     }
 }
示例#5
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // Loads fonts
            GameFonts.LoadContent(Content);

            // Loads content in ScreenManager
            ScreenManager.Instance.LoadContent(Content);

            // Loads a masterpeice
            backgroundMusic = Content.Load <Song>("Sounds/Music/Memer");
            //MediaPlayer.Play(backgroundMusic);
            MediaPlayer.IsRepeating = true;
        }
示例#6
0
 public static void AddFont(GameFonts obj)
 {
     try
     {
         if (Fonts == null)
         {
             Fonts = new Dictionary <GameFonts, SpriteFont>();
         }
         if (!Fonts.ContainsKey(obj))
         {
             Fonts.Add(obj, ContentMgr.Load <SpriteFont>("Fonts/" + Enum.GetName(typeof(GameFonts), obj)));
         }
     }catch (Exception exception)
     {
         ErrorLog.Add(exception);
     }
 }