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


C# Content.ContentManager类代码示例

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


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

示例1: Pigeon

        public Pigeon(ContentManager con)
        {
            boundingBox = new Vector3(6, 3, 6);

            distance = 0;
            rand = new Random();

            dx = (0.5-rand.NextDouble())*0.8 + 0.2;
            dy = rand.NextDouble()*1.5 + 0.7;
            dz = 0.8;

            x = 5.8;
            y = -2;
            z = 83.5;

            sx = 5.8;
            sy = -2;
            sz = 83.5;

            this.world = Matrix.CreateTranslation(new Vector3((float)x, (float)y, (float)z));

            model = con.Load<Model>(@"models/pigeon");

            isDone = false;
        }
开发者ID:richardshelby,项目名称:TargetPractice,代码行数:25,代码来源:Pigeon.cs

示例2: DrawObjects

        public override void DrawObjects(GraphicsDevice graphicDevice, SpriteBatch spriteBatch, ContentManager content)
        {
            graphicDevice.Clear(Color.CornflowerBlue);
            SpriteFont newFont = content.Load<SpriteFont>(@"Fonts/Text");

            spriteBatch.Begin();

            this.controlScreenBackgroundPosition = new Vector2(0, 0);
            spriteBatch.Draw(this.controlScreenBackgroundTexture, this.controlScreenBackgroundPosition, Color.White);

            if (this.controlScreenItems.Count < 1)
            {
                // Back planket and text;
                this.buttonPosition = new Vector2(840, 660);
                this.controlScreenItems.Add(new MenuItems(this.button, this.buttonPosition, "Back", newFont, false));
            }

            this.controlScreenItems[this.selectedEntry].Selected = true;
            foreach (var item in this.controlScreenItems)
            {
                item.DrawMenuItems(spriteBatch, new Color(248, 218, 127));
            }

            this.DrawCursor(spriteBatch);
            spriteBatch.End();
        }
开发者ID:penjurov,项目名称:TeamGeorgeOrwell,代码行数:26,代码来源:ControlScreen.cs

示例3: TacticalBattle

        public ControlState controlState;                //get and set the control state
        #endregion

        #region constructor/load
        public TacticalBattle(List<Piece> player1Army, List<Piece> player2Army, TacMap map, ContentManager content)
        {
            //p1Avatar = player1;
            //p2Avatar = player2;

            this.player1Army = player1Army;
            this.player2Army = player2Army;

            isPlayer1Turn = true;
            this.map = map;
            battleOver = false;
            gridOn = false;

            mouseVisible = true;
            controlState = ControlState.selectUnit;

            selectedUnit = null;
            status = "Combat begins";
            selectionTiles = new List<Tile>();
            unitInfo = "";
            //load interface items                  TODO
            confirmation = content.Load<Texture2D>("confirmationPopup");
            background = content.Load<Texture2D>("TerrainSprites/battle");
            statusFont = content.Load<SpriteFont>("Arial");
            playerFont = content.Load<SpriteFont>("playerFont");
            infoFont = content.Load<SpriteFont>("infoFont");
            moveBox = content.Load<Texture2D>("TerrainSprites/move");
            targetBox = content.Load<Texture2D>("TerrainSprites/target");
            selectedBox = content.Load<Texture2D>("TerrainSprites/selected");
            horizontal = content.Load<Texture2D>("TerrainSprites/horizontal");
            vertical = content.Load<Texture2D>("TerrainSprites/vertical");
            winBox = content.Load<Texture2D>("Menu/Win message");
            //set units to starting positions
            startingPositions();
        }
开发者ID:Risab,项目名称:dawn-of-conquest,代码行数:39,代码来源:TacticalBattle.cs

示例4: Load

        public static void Load(ContentManager content)
        {
            Player = content.Load<Texture2D>("Player");

            Pixel = new Texture2D(Player.GraphicsDevice, 1, 1);
            Pixel.SetData(new[] { Color.White });
        }
开发者ID:hvp,项目名称:Squareosity,代码行数:7,代码来源:Art.cs

示例5: Paddle

        public Paddle(ContentManager theContent, string theAssetName, Input theInput, PaddlePosition thePosition)
            : base(theContent, theAssetName)
        {
            SourceRectangle = new Rectangle(0, 0, 1, 1);
            Scale = new Vector2(10.0f, 100.0f);
            mColor = Color.SlateBlue;

            mPaddlePosition = thePosition;
            switch (thePosition)
            {
                case PaddlePosition.Left:
                    {
                        Boundary = new Rectangle(140, 185, 10, 833);
                        break;
                    }

                case PaddlePosition.Right:
                    {
                        Boundary = new Rectangle(1130, 185, 10, 833);
                        break;
                    }
            }

            Position = Center(Boundary);

            mInput = theInput;
        }
