当前位置: 首页>>代码示例>>C#>>正文


C# ContentManager.Load方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Content.ContentManager.Load方法的典型用法代码示例。如果您正苦于以下问题:C# ContentManager.Load方法的具体用法?C# ContentManager.Load怎么用?C# ContentManager.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Content.ContentManager的用法示例。


在下文中一共展示了ContentManager.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init(ContentManager content, Vector2 position, string normalTextureName, string hoverTextureName)
        {
            m_Normal = content.Load<Texture2D>(normalTextureName);
            m_Hover = content.Load<Texture2D>(hoverTextureName);

            m_ButtonRec = new Rectangle((int)position.X, (int)position.Y, m_Normal.Width, m_Normal.Height);
        }
开发者ID:rushTENm,项目名称:Exit_OF,代码行数:7,代码来源:Button.cs

示例2: LoadContent

 public void LoadContent(ContentManager content)
 {
     this.images = new Texture2D[] {content.Load<Texture2D>(ImageName1), content.Load<Texture2D>(ImageName2)};
     current = images[0];
     this.Width = images[0].Width;
     this.Height = images[0].Height;
 }
开发者ID:kshichanin,项目名称:Bunny-and-Clyde,代码行数:7,代码来源:PlayerIcon.cs

示例3: TileMap3D

            public TileMap3D(GraphicsDevice graphicsDevice, ContentManager contentManager, int width, int height)
            {
                this.GraphicsDevice = graphicsDevice;
                Wall = contentManager.Load<Model>("Models/TileMap3D/Wall");
                FloorTile = contentManager.Load<Model>("Models/TileMap3D/FloorTile");
                Dirt = contentManager.Load<Model>("Models/TileMap3D/Dirt");
                Cleaner = contentManager.Load<Model>("Models/TileMap3D/Cleaner");

                ((BasicEffect)Wall.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)FloorTile.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Dirt.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Cleaner.Meshes[0].Effects[0]).EnableDefaultLighting();
                foreach (BasicEffect effect in Cleaner.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;
                foreach (BasicEffect effect in FloorTile.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;

                dss.DepthBufferEnable = true;
                dss.DepthBufferFunction = CompareFunction.LessEqual;
                dss.DepthBufferWriteEnable = true;
                rs.CullMode = CullMode.CullCounterClockwiseFace;
                ss.AddressU = TextureAddressMode.Wrap;
                ss.AddressV = TextureAddressMode.Wrap;
                ss.Filter = TextureFilter.Anisotropic;

                Camera = new Camera(graphicsDevice.Viewport.AspectRatio, graphicsDevice);
            }
开发者ID:Troilk,项目名称:VacuumCleaner,代码行数:27,代码来源:TileMap3D.cs

示例4: Slider

        public Slider(ContentManager content, Vector2 position, Vector2 sizeInPx, float value, Color color, SliderType type)
        {
            //Save the properties of the slider
            _position = position;
            _sizeInPx = sizeInPx;
            _value = value;
            _color = color;
            _type = type;

            //Load some basic content
            content.Load<Texture2D>("UIElements/sliderMiddle");
            content.Load<Texture2D>("UIElements/sliderEnd");
            content.Load<Texture2D>("UIElements/sliderMarker");

            //Set the zero zone and max zone values
            if (type == SliderType.HorizontalSlider)
            {
                _zeroZoneMax = Vector2.Multiply(sizeInPx, new Vector2(0.1f, 1.0f)) + position;
                _maxZoneMin = Vector2.Multiply(sizeInPx, new Vector2(0.9f, 1.0f)) + position;
            }
            else if (type == SliderType.VerticalSlider)
            {
                _zeroZoneMax = Vector2.Multiply(sizeInPx, new Vector2(1.0f, 0.1f)) + position;
                _maxZoneMin = Vector2.Multiply(sizeInPx, new Vector2(1.0f, 0.9f)) + position;
            }

            //Initialize all of the necessary boundries
            _bounds = new Rectangle((int)position.X, (int)position.Y, (int)sizeInPx.X, (int)sizeInPx.Y);
            _zeroZoneBounds = new Rectangle((int)position.X, (int)position.Y, (int)(sizeInPx.X * 0.1f), (int)sizeInPx.Y);
            _normalZoneBounds = new Rectangle((int)(position.X + sizeInPx.X * 0.1f), (int)position.Y, (int)(sizeInPx.X * 0.8f), (int)sizeInPx.Y);
            _maxZoneBounds = new Rectangle((int)(position.X + sizeInPx.X * 0.9f), (int)position.Y, (int)(sizeInPx.X * 0.1f), (int)sizeInPx.Y);
            _markerZoneBounds = new Rectangle((int)(_normalZoneBounds.Width * _value + position.X), (int)position.Y, _sliderMarker.Width, (int)sizeInPx.Y);
        }
开发者ID:kevroy314,项目名称:XNA-Farseer-Prototype,代码行数:33,代码来源:Slider.cs

示例5: LoadLevelSelection

 public void LoadLevelSelection(string fileAddress,ContentManager content)
 {
     levelData.Clear();
     BFFileReader reader = new BFFileReader(fileAddress);
     reader.Open();
     string line = null;
     while((line = reader.ReadLine())!= null)
     {
         LevelData levelInfo;
         string[] param = line.Split(' ');
         levelInfo.name = param[0];
         levelInfo.texture = content.Load<Texture2D>(param[1]);
         levelData.AddLast(levelInfo);
     }
     reader.Close();
     data = levelData.First;
     //load the left and right arrow textures
     leftArrowTex = content.Load<Texture2D>("Left");
     rightArrowTex = content.Load<Texture2D>("Right");
     Texture2D exit = content.Load<Texture2D>("Exit");
     Texture2D start = content.Load<Texture2D>("Resume");
     font = content.Load<SpriteFont>("Font");
     selection = new Menu(4, new Rectangle(parent.ScreenWidth/2 -(exit.Width/2),parent.ScreenHeight/2+15,exit.Width,exit.Height),start,exit);
     time = InputDelay;
 }
开发者ID:JustinWeq,项目名称:Barfight-CS-285,代码行数:25,代码来源:LevelSelection.cs

示例6: LoadContent

 public static void LoadContent(ContentManager cm)
 {
     Arial = cm.Load<SpriteFont>(@"fonts\Arial");
     Tahoma = cm.Load<SpriteFont>(@"fonts\Tahoma");
     Calibri = cm.Load<SpriteFont>(@"fonts\Calibri");
     Verdana = cm.Load<SpriteFont>(@"fonts\Verdana");
 }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:7,代码来源:Fonts.cs

示例7: LoadContent

        /// <summary>
        /// 
        /// </summary>
        public override void LoadContent()
        {
            content = new ContentManager(ScreenManager.Game.Services, "Content");

            menuBackground = content.Load<Texture2D>("GUI/MenuBackground");

            //Buttons are 300 x 75
            Texture2D exitText = content.Load<Texture2D>("GUI/ExitButton");
            Texture2D patientText = content.Load<Texture2D>("GUI/PatientButton");
            Texture2D optionsText = content.Load<Texture2D>("GUI/OptionsButton");

            int menuX = (ScreenManager.GraphicsDevice.Viewport.Width / 2) - (menuBackground.Width / 2);
            int menuY = (ScreenManager.GraphicsDevice.Viewport.Height / 2) - (menuBackground.Height / 2);

            menuRect = new Rectangle(menuX, menuY, menuBackground.Width, menuBackground.Height);

            int buttonSpace = 75;
            int buttonX = menuX + (menuBackground.Width / 2) - 150;
            int buttonY = menuY + buttonSpace;

            Rectangle patientRect = new Rectangle(buttonX, buttonY, patientText.Width, patientText.Height);
            Rectangle optionsRect = new Rectangle(buttonX, patientRect.Y + buttonSpace + patientText.Height, optionsText.Width, optionsText.Height);
            Rectangle exitRect = new Rectangle(buttonX, optionsRect.Y + buttonSpace + exitText.Height, exitText.Width, exitText.Height);

            exitButton = new GameLibrary.UI.Button(exitText, exitRect);
            patientButton = new GameLibrary.UI.Button(patientText, patientRect);
            optionsButton = new GameLibrary.UI.Button(optionsText, optionsRect);
        }
开发者ID:oh-team-machine,项目名称:Target-Tapping,代码行数:31,代码来源:MenuScreen.cs

示例8: LoadContent

 public void LoadContent(ContentManager content)
 {
     GUITexture = content.Load<Texture2D>(assetName);
     GUIRect = new Rectangle(0, 0, GUITexture.Width, GUITexture.Height);
     MusiqueMain = content.Load<Song>(@"Sons\Musiques\MusiqueTest");
     MusiqueMenu = content.Load<Song>(@"Sons\Musiques\Musique_Menu_Test");
 }
开发者ID:TheWalkingCoders,项目名称:FinalRush_sale,代码行数:7,代码来源:GUIElement.cs

示例9: load

 public void load(ContentManager content)
 {
     texture = content.Load<Texture2D>("Sprites//Laser");
     textureOverlay = content.Load<Texture2D>("Sprites//Laser2");
     test = content.Load<Texture2D>("Sprites//Pixel");
     textureGlow = content.Load<Texture2D>("Sprites//Glow");
 }
开发者ID:Stewart-Taylor,项目名称:LaserBox,代码行数:7,代码来源:Laser.cs

示例10: Load

 public static void Load(ContentManager Content)
 {
     ShadowEffectList.Add(Content.Load<Effect>(@"Shaders\distort"));
     ShadowEffectList.Add(Content.Load<Effect>(@"Shaders\fade"));
     ShadowEffectList.Add(Content.Load<Effect>(@"Shaders\reduction"));
     ShadowEffectList.Add(Content.Load<Effect>(@"Shaders\resolve"));
 }
开发者ID:Fireeyes,项目名称:The-Day-After,代码行数:7,代码来源:Databse.cs

示例11: Player

        public Player(ContentManager content)
        {
            mapManager = new MapManager(content);
            _map = mapManager.CreateMap(Global.LEVEL);
            towerButtons = Data.loadTowerButton(content);
            waveManager = Data.loadWave(Global.LEVEL);
            SetUpPanel(content);
            coin_tex = content.Load<Texture2D>(@"Sprite\Image\coin");
            coin = new NormalSprite(coin_tex, 0, 0, coin_tex.Width, coin_tex.Height);

            speed_1_tex = content.Load<Texture2D>(@"Sprite\Image\Menu\button_x1");
            NormalSprite speed_1 = new NormalSprite(speed_1_tex, 685, 5, speed_1_tex.Width / 2, speed_1_tex.Height);
            increaseSpeed_1 = new Checkbox(speed_1, 2, Global.NEW_GAME_SPEED == 1 ? true : false);
            speedButtonList.Add(increaseSpeed_1);

            skip_tex = content.Load<Texture2D>(@"Sprite\Image\Menu\button_skip");
            NormalSprite speed_2 = new NormalSprite(skip_tex, 720, 5, skip_tex.Width / 2, skip_tex.Height);
            increaseSpeed_2 = new Checkbox(speed_2, 2, Global.NEW_GAME_SPEED == 2 ? true : false);
            speedButtonList.Add(increaseSpeed_2);

            speed_3_tex = content.Load<Texture2D>(@"Sprite\Image\Menu\button_x3");
            NormalSprite speed_3 = new NormalSprite(speed_3_tex, 755, 5, speed_3_tex.Width / 2, speed_3_tex.Height);
            increaseSpeed_3 = new Checkbox(speed_3, 2, Global.NEW_GAME_SPEED == 3 ? true : false);
            speedButtonList.Add(increaseSpeed_3);

            _content = content;
        }
开发者ID:nguyentheanst,项目名称:TH2010_LTGame,代码行数:27,代码来源:Player.cs

示例12: LoadContent

        public override void LoadContent()
        {
            content = new ContentManager(ScreenManager.Game.Services, "Content");

            optionsBackground = content.Load<Texture2D>("GUI/MenuBackground");

            //Buttons are 300 x 75
            Texture2D selectText = content.Load<Texture2D>("GUI/SelectButton");
            Texture2D cancelText = content.Load<Texture2D>("GUI/CancelButton");

            int menuX = (ScreenManager.GraphicsDevice.Viewport.Width / 2) - (optionsBackground.Width / 2);
            int menuY = (ScreenManager.GraphicsDevice.Viewport.Height / 2) - (optionsBackground.Height / 2);

            optionsRect = new Rectangle(menuX, menuY, optionsBackground.Width, optionsBackground.Height);

            Rectangle selectRect = new Rectangle(menuX, menuY + optionsBackground.Height, selectText.Width, selectText.Height);
            Rectangle cancelRect = new Rectangle(menuX + (optionsBackground.Width - cancelText.Width), menuY + optionsBackground.Height, selectText.Width, selectText.Height);

            selectButton = new GameLibrary.UI.Button(selectText, selectRect);
            cancelButton = new GameLibrary.UI.Button(cancelText, cancelRect);

            Vector2 position = new Vector2(menuX + ((optionsBackground.Width / 2)), menuY + ScreenManager.ScaleYPosition(50));

            Texture2D dummyTexture = new Texture2D(ScreenManager.GraphicsDevice, 1, 1);
            dummyTexture.SetData(new Color[] { Color.White });

            SpriteFont font = content.Load<SpriteFont>("Font");

            molesUpDown = new GameLibrary.UI.NumericUpDown(dummyTexture, position, GameLibrary.UI.Label.CENTER, 100.0f,font, 1m, 1m, 6m, 1m);

            position.Y += ScreenManager.ScaleYPosition(50);

            timerUpDown = new GameLibrary.UI.NumericUpDown(dummyTexture, position, GameLibrary.UI.Label.CENTER, 100.0f, font, 0.25m, 0.25m, 10.00m, 0.25m);

            position.Y += ScreenManager.ScaleYPosition(50);

            repetitionUpDown = new GameLibrary.UI.NumericUpDown(dummyTexture, position, GameLibrary.UI.Label.CENTER, 100.0f, font, 1m, 1m, 1000m, 1m);

            position.Y += ScreenManager.ScaleYPosition(75);

            List<String> hands = new List<String> { "Right", "Left" };

            handList = new GameLibrary.UI.List(hands, 175, 2, 25, position, dummyTexture, font, Color.Black, Color.White);

            position = new Vector2(menuX + ((optionsBackground.Width / 2)) - ScreenManager.ScaleXPosition(300), menuY + ScreenManager.ScaleYPosition(50));

            moleLabel = new GameLibrary.UI.Label("Number of Moles:", position, GameLibrary.UI.Label.LEFT, 200.0f, font);

            position.Y += ScreenManager.ScaleYPosition(50);

            timerLabel = new GameLibrary.UI.Label("Mole Up Time:", position, GameLibrary.UI.Label.LEFT, 200.0f, font);

            position.Y += ScreenManager.ScaleYPosition(50);

            repetitionLabel = new GameLibrary.UI.Label("Number of Reps:", position, GameLibrary.UI.Label.LEFT, 200.0f, font);

            position.Y += ScreenManager.ScaleYPosition(85);

            handLabel = new GameLibrary.UI.Label("Hand Used:", position, GameLibrary.UI.Label.LEFT, 200.0f, font);
        }
开发者ID:oh-team-machine,项目名称:Target-Tapping,代码行数:60,代码来源:OptionsScreen.cs

示例13: EndGame

        public EndGame(ContentManager content)
        {
            _video = content.Load<Video>(@"Movies\EndGame");
            _endGameFont = content.Load<SpriteFont>(@"Fonts\MenuFont");

            _videoPlayer = new VideoPlayer();
        }
开发者ID:RonyOCuinn,项目名称:Over-The-Top,代码行数:7,代码来源:EndGame.cs

示例14: LoadContent

 public void LoadContent(ContentManager content)
 {
     AsteroidTexture1 = content.Load<Texture2D>(@"Sprites\Asteroids\Asteroid-1");
     AsteroidTexture2 = content.Load<Texture2D>(@"Sprites\Asteroids\Asteroid-2");
     AsteroidTexture3 = content.Load<Texture2D>(@"Sprites\Asteroids\Asteroid-3");
     AsteroidTexture4 = content.Load<Texture2D>(@"Sprites\Asteroids\Asteroid-4");
 }
开发者ID:Spikky577,项目名称:Levi-Challenge,代码行数:7,代码来源:EnemyManager.cs

示例15: Load

        /// <summary>
        /// Load your graphics content.
        /// </summary>
        public void Load(GraphicsDevice device, ContentManager content)
        {
            GraphicsDevice = device;

            spriteBatch = new SpriteBatch(GraphicsDevice);

            bloomExtractEffect = content.Load<Effect>("BloomExtract");
            bloomCombineEffect = content.Load<Effect>("BloomCombine");
            gaussianBlurEffect = content.Load<Effect>("GaussianBlur");


            // Look up the resolution and format of our main backbuffer.
            PresentationParameters pp = GraphicsDevice.PresentationParameters;

            int width = pp.BackBufferWidth;
            int height = pp.BackBufferHeight;

            SurfaceFormat format = pp.BackBufferFormat;

            // Create a texture for reading back the backbuffer contents.
            resolveTarget = new ResolveTexture2D(GraphicsDevice, width, height, 1, format);

            // Create two rendertargets for the bloom processing. These are half the
            // size of the backbuffer, in order to minimize fillrate costs. Reducing
            // the resolution in this way doesn't hurt quality, because we are going
            // to be blurring the bloom images in any case.
            width /= 4;
            height /= 4;

            renderTarget1 = new RenderTarget2D(GraphicsDevice, width, height, 1, format);
            renderTarget2 = new RenderTarget2D(GraphicsDevice, width, height, 1, format);
        }
开发者ID:GlennSandoval,项目名称:Infiniminer,代码行数:35,代码来源:BloomComponent.cs


注:本文中的Microsoft.Xna.Framework.Content.ContentManager.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。