using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows.Forms; using System.Xml.Linq; using System.Xml.Serialization; using UnityEngine; public class CMSystem { public CMSystem() { this.SysButtonShowAlways = true; this.FullScreen = false; this.SetScreenSize(new Size { width = 1280, height = 720 }); this.Antialias = CMSystem.AntiAliasType.X2; this.ShadowQuality = CMSystem.ShadowQualityType.Medium; this.TextureQuality = CMSystem.TextureQualityType.High; this.TargetFPS = 60; this.VSync = false; this.ViewFps = false; this.Bloom = true; this.BloomValue = 50; this.MsgAlreadySkip = true; this.MsgVoiceNoStop = true; this.SubtitleType = SubtitleDisplayManager.DisplayType.OriginalAndSubtitle; this.EjaculationSeEnabled = true; this.NetUse = false; this.CM3D2Path = string.Empty; this.LoadSystem(); this.LoadLauncherCfg(); } public bool SysButtonShowAlways { get; set; } public bool FullScreen { get; set; } public void SetSystemVers(string f_strKey, string f_strVal) { if (this.m_SystemVers.ContainsKey(f_strKey)) { this.m_SystemVers[f_strKey] = f_strVal; } else { this.m_SystemVers.Add(f_strKey, f_strVal); } } public string GetSystemVers(string f_strKey) { string result = null; this.m_SystemVers.TryGetValue(f_strKey, out result); return result; } public List> GetScreenSizeList() { List> list = new List>(); list.AddRange(this.m_listScreenDefSize); Size siDesktop = default(Size); siDesktop.width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; siDesktop.height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; list.RemoveAll((Size s) => s.height > siDesktop.width || s.height > siDesktop.height); list.Add(siDesktop); list.Add(new Size(UnityEngine.Screen.width, UnityEngine.Screen.height)); return list; } public void SetScreenSize(Size f_siSize) { this.m_siScreenSize = f_siSize; } public Size GetScreenSizeNow() { return new Size { width = UnityEngine.Screen.width, height = UnityEngine.Screen.height }; } public CMSystem.AntiAliasType Antialias { get; set; } public CMSystem.ShadowQualityType ShadowQuality { get; set; } public CMSystem.TextureQualityType TextureQuality { get; set; } public bool VSync { get; set; } public int TargetFPS { get; set; } public bool ViewFps { get; set; } public bool Bloom { get; set; } public int BloomValue { get { return this.m_nBloomValue; } set { this.m_nBloomValue = Math.Max(0, Math.Min(100, value)); } } public CMSystem.SSSuperSizeType ScreenShotSuperSize { get { return this.m_eScreenShotSuperSize; } set { this.m_eScreenShotSuperSize = value; } } public int ManAlpha { get { return this.m_nManAlpha; } set { this.m_nManAlpha = Math.Max(Math.Min(value, 100), 0); } } public int MsgWndAlpha { get { return this.m_nMsgWndAlpha; } set { this.m_nMsgWndAlpha = Math.Max(Math.Min(value, 100), 0); } } public int MsgTextSpeed { get { return this.m_nMsgTextSpeed; } set { this.m_nMsgTextSpeed = Math.Max(Math.Min(value, 100), 0); } } public int MsgAutoSpeed { get { return this.m_nMsgAutoSpeed; } set { this.m_nMsgAutoSpeed = Math.Max(Math.Min(value, 100), 0); } } public bool MsgAlreadySkip { get; set; } public bool MsgVoiceNoStop { get; set; } public SubtitleDisplayManager.DisplayType SubtitleType { get { return this.m_SubtitleType; } set { this.m_SubtitleType = value; } } public bool EjaculationSeEnabled { get; set; } public int FadeSpeed { get { return this.m_nFadeSpeed; } set { this.m_nFadeSpeed = Math.Max(Math.Min(value, 100), 0); } } public float FadeSpeedRate { get { return ((float)this.m_nFadeSpeed / 100f > 0.05f) ? ((float)this.m_nFadeSpeed / 100f) : 0.05f; } } public bool NetUse { get; set; } public string CM3D2Path { get; private set; } public int DesktopCaptureMonitorNo { get { return this.m_nDesktopCaptureMonitorNo; } set { this.m_nDesktopCaptureMonitorNo = value; } } public bool EditItemGroup { get { return this.m_bEditItemGroup; } set { this.m_bEditItemGroup = value; } } public bool EditTouchJump { get { return this.m_bEditTouchJump; } set { this.m_bEditTouchJump = value; } } public float VRCameraHeightStand { get { return this.m_fVRCameraHeightStand; } set { this.m_fVRCameraHeightStand = Mathf.Clamp(value, 1.5f, 1.8f); } } public float VRCameraHeightStandOffs { get { return this.m_fVRCameraHeightStand - 0.1f; } } public float VRCameraHeightSit { get { return this.m_fVRCameraHeightSit; } set { this.m_fVRCameraHeightSit = Mathf.Clamp(value, 0.7f, 1f); } } public float VRCameraHeightSitOffs { get { return this.m_fVRCameraHeightSit - 0.1f; } } public float VRCameraMoveSpeedKey { get { return this.m_fVRCameraMoveSpeedKey; } set { this.m_fVRCameraMoveSpeedKey = Mathf.Clamp(value, 0f, 1f); } } public float VRCameraRotSpeedKey { get { return this.m_fVRCameraRotSpeedKey; } set { this.m_fVRCameraRotSpeedKey = Mathf.Clamp(value, 0f, 1f); } } public bool VRCameraPlaneMove { get { return this.m_bVRCameraPlaneMove; } set { this.m_bVRCameraPlaneMove = value; } } public float VRCameraRotSpeedMouse { get { return this.m_fVRCameraRotSpeedMouse; } set { this.m_fVRCameraRotSpeedMouse = Mathf.Clamp(value, 0f, 1f); } } public bool VRManShow { get { return this.m_bVRManShow; } set { this.m_bVRManShow = value; } } public float VRCameraFov { get { return this.m_fVRCameraFov; } set { this.m_fVRCameraFov = Mathf.Clamp(value, 30f, 60f); } } public bool VRCamRotDownUp { get { return this.m_bVRCamRotDownUp; } set { this.m_bVRCamRotDownUp = value; } } public float OvrHeadScale { get { return this.m_fOvrHeadScale; } set { this.m_fOvrHeadScale = Math.Max(Math.Min(value, 3f), 0.1f); } } public float OvrCursorStabilization { get { return this.m_fOvrCursorStabilization; } set { this.m_fOvrCursorStabilization = value; } } public float OvrCursorBoostSpeed { get { return this.m_fOvrCursorBoostSpeed; } set { this.m_fOvrCursorBoostSpeed = value; } } public int OvrPointerMode { get { return this.m_nOvrPointerMode; } set { this.m_nOvrPointerMode = value; } } public int OvrMoveMode { get { return this.m_nOvrMoveMode; } set { this.m_nOvrMoveMode = value; } } public float OvrCursorPadSpeed { get { return this.m_fOvrCursorPadSpeed; } set { this.m_fOvrCursorPadSpeed = value; } } public float OvrViveCursorLaserHitScale { get { return this.m_fOvrViveCursorLaserHitScale; } set { this.m_fOvrViveCursorLaserHitScale = value; } } public float OvrViveCursorLaserEasing { get { return this.m_fOvrViveCursorLaserEasing; } set { this.m_fOvrViveCursorLaserEasing = value; } } public int OvrHandCameraWidth { get { return this.m_nOvrHandCameraWidth; } set { this.m_nOvrHandCameraWidth = value; } } public int OvrHandCameraHeight { get { return this.m_nOvrHandCameraHeight; } set { this.m_nOvrHandCameraHeight = value; } } public Dictionary OvrDDBG { get { return this.m_dicVRDDBG; } set { this.m_dicVRDDBG = value; } } public bool OvrScreenMirror { get { return this.m_bOvrScreenMirror; } set { this.m_bOvrScreenMirror = value; } } public CMSystem.OVR_CAM_HEIGHT_TYPE OvrCameraHeightType { get { return this.m_eOvrCameraHeightType; } set { this.m_eOvrCameraHeightType = value; } } public bool OvrMouseRot { get { return this.m_bOvrMouseRot; } set { this.m_bOvrMouseRot = value; } } public float OvrUITabletSize { get { return this.m_fOvrUITabletSize; } set { this.m_fOvrUITabletSize = value; } } public bool OvrUseTouch { get { return this.m_bOvrUseTouch; } set { this.m_bOvrUseTouch = value; } } public bool OvrUseNewControllerType { get { return this.m_bUseNewControllerType; } set { this.m_bUseNewControllerType = value; } } public bool OvrUseSnapRotate { get { return this.m_bOvrUseSnapRotate; } set { this.m_bOvrUseSnapRotate = value; } } public int OvrUseSnapRotateRate { get { return this.m_nOvrUseSnapRotateRate; } set { this.m_nOvrUseSnapRotateRate = Mathf.Clamp(value, 10, 80); } } public bool QuitWhenAssert { get { return NDebug.m_bQuitWhenAssert; } set { NDebug.m_bQuitWhenAssert = value; } } public string ShopURL { get { string text = "https://com3d2-shop.s-court.me/?ctv=1"; if (!string.IsNullOrEmpty(this.CM3D2Path)) { text += "&cmd=1"; } else { text += "&cmd=0"; } return text; } } public CMSystem.SerializeConfig SConfig { get { return this.m_SConfig; } } public void SetTmpGenericFlag(string flag_name, int val) { if (this.m_GenericTmpFlag.ContainsKey(flag_name)) { this.m_GenericTmpFlag[flag_name] = val; } else { this.m_GenericTmpFlag.Add(flag_name, val); } } public int GetTmpGenericFlag(string flag_name) { return (!this.m_GenericTmpFlag.ContainsKey(flag_name)) ? 0 : this.m_GenericTmpFlag[flag_name]; } public bool ExistEditColorPresetData(int slotNo) { return this.m_dicEditColorPresetData.ContainsKey(slotNo); } public Dictionary GetEditColorPresetData(int slotNo) { return this.ExistEditColorPresetData(slotNo) ? this.m_dicEditColorPresetData[slotNo] : null; } public void SetEditColorPresetData(int slotNo, Dictionary setData) { if (this.ExistEditColorPresetData(slotNo)) { this.m_dicEditColorPresetData.Remove(slotNo); } if (setData != null) { this.m_dicEditColorPresetData.Add(slotNo, setData); } } public void RemoveEditColorPresetData(int slotNo) { this.SetEditColorPresetData(slotNo, null); } public void ConfigSystemApply() { } public void ConfigScreenApply() { bool flag = false; if (this.ShadowQuality == CMSystem.ShadowQualityType.None) { if (QualitySettings.GetQualityLevel() != 2) { QualitySettings.SetQualityLevel(2); flag = true; } } else if (this.ShadowQuality == CMSystem.ShadowQualityType.Low) { if (QualitySettings.GetQualityLevel() != 3) { QualitySettings.SetQualityLevel(3); flag = true; } } else if (this.ShadowQuality == CMSystem.ShadowQualityType.Medium) { if (QualitySettings.GetQualityLevel() != 4) { QualitySettings.SetQualityLevel(4); flag = true; } } else if (this.ShadowQuality == CMSystem.ShadowQualityType.High && QualitySettings.GetQualityLevel() != 5) { QualitySettings.SetQualityLevel(5); flag = true; } if (!GameMain.Instance.VRMode || GameMain.Instance.VRDummyMode) { if (UnityEngine.Screen.width != this.m_siScreenSize.width || UnityEngine.Screen.height != this.m_siScreenSize.height || UnityEngine.Screen.fullScreen != this.FullScreen) { UnityEngine.Screen.SetResolution(this.m_siScreenSize.width, this.m_siScreenSize.height, this.FullScreen); flag = true; } if (QualitySettings.antiAliasing != this.m_nAntiAlias[(int)this.Antialias]) { QualitySettings.antiAliasing = this.m_nAntiAlias[(int)this.Antialias]; flag = true; } } else if (QualitySettings.antiAliasing != this.m_nAntiAlias[(int)this.Antialias]) { QualitySettings.antiAliasing = this.m_nAntiAlias[(int)this.Antialias]; flag = true; } if (this.TextureQuality == CMSystem.TextureQualityType.Low) { if (QualitySettings.anisotropicFiltering != AnisotropicFiltering.Disable) { QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable; flag = true; } } else if (this.TextureQuality == CMSystem.TextureQualityType.Medium) { if (QualitySettings.anisotropicFiltering != AnisotropicFiltering.Enable) { QualitySettings.anisotropicFiltering = AnisotropicFiltering.Enable; flag = true; } } else if (this.TextureQuality == CMSystem.TextureQualityType.High && QualitySettings.anisotropicFiltering != AnisotropicFiltering.ForceEnable) { QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnable; flag = true; } if (!GameMain.Instance.VRMode || GameMain.Instance.VRDummyMode) { if (this.VSync) { if (QualitySettings.vSyncCount != 60) { QualitySettings.vSyncCount = 60; } } else if (QualitySettings.vSyncCount != 0) { QualitySettings.vSyncCount = 0; } if (UnityEngine.Application.targetFrameRate != this.TargetFPS) { UnityEngine.Application.targetFrameRate = this.TargetFPS; } flag = true; } else { if (QualitySettings.vSyncCount != 0) { QualitySettings.vSyncCount = 0; flag = true; } if (UnityEngine.Application.targetFrameRate != -1) { UnityEngine.Application.targetFrameRate = -1; flag = true; } } if (GameMain.Instance != null && GameMain.Instance.FpsCounter != null) { GameMain.Instance.FpsCounter.gameObject.SetActive(this.ViewFps); } if (GameMain.Instance != null && GameMain.Instance.CharacterMgr != null) { GameMain.Instance.CharacterMgr.ManAlphaUpdate(); } if (flag && GameMain.Instance != null) { GameMain.Instance.BroadcastMessage("OnChangeScreenSizeOrAA", SendMessageOptions.DontRequireReceiver); } } public bool SaveIni() { XElement xelement = new XElement("Config", new object[] { new XAttribute("Version", 1170), new XElement("System", new XElement("SysButtonShowAlways", this.SysButtonShowAlways)), new XElement("Screen", new object[] { new XElement("FullScreen", this.FullScreen), new XElement("ScreenSizeNow.width", this.GetScreenSizeNow().width), new XElement("ScreenSizeNow.height", this.GetScreenSizeNow().height), new XElement("Antialias", this.Antialias), new XElement("ShadowQuality", this.ShadowQuality), new XElement("TextureQuality", this.TextureQuality), new XElement("VSync", this.VSync), new XElement("TargetFPS", this.TargetFPS), new XElement("ViewFps", this.ViewFps), new XElement("Bloom", this.Bloom), new XElement("BloomValue", this.BloomValue), new XElement("ScreenShotSuperSize", this.ScreenShotSuperSize), new XElement("ManAlpha", this.ManAlpha) }), new XElement("Message", new object[] { new XElement("MsgWndAlpha", this.MsgWndAlpha), new XElement("MsgTextSpeed", this.MsgTextSpeed), new XElement("MsgAutoSpeed", this.MsgAutoSpeed), new XElement("MsgAlreadySkip", this.MsgAlreadySkip), new XElement("MsgVoiceNoStop", this.MsgVoiceNoStop), new XElement("SubtitleType", this.SubtitleType.ToString()), new XElement("EjaculationSeEnabled", this.EjaculationSeEnabled) }), new XElement("Other", new object[] { new XElement("FadeSpeed", this.FadeSpeed), new XElement("DesktopCaptureMonitorNo", this.DesktopCaptureMonitorNo), new XElement("EditItemGroup", this.EditItemGroup), new XElement("EditTouchJump", this.EditTouchJump), new XElement("VRCameraHeightStand", (int)(this.VRCameraHeightStand * 1000f)), new XElement("VRCameraHeightSit", (int)(this.VRCameraHeightSit * 1000f)), new XElement("VRCameraMoveSpeedKey", (int)(this.VRCameraMoveSpeedKey * 1000f)), new XElement("VRCameraRotSpeedKey", (int)(this.VRCameraRotSpeedKey * 1000f)), new XElement("VRCameraPlaneMove", this.VRCameraPlaneMove), new XElement("VRCameraRotSpeedMouse", (int)(this.VRCameraRotSpeedMouse * 1000f)), new XElement("VRManShow", this.VRManShow), new XElement("VRCameraFov", (int)(this.VRCameraFov * 1000f)), new XElement("VRCamRotDownUp", this.VRCamRotDownUp), new XElement("QuitWhenAssert", this.QuitWhenAssert) }) }); if (GameMain.Instance.VRMode && !GameMain.Instance.VRDummyMode) { XContainer xcontainer = xelement; XName name = "Ovr"; object[] array = new object[21]; array[0] = new XElement("OvrConfVer", this.m_nOvrConfVer); array[1] = new XElement("HeadScale", (int)(this.OvrHeadScale * 1000f)); array[2] = new XElement("CursorBoostSpeed", (int)(this.OvrCursorBoostSpeed * 1000f)); array[3] = new XElement("CursorStabilization", (int)(this.OvrCursorStabilization * 1000f)); array[4] = new XElement("PointerMode", this.OvrPointerMode); array[5] = new XElement("OvrMoveMode", this.OvrMoveMode); array[6] = new XElement("CursorPadSpeed", (int)(this.OvrCursorPadSpeed * 1000f)); array[7] = new XElement("OvrViveCursorLaserHitScale", (int)(this.OvrViveCursorLaserHitScale * 1000f)); array[8] = new XElement("OvrViveCursorLaserEasing", (int)(this.OvrViveCursorLaserEasing * 1000f)); array[9] = new XElement("OvrHandCameraWidth", this.OvrHandCameraWidth); array[10] = new XElement("OvrHandCameraHeight", this.OvrHandCameraHeight); array[11] = new XElement("OvrDDBG", from keyValue in this.OvrDDBG select new XElement(keyValue.Key, keyValue.Value.ToSaveString())); array[12] = new XElement("OvrHandCameraWidth", this.OvrHandCameraWidth); array[13] = new XElement("OvrScreenMirror", this.OvrScreenMirror); array[14] = new XElement("OvrCameraHeightType1", this.OvrCameraHeightType); array[15] = new XElement("OvrMouseRot", this.OvrMouseRot); array[16] = new XElement("OvrUITabletSize", (int)(this.OvrUITabletSize * 1000f)); array[17] = new XElement("OvrUseTouch", this.OvrUseTouch); array[18] = new XElement("OvrUseNewControllerType2", this.OvrUseNewControllerType); array[19] = new XElement("OvrUseSnapRotate2", this.OvrUseSnapRotate); array[20] = new XElement("OvrUseSnapRotateRate", this.OvrUseSnapRotateRate); xcontainer.Add(new XElement(name, array)); } string value = JsonUtility.ToJson(this.m_SConfig, true); xelement.Add(new XElement("SJConfig", value)); GameMain.Instance.SoundMgr.SaveIni(xelement); XDocument xdocument = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new object[] { new XComment("CM3D2 Config"), xelement }); string text = Path.GetFullPath(".\\"); if (!GameMain.Instance.VRMode || GameMain.Instance.VRDummyMode) { text += "config.xml"; } else { text += "config_ovr.xml"; } xdocument.Save(text); return true; } public bool LoadIni() { string text = Path.GetFullPath(".\\"); if (!GameMain.Instance.VRMode || GameMain.Instance.VRDummyMode) { text += "config.xml"; } else { text += "config_ovr.xml"; } if (File.Exists(text)) { try { XDocument xdocument = XDocument.Load(text); XElement xelement = xdocument.Element("Config"); XElement xelm = xelement.Element("System"); this.SysButtonShowAlways = bool.Parse(this.getElemetn(xelm, "SysButtonShowAlways", "true").Value); XElement xelm2 = xelement.Element("Screen"); this.FullScreen = bool.Parse(this.getElemetn(xelm2, "FullScreen", "false").Value); this.m_siScreenSize.width = int.Parse(this.getElemetn(xelm2, "ScreenSizeNow.width", "1280").Value); this.m_siScreenSize.height = int.Parse(this.getElemetn(xelm2, "ScreenSizeNow.height", "720").Value); this.Antialias = (CMSystem.AntiAliasType)Enum.Parse(typeof(CMSystem.AntiAliasType), this.getElemetn(xelm2, "Antialias", CMSystem.AntiAliasType.X2.ToString()).Value); this.ShadowQuality = (CMSystem.ShadowQualityType)Enum.Parse(typeof(CMSystem.ShadowQualityType), this.getElemetn(xelm2, "ShadowQuality", CMSystem.ShadowQualityType.Medium.ToString()).Value); this.TextureQuality = (CMSystem.TextureQualityType)Enum.Parse(typeof(CMSystem.TextureQualityType), this.getElemetn(xelm2, "TextureQuality", CMSystem.TextureQualityType.High.ToString()).Value); this.VSync = bool.Parse(this.getElemetn(xelm2, "VSync", "false").Value); this.TargetFPS = int.Parse(this.getElemetn(xelm2, "TargetFPS", "60").Value); this.ViewFps = bool.Parse(this.getElemetn(xelm2, "ViewFps", "false").Value); this.Bloom = bool.Parse(this.getElemetn(xelm2, "Bloom", "true").Value); this.BloomValue = int.Parse(this.getElemetn(xelm2, "BloomValue", "100").Value); this.ScreenShotSuperSize = (CMSystem.SSSuperSizeType)Enum.Parse(typeof(CMSystem.SSSuperSizeType), this.getElemetn(xelm2, "ScreenShotSuperSize", CMSystem.SSSuperSizeType.X1.ToString()).Value); this.ManAlpha = int.Parse(this.getElemetn(xelm2, "ManAlpha", "50").Value); XElement xelm3 = xelement.Element("Message"); this.MsgWndAlpha = int.Parse(this.getElemetn(xelm3, "MsgWndAlpha", "0").Value); this.MsgTextSpeed = int.Parse(this.getElemetn(xelm3, "MsgTextSpeed", "80").Value); this.MsgAutoSpeed = int.Parse(this.getElemetn(xelm3, "MsgAutoSpeed", "50").Value); this.MsgAlreadySkip = bool.Parse(this.getElemetn(xelm3, "MsgAlreadySkip", "true").Value); this.MsgVoiceNoStop = bool.Parse(this.getElemetn(xelm3, "MsgVoiceNoStop", "true").Value); try { this.SubtitleType = (SubtitleDisplayManager.DisplayType)Enum.Parse(typeof(SubtitleDisplayManager.DisplayType), this.getElemetn(xelm3, "SubtitleType", SubtitleDisplayManager.DisplayType.OriginalAndSubtitle.ToString()).Value); } catch (Exception) { this.SubtitleType = SubtitleDisplayManager.DisplayType.None; } this.EjaculationSeEnabled = bool.Parse(this.getElemetn(xelm3, "EjaculationSeEnabled", "true").Value); XElement xelement2 = xelement.Element("Other"); if (xelement2 != null) { this.FadeSpeed = int.Parse(this.getElemetn(xelement2, "FadeSpeed", "100").Value); this.DesktopCaptureMonitorNo = int.Parse(this.getElemetn(xelement2, "DesktopCaptureMonitorNo", "1").Value); this.EditItemGroup = bool.Parse(this.getElemetn(xelement2, "EditItemGroup", "True").Value); this.EditTouchJump = bool.Parse(this.getElemetn(xelement2, "EditTouchJump", "False").Value); this.VRCameraHeightStand = (float)int.Parse(this.getElemetn(xelement2, "VRCameraHeightStand", (this.VRCameraHeightStand * 1000f).ToString()).Value) / 1000f; this.VRCameraHeightSit = (float)int.Parse(this.getElemetn(xelement2, "VRCameraHeightSit", (this.VRCameraHeightSit * 1000f).ToString()).Value) / 1000f; this.VRCameraMoveSpeedKey = (float)int.Parse(this.getElemetn(xelement2, "VRCameraMoveSpeedKey", (this.VRCameraMoveSpeedKey * 1000f).ToString()).Value) / 1000f; this.VRCameraRotSpeedKey = (float)int.Parse(this.getElemetn(xelement2, "VRCameraRotSpeedKey", (this.VRCameraRotSpeedKey * 1000f).ToString()).Value) / 1000f; this.VRCameraPlaneMove = bool.Parse(this.getElemetn(xelement2, "VRCameraPlaneMove", this.VRCameraPlaneMove.ToString()).Value); this.VRCameraRotSpeedMouse = (float)int.Parse(this.getElemetn(xelement2, "VRCameraRotSpeedMouse", (this.VRCameraRotSpeedMouse * 1000f).ToString()).Value) / 1000f; this.VRManShow = bool.Parse(this.getElemetn(xelement2, "VRManShow", this.VRManShow.ToString()).Value); this.VRCameraFov = (float)int.Parse(this.getElemetn(xelement2, "VRCameraFov", (this.VRCameraFov * 1000f).ToString()).Value) / 1000f; this.VRCamRotDownUp = bool.Parse(this.getElemetn(xelement2, "VRCamRotDownUp", this.VRCamRotDownUp.ToString()).Value); this.QuitWhenAssert = bool.Parse(this.getElemetn(xelement2, "QuitWhenAssert", this.QuitWhenAssert.ToString()).Value); } if (GameMain.Instance.VRMode && !GameMain.Instance.VRDummyMode) { XElement xelement3 = xelement.Element("Ovr"); if (xelement3 != null) { int num = 0; XElement xelement4 = xelement3.Element("OvrConfVer"); if (xelement4 != null) { num = int.Parse(xelement4.Value); } xelement4 = xelement3.Element("HeadScale"); if (xelement4 != null) { this.OvrHeadScale = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("CursorBoostSpeed"); if (xelement4 != null) { this.OvrCursorBoostSpeed = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("CursorStabilization"); if (xelement4 != null) { this.OvrCursorStabilization = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("PointerMode"); if (xelement4 != null) { this.OvrPointerMode = int.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrMoveMode"); if (xelement4 != null) { this.OvrMoveMode = int.Parse(xelement4.Value); } xelement4 = xelement3.Element("CursorPadSpeed"); if (xelement4 != null) { this.OvrCursorPadSpeed = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("OvrViveCursorLaserHitScale"); if (xelement4 != null) { this.OvrViveCursorLaserHitScale = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("OvrViveCursorLaserEasing"); if (xelement4 != null) { this.OvrViveCursorLaserEasing = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("OvrHandCameraWidth"); if (xelement4 != null) { this.OvrHandCameraWidth = int.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrHandCameraHeight"); if (xelement4 != null) { this.OvrHandCameraHeight = int.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrDDBG"); if (xelement4 != null) { this.OvrDDBG.Clear(); foreach (XElement xelement5 in xelement4.Elements()) { this.OvrDDBG.Add(xelement5.Name.LocalName, new CMSystem.TransDD(xelement5.Value, num)); } } xelement4 = xelement3.Element("OvrScreenMirror"); if (xelement4 != null) { this.OvrScreenMirror = bool.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrCameraHeightType1"); if (xelement4 != null) { this.OvrCameraHeightType = (CMSystem.OVR_CAM_HEIGHT_TYPE)Enum.Parse(typeof(CMSystem.OVR_CAM_HEIGHT_TYPE), xelement4.Value); } xelement4 = xelement3.Element("OvrMouseRot"); if (xelement4 != null) { this.OvrMouseRot = bool.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrUITabletSize"); if (xelement4 != null) { this.OvrUITabletSize = (float)int.Parse(xelement4.Value) / 1000f; } xelement4 = xelement3.Element("OvrUseTouch"); if (xelement4 != null) { this.OvrUseTouch = bool.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrUseNewControllerType2"); if (xelement4 != null) { this.OvrUseNewControllerType = bool.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrUseSnapRotate2"); if (xelement4 != null) { this.OvrUseSnapRotate = bool.Parse(xelement4.Value); } xelement4 = xelement3.Element("OvrUseSnapRotateRate"); if (xelement4 != null) { this.OvrUseSnapRotateRate = int.Parse(xelement4.Value); } if (num < 1430) { this.OvrPointerMode = 0; this.OvrCursorPadSpeed *= 1000f; } } } XElement xelement6 = xelement.Element("SJConfig"); if (xelement6 != null) { this.m_SConfig = JsonUtility.FromJson(xelement6.Value); } GameMain.Instance.SoundMgr.LoadIni(xelement); Debug.Log("コンフィグ内容 " + xdocument.ToString(SaveOptions.DisableFormatting)); } catch (Exception ex) { Debug.LogError("コンフィグが読み込めませんでした。" + ex.Message); } } else { Debug.Log("コンフィグファイル " + text + " はありません。(初回起動)"); } this.ConfigSystemApply(); this.ConfigScreenApply(); GameMain.Instance.SoundMgr.Apply(); return true; } private XElement getElemetn(XElement xelm, string name, string def) { xelm = xelm.Element(name); if (xelm == null) { xelm = new XElement(name, def); } return xelm; } public void SaveSystem() { MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write("CM3D2_SYSTEM2"); binaryWriter.Write(1170); binaryWriter.Write(this.m_dicEditColorPresetData.Count); foreach (KeyValuePair> keyValuePair in this.m_dicEditColorPresetData) { binaryWriter.Write(keyValuePair.Key); binaryWriter.Write(keyValuePair.Value.Count); foreach (KeyValuePair keyValuePair2 in keyValuePair.Value) { binaryWriter.Write(keyValuePair2.Key); binaryWriter.Write(keyValuePair2.Value); } } binaryWriter.Write(this.m_SystemVers.Count); foreach (KeyValuePair keyValuePair3 in this.m_SystemVers) { binaryWriter.Write(keyValuePair3.Key); binaryWriter.Write(keyValuePair3.Value); } File.WriteAllBytes(Path.GetFullPath(".\\") + "system.dat", memoryStream.ToArray()); memoryStream.Dispose(); memoryStream = null; } public bool LoadSystem() { string path = Path.GetFullPath(".\\") + "system.dat"; if (File.Exists(path)) { try { this.m_dicEditColorPresetData.Clear(); this.m_SystemVers.Clear(); using (FileStream fileStream = new FileStream(Path.GetFullPath(".\\") + "system.dat", FileMode.Open)) { BinaryReader binaryReader = new BinaryReader(fileStream); string a = binaryReader.ReadString(); if (a == "CM3D2_SYSTEM") { return true; } NDebug.Assert(a == "CM3D2_SYSTEM2", "システムファイルのヘッダーが不正です。"); int num = binaryReader.ReadInt32(); int num2 = binaryReader.ReadInt32(); for (int i = 0; i < num2; i++) { int key = binaryReader.ReadInt32(); int num3 = binaryReader.ReadInt32(); Dictionary dictionary = new Dictionary(); for (int j = 0; j < num3; j++) { string key2 = binaryReader.ReadString(); int value = binaryReader.ReadInt32(); dictionary.Add(key2, value); } this.m_dicEditColorPresetData.Add(key, dictionary); } int num4 = binaryReader.ReadInt32(); for (int k = 0; k < num4; k++) { this.SetSystemVers(binaryReader.ReadString(), binaryReader.ReadString()); } } } catch (Exception ex) { Debug.LogError("system.datの読み込みに失敗しました\n" + ex.Message); } return true; } return true; } private void LoadLauncherCfg() { string path = Path.GetFullPath(".\\") + "update.cfg"; if (File.Exists(path)) { using (StreamReader streamReader = new StreamReader(path)) { while (!streamReader.EndOfStream) { string text = streamReader.ReadLine(); Console.WriteLine("{0}", text); string[] array = text.Split(new char[] { '=' }); if (array != null && array.Length == 2) { string a = array[0]; string text2 = array[1]; if (a == "m_bUseNet") { if (text2 == "1") { this.NetUse = true; } else { this.NetUse = false; } } else if (a == "m_strCM3D2Path") { text2 = text2.Replace("/", "\\"); if (!string.IsNullOrEmpty(text2)) { if (!File.Exists(text2 + "\\CM3D2.exe")) { NDebug.Assert("2.0互換パス " + text2 + " には CM3D2.exe が無く、互換モードは無効です。", true); text2 = string.Empty; } else if (!File.Exists(text2 + "\\GameData\\csv.arc")) { NDebug.Assert("2.0互換パス " + text2 + " には csv.arc が無く、互換モードは無効です。", true); text2 = string.Empty; } else if (!File.Exists(text2 + "\\GameData\\script.arc")) { NDebug.Assert("2.0互換パス " + text2 + " には script.arc が無く、互換モードは無効です。", true); text2 = string.Empty; } } this.CM3D2Path = text2; } } } } } } private Dictionary> m_dicEditColorPresetData = new Dictionary>(); [XmlIgnore] public Dictionary m_GenericTmpFlag = new Dictionary(); public Dictionary m_SystemVers = new Dictionary(); private int[] m_nAntiAlias = new int[] { 0, 2, 4, 8 }; private Size m_siScreenSize = new Size { width = 1280, height = 720 }; private CMSystem.SSSuperSizeType m_eScreenShotSuperSize; private int m_nManAlpha = 50; private int m_nBloomValue = 100; private int m_nMsgWndAlpha; private int m_nMsgTextSpeed = 80; private int m_nMsgAutoSpeed = 50; private int m_nFadeSpeed = 100; private SubtitleDisplayManager.DisplayType m_SubtitleType; private int m_nDesktopCaptureMonitorNo = 1; private bool m_bEditItemGroup = true; private bool m_bEditTouchJump; private float m_fVRCameraHeightStand = 1.6f; private float m_fVRCameraHeightSit = 0.8f; private float m_fVRCameraMoveSpeedKey = 0.5f; private float m_fVRCameraRotSpeedKey = 0.5f; private bool m_bVRCameraPlaneMove; private float m_fVRCameraRotSpeedMouse = 0.5f; private bool m_bVRManShow = true; private float m_fVRCameraFov = 60f; private bool m_bVRCamRotDownUp; private int m_nOvrConfVer = 1470; private float m_fOvrHeadScale = 1f; private float m_fOvrCursorStabilization = 0.05f; private float m_fOvrCursorBoostSpeed = 0.2f; private int m_nOvrPointerMode; private int m_nOvrMoveMode; private float m_fOvrCursorPadSpeed = 130f; private float m_fOvrViveCursorLaserHitScale = 9f; private float m_fOvrViveCursorLaserEasing = 0.3f; private int m_nOvrHandCameraWidth = 720; private int m_nOvrHandCameraHeight = 1280; private Dictionary m_dicVRDDBG = new Dictionary(); private bool m_bOvrScreenMirror = true; private CMSystem.OVR_CAM_HEIGHT_TYPE m_eOvrCameraHeightType = CMSystem.OVR_CAM_HEIGHT_TYPE.VR; private bool m_bOvrMouseRot = true; private float m_fOvrUITabletSize = 1f; private bool m_bOvrUseTouch = true; private bool m_bUseNewControllerType = true; private bool m_bOvrUseSnapRotate = true; private int m_nOvrUseSnapRotateRate = 30; private readonly List> m_listScreenDefSize = new List> { new Size { width = 1024, height = 576 }, new Size { width = 1280, height = 720 }, new Size { width = 1366, height = 768 }, new Size { width = 1920, height = 1080 } }; private CMSystem.SerializeConfig m_SConfig = new CMSystem.SerializeConfig(); public enum SSSuperSizeType { X1, X2, X4, MAX } public enum AntiAliasType { None, X2, X4, X8, MAX } public enum ShadowQualityType { None, Low, Medium, High } public enum TextureQualityType { Low, Medium, High } public class TransDD { public TransDD() { } public TransDD(string strSaveString, int f_nOvrConfVer) { this.FromSaveString(strSaveString, f_nOvrConfVer); } public string ToSaveString() { string text = string.Concat(new string[] { this.m_vPos.x.ToString(), ":", this.m_vPos.y.ToString(), ":", this.m_vPos.z.ToString() }); string text2 = text; text = string.Concat(new string[] { text2, ":", this.m_qRot.x.ToString(), ":", this.m_qRot.y.ToString(), ":", this.m_qRot.z.ToString(), ":", this.m_qRot.w.ToString() }); text2 = text; return string.Concat(new string[] { text2, ":", this.m_vScale.x.ToString(), ":", this.m_vScale.y.ToString(), ":", this.m_vScale.z.ToString(), ":", this.m_bShow.ToString() }); } public void FromSaveString(string f_strString, int f_nOvrConfVer) { string[] array = f_strString.Split(new char[] { ':' }); try { this.m_vPos.x = float.Parse(array[0]); this.m_vPos.y = float.Parse(array[1]); this.m_vPos.z = float.Parse(array[2]); this.m_qRot.x = float.Parse(array[3]); this.m_qRot.y = float.Parse(array[4]); this.m_qRot.z = float.Parse(array[5]); this.m_qRot.w = float.Parse(array[6]); this.m_vScale.x = float.Parse(array[7]); this.m_vScale.y = float.Parse(array[8]); this.m_vScale.z = float.Parse(array[9]); if (f_nOvrConfVer >= 1470) { this.m_bShow = bool.Parse(array[10]); } } catch (Exception ex) { Debug.LogError(ex.Message); } } public Vector3 m_vPos; public Quaternion m_qRot; public Vector3 m_vScale; public bool m_bShow; } public enum OVR_CAM_HEIGHT_TYPE { REAL, VR } [Serializable] public class SerializeConfig : ISerializationCallbackReceiver { public int Version { get { return this.m_nVersion; } set { this.m_nVersion = value; } } public string DShowFilter { get { return this.m_strDShowFilter; } } public CMSystem.SerializeConfig.OVR_MOVE_TYPE OvrMoveType { get { return this.m_eOvrMoveType; } set { this.m_eOvrMoveType = value; } } public float OvrMoveDirSpeed { get { return this.m_fOvrMoveDirSpeed; } } public bool OvrViveSmoothRotatePadAreaUse { get { return this.m_bOvrViveSmoothRotateAreaUse; } set { this.m_bOvrViveSmoothRotateAreaUse = value; } } public float OvrViveSmoothRotatePadAriaRate { get { return this.m_fOvrViveSmoothUpDownPadAriaRate = this.m_fOvrViveSmoothRotatePadAriaRate; } set { this.m_fOvrViveSmoothUpDownPadAriaRate = (this.m_fOvrViveSmoothRotatePadAriaRate = Mathf.Clamp(value, 10f, 80f)); } } public bool OvrViveSmoothupDownPadAreaUse { get { return this.m_bOvrViveSmoothupDownPadAreaUse; } set { this.m_bOvrViveSmoothupDownPadAreaUse = value; } } public float OvrViveSmoothUpDownPadAriaRate { get { return this.OvrViveSmoothRotatePadAriaRate; } set { this.OvrViveSmoothRotatePadAriaRate = Mathf.Clamp(value, 10f, 80f); } } public bool OvrIkAllSceneEnable { get { return this.m_bOvrIkAllSceneEnable; } set { this.m_bOvrIkAllSceneEnable = value; } } public bool OvrRiftGripStickRotate { get { return this.m_bOvrRiftGripStickRotate; } set { this.m_bOvrRiftGripStickRotate = value; } } public bool OvrRiftTriggerStickUpDown { get { return this.m_bOvrRiftTriggerStickUpDown; } set { this.m_bOvrRiftTriggerStickUpDown = value; } } public float OvrIkSelfCamFovMin { get { return this.m_bOvrIkSelfCamFovMin; } set { this.m_bOvrIkSelfCamFovMin = value; } } public float OvrIkSelfCamFovMax { get { return this.m_bOvrIkSelfCamFovMax; } set { this.m_bOvrIkSelfCamFovMax = value; } } public bool OvrDDTouchToClick { get { return this.m_bOvrDesktopScreenTouchToClick; } set { this.m_bOvrDesktopScreenTouchToClick = value; } } public bool OvrDDtoBG { get { return this.m_bOvrDesktopScreenPosSaveToBG; } set { this.m_bOvrDesktopScreenPosSaveToBG = value; } } public bool OvrTabletFrameHideWhenMsgWndVisible { get { return this.m_bOvrTabletFrameHideWhenMsgWndVisible; } set { this.m_bOvrTabletFrameHideWhenMsgWndVisible = value; } } public void OnBeforeSerialize() { this.m_nVersion = 1170; } public void OnAfterDeserialize() { } [SerializeField] private int m_nVersion = 1170; [SerializeField] private string m_strDShowFilter = "Microsoft DTV-DVD Video Decoder"; [SerializeField] private CMSystem.SerializeConfig.OVR_MOVE_TYPE m_eOvrMoveType; [SerializeField] private float m_fOvrMoveDirSpeed = 5f; [SerializeField] private bool m_bOvrViveSmoothRotateAreaUse = true; [SerializeField] private float m_fOvrViveSmoothRotatePadAriaRate = 30f; [SerializeField] private bool m_bOvrViveSmoothupDownPadAreaUse = true; [SerializeField] private float m_fOvrViveSmoothUpDownPadAriaRate = 30f; [SerializeField] private bool m_bOvrIkAllSceneEnable; [SerializeField] private bool m_bOvrRiftGripStickRotate = true; [SerializeField] private bool m_bOvrRiftTriggerStickUpDown = true; [SerializeField] private float m_bOvrIkSelfCamFovMin = 20f; [SerializeField] private float m_bOvrIkSelfCamFovMax = 80f; [SerializeField] private bool m_bOvrDesktopScreenTouchToClick = true; [SerializeField] private bool m_bOvrDesktopScreenPosSaveToBG; [SerializeField] private bool m_bOvrTabletFrameHideWhenMsgWndVisible = true; public enum OVR_MOVE_TYPE { WARP_DRAW_STEPROT, DIRECTION } } }