コード例 #1
0
        public override void HandleInput(InputState input)
        {
            Keybinding tmpKey = input.GetNewestKeybindingPressed(this.ControllingPlayer);

            if (tmpKey != null && mNewKey == null)
            {
                Content = "Key [" + tmpKey.ToString() + "] Pressed";
                mNewKey = tmpKey;

                this.mSelectedButton = 0;

                Buttons[0].State = UIState.Selected;
                Buttons[1].State = UIState.Active;
            }
            else
                base.HandleInput(input);
        }
コード例 #2
0
ファイル: InputState.cs プロジェクト: CrimsonChris/Half-Caked
 public bool IsNewKeybindingPress(PlayerIndex? controllingPlayer, Keybinding input)
 {
     PlayerIndex playerIndex;
     switch (input.Type)
     {
         case Keybinding.InputType.Button:
             return IsNewButtonPress(input.Button, controllingPlayer, out playerIndex);
         case Keybinding.InputType.Key:
             return IsNewKeyPress(input.Key, controllingPlayer, out playerIndex);
         case Keybinding.InputType.MouseClick:
             return IsNewMouseClick(input.MouseClick);
         default:
             return false;
     }
 }
コード例 #3
0
 private void SetKeybinding(KeybindingKV s, Keybinding input, int whichBinding)
 {
     string displayName = s.Key;
     Keybinding[] key = s.Value;
     if (input == null) {
         //throw new System.ArgumentNullException("Keybindings Menu returned null Keybinding object 'input'");
         return;
     }
     System.Console.Error.WriteLine("Request to set the {0} keybinding [{1}] to {2}", whichBinding, displayName, input.ToString());
     if (whichBinding < 0 || whichBinding > key.Length) {
         //throw new System.IndexOutOfRangeException("Keybindings Menu tried to bind to a Keybinding index that doesn't exist.");
         return;
     }
     key[whichBinding] = input;
 }