Asteroids.Classes.ControlHandler.GetInput C# (CSharp) 메소드

GetInput() 공개 메소드

public GetInput ( ) : List
리턴 List
        public List<string> GetInput()
        {
            List<string> allInput = new List<string>();
            List<string> wmInput;
            List<string> kbInput;

            wmInput = wmHandler.GetButtonsPressed();
            foreach (string input in wmInput)
            {
                allInput.Add(input);
            }

            kbInput = kbHandler.GetButtonsPressed();
            foreach (string input in kbInput)
            {
                allInput.Add(input);
            }

            return allInput;
        }

Usage Example

예제 #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;
            }
        }
All Usage Examples Of Asteroids.Classes.ControlHandler::GetInput