Beispiel #1
0
        protected override void Update(GameTime gameTime)
        {
            this.currentKeyboard = Keyboard.GetState();

            if (this.currentKeyboard.IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D1))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D1))
                {
                    tryb = 1;
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D2))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D2))
                {
                    tryb = 2;
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D3))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D3))
                {
                    tryb = 3;
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D4))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D4))
                {
                    tryb = 4;
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D5))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D5))
                {
                    tryb = 5;
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D6))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D6))
                {
                    tryb = 6;
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.D0))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.D0))
                {
                    if (tryb3Choose && tryb == 3)
                    {
                        tryb3Choose = false;
                    }
                    else if (!tryb3Choose && tryb == 3)
                    {
                        tryb3Choose = true;
                    }
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.LeftControl))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.LeftControl))
                {
                    if (timePause)
                    {
                        timePause = false;
                    }
                    else
                    {
                        timePause = true;
                    }
                }
            }

            if (this.currentKeyboard.IsKeyDown(Keys.LeftShift))
            {
                if (!this.previousKeyboard.IsKeyDown(Keys.LeftShift))
                {
                    if (fpsCup)
                    {
                        this.graphics.SynchronizeWithVerticalRetrace = false;
                        this.graphics.ApplyChanges();
                        this.IsFixedTimeStep = false;

                        tryb1.cube.speed         = tryb1.cube.speed2;
                        tryb3.speed              = tryb3.speed2;
                        tryb4.rubik.speed        = tryb4.rubik.speed2;
                        tryb4.rubik.help.rotatuj = tryb4.rubik.help.rotatuj_2;

                        fpsCup = false;
                    }
                    else if (!fpsCup)
                    {
                        this.graphics.SynchronizeWithVerticalRetrace = true;
                        this.graphics.ApplyChanges();
                        this.IsFixedTimeStep = false;

                        tryb1.cube.speed         = tryb1.cube.speed1;
                        tryb3.speed              = tryb3.speed1;
                        tryb4.rubik.speed        = tryb4.rubik.speed1;
                        tryb4.rubik.help.rotatuj = tryb4.rubik.help.rotatuj_1;

                        fpsCup = true;
                    }
                }
            }

            FPS.countFPS(gameTime.TotalGameTime.Seconds, tryb);

            textField.fps       = FPS.fps;
            textField.timeMean  = TIME.meanTime;
            textField.timeStart = TIME.startTime;
            textField.timeStop  = TIME.stopTime;
            textField.timeMin   = TIME.minTime;
            textField.timeMax   = TIME.maxTime;
            textField.tryb      = tryb;
            textField.block     = fpsCup;
            textField.pause     = timePause;

            this.previousKeyboard = Keyboard.GetState();

            if (tryb == 1)
            {
                tryb1.Update(gameTime);
            }
            else if (tryb == 2)
            {
                tryb2.Update(gameTime);
            }
            else if (tryb == 3)
            {
                tryb3.Update(gameTime);
            }
            else if (tryb == 4)
            {
                tryb4.Update(gameTime);
            }
            else if (tryb == 5)
            {
                tryb5.Update(gameTime);
            }

            base.Update(gameTime);
        }