コード例 #1
1
ファイル: Toolbar.cs プロジェクト: hover024/Virus-Attack
 public Toolbar(Texture2D texture, SpriteFont font, Vector2 position)
 {
     _texture = texture;
     _font = font;
     _position = position;
     _textPosition=new Vector2(130,_position.Y+10);
 }
コード例 #2
1
ファイル: Button.cs プロジェクト: nowaksmini/cadcam
 /// <summary>
 /// Initializes a new instance of the <see cref="Button"/> class.
 /// </summary>
 /// <param name="texture">The texture.</param>
 /// <param name="color">The color.</param>
 /// <param name="spriteFont">The sprite font.</param>
 /// <param name="text">The text.</param>
 /// <param name="textColor">Color of the text.</param>
 public Button(Texture2D texture, Color color, SpriteFont spriteFont, String text, Color textColor)
     : base(texture, color, new Vector2(0, 0), new Vector2(1, 1), 0f)
 {
     _textLabel = new Label(spriteFont, text, textColor, new Vector2(0, 0), new Vector2(1, 1), 0);
     _state = BState.Up;
     _timer = 2f;
 }
コード例 #3
1
ファイル: Maps.cs プロジェクト: Cephas1982/LCR
 public C_Maps()
 {
     //init stuff here
     m_mousePosition = Vector2.Zero;
     m_font1 = null;
     m_spriteBatch = null;
 }
コード例 #4
1
        public MenuManager(Main game, String[] strMenuTextures,
            String strMenuFont, Integer2 textureBorderPadding)
            : base(game)
        {
            this.game = game;

            //nmcg - create an array of textures
            this.menuTextures = new Texture2D[strMenuTextures.Length];

            //nmcg - load the textures
            for (int i = 0; i < strMenuTextures.Length; i++)
            {
                this.menuTextures[i] =
                    game.Content.Load<Texture2D>(@"" + strMenuTextures[i]);
            }

            //nmcg - load menu font
            this.menuFont = game.Content.Load<SpriteFont>(@"" + strMenuFont);

            //nmcg - stores all menu item (e.g. Save, Resume, Exit) objects
            this.menuItemList = new List<MenuItem>();

            //sets menu texture to fullscreen minus and padding on XY
            this.textureRectangle = menuTextures[0].Bounds;
        }
コード例 #5
0
 public override void Initialize()
 {
     this.spriteBatch = EntitySystem.BlackBoard.GetEntry<SpriteBatch>("SpriteBatch");
     this.font = EntitySystem.BlackBoard.GetEntry<SpriteFont>("SpriteFont");
     healthMapper = new ComponentMapper<Health>(world);
     transformMapper = new ComponentMapper<Transform>(world);
 }
コード例 #6
0
 /// <summary>
 /// Constructs a new menu entry with the specified text and location.
 /// </summary>
 public MenuEntry(MenuScreen screen, string text, Vector2 position)
 {
     this.screen = screen;
     this.Text = text;
     this.position = position;
     this.font = screen.ScreenManager.GameContent.gameFont;
 }
コード例 #7
0
ファイル: MenuItem.cs プロジェクト: JllyGrnGiant/game_demo
 private void Setup(SpriteFont font, string text, Rectangle rect)
 {
     spriteBatch = new SpriteBatch(Engine.GraphicsDevice);
     spriteFont = font;
     Rectangle = rect;
     menuText = text;
 }
コード例 #8
0
ファイル: LevelMenyState.cs プロジェクト: Jakob37/JDGAME
        public LevelMenyState(Game1 game, Sprite spriteSheet)
            : base(game)
        {
            this.spriteSheet = spriteSheet;
            font = game.Content.Load<SpriteFont>("menyFont");

            knappar = new List<Clickable>();

            Random random = new Random();

            LevelMenyExitKnapp levelExit = new LevelMenyExitKnapp(game, spriteSheet, new Vector2(410, 550));
            levelExit.Initialize();

            Level1 lv1 = new Level1(game, spriteSheet, random);
            Level1Knapp level1knapp = new Level1Knapp(game, spriteSheet, new Vector2(200, 200), lv1);
            level1knapp.Initialize();
            lv1.AddLevelButton(level1knapp);

            Level2 lv2 = new Level2(game, spriteSheet, random);
            Level2Knapp level2knapp = new Level2Knapp(game, spriteSheet, new Vector2(300, 200), lv2);
            level2knapp.Initialize();
            lv2.AddLevelButton(level2knapp);

            Level3 lv3 = new Level3(game, spriteSheet, random);
            Level3Knapp level3knapp = new Level3Knapp(game, spriteSheet, new Vector2(400, 200), lv3);
            level3knapp.Initialize();
            lv3.AddLevelButton(level3knapp);

            Level4 lv4 = new Level4(game, spriteSheet, random);
            Level4Knapp level4knapp = new Level4Knapp(game, spriteSheet, new Vector2(500, 200), lv4);
            level4knapp.Initialize();
            lv4.AddLevelButton(level4knapp);

            Level5 lv5 = new Level5(game, spriteSheet, random);
            Level5Knapp level5knapp = new Level5Knapp(game, spriteSheet, new Vector2(600, 200), lv5);
            level5knapp.Initialize();
            lv5.AddLevelButton(level5knapp);

            Level6 lv6 = new Level6(game, spriteSheet, random);
            Level6Knapp level6knapp = new Level6Knapp(game, spriteSheet, new Vector2(700, 200), lv6);
            level6knapp.Initialize();
            lv6.AddLevelButton(level6knapp);

            LevelTest lvTest = new LevelTest(game, spriteSheet, random);
            TestLevelKnapp levelTestknapp = new TestLevelKnapp(game, spriteSheet, new Vector2(800, 600), lvTest);
            levelTestknapp.Initialize();
            lvTest.AddLevelButton(levelTestknapp);

            knappar.Add(level1knapp);
            knappar.Add(level2knapp);
            knappar.Add(level3knapp);
            knappar.Add(level4knapp);
            knappar.Add(level5knapp);
            knappar.Add(level6knapp);
            knappar.Add(levelTestknapp);

            knappar.Add(levelExit);

            textTimer = 0;
        }
