Browse Source

Clean up init() and make tiny change to ComboBox

init()
- Pull cm3d2 photo bgs from nei
- Add missing bgm (at least the ones I have that's missing)
- Rewrite a bunch of stuff to be more concise (maybe more performant)
- Remove stuff that pretty much does nothing

ComboBox
- Just steal the entire onHover style
habeebweeb 4 years ago
parent
commit
a1c4cb8470

+ 157 - 433
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Init.cs

@@ -92,8 +92,6 @@ namespace CM3D2.MultipleMaids.Plugin
             isDance = false;
             isDanceChu = false;
             isSavePose = false;
-            // bgIndex = 0;
-            // bgIndexB = 0;
             bgIndex = bgCombo2.selectedItemIndex = bgCombo.selectedItemIndex = Array.FindIndex(bgArray, bg => bg == "Theater");
             bg.localScale = new Vector3(1f, 1f, 1f);
             softG = new Vector3(0.0f, -3f / 1000f, 0.0f);
@@ -440,9 +438,7 @@ namespace CM3D2.MultipleMaids.Plugin
             lightComboList[0] = new GUIContent("メイン");
             lightCombo.selectedItemIndex = 0;
             selectLightIndex = 0;
-            // bgCombo.selectedItemIndex = 0;
             kankyoCombo.selectedItemIndex = 0;
-            // bgCombo2.selectedItemIndex = 0;
             itemCombo2.selectedItemIndex = 0;
             slotCombo.selectedItemIndex = 0;
             sortList.Clear();
@@ -966,9 +962,7 @@ namespace CM3D2.MultipleMaids.Plugin
             lightComboList[0] = new GUIContent("メイン");
             lightCombo.selectedItemIndex = 0;
             selectLightIndex = 0;
-            // bgCombo.selectedItemIndex = 0;
             kankyoCombo.selectedItemIndex = 0;
-            // bgCombo2.selectedItemIndex = 0;
             itemCombo2.selectedItemIndex = 0;
             slotCombo.selectedItemIndex = 0;
             sortList.Clear();
@@ -1003,31 +997,15 @@ namespace CM3D2.MultipleMaids.Plugin
             }
 
             doguObject.Clear();
-            string path1 = Path.GetFullPath(".\\") + "Mod\\MultipleMaidsPose";
-            if (!File.Exists(path1))
+            string mmPosePath = Path.GetFullPath(".\\") + "Mod\\MultipleMaidsPose";
+            if (!File.Exists(mmPosePath))
             {
-                Directory.CreateDirectory(path1);
+                Directory.CreateDirectory(mmPosePath);
             }
 
             int countS = this.countS;
-            Action<string, List<string>> action1 = (path, result_list) =>
-                                                            {
-                                                                string[] files = Directory.GetFiles(path);
-                                                                this.countS = 0;
-                                                                for (int index = 0; index < files.Length; ++index)
-                                                                {
-                                                                    if (Path.GetExtension(files[index]) == ".anm")
-                                                                    {
-                                                                        strListS.Add(files[index].Split('\\')[files[index]
-                                                                                                              .Split('\\').Length - 1]
-                                                                                                 .Split('.')[0] + "                    /"
-                                                                                                                + files[index]);
-                                                                        ++this.countS;
-                                                                    }
-                                                                }
-                                                            };
-            List<string> stringList1 = new List<string>();
-            action1(path1, stringList1);
+            this.countS = Directory.GetFiles(mmPosePath).Where(f => Path.GetExtension(f) == ".anm").Count();
+
             if (this.countS != countS)
             {
                 poseArray = null;
@@ -1038,84 +1016,6 @@ namespace CM3D2.MultipleMaids.Plugin
                 return;
             }
 
