using System; using System.Collections; using System.Collections.Generic; using System.Linq; using BeinLab.Util; using LitJson; using ShadowStudio.Mgr; using ShadowStudio.Model; using ShadowStudio.UI; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using XRTool.Util; public class ShowViewMgr : UnitySingleton { public event Action, bool> OnUserChange; public event Action OnRoomPageChange;//第一个是total,第二个是当前的 public event Action, SceneConfig> OnChangeRoom; public string roomId; public List artContainerList; public List SceneList; public Transform Target; public static Action ChooseSenceAction;//选择场景的监听 public static Action> RemoteSenceAction;//移除场景的监听 protected override void Awake() { base.Awake(); artContainerList = new List(); SceneList = new List(); ArtInfoMgr.Instance.ContainerCreate -= CreateSuccess; ArtInfoMgr.ContainerSelect -= OnContainerSelect; ArtInfoMgr.Instance.ContainerDel -= DeleteContainer; WSHandler.Room.OnOtherUserJoinRoom -= OtherUserJoinRoom; WSHandler.Room.OnOtherUserLeaveRoom -= OtherUserLeaveRoom; WSHandler.Room.onChangeScene -= ChangeScene; OnChangeRoom -= OnLocalChangeRoom; WSHandler.Room.OnClose -= Close; ArtInfoMgr.Instance.ContainerCreate += CreateSuccess; ArtInfoMgr.ContainerSelect += OnContainerSelect; ArtInfoMgr.Instance.ContainerDel += DeleteContainer; WSHandler.Room.OnOtherUserJoinRoom += OtherUserJoinRoom; WSHandler.Room.OnOtherUserLeaveRoom += OtherUserLeaveRoom; WSHandler.Room.onChangeScene += ChangeScene; OnChangeRoom += OnLocalChangeRoom; WSHandler.Room.OnClose += Close; } private void Close(JsonData data) { CommonMethod.ShowNetErrorAbnormalOutPop(); } private void ChangeScene(string peerId, List scenes, SceneConfig currentScene) { List sceneList = new List(); for (int i = 0; i < scenes.Count; i++) { sceneList.Add(scenes[i]); } OnRoomPageChange?.Invoke(scenes.Count, currentScene.Id); CompareList(SceneList, scenes, currentScene); SceneList.Clear(); for (int i = 0; i < sceneList.Count; i++) { SceneList.Add(sceneList[i]); } CommonMethod.currentScene = currentScene; } private void OnLocalChangeRoom(string method, List remainscene, SceneConfig currentScene) { switch (method) { case "RemoveSence": RemoteSenceAction.Invoke(remainscene); if (ItemSenceList.Instance) { ItemSenceList.Instance.SetCreateSenceBtnBtn(true); } break; case "AddSence": ItemSenceList.Instance.Init(remainscene, currentScene); ItemSenceSmallList.Instance.Init(remainscene, currentScene); break; case "ChangeSence": break; } ChooseSenceAction?.Invoke(currentScene); } void Start() { ArtInfoMgr.Instance.ListenPage(); ArtInfoMgr.Instance.ListenUser(); roomId = CommonMethod.roomConfig.Id; //WSHandler.User.OnRoomChange += roomChange; TimerMgr.Instance.CreateTimer(Init, 0.5f); if (CommonMethod.roomConfig.Is_created == "0") { GameObject.Find("CreateSenceBtn").GetComponent