コード例 #9
0
ファイル: DialogState.cs プロジェクト: erob2620/Space-Wizards
 protected override void LoadContent()
 {
     base.LoadContent();
     ContentManager Content = Game.Content;
     font = Content.Load<SpriteFont>(@"Fonts/ControlFont");
     pos = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
 }
コード例 #10
0
ファイル: DebugScreen.cs プロジェクト: pampersrocker/STAR
 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;
 }
コード例 #11
0
ファイル: MonogameRoundManager.cs プロジェクト: Zac-Bruin/LaG
        protected override void LoadContent()
        {
            this.font = content.Load<SpriteFont>("ConsoleFont");

            this.placeHolder = content.Load<Texture2D>("Instructions");
            this.spriteTexture = content.Load<Texture2D>("SpriteMarker");
            this.roundMusic = content.Load<Song>("music_game");
            this.waitMusic = content.Load<Song>("music_waiting_loop");

            NewHigh = content.Load<SoundEffect>("new_highscore");
            EndRound = content.Load<SoundEffect>("game_end");

            timeInstructionsStayAround = 10;

            MediaPlayer.Play(roundMusic);
            MediaPlayer.Volume = .3f;
            MediaPlayer.IsRepeating = true;          

            this.FirstRoundStartHasStarted = this.firstRoundOver = false;
            this.HasStartedRound = false;

            this.highScore = 0;

            if (!Lanko_And_Glub.utility.ShowInstructions)
                this.instructionsColor = new Color(0, 0, 0, 0);
            else
                this.instructionsColor = Color.White;

            this.scale = 0;

            this.fontScale = 1f;
            this.fontColor = timerColor = Color.White;

            base.LoadContent();
        }
コード例 #12
0
ファイル: Interface.cs プロジェクト: floAr/WarTornLands
 public Interface(Game game)
     : base(game)
 {
     _font = Game.Content.Load<SpriteFont>("Test");
     _heartTexture = Game.Content.Load<Texture2D>("heart");
     _potionTexture = Game.Content.Load<Texture2D>("potion");
 }
コード例 #13
0
 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");
 }
コード例 #14
0
ファイル: Event.cs プロジェクト: TowerTin/SourceCode
        public Event(SpriteBatch _s, GraphicsDevice _g,SpriteFont _font)
        {
            s = _s;
            g = _g;
            font = _font;

            posBGI.X = 0;
            posBGI.Y = 0;
            posLeft0.X = 0;
            posLeft0.Y = 10;
            posLeft1.X = 60;
            posLeft1.Y = 10;
            posRight0.X = 480;
            posRight0.Y = 10;
            posRight1.X = 520;
            posRight1.Y = 10;
            posFrame.X = 10;
            posFrame.Y = 340;
            posName.X = 100;
            posName.Y = 355;
            posTalk.X = 50;
            posTalk.Y = 400;

            serif = new List<string>();
            Stream stream;
             stream = File.OpenRead("images/hb1.png");
            imgBGI = Texture2D.FromStream(g, stream);

             stream = File.OpenRead("images/sowaku.png");
             imgFrame = Texture2D.FromStream(g, stream);
        }
コード例 #15
0
ファイル: Button.cs プロジェクト: cragmire/MVA
 public Button(SpriteFont font, string text, int posX, int posY)
 {
     _font = font;
     _text = text;
     var size = _font.MeasureString(text);
     _location = new Rectangle(posX - (int)(size.X / 2.0f), posY - (int)(size.Y / 2.0f), (int)size.X, (int)size.Y);
 }
コード例 #16
0
ファイル: MpqConsole.cs プロジェクト: WCell/WCell-Terrain
 /// <summary>
 /// Creates a new MpqConsole
 /// </summary>
 public MpqConsole(Game game, SpriteFont font)
     : base(game)
 {
     Console = new XnaConsoleComponent(game, font);
     game.Components.Add(Console);
     Console.Prompt(Prompt, Execute);
 }
コード例 #17
0
ファイル: Game1.cs プロジェクト: nreusch/MonoPong
        /// <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);

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

            t_wall = new Texture2D(GraphicsDevice,1,1);
            t_wall.SetData(new Color[] {Color.Black});

            t_goal = new Texture2D(GraphicsDevice, 1, 1);
            t_goal.SetData(new Color[] { Color.Pink });

            Dictionary<Keys, Command> p1Dict = new Dictionary<Keys, Command>();            
            player1 = new Player(Content.Load<Texture2D>(@"png/bar"), new Vector2(0, 0), 1,p1Dict);
            player1.Position = new Vector2(boundingBoxLeft.Width, boundingBoxTop.Y + boundingBoxTop.Height);
            //player1.Position = new Vector2(boundingBoxLeft.Width, boundingBoxTop.Y + boundingBoxTop.Height + HEIGHT / 2 - player1.BoundingBox.Height);
            p1Dict.Add(Keys.W, new MoveUpCommand(player1));
            p1Dict.Add(Keys.S, new MoveDownCommand(player1));

            Dictionary<Keys, Command> p2Dict = new Dictionary<Keys, Command>();        
            player2 = new Player(Content.Load<Texture2D>(@"png/bar"), new Vector2(0, 0), 2, p2Dict);
            player2.Position = new Vector2(WIDTH - boundingBoxRight.Width - player2.BoundingBox.Width, boundingBoxTop.Y + boundingBoxTop.Height);
            // player2.Position = new Vector2(WIDTH-boundingBoxRight.Width-player2.BoundingBox.Width, boundingBoxTop.Y + boundingBoxTop.Height + HEIGHT/2 - player2.BoundingBox.Height );
            p2Dict.Add(Keys.Up, new MoveUpCommand(player2));
            p2Dict.Add(Keys.Down, new MoveDownCommand(player2));
           
            ball = new Ball(Content.Load<Texture2D>(@"png/ball"),new Vector2(300, boundingBoxTop.Y + boundingBoxTop.Height + player1.BoundingBox.Height/2 - 10),300f);
            ball.setToStartPosition(player1);
        }