-            strList2 = new List<string>();
-            strListE = new List<string>();
-            strListE2 = new List<string>();
-            strListS = new List<string>();
-            strListD = new List<string>();
-            strS = "";
-            List<string> stringList2 = new List<string>
-            {
-                string.Empty
-            };
-            stringList2.AddRange(GameUty.PathList);
-            List<string> bgList2 = new List<string>();
-            Action<string> action2 = strFileName =>
-                                              {
-                                                  if (!GameUty.FileSystem.IsExistentFile(strFileName))
-                                                  {
-                                                      return;
-                                                  }
-
-                                                  using (AFileBase file = GameUty.FileSystem.FileOpen(strFileName))
-                                                  {
-                                                      using (CsvParser csvParser = new CsvParser())
-                                                      {
-                                                          csvParser.Open(file);
-                                                          for (int cell_y = 1; cell_y < csvParser.max_cell_y; ++cell_y)
-                                                          {
-                                                              if (csvParser.IsCellToExistData(0, cell_y))
-                                                              {
-                                                                  bgList2.Add(csvParser.GetCellAsString(1, cell_y));
-                                                              }
-                                                          }
-                                                      }
-                                                  }
-                                              };
-            action2("edit_bg.nei");
-            for (int index = 0; index < stringList2.Count; ++index)
-            {
-                action2("edit_bg_" + stringList2[index] + ".nei");
-            }
-
-            List<string> stringList3 = new List<string>();
-            for (int index1 = 0; index1 < bgList2.Count; ++index1)
-            {
-                bool flag = false;
-                for (int index2 = 0; index2 < bgArray21.Length; ++index2)
-                {
-                    if (bgList2[index1] == bgArray21[index2])
-                    {
-                        flag = true;
-                    }
-                }
-
-                if (!flag && bgList2[index1] != "HoneymoonRoom" && bgList2[index1] != "ClassRoom_Play" && bgList2[index1] != "BigSight"
-                    && bgList2[index1] != "PrivateRoom" && bgList2[index1] != "Sea_Night" && bgList2[index1] != "Yashiki")
-                {
-                    stringList3.Add(bgList2[index1]);
-                }
-            }
-
-            if (GameMain.Instance.BgMgr.CreateAssetBundle("SMRoom2") != null)
-            {
-                isVP = true;
-            }
-            if (GameMain.Instance.BgMgr.CreateAssetBundle("Train") != null)
-            {
-                isPP = true;
-            }
-
-            if (GameMain.Instance.BgMgr.CreateAssetBundle("HoneymoonRoom") != null)
-            {
-                isPP2 = true;
-            }
-
-            if (GameMain.Instance.BgMgr.CreateAssetBundle("BigSight") != null)
-            {
-                isPP3 = true;
-            }
-
             if (GameMain.Instance.BgMgr.CreateAssetBundle("rotenburo") != null)
             {
                 isVA = true;
@@ -1133,64 +1033,30 @@ namespace CM3D2.MultipleMaids.Plugin
 
             List<string> stringList4 = new List<string>(350 + poseArray2.Length);
             stringList4.AddRange(poseArray2);
+
             List<string> stringList5 = new List<string>();
-            for (int index = 11; index < 200; ++index)
+
+            // Seems to only produce 'edit_pose_027'
+            for (int poseIndex = 11; poseIndex < 100; poseIndex++)
             {
-                if (index < 100)
+                string pose = $"edit_pose_{poseIndex:000}_f";
+                if (GameUty.FileSystem.IsExistentFile($"{pose}.anm"))
                 {
-                    using (AFileBase afileBase1 = GameUty.FileSystem.FileOpen("edit_pose_0" + index + "_f.anm"))
-                    {
-                        if (afileBase1.IsValid())
-                        {
-                            stringList5.Add("edit_pose_0" + index + "_f");
-                        }
-                        else
-                        {
-                            using (AFileBase afileBase2 = GameUty.FileSystem.FileOpen("edit_pose_" + index + "_f.anm"))
-                            {
-                                if (afileBase2.IsValid())
-                                {
-                                    stringList5.Add("edit_pose_" + index + "_f");
-                                }
-                            }
-                        }
-                    }
+                    stringList5.Add(pose);
                 }
             }
 
-            for (int index1 = 15; index1 < 25; ++index1)
+            // Update when denkigai 2025 releases
+            for (int year = 17; year < 25; year++)
             {
-                for (int index2 = 0; index2 < 2; ++index2)
+                foreach (char sw in "sw")
                 {
-                    string str = "s";
-                    if (index2 == 1)
+                    for (int poseIndex = 1; poseIndex < 10; poseIndex++)
                     {
-                        str = "w";
-                    }
-
-                    for (int index3 = 1; index3 < 20; ++index3)
-                    {
-                        if (index3 < 10)
+                        string pose = $"edit_pose_dg{year}{sw}_{poseIndex:000}_f";
+                        if (GameUty.FileSystem.IsExistentFile($"{pose}.anm"))
                         {
-                            using (AFileBase afileBase3 =
-                                GameUty.FileSystem.FileOpen("edit_pose_dg" + index1 + str + "_00" + index3 + "_f.anm"))
-                            {
-                                if (afileBase3.IsValid())
-                                {
-                                    stringList5.Add("edit_pose_dg" + index1 + str + "_00" + index3 + "_f");
-                                }
-                                else
-                                {
-                                    using (AFileBase afileBase4 =
-                                        GameUty.FileSystem.FileOpen("edit_pose_dg" + index1 + str + "_0" + index3 + "_f.anm"))
-                                    {
-                                        if (afileBase4.IsValid())
-                                        {
-                                            stringList5.Add("edit_pose_dg" + index1 + str + "_0" + index3 + "_f");
-                                        }
-                                    }
-                                }
-                            }
+                            stringList5.Add(pose);
                         }
                     }
                 }
@@ -1198,22 +1064,7 @@ namespace CM3D2.MultipleMaids.Plugin
 
             if (stringList5.Count > 0)
             {
-                stringList4.AddRange(stringList5.ToArray());
-            }
-
-            using (GameUty.FileSystem.FileOpen("dance_cm3d_003_sp2_f1.anm"))
-            {
-                ;
-            }
-
-            using (GameUty.FileSystem.FileOpen("dance_cm3d2_kara_003_ddfl_f1.anm"))
-            {
-                ;
-            }
-
-            using (GameUty.FileSystem.FileOpen("dance_cm3d2_kara02_001_smt_f1.anm"))
-            {
-                ;
+                stringList4.AddRange(stringList5);
             }
 
             stringList4.AddRange(poseArrayVP2);
@@ -1221,85 +1072,70 @@ namespace CM3D2.MultipleMaids.Plugin
             stringList4.AddRange(poseArray4);
             stringList4.AddRange(poseArray5);
             stringList4.AddRange(poseArray6);
-            poseArray = stringList4.ToArray();
-            ((Action<string, List<string>>)((path, result_list) =>
-                                               {
-                                                   string[] files = Directory.GetFiles(path);
-                                                   this.countS = 0;
-                                                   for (int index = 0; index < files.Length; ++index)
-                                                   {
-                                                       if (Path.GetExtension(files[index]) == ".anm")
-                                                       {
-                                                           strListS.Add(files[index].Split('\\')[files[index].Split('\\').Length - 1]
-                                                                                    .Split('.')[0] + "                    /"
-                                                                                                   + files[index]);
-                                                           ++this.countS;
-                                                       }
-                                                   }
-                                               }))(Path.GetFullPath(".\\") + "Mod\\MultipleMaidsPose", new List<string>());
+
+            strList2 = new List<string>();
+            strListE = new List<string>();
+            strListE2 = new List<string>();
+            strListS = new List<string>();
+            HashSet<string> poseSet = new HashSet<string>(stringList4);
+            strS = "";
+            this.countS = 0;
+            foreach (string file in Directory.GetFiles(Path.GetFullPath(".\\") + "Mod\\MultipleMaidsPose"))
+            {
+                if (Path.GetExtension(file) == ".anm")
+                {
+                    string withoutExtension = Path.GetFileNameWithoutExtension(file);
+                    string mmPose = $"{withoutExtension}{twentySpaces}/{file}";
+                    strListS.Add(mmPose);
+                    ++this.countS;
+                }
+            }
             string[] list = GameUty.FileSystem.GetList("motion", AFileSystemBase.ListType.AllFile);
-            int num = 0;
             List<string> stringList6 = new List<string>();
+
             foreach (string path2 in list)
             {
                 string withoutExtension = Path.GetFileNameWithoutExtension(path2);
                 string directoryName = Path.GetDirectoryName(path2);
                 if (!withoutExtension.StartsWith("maid_motion_") && !withoutExtension.StartsWith("work_00")
-                                                                 && !withoutExtension.EndsWith("_3_") && !withoutExtension.EndsWith("_5_")
-                                                                 && !withoutExtension.StartsWith("ck_")
-                                                                 && !withoutExtension.StartsWith("vr_")
-                                                                 && !withoutExtension.StartsWith("dance_mc")
-                                                                 && !withoutExtension.Contains("a01_") && !withoutExtension.StartsWith("j_")
-                                                                 && !withoutExtension.StartsWith("k_") && !withoutExtension.StartsWith("t_")
-                                                                 && !withoutExtension.StartsWith("cbl_")
-                                                                 && !withoutExtension.Contains("b01_") && !withoutExtension.Contains("b02_")
-                                                                 && !withoutExtension.Contains("_kubi_")
-                                                                 && !withoutExtension.EndsWith("_m2") && !withoutExtension.EndsWith("_m3")
-                                                                 && !withoutExtension.Contains("_m2_once")
-                                                                 && !withoutExtension.Contains("_m3_once")
-                                                                 && !withoutExtension.StartsWith("h_")
-                                                                 && !withoutExtension.StartsWith("event_")
-                                                                 && !withoutExtension.StartsWith("man_") && !withoutExtension.EndsWith("_m")
-                                                                 && !withoutExtension.Contains("_m_") && !withoutExtension.Contains("_man")
-                                                                 && !(withoutExtension == "dance_cm3d2_001_zoukin")
-                                                                 && !(withoutExtension == "dance_cm3d2_001_mop")
-                                                                 && !(withoutExtension == "maid_motion")
-                                                                 && !(withoutExtension == "aruki_1_idougo_f")
-                                                                 && !(withoutExtension == "sleep2") && !(withoutExtension == "stand_akire2")
-                                                                 && !(withoutExtension == "ero_scene_001")
-                                                                 && !(withoutExtension == "ero_scenefm_001")
-                                                                 && !(withoutExtension == "training_001")
-                                                                 && !(withoutExtension == "workff_001")
-                                                                 && !(withoutExtension == "workfm_001")
-                                                                 && !(withoutExtension == "dance_cm3d21_005_moe_mset")
-                                                                 && !(withoutExtension == "hinpyoukai_001"))
+                #region huge if condition
+                    && !withoutExtension.EndsWith("_3_") && !withoutExtension.EndsWith("_5_")
+                    && !withoutExtension.StartsWith("ck_")
+                    && !withoutExtension.StartsWith("vr_")
+                    && !withoutExtension.StartsWith("dance_mc")
+                    && !withoutExtension.Contains("a01_") && !withoutExtension.StartsWith("j_")
+                    && !withoutExtension.StartsWith("k_") && !withoutExtension.StartsWith("t_")
+                    && !withoutExtension.StartsWith("cbl_")
+                    && !withoutExtension.Contains("b01_") && !withoutExtension.Contains("b02_")
+                    && !withoutExtension.Contains("_kubi_")
+                    && !withoutExtension.EndsWith("_m2") && !withoutExtension.EndsWith("_m3")
+                    && !withoutExtension.Contains("_m2_once")
+                    && !withoutExtension.Contains("_m3_once")
+                    && !withoutExtension.StartsWith("h_")
+                    && !withoutExtension.StartsWith("event_")
+                    && !withoutExtension.StartsWith("man_") && !withoutExtension.EndsWith("_m")
+                    && !withoutExtension.Contains("_m_") && !withoutExtension.Contains("_man")
+                    && !(withoutExtension == "dance_cm3d2_001_zoukin")
+                    && !(withoutExtension == "dance_cm3d2_001_mop")
+                    && !(withoutExtension == "maid_motion")
+                    && !(withoutExtension == "aruki_1_idougo_f")
+                    && !(withoutExtension == "sleep2") && !(withoutExtension == "stand_akire2")
+                    && !(withoutExtension == "ero_scene_001")
+                    && !(withoutExtension == "ero_scenefm_001")
+                    && !(withoutExtension == "training_001")
+                    && !(withoutExtension == "workff_001")
+                    && !(withoutExtension == "workfm_001")
+                    && !(withoutExtension == "dance_cm3d21_005_moe_mset")
+                    && !(withoutExtension == "hinpyoukai_001"))
+                #endregion
                 {
                     if (!directoryName.Contains("\\sex\\"))
                     {
-                        if (!withoutExtension.StartsWith("sex_"))
+                        if (!withoutExtension.StartsWith("sex_") && !withoutExtension.StartsWith("dance_test"))
                         {
-                            if (withoutExtension.StartsWith("dance_test"))
+                            if (!strListS.Exists(mmPose => withoutExtension == mmPose.Split('/')[0].Replace(twentySpaces, "")))
                             {
-                                strListD.Add(withoutExtension);
-                            }
-                            else
-                            {
-                                bool flag = false;
-                                foreach (string str1 in strListS)
-                                {
-                                    char[] chArray = new char[1] { '/' };
-                                    string str2 = str1.Split(chArray)[0].Replace("                    ", "");
-                                    if (withoutExtension == str2)
-                                    {
-                                        flag = true;
-                                        break;
-                                    }
-                                }
-
-                                if (!flag)
-                                {
-                                    stringList6.Add(withoutExtension);
-                                }
+                                stringList6.Add(withoutExtension);
                             }
                         }
                     }
@@ -1310,85 +1146,23 @@ namespace CM3D2.MultipleMaids.Plugin
                 }
             }
 
-            foreach (string str in stringList6)
-            {
-                bool flag = false;
-                for (int index = 0; index < poseArray.Length; ++index)
-                {
-                    if (str == poseArray[index])
-                    {
-                        flag = true;
-                    }
-                }
-
-                if (!flag && str.StartsWith("edit_"))
-                {
-                    strList2.Add(str);
-                }
-            }
-
-            foreach (string str in stringList6)
-            {
-                bool flag = false;
-                for (int index = 0; index < poseArray.Length; ++index)
-                {
-                    if (str == poseArray[index])
-                    {
-                        flag = true;
-                    }
-                }
-
-                if (!flag && str.StartsWith("pose_"))
-                {
-                    strList2.Add(str);
-                }
-            }
+            strList2.AddRange(stringList6.Where(str => !poseSet.Contains(str) && str.StartsWith("edit_")));
+            strList2.AddRange(stringList6.Where(str => !poseSet.Contains(str) && str.StartsWith("pose_")));
+            strList2.AddRange(stringList6.Where(str => !poseSet.Contains(str) && !str.StartsWith("edit_") && !str.StartsWith("pose_")));
+            strListE2.AddRange(strListE.Where(str => !poseSet.Contains(str)));
 
-            foreach (string str in stringList6)
-            {
-                bool flag = false;
-                for (int index = 0; index < poseArray.Length; ++index)
-                {
-                    if (str == poseArray[index])
-                    {
-                        flag = true;
-                    }
-                }
+            stringList4.AddRange(strList2);
+            stringList4.AddRange(strListE2);
 
-                if (!flag && !str.StartsWith("edit_") && !str.StartsWith("pose_"))
-                {
-                    strList2.Add(str);
-                }
-            }
-
-            foreach (string str in strListE)
-            {
-                bool flag = false;
-                for (int index = 0; index < poseArray.Length; ++index)
-                {
-                    if (str == poseArray[index])
-                    {
-                        flag = true;
-                    }
-                }
-
-                if (!flag)
-                {
-                    strListE2.Add(str);
-                    ++num;
-                }
-            }
-
-            stringList4.AddRange(strList2.ToArray());
-            stringList4.AddRange(strListE2.ToArray());
+            // What is this for?
             existPose = false;
             poseIniStr = "";
             foreach (IniKey key in Preferences["pose"].Keys)
             {
                 IniKey iniKey = Preferences["pose"][key.Key];
-                if (iniKey.Value != null && iniKey.Value != "" && iniKey.Value != "del")
+                if (!string.IsNullOrEmpty(iniKey.Value) && iniKey.Value != "del")
                 {
-                    stringList4.AddRange(new string[1] { key.Key });
+                    stringList4.Add(key.Key);
                     existPose = true;
                     if (poseIniStr == "")
                     {
@@ -1397,7 +1171,7 @@ namespace CM3D2.MultipleMaids.Plugin
                 }
             }
 
-            stringList4.AddRange(strListS.ToArray());
+            stringList4.AddRange(strListS);
             poseArray = stringList4.ToArray();
             List<string> stringList7 = new List<string>(50 + poseGroupArray2.Length);
             stringList7.AddRange(poseGroupArray2);
@@ -1421,37 +1195,22 @@ namespace CM3D2.MultipleMaids.Plugin
 
             poseGroupArray = stringList7.ToArray();
             groupList = new ArrayList();
-            for (int index1 = 0; index1 < poseArray.Length; ++index1)
+            for (int i = 0; i < poseArray.Length; i++)
             {
-                for (int index2 = 0; index2 < poseGroupArray.Length; ++index2)
+                foreach (string poseGroup in poseGroupArray)
                 {
-                    if (poseGroupArray[index2] == poseArray[index1])
+                    if (poseGroup == poseArray[i])
                     {
-                        groupList.Add(index1);
-                        if (poseGroupArray[index2] == strList2[0])
+                        groupList.Add(i);
+                        if (poseGroup == strList2[0])
                         {
-                            sPoseCount = index1;
+                            sPoseCount = i;
                         }
                     }
                 }
             }
 
-            string[] strArray1 = new string[1] { "Salon_Day" };
-            string[] strArray2 = new string[2] { "SMRoom2", "LockerRoom" };
-            string[] strArray3 = new string[4] { "Train", "Toilet", "Oheya", "MyBedRoom_NightOff" };
-            string[] strArray4 = new string[4] { "ClassRoom", "ClassRoom_Play", "HoneymoonRoom", "OutletPark" };
-            string[] strArray5 = new string[9]
-            {
-                    "BigSight", "BigSight_Night", "PrivateRoom", "PrivateRoom_Night", "Sea", "Sea_Night", "Yashiki_Day", "Yashiki",
-                    "Yashiki_Pillow"
-            };
-            string[] strArray6 = new string[8]
-            {
-                    "rotenburo", "rotenburo_night", "villa", "villa_night", "villa_bedroom", "villa_bedroom_night", "villa_farm",
-                    "villa_farm_night"
-            };
-            string[] strArray7 = new string[1] { "karaokeroom" };
-            List<string> stringList8 = new List<string>(50 + poseArray2.Length);
+            List<string> bgList = new List<string>(50 + poseArray2.Length);
 
             PhotoBGData.Create();
             bgDict = new Dictionary<string, string>();
@@ -1468,144 +1227,111 @@ namespace CM3D2.MultipleMaids.Plugin
 
             bgUiNames.ToList().ForEach(x => bgDict[x.Key] = x.Value);
 
-            stringList8.AddRange(neiList);
+            bgList.AddRange(neiList);
 
-            List<string> stringList9 = new List<string>();
+            List<string> myRoomBgList = new List<string>();
             Dictionary<string, string> saveDataDic = CreativeRoomManager.GetSaveDataDic();
             if (saveDataDic != null)
             {
                 foreach (KeyValuePair<string, string> keyValuePair in saveDataDic)
                 {
-                    stringList9.Add(keyValuePair.Key);
+                    myRoomBgList.Add(keyValuePair.Key);
                     bgDict[keyValuePair.Key] = keyValuePair.Value;
                 }
             }
 
-            stringList8.AddRange(stringList9.ToArray());
+            bgList.AddRange(myRoomBgList);
+
             if (isCM3D2)
             {
-                stringList8.AddRange(bgArray21);
-                if (isVP)
-                {
-                    stringList8.AddRange(strArray2);
-                }
-
-                if (isPP)
+                if (GameUty.FileSystemOld.IsExistentFile("phot_bg_list.nei"))
                 {
-                    stringList8.AddRange(strArray3);
+                    List<string> cm3d2BgList = new List<string>(50);
+                    using (AFileBase file = GameUty.FileSystemOld.FileOpen("phot_bg_list.nei"))
+                    {
+                        using (CsvParser csvParser = new CsvParser())
+                        {
+                            csvParser.Open(file);
+                            for (int cell_y = 1; cell_y < csvParser.max_cell_y; ++cell_y)
+                            {
+                                if (csvParser.IsCellToExistData(3, cell_y))
+                                {
+                                    string data = csvParser.GetCellAsString(3, cell_y);
+                                    cm3d2BgList.Add(data);
+                                    // ew
+                                    if (data == "Yashiki") cm3d2BgList.Add("Yashiki_Pillow");
+                                }
+                            }
+                        }
+                    }
+                    bgList.AddRange(cm3d2BgList);
                 }
+            }
 
-                if (isPP2)
-                {
-                    stringList8.AddRange(strArray4);
-                }
+            bgArray = bgList.ToArray();
 
-                if (isPP3)
-                {
-                    stringList8.AddRange(strArray5);
-                }
+            bgIndex = bgCombo2.selectedItemIndex = bgCombo.selectedItemIndex = Array.FindIndex(bgArray, bg => bg == "Theater");
 
-                if (isVA)
-                {
-                    stringList8.AddRange(strArray6);
-                }
+            List<string> bgmList = new List<string>(50) { "bgm008" };
 
-                if (isKA || isKA2)
+            for (int i = 1; i < 33; i++)
+            {
+                if (i == 8) continue;
+                string bgm = $"bgm{i:000}";
+                if (GameUty.FileSystem.IsExistentFile($"{bgm}.ogg"))
                 {
-                    stringList8.AddRange(strArray7);
+                    bgmList.Add(bgm);
                 }
-
-                stringList8.AddRange(strArray1);
             }
 
-            bgArray = stringList8.ToArray();
-            bgIndex = bgCombo2.selectedItemIndex = bgCombo.selectedItemIndex = Array.FindIndex(bgArray, bg => bg == "Theater");
-            string[] strArray8 = new string[3] { "dokidokifallinlove_short_inst", "dokidokifallinlove_short", "entrancetoyou_short" };
-            string[] strArray9 = new string[1] { "scarlet leap_short" };
-            string[] strArray11 = new string[1] { "RhythmixToYou" };
-            string[] strArray15 = new string[5]
-            {
-                    "bloomingdreaming_short", "kiminiaijodelicious_short", "luminousmoment_short", "nightmagicfire_short",
-                    "melodyofempire_short"
-            };
-            List<string> stringList10 = new List<string>(50);
-            stringList10.AddRange(bgmArray2);
-            List<string> stringList11 = new List<string>();
-            for (int index = 18; index < 210; ++index)
+            bgmList.AddRange(new string[]
             {
-                if (index < 100)
+                "bloomingdreaming_short", "canknowtwoclose_short", "dokidokifallinlove_short",
+                "dokidokifallinlove_short_inst", "entrancetoyou_short", "happyhappyscandal_short_nao_kara",
+                "kiminiaijodelicious_short", "luminousmoment_short", "melodyofempire_short",
+                "nightmagicfire_short", "rhythmixtoyou", "scarlet leap_short",
+                "stellarmytears_short_misato_kara", "stellarmytears_short_nao_kara", "stellarmytears_short_sasaki_kara",
+            });
+
+            bgmArray = bgmList.ToArray();
+
+            List<string> stringList12 = new List<string>(50 + parArray2.Length);
+            stringList12.AddRange(parArray2);
+            HashSet<int> enabled_id_list = new HashSet<int>();
+            Action<string> action3 = file_name =>
                 {
-                    using (AFileBase afileBase5 = GameUty.FileSystem.FileOpen("bgm0" + index + ".ogg"))
+                    if (GameUty.FileSystem.IsExistentFile(file_name))
                     {
-                        if (afileBase5.IsValid())
+                        using (AFileBase file = GameUty.FileSystem.FileOpen(file_name))
                         {
-                            stringList11.Add("bgm0" + index);
-                        }
-                        else
-                        {
-                            using (AFileBase afileBase6 = GameUty.FileSystem.FileOpen("bgm" + index + ".ogg"))
+                            using (CsvParser csvParser = new CsvParser())
                             {
-                                if (afileBase6.IsValid())
+                                for (int cell_y = 1; cell_y < csvParser.max_cell_y; ++cell_y)
                                 {
-                                    stringList11.Add("bgm" + index);
+                                    if (csvParser.IsCellToExistData(0, cell_y))
+                                    {
+                                        int cellAsInteger = csvParser.GetCellAsInteger(0, cell_y);
+                                        if (!enabled_id_list.Contains(cellAsInteger))
+                                        {
+                                            enabled_id_list.Add(cellAsInteger);
+                                        }
+                                    }
                                 }
                             }
                         }
                     }
-                }
-            }
+                };
 
