public RebindResult Rebind(Buttons newButton)
        {
            if (!IsRebindable)
            {
                return(RebindResult.NotAllowed);
            }

            if (GlobalInputProperties.IsButtonAllowed(newButton))
            {
                if (ButtonList.Contains(newButton))
                {
                    ButtonList.Remove(newButton);
                    return(RebindResult.Removed);
                }
                else
                {
                    if (ButtonList.Count >= GlobalInputProperties.MaxGamepadButtons)
                    {
                        // if too many buttons, remove from head
                        ButtonList.RemoveRange(0, ButtonList.Count - GlobalInputProperties.MaxGamepadButtons + 1);
                    }
                    ButtonList.Add(newButton);
                    return(RebindResult.Added);
                }
            }
            else
            {
                return(RebindResult.NotAllowed);
            }
        }
예제 #2
0
 public RebindResult Rebind(Keys newKey)
 {
     if (GlobalInputProperties.IsKeyAllowed(newKey))
     {
         if (newKey == HardcodedKey)
         {
             if (UserKey == null)
             {
                 return(RebindResult.NoOp);
             }
             else
             {
                 UserKey = null;
                 return(RebindResult.Removed);
             }
         }
         else if (newKey == UserKey)
         {
             UserKey = null;
             return(RebindResult.Removed);
         }
         else
         {
             UserKey = newKey;
             return(RebindResult.Added);
         }
     }
     else
     {
         return(RebindResult.NotAllowed);
     }
 }
예제 #3
0
        protected override void Update()
        {
            var v = 0f;

            foreach (var item in SubAxes)
            {
                v += item.Value;
            }
            Value = GlobalInputProperties.CleanAxisInput(v);
        }
예제 #4
0
 protected override void Update()
 {
     if (input2 == null)
     {
         Value = GlobalInputProperties.CleanAxisInput(input.Get(Index));
     }
     else
     {
         Value = GlobalInputProperties.CleanAxisInput(input.Get(Index) + input2.Get(Index));
     }
 }