GameStart.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using LitJson;
  5. using SC.XR.Unity;
  6. using UnityEngine;
  7. using XRTool.Util;
  8. public class GameStart : UnitySingleton<GameStart>
  9. {
  10. public static Action actionok;
  11. public SystemFollow systemMenu;
  12. protected override void Awake()
  13. {
  14. base.Awake();
  15. GameObject systemMenuObj = Resources.Load("systemMenu") as GameObject;
  16. systemMenuObj = Instantiate(systemMenuObj);
  17. systemMenu = systemMenuObj.transform.GetComponent<SystemFollow>();
  18. systemMenu.InitUI();
  19. }
  20. // Start is called before the first frame update
  21. void Start()
  22. {
  23. //if (TimerMgr.Instance)
  24. //{
  25. // TimerMgr.Instance.CreateTimer(() =>
  26. // {
  27. // API_GSXR_Slam.GSXR_Set_TrackMode(TrackMode.Mode_3Dof);
  28. // }, 1f);
  29. //}
  30. actionok += ShowDating;
  31. WSHandler.Office.OnInvitee += Invitee;
  32. ScenesManager.Instance.showWindow(ScenesManager.SceneType.GameStartLogo);
  33. }
  34. private void Invitee(JsonData data)
  35. {
  36. WSHandler.Office.ChangeUserType(UserInfo.BusyType);
  37. string peerId = data["data"]["peerId"].ToString();
  38. string nickName = data["data"]["nickName"].ToString();
  39. string roomId = data["data"]["roomId"].ToString();
  40. string avatar = data["data"]["avatar"].ToString();
  41. PopUpInfo.Instance.showPublic(PopUpInfo.PopType.ListenDlg);
  42. if (ListenDlg.Instance)
  43. {
  44. ListenDlg.Instance.Init(peerId, roomId, nickName, avatar, true);
  45. }
  46. }
  47. public void ShowDating()
  48. {
  49. if (JoinRoom.Instance != null)
  50. {
  51. JoinRoom.Instance.showOffice();
  52. }
  53. }
  54. protected override void OnDestroy()
  55. {
  56. base.OnDestroy();
  57. actionok -= ShowDating;
  58. WSHandler.Office.OnInvitee -= Invitee;
  59. }
  60. }