using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; using UnityWebSocket; public class Tips : MonoBehaviour { #region Judge [SerializeField] private Text Title; [SerializeField] private Text Information; [SerializeField] private Button Yes; [SerializeField] private Button No; private Action OnChoose; #endregion #region Confrom [SerializeField] private Button Confrom; private Action OnConform; #endregion // Use this for initialization void Start () { Confrom.onClick.AddListener(() => { Confrom.interactable = false; Invoke("ShowDelay",3); if (WebSocketDemo.socket_main != null && WebSocketDemo.socket_main.ReadyState == WebSocketState.Closed) { WebSocketDemo.socket_main.ConnectAsync(); } if(WebSocketDemo.socket_trans != null && WebSocketDemo.socket_trans.ReadyState == WebSocketState.Closed) { WebSocketDemo.socket_trans.ConnectAsync(); } }); } public void TipJudge(string title,string info,Action callback) { Title.text = title; Information.text = info; OnChoose = callback; } public void TipConform() { gameObject.SetActive(true); } /// /// 重连成功 /// public void TipHide() { Confrom.interactable = true; gameObject.SetActive(false); } /// /// 尝试重连后禁止操作 /// private void ShowDelay() { Confrom.interactable = true; } }