ConfigMgr.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class ConfigMgr : BaseMgr<ConfigMgr>
  5. {
  6. private void Init()
  7. {
  8. string rootPath = "__GameMain__/SystemUI Root";
  9. this.m_goPanel = base.GetPanel("ConfigPanel", rootPath);
  10. this.configMgr.Init(this.cblConfig);
  11. this.m_uiPanel = this.m_goPanel.GetComponent<UIPanel>();
  12. this.m_goPanel.SetActive(false);
  13. this.m_bInited = true;
  14. }
  15. public bool IsOpenConfigPanel()
  16. {
  17. return !(this.m_goPanel == null) && this.m_goPanel.activeSelf;
  18. }
  19. public void SubtitleDisplayTypeChange(string typeName)
  20. {
  21. IEnumerator enumerator = Enum.GetValues(typeof(SubtitleDisplayManager.DisplayType)).GetEnumerator();
  22. try
  23. {
  24. while (enumerator.MoveNext())
  25. {
  26. object obj = enumerator.Current;
  27. string term = SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)obj);
  28. if (typeName == term)
  29. {
  30. GameMain.Instance.CMSystem.SubtitleType = (SubtitleDisplayManager.DisplayType)obj;
  31. break;
  32. }
  33. }
  34. }
  35. finally
  36. {
  37. IDisposable disposable;
  38. if ((disposable = (enumerator as IDisposable)) != null)
  39. {
  40. disposable.Dispose();
  41. }
  42. }
  43. }
  44. public void OpenConfigPanel()
  45. {
  46. if (!this.m_bInited)
  47. {
  48. this.Init();
  49. }
  50. this.configMgr.LoadConfig();
  51. this.configMgr.SetCloseButtonActive(true);
  52. this.m_goPanel.SetActive(true);
  53. TweenAlpha tweenAlpha = this.m_goPanel.AddComponent<TweenAlpha>();
  54. tweenAlpha.from = 0f;
  55. tweenAlpha.to = 1f;
  56. tweenAlpha.duration = 0.3f;
  57. tweenAlpha.PlayForward();
  58. }
  59. public void CloseConfigPanel()
  60. {
  61. this.configMgr.SetCloseButtonActive(false);
  62. this.cblConfig.OnClose();
  63. TweenAlpha tweenAlpha = TweenAlpha.Begin(this.m_goPanel, 0.3f, 0f);
  64. EventDelegate.Set(tweenAlpha.onFinished, delegate()
  65. {
  66. this.m_goPanel.SetActive(false);
  67. });
  68. GameMain.Instance.BroadcastMessage("OnChangeScreenSizeOrAA", SendMessageOptions.DontRequireReceiver);
  69. }
  70. public void Update()
  71. {
  72. if (Product.supportMultiLanguage)
  73. {
  74. int num = int.MinValue;
  75. if (Input.GetKeyDown(KeyCode.F1))
  76. {
  77. num = 1;
  78. }
  79. else if (Input.GetKeyDown(KeyCode.F2))
  80. {
  81. num = 2;
  82. }
  83. else if (Input.GetKeyDown(KeyCode.F3))
  84. {
  85. num = 3;
  86. }
  87. if (num != -2147483648)
  88. {
  89. if (this.configMgr == null)
  90. {
  91. GameMain.Instance.CMSystem.SubtitleType = (SubtitleDisplayManager.DisplayType)num;
  92. }
  93. else
  94. {
  95. this.configMgr.subtitleTypePopupList.value = SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)num);
  96. }
  97. }
  98. }
  99. }
  100. [SerializeField]
  101. private ConfigManager configMgr;
  102. [SerializeField]
  103. public ConfigCblManager cblConfig;
  104. private const float DURATION_TO_FADE = 0.3f;
  105. private UIPanel m_uiPanel;
  106. private bool m_bInited;
  107. }