ConfigMgr.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. using System;
  2. using UnityEngine;
  3. public class ConfigMgr : BaseMgr<ConfigMgr>
  4. {
  5. private void Start()
  6. {
  7. }
  8. private void Init()
  9. {
  10. string rootPath = "__GameMain__/SystemUI Root";
  11. this.m_goPanel = base.GetPanel("ConfigPanel", rootPath);
  12. this.m_configCtrl = base.GetCtrl<ConfigCtrl>();
  13. this.m_configCtrl.Init(this.m_goPanel);
  14. this.m_uiPanel = this.m_goPanel.GetComponent<UIPanel>();
  15. this.m_goPanel.SetActive(false);
  16. this.m_bInited = true;
  17. this.ChangeNormalConfig();
  18. }
  19. public bool IsOpenConfigPanel()
  20. {
  21. return !(this.m_goPanel == null) && this.m_goPanel.activeSelf;
  22. }
  23. public void OnSysButtonShowAlwaysEnabled()
  24. {
  25. this.m_configCtrl.SetButtonShowAlwaysEnabled(true);
  26. }
  27. public void OnSysButtonShowAlwaysDisabled()
  28. {
  29. this.m_configCtrl.SetButtonShowAlwaysEnabled(false);
  30. }
  31. public void OnFullScreenEnabled()
  32. {
  33. this.m_configCtrl.SetFullScreenEnabled(true);
  34. }
  35. public void OnFullScreenDisabled()
  36. {
  37. this.m_configCtrl.SetFullScreenEnabled(false);
  38. }
  39. public void OnResolutionChange()
  40. {
  41. if (!this.m_bInited)
  42. {
  43. return;
  44. }
  45. string value = UIPopupList.current.value;
  46. this.m_configCtrl.ChangePopupListResolutionValue(value);
  47. }
  48. public void OnAntiAliasChange()
  49. {
  50. if (!this.m_bInited)
  51. {
  52. return;
  53. }
  54. string value = UIPopupList.current.value;
  55. base.IsValidatePopupValue<CMSystem.AntiAliasType>(value);
  56. this.m_configCtrl.ChangePopupListValue<CMSystem.AntiAliasType>(value);
  57. }
  58. public void OnShadowQualityChange()
  59. {
  60. if (!this.m_bInited)
  61. {
  62. return;
  63. }
  64. string value = UIPopupList.current.value;
  65. base.IsValidatePopupValue<CMSystem.ShadowQualityType>(value);
  66. this.m_configCtrl.ChangePopupListValue<CMSystem.ShadowQualityType>(value);
  67. }
  68. public void OnTextureQualityChange()
  69. {
  70. if (!this.m_bInited)
  71. {
  72. return;
  73. }
  74. string value = UIPopupList.current.value;
  75. base.IsValidatePopupValue<CMSystem.TextureQualityType>(value);
  76. this.m_configCtrl.ChangePopupListValue<CMSystem.TextureQualityType>(value);
  77. }
  78. public void OnFpsDisplayEnabled()
  79. {
  80. this.m_configCtrl.SetFpsDisplayEnabled(true);
  81. }
  82. public void OnFpsDisplayDisabled()
  83. {
  84. this.m_configCtrl.SetFpsDisplayEnabled(false);
  85. }
  86. public void OnCaptureMagnificationChange()
  87. {
  88. if (!this.m_bInited)
  89. {
  90. return;
  91. }
  92. string value = UIPopupList.current.value;
  93. base.IsValidatePopupValue<CMSystem.SSSuperSizeType>(value);
  94. this.m_configCtrl.ChangePopupListValue<CMSystem.SSSuperSizeType>(value);
  95. }
  96. public void OnBloomChange()
  97. {
  98. if (!this.m_bInited)
  99. {
  100. return;
  101. }
  102. float value = UIProgressBar.current.value;
  103. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.Bloom, value);
  104. }
  105. public void OnPlayerModelTransparencyChange()
  106. {
  107. if (!this.m_bInited)
  108. {
  109. return;
  110. }
  111. float value = UIProgressBar.current.value;
  112. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.PlayerModelTransparency, value);
  113. }
  114. public void OnMessageWindowTransparencyChange()
  115. {
  116. if (!this.m_bInited)
  117. {
  118. return;
  119. }
  120. float value = UIProgressBar.current.value;
  121. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.MessageWindowTransparency, value);
  122. }
  123. public void OnTextSpeedChange()
  124. {
  125. if (!this.m_bInited)
  126. {
  127. return;
  128. }
  129. float value = UIProgressBar.current.value;
  130. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.TextSpeed, value);
  131. }
  132. public void OnAutoSpeedChange()
  133. {
  134. if (!this.m_bInited)
  135. {
  136. return;
  137. }
  138. float value = UIProgressBar.current.value;
  139. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.AutoSpeed, value);
  140. }
  141. public void OnMasterVolumeChange()
  142. {
  143. if (!this.m_bInited)
  144. {
  145. return;
  146. }
  147. float value = UIProgressBar.current.value;
  148. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.MasterVolume, value);
  149. }
  150. public void OnSystemVolumeChange()
  151. {
  152. if (!this.m_bInited)
  153. {
  154. return;
  155. }
  156. float value = UIProgressBar.current.value;
  157. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.SystemVolume, value);
  158. }
  159. public void OnMusicVolumeChange()
  160. {
  161. if (!this.m_bInited)
  162. {
  163. return;
  164. }
  165. float value = UIProgressBar.current.value;
  166. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.MusicVolume, value);
  167. }
  168. public void OnDanceVolumeChange()
  169. {
  170. if (!this.m_bInited)
  171. {
  172. return;
  173. }
  174. float value = UIProgressBar.current.value;
  175. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.DanceVolume, value);
  176. }
  177. public void OnVoiceVolumeChange()
  178. {
  179. if (!this.m_bInited)
  180. {
  181. return;
  182. }
  183. float value = UIProgressBar.current.value;
  184. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.VoiceVolume, value);
  185. }
  186. public void OnSoundEffectVolumeChange()
  187. {
  188. if (!this.m_bInited)
  189. {
  190. return;
  191. }
  192. float value = UIProgressBar.current.value;
  193. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.SoundEffectVolume, value);
  194. }
  195. public void OnSoundEnvironmentVolumeChange()
  196. {
  197. if (!this.m_bInited)
  198. {
  199. return;
  200. }
  201. float value = UIProgressBar.current.value;
  202. this.m_configCtrl.ChangeSliderValue(ConfigMgr.SliderType.SoundEnvironmentVolume, value);
  203. }
  204. public void OnAlreadyReadSkipEnabled()
  205. {
  206. this.m_configCtrl.SetAlreadyReadSkipEnabled(true);
  207. }
  208. public void OnAlreadyReadSkipDisabled()
  209. {
  210. this.m_configCtrl.SetAlreadyReadSkipEnabled(false);
  211. }
  212. public void OnSequentialVoiceEnabled()
  213. {
  214. this.m_configCtrl.SetSequentialVoiceEnabled(true);
  215. }
  216. public void OnSequentialVoiceDisabled()
  217. {
  218. this.m_configCtrl.SetSequentialVoiceEnabled(false);
  219. }
  220. public void SetEjaculationSeEnabled()
  221. {
  222. this.m_configCtrl.SetEjaculationSeEnabled(true);
  223. }
  224. public void SetEjaculationSeDisabled()
  225. {
  226. this.m_configCtrl.SetEjaculationSeEnabled(false);
  227. }
  228. public void OnMusic3DActive()
  229. {
  230. this.m_configCtrl.SetMusic3DActive();
  231. }
  232. public void OnVoice3DActive()
  233. {
  234. this.m_configCtrl.SetVoice3DActive();
  235. }
  236. public void OnSoundEffect3DActive()
  237. {
  238. this.m_configCtrl.SetSoundEffect3DActive();
  239. }
  240. public void OnSoundEnvironment3DActive()
  241. {
  242. this.m_configCtrl.SetSoundEnvironment3DActive();
  243. }
  244. public void OpenConfigPanel()
  245. {
  246. if (!this.m_bInited)
  247. {
  248. this.Init();
  249. }
  250. this.m_configCtrl.LoadConfigData();
  251. this.m_configCtrl.SetOKButtonActive(true);
  252. this.m_goPanel.SetActive(true);
  253. TweenAlpha tweenAlpha = this.m_goPanel.AddComponent<TweenAlpha>();
  254. tweenAlpha.from = 0f;
  255. tweenAlpha.to = 1f;
  256. tweenAlpha.duration = 0.3f;
  257. tweenAlpha.PlayForward();
  258. }
  259. public void CloseConfigPanel()
  260. {
  261. this.m_configCtrl.SetOKButtonActive(false);
  262. this.cblConfig.OnClose();
  263. TweenAlpha tweenAlpha = TweenAlpha.Begin(this.m_goPanel, 0.3f, 0f);
  264. EventDelegate.Set(tweenAlpha.onFinished, delegate
  265. {
  266. this.m_goPanel.SetActive(false);
  267. });
  268. GameMain.Instance.BroadcastMessage("OnChangeScreenSizeOrAA", SendMessageOptions.DontRequireReceiver);
  269. }
  270. public void ChangeNormalConfig()
  271. {
  272. this.m_configCtrl.SetContentsVisible(true);
  273. this.cblConfig.visible = false;
  274. }
  275. public void ChangeCBLConfig()
  276. {
  277. this.m_configCtrl.SetContentsVisible(false);
  278. this.cblConfig.visible = true;
  279. }
  280. [SerializeField]
  281. public ConfigCblManager cblConfig;
  282. private ConfigCtrl m_configCtrl;
  283. private const float DURATION_TO_FADE = 0.3f;
  284. private UIPanel m_uiPanel;
  285. private bool m_bInited;
  286. public enum SliderType
  287. {
  288. Bloom,
  289. PlayerModelTransparency,
  290. MessageWindowTransparency,
  291. TextSpeed,
  292. AutoSpeed,
  293. MasterVolume,
  294. SystemVolume,
  295. MusicVolume,
  296. DanceVolume,
  297. VoiceVolume,
  298. SoundEffectVolume,
  299. SoundEnvironmentVolume
  300. }
  301. }