Пример #1
0
 /// <summary>
 /// 给 Slider 添加结束拖拽事件
 /// </summary>
 /// <param name="eventData"></param>
 public void OnEndDrag(PointerEventData eventData)
 {
     toPlayVideo.isPlay.Value = false;
     toPlayVideo.videoPlayer.Play();
     MainControl.Instance().SendMsg(toPlayVideo.Name + TcpOrder.orderDrag + toPlayVideo.sliderVideoTime.value);
     //向客户端发送事件
 }
Пример #2
0
        // Start is called before the first frame update
        void Start()
        {
            goVideoPanel.Hide();
            this.Delay(1.0f, () => {
                if (!MainControl.Instance().xmlInfo.IsOpenTcpPanel())
                {
                    goTcpInfoPanel.Show();
                    goTcpInfoPanel.GetComponent <TcpSectionUI>().toggle.isOn = false;
                }
                else
                {
                    goTcpInfoPanel.Hide();
                    goTcpInfoPanel.GetComponent <TcpSectionUI>().toggle.isOn = true;
                    Info qInfo = MainControl.Instance().xmlInfo.GetIpPortInfo();

                    MainControl.Instance().StartSever(qInfo.sIp, Convert.ToInt32(qInfo.sPort));
                }
            });

            MainControl.Instance().tcpServer.IsContent.Subscribe(_ => {
                if (_)
                {
                    goVideoPanel.Show();
                }
            });
        }
Пример #3
0
 void Start()
 {
     text.text = "继电器尚未链接";
     MainControl.Instance().tcpServer.CallTcpSuccess03 += () => {
         ThreadHelperTool.QueueOnMainThread(() => {
             text.text = "继电器连接成功";
         });
     };
 }
Пример #4
0
 void StopVideo()
 {
     videoPlayer.Stop();
     btnPlayPause.image.sprite = spritePlayOrPause[0];
     sliderVideoTime.gameObject.SetActive(false);
     textVideoName.gameObject.Hide();
     textVideoTime.text = "";
     isPlay.Value       = true;
     MainControl.Instance().SendMsg(Name + TcpOrder.orderStop);
 }
Пример #5
0
        void InitSever()
        {
            string ip   = inputFieldIp.text;
            string port = InputFieldPort.text;


            MainControl.Instance().xmlInfo.SetIpPortInfo(ip, port, toggle.isOn);

            MainControl.Instance().StartSever(ip, Convert.ToInt32(port));
            gameObject.Hide();
        }
Пример #6
0
        private void Start()
        {
            btnPlayPause.onClick.AddListener(PlayOrPause);
            btnStop.onClick.AddListener(StopVideo);
            btnPlayPause.image.sprite = spritePlayOrPause[1];
            ShowVideoLength();
            textVideoTime.text = "";
            isPlay.Skip(1).Subscribe(_ =>
            {
                Debug.Log(isPlay.Value);
                if (_)
                {
                    btnPlayPause.image.sprite = spritePlayOrPause[1];
                    videoPlayer.Pause();

                    MainControl.Instance().SendMsg(Name + TcpOrder.orderPause);
                }
                else
                {
                    btnPlayPause.image.sprite = spritePlayOrPause[0];
                    Debug.Log("Play");
                    videoPlayer.Play();
                    MainControl.Instance().SendMsg(Name + TcpOrder.orderPlay);
                }
            });
            if (is01)
            {
                MainControl.Instance().tcpServer.CallTcpSuccess01 += () => {
                    ThreadHelperTool.QueueOnMainThread(() => {
                        SetDialog(true);
                    });
                };
            }
            else
            {
                MainControl.Instance().tcpServer.CallTcpSuccess02 += () => {
                    ThreadHelperTool.QueueOnMainThread(() => {
                        SetDialog(true);
                    });
                };
            }



            //Observable.NextFrame().Subscribe((_) => {
            //}); ;

            videoPlayer.frame = 1;
            SetDialog(false);
        }
Пример #7
0
        void Start()
        {
            isToggleConnect = false;

            btn01.transform.GetChild(1).Hide();
            btn02.transform.GetChild(1).Hide();

            isTog01.Subscribe(_ => {
                if (_)
                {
                    btn01.transform.GetChild(1).Show();
                    btn01.transform.GetChild(0).Hide();
                    str01 = strOn1;
                }
                else
                {
                    btn01.transform.GetChild(0).Show();
                    btn01.transform.GetChild(1).Hide();
                    str01 = strOff1;
                }
                MainControl.Instance().SendMsg(str01);
            });
            isTog02.Subscribe(_ => {
                if (_)
                {
                    btn01.transform.GetChild(1).Show();
                    btn01.transform.GetChild(0).Hide();
                    str02 = strOn2;
                }
                else
                {
                    btn01.transform.GetChild(0).Show();
                    btn01.transform.GetChild(1).Hide();
                    str02 = strOff2;
                }
                MainControl.Instance().SendMsg(str02);
            });

            btn01.onClick.AddListener(() => {
                isTog01.Value = !isTog01.Value;
            });
            btn02.onClick.AddListener(() => {
                isTog02.Value = !isTog02.Value;
            });
        }