BaseSetting.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class BaseSetting : MonoBehaviour
  5. {
  6. public GameObject CameraOpenIcon;
  7. public GameObject CameraCloseIcon;
  8. public GameObject MicOpenIcon;
  9. public GameObject MicCloseIcon;
  10. public GameObject[] QesolutionIcons;
  11. public Game3DInputField g3dField;
  12. public void Start()
  13. {
  14. string dName = PlayerPrefs.GetString("name");
  15. if(dName!=null&& dName!="")
  16. g3dField.text = dName;
  17. string isSendVideo = PlayerPrefs.GetString("isSendVideo");
  18. string isSendAudio = PlayerPrefs.GetString("isSendAudio");
  19. string SetFrame = PlayerPrefs.GetString("SetFrame");
  20. string ChooseFPS = PlayerPrefs.GetString("ChooseFPS");
  21. switch (isSendVideo)
  22. {
  23. case "Open":
  24. CustomInfo.isSendVideo = true;
  25. CameraOpenIcon.SetActive(CustomInfo.isSendVideo);
  26. CameraCloseIcon.SetActive(!CustomInfo.isSendVideo);
  27. break;
  28. case "Close":
  29. CustomInfo.isSendVideo = false;
  30. CameraOpenIcon.SetActive(CustomInfo.isSendVideo);
  31. CameraCloseIcon.SetActive(!CustomInfo.isSendVideo);
  32. break;
  33. default:
  34. CustomInfo.isSendVideo = true;
  35. CameraOpenIcon.SetActive(CustomInfo.isSendVideo);
  36. CameraCloseIcon.SetActive(!CustomInfo.isSendVideo);
  37. break;
  38. }
  39. isVideoGM.SetActive(!CustomInfo.isSendVideo);
  40. switch (isSendAudio)
  41. {
  42. case "Open":
  43. CustomInfo.isSendAudio = true;
  44. MicOpenIcon.SetActive(CustomInfo.isSendAudio);
  45. MicCloseIcon.SetActive(!CustomInfo.isSendAudio);
  46. break;
  47. case "Close":
  48. CustomInfo.isSendAudio = false;
  49. MicOpenIcon.SetActive(CustomInfo.isSendAudio);
  50. MicCloseIcon.SetActive(!CustomInfo.isSendAudio);
  51. break;
  52. default:
  53. CustomInfo.isSendAudio = true;
  54. MicOpenIcon.SetActive(CustomInfo.isSendAudio);
  55. MicCloseIcon.SetActive(!CustomInfo.isSendAudio);
  56. break;
  57. }
  58. isAudioGM.SetActive(!CustomInfo.isSendAudio);
  59. switch (ChooseFPS)
  60. {
  61. case "Super":
  62. ChooseSuper();
  63. break;
  64. case "High":
  65. ChooseHigh();
  66. break;
  67. case "Standard":
  68. ChooseStandard();
  69. break;
  70. default:
  71. ChooseHigh();
  72. break;
  73. }
  74. switch (ChooseFPS)
  75. {
  76. case "Super":
  77. SetFrameSuper();
  78. break;
  79. case "High":
  80. SetFrameHigh();
  81. break;
  82. case "Standard":
  83. SetFrameStandard();
  84. break;
  85. default:
  86. SetFrameHigh();
  87. break;
  88. }
  89. }
  90. public void changeCamera()
  91. {
  92. CustomInfo.isSendVideo = !CustomInfo.isSendVideo;
  93. CameraOpenIcon.SetActive(CustomInfo.isSendVideo);
  94. CameraCloseIcon.SetActive(!CustomInfo.isSendVideo);
  95. if (CustomInfo.isSendVideo)
  96. {
  97. PlayerPrefs.SetString("isSendVideo","Open");
  98. }else
  99. {
  100. PlayerPrefs.SetString("isSendVideo", "Close");
  101. }
  102. isVideoGM.SetActive(!CustomInfo.isSendVideo);
  103. SCRtcFactory.Instance.mSCRtcHandle.sendVideo(CustomInfo.isSendVideo);
  104. }
  105. public void changeMic()
  106. {
  107. CustomInfo.isSendAudio = !CustomInfo.isSendAudio;
  108. MicOpenIcon.SetActive(CustomInfo.isSendAudio);
  109. MicCloseIcon.SetActive(!CustomInfo.isSendAudio);
  110. if (CustomInfo.isSendAudio)
  111. {
  112. PlayerPrefs.SetString("isSendAudio", "Open");
  113. }
  114. else
  115. {
  116. PlayerPrefs.SetString("isSendAudio", "Close");
  117. }
  118. isAudioGM.SetActive(!CustomInfo.isSendAudio);
  119. SCRtcFactory.Instance.mSCRtcHandle.sendMic(CustomInfo.isSendAudio);
  120. }
  121. public ChooseManage chooseVideo;
  122. public ChooseManage chooseFPS;
  123. public void ChooseSuper()
  124. {
  125. CustomInfo.FPS = 60;
  126. chooseFPS.changeList(2);
  127. PlayerPrefs.SetString("ChooseFPS", "Super");
  128. }
  129. public void ChooseHigh()
  130. {
  131. CustomInfo.FPS = 30;
  132. chooseFPS.changeList(1);
  133. PlayerPrefs.SetString("ChooseFPS", "High");
  134. }
  135. public void ChooseStandard()
  136. {
  137. CustomInfo.FPS = 15;
  138. chooseFPS.changeList(0);
  139. PlayerPrefs.SetString("ChooseFPS", "Standard");
  140. }
  141. public void SetFrameSuper()
  142. {
  143. CustomInfo.mWidth = 1280;
  144. CustomInfo.mHight = 960;
  145. chooseVideo.changeList(2);
  146. PlayerPrefs.SetString("SetFrame", "Super");
  147. }
  148. public void SetFrameHigh()
  149. {
  150. CustomInfo.mWidth = 640;
  151. CustomInfo.mHight = 480;
  152. chooseVideo.changeList(1);
  153. PlayerPrefs.SetString("SetFrame", "High");
  154. }
  155. public void SetFrameStandard()
  156. {
  157. CustomInfo.mWidth = 320;
  158. CustomInfo.mHight = 240;
  159. chooseVideo.changeList(0);
  160. PlayerPrefs.SetString("SetFrame", "Standard");
  161. }
  162. public GameObject isVideoGM;
  163. public GameObject isAudioGM;
  164. }