开发者ID:Gevil,项目名称:Projects,代码行数:27,代码来源:Paddle.cs

示例6: LoadContent

        public void LoadContent(ContentManager content, GraphicsDeviceManager graphicsDeviceManager)
        {
            texture = content.Load<Texture2D>("brick_texture_map");

            wall = new VertexPositionTexture[22];
            wall[0] = new VertexPositionTexture(new Vector3(200, 0, 200), new Vector2(0, 0));
            wall[1] = new VertexPositionTexture(new Vector3(200, 200, 200), new Vector2(2, 0));
            wall[2] = new VertexPositionTexture(new Vector3(0, 0, 200), new Vector2(0, 2));
            wall[3] = new VertexPositionTexture(new Vector3(0, 200, 200), new Vector2(2, 2));
            wall[4] = new VertexPositionTexture(new Vector3(0, 0, 220), new Vector2(0, 0));
            wall[5] = new VertexPositionTexture(new Vector3(0, 200, 220), new Vector2(2, 0));
            wall[6] = new VertexPositionTexture(new Vector3(200, 0, 220), new Vector2(0, 2));
            wall[7] = new VertexPositionTexture(new Vector3(200, 200, 220), new Vector2(2, 2));
            wall[8] = new VertexPositionTexture(new Vector3(200, 0, 200), new Vector2(0, 0));
            wall[9] = new VertexPositionTexture(new Vector3(200, 200, 220), new Vector2(2, 0));
            wall[10] = new VertexPositionTexture(new Vector3(200, 200, 200), new Vector2(2, 2));
            wall[11] = new VertexPositionTexture(new Vector3(0, 200, 220), new Vector2(0, 2));
            wall[12] = new VertexPositionTexture(new Vector3(0, 200, 200), new Vector2(0, 0));

            // Set vertex data in VertexBuffer
            vertexBuffer = new VertexBuffer(graphicsDeviceManager.GraphicsDevice, typeof(VertexPositionTexture), wall.Length, BufferUsage.None);
            vertexBuffer.SetData(wall);

            // Initialize the BasicEffect
            effect = new BasicEffect(graphicsDeviceManager.GraphicsDevice);
        }
开发者ID:Woodje,项目名称:3DGame,代码行数:26,代码来源:Wall.cs

示例7: RenderingExplosion

 public RenderingExplosion(ContentManager Content)
     : base(Content)
 {
     spriteBatch = Content.ServiceProvider.GetService(typeof(SpriteBatch)) as SpriteBatch;
     explosionTexture = Content.Load<Texture2D>("TroopTexture/explosion");
     stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame;
 }
开发者ID:JacopoV,项目名称:Tap---Conquer,代码行数:7,代码来源:RenderingExplosion.cs

示例8: LoadRepositoryXml

        public static void LoadRepositoryXml(string filePath, ContentManager content)
        {
            XmlDocument document = new XmlDocument();
            document.Load(filePath);

            foreach (XmlNode itemNode in document.SelectNodes("ItemRepository/Item"))
            {
                Item item = new Item();
                item.Name = XmlExtensions.GetAttributeValue(itemNode, "Name", null, true);

                item.FriendlyName = itemNode.SelectSingleNode("FriendlyName").InnerText;
                item.Description = itemNode.SelectSingleNode("Description").InnerText;
                item.Weight = XmlExtensions.GetAttributeValue<float>(itemNode, "Weight", 0);
                item.ItemType = (ItemType)Enum.Parse(typeof(ItemType), XmlExtensions.GetAttributeValue(itemNode, "ItemType", null, true));

                foreach(XmlNode drawableSetNode in itemNode.SelectNodes("Drawables/Drawable"))
                {
                    string src = XmlExtensions.GetAttributeValue(drawableSetNode, "src");
                    DrawableSet.LoadDrawableSetXml(item.Drawables, src, content);
                }

                if (itemNode.SelectSingleNode("Icon") != null)
                    item.Icon = content.Load<Texture2D>(XmlExtensions.GetAttributeValue(itemNode.SelectSingleNode("Icon"), "src"));

                GameItems.Add(item.Name, item);
            }
        }
开发者ID:behindcurtain3,项目名称:TheArena,代码行数:27,代码来源:ItemRepository.cs

示例9: 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

示例10: LoadContent

        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            backgroundTexture = content.Load<Texture2D>("background");
        }
开发者ID:adamjarret,项目名称:Slauncha,代码行数:14,代码来源:BackgroundScreen.cs

