Exemplo n.º 1
0
        // queries
        public static Rectangle SourceRectangle(XboxButtons button)
        {
            int column = (int)button % 4;
            int row    = (int)button / 4;

            return(new Rectangle(column * ButtonSize, row * ButtonSize, ButtonSize, ButtonSize));
        }
Exemplo n.º 2
0
 void CheckForTutorialStart()
 {
     if (tutorial[tutIndex].initiation())
     {
         isDisplaying = true;
         //show
         displayString = tutorial[tutIndex].textToDisplay;
         displayButton = tutorial[tutIndex].button;
     }
 }
 public ButtonState GetButtonState(XboxButtons btn)
 {
     if (GameLoopEntry.CurrentSequence == UpdateSequence.FixedUpdate)
     {
         return(_currentFixed.GetButtonState(btn));
     }
     else
     {
         return(_current.GetButtonState(btn));
     }
 }
Exemplo n.º 4
0
 public void GiveCommand(int _index, Rectangle _dest, XboxButtons _button, Align _anchor, bool flip = false)
 {
     if (flip)
     {
         _anchor  = UserInterface.Flip(_anchor);
         _dest.X *= -1;
     }
     _commands.Add(new ButtonCommand()
     {
         Index = _index, dest = _dest, Button = _button, anchor = _anchor
     });
 }
Exemplo n.º 5
0
 void CheckForTutorialEnd()
 {
     if (tutorial[tutIndex].termination())
     {
         isDisplaying = false;
         tutIndex++;
         nextTutTime = Time.CurrentTime + timeBetweenTut;
         //hide (not needed)
         displayString = "";
         displayButton = XboxButtons.Null;
     }
 }
Exemplo n.º 6
0
        public override void Start()
        {
            SetupTutorial();

            player = ElementManager.Instance.Player(_index);

            tutIndex     = 0;
            nextTutTime  = Time.CurrentTime + timeBetweenTut + 4f; // initial countdown
            isDisplaying = false;

            displayString = "";
            displayButton = XboxButtons.Null;
        }
        public ButtonState GetButtonState(XboxButtons btn)
        {
            switch (btn)
            {
            case XboxButtons.DPadUp:
                return(DPadUp);

            case XboxButtons.DPadRight:
                return(DPadRight);

            case XboxButtons.DPadDown:
                return(DPadDown);

            case XboxButtons.DPadLeft:
                return(DPadLeft);

            case XboxButtons.A:
                return(A);

            case XboxButtons.B:
                return(B);

            case XboxButtons.X:
                return(X);

            case XboxButtons.Y:
                return(Y);

            case XboxButtons.LB:
                return(LB);

            case XboxButtons.RB:
                return(RB);

            case XboxButtons.Start:
                return(Start);

            case XboxButtons.Back:
                return(Back);

            case XboxButtons.LeftStick:
                return(LeftStickClick);

            case XboxButtons.RightStick:
                return(RightStickClick);
            }

            return(ButtonState.None);
        }
Exemplo n.º 8
0
        public void Start()
        {
            var client = new ViGEmClient();

            X360Controller = new Xbox360Controller(client);

            server = new Server
            {
                Services =
                {
                    XboxButtons.BindService(new XboxImpl(X360Controller)),
                    StandardInput.BindService(new StandardInputImpl()) // this))
                },
                Ports = { new ServerPort(Host, Port, ServerCredentials.Insecure) }
            };

            server.Start();
            ServerStarted = true;
        }
Exemplo n.º 9
0
        public static bool DispatchXboxEvent(XboxButtons id, double value)
        {
            int mode = (int)Earth3d.MainWindow.CurrentImageSet.DataSetType;

            if (Earth3d.MainWindow.CurrentImageSet.DataSetType == ImageSetType.Sky && Properties.Settings.Default.LocalHorizonMode)
            {
                mode = 5;
            }


            if (!Properties.Settings.Default.XboxModeMapping)
            {
                mode = 6;
            }

            ControlMap map = xboxMaps[mode].ControlMaps[(int)id];

            map.BindingA.DispatchMessage(MIDI.MidiMessage.NoteOn, -1, 0, value * 127);


            return(!map.AutoRepeat);
        }
Exemplo n.º 10
0
 private void DoButtonUp(InputButton Button, XboxButtons XboxButton)
 {
     buttonStates[(int)XboxButton] = false;
     OnButtonUp(Button);
 }
 public string JoystickButton(int joystick, XboxButtons button)
 {
     string buttonString = xboxStrings[button].ToString();
     return "joystick" + joystick.ToString() + "button" + buttonString;
 }
 public bool GetButtonUp(int joystick, XboxButtons button)
 {
     return Input.GetButtonUp(JoystickButton(joystick, button));
 }
