Ejemplo n.º 1
0
 public static void OnCurrentSwipeDirectionChangedInvoke(InputEventArg arg, object sender = null)
 {
     if (OnCurrentSwipeDirectionChanged != null)
     {
         OnCurrentSwipeDirectionChanged.Invoke(sender, arg);
     }
 }
Ejemplo n.º 2
0
        private void OnKeyPressed(object sender, InputEventArg e)
        {
//             lbHandle.Text = e.KeyPressEvent.DeviceHandle.ToString();
//             lbType.Text = e.KeyPressEvent.DeviceType;
//             lbName.Text = e.KeyPressEvent.DeviceName;
//             lbDescription.Text = e.KeyPressEvent.Name;
//             lbKey.Text = e.KeyPressEvent.VKey.ToString(CultureInfo.InvariantCulture);
//             lbNumKeyboards.Text = _rawinput.NumberOfKeyboards.ToString(CultureInfo.InvariantCulture);
//             lbVKey.Text = e.KeyPressEvent.VKeyName;
//             lbSource.Text = e.KeyPressEvent.Source;
//             lbKeyPressState.Text = e.KeyPressEvent.KeyPressState;
//             lbMessage.Text = string.Format("0x{0:X4} ({0})", e.KeyPressEvent.Message);

            switch (e.KeyPressEvent.Message)
            {
            case Win32.WM_KEYDOWN:
                /*Debug.WriteLine(e.KeyPressEvent.KeyPressState);*/
                break;

            case Win32.WM_KEYUP:
                textBox.Text += e.KeyPressEvent.VKeyName.ToString() + "\n";
                textBox.ScrollToEnd();
                break;
            }
        }
Ejemplo n.º 3
0
 public static void OnSwipeInvoke(object sender, InputEventArg arg)
 {
     if (OnSwipe != null)
     {
         OnSwipe.Invoke(null, arg);
     }
 }
Ejemplo n.º 4
0
        private void OnKeyPress(object sender, InputEventArg e)
        {
            p             = e.KeyPressEvent.DeviceName.ToString(); // получаем имя устройства ввода
            textBox5.Text = p;                                     // выводим имя устройства (делается только при первой установке программы). Потом удаляем
            if (p == "")
            {
                InOut = "Выезд";                     // тут добавить имена устройств въезда и выезда
            }
            string perev = e.KeyPressEvent.VKeyName; // получаем ключевые имена кнопок для перекодировки в двоичную систему

            switch (perev)
            {
            case "D0":
                break;

            case "D1":
                textBox1.Text += "1";
                break;

            case "D2":
                textBox1.Text += "2";
                break;

            case "D3":
                textBox1.Text += "3";
                break;

            case "D4":
                textBox1.Text += "4";
                break;

            case "D5":
                textBox1.Text += "5";
                break;

            case "D6":
                textBox1.Text += "6";
                break;

            case "D7":
                textBox1.Text += "7";
                break;

            case "D8":
                textBox1.Text += "8";
                break;

            case "D9":
                textBox1.Text += "9";
                break;
            }
        }
Ejemplo n.º 5
0
        private void OnKeyPressed(object sender, InputEventArg e)
        {
            switch (e.KeyPressEvent.Message)
            {
            case Win32.WM_KEYDOWN:
                /*Debug.WriteLine(e.KeyPressEvent.KeyPressState);*/
                break;

            case Win32.WM_KEYUP:
                textBox.Text += e.KeyPressEvent.VKeyName.ToString() + "\n";
                textBox.ScrollToEnd();
                break;
            }
        }
Ejemplo n.º 6
0
 private void OnSwipe(object sender, InputEventArg e)
 {
     if (GameModel.State == GameState.Idle)
     {
         CurrentSwipeDirection = e.CurrDirection;
         EventSystem.OnCurrentSwipeDirectionChangedInvoke(new InputEventArg {
             CurrDirection = CurrentSwipeDirection
         });
     }
     else if (GameModel.State == GameState.Moving)
     {
         UpcomingSwipeDirection = e.CurrDirection;
     }
 }
 private void HandleChargingATK(InputEventArg <PlayerInputCommand> eventArg)
 {
     if (eventArg._command == PlayerInputCommand.RangeChargeAttack)
     {
         _particles["Range_Charge_Ground_Charging"].Stop();
         _particles["Range_Charge_Ground_ATK"].Play();
     }
     if (eventArg._command == PlayerInputCommand.RangeChargeBegin)
     {
         _particles["Range_Charge_Ground_Charging"].Play();
     }
     if (eventArg._command == PlayerInputCommand.RangeChargeBreak)
     {
         _particles["Range_Charge_Ground_Charging"].Stop();
         _particles["Range_Charge_Ground_ATK"].Stop();
     }
 }
 private void HandleReceivedInput(InputEventArg <EnemyInput> eventArgs)
 {
     if (eventArgs._command == EnemyInput.Attack)
     {
         enemyAudioSource1.clip   = _audios["Attack"];
         enemyAudioSource1.volume = _volume["Attack"];
         enemyAudioSource1.pitch  = _pitch["Attack"];
         enemyAudioSource1.Play();
     }
     if (eventArgs._command == EnemyInput.Alert)
     {
         enemyAudioSource1.clip   = _audios["Alert"];
         enemyAudioSource1.volume = _volume["Alert"];
         enemyAudioSource1.pitch  = _pitch["Alert"];
         enemyAudioSource1.Play();
     }
 }