コード例 #18
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);

			//TODO: use this.Content to load your game content here
			monkey = Content.Load<Texture2D> ("monkey");
			background = Content.Load <Texture2D> ("background");
			logo = Content.Load<Texture2D> ("logo");
			font = Content.Load<SpriteFont> ("font");
			hit = Content.Load<SoundEffect> ("hit");
			title = Content.Load<Song> ("title");
			Microsoft.Xna.Framework.Media.MediaPlayer.IsRepeating = true;
			Microsoft.Xna.Framework.Media.MediaPlayer.Play (title);

			var viewport = graphics.GraphicsDevice.Viewport;
			var padding = (viewport.Width / 100);
			var gridWidth = (viewport.Width - (padding * 5)) / 4;
			var gridHeight = gridWidth;

			for (int y = padding; y < gridHeight*5; y+=gridHeight+padding) {
				for (int x = padding; x < viewport.Width-gridWidth; x+=gridWidth+padding) {
					grid.Add (new GridCell () {
						DisplayRectangle = new Rectangle (x, y, gridWidth, gridHeight)
					});
				}
			}
		}
コード例 #19
0
ファイル: Game1.cs プロジェクト: Cheeser12/XNAsteroids
        /// <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);

            titleFont = Content.Load<SpriteFont>("TitleFont");
        }
コード例 #20
0
ファイル: DrawFPS.cs プロジェクト: pentiumx/HLSLTest
 //private Game1 game;
 public DebugMessage(Game game, SpriteBatch spriteBatch)
     : base(game)
 {
     // TODO: Construct any child components here
     _spriteBatch = spriteBatch;
     _font = this.Game.Content.Load<SpriteFont>("Fonts\\menuFont");
 }
コード例 #21
0
 public CCBox2dDraw(string spriteFontName, int ptmRatio) : base(ptmRatio)
 {
     primitiveBatch = new CCPrimitiveBatch(5000);
     spriteFont = CCContentManager.SharedContentManager.Load<SpriteFont>(spriteFontName);
     stringData = new List<StringData>();
     stringBuilder = new StringBuilder();
 }
コード例 #22
0
 public Sprite(SpriteFont font, string text, Vector2 position, Color? tint = null)
 {
     this.Font = font;
     this.Text = text;
     this.Position = position;
     this.Tint = tint.HasValue ? tint.Value : Color.White;
 }
コード例 #23
0
ファイル: MenuComponent.cs プロジェクト: tojuhaka/HakaGame
 public MenuComponent(SpriteFont spriteFont, string[] items)
 {
     this.spriteFont = spriteFont;
     SetMenuItems(items);
     NormalColor = Color.White;
     HiliteColor = Color.Red;
 }
コード例 #24
0
 public ActionScene(
     IController playerOneController,
     IController playerTwoController,
     Game game,
     Texture2D theTexture,
     Texture2D backgroundTexture,
     Rectangle screenBounds,
     SpriteFont font,
     Vector2 gameoverPosition)
     : this(game, theTexture, backgroundTexture, font, gameoverPosition)
 {
     this.TwoPlayers = true;
     this._player1 = new Player(Game, ref this._actionTexture, new Vector2(x: screenBounds.Width / 3, y: 0), new Rectangle(323, 15, 30, 30), playerOneController);
     this._player1.Initialize();
     Components.Add(this._player1);
     this._scorePlayer2 = new Score(game, font, Color.Red)
                        {
                            Position =
                                new Vector2(
                                this.Game.Window.ClientBounds.Width - 200, 10)
                        };
     Components.Add(this._scorePlayer2);
     this._player2 = new Player(Game, ref this._actionTexture, new Vector2((int)(screenBounds.Width / 1.5), 0), new Rectangle(360, 17, 30, 30), playerTwoController);
     this._player2.Initialize();
     Components.Add(this._player2);
 }
コード例 #25
0
ファイル: TextButton.cs プロジェクト: dah6ce/Blink
 public TextButton(String text, SpriteFont font, Vector2 pos, Texture2D up, Texture2D down, Vector2 center = default(Vector2))
     : base(pos, new Vector2(0,0), up, down, center)
 {
     this.text = text;
     this.font = font;
     this.size = new Vector2(FONT_SIZE * text.Length + 2*MARGIN, 1.6f * FONT_SIZE + 2*MARGIN);
 }
コード例 #26
0
ファイル: EndState.cs プロジェクト: guorenxu/FoodSpace
        protected override void LoadContent()
        {
            this.EndTexture = Content.Load<Texture2D>("Transparent25Percent");
            this.font = Content.Load<SpriteFont>("NFont");
            base.LoadContent();

        }
コード例 #27
0
ファイル: TitleCard.cs プロジェクト: HStocker/RogueLike
 public TitleCard(SpriteBatch spriteBatch, RogueLike ingame)
 {
     this.spriteBatch = spriteBatch;
     this.ingame = ingame;
     overlay = ingame.Content.Load<Texture2D>("overlay.png");
     output128 = ingame.Content.Load<SpriteFont>("Output128pt");
 }
コード例 #28
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);

            // TODO: use this.Content to load your game content here

            star = Content.Load<Texture2D>("star");
            font = Content.Load<SpriteFont>("font");
            sphereModel = Content.Load<Model>("sphere");

            for (int i = 0; i < particleCount; ++i)
            {
                particles.Add(GetRandomParticle());
            }

            try
            {

                glove = new P5();

                glove.ResetSensors();
                useGlove = true;
            }
            catch
            {
                useGlove = false;
            }

        }
コード例 #29
0
 public Tooltip(string str, SpriteFont Font, Color Color)
 {
     text = str;
     font = Font;
     location = new Vector2(Input.mousePosition.X, Input.mousePosition.Y);
     color = Color;
 }
