public void QuitGame()
 {
     if (currentMatch != null)
     {
         currentMatch.LeaveMatch();
     }
     SNBNetwork.instance.TerminateConnection((response) => {
         Debug.Log("Quitting...");
         Application.Quit();
     });
 }
Esempio n. 2
0
 void Start()
 {
     timeText    = transform.Find("timer").GetComponent <Text>();
     contentText = transform.Find("Image/Text").GetComponent <Text>();
     InvokeRepeating("showtip", 0, 0.4f);
     matchHandler = GameObject.Find("NetWork").GetComponent <MatchHandler>();
     matchHandler.OnLeaveMatch = this.OnHide;//向该模块注册取消匹配返回的处理函数
     transform.Find("btncancel").GetComponent <Button>().onClick.AddListener(delegate()
     {
         //向服务器请求取消匹配
         matchHandler.LeaveMatch();
     });
 }