123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- using SC.XR.Unity;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ScenesManager
- {
- public enum mType
- {
- LogoInt = 1,
- LoginInt = 2,
- ShowChoose = 3,
- ShowXunJian = 4,
- ShowRTC = 5,
- ShowDevice = 6,
- Navigationing = 8,
- officeInt = 30,
- RoomInt = 40,
- publicInt = 50,
- }
- public void showOffice(SceneType stype)
- {
- if(dlglist.ContainsKey(mType.officeInt.GetHashCode()))
- for (int i = 0; i < dlglist[mType.officeInt.GetHashCode()].Count; i++)
- {
- if (stype == dlglist[mType.officeInt.GetHashCode()][i]._sceneType)
- {
- dlglist[mType.officeInt.GetHashCode()][i].gameObject.SetActive(true);
- MonoBehaviour alist = dlglist[mType.officeInt.GetHashCode()][i].GetComponent<MonoBehaviour>();
- Type t = Type.GetType(alist.name);
- System.Reflection.MethodInfo md = t.GetMethod("initShow");
- if (md != null)
- {
- md.Invoke(alist, null);
- }
- }
- else
- {
- dlglist[mType.officeInt.GetHashCode()][i].gameObject.SetActive(false);
- }
- }
- }
- public enum SceneType
- {
- GameStartLogo = 10001,
- ShowLogin = 20001,
- ShowChoose = 30001,
- ShowXunJian = 40001,
- ShowXJ = 41001,
- ShowDH = 41002,
- ShowRTC = 50001,
- ShowRTCRoomMain = 51002,
- ShowRTCHistory = 51003,
- //ShowZhiDao = 50001,
-
- ShowDevice = 60001, // 设备基础信息
- ShowBasicDevice = 61001, // 设备基础详情
- DeviceDetails = 61002, // 设备详情
- Navigationing = 80001, // 导航中
- ShowZhidao = 70001,
- ShowOffice = 300001,
- CreateRoom = 300101,
- JoinRoom = 300102,
- UserSystem = 300103,
- RemoteSystem = 300104,
- OfficeWindow = 300105,
- ShowRoom = 400001,
- RoomMain = 400101,
- RoomOtherUser = 400102,
- RoomInfo = 400103,
- RoomFile = 400104,
- PopPublic = 500001,
- PopPeerView = 500101,
- PopUpInfo = 500101,
- PopCall = 500102,
- }
- private SceneType onlineSceneType;
- private static ScenesManager instance;
-
- public static ScenesManager Instance
- {
- get
- {
- if (instance == null)
- {
- instance = new ScenesManager();
- }
- return instance;
- }
- }
- public List<SceneInfo> windows = new List<SceneInfo>();
- public Dictionary<int, List<SceneInfo>> dlglist = new Dictionary<int, List<SceneInfo>>();
- public void initWindow(GameObject window)
- {
- SceneInfo sceneInfo = window.AddComponent<SceneInfo>();
- SceneType stp = (SceneType)System.Enum.Parse(typeof(SceneType), window.name.Split('(')[0]);
- sceneInfo.setType(stp);
- int codeint = stp.GetHashCode() / 10000;
- if (stp.GetHashCode() - (codeint * 10000) == 1)
- {
- windows.Add(sceneInfo);
- // window.SetActive(false);
- }
- else
- {
- if (dlglist.ContainsKey(codeint))
- {
- List<SceneInfo> dlg = dlglist[codeint];
- dlg.Add(sceneInfo);
- dlglist[codeint] = dlg;
- }
- else
- {
- List<SceneInfo> dlg = new List<SceneInfo>();
- dlg.Add(sceneInfo);
- dlglist.Add(codeint, dlg);
- }
- }
- }
- public void initRoom()
- {
- Debug.Log("HJJLANGCHAORTC " + mType.RoomInt.GetHashCode());
- for (int i = 0; i < dlglist[mType.RoomInt.GetHashCode()].Count; i++)
- {
- MonoBehaviour alist = dlglist[mType.RoomInt.GetHashCode()][i].GetComponent<MonoBehaviour>();
- Debug.Log("HJJLANGCHAORTC " + alist.name);
- Type t = Type.GetType(alist.name);
- System.Reflection.MethodInfo md = t.GetMethod("initShow");
- if (md != null)
- {
- md.Invoke(alist, null);
- }
- }
- }
- public void showWindow(SceneType sceneType)
- {
- switch (sceneType)
- {
- case SceneType.GameStartLogo:
- break;
- case SceneType.ShowLogin:
- break;
- case SceneType.ShowChoose:
- XRRGBCamera.Instance.playCamera(1280, 720);
- break;
- case SceneType.ShowXunJian:
- XRRGBCamera.Instance.playCamera(1280, 720);
- break;
- case SceneType.ShowXJ:
- break;
- case SceneType.ShowDH:
- XRRGBCamera.Instance.playCamera(1280, 720);
- break;
- case SceneType.ShowRTC:
- XRRGBCamera.Instance.playCamera(1280, 720);
- break;
- case SceneType.ShowRTCRoomMain:
- break;
- case SceneType.ShowRTCHistory:
- break;
- case SceneType.ShowDevice:
- break;
- case SceneType.ShowBasicDevice:
- break;
- case SceneType.DeviceDetails:
- break;
- case SceneType.Navigationing:
- break;
- case SceneType.ShowOffice:
- break;
- case SceneType.CreateRoom:
- break;
- case SceneType.JoinRoom:
- break;
- case SceneType.UserSystem:
- break;
- case SceneType.RemoteSystem:
- break;
- case SceneType.OfficeWindow:
- break;
- case SceneType.ShowRoom:
- break;
- case SceneType.RoomMain:
- break;
- case SceneType.RoomOtherUser:
- break;
- case SceneType.RoomInfo:
- break;
- case SceneType.RoomFile:
- break;
- case SceneType.PopPublic:
- break;
- case SceneType.PopPeerView:
- break;
- case SceneType.PopCall:
- break;
- default:
- break;
- }
- for (int i = 0; i < windows.Count; i++)
- {
- int codeint = windows[i]._sceneType.GetHashCode() / 10000;
- if (windows[i]._sceneType == sceneType || codeint == mType.publicInt.GetHashCode())
- {
- windows[i].gameObject.SetActive(true);
- MonoBehaviour alist = windows[i].GetComponent<MonoBehaviour>();
- Type t = Type.GetType(alist.name);
- System.Reflection.MethodInfo md = t.GetMethod("initShow");
- if (md != null)
- {
- md.Invoke(alist, null);
- }
- onlineSceneType = sceneType;
- }
- else
- {
- windows[i].gameObject.SetActive(false);
- }
- }
- }
- public SceneType getWindow()
- {
- return onlineSceneType;
- }
- public void initPopUp()
- {
- // for (int i = 0; i < dlglist[mType.publicInt.GetHashCode()].Count; i++)
- // {
- // dlglist[mType.publicInt.GetHashCode()][i].gameObject.SetActive(false);
- // }
- }
- private PopPublic _popPublic;
- public PopPublic popPublic
- {
- get
- {
- if (!_popPublic)
- {
- for (int i = 0; i < dlglist[mType.publicInt.GetHashCode()].Count; i++)
- {
- PopPublic ppc = dlglist[mType.publicInt.GetHashCode()][i].GetComponent<PopPublic>();
- if (ppc)
- _popPublic = ppc;
- }
- }
- return _popPublic;
- }
- }
- public void showPop()
- {
- popPublic.gameObject.SetActive(true);
- }
- }
|