GetInput() public method

public GetInput ( ) : List
return List
コード例 #1
0
        public void Update(ControlHandler ch)
        {
            if (framesPassed >= 3)
            {
                framesPassed = 0;
                if (ch.GetInput().Contains("Up"))
                {
                    switch (selectedNumber)
                    {
                        case 0:
                            {
                                boolSound = true;
                                boolResolution = false;
                                boolAlias = false;
                                boolText = false;
                                oText.UpdateSelect(0);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                        case 1:
                            {
                                selectedNumber--;
                                boolSound = false;
                                boolResolution = true;
                                boolAlias = false;
                                boolText = false;
                                oText.UpdateSelect(1);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                        case 2:
                            {
                                selectedNumber--;
                                boolSound = false;
                                boolResolution = false;
                                boolAlias = true;
                                boolText = false;
                                oText.UpdateSelect(2);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                        case 3:
                            {
                                selectedNumber--;
                                boolSound = false;
                                boolResolution = false;
                                boolAlias = false;
                                boolText = true;
                                oText.UpdateSelect(3);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                    }
                }

                else if (ch.GetInput().Contains("Down"))
                {
                    switch (selectedNumber)
                    {
                        case 0:
                            {
                                selectedNumber++;
                                boolSound = true;
                                boolResolution = false;
                                boolAlias = false;
                                boolText = false;
                                oText.UpdateSelect(0);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                        case 1:
                            {
                                selectedNumber++;
                                boolSound = false;
                                boolResolution = true;
                                boolAlias = false;
                                boolText = false;
                                oText.UpdateSelect(1);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                        case 2:
                            {
                                selectedNumber++;
                                boolSound = false;
                                boolResolution = false;
                                boolAlias = true;
                                boolText = false;
                                oText.UpdateSelect(2);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }
                        case 3:
                            {
                                boolSound = false;
                                boolResolution = false;
                                boolAlias = false;
                                boolText = true;
                                oText.UpdateSelect(3);
                                Thread.Sleep(sleepTimeUpDown);
                                break;
                            }

                    }
                }
                else if (ch.GetInput().Contains("Left"))
                {
                    if (boolSound)
                    {
                        tSound.SelectLeft();
                        Thread.Sleep(sleepTimeLeftRight);
                    }
                    if (boolResolution)
                    {
                        tResolution.SelectLeft();
                        Thread.Sleep(sleepTimeResolution);
                    }
                    if (boolAlias)
                    {
                        cbAlias.SelectLeftRight();
                        Thread.Sleep(sleepTimeCheckBox);
                    }
                }

                else if (ch.GetInput().Contains("Right"))
                {
                    if (boolSound)
                    {
                        tSound.SelectRight();
                        Thread.Sleep(sleepTimeLeftRight);
                    }

                    if (boolResolution)
                    {
                        tResolution.SelectRight();
                        Thread.Sleep(sleepTimeResolution);
                    }

                    if (boolAlias)
                    {
                        cbAlias.SelectLeftRight();
                        Thread.Sleep(sleepTimeCheckBox);
                    }
                }
                else if (ch.GetInput().Contains("Select"))
                {
                    if (boolText)
                    {
                        currentGameState = 2;
                    }
                }
                else if (ch.GetInput().Contains("Back"))
                {
                    currentGameState = 2;
                }

            }
            framesPassed++;

            if (tResolution.GetResolutionChanged())
            {
                tResolution.Init();
                tSound.Init();
                cbAlias.Init();
                oText.Init();
            }
            MouseState mouse = Mouse.GetState();
            cbAlias.Update(mouse);
            tResolution.Update(mouse);
            tSound.Update(mouse);
            if (oText.Update(mouse))
            {
                currentGameState = 2;
            }
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: Timvangool/AsteroidsAPO2
        public void Update(GameTime gameTime, ControlHandler contHand)
        {
            //Player movement
            if (contHand.GetInput().Contains("Up"))
            {
                Move();
                playerTextureIdle = playerTextureMoving;
            }
            if (!contHand.GetInput().Contains("Up"))
            {
                SlowDown();
                playerTextureIdle = defaultTexture;
            }
            if (contHand.GetInput().Contains("Right"))
            {
                rotationAngle = rotationAngle + 0.1f;
                bulletDirection = new Vector2((float)Math.Cos(rotationAngle), (float)Math.Sin(rotationAngle));
            }
            if (contHand.GetInput().Contains("Left"))
            {
                rotationAngle = rotationAngle - 0.1f;
                bulletDirection = new Vector2((float)Math.Cos(rotationAngle), (float)Math.Sin(rotationAngle));
            }

            if (delay > 0)
            {
                delay--;
            }

            if (delay <= 0)
            {
                if (contHand.GetInput().Contains("Shoot"))
                {
                    weapList.Add(Shoot(1));
                }
            }

            hitBox = new Rectangle((int)(playerPos.X - (playerTextureIdle.Width / 2)), (int)(playerPos.Y - (playerTextureIdle.Height / 2)), playerTextureIdle.Width, playerTextureIdle.Height);
            contHand.SetWiimoteLeds(0, lives);
        }
コード例 #3
0
        public void SelectName(MouseState mouse, Point mousePoint, GameTime gameTime, ControlHandler contHand, Highscores scores)
        {
            if (selectedRect >= 8)
            {
                selectedRect = 8;
            }
            if (selectedRect <= 0)
            {
                selectedRect = 0;
            }

            if (frames > 60)
            {
                if (contHand.GetInput().Contains("Right"))
                {
                    selectedRect++;
                }
                if (contHand.GetInput().Contains("Left"))
                {
                    selectedRect--;
                }

                if (contHand.GetInput().Contains("Select"))
                {
                    System.Threading.Thread.Sleep(100);
                    switch (selectedRect)
                    {
                        case 0:
                            if (letter[0] < 25)
                                letter[0]++;
                            else if (letter[0] == 25)
                                letter[0] = 0;
                            break;
                        case 1:
                            if (letter[0] > 0)
                                letter[0]--;
                            else if (letter[0] == 0)
                                letter[0] = 25;
                            break;
                        case 2:
                            if (letter[1] < 25)
                                letter[1]++;
                            else if (letter[1] == 25)
                                letter[1] = 0;
                            break;
                        case 3:
                            if (letter[1] > 0)
                                letter[1]--;
                            else if (letter[1] == 0)
                                letter[1] = 25;
                            break;
                        case 4:
                            if (letter[2] < 25)
                                letter[2]++;
                            else if (letter[1] == 25)
                                letter[2] = 0;
                            break;
                        case 5:
                            if (letter[2] > 0)
                                letter[2]--;
                            else if (letter[2] == 0)
                                letter[2] = 25;
                            break;
                        case 6:
                            scores.AddHighscore(Convert.ToInt32(textScore), Name);
                            scores.SaveHighScores();
                            scores.LoadHighScores();
                            scores.SortHighScores();
                            Saved = true;
                            break;
                        case 7:
                            gameStateNumber = 3;
                            break;
                        case 8:
                            gameStateNumber = 2;
                            break;
                        default:
                            break;
                    }
                }
                frames = 0;
            }
            frames++;

            //if (mouse.LeftButton == ButtonState.Pressed && mouseReleased == true && Saved != true)
            //{
            //    framesPassed++;
            //    if (framesPassed % 7 == 0)
            //    {
            //        for (int i = 0; i < 3; i++)
            //        {
            //            if (recArrowDown[i].Contains(mousePoint))
            //            {
            //                if (letter[i] < 25)
            //                    letter[i]++;
            //                else if (letter[i] == 25)
            //                    letter[i] = 0;
            //            }
            //            else if (recArrowUp[i].Contains(mousePoint))
            //            {
            //                if (letter[i] > 0)
            //                    letter[i]--;
            //                else if (letter[i] == 0)
            //                    letter[i] = 25;
            //            }
            //        }
            //    }
            //    if (recSubmit.Contains(mousePoint))
            //    {
            //        if (Name == "AAA")
            //        {
            //            textSucces = "Very creative...Saved Succesful!";
            //        }
            //        Saved = true;
            //    }
            //}
            //if (mouse.LeftButton == ButtonState.Released)
            //{
            //    mouseReleased = true;
            //}
            OrderName();
            framesPassed++;
        }