-            if (stringList11.Count > 0)
+            action3("desk_item_enabled_id.nei");
+            foreach (string path in GameUty.PathList)
             {
-                stringList10.AddRange(stringList11.ToArray());
-            }
-
-            stringList10.AddRange(strArray8);
-            stringList10.AddRange(strArray9);
-            stringList10.AddRange(strArray11);
-            stringList10.AddRange(strArray15);
-            bgmArray = stringList10.ToArray();
-            List<string> stringList12 = new List<string>(50 + parArray2.Length);
-            stringList12.AddRange(parArray2);
-            HashSet<int> enabled_id_list = new HashSet<int>();
-            Action<string> action3 = file_name =>
-                                              {
-                                                  file_name += ".nei";
-                                                  if (!GameUty.FileSystem.IsExistentFile(file_name))
-                                                  {
-                                                      return;
-                                                  }
-
-                                                  using (AFileBase file = GameUty.FileSystem.FileOpen(file_name))
-                                                  {
-                                                      using (CsvParser csvParser = new CsvParser())
-                                                      {
-                                                          NDebug.Assert(csvParser.Open(file), file_name + "\nopen failed.");
-                                                          for (int cell_y = 1; cell_y < csvParser.max_cell_y; ++cell_y)
-                                                          {
-                                                              if (csvParser.IsCellToExistData(0, cell_y))
-                                                              {
-                                                                  int cellAsInteger = csvParser.GetCellAsInteger(0, cell_y);
-                                                                  if (!enabled_id_list.Contains(cellAsInteger))
-                                                                  {
-                                                                      enabled_id_list.Add(cellAsInteger);
-                                                                  }
-                                                              }
-                                                          }
-                                                      }
-                                                  }
-                                              };
-            action3("desk_item_enabled_id");
-            for (int index = 0; index < GameUty.PathList.Count; ++index)
-            {
-                action3("desk_item_enabled_id_" + GameUty.PathList[index]);
+                action3($"desk_item_enabled_id_{path}.nei");
             }
 
             using (AFileBase file = GameUty.FileSystem.FileOpen("desk_item_detail.nei"))
             {
                 using (CsvParser csv = new CsvParser())
                 {
-                    NDebug.Assert(csv.Open(file), "desk_item_detail.nei\nopen failed.");
                     for (int index = 1; index < csv.max_cell_y; ++index)
                     {
                         if (csv.IsCellToExistData(0, index))
@@ -1616,7 +1342,7 @@ namespace CM3D2.MultipleMaids.Plugin
                                 ItemData2 itemData2 = new ItemData2(csv, index);
                                 if (itemData2.asset_name != "")
                                 {
-                                    stringList12.AddRange(new string[1] { itemData2.name + "                    #" + itemData2.asset_name });
+                                    stringList12.Add($"{itemData2.name}{twentySpaces}#{itemData2.asset_name}");
                                 }
                             }
                         }
@@ -1657,9 +1383,9 @@ namespace CM3D2.MultipleMaids.Plugin
             }
 
             IEnumerable<string> propList1 = filteredList.Where(prpdata => !string.IsNullOrEmpty(prpdata.create_prefab_name))
