123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- using SC.XR.Unity;
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.EventSystems;
- public class PopPeerView : RemoteSingleton<PopPeerView>
- {
- public Transform list;
- public List<GameObject> v3 = new List<GameObject>();
- public List<PeerBigView> bigList = new List<PeerBigView>();
- 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<PeerBigView>();
- 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();
- }
- }
- }
|