using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;

public class ConfigCtrl : MonoBehaviour
{
	public void Init(GameObject configPanel)
	{
		this.m_sysBtnShowAlwaysOn = UTY.GetChildObject(configPanel, "System/SysButtonShowAlways/On", false).GetComponent<UIButton>();
		this.m_sysBtnShowAlwaysOff = UTY.GetChildObject(configPanel, "System/SysButtonShowAlways/Off", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_sysBtnShowAlwaysOn.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSysButtonShowAlwaysEnabled));
		EventDelegate.Add(this.m_sysBtnShowAlwaysOff.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSysButtonShowAlwaysDisabled));
		UTY.GetChildObject(configPanel, "CategorySwitch", false).SetActive(false);
		GameObject childObject = UTY.GetChildObject(configPanel, "Screen", false);
		this.m_fullScreenOn = UTY.GetChildObject(childObject, "FullScreen/On", false).GetComponent<UIButton>();
		this.m_fullScreenOff = UTY.GetChildObject(childObject, "FullScreen/Off", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_fullScreenOn.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnFullScreenEnabled));
		EventDelegate.Add(this.m_fullScreenOff.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnFullScreenDisabled));
		this.m_plResolution = UTY.GetChildObject(childObject, "Resolution/PopupList", false).GetComponent<UIPopupList>();
		List<Size<int>> list = this.MakeResolutionPopupList();
		foreach (Size<int> size in list)
		{
			this.m_plResolution.items.Add(this.ToResolutionOption(size));
		}
		EventDelegate.Add(this.m_plResolution.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnResolutionChange));
		this.m_plAntiAlias = UTY.GetChildObject(childObject, "AntiAlias/PopupList", false).GetComponent<UIPopupList>();
		IEnumerator enumerator2 = Enum.GetValues(typeof(CMSystem.AntiAliasType)).GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				object obj = enumerator2.Current;
				this.MakePopupListOption(this.m_plAntiAlias, obj.ToString());
			}
		}
		finally
		{
			IDisposable disposable;
			if ((disposable = (enumerator2 as IDisposable)) != null)
			{
				disposable.Dispose();
			}
		}
		EventDelegate.Add(this.m_plAntiAlias.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnAntiAliasChange));
		this.m_plShadowQuality = UTY.GetChildObject(childObject, "ShadowQuality/PopupList", false).GetComponent<UIPopupList>();
		IEnumerator enumerator3 = Enum.GetValues(typeof(CMSystem.ShadowQualityType)).GetEnumerator();
		try
		{
			while (enumerator3.MoveNext())
			{
				object obj2 = enumerator3.Current;
				this.MakePopupListOption(this.m_plShadowQuality, obj2.ToString());
			}
		}
		finally
		{
			IDisposable disposable2;
			if ((disposable2 = (enumerator3 as IDisposable)) != null)
			{
				disposable2.Dispose();
			}
		}
		EventDelegate.Add(this.m_plShadowQuality.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnShadowQualityChange));
		this.m_plTextureQuality = UTY.GetChildObject(childObject, "TextureQuality/PopupList", false).GetComponent<UIPopupList>();
		IEnumerator enumerator4 = Enum.GetValues(typeof(CMSystem.TextureQualityType)).GetEnumerator();
		try
		{
			while (enumerator4.MoveNext())
			{
				object obj3 = enumerator4.Current;
				this.MakePopupListOption(this.m_plTextureQuality, obj3.ToString());
			}
		}
		finally
		{
			IDisposable disposable3;
			if ((disposable3 = (enumerator4 as IDisposable)) != null)
			{
				disposable3.Dispose();
			}
		}
		EventDelegate.Add(this.m_plTextureQuality.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnTextureQualityChange));
		this.m_fpsDisplayOn = UTY.GetChildObject(childObject, "FpsDisplay/On", false).GetComponent<UIButton>();
		this.m_fpsDisplayOff = UTY.GetChildObject(childObject, "FpsDisplay/Off", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_fpsDisplayOn.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnFpsDisplayEnabled));
		EventDelegate.Add(this.m_fpsDisplayOff.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnFpsDisplayDisabled));
		this.m_slBloom = UTY.GetChildObject(childObject, "Bloom/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slBloom.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnBloomChange));
		this.m_plCaptureMagnification = UTY.GetChildObject(childObject, "CaptureMagnification/PopupList", false).GetComponent<UIPopupList>();
		IEnumerator enumerator5 = Enum.GetValues(typeof(CMSystem.SSSuperSizeType)).GetEnumerator();
		try
		{
			while (enumerator5.MoveNext())
			{
				object obj4 = enumerator5.Current;
				this.MakePopupListOption(this.m_plCaptureMagnification, obj4.ToString());
			}
		}
		finally
		{
			IDisposable disposable4;
			if ((disposable4 = (enumerator5 as IDisposable)) != null)
			{
				disposable4.Dispose();
			}
		}
		EventDelegate.Add(this.m_plCaptureMagnification.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnCaptureMagnificationChange));
		this.m_slPlayerModelTransparency = UTY.GetChildObject(childObject, "PlayerModelTransparency/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slPlayerModelTransparency.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnPlayerModelTransparencyChange));
		GameObject childObject2 = UTY.GetChildObject(configPanel, "Message", false);
		this.m_slMessageWindowTransparency = UTY.GetChildObject(childObject2, "MessageWindowTransparency/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slMessageWindowTransparency.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnMessageWindowTransparencyChange));
		this.m_slTextSpeed = UTY.GetChildObject(childObject2, "TextSpeed/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slTextSpeed.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnTextSpeedChange));
		this.m_slAutoSpeed = UTY.GetChildObject(childObject2, "AutoSpeed/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slAutoSpeed.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnAutoSpeedChange));
		this.m_sequentialVoiceOn = UTY.GetChildObject(childObject2, "SequentialVoice/On", false).GetComponent<UIButton>();
		this.m_sequentialVoiceOff = UTY.GetChildObject(childObject2, "SequentialVoice/Off", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_sequentialVoiceOn.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSequentialVoiceEnabled));
		EventDelegate.Add(this.m_sequentialVoiceOff.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSequentialVoiceDisabled));
		this.m_plSubtitleType = UTY.GetChildObject(childObject2, "Subtitle/PopupList", false).GetComponent<UIPopupList>();
		IEnumerator enumerator6 = Enum.GetValues(typeof(SubtitleDisplayManager.DisplayType)).GetEnumerator();
		try
		{
			while (enumerator6.MoveNext())
			{
				object obj5 = enumerator6.Current;
				this.MakePopupListOption(this.m_plSubtitleType, SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)obj5));
			}
		}
		finally
		{
			IDisposable disposable5;
			if ((disposable5 = (enumerator6 as IDisposable)) != null)
			{
				disposable5.Dispose();
			}
		}
		EventDelegate.Add(this.m_plSubtitleType.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSubtitleDisplayTypeChange));
		childObject2.GetComponent<UISprite>().enabled = false;
		UTY.GetChildObject(childObject2, "Frame2", false).SetActive(true);
		GameObject childObject3 = UTY.GetChildObject(configPanel, "Sound", false);
		this.m_slMasterVolume = UTY.GetChildObject(childObject3, "MasterVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slMasterVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnMasterVolumeChange));
		this.m_slSystemVolume = UTY.GetChildObject(childObject3, "SystemVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slSystemVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSystemVolumeChange));
		this.m_slMusicVolume = UTY.GetChildObject(childObject3, "MusicVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slMusicVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnMusicVolumeChange));
		this.m_slDanceVolume = UTY.GetChildObject(childObject3, "DanceVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slDanceVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnDanceVolumeChange));
		this.m_music3d = UTY.GetChildObject(childObject3, "MusicVolume/3D", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_music3d.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnMusic3DActive));
		this.m_slVoiceVolume = UTY.GetChildObject(childObject3, "VoiceVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slVoiceVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnVoiceVolumeChange));
		this.m_voice3d = UTY.GetChildObject(childObject3, "VoiceVolume/3D", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_voice3d.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnVoice3DActive));
		this.m_slSoundEffectVolume = UTY.GetChildObject(childObject3, "SoundEffectVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slSoundEffectVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSoundEffectVolumeChange));
		this.m_soundEffect3d = UTY.GetChildObject(childObject3, "SoundEffectVolume/3D", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_soundEffect3d.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSoundEffect3DActive));
		this.m_slSoundEnvironmentVolume = UTY.GetChildObject(childObject3, "SoundEnvironmentVolume/Slider", false).GetComponent<UISlider>();
		EventDelegate.Add(this.m_slSoundEnvironmentVolume.onChange, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSoundEnvironmentVolumeChange));
		this.m_soundEnvironment3d = UTY.GetChildObject(childObject3, "SoundEnvironmentVolume/3D", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_soundEnvironment3d.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.OnSoundEnvironment3DActive));
		this.m_ejaculationSeEnabledOn = UTY.GetChildObject(childObject3, "EjaculationSeEnabled/On", false).GetComponent<UIButton>();
		this.m_ejaculationSeEnabledOff = UTY.GetChildObject(childObject3, "EjaculationSeEnabled/Off", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_ejaculationSeEnabledOn.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.SetEjaculationSeEnabled));
		EventDelegate.Add(this.m_ejaculationSeEnabledOff.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.SetEjaculationSeDisabled));
		this.m_okButton = UTY.GetChildObject(configPanel, "OK", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_okButton.onClick, new EventDelegate.Callback(BaseMgr<ConfigMgr>.Instance.CloseConfigPanel));
		this.m_changeVRConfigButton = UTY.GetChildObject(configPanel, "Change VR", false).GetComponent<UIButton>();
		EventDelegate.Add(this.m_changeVRConfigButton.onClick, delegate()
		{
			BaseMgr<ConfigMgr>.Instance.CloseConfigPanel();
			ConfigVRCtrl.Open(null);
		});
		this.activeColor = new Color(this.m_sysBtnShowAlwaysOn.defaultColor.r, this.m_sysBtnShowAlwaysOn.defaultColor.g, this.m_sysBtnShowAlwaysOn.defaultColor.b, 1f);
		this.inActiveColor = this.m_sysBtnShowAlwaysOn.defaultColor;
		this.LoadConfigData();
	}

	private void MakePopupListOption(UIPopupList popupList, string option)
	{
		if (option != "MAX")
		{
			popupList.items.Add(option);
		}
	}

	private List<Size<int>> MakeResolutionPopupList()
	{
		List<Size<int>> screenSizeList = GameMain.Instance.CMSystem.GetScreenSizeList();
		Size<int> screenSizeNow = GameMain.Instance.CMSystem.GetScreenSizeNow();
		if (!screenSizeList.Contains(screenSizeNow))
		{
			screenSizeList.Add(screenSizeNow);
		}
		return screenSizeList;
	}

	public void LoadConfigData()
	{
		bool sysButtonShowAlways = GameMain.Instance.CMSystem.SysButtonShowAlways;
		this.SetButtonActive(this.m_sysBtnShowAlwaysOn, this.m_sysBtnShowAlwaysOff, sysButtonShowAlways);
		Debug.Log("Load sysButtonShowAlwaysEnabled=" + sysButtonShowAlways);
		bool fullScreen = GameMain.Instance.CMSystem.FullScreen;
		this.SetButtonActive(this.m_fullScreenOn, this.m_fullScreenOff, fullScreen);
		Debug.Log("Load fullScreenEnabled=" + fullScreen);
		Size<int> screenSizeNow = GameMain.Instance.CMSystem.GetScreenSizeNow();
		this.m_plResolution.value = this.ToResolutionOption(screenSizeNow);
		CMSystem.AntiAliasType antialias = GameMain.Instance.CMSystem.Antialias;
		this.m_plAntiAlias.value = antialias.ToString();
		CMSystem.ShadowQualityType shadowQuality = GameMain.Instance.CMSystem.ShadowQuality;
		this.m_plShadowQuality.value = shadowQuality.ToString();
		CMSystem.TextureQualityType textureQuality = GameMain.Instance.CMSystem.TextureQuality;
		this.m_plTextureQuality.value = textureQuality.ToString();
		bool viewFps = GameMain.Instance.CMSystem.ViewFps;
		this.SetButtonActive(this.m_fpsDisplayOn, this.m_fpsDisplayOff, viewFps);
		Debug.Log("Load viewFpsEnabled=" + viewFps);
		int bloomValue = GameMain.Instance.CMSystem.BloomValue;
		float num = (float)Math.Round((double)((float)bloomValue / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slBloom.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load bloom Value=",
			bloomValue,
			" sliderValue=",
			num
		}));
		CMSystem.SSSuperSizeType screenShotSuperSize = GameMain.Instance.CMSystem.ScreenShotSuperSize;
		this.m_plCaptureMagnification.value = screenShotSuperSize.ToString();
		int manAlpha = GameMain.Instance.CMSystem.ManAlpha;
		num = (float)Math.Round((double)((float)manAlpha / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slPlayerModelTransparency.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load playerModelTransparency Value=",
			manAlpha,
			" sliderValue=",
			num
		}));
		int msgWndAlpha = GameMain.Instance.CMSystem.MsgWndAlpha;
		num = (float)Math.Round((double)((float)msgWndAlpha / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slMessageWindowTransparency.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load messageWindowTransparency Value :",
			msgWndAlpha,
			" sliderValue=",
			num
		}));
		int msgTextSpeed = GameMain.Instance.CMSystem.MsgTextSpeed;
		num = (float)Math.Round((double)((float)msgTextSpeed / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slTextSpeed.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load textSpeed Value :",
			msgTextSpeed,
			" sliderValue=",
			num
		}));
		int msgAutoSpeed = GameMain.Instance.CMSystem.MsgAutoSpeed;
		num = (float)Math.Round((double)((float)msgAutoSpeed / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slAutoSpeed.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load autoSpeed Value :",
			msgAutoSpeed,
			" sliderValue=",
			num
		}));
		SubtitleDisplayManager.DisplayType subtitleType = GameMain.Instance.CMSystem.SubtitleType;
		this.m_plSubtitleType.value = SubtitleDisplayManager.EnumConvert.GetTerm(subtitleType);
		bool msgVoiceNoStop = GameMain.Instance.CMSystem.MsgVoiceNoStop;
		Debug.Log("Load alreadyReadSkipEnabled:" + msgVoiceNoStop);
		this.SetButtonActive(this.m_sequentialVoiceOn, this.m_sequentialVoiceOff, msgVoiceNoStop);
		int volumeAll = GameMain.Instance.SoundMgr.GetVolumeAll();
		num = (float)Math.Round((double)((float)volumeAll / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slMasterVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load masterVolume Value :",
			volumeAll,
			" sliderValue=",
			num
		}));
		int volume = GameMain.Instance.SoundMgr.GetVolume(AudioSourceMgr.Type.System);
		num = (float)Math.Round((double)((float)volume / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slSystemVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load systemVolume Value :",
			volume,
			" sliderValue=",
			num
		}));
		int volume2 = GameMain.Instance.SoundMgr.GetVolume(AudioSourceMgr.Type.Bgm);
		num = (float)Math.Round((double)((float)volume2 / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slMusicVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load musicVolume Value :",
			volume2,
			" sliderValue=",
			num
		}));
		int volumeDance = GameMain.Instance.SoundMgr.GetVolumeDance();
		num = (float)Math.Round((double)((float)volumeDance / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slDanceVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load danceVolume Value :",
			volumeDance,
			" sliderValue=",
			num
		}));
		int volume3 = GameMain.Instance.SoundMgr.GetVolume(AudioSourceMgr.Type.Voice);
		num = (float)Math.Round((double)((float)volume3 / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slVoiceVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load voiceVolume Value :",
			volume3,
			" sliderValue=",
			num
		}));
		int volume4 = GameMain.Instance.SoundMgr.GetVolume(AudioSourceMgr.Type.Se);
		num = (float)Math.Round((double)((float)volume4 / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slSoundEffectVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load soundEffectVolume Value :",
			volume4,
			" sliderValue=",
			num
		}));
		int volume5 = GameMain.Instance.SoundMgr.GetVolume(AudioSourceMgr.Type.Env);
		num = (float)Math.Round((double)((float)volume5 / 100f), 2, MidpointRounding.AwayFromZero);
		this.m_slSoundEnvironmentVolume.value = num;
		Debug.Log(string.Concat(new object[]
		{
			"Load soundEnvironmentVolume Value :",
			volume5,
			" sliderValue=",
			num
		}));
		bool threeD = GameMain.Instance.SoundMgr.GetThreeD(AudioSourceMgr.Type.Voice);
		Debug.Log("Load voice3dEnabled:" + threeD);
		this.SetToggleButtonActive(this.m_voice3d, threeD);
		bool threeD2 = GameMain.Instance.SoundMgr.GetThreeD(AudioSourceMgr.Type.Se);
		Debug.Log("Load soundEffect3dEnabled:" + threeD2);
		this.SetToggleButtonActive(this.m_soundEffect3d, threeD2);
		bool threeD3 = GameMain.Instance.SoundMgr.GetThreeD(AudioSourceMgr.Type.Env);
		Debug.Log("Load soundEnvironment3dEnabled:" + threeD3);
		this.SetToggleButtonActive(this.m_soundEnvironment3d, threeD3);
		bool ejaculationSeEnabled = GameMain.Instance.CMSystem.EjaculationSeEnabled;
		Debug.Log("Load EjaculationSeEnabled:" + ejaculationSeEnabled);
		this.SetButtonActive(this.m_ejaculationSeEnabledOn, this.m_ejaculationSeEnabledOff, ejaculationSeEnabled);
	}

	private void SetButtonActive(UIButton ActiveButton, UIButton InActiveButton, bool active)
	{
		if (active)
		{
			this.SetButtonActive(ActiveButton, InActiveButton);
		}
		else
		{
			this.SetButtonActive(InActiveButton, ActiveButton);
		}
	}

	private string ToResolutionOption(Size<int> size)
	{
		return string.Format("{0}x{1}", size.width, size.height);
	}

	private void SetButtonActive(UIButton activeButton, UIButton inActiveButton)
	{
		activeButton.defaultColor = this.activeColor;
		inActiveButton.defaultColor = this.inActiveColor;
	}

	private void InvertButtonActive(UIButton toggleButton, bool wasActive)
	{
		if (wasActive)
		{
			toggleButton.defaultColor = this.inActiveColor;
		}
		else
		{
			toggleButton.defaultColor = this.activeColor;
		}
	}

	private void SetToggleButtonActive(UIButton toggleButton, bool active)
	{
		if (active)
		{
			toggleButton.defaultColor = this.activeColor;
		}
		else
		{
			toggleButton.defaultColor = this.inActiveColor;
		}
	}

	public void SetButtonShowAlwaysEnabled(bool enabled)
	{
		this.SetButtonActive(this.m_sysBtnShowAlwaysOn, this.m_sysBtnShowAlwaysOff, enabled);
		GameMain.Instance.CMSystem.SysButtonShowAlways = enabled;
		GameMain.Instance.CMSystem.ConfigSystemApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "SysButtonShowAlways", enabled));
	}

	public void SetFullScreenEnabled(bool enabled)
	{
		this.SetButtonActive(this.m_fullScreenOn, this.m_fullScreenOff, enabled);
		GameMain.Instance.CMSystem.FullScreen = enabled;
		GameMain.Instance.CMSystem.ConfigScreenApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "FullScreen", enabled));
	}

	public void SetFpsDisplayEnabled(bool enabled)
	{
		this.SetButtonActive(this.m_fpsDisplayOn, this.m_fpsDisplayOff, enabled);
		GameMain.Instance.CMSystem.ViewFps = enabled;
		GameMain.Instance.CMSystem.ConfigScreenApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "ViewFps", enabled));
	}

	public void SetAlreadyReadSkipEnabled(bool enabled)
	{
		this.SetButtonActive(this.m_alreadyReadSkipOn, this.m_alreadyReadSkipOff, enabled);
		GameMain.Instance.CMSystem.MsgAlreadySkip = enabled;
		GameMain.Instance.CMSystem.ConfigSystemApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "MsgAlreadySkip", enabled));
	}

	public void SetSequentialVoiceEnabled(bool enabled)
	{
		this.SetButtonActive(this.m_sequentialVoiceOn, this.m_sequentialVoiceOff, enabled);
		GameMain.Instance.CMSystem.MsgVoiceNoStop = enabled;
		GameMain.Instance.CMSystem.ConfigSystemApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "MsgVoiceNoStop", enabled));
	}

	public void SetEjaculationSeEnabled(bool enabled)
	{
		this.SetButtonActive(this.m_ejaculationSeEnabledOn, this.m_ejaculationSeEnabledOff, enabled);
		GameMain.Instance.CMSystem.EjaculationSeEnabled = enabled;
		GameMain.Instance.CMSystem.ConfigSystemApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "EjaculationSeEnabled", enabled));
	}

	public void SetMusic3DActive()
	{
		this.SetSound3DActive(this.m_music3d, AudioSourceMgr.Type.Bgm);
	}

	public void SetVoice3DActive()
	{
		this.SetSound3DActive(this.m_voice3d, AudioSourceMgr.Type.Voice);
	}

	public void SetSoundEffect3DActive()
	{
		this.SetSound3DActive(this.m_soundEffect3d, AudioSourceMgr.Type.Se);
	}

	public void SetSoundEnvironment3DActive()
	{
		this.SetSound3DActive(this.m_soundEnvironment3d, AudioSourceMgr.Type.Env);
	}

	private void SetSound3DActive(UIButton button, AudioSourceMgr.Type soundType)
	{
		bool threeD = GameMain.Instance.SoundMgr.GetThreeD(soundType);
		this.InvertButtonActive(button, threeD);
		GameMain.Instance.SoundMgr.SetThreeD(soundType, !threeD);
		GameMain.Instance.SoundMgr.Apply();
		Debug.Log(string.Format("{0}[3D]に{1}を設定しました。", soundType, !threeD));
	}

	public void ChangePopupListResolutionValue(string value)
	{
		value = this.DelNewlineOfSentenceEnd(value);
		Size<int> screenSize = this.ToSize(value);
		GameMain.Instance.CMSystem.SetScreenSize(screenSize);
		GameMain.Instance.CMSystem.ConfigScreenApply();
		Debug.Log(string.Format("{0}に{1}を設定しました。", "解像度", value));
	}

	private Size<int> ToSize(string value)
	{
		Size<int> result = default(Size<int>);
		int num = value.IndexOf("x");
		if (num < 0)
		{
			Debug.LogError(string.Format("不適切な解像度が設定されています。設定された解像度={0}", value));
		}
		string s = value.Substring(0, num);
		int width;
		if (int.TryParse(s, out width))
		{
			result.width = width;
		}
		else
		{
			Debug.LogError(string.Format("不適切な解像度が設定されています。設定された解像度={0}", value));
		}
		string s2 = value.Substring(num + 1);
		int height;
		if (int.TryParse(s2, out height))
		{
			result.height = height;
		}
		else
		{
			Debug.LogError(string.Format("不適切な解像度が設定されています。設定された解像度={0}", value));
		}
		return result;
	}

	public void ChangePopupListValue<PopupListType>(string value)
	{
		value = this.DelNewlineOfSentenceEnd(value);
		if (typeof(PopupListType) == typeof(CMSystem.AntiAliasType))
		{
			GameMain.Instance.CMSystem.Antialias = (CMSystem.AntiAliasType)Enum.Parse(typeof(CMSystem.AntiAliasType), value);
		}
		else if (typeof(PopupListType) == typeof(CMSystem.ShadowQualityType))
		{
			GameMain.Instance.CMSystem.ShadowQuality = (CMSystem.ShadowQualityType)Enum.Parse(typeof(CMSystem.ShadowQualityType), value);
		}
		else if (typeof(PopupListType) == typeof(CMSystem.TextureQualityType))
		{
			GameMain.Instance.CMSystem.TextureQuality = (CMSystem.TextureQualityType)Enum.Parse(typeof(CMSystem.TextureQualityType), value);
		}
		else if (typeof(PopupListType) == typeof(CMSystem.SSSuperSizeType))
		{
			GameMain.Instance.CMSystem.ScreenShotSuperSize = (CMSystem.SSSuperSizeType)Enum.Parse(typeof(CMSystem.SSSuperSizeType), value);
		}
		GameMain.Instance.CMSystem.ConfigScreenApply();
		Debug.Log(string.Format("{0}に[{1}]が設定されました。", typeof(PopupListType).ToString(), value));
	}

	public void ChangeSliderValue(ConfigMgr.SliderType sliderType, float value)
	{
		int num = (int)Math.Ceiling((double)(value * 100f));
		switch (sliderType)
		{
		case ConfigMgr.SliderType.Bloom:
			GameMain.Instance.CMSystem.BloomValue = num;
			GameMain.Instance.CMSystem.ConfigScreenApply();
			break;
		case ConfigMgr.SliderType.PlayerModelTransparency:
			GameMain.Instance.CMSystem.ManAlpha = num;
			GameMain.Instance.CMSystem.ConfigScreenApply();
			break;
		case ConfigMgr.SliderType.MessageWindowTransparency:
			GameMain.Instance.CMSystem.MsgWndAlpha = num;
			GameMain.Instance.CMSystem.ConfigSystemApply();
			break;
		case ConfigMgr.SliderType.TextSpeed:
			GameMain.Instance.CMSystem.MsgTextSpeed = num;
			GameMain.Instance.CMSystem.ConfigSystemApply();
			break;
		case ConfigMgr.SliderType.AutoSpeed:
			GameMain.Instance.CMSystem.MsgAutoSpeed = num;
			GameMain.Instance.CMSystem.ConfigSystemApply();
			break;
		case ConfigMgr.SliderType.MasterVolume:
			GameMain.Instance.SoundMgr.SetVolumeAll(num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		case ConfigMgr.SliderType.SystemVolume:
			GameMain.Instance.SoundMgr.SetVolume(AudioSourceMgr.Type.System, num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		case ConfigMgr.SliderType.MusicVolume:
			GameMain.Instance.SoundMgr.SetVolume(AudioSourceMgr.Type.Bgm, num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		case ConfigMgr.SliderType.DanceVolume:
			GameMain.Instance.SoundMgr.SetVolumeDance(num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		case ConfigMgr.SliderType.VoiceVolume:
			GameMain.Instance.SoundMgr.SetVolume(AudioSourceMgr.Type.Voice, num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		case ConfigMgr.SliderType.SoundEffectVolume:
			GameMain.Instance.SoundMgr.SetVolume(AudioSourceMgr.Type.Se, num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		case ConfigMgr.SliderType.SoundEnvironmentVolume:
			GameMain.Instance.SoundMgr.SetVolume(AudioSourceMgr.Type.Env, num);
			GameMain.Instance.SoundMgr.Apply();
			break;
		default:
			Debug.LogError(string.Format("不適切な項目が変更されました。変更しようとした項目={0}", sliderType));
			break;
		}
		Debug.Log(string.Format("{0}の値に[{1}]が設定されました。", sliderType.ToString(), num));
	}

	public void SetOKButtonActive(bool active)
	{
		this.m_okButton.enabled = active;
	}

	public void SetContentsVisible(bool value)
	{
		string[] array = new string[]
		{
			"System",
			"Screen",
			"Message",
			"Sound"
		};
		foreach (string f_strObjName in array)
		{
			UTY.GetChildObject(base.gameObject, f_strObjName, false).SetActive(value);
		}
	}

	private string DelNewlineOfSentenceEnd(string str)
	{
		return Regex.Replace(str, "[\\r\\n]+$", string.Empty);
	}

	public UIPopupList m_plSubtitleType;

	private UIPopupList m_resolution;

	private UIPopupList m_plResolution;

	private UIPopupList m_plAntiAlias;

	private UIPopupList m_plShadowQuality;

	private UIPopupList m_plTextureQuality;

	private UIPopupList m_plCaptureMagnification;

	private UISlider m_volume;

	private UISlider m_slSystemVolume;

	private UISlider m_slBloom;

	private UISlider m_slPlayerModelTransparency;

	private UISlider m_slMessageWindowTransparency;

	private UISlider m_slTextSpeed;

	private UISlider m_slAutoSpeed;

	private UISlider m_slMasterVolume;

	private UISlider m_slMusicVolume;

	private UISlider m_slDanceVolume;

	private UISlider m_slVoiceVolume;

	private UISlider m_slSoundEffectVolume;

	private UISlider m_slSoundEnvironmentVolume;

	private UIButton m_sysBtnShowAlwaysOn;

	private UIButton m_sysBtnShowAlwaysOff;

	private UIButton m_fullScreenOn;

	private UIButton m_fullScreenOff;

	private UIButton m_fpsDisplayOn;

	private UIButton m_fpsDisplayOff;

	private UIButton m_alreadyReadSkipOn;

	private UIButton m_alreadyReadSkipOff;

	private UIButton m_sequentialVoiceOn;

	private UIButton m_sequentialVoiceOff;

	private UIButton m_ejaculationSeEnabledOn;

	private UIButton m_ejaculationSeEnabledOff;

	private UIButton m_music3d;

	private UIButton m_voice3d;

	private UIButton m_soundEffect3d;

	private UIButton m_soundEnvironment3d;

	private UIButton m_okButton;

	private UIButton m_changeVRConfigButton;

	private Color activeColor;

	private Color inActiveColor;

	private const string RESOLUTION_MARK = "x";

	private const string ENUM_MAX_MARK = "MAX";

	private const int COEFFICIENT = 100;

	private class Resolution
	{
		public int width;

		public int height;
	}
}