-                                        .Select(prpdata => prpdata.create_prefab_name);
+                .Select(prpdata => prpdata.create_prefab_name);
             IEnumerable<string> propList2 = filteredList.Where(prpdata => !string.IsNullOrEmpty(prpdata.create_asset_bundle_name))
-                                        .Select(prpdata => prpdata.create_asset_bundle_name);
+                .Select(prpdata => prpdata.create_asset_bundle_name);
             List<string> propList = propList1.ToList();
             propList.AddRange(propList2.ToList());
             stringList13.AddRange(propList);
@@ -1705,8 +1431,6 @@ namespace CM3D2.MultipleMaids.Plugin
             }
 
             itemBArray = stringList14.ToArray();
-
-            //rectWin.y = GetPix(65);
         }
     }
 }

+ 11 - 25
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.cs

@@ -569,11 +569,15 @@ namespace CM3D2.MultipleMaids.Plugin
             ["SeaCafe"] = "SeaCafe",
             ["SeaCafe_Night"] = "SeaCafe (Night)",
             ["Sea_Night"] = "海(夜)",
+            ["Sea_VR"] = "海VR",
+            ["Sea_VR_Night"] = "海VR(夜)",
             ["ShinShitsumu"] = "執務室",
             ["ShinShitsumu_ChairRot"] = "執務室(椅子)",
             ["ShinShitsumu_Night"] = "執務室(夜)",
             ["Shitsumu"] = "執務室",
             ["Shitsumu_Night"] = "執務室(夜)",
