123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- using System;
- using System.Collections;
- using UnityEngine;
- public class ConfigMgr : BaseMgr<ConfigMgr>
- {
- private void Init()
- {
- string rootPath = "__GameMain__/SystemUI Root";
- this.m_goPanel = base.GetPanel("ConfigPanel", rootPath);
- this.configMgr.Init(this.cblConfig);
- this.m_uiPanel = this.m_goPanel.GetComponent<UIPanel>();
- this.m_goPanel.SetActive(false);
- this.m_bInited = true;
- }
- public bool IsOpenConfigPanel()
- {
- return !(this.m_goPanel == null) && this.m_goPanel.activeSelf;
- }
- public void SubtitleDisplayTypeChange(string typeName)
- {
- IEnumerator enumerator = Enum.GetValues(typeof(SubtitleDisplayManager.DisplayType)).GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- string term = SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)obj);
- if (typeName == term)
- {
- GameMain.Instance.CMSystem.SubtitleType = (SubtitleDisplayManager.DisplayType)obj;
- break;
- }
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- public void OpenConfigPanel()
- {
- if (!this.m_bInited)
- {
- this.Init();
- }
- this.configMgr.LoadConfig();
- this.configMgr.SetCloseButtonActive(true);
- this.m_goPanel.SetActive(true);
- TweenAlpha tweenAlpha = this.m_goPanel.AddComponent<TweenAlpha>();
- tweenAlpha.from = 0f;
- tweenAlpha.to = 1f;
- tweenAlpha.duration = 0.3f;
- tweenAlpha.PlayForward();
- }
- public void CloseConfigPanel()
- {
- this.configMgr.SetCloseButtonActive(false);
- this.cblConfig.OnClose();
- TweenAlpha tweenAlpha = TweenAlpha.Begin(this.m_goPanel, 0.3f, 0f);
- EventDelegate.Set(tweenAlpha.onFinished, delegate()
- {
- this.m_goPanel.SetActive(false);
- });
- GameMain.Instance.BroadcastMessage("OnChangeScreenSizeOrAA", SendMessageOptions.DontRequireReceiver);
- }
- public void Update()
- {
- if (Product.supportMultiLanguage)
- {
- int num = int.MinValue;
- if (Input.GetKeyDown(KeyCode.F1))
- {
- num = 1;
- }
- else if (Input.GetKeyDown(KeyCode.F2))
- {
- num = 2;
- }
- else if (Input.GetKeyDown(KeyCode.F3))
- {
- num = 3;
- }
- if (num != -2147483648)
- {
- if (this.configMgr == null)
- {
- GameMain.Instance.CMSystem.SubtitleType = (SubtitleDisplayManager.DisplayType)num;
- }
- else
- {
- this.configMgr.subtitleTypePopupList.value = SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)num);
- }
- }
- }
- }
- [SerializeField]
- private ConfigManager configMgr;
- [SerializeField]
- public ConfigCblManager cblConfig;
- private const float DURATION_TO_FADE = 0.3f;
- private UIPanel m_uiPanel;
- private bool m_bInited;
- }
|