コード例 #30
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _camera = new Camera2D(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            _player = new Player(Content, new Vector2(400, 430));
            _player.Load("Animations.xml");

            _font = Content.Load<SpriteFont>("font");

            Debug.Assert(GraphicsDevice != null, "GraphicsDevice != null");
// ReSharper disable once PossibleLossOfFraction
            _camera.MinPosition = new Vector2(x: GraphicsDevice.Viewport.Width / 2, y: 0);
            //Camera.MaxPosition = new Vector2(map.Dimensions.X - GraphicsDevice.Viewport.Width / 2, map.Dimensions.Y / 2 - 35);
            _camera.MaxPosition = new Vector2(5000, 200);

            _camera.TrackingBody = _player;

            _levelProvider = new LevelProvider(Content, _player, _camera);
            _levelProvider.LoadMaps(GraphicsDevice, "hills.tmx");

            _hud = new HUD(Content, _player);
            _hud.Initialize();
            _hud.SetMapWidth(1000);
        }
コード例 #31
0
ファイル: Game1.cs プロジェクト: jfernandezrodriguez/MonoGame
        /// <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);

            font     = Content.Load <Microsoft.Xna.Framework.Graphics.SpriteFont>("SpriteFont1");
            textSize = font.MeasureString("MonoGame");
            textSize = new Vector2(textSize.X / 2, textSize.Y / 2);
        }
コード例 #32
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);

            font1    = Content.Load <SpriteFont>("SpriteFont1");
            font2    = Content.Load <SpriteFont>("Arial32");
            textSize = font1.MeasureString("MonoGame");
            textSize = new Vector2(textSize.X / 2, textSize.Y / 2);
        }
コード例 #33
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(base.Game.GraphicsDevice);

            // Populate your tiles list with your textures here
            //Tiles = new List<Texture2D>();
            Texture2D tmp = base.Game.Content.Load <Texture2D>(@"CityMap\Cubes\cubo_terra");

            //Tiles.Add(tmp);

            selectionTexture = base.Game.Content.Load <Texture2D>(@"CityMap\selection_maior");
            //cuboSemLinha = this.content.Load<Texture2D>("cubosemlinha");

            pequenaCasa = base.Game.Content.Load <Texture2D>(@"CityMap\pequena_casa");

            //grandeCasa = base.Game.Content.Load<Texture2D>(@"Buildings\casa_grande");
            grandeCasa = base.Game.Content.Load <Texture2D>(@"Buildings\quartel_2x2");

            House3x3 = base.Game.Content.Load <Texture2D>(@"Buildings\casa3x3");

            spriteFont = base.Game.Content.Load <SpriteFont>(@"SpriteFont");

            //testeHouse = new TinyHouse(pequenaCasa);

            //  Initialise block 2D array
            Blocks = new DrawableCityBlock[Width, Height];

            // Used as a base width and height for varying sized tiles
            CityBlock.BaseWidth  = tmp.Width;
            CityBlock.BaseHeight = tmp.Height / 2;

            Rectangle position = new Rectangle(0, 0, tmp.Width, tmp.Height);

            for (int x = 0; x < Width; x++)
            {
                position.X = (CityBlock.BaseWidth / 2) * x;
                position.Y = (CityBlock.BaseHeight / 2) * x;

                for (int y = 0; y < Height; y++)
                {
                    Blocks[x, y] = new DrawableCityBlock(new CityBlock(position, new Point(x, y)));

                    Blocks[x, y].Coordinates = x + "," + y;

                    position.Y += (CityBlock.BaseHeight / 2);
                    position.X += -(CityBlock.BaseWidth / 2);
                }
            }

            CalculateCityEdges();

            base.LoadContent();
        }
コード例 #34
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager graphics, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            g.Clear(Color.Black);

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White);

            // sp.DrawString(font, "Options", new Vector2(20, 20), Color.White);

            foreach (Button btn in bl)
            {
                sp.Draw(btn.Texture, btn.Position, btn.SourceRectangle, btn.Color, btn.Rotation, btn.Origin, btn.Scale, btn.Effect, btn.LayerDepth);
            }

            sp.End();
        }
コード例 #35
0
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager g, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White);

            // Draws the player-picture in question to detailview
            // sp.Draw(player_picture, detailPictureOutlines, Color.White);

            sp.Draw(player_picture, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White);

            // Draws the caption in the Topleft-Corner
            // sp.DrawString(font, "Detailview - Click anywhere to return", new Vector2(20, 20), Color.Black);

            // Draws the caption that tells the player how to return to the highscore-tablescreen
            sp.DrawString(font, "Click on the Background to return", new Vector2((int)(bZero * 0.300), 40), Color.White);
            sp.End();
        }