+            ["Shitsumu_ChairRot"] = "執務室(椅子)",
+            ["Shitsumu_ChairRot_Night"] = "執務室(椅子・夜)",
             ["ShoppingMall"] = "ショッピングモール",
             ["ShoppingMall_Night"] = "ショッピングモール(夜)",
             ["Shukuhakubeya_BedRoom"] = "宿泊-ベッドルーム",
@@ -598,24 +602,16 @@ namespace CM3D2.MultipleMaids.Plugin
             ["Toilet"] = "Toilet",
             ["Town"] = "Town",
             ["Train"] = "電車",
-            ["villa"] = "ヴィラ1F",
-            ["villa_bedroom"] = "ヴィラ2F",
-            ["villa_bedroom_night"] = "ヴィラ2F(夜)",
-            ["villa_farm"] = "畑",
-            ["villa_farm_night"] = "畑(夜)",
-            ["villa_night"] = "ヴィラ1F(夜)",
+            ["Villa"] = "ヴィラ1F",
+            ["Villa_BedRoom"] = "ヴィラ2F",
+            ["Villa_BedRoom_Night"] = "ヴィラ2F(夜)",
+            ["Villa_Farm"] = "畑",
+            ["Villa_Farm_Night"] = "畑(夜)",
+            ["Villa_Night"] = "ヴィラ1F(夜)",
             ["Yashiki"] = "屋敷(夜)",
             ["Yashiki_Day"] = "屋敷",
             ["Yashiki_Pillow"] = "屋敷(夜・枕)",
         };
