diff --git a/Assets/Temp/Scripts/Taskpanel.cs b/Assets/Temp/Scripts/Taskpanel.cs index e4cd78e3..8e4f4615 100644 --- a/Assets/Temp/Scripts/Taskpanel.cs +++ b/Assets/Temp/Scripts/Taskpanel.cs @@ -1,4 +1,5 @@ -using System.Collections; +using AdamSync; +using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; @@ -18,7 +19,7 @@ public class Taskpanel : MonoBehaviour /// /// 二维地图页面 /// - + public RectTransform measure_panl;//测量页面 public RectTransform punctuation_panl;//标记工具 public RectTransform specific_panl;//专用标会 @@ -38,19 +39,24 @@ public class Taskpanel : MonoBehaviour public Button fanhuiBtn; public Button fanhui; - private bool isp=true; + private bool isp = true; void Start() { + + AdamSync.SyncCreateRoom.leaveRoomRequset += OnGetLeaveRoomsInfo; + fanhui.onClick.AddListener(() => { GameMain.tiao = false; - SceneManager.LoadScene("SampleScene"); + OnLeaveRoom(); + + }); two_dimensional.onClick.AddListener(() => { //two_dimensional.gameObject.SetActive(false); //playback_btn.gameObject.SetActive(false); - model.gameObject.SetActive(true); + model.gameObject.SetActive(true); }); ////返回按钮 //fanhuiBtn.onClick.AddListener(() => @@ -119,7 +125,7 @@ public class Taskpanel : MonoBehaviour }); menu_button.onClick.AddListener(() => { - if (isp==true) + if (isp == true) { measure_btn.gameObject.SetActive(false); punctuation_btn.gameObject.SetActive(false); @@ -139,10 +145,22 @@ public class Taskpanel : MonoBehaviour } }); } - + public void OnGetLeaveRoomsInfo(string msg) + { + Debug.Log("OnGetLeaveRoomsInfo====" + msg); + string[] info = msg.Split(','); + GameManager.Instance.RemovePlayer(ulong.Parse(info[0])); + SceneManager.LoadScene("SampleScene"); + } + public void OnLeaveRoom() + { + Debug.Log("Leaveroom"); + string msg = "leaveroom "; + _ = SyncCreateRoom.SendMessageAsync(msg); + } // Update is called once per frame void Update() { - + } } diff --git a/Assets/Temp/Scripts/View_Panel2.cs b/Assets/Temp/Scripts/View_Panel2.cs index 4872104e..3d62303a 100644 --- a/Assets/Temp/Scripts/View_Panel2.cs +++ b/Assets/Temp/Scripts/View_Panel2.cs @@ -574,12 +574,12 @@ public class View_Panel2 : XUIPanel GameObject subjectTemp = GameObject.Instantiate(currentRoomSubjectItem, currentRoomSubjectItemConnect); subjectTemp.SetActive(true); subjectTemp.name = di[index].Id; - GlobalFlag.practiceSubjectID = subjectTemp.name; subjectTemp.transform.GetChild(0).GetComponent().text = di[index].Name; subjectTemp.GetComponent