using SC.XR.Unity; using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class PopPeerView : RemoteSingleton { public Transform list; public List v3 = new List(); public List bigList = new List(); public GameObject view; public int viewCount=0; public static Action CloseView; public override void Awake() { base.Awake(); view.SetActive(false); } public override void initShow() { base.initShow(); view.SetActive(false); viewCount = 0; } public void addBigView(CustomPeer cp) { if(viewCount<=0) { viewCount = 0; } Debug.Log("增加:1===>"+ viewCount); GameObject bigView = GameObject.Instantiate(view); bigView.SetActive(true); bigView.transform.parent = view.transform.parent; bigView.transform.position = v3[viewCount].transform.position; bigView.transform.eulerAngles = v3[viewCount].transform.eulerAngles; PeerBigView pbv = bigView.GetComponent(); pbv.cPeer = cp; pbv.initView(); bigList.Add(pbv); viewCount ++; } public void closeView(PeerBigView view) { if (!view.isMove) viewCount--; Destroy(view.gameObject); Debug.Log("删除:1===>" + viewCount); } public void ViewOut(PeerBigView view) { viewCount--; Debug.Log("删除:1===>" + viewCount); } public void DestoryAll() { if (bigList.Count > 0) { for (int i = bigList.Count - 1; i >= 0; i--) { Destroy(bigList[i].gameObject); bigList.Remove(bigList[i]); } bigList.Clear(); } } }