-
-        private readonly string[] bgArray21 = new string[23]
-        {
-                "Salon", "Syosai", "Syosai_Night", "DressRoom_NoMirror", "MyBedRoom", "MyBedRoom_Night", "Bathroom", "PlayRoom", "Pool",
-                "SMRoom", "PlayRoom2", "Salon_Garden", "LargeBathRoom", "MaidRoom", "OiranRoom", "Penthouse", "Town", "Kitchen",
-                "Kitchen_Night", "Shitsumu", "Shitsumu_Night", "Salon_Entrance", "Bar"
-        };
-
         private readonly ComboBox2 bgCombo = new ComboBox2();
         private readonly ComboBox2 bgCombo2 = new ComboBox2();
         private GUIContent[] bgCombo2List;
@@ -625,13 +621,6 @@ namespace CM3D2.MultipleMaids.Plugin
         private int bgIndex6;
         private int bgIndexB;
         private string[] bgmArray;
-
-        private readonly string[] bgmArray2 = new string[17]
-        {
-                "bgm008", "bgm001", "bgm002", "bgm003", "bgm004", "bgm005", "bgm006", "bgm007", "bgm009", "bgm010", "bgm011", "bgm012",
-                "bgm013", "bgm014", "bgm015", "bgm016", "bgm017"
-        };
-
         private readonly ComboBox2 bgmCombo = new ComboBox2();
         private GUIContent[] bgmComboList;
         private int bgmIndex;
