void StoreSettings() { Maid maid = lastMaid; ExSaveData.SetBool(maid, PluginName, "AutoCameraInitialValue", bLastAutoCam); ExSaveData.SetBool(maid, PluginName, "EyeToCameraInitialValue", bLastEyeToCam); ExSaveData.Set(maid, PluginName, "ClothMaskMode", lastClothMaskMode.ToString()); ExSaveData.Set(maid, PluginName, "BgName", lastBgName); ExSaveData.Set(maid, PluginName, "PoseName", lastPoseName); ExSaveData.SetFloat(maid, PluginName, "CameraPos.x", lastCameraPos.x); ExSaveData.SetFloat(maid, PluginName, "CameraPos.y", lastCameraPos.y); ExSaveData.SetFloat(maid, PluginName, "CameraPos.z", lastCameraPos.z); ExSaveData.SetFloat(maid, PluginName, "CameraTargetPos.x", lastCameraTargetPos.x); ExSaveData.SetFloat(maid, PluginName, "CameraTargetPos.y", lastCameraTargetPos.y); ExSaveData.SetFloat(maid, PluginName, "CameraTargetPos.z", lastCameraTargetPos.z); ExSaveData.SetFloat(maid, PluginName, "CameraDistance", lastCameraDistance); ExSaveData.SetFloat(maid, PluginName, "CameraRotation.x", lastCameraRotation.x); ExSaveData.SetFloat(maid, PluginName, "CameraRotation.y", lastCameraRotation.y); ExSaveData.SetFloat(maid, PluginName, "CameraRotation.z", lastCameraRotation.z); ExSaveData.SetFloat(maid, PluginName, "CameraRotation.w", lastCameraRotation.w); ExSaveData.SetFloat(maid, PluginName, "CameraFov", lastCameraFov); Console.WriteLine( "PersonalizedEditSceneSettings.StoreSettings : name={0}{1}, autoCam={2}, eyeToCam={3}, cloth={4}, bg={5}, pose={6}", maid.Param.status.last_name, maid.Param.status.first_name, bLastAutoCam, bLastEyeToCam, lastClothMaskMode, lastBgName, lastPoseName); }
static void PathCheck(Maid maid, string PluginName, string fname) { if (!File.Exists(fname)) { fname = "Sybaris/UnityInjector/Config/MaidVoicePitchSlider.xml"; ExSaveData.Set(maid, PluginName, "SLIDER_TEMPLATE", fname); } }
// 動作していない古い設定を削除する static void CleanupExSave() { string[] obsoleteSettings = { "WIDESLIDER.enable", "PROPSET_OFF.enable", "LIPSYNC_OFF.enable", "HYOUJOU_OFF.enable", "EYETOCAMERA_OFF.enable", "MUHYOU.enable", "FARMFIX.enable", "EYEBALL.enable", "EYE_ANG.enable", "PELSCL.enable", "SKTSCL.enable", "THISCL.enable", "THIPOS.enable", "PELVIS.enable", "FARMFIX.enable", "SPISCL.enable", "S0ASCL.enable", "S1_SCL.enable", "S1ASCL.enable", "FACE_OFF.enable", "FACEBLEND_OFF.enable", // 以下0.2.4で廃止 "FACE_ANIME_SPEED", "MABATAKI_SPEED", "PELVIS", "PELVIS.x", "PELVIS.y", "PELVIS.z", }; CharacterMgr cm = GameMain.Instance.CharacterMgr; for (int i = 0, n = cm.GetStockMaidCount(); i < n; i++) { Maid maid = cm.GetStockMaid(i); foreach (string s in obsoleteSettings) { ExSaveData.Remove(maid, PluginName, s); } { string fname = ExSaveData.Get(maid, PluginName, "SLIDER_TEMPLATE", null); if (string.IsNullOrEmpty(fname)) { ExSaveData.Set(maid, PluginName, "SLIDER_TEMPLATE", "UnityInjector/Config/MaidVoicePitchSlider.xml", true); } } } string[] obsoleteGlobalSettings = { "TEST_GLOBAL_KEY" }; foreach (string s in obsoleteGlobalSettings) { ExSaveData.GlobalRemove(PluginName, s); } }
public static void FreeCommentToSetting(Maid maid, string PluginName, bool overwrite) { if (maid == null || maid.Param == null || maid.Param.status == null) { return; } string freeComment = maid.Param.status.free_comment; Func <string, bool> Contains = (str) => { if (freeComment == null) { return(false); } return(freeComment.Contains(str)); }; Func <string, string> String = (pattern) => { if (freeComment != null) { Match m = Regex.Match(freeComment, pattern); if (m.Groups.Count >= 2) { return(m.Groups[1].Value); } } return(null); }; Func <int, float, string, float> Float = (index, defaultValue, pattern) => { if (freeComment != null) { Match m = Regex.Match(freeComment, pattern); if (m.Groups.Count >= 2 + index) { return(Helper.StringToFloat(m.Groups[1 + index].Value, defaultValue)); } } return(defaultValue); }; string n = PluginName; // ExSaveData.SetBool(maid, n, "WIDESLIDER", Contains("#WIDESLIDER#") || Contains("#TEST_WIDE_SLIDER#"), overwrite); ExSaveData.SetBool(maid, n, "PROPSET_OFF", Contains("#PROPSET_OFF#") || Contains("#TEST_PROPSET_OFF#"), overwrite); ExSaveData.SetFloat(maid, n, "EYETOCAM", Contains("#EYETOCAM#") ? 1f : 0f, overwrite); ExSaveData.SetFloat(maid, n, "HEADTOCAM", Contains("#HEADTOCAM#") ? 1f : 0f, overwrite); ExSaveData.SetBool(maid, n, "LIPSYNC_OFF", Contains("#LIPSYNC_OFF#"), overwrite); ExSaveData.SetBool(maid, n, "HYOUJOU_OFF", Contains("#HYOUJOU_OFF#"), overwrite); ExSaveData.SetBool(maid, n, "EYETOCAMERA_OFF", Contains("#TEST_EYETOCAMERA_OFF#"), overwrite); ExSaveData.SetBool(maid, n, "MUHYOU", Contains("#MUHYOU#"), overwrite); ExSaveData.Set(maid, n, "FACE_SCRIPT_TEMPLATE", String(@"#TEST_FACE_SCRIPT_TEMPLATE=([^#]*)#"), overwrite); ExSaveData.SetFloat(maid, n, "FACE_ANIME_SPEED", Float(0, 1f, @"#TEST_FACE_ANIME_SPEED=([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.Set(maid, n, "SLIDER_TEMPLATE", String(@"#TEST_SLIDER_TEMPLATE=([^#]*)#"), overwrite); ExSaveData.SetFloat(maid, n, "PITCH", Float(0, 0f, @"#PITCH=([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "LIPSYNC", Float(0, 1f, @"#TEST_LIPSYNC=([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "EYEBALL.width", Float(0, 1f, @"#EYEBALL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "EYEBALL.height", Float(1, 1f, @"#EYEBALL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "EYE_RATIO", Float(0, 1f, @"#TEST_EYE_RATIO=([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "MABATAKI", Float(0, 1f, @"#MABATAKI=([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetBool(maid, n, "MABATAKI.pause", Contains("#MABATAKI_PAUSE#"), overwrite); // ExSaveData.SetFloat(maid, n, "MABATAKI.min", Float(0, 0f, @"#MABATAKI=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); // ExSaveData.SetFloat(maid, n, "MABATAKI.max", Float(1, 1f, @"#MABATAKI=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "EYE_ANG.angle", Float(0, 0f, @"#TEST_EYE_ANG=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "EYE_ANG.x", Float(1, 0f, @"#TEST_EYE_ANG=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "EYE_ANG.y", Float(2, 0f, @"#TEST_EYE_ANG=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "PELSCL.width", Float(0, 1f, @"#TEST_PELSCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "PELSCL.depth", Float(1, 1f, @"#TEST_PELSCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "PELSCL.height", Float(2, 1f, @"#TEST_PELSCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "THISCL.width", Float(0, 1f, @"#TEST_THISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "THISCL.depth", Float(1, 1f, @"#TEST_THISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "THIPOS.x", Float(0, 0f, @"#TEST_THIPOS=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "THIPOS.z", Float(1, 0f, @"#TEST_THIPOS=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetBool(maid, n, "PELVIS", Contains("#TEST_PELVIS_ENABLE#"), overwrite); ExSaveData.SetFloat(maid, n, "PELVIS.x", Float(0, 0f, @"#TEST_PELVIS=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "PELVIS.y", Float(1, 0f, @"#TEST_PELVIS=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "PELVIS.z", Float(2, 0f, @"#TEST_PELVIS=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetBool(maid, n, "FARMFIX", Contains("#FARMFIX##"), overwrite); ExSaveData.SetBool(maid, n, "SPISCL", Contains("#SPISCL"), overwrite); ExSaveData.SetFloat(maid, n, "SPISCL.width", Float(0, 1f, @"#SPISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "SPISCL.depth", Float(1, 1f, @"#SPISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "SPISCL.height", Float(2, 1f, @"#SPISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetBool(maid, n, "S0ASCL", Contains("#S0ASCL"), overwrite); ExSaveData.SetFloat(maid, n, "S0ASCL.width", Float(0, 1f, @"#S0ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "S0ASCL.depth", Float(1, 1f, @"#S0ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "S0ASCL.height", Float(2, 1f, @"#S0ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetBool(maid, n, "S1_SCL", Contains("#S1_SCL"), overwrite); ExSaveData.SetFloat(maid, n, "S1_SCL.width", Float(0, 1f, @"#S1_SCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "S1_SCL.depth", Float(1, 1f, @"#S1_SCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "S1_SCL.height", Float(2, 1f, @"#S1_SCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetBool(maid, n, "S1ASCL", Contains("#S1ASCL"), overwrite); ExSaveData.SetFloat(maid, n, "S1ASCL.width", Float(0, 1f, @"#S1ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "S1ASCL.depth", Float(1, 1f, @"#S1ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); ExSaveData.SetFloat(maid, n, "S1ASCL.height", Float(2, 1f, @"#S1ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#"), overwrite); }