コード例 #1
0
 /// <summary>
 /// Bind the debug key and escape key for the Arena.
 /// </summary>
 protected override void BindKeys()
 {
     Controls.Bind(Commands.Debug, Keys.D, ActionType.Released);
     Controls.Bind(Commands.Pause, Keys.P, ActionType.Released);
     Controls.Bind(Commands.Pause, Keys.Escape, ActionType.Released);
 }
コード例 #2
0
        public void DoCheck()
        {
            if (firstFrame)
            {
                return;
            }

            if (Focused == this)
            {
                if (Gamepad)
                {
                    if (GamepadComponent.Controller == null)
                    {
                        Log.Error("Null controller");
                        return;
                    }


                    foreach (var b in buttonsToCheck)
                    {
                        if (GamepadComponent.Controller.WasPressed(b))
                        {
                            Controls.Replace(Key, b);
                            Controls.Bind();
                            Controls.Save();

                            Focused = null;
                            SetLabel();

                            break;
                        }
                    }
                }
                else
                {
                    foreach (var k in keysToCheck)
                    {
                        if (Input.Keyboard.WasPressed(k))
                        {
                            Controls.Replace(Key, k);
                            Controls.Bind();
                            Controls.Save();

                            Focused = null;
                            SetLabel();

                            break;
                        }
                    }

                    if (firstClickFrame)
                    {
                        firstClickFrame = false;
                    }
                    else
                    {
                        foreach (var b in mouseToCheck)
                        {
                            if (Input.Mouse.Check(b, Input.CheckType.PRESSED))
                            {
                                Controls.Replace(Key, b);
                                Controls.Bind();
                                Controls.Save();

                                Focused = null;
                                SetLabel();

                                break;
                            }
                        }
                    }
                }
            }
        }