Exemplo n.º 13
0
    void SetWasActiveFalse()
    {
        QTEWasActive = false;
        _player1Button = XboxButtons.None;
        _player2Button = XboxButtons.None;

        _firstPlayerPressed = 0f;
        doneSync = false;

        print("Reset buttons and attack");
    }
Exemplo n.º 14
0
 public bool getButton(XboxButtons button)
 {
     return base.GetRawButton((int)button);
 }
Exemplo n.º 15
0
    public void CheckPlayerButtons(XboxButtons correctButton, XboxButtons player1Button, XboxButtons player2Button)
    {
        if (player1Button == correctButton && player2Button == correctButton)
        {
            // damage golem.
            print("SYNC SUCCESSFUL, DAMAGED GOLEM (nope)");
            boss.TakeDamage(DamageToBossSyncSuccess, false);
        }
        else if (player1Button == correctButton && player2Button != correctButton)
        {
            // player2 f***s over player 1
            QuickTimeEventFailed(this.trigger1.GetComponent<QTETrigger>().playerOne);
            print("player2 f***s over player 1");
        }
        else if (player2Button == correctButton && player1Button != correctButton)
        {
            // player1 f***s over player 2
            QuickTimeEventFailed(this.trigger1.GetComponent<QTETrigger>().playerTwo);
            print("player1 f***s over player 2");
        }
        else
        {
            // they failed, damage both players.
            QuickTimeEventFailed(this.trigger1.GetComponent<QTETrigger>().playerOne);
            QuickTimeEventFailed(this.trigger1.GetComponent<QTETrigger>().playerTwo);
        }

        doneSync = true;
    }
Exemplo n.º 16
0
        public static bool DispatchXboxEvent(XboxButtons id, double value)
        {
            var mode = (int)Earth3d.MainWindow.CurrentImageSet.DataSetType;

            if (Earth3d.MainWindow.CurrentImageSet.DataSetType == ImageSetType.Sky && Properties.Settings.Default.LocalHorizonMode)
            {
                mode = 5;
            }

            if (!Properties.Settings.Default.XboxModeMapping)
            {
                mode = 6;
            }

            var map = xboxMaps[mode].ControlMaps[(int)id];

            map.BindingA.DispatchMessage(MidiMessage.NoteOn, -1, 0, value * 127);

            return !map.AutoRepeat;
        }
Exemplo n.º 17
0
 private void DoButtonDown(InputButton Button, XboxButtons XboxButton)
 {
     buttonStates[(int)XboxButton] = true;
     OnButtonDown(Button);
 }
Exemplo n.º 18
0
 public Tut(XboxButtons b, string s, Predicate i, Predicate t)
 {
     button = b; textToDisplay = s; initiation = i; termination = t;
 }
Exemplo n.º 19
0
 public bool GetButtonUp(int joystick, XboxButtons button)
 {
     return(Input.GetButtonUp(JoystickButton(joystick, button)));
 }
Exemplo n.º 20
0
    public string JoystickButton(int joystick, XboxButtons button)
    {
        string buttonString = xboxStrings[button].ToString();

        return("joystick" + joystick.ToString() + "button" + buttonString);
    }
Exemplo n.º 21
0
    private void ReadPlayerInput()
    {
        //print("Reading player input");
        if (this._player1Button == XboxButtons.None)
        {
            if (Input.GetButtonDown("P1_A"))
            {
                print("P1 A PRESSED");
                this._player1Button = XboxButtons.A;

                // other player hasn't pressed yet
                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
            else if (Input.GetButtonDown("P1_B"))
            {
                print("P1 B PRESSED");
                this._player1Button = XboxButtons.B;

                // other player hasn't pressed yet
                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
            else if (Input.GetButtonDown("P1_X"))
            {
                print("P1 X PRESSED");
                this._player1Button = XboxButtons.X;

                // other player hasn't pressed yet
                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
            else if (Input.GetButtonDown("P1_Y"))
            {
                print("P1 Y PRESSED");
                this._player1Button = XboxButtons.Y;

                // other player hasn't pressed yet
                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
        }
        if (this._player2Button == XboxButtons.None)
        {
            if (Input.GetButtonDown("P2_A"))
            {
                this._player2Button = XboxButtons.A;
                print("P2 A PRESSED");

                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
            else if (Input.GetButtonDown("P2_B"))
            {
                this._player2Button = XboxButtons.B;
                print("P2 B PRESSED");

                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
            else if (Input.GetButtonDown("P2_X"))
            {
                this._player2Button = XboxButtons.X;
                print("P2 X PRESSED");

                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
            else if (Input.GetButtonDown("P2_Y"))
            {
                this._player2Button = XboxButtons.Y;
                print("P2 Y PRESSED");

                if (this._firstPlayerPressed == 0)
                    this._firstPlayerPressed = Time.timeSinceLevelLoad;
            }
        }
    }