Exemplo n.º 1
0
 private void TransSingleKey(PvrControllerKey key, int beginIndex, int[] data)
 {
     key.State       = Convert.ToBoolean(data[beginIndex]);
     key.PressedDown = Convert.ToBoolean(data[beginIndex + 1]);
     key.PressedUp   = Convert.ToBoolean(data[beginIndex + 2]);
     key.LongPressed = Convert.ToBoolean(data[beginIndex + 3]);
     key.Click       = Convert.ToBoolean(data[beginIndex + 4]);
 }
Exemplo n.º 2
0
 private void TransformData(PvrControllerKey key, int keystate)
 {
     if (keystate == 1)
     {
         key.PressedUp = false;
         if (!key.State)
         {
             key.PressedDown = true;
             longPressclock  = false;
         }
         else
         {
             key.PressedDown = false;
         }
         key.State = true;
     }
     else
     {
         key.PressedUp   = key.State;
         key.State       = false;
         key.PressedDown = false;
     }
     if (key.State)
     {
         key.TimeCount += Time.deltaTime;
         if (key.TimeCount >= longpresstime &&
             !key.LongPressedClock)
         {
             key.LongPressed      = true;
             key.LongPressedClock = true;
             longPressclock       = true;
         }
         else
         {
             key.LongPressed = false;
         }
     }
     else
     {
         key.LongPressedClock = false;
         key.TimeCount        = 0;
         key.LongPressed      = false;
     }
 }
Exemplo n.º 3
0
 private void SetTriggerClick(PvrControllerKey trigger, int value)
 {
     if (value >= 170)
     {
         trigger.PressedUp = false;
         if (!trigger.State)
         {
             trigger.PressedDown      = true;
             trigger.LongPressedClock = false;
         }
         else
         {
             trigger.PressedDown = false;
         }
         trigger.State = true;
     }
     else
     {
         trigger.PressedUp   = trigger.State;
         trigger.State       = false;
         trigger.PressedDown = false;
     }
     if (trigger.State)
     {
         trigger.TimeCount += Time.deltaTime;
         if (trigger.TimeCount >= longpresstime &&
             !trigger.LongPressedClock)
         {
             trigger.LongPressed      = true;
             trigger.LongPressedClock = true;
         }
         else
         {
             trigger.LongPressed = false;
         }
     }
     else
     {
         trigger.LongPressedClock = false;
         trigger.TimeCount        = 0;
         trigger.LongPressed      = false;
     }
 }
Exemplo n.º 4
0
 private void TransSingleTouchValue(PvrControllerKey key, int beginIndex, int[] data)
 {
     key.Touch     = Convert.ToBoolean(data[beginIndex]);
     key.TouchDown = Convert.ToBoolean(data[beginIndex + 1]);
     key.TouchUp   = Convert.ToBoolean(data[beginIndex + 2]);
 }