ArcadeRPG.Backpack.loadContent C# (CSharp) Метод

loadContent() публичный Метод

public loadContent ( Microsoft.Xna.Framework.Content.ContentManager contman ) : void
contman Microsoft.Xna.Framework.Content.ContentManager
Результат void
        public void loadContent(ContentManager contman)
        {
            backpackpic = contman.Load<Texture2D>("Inventory"); // load the picture
            backpackpos = new Vector2(0, 0);
        }

Usage Example

Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent(ContentManager Content)
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            Texture2D textureb = Content.Load <Texture2D>("background_cropped"); // background
            Texture2D texturef = Content.Load <Texture2D>("foreground_cropped"); // foreground
            Texture2D textureo = Content.Load <Texture2D>("objects1");           // objects

            tiles = new List <Texture2D>();                                      // tiles
            tiles.Add(textureb);
            tiles.Add(texturef);
            tiles.Add(textureo); // add bg, fg, obj's to draw
            game_state.tile_engine = new TileEngine(32, tiles);

            //Character Sprite
            character_sprite[(int)weaponType.NONE].Load(Content, "player_no", 32, 36, 200);
            character_sprite[(int)weaponType.SWORD].Load(Content, "player_sword", 32, 36, 200);
            character_sprite[(int)weaponType.LASER].Load(Content, "player_gun", 32, 36, 200);

            monster_texture[(int)enemyType.GRUNT] = Content.Load <Texture2D>("grunt");

            monster_texture[(int)enemyType.BEETLE]    = Content.Load <Texture2D>("beetles");
            monster_texture[(int)enemyType.BERSERKER] = Content.Load <Texture2D>("berserker");
            monster_texture[(int)enemyType.TROOPER]   = Content.Load <Texture2D>("trooper");

            LoadLevel(0);
            bullet_sprite.Load(Content, "bullet", 9, 9, 0);
            sword_sprite.Load(Content, "player_sword_attack", 32, 36, 0);


            for (int i = 0; i < game_state.monster_engine.GetMonsters().Count(); ++i) // draw new monsters randomly
            {
                Enemy  new_enemy      = game_state.monster_engine.GetMonsters().ElementAt(i);
                Sprite enemy_sprite   = new Sprite();
                int    new_enemy_type = (int)new_enemy.getType();

                enemy_sprite.Load(monster_texture[new_enemy_type], new_enemy.getWidth(), new_enemy.getHeight(), 200);
                new_enemy.setSprite(enemy_sprite);
            }

            game_state.bullet_engine = new BulletEngine(game_state);


            uparrow         = Content.Load <Texture2D>("arrowup");
            downarrow       = Content.Load <Texture2D>("arrowdown");
            leftarrow       = Content.Load <Texture2D>("arrowleft");
            rightarrow      = Content.Load <Texture2D>("arrowright");      // components for "keypad" HUD
            fire_button     = Content.Load <Texture2D>("fire");            // "fire" button (attacks enemies when pushed)
            item_background = Content.Load <Texture2D>("item_background"); // user taps this to bring up inventory

            game_state.fx_engine.LoadSound(Content, "shoot", soundType.SHOOT);

            game_state.fx_engine.LoadSound(Content, "enemy_hit", soundType.ENEMY_HURT);
            game_state.fx_engine.LoadSound(Content, "enemy_die", soundType.ENEMY_DIE);
            game_state.fx_engine.LoadSound(Content, "player_hurt", soundType.PLAYER_HURT);
            game_state.fx_engine.LoadSound(Content, "player_sword_s", soundType.SWORD);
            game_state.fx_engine.LoadSound(Content, "item_pickup", soundType.ITEM_PICKUP);
            game_state.fx_engine.LoadExplosion(Content, "expl", explosionType.SMALL);
            //SoundEffect game_music = Content.Load<SoundEffect>("01AttackPanda1");
            Song game_music = Content.Load <Song>("01AttackPanda1");

            MediaPlayer.Play(game_music);
            MediaPlayer.IsRepeating = true;

            //********************************LOADING GRAPHIC SPRITES********************************//
            backpack             = Content.Load <Texture2D>("backpack");       // loading backpack
            healthbar_empty      = Content.Load <Texture2D>("healthbar");      // load health bar
            healthbar_full       = Content.Load <Texture2D>("healthbar_full"); // load health bar
            health_bar_rec       = new Rectangle((int)healthpos.X, (int)healthpos.Y, health_bar_width, 30);
            health_bar_empty_rec = new Rectangle((int)healthpos.X, (int)healthpos.Y, health_bar_width, 30);
            //**************************************************************************************//


            //********************MISCELLANEOUS*****************************************************//
            displayFont = Content.Load <SpriteFont>("StatsFont");   //load a font from a formatted file
            //displayFont = Content.Load<SpriteFont>("Courier New");
            itemfont    = Content.Load <SpriteFont>("ItemFont");    // ^^
            expiredfont = Content.Load <SpriteFont>("TimeExpired"); // ^^
            //***************************************************************************************//

            backpackmenu.loadContent(Content);
            gameOver.loadContent(Content);
            timex.loadContent(Content);
            //load content for each respective menu
        }
All Usage Examples Of ArcadeRPG.Backpack::loadContent