@@ -4210,9 +4199,6 @@ namespace CM3D2.MultipleMaids.Plugin
         private bool isPoseEdit;
         private bool isPoseInit;
         private readonly bool[] isPoseIti = new bool[maxMaidCnt];
-        private bool isPP;
-        private bool isPP2;
-        private bool isPP3;
         private bool isPref;
         private bool isSavePose;
         private bool isSavePose2;
@@ -4256,7 +4242,6 @@ namespace CM3D2.MultipleMaids.Plugin
         private bool isToothoff;
         private bool isVA;
         private bool isWear;
-        private bool isVP;
         private bool isVR;
         private bool isVR2 = true;
         private bool isVRScroll = true;
@@ -4902,6 +4887,7 @@ namespace CM3D2.MultipleMaids.Plugin
         private Vector3 softG;
         private Vector3 softG2;
         private List<SortItem> sortList = new List<SortItem>();
+        private static readonly string twentySpaces = "                    ";
         private float speed = 1f;
         private Transform Spine;
         private Transform Spine0a;

+ 1 - 2
MultipleMaids/ComboBox2.cs

@@ -32,8 +32,7 @@ public class ComboBox2
                     GUIStyle boxStyle,
                     GUIStyle listStyle)
     {
-        listStyle.onNormal.textColor = listStyle.onHover.textColor;
-        listStyle.onNormal.background = listStyle.onHover.background;
+        listStyle.onNormal = listStyle.onHover;
         if (forceToUnShow)
         {
             forceToUnShow = false;