ScenesManager.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. using SC.XR.Unity;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. public class ScenesManager
  7. {
  8. public enum mType
  9. {
  10. LogoInt = 1,
  11. LoginInt = 2,
  12. ShowChoose = 3,
  13. ShowXunJian = 4,
  14. ShowRTC = 5,
  15. ShowDevice = 6,
  16. Navigationing = 8,
  17. ShowMail = 10,
  18. officeInt = 30,
  19. RoomInt = 40,
  20. publicInt = 50,
  21. }
  22. public void showOffice(SceneType stype)
  23. {
  24. if(dlglist.ContainsKey(mType.officeInt.GetHashCode()))
  25. for (int i = 0; i < dlglist[mType.officeInt.GetHashCode()].Count; i++)
  26. {
  27. if (stype == dlglist[mType.officeInt.GetHashCode()][i]._sceneType)
  28. {
  29. dlglist[mType.officeInt.GetHashCode()][i].gameObject.SetActive(true);
  30. MonoBehaviour alist = dlglist[mType.officeInt.GetHashCode()][i].GetComponent<MonoBehaviour>();
  31. Type t = Type.GetType(alist.name);
  32. System.Reflection.MethodInfo md = t.GetMethod("initShow");
  33. if (md != null)
  34. {
  35. md.Invoke(alist, null);
  36. }
  37. }
  38. else
  39. {
  40. dlglist[mType.officeInt.GetHashCode()][i].gameObject.SetActive(false);
  41. }
  42. }
  43. }
  44. public enum SceneType
  45. {
  46. GameStartLogo = 10001,
  47. ShowLogin = 20001,
  48. ShowChoose = 30001,
  49. ShowXunJian = 40001,
  50. ShowXJ = 41001,
  51. ShowDH = 41002,
  52. ShowRTC = 50001,
  53. ShowRTCRoomMain = 51002,
  54. ShowRTCHistory = 51003,
  55. ShowZhidao = 70001,
  56. ShowDevice = 60001, // 设备基础信息
  57. ShowBasicDevice = 61001, // 设备基础详情
  58. DeviceDetails = 61002, // 设备详情
  59. Navigationing = 80001, // 导航中
  60. ShowMail = 90001,
  61. ShowOffice = 300001,
  62. CreateRoom = 300101,
  63. JoinRoom = 300102,
  64. UserSystem = 300103,
  65. RemoteSystem = 300104,
  66. OfficeWindow = 300105,
  67. ShowRoom = 400001,
  68. RoomMain = 400101,
  69. RoomOtherUser = 400102,
  70. RoomInfo = 400103,
  71. RoomFile = 400104,
  72. PopPublic = 500001,
  73. PopPeerView = 500101,
  74. PopUpInfo = 500101,
  75. PopCall = 500102,
  76. }
  77. private SceneType onlineSceneType;
  78. private static ScenesManager instance;
  79. public static ScenesManager Instance
  80. {
  81. get
  82. {
  83. if (instance == null)
  84. {
  85. instance = new ScenesManager();
  86. }
  87. return instance;
  88. }
  89. }
  90. public List<SceneInfo> windows = new List<SceneInfo>();
  91. public Dictionary<int, List<SceneInfo>> dlglist = new Dictionary<int, List<SceneInfo>>();
  92. public void initWindow(GameObject window)
  93. {
  94. SceneInfo sceneInfo = window.AddComponent<SceneInfo>();
  95. SceneType stp = (SceneType)System.Enum.Parse(typeof(SceneType), window.name.Split('(')[0]);
  96. sceneInfo.setType(stp);
  97. int codeint = stp.GetHashCode() / 10000;
  98. if (stp.GetHashCode() - (codeint * 10000) == 1)
  99. {
  100. windows.Add(sceneInfo);
  101. // window.SetActive(false);
  102. }
  103. else
  104. {
  105. if (dlglist.ContainsKey(codeint))
  106. {
  107. List<SceneInfo> dlg = dlglist[codeint];
  108. dlg.Add(sceneInfo);
  109. dlglist[codeint] = dlg;
  110. }
  111. else
  112. {
  113. List<SceneInfo> dlg = new List<SceneInfo>();
  114. dlg.Add(sceneInfo);
  115. dlglist.Add(codeint, dlg);
  116. }
  117. }
  118. }
  119. public void initRoom()
  120. {
  121. Debug.Log("HJJLANGCHAORTC " + mType.RoomInt.GetHashCode());
  122. for (int i = 0; i < dlglist[mType.RoomInt.GetHashCode()].Count; i++)
  123. {
  124. MonoBehaviour alist = dlglist[mType.RoomInt.GetHashCode()][i].GetComponent<MonoBehaviour>();
  125. Debug.Log("HJJLANGCHAORTC " + alist.name);
  126. Type t = Type.GetType(alist.name);
  127. System.Reflection.MethodInfo md = t.GetMethod("initShow");
  128. if (md != null)
  129. {
  130. md.Invoke(alist, null);
  131. }
  132. }
  133. }
  134. public void showWindow(SceneType sceneType)
  135. {
  136. switch (sceneType)
  137. {
  138. case SceneType.GameStartLogo:
  139. break;
  140. case SceneType.ShowLogin:
  141. break;
  142. case SceneType.ShowChoose:
  143. XRRGBCamera.Instance.playCamera(1280, 720);
  144. break;
  145. case SceneType.ShowXunJian:
  146. XRRGBCamera.Instance.playCamera(1280, 720);
  147. break;
  148. case SceneType.ShowXJ:
  149. break;
  150. case SceneType.ShowDH:
  151. XRRGBCamera.Instance.playCamera(1280, 720);
  152. break;
  153. case SceneType.ShowRTC:
  154. XRRGBCamera.Instance.playCamera(1280, 720);
  155. break;
  156. case SceneType.ShowRTCRoomMain:
  157. break;
  158. case SceneType.ShowRTCHistory:
  159. break;
  160. case SceneType.ShowDevice:
  161. break;
  162. case SceneType.ShowBasicDevice:
  163. break;
  164. case SceneType.DeviceDetails:
  165. break;
  166. case SceneType.Navigationing:
  167. break;
  168. case SceneType.ShowOffice:
  169. break;
  170. case SceneType.CreateRoom:
  171. break;
  172. case SceneType.JoinRoom:
  173. break;
  174. case SceneType.UserSystem:
  175. break;
  176. case SceneType.RemoteSystem:
  177. break;
  178. case SceneType.OfficeWindow:
  179. break;
  180. case SceneType.ShowRoom:
  181. break;
  182. case SceneType.RoomMain:
  183. break;
  184. case SceneType.RoomOtherUser:
  185. break;
  186. case SceneType.RoomInfo:
  187. break;
  188. case SceneType.RoomFile:
  189. break;
  190. case SceneType.PopPublic:
  191. break;
  192. case SceneType.PopPeerView:
  193. break;
  194. case SceneType.PopCall:
  195. break;
  196. case SceneType.ShowMail:
  197. XRRGBCamera.Instance.playCamera(1280, 720);
  198. break;
  199. default:
  200. break;
  201. }
  202. for (int i = 0; i < windows.Count; i++)
  203. {
  204. int codeint = windows[i]._sceneType.GetHashCode() / 10000;
  205. if (windows[i]._sceneType == sceneType || codeint == mType.publicInt.GetHashCode())
  206. {
  207. windows[i].gameObject.SetActive(true);
  208. MonoBehaviour alist = windows[i].GetComponent<MonoBehaviour>();
  209. Debug.Log("alist.name===>"+ alist.name);
  210. Type t = Type.GetType(alist.name);
  211. System.Reflection.MethodInfo md = t.GetMethod("initShow");
  212. if (md != null)
  213. {
  214. md.Invoke(alist, null);
  215. }
  216. onlineSceneType = sceneType;
  217. }
  218. else
  219. {
  220. windows[i].gameObject.SetActive(false);
  221. }
  222. }
  223. }
  224. public SceneType getWindow()
  225. {
  226. return onlineSceneType;
  227. }
  228. public void initPopUp()
  229. {
  230. // for (int i = 0; i < dlglist[mType.publicInt.GetHashCode()].Count; i++)
  231. // {
  232. // dlglist[mType.publicInt.GetHashCode()][i].gameObject.SetActive(false);
  233. // }
  234. }
  235. private PopPublic _popPublic;
  236. public PopPublic popPublic
  237. {
  238. get
  239. {
  240. if (!_popPublic)
  241. {
  242. for (int i = 0; i < dlglist[mType.publicInt.GetHashCode()].Count; i++)
  243. {
  244. PopPublic ppc = dlglist[mType.publicInt.GetHashCode()][i].GetComponent<PopPublic>();
  245. if (ppc)
  246. _popPublic = ppc;
  247. }
  248. }
  249. return _popPublic;
  250. }
  251. }
  252. public void showPop()
  253. {
  254. popPublic.gameObject.SetActive(true);
  255. }
  256. }