Пример #1
0
        private static byte GetButtonsPressed(DualActionMessage message)
        {
            if (message == null) throw new ArgumentNullException("message");
            byte buttonsPressed = 0;

            if (message.UpPressed) { buttonsPressed++; }
            if (message.DownPressed) { buttonsPressed++; }
            if (message.LeftPressed) { buttonsPressed++; }
            if (message.RightPressed) { buttonsPressed++; }
            if (message.Button1Pressed) { buttonsPressed++; }
            if (message.Button2Pressed) { buttonsPressed++; }
            if (message.Button3Pressed) { buttonsPressed++; }
            if (message.Button4Pressed) { buttonsPressed++; }
            if (message.Button5Pressed) { buttonsPressed++; }
            if (message.Button6Pressed) { buttonsPressed++; }
            if (message.Button7Pressed) { buttonsPressed++; }
            if (message.Button8Pressed) { buttonsPressed++; }
            if (message.Button9Pressed) { buttonsPressed++; }
            if (message.Button10Pressed) { buttonsPressed++; }

            return buttonsPressed;
        }
Пример #2
0
        private static byte GetButtonsPressed(DualActionMessage message)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            byte buttonsPressed = 0;

            if (message.UpPressed)
            {
                buttonsPressed++;
            }
            if (message.DownPressed)
            {
                buttonsPressed++;
            }
            if (message.LeftPressed)
            {
                buttonsPressed++;
            }
            if (message.RightPressed)
            {
                buttonsPressed++;
            }
            if (message.Button1Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button2Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button3Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button4Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button5Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button6Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button7Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button8Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button9Pressed)
            {
                buttonsPressed++;
            }
            if (message.Button10Pressed)
            {
                buttonsPressed++;
            }

            return(buttonsPressed);
        }