示例#1
0
        private void SetupButton(VirtualController.Button button, Panel panel)
        {
            string name = button.ToString();
            SlotShape shape = SlotShape.Rounded;

            if (panel.Tag is string) try {
                shape = (SlotShape)Enum.Parse(typeof(SlotShape), panel.Tag as string);
            } catch (FormatException) { }
            RegisterOverlay(button, panel.Bounds, panel.BackColor, shape);
            panel.Tag = button;
            panel.Hide();
        }
示例#2
0
        void AddStickDirections(TreeNode root, Controller cc, VirtualController.Axis stick)
        {
            string prefix = stick.ToString();
            prefix = prefix.Substring (0, prefix.Length - 1);
            var y = Util.ParseEnum<VirtualController.Axis>(prefix + "Y");
            var x = stick;

            AddDirectionNode(root, cc, x, false, "Left");
            AddDirectionNode(root, cc, x, true, "Right");
            AddDirectionNode(root, cc, y, false, "Up");
            AddDirectionNode(root, cc, y, true, "Down");
        }
示例#3
0
        private void SetupButton(VirtualController.Button button)
        {
            string name = button.ToString();

            if (button == VirtualController.Button.Bl) name = "Left Bumper";
            else if (button == VirtualController.Button.Br) name = "Right Bumper";
            else if (button == VirtualController.Button.Tl) name = "Left Trigger";
            else if (button == VirtualController.Button.Tr) name = "Right Trigger";

            TreeNode n;
            if (button == VirtualController.Button.LeftAnalog) {
                TreeNode root;
                if (axisPortNodes.ContainsKey(VirtualController.Axis.LeftX)) {
                    root = axisPortNodes[VirtualController.Axis.LeftX];
                } else {
                    root = axisPortNodes[VirtualController.Axis.LeftX] =
                        buttonMapNodes["left-analog"] = currentMappings.Nodes.Add("Left Analog");
                }

                buttonMapNodes["left-analog/button"] = n = root.Nodes.Add("Push");
            } else if (button == VirtualController.Button.RightAnalog) {
                TreeNode root;
                if (axisPortNodes.ContainsKey(VirtualController.Axis.RightX)) {
                    root = axisPortNodes[VirtualController.Axis.RightX];
                } else {
                    root = axisPortNodes[VirtualController.Axis.RightX] =
                        buttonMapNodes["right-analog"] = currentMappings.Nodes.Add("Right Analog");
                }

                buttonMapNodes["right-analog/button"] = n = root.Nodes.Add("Push");
            } else {
                n = currentMappings.Nodes.Add(name);
            }

            buttonMapNodes[button.ToString()] = n;
            buttonMapNodes[button.ToString() + "/link"] = n.Nodes.Add("Link");
            buttonMapNodes[button.ToString() + "/tap"] = n.Nodes.Add("Tap");
            buttonMapNodes[button.ToString() + "/dtap"] = n.Nodes.Add("Double Tap");
            buttonMapNodes[button.ToString() + "/hold"] = n.Nodes.Add("Hold");
        }