示例#1
0
 private void OnEnable()
 {
     BI = this;
     buttonIndicator = transform.Find("ButtonIndicator").gameObject;
     startText       = buttonIndicator.transform.Find("StartText").GetComponent <Text>();
     buttonText      = buttonIndicator.transform.Find("Button").transform.Find("ButtonText").GetComponent <Text>();
     endText         = buttonIndicator.transform.Find("EndText").GetComponent <Text>();
     extra           = buttonIndicator.transform.Find("Extra").gameObject;
     extraButtonText = extra.transform.Find("ExtraButton").transform.Find("Text").GetComponent <Text>();
     extraText       = extra.transform.Find("ExtraText").GetComponent <Text>();
 }
示例#2
0
        private void UpdateControllerDisplay()
        {
            AxisPanel.Children.Clear();
            ButtonPanel.Children.Clear();
            _buttons.Clear();

            DirectXControllerInterface controller = Interface as DirectXControllerInterface;

            if (controller != null)
            {
                foreach (DirectXControllerFunction function in controller.Functions)
                {
                    DirectXControllerButton button = function as DirectXControllerButton;
                    if (button != null)
                    {
                        ButtonIndicator indicator = new ButtonIndicator();
                        indicator.Width  = 30;
                        indicator.Height = 30;
                        indicator.Label  = (button.ObjectNumber + 1).ToString();
                        indicator.Margin = new Thickness(2);
                        _buttons.Add(button, indicator);
                        ButtonPanel.Children.Add(indicator);
                    }

                    DirectXControllerAxis axis = function as DirectXControllerAxis;
                    if (axis != null)
                    {
                        AxisBar bar = new AxisBar();
                        bar.BarWidth        = 30;
                        bar.Height          = 110;
                        bar.Label           = axis.Name;
                        bar.BorderThickness = new Thickness(1d);
                        bar.BorderBrush     = Brushes.DarkGray;
                        bar.Margin          = new Thickness(10, 2, 0, 2);
                        _axis.Add(axis, bar);
                        AxisPanel.Children.Add(bar);
                    }

                    DirectXControllerPOVHat hat = function as DirectXControllerPOVHat;
                    if (hat != null)
                    {
                        PointOfViewIndicator pov = new PointOfViewIndicator();
                        pov.Width     = 60;
                        pov.Height    = 60;
                        pov.Direction = POVDirection.Center;

                        TextBlock label = new TextBlock();
                        label.Width = 60;
                        label.Text  = hat.Name;

                        StackPanel panel = new StackPanel();
                        panel.Margin = new Thickness(10, 2, 0, 2);
                        panel.Children.Add(pov);
                        panel.Children.Add(label);

                        _povs.Add(hat, pov);
                        POVPanel.Children.Add(panel);
                    }
                }

                if (_axis.Count > 0)
                {
                    AxisGroup.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    AxisGroup.Visibility = System.Windows.Visibility.Collapsed;
                }

                if (_buttons.Count > 0)
                {
                    ButtonGroup.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    ButtonGroup.Visibility = System.Windows.Visibility.Collapsed;
                }

                if (_povs.Count > 0)
                {
                    POVGroup.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    POVGroup.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }
示例#3
0
 public void ChangeButtonState(int number, ButtonIndicator state)
 {
     buttons[number].TextureIndicator = state;
 }