示例#1
0
        public void CreateUI(IUIBuilder builder)
        {
            ComPortChooser = builder.CreatePopup("OutputTarget:Serial:ComPortChooser", "Select COM port", SerialPort.GetPortNames().ToList(), "None", null);

            ButtonGroup = builder.CreateHorizontalGroup(510, 50, new Vector2(10, 0), 2, idx => builder.CreateButtonEx());
            var startSerialButton = ButtonGroup.items[0].GetComponent <UIDynamicButton>();

            startSerialButton.label = "Start Serial";
            startSerialButton.button.onClick.AddListener(StartSerial);

            var stopSerialButton = ButtonGroup.items[1].GetComponent <UIDynamicButton>();

            stopSerialButton.label = "Stop Serial";
            stopSerialButton.button.onClick.AddListener(StopSerial);

            StartSerialAction = UIManager.CreateAction("Start Serial", StartSerial);
            StopSerialAction  = UIManager.CreateAction("Stop Serial", StopSerial);
        }
示例#2
0
 public Transform CreateButtonEx() => _builder.CreateButtonEx();
示例#3
0
        public void CreateUI(IUIBuilder builder)
        {
            DataParserChooser = builder.CreatePopup("Plugin:ValuesSource:DataParser", "Data type", new List <string> {
                "TCode"
            }, "TCode", DataParserChooserCallback);
            DataParserChooserCallback(DataParserChooser.val);

            CreateCustomUI(builder);

            StartStopButtonGroup = builder.CreateHorizontalGroup(510, 50, new Vector2(10, 0), 2, idx => builder.CreateButtonEx());
            var startButton = StartStopButtonGroup.items[0].GetComponent <UIDynamicButton>();

            startButton.buttonText.fontSize = 25;
            startButton.label       = "Start";
            startButton.buttonColor = new Color(0.309f, 1f, 0.039f) * 0.8f;
            startButton.textColor   = Color.white;
            startButton.button.onClick.AddListener(StartCallback);

            var stopButton = StartStopButtonGroup.items[1].GetComponent <UIDynamicButton>();

            stopButton.buttonText.fontSize = 25;
            stopButton.label       = "Stop";
            stopButton.buttonColor = new Color(1f, 0.168f, 0.039f) * 0.8f;
            stopButton.textColor   = Color.white;
            stopButton.button.onClick.AddListener(StopCallback);
        }
示例#4
0
        public void CreateUI(IUIBuilder builder)
        {
            AddressInput = builder.CreateTextInput("OutputTarget:Udp:Address", "Address:", "127.0.0.1", 50);
            PortInput    = builder.CreateTextInput("OutputTarget:Udp:Port", "Port:", "8889", 50);
            IpText       = AddressInput.storable;
            PortText     = PortInput.storable;

            ButtonGroup = builder.CreateHorizontalGroup(510, 50, new Vector2(10, 0), 2, idx => builder.CreateButtonEx());
            var startSerialButton = ButtonGroup.items[0].GetComponent <UIDynamicButton>();

            startSerialButton.label = "Start Udp";
            startSerialButton.button.onClick.AddListener(StartUdp);

            var stopSerialButton = ButtonGroup.items[1].GetComponent <UIDynamicButton>();

            stopSerialButton.label = "Stop Udp";
            stopSerialButton.button.onClick.AddListener(StopUdp);

            StartUdpAction = UIManager.CreateAction("Start Udp", StartUdp);
            StopUdpAction  = UIManager.CreateAction("Stop Udp", StopUdp);
        }