RemoteSystem.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Newtonsoft.Json;
  2. using SC.XR.Unity;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using static ScenesManager;
  6. public class RemoteSystem : RemoteSingleton<RemoteSystem>
  7. {
  8. public GameObject audioOpen;
  9. public GameObject audioClose;
  10. public GameObject videoOpen;
  11. public GameObject videoClose;
  12. public NormalList sysList;
  13. public override void initShow()
  14. {
  15. base.initShow();
  16. sysList.initList(CustomInfo.sscList);
  17. audioOpen.SetActive(!CustomInfo.isSendAudio);
  18. audioClose.SetActive(CustomInfo.isSendAudio);
  19. videoOpen.SetActive(!CustomInfo.isSendVideo);
  20. videoClose.SetActive(CustomInfo.isSendVideo);
  21. }
  22. public void showOffice()
  23. {
  24. NetWorkHeaders.SetUserSys(CustomInfo.isSendAudio, CustomInfo.isSendVideo, CustomInfo.camIndex);
  25. ScenesManager.Instance.showOffice(SceneType.OfficeWindow);
  26. }
  27. public void audioChoose()
  28. {
  29. CustomInfo.isSendAudio = !CustomInfo.isSendAudio;
  30. audioOpen.SetActive(!CustomInfo.isSendAudio);
  31. audioClose.SetActive(CustomInfo.isSendAudio);
  32. SaveSystemData();
  33. }
  34. public void videoChoose()
  35. {
  36. CustomInfo.isSendVideo = !CustomInfo.isSendVideo;
  37. videoOpen.SetActive(!CustomInfo.isSendVideo);
  38. videoClose.SetActive(CustomInfo.isSendVideo);
  39. SaveSystemData();
  40. }
  41. private void SaveSystemData()
  42. {
  43. SystemDatas data = new SystemDatas();
  44. data.Camera = CustomInfo.isSendVideo ? 1 : 0;
  45. data.Mic = CustomInfo.isSendAudio ? 1 : 0;
  46. string saveData = JsonConvert.SerializeObject(data);
  47. Debug.Log(saveData);
  48. PlayerPrefs.SetString(UserInfo.Account + "_SystemSetting", saveData);
  49. }
  50. }