Forráskód Böngészése

Add MyRoomCustom BGs and missing CM3D2 BGs

Translation.GetList has been changed to return an IEnumerable<string>
for extra processing of the list and a separate method,
Translation.GetArray, has been added
habeebweeb 4 éve
szülő
commit
a4a69274c4

+ 2 - 0
COM3D2.MeidoPhotoStudio.Plugin/Config/MeidoPhotoStudio/translations.en.json

@@ -462,9 +462,11 @@
         "Toilet": "Toilet",
         "Town": "Town",
         "Train": "Train",
+        "train_notsurikawa": "Train (No Handles)",
         "Villa": "Villa 1F",
         "Villa_BedRoom": "Villa 2f",
         "Villa_BedRoom_Night": "Villa 2f (Night)",
+        "villa_bedroom_door": "Villa 2f (Door)",
         "Villa_Farm": "Garden",
         "Villa_Farm_Night": "Garden (Night)",
         "Villa_Night": "Villa 1F (Night)",

+ 24 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Constants.cs

@@ -30,9 +30,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public static readonly List<string> PoseGroupList;
         public static readonly Dictionary<string, List<string>> PoseDict;
         public static readonly Dictionary<string, List<KeyValuePair<string, string>>> CustomPoseDict;
-        public static int CustomPoseGroupsIndex { get; private set; }
+        public static int CustomPoseGroupsIndex { get; private set; } = -1;
+        public static int MyRoomCustomBGIndex { get; private set; } = -1;
         public static readonly List<string> FaceBlendList;
         public static readonly List<string> BGList;
+        public static List<KeyValuePair<string, string>> MyRoomCustomBGList;
 
         static Constants()
         {
@@ -52,6 +54,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             FaceBlendList = new List<string>();
 
             BGList = new List<string>();
+            MyRoomCustomBGList = new List<KeyValuePair<string, string>>();
         }
 
         public static void Initialize()
@@ -125,7 +128,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             CustomPoseGroupsIndex = PoseDict.Count;
 
-            Action<string> GetPoses = (directory) =>
+            Action<string> GetPoses = directory =>
             {
                 List<KeyValuePair<string, string>> poseList = new List<KeyValuePair<string, string>>();
                 foreach (string file in Directory.GetFiles(directory))
@@ -189,10 +192,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                         {
                             string bg = csvParser.GetCellAsString(3, cell_y);
                             BGList.Add(bg);
+                            // ew
+                            if (bg == "Yashiki") BGList.Add("Yashiki_Pillow");
+                            else if (bg == "Train") BGList.Add("train_notsurikawa");
                         }
                     }
                 }
             }
+
+            Dictionary<string, string> saveDataDict = MyRoomCustom.CreativeRoomManager.GetSaveDataDic();
+
+            if (saveDataDict != null)
+            {
+                MyRoomCustomBGIndex = BGList.Count;
+                MyRoomCustomBGList.AddRange(saveDataDict);
+            }
         }
 
         private static CsvParser OpenCsvParser(string nei, AFileSystemBase fs)
@@ -264,9 +278,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             return Translations[category][text];
         }
 
-        public static string[] GetList(string category, IEnumerable<string> list)
+        public static string[] GetArray(string category, IEnumerable<string> list)
         {
-            return list.Select(uiName => Get(category, uiName) ?? uiName).ToArray();
+            return GetList(category, list).ToArray();
+        }
+
+        public static IEnumerable<string> GetList(string category, IEnumerable<string> list)
+        {
+
+            return list.Select(uiName => Get(category, uiName) ?? uiName);
         }
 
         public static string[] GetList(string category, IEnumerable<KeyValuePair<string, string>> list)

+ 18 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/BackgroundSelectorPane.cs

@@ -1,4 +1,5 @@
 using UnityEngine;
+using System.Collections.Generic;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
@@ -15,11 +16,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             int theaterIndex = Constants.BGList.FindIndex(bg => bg == "Theater");
 
-            this.bgDropdown = new Dropdown(Translation.GetList("bgDropdown", Constants.BGList), theaterIndex);
+            List<string> bgList = new List<string>(Translation.GetList("bgDropdown", Constants.BGList));
+            if (Constants.MyRoomCustomBGIndex >= 0)
+            {
+                foreach (KeyValuePair<string, string> kvp in Constants.MyRoomCustomBGList)
+                {
+                    bgList.Add(kvp.Value);
+                }
+            }
+
+            this.bgDropdown = new Dropdown(bgList.ToArray(), theaterIndex);
             this.bgDropdown.SelectionChange += (s, a) =>
             {
-                string bg = Constants.BGList[this.bgDropdown.SelectedItemIndex];
-                environmentManager.ChangeBackground(bg);
+                int selectedIndex = this.bgDropdown.SelectedItemIndex;
+                bool isCreative = this.bgDropdown.SelectedItemIndex >= Constants.MyRoomCustomBGIndex;
+                string bg = isCreative
+                    ? Constants.MyRoomCustomBGList[selectedIndex - Constants.MyRoomCustomBGIndex].Key
+                    : Constants.BGList[selectedIndex];
+
+                environmentManager.ChangeBackground(bg, isCreative);
             };
 
             this.prevBGButton = new Button("<");

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidPoseSelectorPane.cs

@@ -21,7 +21,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.meidoManager = meidoManager;
 
-            this.poseGroupDropdown = new Dropdown(Translation.GetList("poseGroupDropdown", Constants.PoseGroupList));
+            this.poseGroupDropdown = new Dropdown(Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList));
             this.poseGroupDropdown.SelectionChange += ChangePoseGroup;
 
             this.poseDropdown = new Dropdown(MakePoseList(Constants.PoseDict[Constants.PoseGroupList[0]]));

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MainWindows/MaidFaceWindow.cs

@@ -24,7 +24,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.maidFaceSliderPane = new MaidFaceSliderPane(this.meidoManager);
 
             this.faceBlendDropdown = new Dropdown(
-                Translation.GetList("faceBlendPresetsDropdown", Constants.FaceBlendList)
+                Translation.GetArray("faceBlendPresetsDropdown", Constants.FaceBlendList)
             );
             this.faceBlendDropdown.SelectionChange += (s, a) =>
             {

+ 13 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EnvironmentManager.cs

@@ -11,14 +11,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private GameObject bgObject;
         private Transform bg;
         private CameraInfo cameraInfo;
-        public void ChangeBackground(string assetName)
+        public void ChangeBackground(string assetName, bool creative = false)
         {
-            GameMain.Instance.BgMgr.ChangeBg(assetName);
-            if (assetName == "KaraokeRoom")
+            if (creative)
             {
-                bg.transform.position = bgObject.transform.position;
-                bg.transform.localPosition = new Vector3(1f, 0f, 4f);
-                bg.transform.localRotation = Quaternion.Euler(new Vector3(0f, 90f, 0f));
+                GameMain.Instance.BgMgr.ChangeBgMyRoom(assetName);
+            }
+            else
+            {
+                GameMain.Instance.BgMgr.ChangeBg(assetName);
+                if (assetName == "KaraokeRoom")
+                {
+                    bg.transform.position = bgObject.transform.position;
+                    bg.transform.localPosition = new Vector3(1f, 0f, 4f);
+                    bg.transform.localRotation = Quaternion.Euler(new Vector3(0f, 90f, 0f));
+                }
             }
         }