示例11: FieldPong

        public FieldPong()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            graphics.PreferredBackBufferWidth = 1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
            graphics.SynchronizeWithVerticalRetrace = true;

            physicsSimulator = new PhysicsSimulator(new Vector2(0));
            physicsSimulator.AllowedPenetration = 0.3f;
            physicsSimulator.BiasFactor = 1.0f;
            Services.AddService(typeof(PhysicsSimulator), physicsSimulator);

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            bloomProcessor = new BloomPostProcessor(this);
            Components.Add(bloomProcessor);

            // Uncomment this to monitor the FPS:

            //fpsCounter = new FrameRateCounter(this);
            //Components.Add(fpsCounter);

            audioEngine = new AudioEngine("Content\\Audio\\FieldPongAudio.xgs");
            waveBank = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb");

            backgroundMusic = soundBank.GetCue("GameSong0010 16 Bit");
            backgroundMusic.Play();
        }
开发者ID:zpconn,项目名称:FieldPong,代码行数:33,代码来源:FieldPong.cs

示例12: 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

示例13: Load

        public void Load(ContentManager content)
        {
            random = new Random();
            space_ship = new SpaceShip();
            space_ship.Load(content);
            float y=-50;
            active_obstacles = new List<Obstacle>();
            for (int i = 0; i < 29; i++)
            {
                active_obstacles.Add(new Obstacle());
                active_obstacles[i].Load(content);

            }
            active_obstacles[0].Init(0,-50);
            for (int i = 1;i<29;i++)
            {
                y += 80 * active_obstacles[i - 1].scale;
                active_obstacles[i].Init(0, y);
            }

            last_obstacle = 0;
            //active_obstacles[0].Init(0, -50);
            //active_obstacles[1].Init(0, -50 + (float)Math.Pow(1.02, 1 )/20);
            //active_obstacles[2].Init(0, -50 + (float)Math.Pow(1.02, 1 )/20 + (float)Math.Pow(1.02, 2) / 20);
            //active_obstacles[3].Init(0, -50 + (float)Math.Pow(1.02, 1) / 20 + (float)Math.Pow(1.02, 2) / 20 + (float)Math.Pow(1.02, 3) / 20);
            //active_obstacles[4].Init(0, -50 + (float)Math.Pow(1.02, 1) / 20 + (float)Math.Pow(1.02, 2) / 20 + (float)Math.Pow(1.02, 3) / 20 + (float)Math.Pow(1.02, 4 )/20);
            //active_obstacles[5].Init(0, -50 + (float)Math.Pow(1.02, 1) / 20 + (float)Math.Pow(1.02, 2) / 20 + (float)Math.Pow(1.02, 3) / 20 + (float)Math.Pow(1.02, 4) / 20 + (float)Math.Pow(1.02, 5) / 20);
            frame_counter = 1;
            newest = 0;
        }
开发者ID:jivanecky,项目名称:SpaceGame,代码行数:30,代码来源:Stage.cs

示例14: 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

示例15: DebugScreen

 public DebugScreen(ContentManager content,Vector2 new_player_pos)
 {
     Vector2 temp = new Vector2(1366 / 2, 768 / 2);
     font = content.Load<SpriteFont>("Stuff/Arial");
     player_pos.vector = Vector2.Zero;
     player_pos.vertices = new VertexPositionColor[4];
     player_speed.vertices = new VertexPositionColor[4];
     player_speed.startpos =temp;
     gravity.vertices = new VertexPositionColor[4];
     gravity.startpos =temp;
     jump.vertices = new VertexPositionColor[4];
     jump.startpos =temp;
     gamepad_pos.vertices = new VertexPositionColor[4];
     gamepad_pos.startpos =temp;
     for(int i=0;i<4;i++)
     {
        player_pos.vertices[i] = new VertexPositionColor(Vector3.Zero,Color.White);
        player_speed.vertices[i] = new VertexPositionColor(Vector3.Zero,Color.Blue);
        gravity.vertices[i] = new VertexPositionColor(Vector3.Zero,Color.Red);
        jump.vertices[i] = new VertexPositionColor(Vector3.Zero,Color.Green);
        gamepad_pos.vertices[i] = new VertexPositionColor(Vector3.Zero,Color.HotPink);
     }
     collision_state_string = "Collision:";
     framerate_string = "FPS:";
     inputkeys_string = "Input:";
     player_speed.vector = Vector2.Zero;
     gravity.vector = Vector2.Zero;
     jump.vector = Vector2.Zero;
     gamepad_pos.vector = Vector2.Zero;
 }
开发者ID:pampersrocker,项目名称:STAR,代码行数:30,代码来源:DebugScreen.cs


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