コード例 #36
0
ファイル: Highscore.cs プロジェクト: marvreichmann/MemoryKidz
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager g, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();

            g.GraphicsDevice.Clear(Color.Black);

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // sp.Draw(background, new Rectangle(0, 0, g.PreferredBackBufferWidth, g.PreferredBackBufferHeight), Color.White);

            // sp.DrawString(font, "Highscore", new Vector2(20, 20), Color.Black);

            /// <summary>
            /// Draws all the Lines necessary for the table to be displayed
            /// </summary>
            int index = 0;

            foreach (Rectangle line in lines)
            {
                sp.Draw(lineTexture, lines[index], Color.OrangeRed);
                index++;
            }

            int offsetX = (int)Math.Round((double)g.PreferredBackBufferWidth * 0.020);
            int offsetY = (int)Math.Round((double)g.PreferredBackBufferHeight * 0.020);

            /// <summary>
            /// Draws the linenumbers onto the table
            /// </summary>
            for (int i = 0; i < 10; i++)
            {
                switch (i)
                {
                case 0:
                {
                    sp.DrawString(GameSpecs.scoreFont, (i + 1).ToString(), new Vector2(lines[i].X + offsetX, lines[i].Y - (int)(offsetY * 10)), Color.OrangeRed);
                    break;
                }

                case 1:
                case 2:
                case 3:
                case 4:
                case 5:
                case 6:
                case 7:
                case 8:
                case 9:
                {
                    sp.DrawString(font, (i + 1).ToString(), new Vector2(lines[i - 1].X + offsetX, lines[i - 1].Y + offsetY), Color.OrangeRed);
                    break;
                }
                }
            }

            ///<summary>
            /// Writes the Highscores into the table
            ///</summary>

            int[] scores = scoreValues.ToArray();

            for (int i = 0; i < 10; i++)
            {
                if (i == 0)
                {
                    sp.DrawString(GameSpecs.scoreFont, scores[i].ToString(), new Vector2(lines[i].X + offsetX * 20, lines[i].Y + (int)(offsetY - offsetY * 11)), Color.OrangeRed);
                }
                else
                {
                    sp.DrawString(font, scores[i].ToString(), new Vector2(lines[i - 1].X + offsetX * 4, lines[i - 1].Y + offsetY), Color.OrangeRed);
                }
            }

            // Draw the Button(s)
            foreach (Button btn in bl)
            {
                sp.Draw(btn.Texture, new Rectangle((int)btn.Position.X, (int)btn.Position.Y, btn.SourceRectangle.Width, btn.SourceRectangle.Height), Color.White);
            }

            List <int> dimensions = Extension.CalculateDimensionsInPixel(ref g);

            int pictureWidth  = 0;
            int pictureHeight = 0;

            if (g.GraphicsDevice.DisplayMode.Height < 1080)
            {
                pictureHeight = 150;
                pictureWidth  = 150;
            }
            else
            {
                pictureHeight = 200;
                pictureWidth  = 200;
            }
            // Draws the picture of the leader of the highscore-ladder to the screen
            sp.Draw(player_picture_frame, new Rectangle((dimensions[6] + dimensions[9]) - 15, dimensions[4] - 15, pictureWidth + 30, pictureHeight + 30), Color.White);
            sp.Draw(leader_picture, new Rectangle(dimensions[6] + dimensions[9], dimensions[4], pictureWidth, pictureHeight), Color.White);

            sp.End();
        }
コード例 #37
0
ファイル: Endgame.cs プロジェクト: marvreichmann/MemoryKidz
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager graphics, ref Microsoft.Xna.Framework.Graphics.SpriteFont font)
        {
            sp.Begin();
            g.Clear(Color.Black);

            /// Logic for drawing the ActiveBackground
            ActiveBackground.DrawSky();
            ActiveBackground.DrawSunrays();
            ActiveBackground.DrawFlowers();
            ActiveBackground.DrawGrass();
            ActiveBackground.DrawSun();
            ActiveBackground.DrawCloud1();
            ActiveBackground.DrawCloud2();
            ActiveBackground.DrawCloud3();
            ActiveBackground.DrawCloud4();
            ActiveBackground.DrawCloud5();

            // Draws the Background-Image
            // sp.Draw(background, new Rectangle(0, 0, bZero, hZero), Color.White);

            // Top-Left corner caption
            // sp.DrawString(font, "Endgame", new Vector2(20, 20), Color.White);

            // The Scoreboard
            sp.DrawString(GameSpecs.scoreFont, Convert.ToInt32(Timer.Score).ToString(), new Vector2((int)(bZero * 0.38), (int)(hZero * 0.011)), Color.OrangeRed);

            // The Placeholder-graphic for the KinectStream
            sp.Draw(placeholder, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White);

            // The Countdown for taking the photo
            sp.DrawString(GameSpecs.scoreFont, Math.Round(Countdown.Counter).ToString(), new Vector2((float)(bZero / 2) - 80, (float)(hZero - 160)), Color.Turquoise);

            if (Session.PhotoTaken == true)
            {
                // Draw the Button(s)
                foreach (Button btn in bl)
                {
                    sp.Draw(btn.Texture, btn.Position, btn.SourceRectangle, btn.Color, btn.Rotation, btn.Origin, btn.Scale, btn.Effect, btn.LayerDepth);
                }
            }

            sp.End();
        }
コード例 #38
0
ファイル: ResourceService.cs プロジェクト: versus-fm/xna-game
 public void Register(Microsoft.Xna.Framework.Graphics.SpriteFont font, string name)
 {
     fonts.Add(name, font);
 }
