using System; using System.Collections; using System.Collections.Generic; using System.Text.RegularExpressions; using UnityEngine; public class ConfigManager : MonoBehaviour { public UIPopupList subtitleTypePopupList { get { return this.subtitleType; } } public void Init(ConfigCblManager cblConfigMgr) { this.cblConfigMgr = cblConfigMgr; ConfigManager.CategoryButton[] array = this.categoryTabButtons; for (int i = 0; i < array.Length; i++) { ConfigManager.CategoryButton categoryData = array[i]; if (categoryData.type == ConfigManager.CategoryButton.Type.System) { this.OnClickCategoryTabButton(categoryData); } EventDelegate.Add(categoryData.tab.onClick, delegate() { this.OnClickCategoryTabButton(categoryData); }); if (categoryData.type == ConfigManager.CategoryButton.Type.ChuBLip) { categoryData.tab.gameObject.SetActive(false); } } KeyValuePair rootItem = this.GetRootItem(this.deviceSelect.gameObject); UIGrid key = rootItem.Key; GameObject value = rootItem.Value; if (value != null) { value.gameObject.SetActive(false); } if (key != null) { key.repositionNow = true; } if (!Product.supportMultiLanguage) { this.systemFrame.height -= 72; } EventDelegate.Add(this.closeButton.onClick, new EventDelegate.Callback(BaseMgr.Instance.CloseConfigPanel)); EventDelegate.Add(this.vrConfigButton.onClick, delegate() { BaseMgr.Instance.CloseConfigPanel(); ConfigVRCtrl.Open(null); }); Action action = delegate(ConfigSelectButton button) { button.Initialize(); this.selectButtons.Add(button); }; Action intSliderInit = delegate(ConfigIntegerSlider slider) { slider.Initialize(); this.intSliders.Add(slider); }; Action action2 = delegate(ConfigIntegerSlider slider, AudioSourceMgr.Type type) { intSliderInit(slider); slider.onGetValue = (() => GameMain.Instance.SoundMgr.GetVolume(type)); slider.onSetValue = delegate(int setValue) { GameMain.Instance.SoundMgr.SetVolume(type, setValue); GameMain.Instance.SoundMgr.Apply(); }; }; Action action3 = delegate(WFCheckBox checkBox, AudioSourceMgr.Type type) { checkBox.onClick.Add(delegate(WFCheckBox clickCheckBox) { GameMain.Instance.SoundMgr.SetThreeD(type, clickCheckBox.check); GameMain.Instance.SoundMgr.Apply(); }); }; action(this.systemButtonVisible); this.systemButtonVisible.onGetValue = (() => GameMain.Instance.CMSystem.SysButtonShowAlways); this.systemButtonVisible.onSetValue = delegate(bool setValue) { GameMain.Instance.CMSystem.SysButtonShowAlways = setValue; }; action(this.screenMode); this.screenMode.onGetValue = (() => GameMain.Instance.CMSystem.FullScreen); this.screenMode.onSetValue = delegate(bool setValue) { GameMain.Instance.CMSystem.FullScreen = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }; action(this.drawFPS); this.drawFPS.onGetValue = (() => GameMain.Instance.CMSystem.ViewFps); this.drawFPS.onSetValue = delegate(bool setValue) { GameMain.Instance.CMSystem.ViewFps = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }; action(this.sequentialVoice); this.sequentialVoice.onGetValue = (() => GameMain.Instance.CMSystem.MsgVoiceNoStop); this.sequentialVoice.onSetValue = delegate(bool setValue) { GameMain.Instance.CMSystem.MsgVoiceNoStop = setValue; }; action(this.ejaculationSe); this.ejaculationSe.onGetValue = (() => GameMain.Instance.CMSystem.EjaculationSeEnabled); this.ejaculationSe.onSetValue = delegate(bool setValue) { GameMain.Instance.CMSystem.EjaculationSeEnabled = setValue; }; if (Product.isPublic) { this.ejaculationSe.gameObject.SetActive(false); } action(this.yotogiSubtitleVisible); this.yotogiSubtitleVisible.onGetValue = (() => GameMain.Instance.CMSystem.YotogiSubtitleVisible); this.yotogiSubtitleVisible.onSetValue = delegate(bool setValue) { GameMain.Instance.CMSystem.YotogiSubtitleVisible = setValue; }; if (!Product.supportMultiLanguage || Product.isPublic) { this.yotogiSubtitleVisible.gameObject.SetActive(false); } foreach (Size size in this.MakeResolutionPopupList()) { this.screenResolution.items.Add(string.Format("{0}x{1}", size.width, size.height)); } EventDelegate.Add(this.screenResolution.onChange, delegate() { string currentPopupListValue = this.GetCurrentPopupListValue(); Size screenSize = this.ResolutionTextToSize(currentPopupListValue); GameMain.Instance.CMSystem.SetScreenSize(screenSize); GameMain.Instance.CMSystem.ConfigScreenApply(); }); this.CreateEnumPopupList(this.captureMagnification, delegate(CMSystem.SSSuperSizeType setValue) { GameMain.Instance.CMSystem.ScreenShotSuperSize = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }); this.CreateEnumPopupList(this.antiAlias, delegate(CMSystem.AntiAliasType setValue) { GameMain.Instance.CMSystem.Antialias = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }); this.CreateEnumPopupList(this.shadowQuality, delegate(CMSystem.ShadowQualityType setValue) { GameMain.Instance.CMSystem.ShadowQuality = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }); this.CreateEnumPopupList(this.textureQuality, delegate(CMSystem.TextureQualityType setValue) { GameMain.Instance.CMSystem.TextureQuality = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }); if (this.subtitleType != null) { if (Product.supportMultiLanguage) { IEnumerator enumerator2 = Enum.GetValues(typeof(SubtitleDisplayManager.DisplayType)).GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj = enumerator2.Current; if ((SubtitleDisplayManager.DisplayType)obj != SubtitleDisplayManager.DisplayType.None) { this.subtitleType.AddItem(SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)obj)); } } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } EventDelegate.Add(this.subtitleType.onChange, delegate() { string currentPopupListValue = this.GetCurrentPopupListValue(); IEnumerator enumerator4 = Enum.GetValues(typeof(SubtitleDisplayManager.DisplayType)).GetEnumerator(); try { while (enumerator4.MoveNext()) { object obj3 = enumerator4.Current; string term = SubtitleDisplayManager.EnumConvert.GetTerm((SubtitleDisplayManager.DisplayType)obj3); if (currentPopupListValue == term) { GameMain.Instance.CMSystem.SubtitleType = (SubtitleDisplayManager.DisplayType)obj3; break; } } } finally { IDisposable disposable3; if ((disposable3 = (enumerator4 as IDisposable)) != null) { disposable3.Dispose(); } } }); } else { Transform transform = this.subtitleType.transform; while (transform.parent == null || transform.parent.GetComponent() == null) { transform = transform.parent; } if (transform != null) { transform.gameObject.SetActive(false); } } } if (this.systemLanguage != null) { if (Product.supportMultiLanguage) { IEnumerator enumerator3 = Enum.GetValues(typeof(Product.Language)).GetEnumerator(); try { while (enumerator3.MoveNext()) { object obj2 = enumerator3.Current; this.systemLanguage.AddItem(Product.EnumConvert.GetTerm((Product.Language)obj2)); } } finally { IDisposable disposable2; if ((disposable2 = (enumerator3 as IDisposable)) != null) { disposable2.Dispose(); } } EventDelegate.Add(this.systemLanguage.onChange, delegate() { string currentPopupListValue = this.GetCurrentPopupListValue(); IEnumerator enumerator4 = Enum.GetValues(typeof(Product.Language)).GetEnumerator(); try { while (enumerator4.MoveNext()) { object obj3 = enumerator4.Current; string term = Product.EnumConvert.GetTerm((Product.Language)obj3); if (currentPopupListValue == term) { GameMain.Instance.CMSystem.SystemLanguage = (Product.Language)obj3; break; } } } finally { IDisposable disposable3; if ((disposable3 = (enumerator4 as IDisposable)) != null) { disposable3.Dispose(); } } }); } else { Transform transform2 = this.systemLanguage.transform; while (transform2.parent == null || transform2.parent.GetComponent() == null) { transform2 = transform2.parent; } if (transform2 != null) { transform2.gameObject.SetActive(false); } } } intSliderInit(this.manAlpha); this.manAlpha.onGetValue = (() => GameMain.Instance.CMSystem.ManAlpha); this.manAlpha.onSetValue = delegate(int setValue) { GameMain.Instance.CMSystem.ManAlpha = setValue; GameMain.Instance.CMSystem.ConfigScreenApply(); }; intSliderInit(this.bloom); this.bloom.onGetValue = (() => GameMain.Instance.CMSystem.BloomValue); this.bloom.onSetValue = delegate(int setValue) { GameMain.Instance.CMSystem.BloomValue = setValue; }; intSliderInit(this.messageAlpha); this.messageAlpha.onGetValue = (() => GameMain.Instance.CMSystem.MsgWndAlpha); this.messageAlpha.onSetValue = delegate(int setValue) { GameMain.Instance.CMSystem.MsgWndAlpha = setValue; }; intSliderInit(this.textSpeed); this.textSpeed.onGetValue = (() => GameMain.Instance.CMSystem.MsgTextSpeed); this.textSpeed.onSetValue = delegate(int setValue) { GameMain.Instance.CMSystem.MsgTextSpeed = setValue; }; intSliderInit(this.textAutoSpeed); this.textAutoSpeed.onGetValue = (() => GameMain.Instance.CMSystem.MsgAutoSpeed); this.textAutoSpeed.onSetValue = delegate(int setValue) { GameMain.Instance.CMSystem.MsgAutoSpeed = setValue; }; intSliderInit(this.volumeMaster); this.volumeMaster.onGetValue = (() => GameMain.Instance.SoundMgr.GetVolumeAll()); this.volumeMaster.onSetValue = delegate(int setValue) { GameMain.Instance.SoundMgr.SetVolumeAll(setValue); GameMain.Instance.SoundMgr.Apply(); }; action2(this.volumeSystem, AudioSourceMgr.Type.System); action2(this.volumeBGM, AudioSourceMgr.Type.Bgm); intSliderInit(this.volumeDance); this.volumeDance.onGetValue = (() => GameMain.Instance.SoundMgr.GetVolumeDance()); this.volumeDance.onSetValue = delegate(int setValue) { GameMain.Instance.SoundMgr.SetVolumeDance(setValue); GameMain.Instance.SoundMgr.Apply(); }; action2(this.volumeVoiceMaster, AudioSourceMgr.Type.Voice); action2(this.volumeVoiceHeroine, AudioSourceMgr.Type.VoiceHeroine); action3(this.threeDEffectVoiceHeroine, AudioSourceMgr.Type.VoiceHeroine); action2(this.volumeSubVoice, AudioSourceMgr.Type.VoiceSub); action3(this.threeDEffectSubVoice, AudioSourceMgr.Type.VoiceSub); action2(this.volumeExtraVoice, AudioSourceMgr.Type.VoiceExtra); action3(this.threeDEffectExtraVoice, AudioSourceMgr.Type.VoiceExtra); action2(this.volumeMobVoice, AudioSourceMgr.Type.VoiceMob); action3(this.threeDEffectMobVoice, AudioSourceMgr.Type.VoiceMob); action2(this.volumeSE, AudioSourceMgr.Type.Se); action3(this.threeDEffectSE, AudioSourceMgr.Type.Se); action2(this.volumeEnv, AudioSourceMgr.Type.Env); action3(this.threeDEffectEnv, AudioSourceMgr.Type.Env); foreach (UIGrid uigrid in base.GetComponentsInChildren()) { uigrid.repositionNow = true; } } public void LoadConfig() { foreach (ConfigSelectButton configSelectButton in this.selectButtons) { configSelectButton.UpdateButton(); } foreach (ConfigIntegerSlider configIntegerSlider in this.intSliders) { configIntegerSlider.UpdateSlider(); } SoundMgr soundMgr = GameMain.Instance.SoundMgr; this.threeDEffectVoiceHeroine.check = soundMgr.GetThreeD(AudioSourceMgr.Type.VoiceHeroine); this.threeDEffectSubVoice.check = soundMgr.GetThreeD(AudioSourceMgr.Type.VoiceSub); this.threeDEffectExtraVoice.check = soundMgr.GetThreeD(AudioSourceMgr.Type.VoiceExtra); this.threeDEffectMobVoice.check = soundMgr.GetThreeD(AudioSourceMgr.Type.VoiceMob); this.threeDEffectSE.check = soundMgr.GetThreeD(AudioSourceMgr.Type.Se); this.threeDEffectEnv.check = soundMgr.GetThreeD(AudioSourceMgr.Type.Env); Size screenSizeNow = GameMain.Instance.CMSystem.GetScreenSizeNow(); this.screenResolution.value = string.Format("{0}x{1}", screenSizeNow.width, screenSizeNow.height); this.captureMagnification.value = GameMain.Instance.CMSystem.ScreenShotSuperSize.ToString(); this.antiAlias.value = GameMain.Instance.CMSystem.Antialias.ToString(); this.shadowQuality.value = GameMain.Instance.CMSystem.ShadowQuality.ToString(); this.textureQuality.value = GameMain.Instance.CMSystem.TextureQuality.ToString(); this.subtitleType.value = SubtitleDisplayManager.EnumConvert.GetTerm(GameMain.Instance.CMSystem.SubtitleType); this.systemLanguage.value = Product.EnumConvert.GetTerm(GameMain.Instance.CMSystem.SystemLanguage); } public void SetCloseButtonActive(bool active) { this.closeButton.gameObject.SetActive(active); } private void OnClickCategoryTabButton(ConfigManager.CategoryButton data) { ConfigManager.CategoryButton.Type type = data.type; if (type != ConfigManager.CategoryButton.Type.System) { if (type != ConfigManager.CategoryButton.Type.Sound) { if (type == ConfigManager.CategoryButton.Type.ChuBLip) { UIRect uirect = this.systemWidget; float alpha = 0f; this.soundWidget.alpha = alpha; uirect.alpha = alpha; this.cblConfigMgr.visible = true; } } else { this.systemWidget.alpha = 0f; this.soundWidget.alpha = 1f; this.cblConfigMgr.visible = false; } } else { this.systemWidget.alpha = 1f; this.soundWidget.alpha = 0f; this.cblConfigMgr.visible = false; } foreach (ConfigManager.CategoryButton categoryButton in this.categoryTabButtons) { categoryButton.tab.SetSelect(categoryButton.type == data.type); } } private void CreateEnumPopupList(UIPopupList addPopupList, Action applyAction) { IEnumerator enumerator = Enum.GetValues(typeof(enumT)).GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; if (obj.ToString() != "MAX") { addPopupList.items.Add(obj.ToString()); } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } EventDelegate.Add(addPopupList.onChange, delegate() { string currentPopupListValue = this.GetCurrentPopupListValue(); if (this.IsValidatePopupValue(currentPopupListValue)) { enumT obj2 = (enumT)((object)Enum.Parse(typeof(enumT), currentPopupListValue)); applyAction(obj2); } }); } private string GetCurrentPopupListValue() { return Regex.Replace(UIPopupList.current.value, "[\\r\\n]+$", string.Empty); } private List> MakeResolutionPopupList() { List> screenSizeList = GameMain.Instance.CMSystem.GetScreenSizeList(); Size screenSizeNow = GameMain.Instance.CMSystem.GetScreenSizeNow(); if (!screenSizeList.Contains(screenSizeNow)) { screenSizeList.Add(screenSizeNow); } return screenSizeList; } private Size ResolutionTextToSize(string value) { Size result = default(Size); 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; } private bool IsValidatePopupValue(string value) { if (!Enum.IsDefined(typeof(T), value)) { Debug.LogError(string.Format("ポップアップリストから不適切な値が選択されました。選択されたボタン名={0}", value)); return false; } return true; } private KeyValuePair GetRootItem(GameObject obj) where T : class { T t = (T)((object)null); Transform transform = obj.transform; for (;;) { t = transform.parent.GetComponent(); if (!(transform.parent == null) && t != null) { break; } transform = transform.parent; } if (transform != null) { transform.gameObject.SetActive(false); } return new KeyValuePair(t, transform.gameObject); } [SerializeField] [Header("タブボタンのデータ")] private ConfigManager.CategoryButton[] categoryTabButtons; [SerializeField] [Header("閉じるボタン")] private UIButton closeButton; [SerializeField] [Header("VRボタン")] private UIButton vrConfigButton; [SerializeField] [Header("システムタブ表示用Widget")] private UIWidget systemWidget; [SerializeField] [Header("システムフレーム")] private UISprite systemFrame; [SerializeField] [Header("サウンドタブ表示用Widget")] private UIWidget soundWidget; [SerializeField] [Header("システムボタン常時表示")] private ConfigSelectButton systemButtonVisible; [SerializeField] [Header("スクリーンモード")] private ConfigSelectButton screenMode; [SerializeField] [Header("FPS表示")] private ConfigSelectButton drawFPS; [SerializeField] [Header("ボイス継続")] private ConfigSelectButton sequentialVoice; [SerializeField] [Header("射精音の再生")] private ConfigSelectButton ejaculationSe; [SerializeField] [Header("夜伽中の字幕表示")] private ConfigSelectButton yotogiSubtitleVisible; [SerializeField] [Header("男透明度")] private ConfigIntegerSlider manAlpha; [SerializeField] [Header("ブルーム")] private ConfigIntegerSlider bloom; [SerializeField] [Header("メッセージウィンドウ透明度")] private ConfigIntegerSlider messageAlpha; [SerializeField] [Header("テキストスピード")] private ConfigIntegerSlider textSpeed; [SerializeField] [Header("テキストオートスピード")] private ConfigIntegerSlider textAutoSpeed; [SerializeField] [Header("CBLデバイス選択")] private UIPopupList deviceSelect; [SerializeField] [Header("画面解像度")] private UIPopupList screenResolution; [SerializeField] [Header("キャプチャ倍率")] private UIPopupList captureMagnification; [SerializeField] [Header("アンチエイリアス")] private UIPopupList antiAlias; [SerializeField] [Header("影のクオリティ")] private UIPopupList shadowQuality; [SerializeField] [Header("テクスチャのクオリティ")] private UIPopupList textureQuality; [SerializeField] [Header("システム言語")] private UIPopupList systemLanguage; [SerializeField] [Header("翻訳版用-ADVの表示タイプ")] private UIPopupList subtitleType; [SerializeField] [Header("音量-マスター")] private ConfigIntegerSlider volumeMaster; [SerializeField] [Header("音量-システム")] private ConfigIntegerSlider volumeSystem; [SerializeField] [Header("音量-BGM")] private ConfigIntegerSlider volumeBGM; [SerializeField] [Header("音量-ダンス")] private ConfigIntegerSlider volumeDance; [SerializeField] [Header("音量-ボイスマスター")] private ConfigIntegerSlider volumeVoiceMaster; [SerializeField] [Header("音量-ボイスヒロイン")] private ConfigIntegerSlider volumeVoiceHeroine; [SerializeField] [Header("3D-ボイスヒロイン")] private WFCheckBox threeDEffectVoiceHeroine; [SerializeField] [Header("音量-ボイスサブ")] private ConfigIntegerSlider volumeSubVoice; [SerializeField] [Header("3D-ボイスサブ")] private WFCheckBox threeDEffectSubVoice; [SerializeField] [Header("音量-ボイスエキストラ")] private ConfigIntegerSlider volumeExtraVoice; [SerializeField] [Header("3D-ボイスエキストラ")] private WFCheckBox threeDEffectExtraVoice; [SerializeField] [Header("音量-ボイスモブ")] private ConfigIntegerSlider volumeMobVoice; [SerializeField] [Header("3D-ボイスモブ")] private WFCheckBox threeDEffectMobVoice; [SerializeField] [Header("音量-SE")] private ConfigIntegerSlider volumeSE; [SerializeField] [Header("3D-SE")] private WFCheckBox threeDEffectSE; [SerializeField] [Header("音量-環境音")] private ConfigIntegerSlider volumeEnv; [SerializeField] [Header("3D-環境音")] private WFCheckBox threeDEffectEnv; private ConfigCblManager cblConfigMgr; private List selectButtons = new List(); private List intSliders = new List(); [Serializable] private struct CategoryButton { public ConfigManager.CategoryButton.Type type; public UIWFTabButton tab; public enum Type { System = 10, Sound = 20, ChuBLip = 30 } } }