Ejemplo n.º 9
0
 private static void OnRawInput(object sender, InputEventArg e)
 {
     if (e.RawInputEvent.DeviceType.Equals("MOUSE"))
     {
         if (e.RawInputEvent.mouseMessage == 1uL || e.RawInputEvent.mouseMessage == 2uL || e.RawInputEvent.mouseMessage == 16uL || e.RawInputEvent.mouseMessage == 32uL || e.RawInputEvent.mouseMessage == 4uL || e.RawInputEvent.mouseMessage == 8uL || e.RawInputEvent.mouseMessage == 1uL || e.RawInputEvent.mouseMessage == 2uL || e.RawInputEvent.mouseMessage == 4uL || e.RawInputEvent.mouseMessage == 8uL || e.RawInputEvent.mouseMessage == 16uL || e.RawInputEvent.mouseMessage == 32uL || e.RawInputEvent.mouseMessage == 64uL || e.RawInputEvent.mouseMessage == 128uL || e.RawInputEvent.mouseMessage == 256uL || e.RawInputEvent.mouseMessage == 512uL || e.RawInputEvent.mouseMessage == 1024uL)
         {
             Program.m_IdleCounter = 0;
             return;
         }
     }
     else
     {
         if (e.RawInputEvent.DeviceType.Equals("KEYBOARD"))
         {
             Program.m_IdleCounter = 0;
         }
     }
 }
 private void OnKeyPressed(object sender, InputEventArg e)
 {
     if (e.KeyPressEvent.Name == "HID Keyboard Device")
     {
         if (e.KeyPressEvent.Message == Win32.WM_KEYDOWN)
         {
             if (BarCodeStarted == false)
             {
                 BarCodeStarted = true;
                 BarCodeReadStartedEvent();
             }
             if (e.KeyPressEvent.VKeyName == "ENTER")
             {
                 BarCodeStarted = false;
                 BarcodeReadEvent(_barcode);
                 _barcode = string.Empty;
             }
             else
             {
                 _barcode = _barcode + (char)e.KeyPressEvent.VKey;
             }
         }
     }
 }
Ejemplo n.º 11
0
    private void OnSwipe(object sender, InputEventArg e)
    {
        GameModel.SavePreviousState();

        switch (e.CurrDirection)
        {
        case Direction.Up:
            for (int i = 0; i < Config.FieldHeight; i++)
            {
                GameModel.SetColumn(Compressor(GameModel.GetColumn(i), e.CurrDirection), i);
            }
            break;

        case Direction.Down:
            for (int i = 0; i < Config.FieldHeight; i++)
            {
                GameModel.SetColumn(Compressor(GameModel.GetColumn(i), e.CurrDirection), i);
            }
            break;

        case Direction.Left:
            for (int i = 0; i < Config.FieldWidth; i++)
            {
                GameModel.SetRow(Compressor(GameModel.GetRow(i), e.CurrDirection), i);
            }
            break;

        case Direction.Right:
            for (int i = 0; i < Config.FieldWidth; i++)
            {
                GameModel.SetRow(Compressor(GameModel.GetRow(i), e.CurrDirection), i);
            }
            break;
        }

        if (!GameModel.AreLastAndCurrentMoveEqual())
        {
            AddRandomCell();
            GameModel.State    = GameState.Moving;
            GameModel.isUndone = false;
        }

        if (GameModel.GameScore > GameModel.GameHighScore)
        {
            GameModel.GameHighScore = GameModel.GameScore;
        }
        saveInfo();
        EventSystem.ModelModifiedInvoke();

        if (isWon() && !isAlreadyWon)
        {
            Win();
        }
        if (GameModel.IsGameModelFilledUp())
        {
            if (IsLose())
            {
                EventSystem.OnGameOverInvoke();
            }
        }
    }
Ejemplo n.º 12
0
        private void OnKeyPressed(object sender, InputEventArg e)
        {
            string vkStatus = e.KeyPressEvent.KeyPressState; // Retrieves information from the user input
            int    vkNumber = e.KeyPressEvent.VKey;
            string vkName   = e.KeyPressEvent.VKeyName;

            currentKey = vkStatus;
            if (previousKey == "BREAK")
            {
                previousKey = currentKey;
                return;
            }

            if (currentKey == previousKey) // Determiens if a key is being held down.
            {
                switch (vkNumber)
                {
                case (int)MusicKeys.Previous:     // Determines whether or not the rewind or fast-forward a track.
                    if (!isRewinding)
                    {
                        RewindSong();
                    }
                    break;

                case (int)MusicKeys.Next:
                    if (!isFastForwarding)
                    {
                        FastForwardSong();
                    }
                    break;
                }
                canCheck = false;
            }
            else
            {
                if (!t.Enabled) // Enables the timer to determine whether or not the application should check for a key press.
                {
                    SetTimer(); // Enables the timer. Prevents repeated calls (e.g. calling "Next Track" multiple times, which would skip a few tracks)
                }
                if (canCheck)
                {
                    switch (vkNumber) // Depending on the key pressed, executes an action.
                    {
                    case (int)MusicKeys.Previous:
                        PreviousSong();
                        break;

                    case (int)MusicKeys.Next:
                        NextSong();
                        break;

                    case (int)MusicKeys.Stop:
                        StopSong();
                        break;

                    case (int)MusicKeys.PlayPause:
                        PlayPauseSong();
                        break;
                    }
                    isRewinding      = false;
                    isFastForwarding = false;
                    previousKey      = "BREAK";
                }
            }
        }