ConfigMgr.cs 8.0 KB

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