BaseSetting.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 changeCamera1()
  106. {
  107. CustomInfo.isSendVideo = !CustomInfo.isSendVideo;
  108. isVideoGM.SetActive(!CustomInfo.isSendVideo);
  109. SCRtcFactory.Instance.mSCRtcHandle.sendVideo(CustomInfo.isSendVideo);
  110. }
  111. public void changeMic()
  112. {
  113. CustomInfo.isSendAudio = !CustomInfo.isSendAudio;
  114. MicOpenIcon.SetActive(CustomInfo.isSendAudio);
  115. MicCloseIcon.SetActive(!CustomInfo.isSendAudio);
  116. if (CustomInfo.isSendAudio)
  117. {
  118. PlayerPrefs.SetString("isSendAudio", "Open");
  119. }
  120. else
  121. {
  122. PlayerPrefs.SetString("isSendAudio", "Close");
  123. }
  124. isAudioGM.SetActive(!CustomInfo.isSendAudio);
  125. SCRtcFactory.Instance.mSCRtcHandle.sendMic(CustomInfo.isSendAudio);
  126. }
  127. public void changeMic1()
  128. {
  129. CustomInfo.isSendAudio = !CustomInfo.isSendAudio;
  130. isAudioGM.SetActive(!CustomInfo.isSendAudio);
  131. SCRtcFactory.Instance.mSCRtcHandle.sendMic(CustomInfo.isSendAudio);
  132. }
  133. public ChooseManage chooseVideo;
  134. public ChooseManage chooseFPS;
  135. public void ChooseSuper()
  136. {
  137. CustomInfo.FPS = 60;
  138. chooseFPS.changeList(2);
  139. PlayerPrefs.SetString("ChooseFPS", "Super");
  140. }
  141. public void ChooseHigh()
  142. {
  143. CustomInfo.FPS = 30;
  144. chooseFPS.changeList(1);
  145. PlayerPrefs.SetString("ChooseFPS", "High");
  146. }
  147. public void ChooseStandard()
  148. {
  149. CustomInfo.FPS = 15;
  150. chooseFPS.changeList(0);
  151. PlayerPrefs.SetString("ChooseFPS", "Standard");
  152. }
  153. public void SetFrameSuper()
  154. {
  155. CustomInfo.mWidth = 1920;
  156. CustomInfo.mHight = 1440;
  157. chooseVideo.changeList(2);
  158. PlayerPrefs.SetString("SetFrame", "Super");
  159. }
  160. public void SetFrameHigh()
  161. {
  162. CustomInfo.mWidth = 640;
  163. CustomInfo.mHight = 480;
  164. chooseVideo.changeList(1);
  165. PlayerPrefs.SetString("SetFrame", "High");
  166. }
  167. public void SetFrameStandard()
  168. {
  169. CustomInfo.mWidth = 320;
  170. CustomInfo.mHight = 240;
  171. chooseVideo.changeList(0);
  172. PlayerPrefs.SetString("SetFrame", "Standard");
  173. }
  174. public GameObject isVideoGM;
  175. public GameObject isAudioGM;
  176. }