コード例 #39
0
        /// <summary>
        /// Loads the resources from any other XNA game like if they were form this one and extracts them.
        /// Tested with the XNA resources from the games "Terraria" and "Stardew Valley" with success.
        /// With applications like "ILSpy" you can see the source code from XNA games since they are .NET.
        /// The idea of this application is to find secrets hidden in the game textures and resources,
        /// but it should never be used to do anything illegal, so be sure you have the proper
        /// permissions before you start using it on random games. Jupisoft will never be responsible.
        /// </summary>
        protected override void LoadContent()
        {
            try
            {
                try { if (!Directory.Exists(Program.Ruta_XNA))
                      {
                          Directory.CreateDirectory(Program.Ruta_XNA);
                      }
                }
                catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); }

                List <string> Lista_Rutas     = new List <string>();
                List <string> Lista_Rutas_XSB = new List <string>();
                string[]      Matriz_Rutas    = Directory.GetFiles(Program.Ruta_XNA, "*.xnb", SearchOption.AllDirectories);
                if (Matriz_Rutas != null && Matriz_Rutas.Length > 0)
                {
                    Lista_Rutas.AddRange(Matriz_Rutas);
                    Matriz_Rutas = null;
                }
                Matriz_Rutas = Directory.GetFiles(Program.Ruta_XNA, "*.xwb", SearchOption.AllDirectories);
                if (Matriz_Rutas != null && Matriz_Rutas.Length > 0)
                {
                    Lista_Rutas.AddRange(Matriz_Rutas);
                    Matriz_Rutas = null;
                }
                Matriz_Rutas = Directory.GetFiles(Program.Ruta_XNA, "*.xgs", SearchOption.AllDirectories);
                if (Matriz_Rutas != null && Matriz_Rutas.Length > 0)
                {
                    Lista_Rutas.AddRange(Matriz_Rutas);
                    Matriz_Rutas = null;
                }
                Matriz_Rutas = Directory.GetFiles(Program.Ruta_XNA, "*.xsb", SearchOption.AllDirectories);
                if (Matriz_Rutas != null && Matriz_Rutas.Length > 0)
                {
                    //Lista_Rutas.AddRange(Matriz_Rutas);
                    Lista_Rutas_XSB.AddRange(Matriz_Rutas);
                    if (Lista_Rutas_XSB.Count > 1)
                    {
                        Lista_Rutas.Sort();
                    }
                    Matriz_Rutas = null;
                }
                if (Lista_Rutas.Count > 1)
                {
                    Lista_Rutas.Sort();
                }
                Matriz_Rutas = Lista_Rutas.ToArray();
                Lista_Rutas  = null;

                if (Matriz_Rutas != null && Matriz_Rutas.Length > 0) // There are files to extract.
                {
                    foreach (string Ruta in Matriz_Rutas)
                    {
                        try
                        {
                            if (!string.IsNullOrEmpty(Ruta) && File.Exists(Ruta))
                            {
                                string Ruta_Relativa = '.' + Ruta.Substring(Program.Ruta_Aplicación.Length).Substring(0, (Ruta.Length - Program.Ruta_Aplicación.Length) - 4);
                                string Ruta_Salida   = Ruta.Substring(0, Ruta.Length - 4);

                                try // Try to read as a 2D texture and export as a PNG image.
                                {
                                    Microsoft.Xna.Framework.Graphics.Texture2D Textura = base.Content.Load <Texture2D>(Ruta_Relativa);
                                    if (Textura != null)
                                    {
                                        MemoryStream Lector_Memoria = new MemoryStream();
                                        int          Ancho          = 16; // Default on error.
                                        int          Alto           = 16;
                                        try { Ancho = Textura.Width; }
                                        catch { Ancho = 16; }
                                        try { Alto = Textura.Height; }
                                        catch { Alto = 16; }
                                        Textura.SaveAsPng(Lector_Memoria, Ancho, Textura.Height);
                                        byte[] Matriz_Bytes = Lector_Memoria.ToArray();
                                        Lector_Memoria.Close();
                                        Lector_Memoria.Dispose();
                                        Lector_Memoria = null;
                                        Lector_Memoria = new MemoryStream(Matriz_Bytes);
                                        Image Imagen_Original = null;
                                        try { Imagen_Original = Image.FromStream(Lector_Memoria, false, false); }
                                        catch { Imagen_Original = null; }
                                        Lector_Memoria.Close();
                                        Lector_Memoria.Dispose();
                                        Lector_Memoria = null;
                                        Matriz_Bytes   = null;
                                        if (Imagen_Original != null) // Reconvert the image to 24 or 32 bits with alpha.
                                        {
                                            //Ancho = Imagen_Original.Width; // Could the width or height change?
                                            //Alto = Imagen_Original.Height;
                                            Bitmap   Imagen = new Bitmap(Ancho, Alto, !Image.IsAlphaPixelFormat(Imagen_Original.PixelFormat) ? PixelFormat.Format24bppRgb : PixelFormat.Format32bppArgb);
                                            Graphics Pintar = Graphics.FromImage(Imagen);
                                            Pintar.CompositingMode    = CompositingMode.SourceCopy;
                                            Pintar.CompositingQuality = CompositingQuality.HighQuality;
                                            Pintar.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                                            Pintar.PixelOffsetMode    = PixelOffsetMode.HighQuality;
                                            Pintar.SmoothingMode      = SmoothingMode.None;
                                            Pintar.TextRenderingHint  = TextRenderingHint.AntiAlias;
                                            Pintar.DrawImage(Imagen_Original, new System.Drawing.Rectangle(0, 0, Ancho, Alto), new System.Drawing.Rectangle(0, 0, Ancho, Alto), GraphicsUnit.Pixel);
                                            Pintar.Dispose();
                                            Pintar = null;
                                            while (File.Exists(Ruta_Salida + ".png"))
                                            {
                                                Ruta_Salida += '_';
                                            }
                                            Imagen.Save(Ruta_Salida + ".png", ImageFormat.Png);
                                            Ruta_Salida = null;
                                            Imagen.Dispose();
                                            Imagen = null;
                                            Imagen_Original.Dispose();
                                            Imagen_Original = null;
                                            Ruta_Relativa   = null;
                                            Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                            continue;                               // Go to the next XNB resource file.
                                        }
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                try // Try to read as a string and string dictionary and export as Unicode text.
                                {
                                    Dictionary <string, string> Diccionario = base.Content.Load <Dictionary <string, string> >(Ruta_Relativa);
                                    if (Diccionario != null && Diccionario.Count > 0)
                                    {
                                        while (File.Exists(Ruta_Salida + ".txt"))
                                        {
                                            Ruta_Salida += '_';
                                        }
                                        FileStream Lector = new FileStream(Ruta_Salida + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                                        Lector.SetLength(0L);
                                        Lector.Seek(0L, SeekOrigin.Begin);
                                        StreamWriter Lector_Texto = new StreamWriter(Lector, Encoding.Unicode);
                                        foreach (KeyValuePair <string, string> Entrada in Diccionario)
                                        {
                                            try
                                            {
                                                Lector_Texto.WriteLine(Entrada.Key);
                                                Lector_Texto.WriteLine(Entrada.Value);
                                                Lector_Texto.WriteLine();
                                                Lector_Texto.Flush();
                                            }
                                            catch (Exception Excepción)
                                            {
                                                Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                                continue;
                                            }
                                        }
                                        Lector_Texto.Close();
                                        Lector_Texto.Dispose();
                                        Lector_Texto = null;
                                        Lector.Close();
                                        Lector.Dispose();
                                        Lector      = null;
                                        Diccionario = null;
                                        Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                        continue;                               // Go to the next XNB resource file.
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                try // Try to read as an int and text dictionary and export as Unicode text.
                                {
                                    Dictionary <int, string> Diccionario = base.Content.Load <Dictionary <int, string> >(Ruta_Relativa);
                                    if (Diccionario != null && Diccionario.Count > 0)
                                    {
                                        while (File.Exists(Ruta_Salida + ".txt"))
                                        {
                                            Ruta_Salida += '_';
                                        }
                                        FileStream Lector = new FileStream(Ruta_Salida + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                                        Lector.SetLength(0L);
                                        Lector.Seek(0L, SeekOrigin.Begin);
                                        StreamWriter Lector_Texto = new StreamWriter(Lector, Encoding.Unicode);
                                        foreach (KeyValuePair <int, string> Entrada in Diccionario)
                                        {
                                            try
                                            {
                                                Lector_Texto.WriteLine(Entrada.Key.ToString());
                                                Lector_Texto.WriteLine(Entrada.Value);
                                                Lector_Texto.WriteLine();
                                                Lector_Texto.Flush();
                                            }
                                            catch (Exception Excepción)
                                            {
                                                Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                                continue;
                                            }
                                        }
                                        Lector_Texto.Close();
                                        Lector_Texto.Dispose();
                                        Lector_Texto = null;
                                        Lector.Close();
                                        Lector.Dispose();
                                        Lector      = null;
                                        Diccionario = null;
                                        Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                        continue;                               // Go to the next XNB resource file.
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                try // Try to read as an int and int array dictionary and export as Unicode text.
                                {
                                    Dictionary <int, int[]> Diccionario = base.Content.Load <Dictionary <int, int[]> >(Ruta_Relativa);
                                    if (Diccionario != null && Diccionario.Count > 0)
                                    {
                                        while (File.Exists(Ruta_Salida + ".txt"))
                                        {
                                            Ruta_Salida += '_';
                                        }
                                        FileStream Lector = new FileStream(Ruta_Salida + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                                        Lector.SetLength(0L);
                                        Lector.Seek(0L, SeekOrigin.Begin);
                                        StreamWriter Lector_Texto = new StreamWriter(Lector, Encoding.Unicode); // .Default?
                                        foreach (KeyValuePair <int, int[]> Entrada in Diccionario)
                                        {
                                            try
                                            {
                                                Lector_Texto.WriteLine(Entrada.Key.ToString());
                                                if (Entrada.Value != null && Entrada.Value.Length > 0)
                                                {
                                                    for (int Índice = 0; Índice < Entrada.Value.Length; Índice++)
                                                    {
                                                        try
                                                        {
                                                            Lector_Texto.Write(Entrada.Value[Índice].ToString() + (Índice + 1 < Entrada.Value.Length ? ", " : null));
                                                        }
                                                        catch (Exception Excepción)
                                                        {
                                                            Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                                            continue;
                                                        }
                                                    }
                                                    Lector_Texto.WriteLine();
                                                }
                                                else
                                                {
                                                    Lector_Texto.WriteLine();
                                                }
                                                Lector_Texto.WriteLine();
                                                Lector_Texto.Flush();
                                            }
                                            catch (Exception Excepción)
                                            {
                                                Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                                continue;
                                            }
                                        }
                                        Lector_Texto.Close();
                                        Lector_Texto.Dispose();
                                        Lector_Texto = null;
                                        Lector.Close();
                                        Lector.Dispose();
                                        Lector      = null;
                                        Diccionario = null;
                                        Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                        continue;                               // Go to the next XNB resource file.
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                try // Try to read as a sprite font and export as a PNG image.
                                {
                                    Microsoft.Xna.Framework.Graphics.SpriteFont Fuente = base.Content.Load <SpriteFont>(Ruta_Relativa);
                                    if (Fuente != null)
                                    {
                                        Fuente = null;
                                        while (File.Exists(Ruta_Salida + ".png"))
                                        {
                                            Ruta_Salida += '_';
                                        }
                                        if (XNA_Extractor.Extract.XnbExtractor.Extract(Ruta, Ruta_Salida + ".png", false, false, false, true))
                                        {
                                            Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                            continue;                               // Go to the next XNB resource file.
                                        }
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                try // Try to read as a sound effect and export as WAV audio file.
                                {
                                    Microsoft.Xna.Framework.Audio.SoundEffect Efecto_Sonido = base.Content.Load <Microsoft.Xna.Framework.Audio.SoundEffect>(Ruta_Relativa);
                                    if (Efecto_Sonido != null)
                                    {
                                        Efecto_Sonido.Dispose();
                                        Efecto_Sonido = null;
                                        while (File.Exists(Ruta_Salida + ".wav"))
                                        {
                                            Ruta_Salida += '_';
                                        }
                                        if (XNA_Extractor.Extract.XnbExtractor.Extract(Ruta, Ruta_Salida + ".wav", false, false, true, false))
                                        {
                                            //Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                            continue; // Go to the next XNB resource file.
                                        }
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                /*try // Try to read as an effect and export as ?.
                                 * {
                                 *  Microsoft.Xna.Framework.Graphics.Effect Efecto = base.Content.Load<Effect>(Ruta_Relativa);
                                 *  if (Efecto != null)
                                 *  {
                                 *      Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                 *      continue; // Go to the next XNB resource file.
                                 *  }
                                 * }
                                 * catch (Exception Excepción)
                                 * {
                                 *  //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                 * }*/

                                try // Try to read as a multiple type and export as a PNG image.
                                {
                                    while (File.Exists(Ruta_Salida + ".png"))
                                    {
                                        Ruta_Salida += '_';
                                    }
                                    if (XNA_Extractor.Extract.XnbExtractor.Extract(Ruta, Ruta_Salida + ".png", false, true, true, true))
                                    {
                                        Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                        continue;                               // Go to the next XNB resource file.
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                try // Try to read as a bank wave file and export as multiple WAV sound files.
                                {
                                    //while (File.Exists(Ruta_Salida + ".wav")) Ruta_Salida += '_';
                                    //MessageBox.Show(Path.GetDirectoryName(Ruta_Salida), Ruta_Salida);
                                    if (/*string.Compare(Path.GetExtension(Ruta), ".xwb", true) == 0 && */ XNA_Extractor.Extract.XactExtractor.Extract(Ruta, Path.GetDirectoryName(Ruta)))
                                    {
                                        Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                        continue;                               // Go to the next XNB resource file.
                                    }
                                }
                                catch (Exception Excepción)
                                {
                                    //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                }

                                // TODO: Add support for more resource types...
                            }
                        }
                        catch (Exception Excepción)
                        {
                            //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                            continue;
                        }
                    }
                    Matriz_Rutas = null;
                }
                // This works perfectly, but the class from "XactExtractor.cs" seems to export too many files?
                if (Lista_Rutas_XSB != null && Lista_Rutas_XSB.Count > 0) // Post-process the track names if present.
                {
                    List <char> Lista_Caracteres_Inválidos = new List <char>(Path.GetInvalidFileNameChars());
                    foreach (string Ruta in Lista_Rutas_XSB)
                    {
                        try
                        {
                            FileStream Lector_Entrada = new FileStream(Ruta, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite);
                            if (Lector_Entrada.Length > 0L)                            // Not empty.
                            {
                                byte[] Matriz_Bytes = new byte[Lector_Entrada.Length]; // Read the whole file at once.
                                int    Longitud     = Lector_Entrada.Read(Matriz_Bytes, 0, Matriz_Bytes.Length);
                                Lector_Entrada.Close();
                                Lector_Entrada.Dispose();
                                Lector_Entrada = null;
                                if (Longitud < Matriz_Bytes.Length)
                                {
                                    Array.Resize(ref Matriz_Bytes, Longitud);
                                }
                                string Ruta_Actual  = Path.GetDirectoryName(Ruta);
                                int    Total_Pistas = 0;
                                for (int Índice = 1; Índice < int.MaxValue; Índice++)
                                {
                                    if (File.Exists(Ruta_Actual + "\\" + Índice.ToString() + " Unknown.wav"))
                                    {
                                        Total_Pistas++;
                                    }
                                    else
                                    {
                                        break;  // Stop when a track in order is missing.
                                    }
                                }
                                List <string> Lista_Nombres   = new List <string>();
                                int           Índice_Anterior = Matriz_Bytes.Length - 1; // This byte should be zero (string ender).
                                for (int Índice = Matriz_Bytes.Length - 2; Índice >= 0; Índice--)
                                {
                                    if (Matriz_Bytes[Índice] == 0)
                                    {
                                        if (Índice + 1 != Índice_Anterior) // Avoid multiple nulls.
                                        {
                                            string Nombre = null;
                                            for (int Índice_Caracter = Índice + 1; Índice_Caracter < Índice_Anterior; Índice_Caracter++)
                                            {
                                                char Caracter = (char)Matriz_Bytes[Índice_Caracter];
                                                if (!char.IsControl(Caracter) && Caracter != 'ÿ' && !Lista_Caracteres_Inválidos.Contains(Caracter))
                                                {
                                                    Nombre += Caracter;
                                                }
                                            }
                                            if (string.IsNullOrEmpty(Nombre))
                                            {
                                                Nombre = "Unknown";
                                            }
                                            Lista_Nombres.Add(Nombre);
                                            //if (Lista_Nombres.Count >= Total_Pistas) break;
                                        }
                                        Índice_Anterior = Índice;
                                    }
                                }
                                if (Lista_Nombres != null && Lista_Nombres.Count > 0)
                                {
                                    for (int Índice_Pista = Total_Pistas, Índice_Nombre = 0; Índice_Pista >= 1; Índice_Pista--, Índice_Nombre++)
                                    {
                                        try
                                        {
                                            File.Move(Ruta_Actual + "\\" + Índice_Pista.ToString() + " Unknown.wav", Ruta_Actual + "\\" + Índice_Pista.ToString() + " " + Lista_Nombres[Índice_Nombre] + ".wav");
                                        }
                                        catch (Exception Excepción)
                                        {
                                            //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                            continue;
                                        }
                                    }
                                    Lista_Nombres.Reverse();
                                    string Ruta_Salida = Ruta.Substring(0, Ruta.Length - 4);
                                    while (File.Exists(Ruta_Salida + ".txt"))
                                    {
                                        Ruta_Salida += '_';
                                    }
                                    FileStream Lector = new FileStream(Ruta_Salida + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
                                    Lector.SetLength(0L);
                                    Lector.Seek(0L, SeekOrigin.Begin);
                                    StreamWriter Lector_Texto = new StreamWriter(Lector, Encoding.Unicode);
                                    foreach (string Nombre in Lista_Nombres)
                                    {
                                        try
                                        {
                                            Lector_Texto.WriteLine(Nombre);
                                            Lector_Texto.Flush();
                                        }
                                        catch (Exception Excepción)
                                        {
                                            //Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                                            continue;
                                        }
                                    }
                                    Lector_Texto.Close();
                                    Lector_Texto.Dispose();
                                    Lector_Texto = null;
                                    Lector.Close();
                                    Lector.Dispose();
                                    Lector        = null;
                                    Lista_Nombres = null;
                                    Program.Eliminar_Archivo_Carpeta(Ruta); // Delete the copied XNB resource.
                                    continue;                               // Go to the next XNB resource file.
                                }
                            }
                        }
                        catch (Exception Excepción)
                        {
                            Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null);
                            continue;
                        }
                    }
                    Lista_Caracteres_Inválidos = null;
                }
                Depurador.Detener_Depurador();
                this.Exit();
            }
            catch (Exception Excepción) { Depurador.Escribir_Excepción(Excepción != null ? Excepción.ToString() : null); }
        }