Пример #1
0
        /// <summary>
        /// Отрисовка экрана в режиме управления роботом.
        /// </summary>
        /// <param name="gameTime">
        /// Игровое время.
        /// </param>
        private void DrawInRobotControlState(GameTime gameTime)
        {
            this.spriteBatch.Begin();

            if (this.IsActive && (this.videoTexture != null))
            {
                Rectangle rectangle = new Rectangle(
                    0,
                    0,
                    this.graphics.PreferredBackBufferWidth,
                    this.graphics.PreferredBackBufferHeight);
                this.spriteBatch.Draw(this.videoTexture, rectangle, Color.White);
            }

            Color  color;
            string motorCommand;
            string speedText = " (max " + Math.Round((double)this.driveHelper.SpeedForKeyboardControl * 100 / 255).ToString() + "%)";

            motorCommand = this.driveHelper.LeftMotorCommand + speedText;
            color        = Color.White;
            this.spriteBatch.DrawString(this.debugFont, motorCommand, ScreenConstants.GetTextPosition(0, 0), color);

            motorCommand = this.driveHelper.RightMotorCommand;
            color        = Color.White;
            this.spriteBatch.DrawString(this.debugFont, motorCommand, ScreenConstants.GetTextPosition(0, 1), color);

            if (this.driveHelper.TurboModeOn)
            {
                this.spriteBatch.DrawString(this.debugFont, "Турбо режим", ScreenConstants.GetTextPosition(1, 0), Color.Orange);
            }

            if (this.driveHelper.RotationModeOn)
            {
                this.spriteBatch.DrawString(this.debugFont, "Режим разворота", ScreenConstants.GetTextPosition(1, 1), Color.Orange);
            }

            if (this.lookHelper.FastModeOn)
            {
                this.spriteBatch.DrawString(this.debugFont, "Быстрый обзор", ScreenConstants.GetTextPosition(1, 2), Color.Orange);
            }

            if (!this.lookHelper.WalkModeOn)
            {
                this.spriteBatch.DrawString(this.debugFont, "Режим обзора", ScreenConstants.GetTextPosition(1, 3), Color.Orange);
            }

            this.spriteBatch.DrawString(this.debugFont, this.lookHelper.HorizontalServoCommand, ScreenConstants.GetTextPosition(0, 2), Color.White);
            this.spriteBatch.DrawString(this.debugFont, this.lookHelper.VerticalServoCommand, ScreenConstants.GetTextPosition(0, 3), Color.White);

            color = this.flashlightHelper.FlashlightTurnedOn ? Color.Yellow : Color.White;
            this.spriteBatch.DrawString(this.debugFont, this.flashlightHelper.FlashlightCommand, ScreenConstants.GetTextPosition(0, 4), color);

            string moodText = "Настроение: ";

            switch (this.moodHelper.Mood)
            {
            case Mood.Happy:
                moodText += "счастлив";
                break;

            case Mood.Blue:
                moodText += "грустно";
                break;

            case Mood.Angry:
                moodText += "злой";
                break;

            case Mood.Disaster:
                moodText += "раздавлен";
                break;

            default:
                moodText += "нормально";
                break;
            }

            this.spriteBatch.DrawString(this.debugFont, moodText, ScreenConstants.GetTextPosition(0, 5), Color.White);

            this.spriteBatch.DrawString(this.debugFont, this.PercentToText(this.gunHelper.GetChargePercent()), ScreenConstants.GetTextPosition(0, 6), Color.White);

            this.spriteBatch.DrawString(this.debugFont, this.communicationHelper.LastErrorMessage, ScreenConstants.GetTextPosition(0, 7), Color.Orange);

            this.spriteBatch.End();
        }
Пример #2
0
        /// <summary>
        /// Draws when the program is in menu mode.
        /// </summary>
        /// <param name="gameTime">
        /// Current game time.
        /// </param>
        private void DrawInMenuState(GameTime gameTime)
        {
            this.spriteBatch.Begin();

            if (this.IsActive && (this.videoTexture != null))
            {
                Rectangle rectangle = new Rectangle(
                    0,
                    0,
                    this.graphics.PreferredBackBufferWidth,
                    this.graphics.PreferredBackBufferHeight);
                this.spriteBatch.Draw(this.videoTexture, rectangle, Color.White);
            }

            Color color = Color.White;

            this.spriteBatch.DrawString(this.debugFont, "Для управления клавиатурой нажмите Пробел", ScreenConstants.GetTextPosition(0, 0), color);
            this.spriteBatch.DrawString(this.debugFont, "Для управления геймпэдом XBOX 360 нажмите Start", ScreenConstants.GetTextPosition(0, 1), color);

            color = Color.Yellow;
            if (this.controlSettingsHelper != null)
            {
                this.spriteBatch.DrawString(this.debugFont, "v" + this.controlSettingsHelper.GetProductVersion(), ScreenConstants.GetTextPosition(0, 4), color);
            }

            this.spriteBatch.End();
        }