Browse Source

clean

i got a cod analyrz.

is this wha i get 4 doing dontet thins in vscode??

I really hope nothing is broken.
habeebweeb 4 years ago
parent
commit
0211b82518
86 changed files with 1635 additions and 1876 deletions
  1. 1 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Configuration.cs
  2. 46 58
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Constants.cs
  3. 19 20
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/CustomGizmo.cs
  4. 15 16
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPoint.cs
  5. 5 5
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointGeneral.cs
  6. 35 47
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointLight.cs
  7. 2 3
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointMeido.cs
  8. 2 4
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Button.cs
  9. 9 12
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/ComboBox.cs
  10. 41 52
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/DropDown.cs
  11. 1 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/KeyRebindButton.cs
  12. 11 12
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/SelectionGrid.cs
  13. 15 15
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Slider.cs
  14. 2 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Toggle.cs
  15. 39 45
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/AttachPropPane.cs
  16. 41 44
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/ModPropsPane.cs
  17. 17 22
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/MyRoomPropsPane.cs
  18. 62 63
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/PropManagerPane.cs
  19. 37 46
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/PropsPane.cs
  20. 31 30
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/BackgroundSelectorPane.cs
  21. 32 35
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/DragPointPane.cs
  22. 48 48
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/BloomPane.cs
  23. 30 45
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/DepthOfFieldPane.cs
  24. 22 22
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectPane.cs
  25. 3 3
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectsPane.cs
  26. 53 53
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/FogPane.cs
  27. 32 32
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/VignettePane.cs
  28. 107 119
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/LightsPane.cs
  29. 3 3
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BasePane.cs
  30. 13 17
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/CallWindowPanes/MaidSelectorPane.cs
  31. 5 6
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/FaceWindowPanes/MaidFaceBlendPane.cs
  32. 10 10
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/FaceWindowPanes/MaidFaceSliderPane.cs
  33. 25 32
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BG2WindowPane.cs
  34. 20 23
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BGWindowPane.cs
  35. 8 12
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/CallWindowPane.cs
  36. 8 8
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/FaceWindowPane.cs
  37. 59 57
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/PoseWindowPane.cs
  38. 4 4
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/SettingsWindowPane.cs
  39. 5 6
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/OtherPanes/MaidSwitcherPane.cs
  40. 2 4
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/OtherPanes/TabsPane.cs
  41. 25 28
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/CopyPosePane.cs
  42. 14 14
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/GravityControlPane.cs
  43. 47 53
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/HandPresetPane.cs
  44. 26 31
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidDressingPane.cs
  45. 35 35
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidFreeLookPane.cs
  46. 27 27
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidIKPane.cs
  47. 63 65
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidPoseSelectorPane.cs
  48. 34 34
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MpnAttachPropPane.cs
  49. 26 26
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/SaveHandPane.cs
  50. 22 22
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/SavePosePane.cs
  51. 24 23
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/SceneManagerPanes/SceneManagerDirectoryPane.cs
  52. 16 13
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/SceneManagerPanes/SceneManagerScenePane.cs
  53. 16 17
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/SceneManagerPanes/SceneManagerTitleBar.cs
  54. 5 12
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/BaseWindow.cs
  55. 1 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/BaseWindowPane.cs
  56. 11 14
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MainWindow.cs
  57. 7 10
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MessageWindow.cs
  58. 36 30
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/SceneModalWindow.cs
  59. 12 13
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/SceneWindow.cs
  60. 6 9
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MaidPlacementUtility.cs
  61. 3 3
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManager.cs
  62. 4 10
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/BloomEffectManager.cs
  63. 1 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/DepthOfFieldManager.cs
  64. 6 7
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/FogEffectManager.cs
  65. 1 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/VignetteEffectManager.cs
  66. 19 28
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EnvironmentManager.cs
  67. 2 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/InputManager.cs
  68. 5 11
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/LightManager.cs
  69. 21 28
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MeidoManager.cs
  70. 33 36
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MessageWindowManager.cs
  71. 11 6
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/PropManager.cs
  72. 17 33
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/SceneManager.cs
  73. 1 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/WindowManager.cs
  74. 9 9
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointChain.cs
  75. 3 3
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointFinger.cs
  76. 8 15
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointHead.cs
  77. 1 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointSpine.cs
  78. 2 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointTorso.cs
  79. 19 21
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs
  80. 15 15
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/MeidoDragPointManager.cs
  81. 6 6
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs
  82. 2 2
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MenuFileCache.cs
  83. 33 69
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MenuFileUtility.cs
  84. 5 10
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MiscGUI.cs
  85. 3 6
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Translation.cs
  86. 32 34
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Configuration.cs

@@ -4,7 +4,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal static class Configuration
     {
-        public static ConfigFile Config { get; private set; }
+        public static ConfigFile Config { get; }
 
         static Configuration()
         {

+ 46 - 58
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Constants.cs

@@ -11,7 +11,7 @@ using wf;
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     using static MenuFileUtility;
-    internal class Constants
+    internal static class Constants
     {
         private static bool beginHandItemInit;
         private static bool beginMpnAttachInit;
@@ -64,14 +64,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public static readonly List<string> SceneDirectoryList = new List<string>();
         public static readonly List<string> KankyoDirectoryList = new List<string>();
         public static readonly List<MpnAttachProp> MpnAttachPropList = new List<MpnAttachProp>();
-        public static int CustomPoseGroupsIndex { get; private set; } = -1;
         public static int MyRoomCustomBGIndex { get; private set; } = -1;
-        public static bool HandItemsInitialized { get; private set; } = false;
-        public static bool MpnAttachInitialized { get; private set; } = false;
-        public static bool MenuFilesInitialized { get; private set; } = false;
+        public static bool HandItemsInitialized { get; private set; }
+        public static bool MpnAttachInitialized { get; private set; }
+        public static bool MenuFilesInitialized { get; private set; }
         public static event EventHandler<MenuFilesEventArgs> MenuFilesChange;
-        public static event EventHandler<CustomPoseEventArgs> customPoseChange;
-        public static event EventHandler<CustomPoseEventArgs> customHandChange;
+        public static event EventHandler<CustomPoseEventArgs> CustomPoseChange;
+        public static event EventHandler<CustomPoseEventArgs> CustomHandChange;
         public static event EventHandler<CustomPoseEventArgs> CustomFaceChange;
         public enum DoguCategory
         {
@@ -189,11 +188,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             filename = Utility.SanitizePathPortion(filename);
             directory = Utility.SanitizePathPortion(directory);
             if (string.IsNullOrEmpty(filename)) filename = "custom_pose";
-            if (directory.Equals(Constants.customPoseDirectory, StringComparison.InvariantCultureIgnoreCase))
+            if (directory.Equals(customPoseDirectory, StringComparison.InvariantCultureIgnoreCase))
             {
-                directory = String.Empty;
+                directory = string.Empty;
             }
-            directory = Path.Combine(Constants.customPosePath, directory);
+            directory = Path.Combine(customPosePath, directory);
 
             if (!Directory.Exists(directory)) Directory.CreateDirectory(directory);
 
@@ -203,7 +202,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             fullPath = Path.GetFullPath($"{fullPath}.anm");
 
-            if (!fullPath.StartsWith(Constants.customPosePath))
+            if (!fullPath.StartsWith(customPosePath))
             {
                 Utility.LogError($"Could not save pose! Path is invalid: '{fullPath}'");
                 return;
@@ -214,21 +213,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             FileInfo fileInfo = new FileInfo(fullPath);
 
             string category = fileInfo.Directory.Name;
-            string poseGroup = Constants.CustomPoseGroupList.Find(
+            string poseGroup = CustomPoseGroupList.Find(
                 group => string.Equals(category, group, StringComparison.InvariantCultureIgnoreCase)
             );
 
             if (string.IsNullOrEmpty(poseGroup))
             {
-                Constants.CustomPoseGroupList.Add(category);
-                Constants.CustomPoseDict[category] = new List<string>();
+                CustomPoseGroupList.Add(category);
+                CustomPoseDict[category] = new List<string>();
             }
             else category = poseGroup;
 
-            Constants.CustomPoseDict[category].Add(fullPath);
-            Constants.CustomPoseDict[category].Sort();
+            CustomPoseDict[category].Add(fullPath);
+            CustomPoseDict[category].Sort();
 
-            customPoseChange?.Invoke(null, new CustomPoseEventArgs(fullPath, category));
+            CustomPoseChange?.Invoke(null, new CustomPoseEventArgs(fullPath, category));
         }
 
         public static void AddHand(byte[] handBinary, bool right, string filename, string directory)
@@ -236,11 +235,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             filename = Utility.SanitizePathPortion(filename);
             directory = Utility.SanitizePathPortion(directory);
             if (string.IsNullOrEmpty(filename)) filename = "custom_hand";
-            if (directory.Equals(Constants.customHandDirectory, StringComparison.InvariantCultureIgnoreCase))
+            if (directory.Equals(customHandDirectory, StringComparison.InvariantCultureIgnoreCase))
             {
-                directory = String.Empty;
+                directory = string.Empty;
             }
-            directory = Path.Combine(Constants.customHandPath, directory);
+            directory = Path.Combine(customHandPath, directory);
 
             if (!Directory.Exists(directory)) Directory.CreateDirectory(directory);
 
@@ -250,7 +249,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             fullPath = Path.GetFullPath($"{fullPath}.xml");
 
-            if (!fullPath.StartsWith(Constants.customHandPath))
+            if (!fullPath.StartsWith(customHandPath))
             {
                 Utility.LogError($"Could not save hand! Path is invalid: '{fullPath}'");
                 return;
@@ -270,21 +269,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             FileInfo fileInfo = new FileInfo(fullPath);
 
             string category = fileInfo.Directory.Name;
-            string handGroup = Constants.CustomHandGroupList.Find(
+            string handGroup = CustomHandGroupList.Find(
                 group => string.Equals(category, group, StringComparison.InvariantCultureIgnoreCase)
             );
 
             if (string.IsNullOrEmpty(handGroup))
             {
-                Constants.CustomHandGroupList.Add(category);
-                Constants.CustomHandDict[category] = new List<string>();
+                CustomHandGroupList.Add(category);
+                CustomHandDict[category] = new List<string>();
             }
             else category = handGroup;
 
-            Constants.CustomHandDict[category].Add(fullPath);
-            Constants.CustomHandDict[category].Sort();
+            CustomHandDict[category].Add(fullPath);
+            CustomHandDict[category].Sort();
 
-            customHandChange?.Invoke(null, new CustomPoseEventArgs(fullPath, category));
+            CustomHandChange?.Invoke(null, new CustomPoseEventArgs(fullPath, category));
         }
 
         public static void InitializeScenes()
@@ -320,7 +319,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             // Get Other poses that'll go into Normal 2 and Ero 2
             string[] com3d2MotionList = GameUty.FileSystem.GetList("motion", AFileSystemBase.ListType.AllFile);
 
-            if (com3d2MotionList != null && com3d2MotionList.Length > 0)
+            if (com3d2MotionList?.Length > 0)
             {
                 HashSet<string> poseSet = new HashSet<string>();
                 foreach (List<string> poses in PoseDict.Values)
@@ -396,7 +395,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 IEnumerable<string> presetList = Directory.GetFiles(directory)
                     .Where(file => Path.GetExtension(file) == ".xml");
 
-                if (presetList.Count() > 0)
+                if (presetList.Any())
                 {
                     string presetCategory = new DirectoryInfo(directory).Name;
                     if (presetCategory != customHandDirectory) CustomHandGroupList.Add(presetCategory);
@@ -482,7 +481,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 }
             }
 
-            Dictionary<string, string> saveDataDict = MyRoomCustom.CreativeRoomManager.GetSaveDataDic();
+            Dictionary<string, string> saveDataDict = CreativeRoomManager.GetSaveDataDic();
 
             if (saveDataDict != null)
             {
@@ -598,7 +597,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                             int cell = csvParser.GetCellAsInteger(0, cell_y);
                             if (enabledIDs.Contains(cell))
                             {
-                                string dogu = String.Empty;
+                                string dogu = string.Empty;
                                 if (csvParser.IsCellToExistData(3, cell_y))
                                 {
                                     dogu = csvParser.GetCellAsString(3, cell_y);
@@ -644,7 +643,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     DoguDict[category] = new List<string>();
                 }
 
-                string dogu = String.Empty;
+                string dogu = string.Empty;
                 if (!string.IsNullOrEmpty(photoBGObject.create_prefab_name))
                 {
                     dogu = photoBGObject.create_prefab_name;
@@ -674,9 +673,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (HandItemsInitialized) return;
 
-            if (!MenuFileUtility.MenuFilesReady)
+            if (!MenuFilesReady)
             {
-                if (!beginHandItemInit) MenuFileUtility.MenuFilesReadyChange += (s, a) => InitializeHandItems();
+                if (!beginHandItemInit) MenuFilesReadyChange += (s, a) => InitializeHandItems();
                 beginHandItemInit = true;
                 return;
             }
@@ -729,9 +728,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (MpnAttachInitialized) return;
 
-            if (!MenuFileUtility.MenuFilesReady)
+            if (!MenuFilesReady)
             {
-                if (!beginMpnAttachInit) MenuFileUtility.MenuFilesReadyChange += (s, a) => InitializeMpnAttachProps();
+                if (!beginMpnAttachInit) MenuFilesReadyChange += (s, a) => InitializeMpnAttachProps();
                 beginMpnAttachInit = true;
                 return;
             }
@@ -791,7 +790,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private static void InitializeModProps()
         {
-            for (int i = 1; i < MenuFileUtility.MenuCategories.Length; i++)
+            for (int i = 1; i < MenuCategories.Length; i++)
             {
                 ModPropDict[MenuCategories[i]] = new List<ModItem>();
             }
@@ -804,7 +803,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 {
                     menuDatabase.SetIndex(i);
                     ModItem modItem = new ModItem();
-                    if (MenuFileUtility.ParseNativeMenuFile(i, modItem))
+                    if (ParseNativeMenuFile(i, modItem))
                     {
                         ModPropDict[modItem.Category].Add(modItem);
                     }
@@ -820,10 +819,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 else
                 {
                     modItem = ModItem.Mod(modMenuFile);
-                    MenuFileUtility.ParseMenuFile(modMenuFile, modItem);
+                    ParseMenuFile(modMenuFile, modItem);
                     cache[modMenuFile] = modItem;
                 }
-                if (MenuFileUtility.ValidBG2MenuFile(modItem)) ModPropDict[modItem.Category].Add(modItem);
+                if (ValidBG2MenuFile(modItem)) ModPropDict[modItem.Category].Add(modItem);
             }
 
             cache.Serialize();
@@ -843,7 +842,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (!PropManager.ModItemsOnly)
             {
-                if (!MenuFileUtility.MenuFilesReady)
+                if (!MenuFilesReady)
                 {
                     Utility.LogMessage("Menu files are not ready yet");
                     return null;
@@ -865,7 +864,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     return res;
                 });
 
-                string previousMenuFile = String.Empty;
+                string previousMenuFile = string.Empty;
                 selectedList.RemoveAll(item =>
                 {
                     if (item.Icon == null)
@@ -921,17 +920,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             return null;
         }
 
-        private static CsvParser OpenCsvParser(string nei)
-        {
-            return OpenCsvParser(nei, GameUty.FileSystem);
-        }
-
-        public static void WriteToFile(string name, IEnumerable<string> list)
-        {
-            if (Path.GetExtension(name) != ".txt") name += ".txt";
-            File.WriteAllLines(Path.Combine(configPath, name), list.ToArray());
-        }
-
         private static void OnMenuFilesChange(MenuFilesEventArgs.EventType eventType)
         {
             MenuFilesChange?.Invoke(null, new MenuFilesEventArgs(eventType));
@@ -951,7 +939,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             HandItems, MenuFiles, MpnAttach
         }
-        public MenuFilesEventArgs(EventType type) => this.Type = type;
+        public MenuFilesEventArgs(EventType type) => Type = type;
     }
 
     public class CustomPoseEventArgs : EventArgs
@@ -960,8 +948,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public string Path { get; }
         public CustomPoseEventArgs(string path, string category)
         {
-            this.Path = path;
-            this.Category = category;
+            Path = path;
+            Category = category;
         }
     }
 
@@ -972,8 +960,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public MpnAttachProp(MPN tag, string menuFile)
         {
-            this.Tag = tag;
-            this.MenuFile = menuFile;
+            Tag = tag;
+            MenuFile = menuFile;
         }
     }
 }

+ 19 - 20
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/CustomGizmo.cs

@@ -6,11 +6,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class CustomGizmo : GizmoRender
     {
-        private static Camera camera = GameMain.Instance.MainCamera.camera;
+        private static readonly Camera camera = GameMain.Instance.MainCamera.camera;
         private Transform target;
-        private FieldInfo beSelectedType = Utility.GetFieldInfo<GizmoRender>("beSelectedType");
+        private readonly FieldInfo beSelectedType = Utility.GetFieldInfo<GizmoRender>("beSelectedType");
         private int SelectedType => (int)beSelectedType.GetValue(this);
-        private static FieldInfo is_drag_ = Utility.GetFieldInfo<GizmoRender>("is_drag_");
+        private static readonly FieldInfo is_drag_ = Utility.GetFieldInfo<GizmoRender>("is_drag_");
         public static bool IsDrag
         {
             get => (bool)is_drag_.GetValue(null);
@@ -18,7 +18,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         }
         private Vector3 positionOld = Vector3.zero;
         private Vector3 deltaPosition = Vector3.zero;
-        private Vector3 localPositionOld = Vector3.zero;
         private Vector3 deltaLocalPosition = Vector3.zero;
         private Quaternion rotationOld = Quaternion.identity;
         private Quaternion deltaRotation = Quaternion.identity;
@@ -40,14 +39,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public bool IsGizmoDrag => GizmoVisible && IsDrag && SelectedType != 0;
         public bool GizmoVisible
         {
-            get => base.Visible;
+            get => Visible;
             set
             {
                 if (value && IsDrag) IsDrag = false;
-                base.Visible = value;
+                Visible = value;
             }
         }
-        public GizmoMode gizmoMode = GizmoMode.Local;
+        public GizmoMode gizmoMode;
         public event EventHandler GizmoDrag;
         public enum GizmoType
         {
@@ -110,7 +109,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 case GizmoMode.Local:
                     target.transform.position += target.transform.TransformVector(deltaLocalPosition).normalized
                         * deltaLocalPosition.magnitude;
-                    target.transform.rotation = target.transform.rotation * deltaLocalRotation;
+                    target.transform.rotation *= deltaLocalRotation;
                     target.transform.localScale += deltaScale;
                     if (deltaLocalRotation != Quaternion.identity || deltaLocalPosition != Vector3.zero
                         || deltaScale != Vector3.zero
@@ -153,24 +152,24 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             switch (gizmoType)
             {
                 case GizmoType.Move:
-                    this.eAxis = true;
-                    this.eRotate = false;
-                    this.eScal = false;
+                    eAxis = true;
+                    eRotate = false;
+                    eScal = false;
                     break;
                 case GizmoType.Rotate:
-                    this.eAxis = false;
-                    this.eRotate = true;
-                    this.eScal = false;
+                    eAxis = false;
+                    eRotate = true;
+                    eScal = false;
                     break;
                 case GizmoType.Scale:
-                    this.eAxis = false;
-                    this.eRotate = false;
-                    this.eScal = true;
+                    eAxis = false;
+                    eRotate = false;
+                    eScal = true;
                     break;
                 case GizmoType.None:
-                    this.eAxis = false;
-                    this.eRotate = false;
-                    this.eScal = false;
+                    eAxis = false;
+                    eRotate = false;
+                    eScal = false;
                     break;
             }
         }

+ 15 - 16
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPoint.cs

@@ -84,7 +84,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => GizmoGo != null && gizmoEnabled;
             set
             {
-                if (GizmoGo == null || (GizmoGo != null && gizmoEnabled == value)) return;
+                if (GizmoGo == null || (gizmoEnabled == value)) return;
                 gizmoEnabled = value;
                 ApplyDragType();
             }
@@ -102,16 +102,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void Awake()
         {
-            this.BaseScale = transform.localScale;
-            this.collider = GetComponent<Collider>();
-            this.renderer = GetComponent<Renderer>();
+            BaseScale = transform.localScale;
+            collider = GetComponent<Collider>();
+            renderer = GetComponent<Renderer>();
             ApplyDragType();
         }
 
         private static GameObject DragPointParent()
         {
-            if (dragPointParent == null) dragPointParent = new GameObject("[MPS DragPoint Parent]");
-            return dragPointParent;
+            return dragPointParent ? dragPointParent : (dragPointParent = new GameObject("[MPS DragPoint Parent]"));
         }
 
         public static T Make<T>(PrimitiveType primitiveType, Vector3 scale) where T : DragPoint
@@ -136,13 +135,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public virtual void Set(Transform myObject)
         {
-            this.MyObject = myObject;
-            this.gameObject.name = $"[MPS DragPoint: {this.MyObject.name}]";
+            MyObject = myObject;
+            gameObject.name = $"[MPS DragPoint: {MyObject.name}]";
         }
 
         public virtual void AddGizmo(float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
         {
-            Gizmo = CustomGizmo.Make(this.MyObject, scale, mode);
+            Gizmo = CustomGizmo.Make(MyObject, scale, mode);
             GizmoGo = Gizmo.gameObject;
             Gizmo.GizmoVisible = false;
             ApplyDragType();
@@ -152,12 +151,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void ApplyProperties(bool active = false, bool visible = false, bool gizmo = false)
         {
-            this.collider.enabled = active;
-            this.renderer.enabled = visible;
-            if (this.Gizmo != null) this.Gizmo.GizmoVisible = gizmo;
+            collider.enabled = active;
+            renderer.enabled = visible;
+            if (Gizmo) Gizmo.GizmoVisible = gizmo;
         }
 
-        protected void ApplyColour(Color colour) => this.renderer.material.color = colour;
+        protected void ApplyColour(Color colour) => renderer.material.color = colour;
 
         protected void ApplyColour(float r, float g, float b, float a = defaultAlpha)
         {
@@ -235,15 +234,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 transform.position = position();
                 transform.eulerAngles = rotation();
             }
-            if (GizmoGo != null) GizmoGo.SetActive(true);
+            if (GizmoGo) GizmoGo.SetActive(true);
             ApplyDragType();
         }
 
         private void OnDisable()
         {
-            if (GizmoGo != null) GizmoGo.SetActive(false);
+            if (GizmoGo) GizmoGo.SetActive(false);
         }
 
-        protected virtual void OnDestroy() => GameObject.Destroy(GizmoGo);
+        protected virtual void OnDestroy() => Destroy(GizmoGo);
     }
 }

+ 5 - 5
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointGeneral.cs

@@ -102,22 +102,22 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             base.OnMouseDown();
 
-            currentScale = this.MyObject.localScale.x;
-            currentRotation = this.MyObject.rotation;
+            currentScale = MyObject.localScale.x;
+            currentRotation = MyObject.rotation;
         }
 
         protected override void OnDoubleClick()
         {
             if (CurrentDragType == DragType.Scale)
             {
-                this.MyObject.localScale = Vector3.one;
+                MyObject.localScale = Vector3.one;
                 OnScale();
                 OnEndScale();
             }
 
             if (CurrentDragType == DragType.RotLocalY || CurrentDragType == DragType.RotLocalXZ)
             {
-                this.MyObject.rotation = Quaternion.identity;
+                MyObject.rotation = Quaternion.identity;
                 OnRotate();
             }
         }
@@ -183,7 +183,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (CurrentDragType == DragType.Scale)
             {
                 scaling = true;
-                float scale = currentScale + (mouseDelta.y / 200f) * ScaleFactor;
+                float scale = currentScale + (mouseDelta.y / 200f * ScaleFactor);
                 if (scale < 0.1f) scale = 0.1f;
                 MyObject.localScale = new Vector3(scale, scale, scale);
                 OnScale();

+ 35 - 47
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointLight.cs

@@ -5,7 +5,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class DragPointLight : DragPointGeneral
     {
-        public static EnvironmentManager environmentManager { private get; set; }
+        public static EnvironmentManager EnvironmentManager { private get; set; }
         private Light light;
         public enum MPSLightType
         {
@@ -21,7 +21,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public bool IsMain { get; set; } = false;
         public MPSLightType SelectedLightType { get; private set; } = MPSLightType.Normal;
         public LightProperty CurrentLightProperty => LightProperties[(int)SelectedLightType];
-        private LightProperty[] LightProperties = new LightProperty[]
+        private readonly LightProperty[] LightProperties = new LightProperty[]
         {
             new LightProperty(),
             new LightProperty(),
@@ -33,8 +33,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => isDisabled;
             set
             {
-                this.isDisabled = value;
-                this.light.gameObject.SetActive(!this.isDisabled);
+                isDisabled = value;
+                light.gameObject.SetActive(!isDisabled);
             }
         }
         private bool isColourMode = false;
@@ -44,49 +44,49 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             set
             {
                 if (!IsMain) return;
-                this.light.color = value ? Color.white : LightColour;
+                light.color = value ? Color.white : LightColour;
                 camera.backgroundColor = value ? LightColour : Color.black;
-                this.isColourMode = value;
-                LightColour = this.isColourMode ? camera.backgroundColor : light.color;
-                environmentManager.BGVisible = !IsColourMode;
+                isColourMode = value;
+                LightColour = isColourMode ? camera.backgroundColor : light.color;
+                EnvironmentManager.BGVisible = !IsColourMode;
             }
         }
         public Quaternion Rotation
         {
             get => CurrentLightProperty.Rotation;
-            set => this.light.transform.rotation = CurrentLightProperty.Rotation = value;
+            set => light.transform.rotation = CurrentLightProperty.Rotation = value;
         }
         public float Intensity
         {
             get => CurrentLightProperty.Intensity;
-            set => this.light.intensity = CurrentLightProperty.Intensity = value;
+            set => light.intensity = CurrentLightProperty.Intensity = value;
         }
         public float Range
         {
             get => CurrentLightProperty.Range;
-            set => this.light.range = CurrentLightProperty.Range = value;
+            set => light.range = CurrentLightProperty.Range = value;
         }
         public float SpotAngle
         {
             get => CurrentLightProperty.SpotAngle;
             set
             {
-                this.light.spotAngle = CurrentLightProperty.SpotAngle = value;
-                this.light.transform.localScale = Vector3.one * value;
+                light.spotAngle = CurrentLightProperty.SpotAngle = value;
+                light.transform.localScale = Vector3.one * value;
             }
         }
         public float ShadowStrength
         {
             get => CurrentLightProperty.ShadowStrength;
-            set => this.light.shadowStrength = CurrentLightProperty.ShadowStrength = value;
+            set => light.shadowStrength = CurrentLightProperty.ShadowStrength = value;
         }
         public float LightColorRed
         {
             get => IsColourMode ? camera.backgroundColor.r : CurrentLightProperty.LightColour.r;
             set
             {
-                Color color = IsColourMode ? camera.backgroundColor : this.light.color;
-                this.LightColour = new Color(value, color.g, color.b);
+                Color color = IsColourMode ? camera.backgroundColor : light.color;
+                LightColour = new Color(value, color.g, color.b);
             }
         }
         public float LightColorGreen
@@ -94,8 +94,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => IsColourMode ? camera.backgroundColor.g : CurrentLightProperty.LightColour.r;
             set
             {
-                Color color = IsColourMode ? camera.backgroundColor : this.light.color;
-                this.LightColour = new Color(color.r, value, color.b);
+                Color color = IsColourMode ? camera.backgroundColor : light.color;
+                LightColour = new Color(color.r, value, color.b);
             }
         }
         public float LightColorBlue
@@ -103,8 +103,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => IsColourMode ? camera.backgroundColor.b : CurrentLightProperty.LightColour.r;
             set
             {
-                Color color = IsColourMode ? camera.backgroundColor : this.light.color;
-                this.LightColour = new Color(color.r, color.g, value);
+                Color color = IsColourMode ? camera.backgroundColor : light.color;
+                LightColour = new Color(color.r, color.g, value);
             }
         }
         public Color LightColour
@@ -114,7 +114,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 Color colour = CurrentLightProperty.LightColour = value;
                 if (IsColourMode) camera.backgroundColor = colour;
-                else this.light.color = colour;
+                else light.color = colour;
             }
         }
 
@@ -150,31 +150,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             light.spotAngle = prop.SpotAngle;
             light.shadowStrength = prop.ShadowStrength;
             light.color = prop.LightColour;
-            if (light.type == LightType.Spot)
-            {
-                light.transform.localScale = Vector3.one * prop.SpotAngle;
-            }
-            else if (light.type == LightType.Point)
-            {
-                light.transform.localScale = Vector3.one * prop.Range;
-            }
+            if (light.type == LightType.Spot) light.transform.localScale = Vector3.one * prop.SpotAngle;
+            else if (light.type == LightType.Point) light.transform.localScale = Vector3.one * prop.Range;
         }
 
         public override void Set(Transform myObject)
         {
             base.Set(myObject);
-            this.light = myObject.gameObject.GetOrAddComponent<Light>();
+            light = myObject.gameObject.GetOrAddComponent<Light>();
 
-            this.light.transform.position = LightProperty.DefaultPosition;
-            this.light.transform.rotation = LightProperty.DefaultRotation;
+            light.transform.position = LightProperty.DefaultPosition;
+            light.transform.rotation = LightProperty.DefaultRotation;
 
             SetLightType(MPSLightType.Normal);
-            this.ScaleFactor = 50f;
+            ScaleFactor = 50f;
         }
 
         protected override void OnDestroy()
         {
-            if (!IsMain) GameObject.Destroy(this.light.gameObject);
+            if (!IsMain) Destroy(light.gameObject);
             base.OnDestroy();
         }
 
@@ -221,22 +215,19 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 name = "point";
             }
 
-            this.light.type = lightType;
-            this.Name = IsMain ? "main" : name;
+            light.type = lightType;
+            Name = IsMain ? "main" : name;
 
             if (IsMain)
             {
-                environmentManager.BGVisible = !(IsColourMode && SelectedLightType == MPSLightType.Normal);
+                EnvironmentManager.BGVisible = !(IsColourMode && SelectedLightType == MPSLightType.Normal);
             }
 
             SetProps();
             ApplyDragType();
         }
 
-        public void SetRotation(float x, float y)
-        {
-            this.Rotation = Quaternion.Euler(x, y, Rotation.eulerAngles.z);
-        }
+        public void SetRotation(float x, float y) => Rotation = Quaternion.Euler(x, y, Rotation.eulerAngles.z);
 
         public void SetProp(LightProp prop, float value)
         {
@@ -272,17 +263,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             SetProps();
         }
 
-        public void ResetLightPosition()
-        {
-            this.light.transform.position = LightProperty.DefaultPosition;
-        }
+        public void ResetLightPosition() => light.transform.position = LightProperty.DefaultPosition;
 
         private void SetProps()
         {
-            SetLightProperties(this.light, CurrentLightProperty);
+            SetLightProperties(light, CurrentLightProperty);
             if (IsColourMode)
             {
-                this.light.color = Color.white;
+                light.color = Color.white;
                 camera.backgroundColor = CurrentLightProperty.LightColour;
             }
         }

+ 2 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/DragPoint/DragPointMeido.cs

@@ -30,8 +30,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             base.Initialize(position, rotation);
             this.meido = meido;
-            this.maid = meido.Maid;
-            this.isPlaying = !meido.Stop;
+            maid = meido.Maid;
+            isPlaying = !meido.Stop;
         }
 
         public override void AddGizmo(float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
@@ -60,6 +60,5 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手");
             ikCmo.Porc(upper, middle, lower, CursorPosition(), Vector3.zero, ikData);
         }
-
     }
 }

+ 2 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Button.cs

@@ -8,14 +8,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public string Label { get; set; }
         public Button(string label)
         {
-            this.Label = label;
+            Label = label;
         }
         public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
         {
             if (!Visible) return;
-            bool clicked = false;
-            clicked = GUILayout.Button(Label, buttonStyle, layoutOptions);
-            if (clicked) OnControlEvent(EventArgs.Empty);
+            if (GUILayout.Button(Label, buttonStyle, layoutOptions)) OnControlEvent(EventArgs.Empty);
         }
 
         public override void Draw(params GUILayoutOption[] layoutOptions)

+ 9 - 12
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/ComboBox.cs

@@ -1,12 +1,11 @@
-using System;
 using UnityEngine;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class ComboBox : BaseControl
     {
-        private TextField textField = new TextField();
-        public Dropdown BaseDropDown { get; private set; }
+        private readonly TextField textField = new TextField();
+        public Dropdown BaseDropDown { get; }
         public string Value
         {
             get => textField.Value;
@@ -15,16 +14,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public ComboBox(string[] itemList)
         {
-            this.BaseDropDown = new Dropdown("▾", itemList);
-            this.BaseDropDown.SelectionChange += (s, a) => textField.Value = BaseDropDown.SelectedItem;
-            this.Value = itemList[0];
+            BaseDropDown = new Dropdown("▾", itemList);
+            BaseDropDown.SelectionChange += (s, a) => textField.Value = BaseDropDown.SelectedItem;
+            Value = itemList[0];
         }
 
         public void SetDropdownItems(string[] itemList)
         {
-            string oldValue = this.Value;
+            string oldValue = Value;
             BaseDropDown.SetDropdownItems(itemList);
-            this.Value = oldValue;
+            Value = oldValue;
         }
 
         public void SetDropdownItem(int index, string newItem) => BaseDropDown.SetDropdownItem(index, newItem);
@@ -35,8 +34,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             GUILayout.BeginHorizontal();
             textField.Draw(textFieldStyle, layoutOptions);
-            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
-            buttonStyle.alignment = TextAnchor.MiddleCenter;
+            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter };
             BaseDropDown.Draw(buttonStyle, GUILayout.Width(buttonSize), GUILayout.Height(buttonSize));
             GUILayout.EndHorizontal();
         }
@@ -50,8 +48,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             GUILayout.BeginHorizontal();
             textField.Draw(new GUIStyle(GUI.skin.textField), layoutOptions);
-            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
-            buttonStyle.alignment = TextAnchor.MiddleCenter;
+            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleCenter };
             BaseDropDown.Draw(buttonStyle, GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
         }

+ 41 - 52
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/DropDown.cs

@@ -9,18 +9,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public event EventHandler SelectionChange;
         public event EventHandler DropdownOpen;
         public event EventHandler DropdownClose;
-        private bool clickedYou = false;
-        private bool showDropdown = false;
-        private string label;
-        private bool isMenu = false;
+        private bool clickedYou;
+        private bool showDropdown;
+        private readonly string label;
+        private readonly bool isMenu;
         public string[] DropdownList { get; private set; }
-        public int DropdownID { get; private set; }
+        public int DropdownID { get; }
         private Vector2 scrollPos;
-        public Vector2 ScrollPos
-        {
-            get => scrollPos;
-            private set => scrollPos = value;
-        }
+        public Vector2 ScrollPos => scrollPos;
         private Rect buttonRect;
         public Rect ButtonRect
         {
@@ -28,18 +24,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             private set => buttonRect = value;
         }
         private Vector2 elementSize;
-        public Vector2 ElementSize
-        {
-            get => elementSize;
-            private set => elementSize = value;
-        }
-        private int selectedItemIndex = 0;
+        public Vector2 ElementSize => elementSize;
+        private int selectedItemIndex;
         public int SelectedItemIndex
         {
             get => selectedItemIndex;
             set
             {
-                this.selectedItemIndex = Mathf.Clamp(value, 0, DropdownList.Length - 1);
+                selectedItemIndex = Mathf.Clamp(value, 0, DropdownList.Length - 1);
                 OnDropdownEvent(SelectionChange);
             }
         }
@@ -69,16 +61,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void SetDropdownItems(string[] itemList, int selectedItemIndex = -1)
         {
-            if (selectedItemIndex < 0) selectedItemIndex = this.SelectedItemIndex;
-            this.elementSize = Vector2.zero;
+            if (selectedItemIndex < 0) selectedItemIndex = SelectedItemIndex;
+            elementSize = Vector2.zero;
 
             // TODO: Calculate scrollpos position maybe
-            if ((selectedItemIndex != this.selectedItemIndex) || (itemList.Length != this.DropdownList?.Length))
+            if ((selectedItemIndex != this.selectedItemIndex) || (itemList.Length != DropdownList?.Length))
             {
-                this.scrollPos = Vector2.zero;
+                scrollPos = Vector2.zero;
             }
-            this.DropdownList = itemList;
-            this.SelectedItemIndex = selectedItemIndex;
+            DropdownList = itemList;
+            SelectedItemIndex = selectedItemIndex;
         }
 
         public void SetDropdownItem(int index, string newItem)
@@ -87,20 +79,20 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             Vector2 itemSize = DropdownHelper.CalculateElementSize(newItem);
 
-            if (itemSize.x > ElementSize.x) ElementSize = itemSize;
+            if (itemSize.x > ElementSize.x) elementSize = itemSize;
 
             DropdownList[index] = newItem;
         }
 
         public void SetDropdownItem(string newItem)
         {
-            SetDropdownItem(this.SelectedItemIndex, newItem);
+            SetDropdownItem(SelectedItemIndex, newItem);
         }
 
         public void Step(int dir)
         {
             dir = (int)Mathf.Sign(dir);
-            this.SelectedItemIndex = Utility.Wrap(this.SelectedItemIndex + dir, 0, this.DropdownList.Length);
+            SelectedItemIndex = Utility.Wrap(SelectedItemIndex + dir, 0, DropdownList.Length);
         }
 
         public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
@@ -128,14 +120,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw(params GUILayoutOption[] layoutOptions)
         {
-            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
-            buttonStyle.alignment = TextAnchor.MiddleLeft;
-            this.Draw(buttonStyle, layoutOptions);
+            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) { alignment = TextAnchor.MiddleLeft };
+            Draw(buttonStyle, layoutOptions);
         }
 
         private void OnChangeSelection(object sender, DropdownSelectArgs args)
         {
-            if (args.DropdownID == this.DropdownID)
+            if (args.DropdownID == DropdownID)
             {
                 SelectedItemIndex = args.SelectedItemIndex;
             }
@@ -143,7 +134,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void OnCloseDropdown(object sender, DropdownCloseArgs args)
         {
-            if (args.DropdownID == this.DropdownID)
+            if (args.DropdownID == DropdownID)
             {
                 scrollPos = args.ScrollPos;
                 clickedYou = args.ClickedYou;
@@ -158,13 +149,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             showDropdown = false;
 
-            this.buttonRect = GUILayoutUtility.GetLastRect();
+            buttonRect = GUILayoutUtility.GetLastRect();
             Vector2 rectPos = GUIUtility.GUIToScreenPoint(new Vector2(buttonRect.x, buttonRect.y));
             buttonRect.x = rectPos.x;
             buttonRect.y = rectPos.y;
-            if (this.elementSize == Vector2.zero)
+            if (elementSize == Vector2.zero)
             {
-                this.elementSize = DropdownHelper.CalculateElementSize(this.DropdownList, dropdownStyle);
+                elementSize = DropdownHelper.CalculateElementSize(DropdownList, dropdownStyle);
             }
             DropdownHelper.Set(this, dropdownStyle);
 
@@ -213,7 +204,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             style = style ?? DefaultDropdownStyle;
 
-            return DefaultDropdownStyle.CalcSize(new GUIContent(item));
+            return style.CalcSize(new GUIContent(item));
         }
 
         public static Vector2 CalculateElementSize(string[] list, GUIStyle style = null)
@@ -289,10 +280,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             bool clicked = false;
 
-            if (Event.current.type == EventType.MouseUp)
-            {
-                clicked = true;
-            }
+            if (Event.current.type == EventType.MouseUp) clicked = true;
 
             scrollPos = GUI.BeginScrollView(dropdownScrollRect, scrollPos, dropdownRect);
             int selection = GUI.SelectionGrid(dropdownRect, selectedItemIndex, dropdownList, 1, dropdownStyle);
@@ -323,9 +311,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private static void InitializeStyle()
         {
-            defaultDropdownStyle = new GUIStyle(GUI.skin.button);
-            defaultDropdownStyle.alignment = TextAnchor.MiddleLeft;
-            defaultDropdownStyle.margin = new RectOffset(0, 0, 0, 0);
+            defaultDropdownStyle = new GUIStyle(GUI.skin.button)
+            {
+                alignment = TextAnchor.MiddleLeft,
+                margin = new RectOffset(0, 0, 0, 0)
+            };
             defaultDropdownStyle.padding.top = defaultDropdownStyle.padding.bottom = 2;
             defaultDropdownStyle.normal.background = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.5f));
             Texture2D whiteBackground = new Texture2D(2, 2);
@@ -338,19 +328,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 = defaultDropdownStyle.hover.textColor
                 = Color.black;
 
-            windowStyle = new GUIStyle(GUI.skin.box);
-            windowStyle.padding = new RectOffset(0, 0, 0, 0);
-            windowStyle.alignment = TextAnchor.UpperRight;
+            windowStyle = new GUIStyle(GUI.skin.box)
+            {
+                padding = new RectOffset(0, 0, 0, 0),
+                alignment = TextAnchor.UpperRight
+            };
             initialized = true;
         }
 
         public class DropdownEventArgs : EventArgs
         {
             public int DropdownID { get; }
-            public DropdownEventArgs(int dropdownID)
-            {
-                this.DropdownID = dropdownID;
-            }
+            public DropdownEventArgs(int dropdownID) => DropdownID = dropdownID;
         }
 
         public class DropdownSelectArgs : DropdownEventArgs
@@ -358,7 +347,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             public int SelectedItemIndex { get; }
             public DropdownSelectArgs(int dropdownID, int selection) : base(dropdownID)
             {
-                this.SelectedItemIndex = selection;
+                SelectedItemIndex = selection;
             }
         }
 
@@ -368,8 +357,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             public bool ClickedYou { get; }
             public DropdownCloseArgs(int dropdownID, Vector2 scrollPos, bool clickedYou = false) : base(dropdownID)
             {
-                this.ScrollPos = scrollPos;
-                this.ClickedYou = clickedYou;
+                ScrollPos = scrollPos;
+                ClickedYou = clickedYou;
             }
         }
     }

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/KeyRebindButton.cs

@@ -5,7 +5,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class KeyRebindButton : BaseControl
     {
-        private Button button;
+        private readonly Button button;
         private bool listening = false;
         private KeyCode keyCode;
         public KeyCode KeyCode

+ 11 - 12
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/SelectionGrid.cs

@@ -12,10 +12,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => selectedItemIndex;
             set
             {
-                this.selectedItemIndex = Mathf.Clamp(value, 0, this.toggles.Length - 1);
+                selectedItemIndex = Mathf.Clamp(value, 0, toggles.Length - 1);
                 foreach (SimpleToggle toggle in toggles)
                 {
-                    toggle.value = toggle.toggleIndex == this.selectedItemIndex;
+                    toggle.value = toggle.toggleIndex == selectedItemIndex;
                 }
                 OnControlEvent(EventArgs.Empty);
             }
@@ -23,7 +23,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public SelectionGrid(string[] items, int selected = 0)
         {
-            this.selectedItemIndex = Mathf.Clamp(selected, 0, items.Length - 1);
+            selectedItemIndex = Mathf.Clamp(selected, 0, items.Length - 1);
             toggles = MakeToggles(items);
         }
 
@@ -32,12 +32,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             SimpleToggle[] toggles = new SimpleToggle[items.Length];
             for (int i = 0; i < items.Length; i++)
             {
-                SimpleToggle toggle = new SimpleToggle(items[i], i == SelectedItemIndex);
-                toggle.toggleIndex = i;
+                SimpleToggle toggle = new SimpleToggle(items[i], i == SelectedItemIndex) { toggleIndex = i };
                 toggle.ControlEvent += (s, a) =>
                 {
                     int value = (s as SimpleToggle).toggleIndex;
-                    if (value != this.SelectedItemIndex) this.SelectedItemIndex = value;
+                    if (value != SelectedItemIndex) SelectedItemIndex = value;
                 };
                 toggles[i] = toggle;
             }
@@ -46,21 +45,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void SetItems(string[] items, int selectedItemIndex = -1)
         {
-            if (selectedItemIndex < 0) selectedItemIndex = this.SelectedItemIndex;
+            if (selectedItemIndex < 0) selectedItemIndex = SelectedItemIndex;
             if (items.Length != toggles.Length)
             {
-                this.toggles = MakeToggles(items);
+                toggles = MakeToggles(items);
             }
             else
             {
                 for (int i = 0; i < items.Length; i++)
                 {
                     string item = items[i];
-                    this.toggles[i].value = i == SelectedItemIndex;
-                    this.toggles[i].label = item;
+                    toggles[i].value = i == SelectedItemIndex;
+                    toggles[i].label = item;
                 }
             }
-            this.SelectedItemIndex = Mathf.Clamp(selectedItemIndex, 0, items.Length - 1);
+            SelectedItemIndex = Mathf.Clamp(selectedItemIndex, 0, items.Length - 1);
         }
 
         public override void Draw(params GUILayoutOption[] layoutOptions)
@@ -91,7 +90,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 bool value = GUILayout.Toggle(this.value, label, layoutOptions);
                 if (value != this.value)
                 {
-                    if (value == false) this.value = true;
+                    if (!value) this.value = true;
                     else
                     {
                         this.value = value;

+ 15 - 15
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Slider.cs

@@ -22,50 +22,50 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => value;
             set
             {
-                this.value = Utility.Bound(value, this.Left, this.Right);
+                this.value = Utility.Bound(value, Left, Right);
                 OnControlEvent(EventArgs.Empty);
             }
         }
         private float left;
         public float Left
         {
-            get => this.left;
+            get => left;
             set
             {
-                this.left = value;
-                this.Value = this.value;
+                left = value;
+                this.value = Utility.Bound(value, left, right);
             }
         }
         private float right;
         public float Right
         {
-            get => this.right;
+            get => right;
             set
             {
-                this.right = value;
-                this.Value = this.value;
+                right = value;
+                this.value = Utility.Bound(value, left, right);
             }
         }
 
         public Slider(string label, float left, float right, float value = 0)
         {
             Label = label;
-            Left = left;
-            Right = right;
+            this.left = left;
+            this.right = right;
             this.value = Utility.Bound(value, left, right);
         }
 
-        public Slider(float min, float max, float value = 0f) : this(String.Empty, min, max, value) { }
+        public Slider(float min, float max, float value = 0f) : this(string.Empty, min, max, value) { }
 
         public Slider(string label, SliderProp prop) : this(label, prop.Left, prop.Right, prop.Initial) { }
 
-        public Slider(SliderProp prop) : this(String.Empty, prop.Left, prop.Right, prop.Initial) { }
+        public Slider(SliderProp prop) : this(string.Empty, prop.Left, prop.Right, prop.Initial) { }
 
         public void SetBounds(float left, float right)
         {
             this.left = left;
             this.right = right;
-            this.Value = this.Value;
+            value = Utility.Bound(value, left, right);
         }
 
         public override void Draw(params GUILayoutOption[] layoutOptions)
@@ -100,9 +100,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public SliderProp(float left, float right, float initial = 0f)
         {
-            this.Left = left;
-            this.Right = right;
-            this.Initial = Utility.Bound(initial, left, right);
+            Left = left;
+            Right = right;
+            Initial = Utility.Bound(initial, left, right);
         }
     }
 }

+ 2 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/Toggle.cs

@@ -23,7 +23,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public Toggle(string label, bool state = false)
         {
             Label = label;
-            this.value = state;
+            value = state;
         }
 
         public override void Draw(params GUILayoutOption[] layoutOptions)
@@ -34,7 +34,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void Draw(GUIStyle toggleStyle, params GUILayoutOption[] layoutOptions)
         {
             if (!Visible) return;
-            bool value = GUILayout.Toggle(Value, Label, toggleStyle);
+            bool value = GUILayout.Toggle(Value, Label, toggleStyle, layoutOptions);
             if (value != Value) Value = value;
         }
     }

+ 39 - 45
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/AttachPropPane.cs

@@ -7,9 +7,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class AttachPropPane : BasePane
     {
-        private PropManager propManager;
-        private MeidoManager meidoManager;
-        private Dictionary<AttachPoint, Toggle> Toggles = new Dictionary<AttachPoint, Toggle>();
+        private readonly PropManager propManager;
+        private readonly MeidoManager meidoManager;
+        private readonly Dictionary<AttachPoint, Toggle> Toggles = new Dictionary<AttachPoint, Toggle>();
         private static readonly Dictionary<AttachPoint, string> toggleTranslation =
             new Dictionary<AttachPoint, string>()
             {
@@ -31,10 +31,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 [AttachPoint.FootL] = "footL",
                 [AttachPoint.FootR] = "footR",
             };
-        private Toggle keepWorldPositionToggle;
-        private Button previousMaidButton;
-        private Button nextMaidButton;
-        private Dropdown meidoDropdown;
+        private readonly Toggle keepWorldPositionToggle;
+        private readonly Button previousMaidButton;
+        private readonly Button nextMaidButton;
+        private readonly Dropdown meidoDropdown;
         private bool meidoDropdownActive = false;
         private bool doguDropdownActive = false;
         private bool PaneActive => meidoDropdownActive && doguDropdownActive;
@@ -43,7 +43,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public AttachPropPane(MeidoManager meidoManager, PropManager propManager)
         {
-            this.header = Translation.Get("attachPropPane", "header");
+            header = Translation.Get("attachPropPane", "header");
             this.propManager = propManager;
             this.meidoManager = meidoManager;
 
@@ -51,16 +51,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.propManager.DoguSelectChange += (s, a) => SwitchDogu();
             this.propManager.DoguListChange += (s, a) => doguDropdownActive = this.propManager.DoguCount > 0;
 
-            this.meidoDropdown = new Dropdown(new[] { Translation.Get("systemMessage", "noMaids") });
-            this.meidoDropdown.SelectionChange += (s, a) => SwitchMaid();
+            meidoDropdown = new Dropdown(new[] { Translation.Get("systemMessage", "noMaids") });
+            meidoDropdown.SelectionChange += (s, a) => SwitchMaid();
 
-            this.previousMaidButton = new Button("<");
-            this.previousMaidButton.ControlEvent += (s, a) => this.meidoDropdown.Step(-1);
+            previousMaidButton = new Button("<");
+            previousMaidButton.ControlEvent += (s, a) => meidoDropdown.Step(-1);
 
-            this.nextMaidButton = new Button(">");
-            this.nextMaidButton.ControlEvent += (s, a) => this.meidoDropdown.Step(1);
+            nextMaidButton = new Button(">");
+            nextMaidButton.ControlEvent += (s, a) => meidoDropdown.Step(1);
 
-            this.keepWorldPositionToggle = new Toggle(Translation.Get("attachPropPane", "keepWorldPosition"));
+            keepWorldPositionToggle = new Toggle(Translation.Get("attachPropPane", "keepWorldPosition"));
 
             foreach (AttachPoint attachPoint in Enum.GetValues(typeof(AttachPoint)))
             {
@@ -69,7 +69,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 Toggle toggle = new Toggle(Translation.Get("attachPropPane", toggleTranslation[point]));
                 toggle.ControlEvent += (s, a) =>
                 {
-                    if (this.updating) return;
+                    if (updating) return;
                     ChangeAttachPoint(point);
                 };
                 Toggles[point] = toggle;
@@ -78,8 +78,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void ReloadTranslation()
         {
-            this.header = Translation.Get("attachPropPane", "header");
-            this.keepWorldPositionToggle.Label = Translation.Get("attachPropPane", "keepWorldPosition");
+            header = Translation.Get("attachPropPane", "header");
+            keepWorldPositionToggle.Label = Translation.Get("attachPropPane", "keepWorldPosition");
             foreach (AttachPoint attachPoint in Enum.GetValues(typeof(AttachPoint)))
             {
                 if (attachPoint == AttachPoint.None) continue;
@@ -89,20 +89,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw()
         {
-            float arrowButtonSize = 30;
-            GUILayoutOption[] arrowLayoutOptions = {
-                GUILayout.Width(arrowButtonSize),
-                GUILayout.Height(arrowButtonSize)
-            };
-
-            float dropdownButtonHeight = arrowButtonSize;
-            float dropdownButtonWidth = 153f;
+            const float dropdownButtonHeight = 30;
+            const float dropdownButtonWidth = 153f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
                 GUILayout.Height(dropdownButtonHeight),
                 GUILayout.Width(dropdownButtonWidth)
             };
 
-            MiscGUI.Header(this.header);
+            MiscGUI.Header(header);
             MiscGUI.WhiteLine();
 
             GUI.enabled = PaneActive;
@@ -137,18 +131,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void SetAttachPointToggle(AttachPoint point, bool value)
         {
-            this.updating = true;
+            updating = true;
             foreach (Toggle toggle in Toggles.Values)
             {
                 toggle.Value = false;
             }
             if (point != AttachPoint.None) Toggles[point].Value = value;
-            this.updating = false;
+            updating = false;
         }
 
         private void ChangeAttachPoint(AttachPoint point)
         {
-            bool toggleValue = point == AttachPoint.None ? false : Toggles[point].Value;
+            bool toggleValue = point != AttachPoint.None && Toggles[point].Value;
             SetAttachPointToggle(point, toggleValue);
 
             Meido meido = null;
@@ -156,20 +150,20 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (point != AttachPoint.None)
             {
                 meido = Toggles[point].Value
-                    ? this.meidoManager.ActiveMeidoList[this.meidoDropdown.SelectedItemIndex]
+                    ? meidoManager.ActiveMeidoList[meidoDropdown.SelectedItemIndex]
                     : null;
             }
 
-            this.propManager.AttachProp(
-                this.propManager.CurrentDoguIndex, point, meido, this.keepWorldPositionToggle.Value
+            propManager.AttachProp(
+                propManager.CurrentDoguIndex, point, meido, keepWorldPositionToggle.Value
             );
         }
 
         private void SwitchMaid()
         {
-            if (updating || selectedMaid == this.meidoDropdown.SelectedItemIndex) return;
-            selectedMaid = this.meidoDropdown.SelectedItemIndex;
-            DragPointDogu dragDogu = this.propManager.CurrentDogu;
+            if (updating || selectedMaid == meidoDropdown.SelectedItemIndex) return;
+            selectedMaid = meidoDropdown.SelectedItemIndex;
+            DragPointDogu dragDogu = propManager.CurrentDogu;
             if (dragDogu != null)
             {
                 if (dragDogu.attachPointInfo.AttachPoint == AttachPoint.None) return;
@@ -180,28 +174,28 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private void SwitchDogu()
         {
             if (updating) return;
-            DragPointDogu dragDogu = this.propManager.CurrentDogu;
+            DragPointDogu dragDogu = propManager.CurrentDogu;
             if (dragDogu != null) SetAttachPointToggle(dragDogu.attachPointInfo.AttachPoint, true);
         }
 
         private void SetMeidoDropdown()
         {
-            if (this.meidoManager.ActiveMeidoList.Count == 0)
+            if (meidoManager.ActiveMeidoList.Count == 0)
             {
                 SetAttachPointToggle(AttachPoint.Head, false);
             }
-            int index = Mathf.Clamp(this.meidoDropdown.SelectedItemIndex, 0, this.meidoManager.ActiveMeidoList.Count);
+            int index = Mathf.Clamp(meidoDropdown.SelectedItemIndex, 0, meidoManager.ActiveMeidoList.Count);
 
-            string[] dropdownList = this.meidoManager.ActiveMeidoList.Count == 0
+            string[] dropdownList = meidoManager.ActiveMeidoList.Count == 0
                 ? new[] { Translation.Get("systemMessage", "noMaids") }
-                : this.meidoManager.ActiveMeidoList.Select(
+                : meidoManager.ActiveMeidoList.Select(
                     meido => $"{meido.Slot + 1}: {meido.FirstName} {meido.LastName}"
                 ).ToArray();
-            this.updating = true;
-            this.meidoDropdown.SetDropdownItems(dropdownList, index);
-            this.updating = false;
+            updating = true;
+            meidoDropdown.SetDropdownItems(dropdownList, index);
+            updating = false;
 
-            meidoDropdownActive = this.meidoManager.HasActiveMeido;
+            meidoDropdownActive = meidoManager.HasActiveMeido;
         }
     }
 }

+ 41 - 44
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/ModPropsPane.cs

@@ -7,15 +7,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     using static MenuFileUtility;
     internal class ModPropsPane : BasePane
     {
-        private PropManager propManager;
-        private Dropdown propCategoryDropdown;
-        private Toggle modFilterToggle;
-        private Toggle baseFilterToggle;
+        private readonly PropManager propManager;
+        private readonly Dropdown propCategoryDropdown;
+        private readonly Toggle modFilterToggle;
+        private readonly Toggle baseFilterToggle;
         private Vector2 propListScrollPos;
-        private string SelectedCategory
-        {
-            get => MenuFileUtility.MenuCategories[this.propCategoryDropdown.SelectedItemIndex];
-        }
+        private string SelectedCategory => MenuCategories[this.propCategoryDropdown.SelectedItemIndex];
         private List<ModItem> modPropList;
         private string currentCategory;
         private bool modItemsReady = false;
@@ -24,7 +21,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private bool modFilter = false;
         private bool baseFilter = false;
         private int currentListCount;
-        private bool isModsOnly = PropManager.ModItemsOnly;
+        private readonly bool isModsOnly = PropManager.ModItemsOnly;
         private enum FilterType
         {
             None, Mod, Base
@@ -34,59 +31,59 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.propManager = propManager;
 
-            this.modItemsReady = MenuFileUtility.MenuFilesReady || PropManager.ModItemsOnly;
+            modItemsReady = MenuFilesReady || PropManager.ModItemsOnly;
 
-            string[] listItems = Translation.GetArray("clothing", MenuFileUtility.MenuCategories);
+            string[] listItems = Translation.GetArray("clothing", MenuCategories);
 
-            if (!this.modItemsReady)
+            if (!modItemsReady)
             {
                 listItems[0] = Translation.Get("systemMessage", "initializing");
 
-                MenuFileUtility.MenuFilesReadyChange += (s, a) =>
+                MenuFilesReadyChange += (s, a) =>
                 {
-                    this.modItemsReady = true;
-                    this.propCategoryDropdown.SetDropdownItems(
-                        Translation.GetArray("clothing", MenuFileUtility.MenuCategories)
+                    modItemsReady = true;
+                    propCategoryDropdown.SetDropdownItems(
+                        Translation.GetArray("clothing", MenuCategories)
                     );
                 };
             }
 
-            this.propCategoryDropdown = new Dropdown(listItems);
+            propCategoryDropdown = new Dropdown(listItems);
 
-            this.propCategoryDropdown.SelectionChange += (s, a) =>
+            propCategoryDropdown.SelectionChange += (s, a) =>
             {
-                if (!this.modItemsReady) return;
+                if (!modItemsReady) return;
                 ChangePropCategory();
             };
 
             if (!isModsOnly)
             {
-                this.modFilterToggle = new Toggle(Translation.Get("background2Window", "modsToggle"));
-                this.modFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Mod);
+                modFilterToggle = new Toggle(Translation.Get("background2Window", "modsToggle"));
+                modFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Mod);
 
-                this.baseFilterToggle = new Toggle(Translation.Get("background2Window", "baseToggle"));
-                this.baseFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Base);
+                baseFilterToggle = new Toggle(Translation.Get("background2Window", "baseToggle"));
+                baseFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Base);
             }
         }
 
         protected override void ReloadTranslation()
         {
-            string[] listItems = Translation.GetArray("clothing", MenuFileUtility.MenuCategories);
+            string[] listItems = Translation.GetArray("clothing", MenuCategories);
 
-            if (!this.modItemsReady) listItems[0] = Translation.Get("systemMessage", "initializing");
+            if (!modItemsReady) listItems[0] = Translation.Get("systemMessage", "initializing");
 
-            this.propCategoryDropdown.SetDropdownItems(listItems);
+            propCategoryDropdown.SetDropdownItems(listItems);
 
             if (!isModsOnly)
             {
-                this.modFilterToggle.Label = Translation.Get("background2Window", "modsToggle");
-                this.baseFilterToggle.Label = Translation.Get("background2Window", "baseToggle");
+                modFilterToggle.Label = Translation.Get("background2Window", "modsToggle");
+                baseFilterToggle.Label = Translation.Get("background2Window", "baseToggle");
             }
         }
 
         public override void Draw()
         {
-            float dropdownButtonHeight = 30f;
+            const float dropdownButtonHeight = 30f;
             float dropdownButtonWidth = isModsOnly ? 120f : 90f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
                 GUILayout.Height(dropdownButtonHeight),
@@ -98,35 +95,35 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (isModsOnly)
             {
                 GUILayout.FlexibleSpace();
-                this.propCategoryDropdown.Draw(dropdownLayoutOptions);
+                propCategoryDropdown.Draw(dropdownLayoutOptions);
                 GUILayout.FlexibleSpace();
             }
             else
             {
-                GUI.enabled = this.modItemsReady;
-                this.propCategoryDropdown.Draw(dropdownLayoutOptions);
+                GUI.enabled = modItemsReady;
+                propCategoryDropdown.Draw(dropdownLayoutOptions);
 
-                GUI.enabled = this.shouldDraw;
-                this.modFilterToggle.Draw();
-                this.baseFilterToggle.Draw();
+                GUI.enabled = shouldDraw;
+                modFilterToggle.Draw();
+                baseFilterToggle.Draw();
                 GUI.enabled = true;
             }
 
             GUILayout.EndHorizontal();
 
-            if (this.shouldDraw)
+            if (shouldDraw)
             {
                 float windowHeight = Screen.height * 0.7f;
 
-                int buttonSize = 50;
-                int offsetLeft = 15;
-                int offsetTop = 85;
+                const int buttonSize = 50;
+                const int offsetLeft = 15;
+                const int offsetTop = 85;
 
-                int columns = 4;
+                const int columns = 4;
 
                 Rect positionRect = new Rect(offsetLeft, offsetTop + dropdownButtonHeight, 220, windowHeight);
                 Rect viewRect = new Rect(
-                    0, 0, buttonSize * columns, buttonSize * Mathf.Ceil(currentListCount / (float)columns) + 5
+                    0, 0, buttonSize * columns, (buttonSize * Mathf.Ceil(currentListCount / (float)columns)) + 5
                 );
                 propListScrollPos = GUI.BeginScrollView(positionRect, propListScrollPos, viewRect);
 
@@ -150,14 +147,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void ChangeFilter(FilterType filterType)
         {
-            if (this.updating) return;
+            if (updating) return;
 
             if (modFilterToggle.Value && baseFilterToggle.Value)
             {
-                this.updating = true;
+                updating = true;
                 modFilterToggle.Value = filterType == FilterType.Mod;
                 baseFilterToggle.Value = filterType == FilterType.Base;
-                this.updating = false;
+                updating = false;
             }
 
             modFilter = modFilterToggle.Value;

+ 17 - 22
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/MyRoomPropsPane.cs

@@ -6,13 +6,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     using static MenuFileUtility;
     internal class MyRoomPropsPane : BasePane
     {
-        private PropManager propManager;
-        private Dropdown propCategoryDropdown;
+        private readonly PropManager propManager;
+        private readonly Dropdown propCategoryDropdown;
         private Vector2 propListScrollPos;
-        private string SelectedCategory
-        {
-            get => Constants.MyRoomPropCategories[this.propCategoryDropdown.SelectedItemIndex];
-        }
+        private string SelectedCategory => Constants.MyRoomPropCategories[propCategoryDropdown.SelectedItemIndex];
         private List<MyRoomItem> myRoomPropList;
         private string currentCategory;
 
@@ -20,24 +17,22 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.propManager = propManager;
 
-            this.propCategoryDropdown = new Dropdown(
-                Translation.GetArray("doguCategories", Constants.MyRoomPropCategories)
-            );
-            this.propCategoryDropdown.SelectionChange += (s, a) => ChangePropCategory(SelectedCategory);
+            propCategoryDropdown = new Dropdown(Translation.GetArray("doguCategories", Constants.MyRoomPropCategories));
+            propCategoryDropdown.SelectionChange += (s, a) => ChangePropCategory(SelectedCategory);
             ChangePropCategory(SelectedCategory);
         }
 
         protected override void ReloadTranslation()
         {
-            this.propCategoryDropdown.SetDropdownItems(
+            propCategoryDropdown.SetDropdownItems(
                 Translation.GetArray("doguCategories", Constants.MyRoomPropCategories)
             );
         }
 
         public override void Draw()
         {
-            float dropdownButtonHeight = 30f;
-            float dropdownButtonWidth = 120f;
+            const float dropdownButtonHeight = 30f;
+            const float dropdownButtonWidth = 120f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
                 GUILayout.Height(dropdownButtonHeight),
                 GUILayout.Width(dropdownButtonWidth)
@@ -45,22 +40,22 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             GUILayout.BeginHorizontal();
             GUILayout.FlexibleSpace();
-            this.propCategoryDropdown.Draw(dropdownLayoutOptions);
+            propCategoryDropdown.Draw(dropdownLayoutOptions);
             GUILayout.FlexibleSpace();
             GUILayout.EndHorizontal();
 
             float windowHeight = Screen.height * 0.6f;
 
-            int buttonSize = 64;
-            int listCount = myRoomPropList.Count;
-            int offsetLeft = 15;
-            int offsetTop = 85;
+            const int buttonSize = 64;
+            const int offsetLeft = 15;
+            const int offsetTop = 85;
+            const int columns = 3;
 
-            int columns = 3;
+            int listCount = myRoomPropList.Count;
 
             Rect positionRect = new Rect(offsetLeft, offsetTop + dropdownButtonHeight, 220, windowHeight);
             Rect viewRect = new Rect(
-                0, 0, buttonSize * columns, buttonSize * Mathf.Ceil(listCount / (float)columns) + 5
+                0, 0, buttonSize * columns, (buttonSize * Mathf.Ceil(listCount / (float)columns)) + 5
             );
             propListScrollPos = GUI.BeginScrollView(positionRect, propListScrollPos, viewRect);
 
@@ -68,7 +63,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 float x = i % columns * buttonSize;
                 float y = i / columns * buttonSize;
-                MenuFileUtility.MyRoomItem myRoomItem = myRoomPropList[i];
+                MyRoomItem myRoomItem = myRoomPropList[i];
                 Rect iconRect = new Rect(x, y, buttonSize, buttonSize);
                 if (GUI.Button(iconRect, "")) propManager.SpawnMyRoomProp(myRoomItem);
                 GUI.DrawTexture(iconRect, myRoomItem.Icon);
@@ -83,7 +78,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (currentCategory == category) return;
             currentCategory = category;
             propListScrollPos = Vector2.zero;
-            this.myRoomPropList = Constants.MyRoomPropDict[category];
+            myRoomPropList = Constants.MyRoomPropDict[category];
             if (myRoomPropList[0].Icon == null)
             {
                 foreach (MyRoomItem item in myRoomPropList)

+ 62 - 63
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/PropManagerPane.cs

@@ -4,16 +4,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class PropManagerPane : BasePane
     {
-        private PropManager propManager;
-        private Dropdown propDropdown;
-        private Button previousPropButton;
-        private Button nextPropButton;
-        private Toggle dragPointToggle;
-        private Toggle gizmoToggle;
-        private Toggle shadowCastingToggle;
-        private Button deletePropButton;
-        private Button copyPropButton;
-        private int CurrentDoguIndex => this.propManager.CurrentDoguIndex;
+        private readonly PropManager propManager;
+        private readonly Dropdown propDropdown;
+        private readonly Button previousPropButton;
+        private readonly Button nextPropButton;
+        private readonly Toggle dragPointToggle;
+        private readonly Toggle gizmoToggle;
+        private readonly Toggle shadowCastingToggle;
+        private readonly Button deletePropButton;
+        private readonly Button copyPropButton;
+        private int CurrentDoguIndex => propManager.CurrentDoguIndex;
 
         public PropManagerPane(PropManager propManager)
         {
@@ -26,99 +26,98 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             this.propManager.DoguSelectChange += (s, a) =>
             {
-                this.updating = true;
-                this.propDropdown.SelectedItemIndex = CurrentDoguIndex;
-                this.updating = false;
+                updating = true;
+                propDropdown.SelectedItemIndex = CurrentDoguIndex;
+                updating = false;
                 UpdateToggles();
             };
 
-            this.propDropdown = new Dropdown(this.propManager.PropNameList);
-            this.propDropdown.SelectionChange += (s, a) =>
+            propDropdown = new Dropdown(this.propManager.PropNameList);
+            propDropdown.SelectionChange += (s, a) =>
             {
                 if (updating) return;
-                this.propManager.SetCurrentDogu(this.propDropdown.SelectedItemIndex);
+                this.propManager.SetCurrentDogu(propDropdown.SelectedItemIndex);
                 UpdateToggles();
             };
 
-            this.previousPropButton = new Button("<");
-            this.previousPropButton.ControlEvent += (s, a) => this.propDropdown.Step(-1);
+            previousPropButton = new Button("<");
+            previousPropButton.ControlEvent += (s, a) => propDropdown.Step(-1);
 
-            this.nextPropButton = new Button(">");
-            this.nextPropButton.ControlEvent += (s, a) => this.propDropdown.Step(1);
+            nextPropButton = new Button(">");
+            nextPropButton.ControlEvent += (s, a) => propDropdown.Step(1);
 
-            this.dragPointToggle = new Toggle(Translation.Get("propManagerPane", "dragPointToggle"));
-            this.dragPointToggle.ControlEvent += (s, a) =>
+            dragPointToggle = new Toggle(Translation.Get("propManagerPane", "dragPointToggle"));
+            dragPointToggle.ControlEvent += (s, a) =>
             {
-                if (this.updating || this.propManager.DoguCount == 0) return;
+                if (updating || this.propManager.DoguCount == 0) return;
                 this.propManager.CurrentDogu.DragPointEnabled = dragPointToggle.Value;
             };
 
-            this.gizmoToggle = new Toggle(Translation.Get("propManagerPane", "gizmoToggle"));
-            this.gizmoToggle.ControlEvent += (s, a) =>
+            gizmoToggle = new Toggle(Translation.Get("propManagerPane", "gizmoToggle"));
+            gizmoToggle.ControlEvent += (s, a) =>
             {
-                if (this.updating || this.propManager.DoguCount == 0) return;
+                if (updating || this.propManager.DoguCount == 0) return;
                 this.propManager.CurrentDogu.GizmoEnabled = gizmoToggle.Value;
             };
 
-            this.shadowCastingToggle = new Toggle(Translation.Get("propManagerPane", "shadowCastingToggle"));
-            this.shadowCastingToggle.ControlEvent += (s, a) =>
+            shadowCastingToggle = new Toggle(Translation.Get("propManagerPane", "shadowCastingToggle"));
+            shadowCastingToggle.ControlEvent += (s, a) =>
             {
-                if (this.updating || this.propManager.DoguCount == 0) return;
-                this.propManager.CurrentDogu.ShadowCasting = this.shadowCastingToggle.Value;
+                if (updating || this.propManager.DoguCount == 0) return;
+                this.propManager.CurrentDogu.ShadowCasting = shadowCastingToggle.Value;
             };
 
-            this.copyPropButton = new Button(Translation.Get("propManagerPane", "copyButton"));
-            this.copyPropButton.ControlEvent += (s, a) => this.propManager.CopyDogu(CurrentDoguIndex);
+            copyPropButton = new Button(Translation.Get("propManagerPane", "copyButton"));
+            copyPropButton.ControlEvent += (s, a) => this.propManager.CopyDogu(CurrentDoguIndex);
 
-            this.deletePropButton = new Button(Translation.Get("propManagerPane", "deleteButton"));
-            this.deletePropButton.ControlEvent += (s, a) => this.propManager.RemoveDogu(CurrentDoguIndex);
+            deletePropButton = new Button(Translation.Get("propManagerPane", "deleteButton"));
+            deletePropButton.ControlEvent += (s, a) => this.propManager.RemoveDogu(CurrentDoguIndex);
         }
 
         protected override void ReloadTranslation()
         {
-            this.dragPointToggle.Label = Translation.Get("propManagerPane", "dragPointToggle");
-            this.gizmoToggle.Label = Translation.Get("propManagerPane", "gizmoToggle");
-            this.shadowCastingToggle.Label = Translation.Get("propManagerPane", "shadowCastingToggle");
-            this.copyPropButton.Label = Translation.Get("propManagerPane", "copyButton");
-            this.deletePropButton.Label = Translation.Get("propManagerPane", "deleteButton");
+            dragPointToggle.Label = Translation.Get("propManagerPane", "dragPointToggle");
+            gizmoToggle.Label = Translation.Get("propManagerPane", "gizmoToggle");
+            shadowCastingToggle.Label = Translation.Get("propManagerPane", "shadowCastingToggle");
+            copyPropButton.Label = Translation.Get("propManagerPane", "copyButton");
+            deletePropButton.Label = Translation.Get("propManagerPane", "deleteButton");
         }
 
         public override void Draw()
         {
-            float arrowButtonSize = 30;
+            const float buttonHeight = 30;
             GUILayoutOption[] arrowLayoutOptions = {
-                GUILayout.Width(arrowButtonSize),
-                GUILayout.Height(arrowButtonSize)
+                GUILayout.Width(buttonHeight),
+                GUILayout.Height(buttonHeight)
             };
 
-            float dropdownButtonHeight = arrowButtonSize;
-            float dropdownButtonWidth = 140f;
+            const float dropdownButtonWidth = 140f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
-                GUILayout.Height(dropdownButtonHeight),
+                GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth)
             };
 
             MiscGUI.WhiteLine();
 
-            GUI.enabled = this.propManager.DoguCount > 0;
+            GUI.enabled = propManager.DoguCount > 0;
 
             GUILayout.BeginHorizontal();
-            this.propDropdown.Draw(dropdownLayoutOptions);
-            this.previousPropButton.Draw(arrowLayoutOptions);
-            this.nextPropButton.Draw(arrowLayoutOptions);
+            propDropdown.Draw(dropdownLayoutOptions);
+            previousPropButton.Draw(arrowLayoutOptions);
+            nextPropButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
 
             GUILayoutOption noExpandWidth = GUILayout.ExpandWidth(false);
 
             GUILayout.BeginHorizontal();
-            this.dragPointToggle.Draw(noExpandWidth);
-            this.gizmoToggle.Draw(noExpandWidth);
-            this.copyPropButton.Draw(noExpandWidth);
-            this.deletePropButton.Draw(noExpandWidth);
+            dragPointToggle.Draw(noExpandWidth);
+            gizmoToggle.Draw(noExpandWidth);
+            copyPropButton.Draw(noExpandWidth);
+            deletePropButton.Draw(noExpandWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.shadowCastingToggle.Draw(noExpandWidth);
+            shadowCastingToggle.Draw(noExpandWidth);
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;
@@ -126,21 +125,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void UpdatePropList()
         {
-            this.updating = true;
-            this.propDropdown.SetDropdownItems(this.propManager.PropNameList, CurrentDoguIndex);
-            this.updating = false;
+            updating = true;
+            propDropdown.SetDropdownItems(propManager.PropNameList, CurrentDoguIndex);
+            updating = false;
         }
 
         private void UpdateToggles()
         {
-            DragPointDogu dogu = this.propManager.CurrentDogu;
+            DragPointDogu dogu = propManager.CurrentDogu;
             if (dogu == null) return;
 
-            this.updating = true;
-            this.dragPointToggle.Value = dogu.DragPointEnabled;
-            this.gizmoToggle.Value = dogu.GizmoEnabled;
-            this.shadowCastingToggle.Value = dogu.ShadowCasting;
-            this.updating = false;
+            updating = true;
+            dragPointToggle.Value = dogu.DragPointEnabled;
+            gizmoToggle.Value = dogu.GizmoEnabled;
+            shadowCastingToggle.Value = dogu.ShadowCasting;
+            updating = false;
         }
     }
 }

+ 37 - 46
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindow2Panes/PropsPane.cs

@@ -6,57 +6,52 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class PropsPane : BasePane
     {
-        private PropManager propManager;
+        private readonly PropManager propManager;
         private string currentCategory;
         private string SelectedCategory => Constants.DoguCategories[this.doguCategoryDropdown.SelectedItemIndex];
-        private Dropdown doguCategoryDropdown;
-        private Dropdown doguDropdown;
-        private Button addDoguButton;
-        private Button nextDoguButton;
-        private Button prevDoguButton;
-        private Button nextDoguCategoryButton;
-        private Button prevDoguCategoryButton;
-        private string header;
+        private readonly Dropdown doguCategoryDropdown;
+        private readonly Dropdown doguDropdown;
+        private readonly Button addDoguButton;
+        private readonly Button nextDoguButton;
+        private readonly Button prevDoguButton;
+        private readonly Button nextDoguCategoryButton;
+        private readonly Button prevDoguCategoryButton;
         private static bool handItemsReady = false;
         private bool itemSelectorEnabled = true;
 
         public PropsPane(PropManager propManager)
         {
-            this.header = Translation.Get("propsPane", "header");
-
             this.propManager = propManager;
 
             handItemsReady = Constants.HandItemsInitialized;
             if (!handItemsReady) Constants.MenuFilesChange += InitializeHandItems;
 
-            this.doguCategoryDropdown = new Dropdown(Translation.GetArray("doguCategories", Constants.DoguCategories));
-            this.doguCategoryDropdown.SelectionChange += (s, a) => ChangeDoguCategory(SelectedCategory);
+            doguCategoryDropdown = new Dropdown(Translation.GetArray("doguCategories", Constants.DoguCategories));
+            doguCategoryDropdown.SelectionChange += (s, a) => ChangeDoguCategory(SelectedCategory);
 
-            this.doguDropdown = new Dropdown(new[] { string.Empty });
+            doguDropdown = new Dropdown(new[] { string.Empty });
 
-            this.addDoguButton = new Button("+");
-            this.addDoguButton.ControlEvent += (s, a) => SpawnObject();
+            addDoguButton = new Button("+");
+            addDoguButton.ControlEvent += (s, a) => SpawnObject();
 
-            this.nextDoguButton = new Button(">");
-            this.nextDoguButton.ControlEvent += (s, a) => this.doguDropdown.Step(1);
+            nextDoguButton = new Button(">");
+            nextDoguButton.ControlEvent += (s, a) => doguDropdown.Step(1);
 
-            this.prevDoguButton = new Button("<");
-            this.prevDoguButton.ControlEvent += (s, a) => this.doguDropdown.Step(-1);
+            prevDoguButton = new Button("<");
+            prevDoguButton.ControlEvent += (s, a) => doguDropdown.Step(-1);
 
-            this.nextDoguCategoryButton = new Button(">");
-            this.nextDoguCategoryButton.ControlEvent += (s, a) => this.doguCategoryDropdown.Step(1);
+            nextDoguCategoryButton = new Button(">");
+            nextDoguCategoryButton.ControlEvent += (s, a) => doguCategoryDropdown.Step(1);
 
-            this.prevDoguCategoryButton = new Button("<");
-            this.prevDoguCategoryButton.ControlEvent += (s, a) => this.doguCategoryDropdown.Step(-1);
+            prevDoguCategoryButton = new Button("<");
+            prevDoguCategoryButton.ControlEvent += (s, a) => doguCategoryDropdown.Step(-1);
 
             ChangeDoguCategory(SelectedCategory);
         }
 
         protected override void ReloadTranslation()
         {
-            this.header = Translation.Get("propsPane", "header");
-
-            this.doguCategoryDropdown.SetDropdownItems(
+            doguCategoryDropdown.SetDropdownItems(
                 Translation.GetArray("doguCategories", Constants.DoguCategories)
             );
 
@@ -77,34 +72,30 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw()
         {
-            float arrowButtonSize = 30;
+            const float buttonHeight = 30;
             GUILayoutOption[] arrowLayoutOptions = {
-                GUILayout.Width(arrowButtonSize),
-                GUILayout.Height(arrowButtonSize)
+                GUILayout.Width(buttonHeight),
+                GUILayout.Height(buttonHeight)
             };
 
-            float dropdownButtonHeight = arrowButtonSize;
-            float dropdownButtonWidth = 120f;
+            const float dropdownButtonWidth = 120f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
-                GUILayout.Height(dropdownButtonHeight),
+                GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth)
             };
 
-            // MiscGUI.Header(this.header);
-            // MiscGUI.WhiteLine();
-
             GUILayout.BeginHorizontal();
-            this.prevDoguCategoryButton.Draw(arrowLayoutOptions);
-            this.doguCategoryDropdown.Draw(dropdownLayoutOptions);
-            this.nextDoguCategoryButton.Draw(arrowLayoutOptions);
+            prevDoguCategoryButton.Draw(arrowLayoutOptions);
+            doguCategoryDropdown.Draw(dropdownLayoutOptions);
+            nextDoguCategoryButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
 
             GUI.enabled = itemSelectorEnabled;
             GUILayout.BeginHorizontal();
-            this.doguDropdown.Draw(dropdownLayoutOptions);
-            this.prevDoguButton.Draw(arrowLayoutOptions);
-            this.nextDoguButton.Draw(arrowLayoutOptions);
-            this.addDoguButton.Draw(arrowLayoutOptions);
+            doguDropdown.Draw(dropdownLayoutOptions);
+            prevDoguButton.Draw(arrowLayoutOptions);
+            nextDoguButton.Draw(arrowLayoutOptions);
+            addDoguButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
             GUI.enabled = true;
         }
@@ -167,14 +158,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void SpawnObject()
         {
-            string assetName = Constants.DoguDict[SelectedCategory][this.doguDropdown.SelectedItemIndex];
+            string assetName = Constants.DoguDict[SelectedCategory][doguDropdown.SelectedItemIndex];
             if (SelectedCategory == Constants.customDoguCategories[Constants.DoguCategory.BGSmall])
             {
-                this.propManager.SpawnBG(assetName);
+                propManager.SpawnBG(assetName);
             }
             else
             {
-                this.propManager.SpawnObject(assetName);
+                propManager.SpawnObject(assetName);
             }
         }
     }

+ 31 - 30
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/BackgroundSelectorPane.cs

@@ -6,10 +6,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class BackgroundSelectorPane : BasePane
     {
-        private EnvironmentManager environmentManager;
-        private Dropdown bgDropdown;
-        private Button prevBGButton;
-        private Button nextBGButton;
+        private readonly EnvironmentManager environmentManager;
+        private readonly Dropdown bgDropdown;
+        private readonly Button prevBGButton;
+        private readonly Button nextBGButton;
 
         public BackgroundSelectorPane(EnvironmentManager environmentManager)
         {
@@ -23,24 +23,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 bgList.AddRange(Constants.MyRoomCustomBGList.Select(kvp => kvp.Value));
             }
 
-            this.bgDropdown = new Dropdown(bgList.ToArray(), theaterIndex);
-            this.bgDropdown.SelectionChange += (s, a) =>
-            {
-                if (updating) return;
-                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);
-            };
+            bgDropdown = new Dropdown(bgList.ToArray(), theaterIndex);
+            bgDropdown.SelectionChange += (s, a) => ChangeBackground();
 
-            this.prevBGButton = new Button("<");
-            this.prevBGButton.ControlEvent += (s, a) => this.bgDropdown.Step(-1);
+            prevBGButton = new Button("<");
+            prevBGButton.ControlEvent += (s, a) => bgDropdown.Step(-1);
 
-            this.nextBGButton = new Button(">");
-            this.nextBGButton.ControlEvent += (s, a) => this.bgDropdown.Step(1);
+            nextBGButton = new Button(">");
+            nextBGButton.ControlEvent += (s, a) => bgDropdown.Step(1);
         }
 
         protected override void ReloadTranslation()
@@ -52,30 +42,41 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
 
             updating = true;
-            this.bgDropdown.SetDropdownItems(bgList.ToArray());
+            bgDropdown.SetDropdownItems(bgList.ToArray());
             updating = false;
         }
 
         public override void Draw()
         {
-            float arrowButtonSize = 30;
+            const float buttonHeight = 30;
             GUILayoutOption[] arrowLayoutOptions = {
-                GUILayout.Width(arrowButtonSize),
-                GUILayout.Height(arrowButtonSize)
+                GUILayout.Width(buttonHeight),
+                GUILayout.Height(buttonHeight)
             };
 
-            float dropdownButtonHeight = arrowButtonSize;
-            float dropdownButtonWidth = 153f;
+            const float dropdownButtonWidth = 153f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
-                GUILayout.Height(dropdownButtonHeight),
+                GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth)
             };
 
             GUILayout.BeginHorizontal();
-            this.prevBGButton.Draw(arrowLayoutOptions);
-            this.bgDropdown.Draw(dropdownLayoutOptions);
-            this.nextBGButton.Draw(arrowLayoutOptions);
+            prevBGButton.Draw(arrowLayoutOptions);
+            bgDropdown.Draw(dropdownLayoutOptions);
+            nextBGButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
         }
+
+        private void ChangeBackground()
+        {
+            if (updating) return;
+            int selectedIndex = bgDropdown.SelectedItemIndex;
+            bool isCreative = bgDropdown.SelectedItemIndex >= Constants.MyRoomCustomBGIndex;
+            string bg = isCreative
+                ? Constants.MyRoomCustomBGList[selectedIndex - Constants.MyRoomCustomBGIndex].Key
+                : Constants.BGList[selectedIndex];
+
+            environmentManager.ChangeBackground(bg, isCreative);
+        }
     }
 }

+ 32 - 35
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/DragPointPane.cs

@@ -5,39 +5,36 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class DragPointPane : BasePane
     {
         private string header;
-        private Toggle propsCubeToggle;
-        private Toggle smallCubeToggle;
-        private Toggle maidCubeToggle;
-        private Toggle bgCubeToggle;
-        private enum DragPointSetting
+        private readonly Toggle propsCubeToggle;
+        private readonly Toggle smallCubeToggle;
+        private readonly Toggle maidCubeToggle;
+        private readonly Toggle bgCubeToggle;
+        private enum Setting
         {
             Prop, Maid, Background, Size
         };
 
         public DragPointPane()
         {
-            this.header = Translation.Get("movementCube", "header");
-            this.propsCubeToggle = new Toggle(Translation.Get("movementCube", "props"), PropManager.CubeActive);
-            this.smallCubeToggle = new Toggle(Translation.Get("movementCube", "small"));
-            this.maidCubeToggle = new Toggle(Translation.Get("movementCube", "maid"), MeidoDragPointManager.CubeActive);
-            this.bgCubeToggle = new Toggle(Translation.Get("movementCube", "bg"), EnvironmentManager.CubeActive);
+            header = Translation.Get("movementCube", "header");
+            propsCubeToggle = new Toggle(Translation.Get("movementCube", "props"), PropManager.CubeActive);
+            smallCubeToggle = new Toggle(Translation.Get("movementCube", "small"));
+            maidCubeToggle = new Toggle(Translation.Get("movementCube", "maid"), MeidoDragPointManager.CubeActive);
+            bgCubeToggle = new Toggle(Translation.Get("movementCube", "bg"), EnvironmentManager.CubeActive);
 
-            this.propsCubeToggle.ControlEvent += (s, a) =>
-            {
-                ChangeDragPointSetting(DragPointSetting.Prop, this.propsCubeToggle.Value);
-            };
-            this.smallCubeToggle.ControlEvent += (s, a) =>
-            {
-                ChangeDragPointSetting(DragPointSetting.Size, this.smallCubeToggle.Value);
-            };
-            this.maidCubeToggle.ControlEvent += (s, a) =>
-            {
-                ChangeDragPointSetting(DragPointSetting.Maid, this.maidCubeToggle.Value);
-            };
-            this.bgCubeToggle.ControlEvent += (s, a) =>
-            {
-                ChangeDragPointSetting(DragPointSetting.Background, this.bgCubeToggle.Value);
-            };
+            propsCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Prop, propsCubeToggle.Value);
+            smallCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Size, smallCubeToggle.Value);
+            maidCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Maid, maidCubeToggle.Value);
+            bgCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Background, bgCubeToggle.Value);
+        }
+
+        protected override void ReloadTranslation()
+        {
+            header = Translation.Get("movementCube", "header");
+            propsCubeToggle.Label = Translation.Get("movementCube", "props");
+            smallCubeToggle.Label = Translation.Get("movementCube", "small");
+            maidCubeToggle.Label = Translation.Get("movementCube", "maid");
+            bgCubeToggle.Label = Translation.Get("movementCube", "bg");
         }
 
         public override void Draw()
@@ -46,27 +43,27 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             MiscGUI.WhiteLine();
 
             GUILayout.BeginHorizontal();
-            this.propsCubeToggle.Draw();
-            this.smallCubeToggle.Draw();
-            this.maidCubeToggle.Draw();
-            this.bgCubeToggle.Draw();
+            propsCubeToggle.Draw();
+            smallCubeToggle.Draw();
+            maidCubeToggle.Draw();
+            bgCubeToggle.Draw();
             GUILayout.EndHorizontal();
         }
 
-        private void ChangeDragPointSetting(DragPointSetting setting, bool value)
+        private void ChangeDragPointSetting(Setting setting, bool value)
         {
             switch (setting)
             {
-                case DragPointSetting.Prop:
+                case Setting.Prop:
                     PropManager.CubeActive = value;
                     break;
-                case DragPointSetting.Background:
+                case Setting.Background:
                     EnvironmentManager.CubeActive = value;
                     break;
-                case DragPointSetting.Maid:
+                case Setting.Maid:
                     MeidoDragPointManager.CubeActive = value;
                     break;
-                case DragPointSetting.Size:
+                case Setting.Size:
                     MeidoDragPointManager.CubeSmall = value;
                     EnvironmentManager.CubeSmall = value;
                     PropManager.CubeSmall = value;

+ 48 - 48
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/BloomPane.cs

@@ -5,75 +5,75 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class BloomPane : EffectPane<BloomEffectManager>
     {
         protected override BloomEffectManager EffectManager { get; set; }
-        private Slider intensitySlider;
-        private Slider blurSlider;
-        private Slider redSlider;
-        private Slider greenSlider;
-        private Slider blueSlider;
-        private Toggle hdrToggle;
+        private readonly Slider intensitySlider;
+        private readonly Slider blurSlider;
+        private readonly Slider redSlider;
+        private readonly Slider greenSlider;
+        private readonly Slider blueSlider;
+        private readonly Toggle hdrToggle;
 
         public BloomPane(EffectManager effectManager) : base(effectManager.Get<BloomEffectManager>())
         {
             Bloom bloom = GameMain.Instance.MainCamera.GetComponent<Bloom>();
 
-            this.intensitySlider = new Slider(
+            intensitySlider = new Slider(
                 Translation.Get("effectBloom", "intensity"), 0f, 5.7f, bloom.bloomIntensity
             );
-            this.intensitySlider.ControlEvent += (s, a) =>
+            intensitySlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.Intensity = this.intensitySlider.Value;
+                if (updating) return;
+                EffectManager.Intensity = intensitySlider.Value;
             };
-            this.blurSlider = new Slider(Translation.Get("effectBloom", "blur"), 0f, 15f, bloom.bloomBlurIterations);
-            this.blurSlider.ControlEvent += (s, a) =>
+            blurSlider = new Slider(Translation.Get("effectBloom", "blur"), 0f, 15f, bloom.bloomBlurIterations);
+            blurSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.BlurIterations = (int)this.blurSlider.Value;
+                if (updating) return;
+                EffectManager.BlurIterations = (int)blurSlider.Value;
             };
-            this.redSlider = new Slider(Translation.Get("backgroundWindow", "red"), 1f, 0.5f, 1f);
-            this.redSlider.ControlEvent += (s, a) =>
+            redSlider = new Slider(Translation.Get("backgroundWindow", "red"), 1f, 0.5f, 1f);
+            redSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.BloomThresholdColorRed = this.redSlider.Value;
+                if (updating) return;
+                EffectManager.BloomThresholdColorRed = redSlider.Value;
             };
-            this.greenSlider = new Slider(Translation.Get("backgroundWindow", "green"), 1f, 0.5f, 1f);
-            this.greenSlider.ControlEvent += (s, a) =>
+            greenSlider = new Slider(Translation.Get("backgroundWindow", "green"), 1f, 0.5f, 1f);
+            greenSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.BloomThresholdColorGreen = this.greenSlider.Value;
+                if (updating) return;
+                EffectManager.BloomThresholdColorGreen = greenSlider.Value;
             };
-            this.blueSlider = new Slider(Translation.Get("backgroundWindow", "blue"), 1f, 0.5f, 1f);
-            this.blueSlider.ControlEvent += (s, a) =>
+            blueSlider = new Slider(Translation.Get("backgroundWindow", "blue"), 1f, 0.5f, 1f);
+            blueSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.BloomThresholdColorBlue = this.blueSlider.Value;
+                if (updating) return;
+                EffectManager.BloomThresholdColorBlue = blueSlider.Value;
             };
-            this.hdrToggle = new Toggle(Translation.Get("effectBloom", "hdrToggle"));
-            this.hdrToggle.ControlEvent += (s, a) =>
+            hdrToggle = new Toggle(Translation.Get("effectBloom", "hdrToggle"));
+            hdrToggle.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.BloomHDR = this.hdrToggle.Value;
+                if (updating) return;
+                EffectManager.BloomHDR = hdrToggle.Value;
             };
         }
 
         protected override void TranslatePane()
         {
-            this.intensitySlider.Label = Translation.Get("effectBloom", "intensity");
-            this.blurSlider.Label = Translation.Get("effectBloom", "blur");
-            this.redSlider.Label = Translation.Get("backgroundWindow", "red");
-            this.greenSlider.Label = Translation.Get("backgroundWindow", "green");
-            this.blueSlider.Label = Translation.Get("backgroundWindow", "blue");
-            this.hdrToggle.Label = Translation.Get("effectBloom", "hdrToggle");
+            intensitySlider.Label = Translation.Get("effectBloom", "intensity");
+            blurSlider.Label = Translation.Get("effectBloom", "blur");
+            redSlider.Label = Translation.Get("backgroundWindow", "red");
+            greenSlider.Label = Translation.Get("backgroundWindow", "green");
+            blueSlider.Label = Translation.Get("backgroundWindow", "blue");
+            hdrToggle.Label = Translation.Get("effectBloom", "hdrToggle");
         }
 
         protected override void UpdateControls()
         {
-            this.intensitySlider.Value = this.EffectManager.Intensity;
-            this.blurSlider.Value = this.EffectManager.BlurIterations;
-            this.redSlider.Value = this.EffectManager.BloomThresholdColorRed;
-            this.greenSlider.Value = this.EffectManager.BloomThresholdColorGreen;
-            this.blueSlider.Value = this.EffectManager.BloomThresholdColorBlue;
-            this.hdrToggle.Value = this.EffectManager.BloomHDR;
+            intensitySlider.Value = EffectManager.Intensity;
+            blurSlider.Value = EffectManager.BlurIterations;
+            redSlider.Value = EffectManager.BloomThresholdColorRed;
+            greenSlider.Value = EffectManager.BloomThresholdColorGreen;
+            blueSlider.Value = EffectManager.BloomThresholdColorBlue;
+            hdrToggle.Value = EffectManager.BloomHDR;
         }
 
         protected override void DrawPane()
@@ -81,19 +81,19 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayoutOption sliderWidth = MiscGUI.HalfSlider;
 
             GUILayout.BeginHorizontal();
-            this.intensitySlider.Draw(sliderWidth);
-            this.blurSlider.Draw(sliderWidth);
+            intensitySlider.Draw(sliderWidth);
+            blurSlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.redSlider.Draw(sliderWidth);
-            this.greenSlider.Draw(sliderWidth);
+            redSlider.Draw(sliderWidth);
+            greenSlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.blueSlider.Draw(sliderWidth);
+            blueSlider.Draw(sliderWidth);
             GUILayout.FlexibleSpace();
-            this.hdrToggle.Draw(GUILayout.ExpandWidth(false));
+            hdrToggle.Draw(GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
         }
     }

+ 30 - 45
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/DepthOfFieldPane.cs

@@ -5,74 +5,59 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class DepthOfFieldPane : EffectPane<DepthOfFieldEffectManager>
     {
         protected override DepthOfFieldEffectManager EffectManager { get; set; }
-        private Slider focalLengthSlider;
-        private Slider focalSizeSlider;
-        private Slider apertureSlider;
-        private Slider blurSlider;
-        private Toggle thicknessToggle;
+        private readonly Slider focalLengthSlider;
+        private readonly Slider focalSizeSlider;
+        private readonly Slider apertureSlider;
+        private readonly Slider blurSlider;
+        private readonly Toggle thicknessToggle;
 
         public DepthOfFieldPane(EffectManager effectManager) : base(effectManager.Get<DepthOfFieldEffectManager>())
         {
-            this.focalLengthSlider = new Slider(Translation.Get("effectDof", "focalLength"), 0f, 10f);
-            this.focalSizeSlider = new Slider(Translation.Get("effectDof", "focalArea"), 0f, 2f);
-            this.apertureSlider = new Slider(Translation.Get("effectDof", "aperture"), 0f, 60f);
-            this.blurSlider = new Slider(Translation.Get("effectDof", "blur"), 0f, 10f);
-            this.thicknessToggle = new Toggle(Translation.Get("effectDof", "thicknessToggle"));
-            this.focalLengthSlider.ControlEvent += (s, a) =>
-            {
-                this.EffectManager.FocalLength = this.focalLengthSlider.Value;
-            };
-            this.focalSizeSlider.ControlEvent += (s, a) =>
-            {
-                this.EffectManager.FocalSize = this.focalSizeSlider.Value;
-            };
-            this.apertureSlider.ControlEvent += (s, a) =>
-            {
-                this.EffectManager.Aperture = this.apertureSlider.Value;
-            };
-            this.blurSlider.ControlEvent += (s, a) =>
-            {
-                this.EffectManager.MaxBlurSize = this.blurSlider.Value;
-            };
-            this.thicknessToggle.ControlEvent += (s, a) =>
-            {
-                this.EffectManager.VisualizeFocus = this.thicknessToggle.Value;
-            };
+            focalLengthSlider = new Slider(Translation.Get("effectDof", "focalLength"), 0f, 10f);
+            focalSizeSlider = new Slider(Translation.Get("effectDof", "focalArea"), 0f, 2f);
+            apertureSlider = new Slider(Translation.Get("effectDof", "aperture"), 0f, 60f);
+            blurSlider = new Slider(Translation.Get("effectDof", "blur"), 0f, 10f);
+            thicknessToggle = new Toggle(Translation.Get("effectDof", "thicknessToggle"));
+            focalLengthSlider.ControlEvent += (s, a) => EffectManager.FocalLength = focalLengthSlider.Value;
+            focalSizeSlider.ControlEvent += (s, a) => EffectManager.FocalSize = focalSizeSlider.Value;
+            apertureSlider.ControlEvent += (s, a) => EffectManager.Aperture = apertureSlider.Value;
+            blurSlider.ControlEvent += (s, a) => EffectManager.MaxBlurSize = blurSlider.Value;
+            thicknessToggle.ControlEvent += (s, a) => EffectManager.VisualizeFocus = thicknessToggle.Value;
         }
 
         protected override void TranslatePane()
         {
-            this.focalLengthSlider.Label = Translation.Get("effectDof", "focalLength");
-            this.focalSizeSlider.Label = Translation.Get("effectDof", "focalArea");
-            this.apertureSlider.Label = Translation.Get("effectDof", "aperture");
-            this.blurSlider.Label = Translation.Get("effectDof", "blur");
-            this.thicknessToggle.Label = Translation.Get("effectDof", "thicknessToggle");
+            focalLengthSlider.Label = Translation.Get("effectDof", "focalLength");
+            focalSizeSlider.Label = Translation.Get("effectDof", "focalArea");
+            apertureSlider.Label = Translation.Get("effectDof", "aperture");
+            blurSlider.Label = Translation.Get("effectDof", "blur");
+            thicknessToggle.Label = Translation.Get("effectDof", "thicknessToggle");
         }
 
         protected override void UpdateControls()
         {
-            this.focalLengthSlider.Value = this.EffectManager.FocalLength;
-            this.focalSizeSlider.Value = this.EffectManager.FocalSize;
-            this.apertureSlider.Value = this.EffectManager.Aperture;
-            this.blurSlider.Value = this.EffectManager.MaxBlurSize;
-            this.thicknessToggle.Value = this.EffectManager.VisualizeFocus;
+            focalLengthSlider.Value = EffectManager.FocalLength;
+            focalSizeSlider.Value = EffectManager.FocalSize;
+            apertureSlider.Value = EffectManager.Aperture;
+            blurSlider.Value = EffectManager.MaxBlurSize;
+            thicknessToggle.Value = EffectManager.VisualizeFocus;
         }
 
         protected override void DrawPane()
         {
-            this.focalLengthSlider.Draw();
+            focalLengthSlider.Draw();
 
             GUILayoutOption sliderWidth = MiscGUI.HalfSlider;
 
             GUILayout.BeginHorizontal();
-            this.focalSizeSlider.Draw(sliderWidth);
-            this.apertureSlider.Draw(sliderWidth);
+            focalSizeSlider.Draw(sliderWidth);
+            apertureSlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.blurSlider.Draw(sliderWidth);
+            blurSlider.Draw(sliderWidth);
             GUILayout.FlexibleSpace();
-            this.thicknessToggle.Draw();
+            thicknessToggle.Draw();
             GUILayout.EndHorizontal();
             GUI.enabled = true;
         }

+ 22 - 22
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectPane.cs

@@ -5,35 +5,35 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal abstract class EffectPane<T> : BasePane where T : IEffectManager
     {
         protected abstract T EffectManager { get; set; }
-        protected Toggle effectToggle;
-        protected Button resetEffectButton;
+        protected readonly Toggle effectToggle;
+        protected readonly Button resetEffectButton;
         private bool enabled;
         public override bool Enabled
         {
             get => enabled;
             set
             {
-                this.enabled = value;
-                this.EffectManager.SetEffectActive(this.enabled);
+                enabled = value;
+                EffectManager.SetEffectActive(enabled);
             }
         }
 
-        public EffectPane(T effectManager) : base()
+        protected EffectPane(T effectManager)
         {
-            this.EffectManager = effectManager;
-            this.resetEffectButton = new Button(Translation.Get("effectsPane", "reset"));
-            this.resetEffectButton.ControlEvent += (s, a) => this.ResetEffect();
-            this.effectToggle = new Toggle(Translation.Get("effectsPane", "onToggle"));
-            this.effectToggle.ControlEvent += (s, a) => this.Enabled = this.effectToggle.Value;
+            EffectManager = effectManager;
+            resetEffectButton = new Button(Translation.Get("effectsPane", "reset"));
+            resetEffectButton.ControlEvent += (s, a) => ResetEffect();
+            effectToggle = new Toggle(Translation.Get("effectsPane", "onToggle"));
+            effectToggle.ControlEvent += (s, a) => Enabled = effectToggle.Value;
         }
 
         protected override void ReloadTranslation()
         {
-            this.updating = true;
-            this.effectToggle.Label = Translation.Get("effectsPane", "onToggle");
-            this.resetEffectButton.Label = Translation.Get("effectsPane", "reset");
+            updating = true;
+            effectToggle.Label = Translation.Get("effectsPane", "onToggle");
+            resetEffectButton.Label = Translation.Get("effectsPane", "reset");
             TranslatePane();
-            this.updating = false;
+            updating = false;
         }
 
         protected abstract void TranslatePane();
@@ -41,10 +41,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void UpdatePane()
         {
             if (!EffectManager.Ready) return;
-            this.updating = true;
-            this.effectToggle.Value = this.EffectManager.Active;
-            this.UpdateControls();
-            this.updating = false;
+            updating = true;
+            effectToggle.Value = EffectManager.Active;
+            UpdateControls();
+            updating = false;
         }
 
         protected abstract void UpdateControls();
@@ -54,7 +54,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayout.BeginHorizontal();
             effectToggle.Draw();
             GUILayout.FlexibleSpace();
-            GUI.enabled = this.Enabled;
+            GUI.enabled = Enabled;
             resetEffectButton.Draw();
             GUILayout.EndHorizontal();
             DrawPane();
@@ -65,9 +65,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void ResetEffect()
         {
-            this.EffectManager.Deactivate();
-            this.EffectManager.SetEffectActive(true);
-            this.UpdatePane();
+            EffectManager.Deactivate();
+            EffectManager.SetEffectActive(true);
+            UpdatePane();
         }
     }
 }

+ 3 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectsPane.cs

@@ -4,10 +4,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class EffectsPane : BasePane
     {
-        private Dictionary<string, BasePane> effectPanes = new Dictionary<string, BasePane>();
-        private SelectionGrid effectToggles;
+        private readonly Dictionary<string, BasePane> effectPanes = new Dictionary<string, BasePane>();
+        private readonly SelectionGrid effectToggles;
+        private readonly List<string> effectList = new List<string>();
         private BasePane currentEffectPane;
-        private List<string> effectList = new List<string>();
 
         public BasePane this[string effectUI]
         {

+ 53 - 53
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/FogPane.cs

@@ -5,89 +5,89 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class FogPane : EffectPane<FogEffectManager>
     {
         protected override FogEffectManager EffectManager { get; set; }
-        private Slider distanceSlider;
-        private Slider densitySlider;
-        private Slider heightScaleSlider;
-        private Slider heightSlider;
-        private Slider redSlider;
-        private Slider greenSlider;
-        private Slider blueSlider;
+        private readonly Slider distanceSlider;
+        private readonly Slider densitySlider;
+        private readonly Slider heightScaleSlider;
+        private readonly Slider heightSlider;
+        private readonly Slider redSlider;
+        private readonly Slider greenSlider;
+        private readonly Slider blueSlider;
 
         public FogPane(EffectManager effectManager) : base(effectManager.Get<FogEffectManager>())
         {
-            this.distanceSlider = new Slider(
+            distanceSlider = new Slider(
                 Translation.Get("effectFog", "distance"), 0f, 30f, FogEffectManager.InitialDistance
             );
-            this.densitySlider = new Slider(
+            densitySlider = new Slider(
                 Translation.Get("effectFog", "density"), 0f, 10f, FogEffectManager.InitialDensity
             );
-            this.heightScaleSlider = new Slider(
+            heightScaleSlider = new Slider(
                 Translation.Get("effectFog", "strength"), -5f, 20f, FogEffectManager.InitialHeightScale
             );
-            this.heightSlider = new Slider(
+            heightSlider = new Slider(
                 Translation.Get("effectFog", "height"), -10f, 10f, FogEffectManager.InitialHeight
             );
             Color initialFogColour = FogEffectManager.InitialColour;
-            this.redSlider = new Slider(Translation.Get("backgroundWIndow", "red"), 0f, 1f, initialFogColour.r);
-            this.greenSlider = new Slider(Translation.Get("backgroundWIndow", "green"), 0f, 1f, initialFogColour.g);
-            this.blueSlider = new Slider(Translation.Get("backgroundWIndow", "blue"), 0f, 1f, initialFogColour.b);
-            this.distanceSlider.ControlEvent += (s, a) =>
+            redSlider = new Slider(Translation.Get("backgroundWIndow", "red"), 0f, 1f, initialFogColour.r);
+            greenSlider = new Slider(Translation.Get("backgroundWIndow", "green"), 0f, 1f, initialFogColour.g);
+            blueSlider = new Slider(Translation.Get("backgroundWIndow", "blue"), 0f, 1f, initialFogColour.b);
+            distanceSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.Distance = this.distanceSlider.Value;
+                if (updating) return;
+                EffectManager.Distance = distanceSlider.Value;
             };
-            this.densitySlider.ControlEvent += (s, a) =>
+            densitySlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.Density = this.densitySlider.Value;
+                if (updating) return;
+                EffectManager.Density = densitySlider.Value;
             };
-            this.heightScaleSlider.ControlEvent += (s, a) =>
+            heightScaleSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.HeightScale = this.heightScaleSlider.Value;
+                if (updating) return;
+                EffectManager.HeightScale = heightScaleSlider.Value;
             };
-            this.heightSlider.ControlEvent += (s, a) =>
+            heightSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.Height = this.heightSlider.Value;
+                if (updating) return;
+                EffectManager.Height = heightSlider.Value;
             };
-            this.redSlider.ControlEvent += (s, a) =>
+            redSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.FogColourRed = this.redSlider.Value;
+                if (updating) return;
+                EffectManager.FogColourRed = redSlider.Value;
             };
-            this.greenSlider.ControlEvent += (s, a) =>
+            greenSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.FogColourGreen = this.greenSlider.Value;
+                if (updating) return;
+                EffectManager.FogColourGreen = greenSlider.Value;
             };
-            this.blueSlider.ControlEvent += (s, a) =>
+            blueSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.FogColourBlue = this.blueSlider.Value;
+                if (updating) return;
+                EffectManager.FogColourBlue = blueSlider.Value;
             };
         }
 
         protected override void TranslatePane()
         {
-            this.distanceSlider.Label = Translation.Get("effectFog", "distance");
-            this.densitySlider.Label = Translation.Get("effectFog", "density");
-            this.heightScaleSlider.Label = Translation.Get("effectFog", "strength");
-            this.heightSlider.Label = Translation.Get("effectFog", "height");
-            this.redSlider.Label = Translation.Get("backgroundWIndow", "red");
-            this.greenSlider.Label = Translation.Get("backgroundWIndow", "green");
-            this.blueSlider.Label = Translation.Get("backgroundWIndow", "blue");
+            distanceSlider.Label = Translation.Get("effectFog", "distance");
+            densitySlider.Label = Translation.Get("effectFog", "density");
+            heightScaleSlider.Label = Translation.Get("effectFog", "strength");
+            heightSlider.Label = Translation.Get("effectFog", "height");
+            redSlider.Label = Translation.Get("backgroundWIndow", "red");
+            greenSlider.Label = Translation.Get("backgroundWIndow", "green");
+            blueSlider.Label = Translation.Get("backgroundWIndow", "blue");
         }
 
         protected override void UpdateControls()
         {
-            this.distanceSlider.Value = EffectManager.Distance;
-            this.densitySlider.Value = EffectManager.Density;
-            this.heightScaleSlider.Value = EffectManager.HeightScale;
-            this.heightSlider.Value = EffectManager.Height;
-            this.redSlider.Value = EffectManager.FogColourRed;
-            this.greenSlider.Value = EffectManager.FogColourGreen;
-            this.blueSlider.Value = EffectManager.FogColourBlue;
+            distanceSlider.Value = EffectManager.Distance;
+            densitySlider.Value = EffectManager.Density;
+            heightScaleSlider.Value = EffectManager.HeightScale;
+            heightSlider.Value = EffectManager.Height;
+            redSlider.Value = EffectManager.FogColourRed;
+            greenSlider.Value = EffectManager.FogColourGreen;
+            blueSlider.Value = EffectManager.FogColourBlue;
         }
 
         protected override void DrawPane()
@@ -95,13 +95,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayoutOption sliderWidth = MiscGUI.HalfSlider;
 
             GUILayout.BeginHorizontal();
-            this.distanceSlider.Draw(sliderWidth);
-            this.densitySlider.Draw(sliderWidth);
+            distanceSlider.Draw(sliderWidth);
+            densitySlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.heightScaleSlider.Draw(sliderWidth);
-            this.heightSlider.Draw(sliderWidth);
+            heightScaleSlider.Draw(sliderWidth);
+            heightSlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();

+ 32 - 32
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/VignettePane.cs

@@ -5,53 +5,53 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class VignettePane : EffectPane<VignetteEffectManager>
     {
         protected override VignetteEffectManager EffectManager { get; set; }
-        private Slider intensitySlider;
-        private Slider blurSlider;
-        private Slider blurSpreadSlider;
-        private Slider aberrationSlider;
+        private readonly Slider intensitySlider;
+        private readonly Slider blurSlider;
+        private readonly Slider blurSpreadSlider;
+        private readonly Slider aberrationSlider;
 
         public VignettePane(EffectManager effectManager) : base(effectManager.Get<VignetteEffectManager>())
         {
-            this.intensitySlider = new Slider(Translation.Get("effectVignette", "intensity"), -40f, 70f);
-            this.intensitySlider.ControlEvent += (s, a) =>
+            intensitySlider = new Slider(Translation.Get("effectVignette", "intensity"), -40f, 70f);
+            intensitySlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.Intensity = this.intensitySlider.Value;
+                if (updating) return;
+                EffectManager.Intensity = intensitySlider.Value;
             };
-            this.blurSlider = new Slider(Translation.Get("effectVignette", "blur"), 0f, 5f);
-            this.blurSlider.ControlEvent += (s, a) =>
+            blurSlider = new Slider(Translation.Get("effectVignette", "blur"), 0f, 5f);
+            blurSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.Blur = this.blurSlider.Value;
+                if (updating) return;
+                EffectManager.Blur = blurSlider.Value;
             };
-            this.blurSpreadSlider = new Slider(Translation.Get("effectVignette", "blurSpread"), 0f, 40f);
-            this.blurSpreadSlider.ControlEvent += (s, a) =>
+            blurSpreadSlider = new Slider(Translation.Get("effectVignette", "blurSpread"), 0f, 40f);
+            blurSpreadSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.BlurSpread = this.blurSpreadSlider.Value;
+                if (updating) return;
+                EffectManager.BlurSpread = blurSpreadSlider.Value;
             };
-            this.aberrationSlider = new Slider(Translation.Get("effectVignette", "aberration"), -30f, 30f);
-            this.aberrationSlider.ControlEvent += (s, a) =>
+            aberrationSlider = new Slider(Translation.Get("effectVignette", "aberration"), -30f, 30f);
+            aberrationSlider.ControlEvent += (s, a) =>
             {
-                if (this.updating) return;
-                this.EffectManager.ChromaticAberration = this.aberrationSlider.Value;
+                if (updating) return;
+                EffectManager.ChromaticAberration = aberrationSlider.Value;
             };
         }
 
         protected override void TranslatePane()
         {
-            this.intensitySlider.Label = Translation.Get("effectVignette", "intensity");
-            this.blurSlider.Label = Translation.Get("effectVignette", "blur");
-            this.blurSpreadSlider.Label = Translation.Get("effectVignette", "blurSpread");
-            this.aberrationSlider.Label = Translation.Get("effectVignette", "aberration");
+            intensitySlider.Label = Translation.Get("effectVignette", "intensity");
+            blurSlider.Label = Translation.Get("effectVignette", "blur");
+            blurSpreadSlider.Label = Translation.Get("effectVignette", "blurSpread");
+            aberrationSlider.Label = Translation.Get("effectVignette", "aberration");
         }
 
         protected override void UpdateControls()
         {
-            this.intensitySlider.Value = this.EffectManager.Intensity;
-            this.blurSlider.Value = this.EffectManager.Blur;
-            this.blurSpreadSlider.Value = this.EffectManager.BlurSpread;
-            this.aberrationSlider.Value = this.EffectManager.ChromaticAberration;
+            intensitySlider.Value = EffectManager.Intensity;
+            blurSlider.Value = EffectManager.Blur;
+            blurSpreadSlider.Value = EffectManager.BlurSpread;
+            aberrationSlider.Value = EffectManager.ChromaticAberration;
         }
 
         protected override void DrawPane()
@@ -59,13 +59,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayoutOption sliderWidth = MiscGUI.HalfSlider;
 
             GUILayout.BeginHorizontal();
-            this.intensitySlider.Draw(sliderWidth);
-            this.blurSlider.Draw(sliderWidth);
+            intensitySlider.Draw(sliderWidth);
+            blurSlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.blurSpreadSlider.Draw(sliderWidth);
-            this.aberrationSlider.Draw(sliderWidth);
+            blurSpreadSlider.Draw(sliderWidth);
+            aberrationSlider.Draw(sliderWidth);
             GUILayout.EndHorizontal();
         }
     }

+ 107 - 119
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/LightsPane.cs

@@ -7,18 +7,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     using static DragPointLight;
     internal class LightsPane : BasePane
     {
-        private LightManager lightManager;
         private static readonly string[] lightTypes = { "normal", "spot", "point" };
-        private Dictionary<LightProp, Slider> LightSlider;
-        private Dropdown lightDropdown;
-        private Button addLightButton;
-        private Button deleteLightButton;
-        private Button clearLightsButton;
-        private Button resetPropsButton;
-        private Button resetPositionButton;
-        private SelectionGrid lightTypeGrid;
-        private Toggle colorToggle;
-        private Toggle disableToggle;
+        private readonly LightManager lightManager;
+        private readonly Dictionary<LightProp, Slider> LightSlider;
+        private readonly Dropdown lightDropdown;
+        private readonly Button addLightButton;
+        private readonly Button deleteLightButton;
+        private readonly Button clearLightsButton;
+        private readonly Button resetPropsButton;
+        private readonly Button resetPositionButton;
+        private readonly SelectionGrid lightTypeGrid;
+        private readonly Toggle colorToggle;
+        private readonly Toggle disableToggle;
         private MPSLightType currentLightType = MPSLightType.Normal;
         private string lightHeader;
         private static readonly Dictionary<LightProp, SliderProp> LightSliderProp =
@@ -34,7 +34,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 [LightProp.Green] = new SliderProp(0f, 1f, 1f),
                 [LightProp.Blue] = new SliderProp(0f, 1f, 1f),
             };
-        private static string[,] sliderNames = {
+        private static readonly string[,] sliderNames = {
             { "lights", "x" }, { "lights", "y" }, { "lights", "intensity" }, { "lights", "shadow" },
             { "lights", "spot" }, { "lights", "range" }, { "backgroundWindow", "red" }, { "backgroundWindow", "green" },
             { "backgroundWindow", "blue" }
@@ -42,7 +42,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public LightsPane(LightManager lightManager)
         {
-            this.lightHeader = Translation.Get("lightsPane", "header");
+            lightHeader = Translation.Get("lightsPane", "header");
 
             this.lightManager = lightManager;
             this.lightManager.Rotate += (s, a) => UpdateRotation();
@@ -50,26 +50,26 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.lightManager.Select += (s, a) => UpdateCurrentLight();
             this.lightManager.ListModified += (s, a) => UpdateList();
 
-            this.lightTypeGrid = new SelectionGrid(Translation.GetArray("lightType", lightTypes));
-            this.lightTypeGrid.ControlEvent += (s, a) => SetCurrentLightType();
+            lightTypeGrid = new SelectionGrid(Translation.GetArray("lightType", lightTypes));
+            lightTypeGrid.ControlEvent += (s, a) => SetCurrentLightType();
 
-            this.lightDropdown = new Dropdown(new[] { "Main" });
-            this.lightDropdown.SelectionChange += (s, a) => SetCurrentLight();
+            lightDropdown = new Dropdown(new[] { "Main" });
+            lightDropdown.SelectionChange += (s, a) => SetCurrentLight();
 
-            this.addLightButton = new Button("+");
-            this.addLightButton.ControlEvent += (s, a) => AddLight();
+            addLightButton = new Button("+");
+            addLightButton.ControlEvent += (s, a) => AddLight();
 
-            this.deleteLightButton = new Button(Translation.Get("lightsPane", "delete"));
-            this.deleteLightButton.ControlEvent += (s, a) => DeleteCurrentLight();
+            deleteLightButton = new Button(Translation.Get("lightsPane", "delete"));
+            deleteLightButton.ControlEvent += (s, a) => DeleteCurrentLight();
 
-            this.disableToggle = new Toggle(Translation.Get("lightsPane", "disable"));
-            this.disableToggle.ControlEvent += (s, a) => SetCurrentLightActive();
+            disableToggle = new Toggle(Translation.Get("lightsPane", "disable"));
+            disableToggle.ControlEvent += (s, a) => SetCurrentLightActive();
 
-            this.clearLightsButton = new Button(Translation.Get("lightsPane", "clear"));
-            this.clearLightsButton.ControlEvent += (s, a) => ClearLights();
+            clearLightsButton = new Button(Translation.Get("lightsPane", "clear"));
+            clearLightsButton.ControlEvent += (s, a) => ClearLights();
 
             int numberOfLightProps = Enum.GetNames(typeof(LightProp)).Length;
-            this.LightSlider = new Dictionary<LightProp, Slider>(numberOfLightProps);
+            LightSlider = new Dictionary<LightProp, Slider>(numberOfLightProps);
 
             for (int i = 0; i < numberOfLightProps; i++)
             {
@@ -87,93 +87,81 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 LightSlider[lightProp] = slider;
             }
 
-            this.colorToggle = new Toggle(Translation.Get("lightsPane", "colour"));
-            this.colorToggle.ControlEvent += (s, a) => SetColourMode();
+            colorToggle = new Toggle(Translation.Get("lightsPane", "colour"));
+            colorToggle.ControlEvent += (s, a) => SetColourMode();
 
-            this.resetPropsButton = new Button(Translation.Get("lightsPane", "resetProperties"));
-            this.resetPropsButton.ControlEvent += (s, a) => ResetLightProps();
+            resetPropsButton = new Button(Translation.Get("lightsPane", "resetProperties"));
+            resetPropsButton.ControlEvent += (s, a) => ResetLightProps();
 
-            this.resetPositionButton = new Button(Translation.Get("lightsPane", "resetPosition"));
-            this.resetPositionButton.ControlEvent += (s, a) => ResetLightPosition();
+            resetPositionButton = new Button(Translation.Get("lightsPane", "resetPosition"));
+            resetPositionButton.ControlEvent += (s, a) => ResetLightPosition();
         }
 
         protected override void ReloadTranslation()
         {
-            this.updating = true;
-            this.lightHeader = Translation.Get("lightsPane", "header");
-            this.lightTypeGrid.SetItems(Translation.GetArray("lightType", lightTypes));
-            this.lightDropdown.SetDropdownItems(this.lightManager.LightNameList);
-            this.deleteLightButton.Label = Translation.Get("lightsPane", "delete");
-            this.disableToggle.Label = Translation.Get("lightsPane", "disable");
-            this.clearLightsButton.Label = Translation.Get("lightsPane", "clear");
+            updating = true;
+            lightHeader = Translation.Get("lightsPane", "header");
+            lightTypeGrid.SetItems(Translation.GetArray("lightType", lightTypes));
+            lightDropdown.SetDropdownItems(lightManager.LightNameList);
+            deleteLightButton.Label = Translation.Get("lightsPane", "delete");
+            disableToggle.Label = Translation.Get("lightsPane", "disable");
+            clearLightsButton.Label = Translation.Get("lightsPane", "clear");
             for (LightProp lightProp = LightProp.LightRotX; lightProp <= LightProp.Blue; lightProp++)
             {
                 LightSlider[lightProp].Label =
                     Translation.Get(sliderNames[(int)lightProp, 0], sliderNames[(int)lightProp, 1]);
             }
-            this.colorToggle.Label = Translation.Get("lightsPane", "colour");
-            this.resetPropsButton.Label = Translation.Get("lightsPane", "resetProperties");
-            this.resetPositionButton.Label = Translation.Get("lightsPane", "resetPosition");
-            this.updating = false;
+            colorToggle.Label = Translation.Get("lightsPane", "colour");
+            resetPropsButton.Label = Translation.Get("lightsPane", "resetProperties");
+            resetPositionButton.Label = Translation.Get("lightsPane", "resetPosition");
+            updating = false;
         }
 
         private void SetColourMode()
         {
-            this.lightManager.SetColourModeActive(this.colorToggle.Value);
-            this.UpdatePane();
+            lightManager.SetColourModeActive(colorToggle.Value);
+            UpdatePane();
         }
 
         private void ClearLights()
         {
-            this.lightManager.ClearLights();
-            this.UpdatePane();
+            lightManager.ClearLights();
+            UpdatePane();
         }
 
         private void SetCurrentLight()
         {
             if (updating) return;
-            this.lightManager.SelectedLightIndex = this.lightDropdown.SelectedItemIndex;
-            this.UpdatePane();
+            lightManager.SelectedLightIndex = lightDropdown.SelectedItemIndex;
+            UpdatePane();
         }
 
         private void ResetLightProps()
         {
-            this.lightManager.CurrentLight.ResetLightProps();
-            this.UpdatePane();
+            lightManager.CurrentLight.ResetLightProps();
+            UpdatePane();
         }
 
-        private void ResetLightPosition()
-        {
-            this.lightManager.CurrentLight.ResetLightPosition();
-        }
+        private void ResetLightPosition() => lightManager.CurrentLight.ResetLightPosition();
 
-        private void AddLight()
-        {
-            this.lightManager.AddLight();
-        }
+        private void AddLight() => lightManager.AddLight();
 
-        private void DeleteCurrentLight()
-        {
-            this.lightManager.DeleteActiveLight();
-        }
+        private void DeleteCurrentLight() => lightManager.DeleteActiveLight();
 
-        private void SetCurrentLightActive()
-        {
-            this.lightManager.CurrentLight.IsDisabled = this.disableToggle.Value;
-        }
+        private void SetCurrentLightActive() => lightManager.CurrentLight.IsDisabled = disableToggle.Value;
 
         private void SetCurrentLightType()
         {
             if (updating) return;
 
-            currentLightType = (MPSLightType)this.lightTypeGrid.SelectedItemIndex;
+            currentLightType = (MPSLightType)lightTypeGrid.SelectedItemIndex;
 
             DragPointLight currentLight = lightManager.CurrentLight;
 
             currentLight.SetLightType(currentLightType);
 
-            this.lightDropdown.SetDropdownItem(lightManager.ActiveLightName);
-            this.UpdatePane();
+            lightDropdown.SetDropdownItem(lightManager.ActiveLightName);
+            UpdatePane();
         }
 
         private void SetLightProp(LightProp prop, float value)
@@ -192,81 +180,81 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void UpdateList()
         {
-            string[] newList = this.lightManager.LightNameList;
-            this.lightDropdown.SetDropdownItems(newList, this.lightManager.SelectedLightIndex);
-            this.UpdatePane();
+            string[] newList = lightManager.LightNameList;
+            lightDropdown.SetDropdownItems(newList, lightManager.SelectedLightIndex);
+            UpdatePane();
         }
 
         private void UpdateRotation()
         {
-            this.updating = true;
-            LightProperty prop = this.lightManager.CurrentLight.CurrentLightProperty;
+            updating = true;
+            LightProperty prop = lightManager.CurrentLight.CurrentLightProperty;
             LightSlider[LightProp.LightRotX].Value = prop.Rotation.eulerAngles.x;
             LightSlider[LightProp.LightRotY].Value = prop.Rotation.eulerAngles.y;
-            this.updating = false;
+            updating = false;
         }
 
         private void UpdateScale()
         {
-            this.updating = true;
-            LightSlider[LightProp.SpotAngle].Value = this.lightManager.CurrentLight.CurrentLightProperty.SpotAngle;
-            LightSlider[LightProp.Range].Value = this.lightManager.CurrentLight.CurrentLightProperty.Range;
-            this.updating = false;
+            updating = true;
+            LightSlider[LightProp.SpotAngle].Value = lightManager.CurrentLight.CurrentLightProperty.SpotAngle;
+            LightSlider[LightProp.Range].Value = lightManager.CurrentLight.CurrentLightProperty.Range;
+            updating = false;
         }
 
         private void UpdateCurrentLight()
         {
-            this.updating = true;
-            this.lightDropdown.SelectedItemIndex = this.lightManager.SelectedLightIndex;
-            this.updating = false;
-            this.UpdatePane();
+            updating = true;
+            lightDropdown.SelectedItemIndex = lightManager.SelectedLightIndex;
+            updating = false;
+            UpdatePane();
         }
 
         public override void UpdatePane()
         {
-            this.updating = true;
-            DragPointLight currentLight = this.lightManager.CurrentLight;
-            this.currentLightType = currentLight.SelectedLightType;
-            this.lightTypeGrid.SelectedItemIndex = (int)this.currentLightType;
-            this.disableToggle.Value = currentLight.IsDisabled;
-            this.LightSlider[LightProp.LightRotX].Value = currentLight.Rotation.eulerAngles.x;
-            this.LightSlider[LightProp.LightRotY].Value = currentLight.Rotation.eulerAngles.y;
-            this.LightSlider[LightProp.Intensity].Value = currentLight.Intensity;
-            this.LightSlider[LightProp.ShadowStrength].Value = currentLight.ShadowStrength;
-            this.LightSlider[LightProp.Range].Value = currentLight.Range;
-            this.LightSlider[LightProp.SpotAngle].Value = currentLight.SpotAngle;
-            this.LightSlider[LightProp.Red].Value = currentLight.LightColour.r;
-            this.LightSlider[LightProp.Green].Value = currentLight.LightColour.g;
-            this.LightSlider[LightProp.Blue].Value = currentLight.LightColour.b;
-            this.updating = false;
+            updating = true;
+            DragPointLight currentLight = lightManager.CurrentLight;
+            currentLightType = currentLight.SelectedLightType;
+            lightTypeGrid.SelectedItemIndex = (int)currentLightType;
+            disableToggle.Value = currentLight.IsDisabled;
+            LightSlider[LightProp.LightRotX].Value = currentLight.Rotation.eulerAngles.x;
+            LightSlider[LightProp.LightRotY].Value = currentLight.Rotation.eulerAngles.y;
+            LightSlider[LightProp.Intensity].Value = currentLight.Intensity;
+            LightSlider[LightProp.ShadowStrength].Value = currentLight.ShadowStrength;
+            LightSlider[LightProp.Range].Value = currentLight.Range;
+            LightSlider[LightProp.SpotAngle].Value = currentLight.SpotAngle;
+            LightSlider[LightProp.Red].Value = currentLight.LightColour.r;
+            LightSlider[LightProp.Green].Value = currentLight.LightColour.g;
+            LightSlider[LightProp.Blue].Value = currentLight.LightColour.b;
+            updating = false;
         }
 
         public override void Draw()
         {
-            bool isMain = this.lightManager.SelectedLightIndex == 0;
+            bool isMain = lightManager.SelectedLightIndex == 0;
 
             MiscGUI.Header(lightHeader);
             MiscGUI.WhiteLine();
 
             GUILayout.BeginHorizontal();
-            this.lightDropdown.Draw(GUILayout.Width(84));
-            this.addLightButton.Draw(GUILayout.ExpandWidth(false));
+            lightDropdown.Draw(GUILayout.Width(84));
+            addLightButton.Draw(GUILayout.ExpandWidth(false));
 
             GUILayout.FlexibleSpace();
             GUI.enabled = !isMain;
-            this.deleteLightButton.Draw(GUILayout.ExpandWidth(false));
+            deleteLightButton.Draw(GUILayout.ExpandWidth(false));
             GUI.enabled = true;
-            this.clearLightsButton.Draw(GUILayout.ExpandWidth(false));
+            clearLightsButton.Draw(GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
 
-            bool isDisabled = !isMain && this.lightManager.CurrentLight.IsDisabled;
+            bool isDisabled = !isMain && lightManager.CurrentLight.IsDisabled;
             GUILayout.BeginHorizontal();
             GUI.enabled = !isDisabled;
-            this.lightTypeGrid.Draw(GUILayout.ExpandWidth(false));
+            lightTypeGrid.Draw(GUILayout.ExpandWidth(false));
             if (!isMain)
             {
                 GUI.enabled = true;
-                this.disableToggle.Draw();
+                disableToggle.Draw();
             }
             GUILayout.EndHorizontal();
 
@@ -274,43 +262,43 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             if (currentLightType != MPSLightType.Point)
             {
-                this.LightSlider[LightProp.LightRotX].Draw();
-                this.LightSlider[LightProp.LightRotY].Draw();
+                LightSlider[LightProp.LightRotX].Draw();
+                LightSlider[LightProp.LightRotY].Draw();
             }
 
-            this.LightSlider[LightProp.Intensity].Draw();
+            LightSlider[LightProp.Intensity].Draw();
 
             if (currentLightType == MPSLightType.Normal)
             {
-                this.LightSlider[LightProp.ShadowStrength].Draw();
+                LightSlider[LightProp.ShadowStrength].Draw();
             }
             else
             {
-                this.LightSlider[LightProp.Range].Draw();
+                LightSlider[LightProp.Range].Draw();
             }
 
             if (currentLightType == MPSLightType.Spot)
             {
-                this.LightSlider[LightProp.SpotAngle].Draw();
+                LightSlider[LightProp.SpotAngle].Draw();
             }
 
             GUILayoutOption sliderWidth = MiscGUI.HalfSlider;
             GUILayout.BeginHorizontal();
-            this.LightSlider[LightProp.Red].Draw(sliderWidth);
-            this.LightSlider[LightProp.Green].Draw(sliderWidth);
+            LightSlider[LightProp.Red].Draw(sliderWidth);
+            LightSlider[LightProp.Green].Draw(sliderWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.LightSlider[LightProp.Blue].Draw(sliderWidth);
+            LightSlider[LightProp.Blue].Draw(sliderWidth);
             if ((lightManager.SelectedLightIndex == 0) && (currentLightType == MPSLightType.Normal))
             {
-                this.colorToggle.Draw();
+                colorToggle.Draw();
             }
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.resetPropsButton.Draw(GUILayout.ExpandWidth(false));
-            this.resetPositionButton.Draw(GUILayout.ExpandWidth(false));
+            resetPropsButton.Draw(GUILayout.ExpandWidth(false));
+            resetPositionButton.Draw(GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;

+ 3 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BasePane.cs

@@ -7,11 +7,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     {
         protected BaseWindow parent;
         protected List<BaseControl> Controls { get; set; }
-        protected bool updating = false;
+        protected bool updating;
         public virtual bool Visible { get; set; }
         public virtual bool Enabled { get; set; }
 
-        public BasePane()
+        protected BasePane()
         {
             Translation.ReloadTranslationEvent += OnReloadTranslation;
             Controls = new List<BaseControl>();
@@ -27,7 +27,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             ReloadTranslation();
         }
 
-        public void SetParent(BaseWindow window) => this.parent = window;
+        public void SetParent(BaseWindow window) => parent = window;
 
         protected virtual void ReloadTranslation() { }
 

+ 13 - 17
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/CallWindowPanes/MaidSelectorPane.cs

@@ -5,15 +5,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MaidSelectorPane : BasePane
     {
-        private MeidoManager meidoManager;
-        public List<int> selectedMaidList { get; private set; }
+        private readonly MeidoManager meidoManager;
         private Vector2 maidListScrollPos;
-        private Button clearMaidsButton;
-        private Button callMaidsButton;
+        private readonly Button clearMaidsButton;
+        private readonly Button callMaidsButton;
         public MaidSelectorPane(MeidoManager meidoManager) : base()
         {
             this.meidoManager = meidoManager;
-            selectedMaidList = new List<int>();
             clearMaidsButton = new Button(Translation.Get("maidCallWindow", "clearButton"));
             clearMaidsButton.ControlEvent += (s, a) => this.meidoManager.SelectMeidoList.Clear();
             Controls.Add(clearMaidsButton);
@@ -34,8 +32,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             clearMaidsButton.Draw();
             callMaidsButton.Draw();
 
-            GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
-            labelStyle.fontSize = 14;
+            GUIStyle labelStyle = new GUIStyle(GUI.skin.label) { fontSize = 14 };
             GUIStyle selectLabelStyle = new GUIStyle(labelStyle);
             selectLabelStyle.normal.textColor = Color.black;
             selectLabelStyle.alignment = TextAnchor.UpperRight;
@@ -43,27 +40,27 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             labelSelectedStyle.normal.textColor = Color.black;
 
             float windowHeight = Screen.height * 0.8f;
-            int buttonHeight = 85;
-            int buttonWidth = 205;
+            const int buttonHeight = 85;
+            const int buttonWidth = 205;
             Rect positionRect = new Rect(5, 115, buttonWidth + 15, windowHeight - 140);
-            Rect viewRect = new Rect(0, 0, buttonWidth - 5, buttonHeight * meidoManager.meidos.Length + 5);
+            Rect viewRect = new Rect(0, 0, buttonWidth - 5, (buttonHeight * meidoManager.Meidos.Length) + 5);
             maidListScrollPos = GUI.BeginScrollView(positionRect, maidListScrollPos, viewRect);
 
-            for (int i = 0; i < meidoManager.meidos.Length; i++)
+            for (int i = 0; i < meidoManager.Meidos.Length; i++)
             {
-                Meido meido = meidoManager.meidos[i];
+                Meido meido = meidoManager.Meidos[i];
                 float y = i * buttonHeight;
-                bool selectedMaid = this.meidoManager.SelectMeidoList.Contains(i);
+                bool selectedMaid = meidoManager.SelectMeidoList.Contains(i);
 
                 if (GUI.Button(new Rect(0, y, buttonWidth, buttonHeight), ""))
                 {
-                    if (selectedMaid) this.meidoManager.SelectMeidoList.Remove(i);
-                    else this.meidoManager.SelectMeidoList.Add(i);
+                    if (selectedMaid) meidoManager.SelectMeidoList.Remove(i);
+                    else meidoManager.SelectMeidoList.Add(i);
                 }
 
                 if (selectedMaid)
                 {
-                    int selectedIndex = this.meidoManager.SelectMeidoList.IndexOf(i) + 1;
+                    int selectedIndex = meidoManager.SelectMeidoList.IndexOf(i) + 1;
                     GUI.DrawTexture(new Rect(5, y + 5, buttonWidth - 10, buttonHeight - 10), Texture2D.whiteTexture);
                     GUI.Label(
                         new Rect(0, y + 5, buttonWidth - 10, buttonHeight), selectedIndex.ToString(), selectLabelStyle
@@ -75,7 +72,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     new Rect(95, y + 30, buttonWidth - 80, buttonHeight),
                     $"{meido.LastName}\n{meido.FirstName}", selectedMaid ? labelSelectedStyle : labelStyle
                 );
-
             }
             GUI.EndScrollView();
         }

+ 5 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/FaceWindowPanes/MaidFaceBlendPane.cs

@@ -93,16 +93,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw()
         {
-            float arrowButtonSize = 30;
+            const float buttonHeight = 30;
             GUILayoutOption[] arrowLayoutOptions = {
-                GUILayout.Width(arrowButtonSize),
-                GUILayout.Height(arrowButtonSize)
+                GUILayout.Width(buttonHeight),
+                GUILayout.Height(buttonHeight)
             };
 
-            float dropdownButtonHeight = arrowButtonSize;
-            float dropdownButtonWidth = 153f;
+            const float dropdownButtonWidth = 153f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
-                GUILayout.Height(dropdownButtonHeight),
+                GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth)
             };
 

+ 10 - 10
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/FaceWindowPanes/MaidFaceSliderPane.cs

@@ -58,21 +58,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             // Tongue Base
             ["tangopen"] = new SliderProp(0f, 1f)
         };
-        private MeidoManager meidoManager;
-        private Dictionary<string, BaseControl> faceControls;
+        private readonly MeidoManager meidoManager;
+        private readonly Dictionary<string, BaseControl> faceControls;
         private bool hasTangOpen = false;
 
         public MaidFaceSliderPane(MeidoManager meidoManager)
         {
             this.meidoManager = meidoManager;
-            this.faceControls = new Dictionary<string, BaseControl>();
+            faceControls = new Dictionary<string, BaseControl>();
 
             foreach (string key in faceKeys)
             {
                 string uiName = Translation.Get("faceBlendValues", key);
                 Slider slider = new Slider(uiName, SliderRange[key]);
                 string myKey = key;
-                slider.ControlEvent += (s, a) => this.SetFaceValue(myKey, slider.Value);
+                slider.ControlEvent += (s, a) => SetFaceValue(myKey, slider.Value);
                 faceControls[key] = slider;
             }
 
@@ -81,7 +81,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 string uiName = Translation.Get("faceBlendValues", key);
                 Toggle toggle = new Toggle(uiName);
                 string myKey = key;
-                toggle.ControlEvent += (s, a) => this.SetFaceValue(myKey, toggle.Value);
+                toggle.ControlEvent += (s, a) => SetFaceValue(myKey, toggle.Value);
                 faceControls[key] = toggle;
             }
         }
@@ -103,8 +103,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void UpdatePane()
         {
-            this.updating = true;
-            Meido meido = this.meidoManager.ActiveMeido;
+            updating = true;
+            Meido meido = meidoManager.ActiveMeido;
             for (int i = 0; i < faceKeys.Length; i++)
             {
                 Slider slider = (Slider)faceControls[faceKeys[i]];
@@ -123,12 +123,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 if (hash == "toothoff") toggle.Value = !toggle.Value;
             }
             hasTangOpen = meido.Body.Face.morph.hash["tangopen"] != null;
-            this.updating = false;
+            updating = false;
         }
 
         public override void Draw()
         {
-            GUI.enabled = this.meidoManager.HasActiveMeido;
+            GUI.enabled = meidoManager.HasActiveMeido;
             DrawSliders("eyeclose", "eyeclose2");
             DrawSliders("eyeclose3", "eyebig");
             DrawSliders("eyeclose6", "eyeclose5");
@@ -173,7 +173,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private void SetFaceValue(string key, float value)
         {
             if (updating) return;
-            this.meidoManager.ActiveMeido.SetFaceBlendValue(key, value);
+            meidoManager.ActiveMeido.SetFaceBlendValue(key, value);
         }
 
         private void SetFaceValue(string key, bool value)

+ 25 - 32
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BG2WindowPane.cs

@@ -2,61 +2,54 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class BG2WindowPane : BaseMainWindowPane
     {
-        private MeidoManager meidoManager;
-        private PropManager propManager;
-        private PropsPane propsPane;
-        private AttachPropPane attachPropPane;
-        private MyRoomPropsPane myRoomPropsPane;
-        private ModPropsPane modPropsPane;
-        private PropManagerPane propManagerPane;
-        private SelectionGrid propTabs;
-        private BasePane currentPropsPane;
         private static readonly string[] tabNames = { "props", "myRoom", "mod" };
+        private readonly MeidoManager meidoManager;
+        private readonly PropManager propManager;
+        private readonly AttachPropPane attachPropPane;
+        private readonly PropManagerPane propManagerPane;
+        private readonly SelectionGrid propTabs;
+        private BasePane currentPropsPane;
 
         public BG2WindowPane(MeidoManager meidoManager, PropManager propManager)
         {
             this.meidoManager = meidoManager;
             this.propManager = propManager;
-            this.propManager.DoguSelectChange += (s, a) => this.propTabs.SelectedItemIndex = 0;
+            this.propManager.DoguSelectChange += (s, a) => propTabs.SelectedItemIndex = 0;
 
-            this.propsPane = AddPane(new PropsPane(propManager));
-            this.myRoomPropsPane = AddPane(new MyRoomPropsPane(propManager));
-            this.modPropsPane = AddPane(new ModPropsPane(propManager));
-            this.attachPropPane = AddPane(new AttachPropPane(this.meidoManager, propManager));
-            this.propManagerPane = AddPane(new PropManagerPane(propManager));
+            // should be added in this order
+            AddPane(new PropsPane(propManager));
+            AddPane(new MyRoomPropsPane(propManager));
+            AddPane(new ModPropsPane(propManager));
 
-            this.propTabs = new SelectionGrid(Translation.GetArray("propsPaneTabs", tabNames));
-            this.propTabs.ControlEvent += (s, a) =>
-            {
-                currentPropsPane = this.Panes[this.propTabs.SelectedItemIndex];
-            };
-            this.currentPropsPane = this.Panes[0];
+            attachPropPane = AddPane(new AttachPropPane(this.meidoManager, propManager));
+            propManagerPane = AddPane(new PropManagerPane(propManager));
+
+            propTabs = new SelectionGrid(Translation.GetArray("propsPaneTabs", tabNames));
+            propTabs.ControlEvent += (s, a) => currentPropsPane = Panes[propTabs.SelectedItemIndex];
+            currentPropsPane = Panes[0];
         }
 
         protected override void ReloadTranslation()
         {
-            this.propTabs.SetItems(Translation.GetArray("propsPaneTabs", tabNames));
+            propTabs.SetItems(Translation.GetArray("propsPaneTabs", tabNames));
         }
 
         public override void Draw()
         {
-            this.tabsPane.Draw();
-            this.propTabs.Draw();
+            tabsPane.Draw();
+            propTabs.Draw();
             MiscGUI.WhiteLine();
-            this.currentPropsPane.Draw();
-            if (this.propTabs.SelectedItemIndex == 0)
+            currentPropsPane.Draw();
+            if (propTabs.SelectedItemIndex == 0)
             {
-                this.propManagerPane.Draw();
-                this.attachPropPane.Draw();
+                propManagerPane.Draw();
+                attachPropPane.Draw();
             }
         }
 
         public override void UpdatePanes()
         {
-            if (ActiveWindow)
-            {
-                base.UpdatePanes();
-            }
+            if (ActiveWindow) base.UpdatePanes();
         }
     }
 }

+ 20 - 23
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/BGWindowPane.cs

@@ -4,25 +4,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class BGWindowPane : BaseMainWindowPane
     {
-        private BackgroundSelectorPane backgroundSelectorPane;
-        private LightsPane lightsPane;
-        private EffectsPane effectsPane;
-        private DragPointPane dragPointPane;
-        private Button sceneManagerButton;
+        private readonly BackgroundSelectorPane backgroundSelectorPane;
+        private readonly LightsPane lightsPane;
+        private readonly EffectsPane effectsPane;
+        private readonly DragPointPane dragPointPane;
+        private readonly Button sceneManagerButton;
 
         public BGWindowPane(
             EnvironmentManager environmentManager, LightManager lightManager, EffectManager effectManager,
             SceneWindow sceneWindow
         )
         {
-            this.sceneManagerButton = new Button(Translation.Get("backgroundWindow", "manageScenesButton"));
-            this.sceneManagerButton.ControlEvent += (s, a) => sceneWindow.Visible = !sceneWindow.Visible;
+            sceneManagerButton = new Button(Translation.Get("backgroundWindow", "manageScenesButton"));
+            sceneManagerButton.ControlEvent += (s, a) => sceneWindow.Visible = !sceneWindow.Visible;
 
-            this.backgroundSelectorPane = AddPane(new BackgroundSelectorPane(environmentManager));
-            this.dragPointPane = AddPane(new DragPointPane());
-            this.lightsPane = AddPane(new LightsPane(lightManager));
+            backgroundSelectorPane = AddPane(new BackgroundSelectorPane(environmentManager));
+            dragPointPane = AddPane(new DragPointPane());
+            lightsPane = AddPane(new LightsPane(lightManager));
 
-            this.effectsPane = AddPane(new EffectsPane()
+            effectsPane = AddPane(new EffectsPane()
             {
                 ["bloom"] = new BloomPane(effectManager),
                 ["dof"] = new DepthOfFieldPane(effectManager),
@@ -33,27 +33,24 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         protected override void ReloadTranslation()
         {
-            this.sceneManagerButton.Label = Translation.Get("backgroundWindow", "manageScenesButton");
+            sceneManagerButton.Label = Translation.Get("backgroundWindow", "manageScenesButton");
         }
 
         public override void Draw()
         {
-            this.tabsPane.Draw();
-            this.sceneManagerButton.Draw();
-            this.backgroundSelectorPane.Draw();
-            this.dragPointPane.Draw();
-            this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
-            this.lightsPane.Draw();
-            this.effectsPane.Draw();
+            tabsPane.Draw();
+            sceneManagerButton.Draw();
+            backgroundSelectorPane.Draw();
+            dragPointPane.Draw();
+            scrollPos = GUILayout.BeginScrollView(scrollPos);
+            lightsPane.Draw();
+            effectsPane.Draw();
             GUILayout.EndScrollView();
         }
 
         public override void UpdatePanes()
         {
-            if (ActiveWindow)
-            {
-                base.UpdatePanes();
-            }
+            if (ActiveWindow) base.UpdatePanes();
         }
     }
 }

+ 8 - 12
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/CallWindowPane.cs

@@ -4,10 +4,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class CallWindowPane : BaseMainWindowPane
     {
-        private MeidoManager meidoManager;
-        private MaidSelectorPane maidSelectorPane;
-        private Dropdown placementDropdown;
-        private Button placementOKButton;
+        private readonly MeidoManager meidoManager;
+        private readonly MaidSelectorPane maidSelectorPane;
+        private readonly Dropdown placementDropdown;
+        private readonly Button placementOKButton;
 
         public CallWindowPane(MeidoManager meidoManager)
         {
@@ -20,11 +20,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             placementOKButton = new Button(Translation.Get("maidCallWindow", "okButton"));
             placementOKButton.ControlEvent += (o, a) =>
             {
-                meidoManager.PlaceMeidos(MaidPlacementUtility.placementTypes[placementDropdown.SelectedItemIndex]);
+                this.meidoManager.PlaceMeidos(MaidPlacementUtility.placementTypes[placementDropdown.SelectedItemIndex]);
             };
             Controls.Add(placementOKButton);
 
-            maidSelectorPane = AddPane(new MaidSelectorPane(meidoManager));
+            maidSelectorPane = AddPane(new MaidSelectorPane(this.meidoManager));
         }
 
         protected override void ReloadTranslation()
@@ -35,14 +35,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             placementOKButton.Label = Translation.Get("maidCallWindow", "okButton");
         }
 
-        public override void UpdatePanes()
-        {
-            base.UpdatePanes();
-        }
-
         public override void Draw()
         {
-            this.tabsPane.Draw();
+            tabsPane.Draw();
+
             GUILayout.BeginHorizontal();
             placementDropdown.Draw(GUILayout.Width(150));
             placementOKButton.Draw();

+ 8 - 8
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/FaceWindowPane.cs

@@ -4,10 +4,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class FaceWindowPane : BaseMainWindowPane
     {
-        private MeidoManager meidoManager;
-        private MaidFaceSliderPane maidFaceSliderPane;
-        private MaidFaceBlendPane maidFaceBlendPane;
-        private MaidSwitcherPane maidSwitcherPane;
+        private readonly MeidoManager meidoManager;
+        private readonly MaidFaceSliderPane maidFaceSliderPane;
+        private readonly MaidFaceBlendPane maidFaceBlendPane;
+        private readonly MaidSwitcherPane maidSwitcherPane;
         private readonly SaveFacePane saveFacePane;
         private readonly Toggle saveFaceToggle;
         private bool saveFaceMode = false;
@@ -18,8 +18,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             this.maidSwitcherPane = maidSwitcherPane;
 
-            this.maidFaceSliderPane = AddPane(new MaidFaceSliderPane(this.meidoManager));
-            this.maidFaceBlendPane = AddPane(new MaidFaceBlendPane(this.meidoManager));
+            maidFaceSliderPane = AddPane(new MaidFaceSliderPane(this.meidoManager));
+            maidFaceBlendPane = AddPane(new MaidFaceBlendPane(this.meidoManager));
             saveFacePane = AddPane(new SaveFacePane(this.meidoManager));
 
             saveFaceToggle = new Toggle(Translation.Get("maidFaceWindow", "savePaneToggle"));
@@ -53,10 +53,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void UpdatePanes()
         {
-            if (!this.meidoManager.HasActiveMeido) return;
+            if (!meidoManager.HasActiveMeido) return;
             if (ActiveWindow)
             {
-                this.meidoManager.ActiveMeido.StopBlink();
+                meidoManager.ActiveMeido.StopBlink();
                 base.UpdatePanes();
             }
         }

+ 59 - 57
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/PoseWindowPane.cs

@@ -4,22 +4,22 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class PoseWindowPane : BaseMainWindowPane
     {
-        private MeidoManager meidoManager;
-        private MaidPoseSelectorPane maidPosePane;
-        private SavePosePane savePosePane;
-        private MaidSwitcherPane maidSwitcherPane;
-        private MaidFaceLookPane maidFaceLookPane;
-        private MpnAttachPropPane mpnAttachPropPane;
-        private MaidDressingPane maidDressingPane;
-        private GravityControlPane gravityControlPane;
-        private CopyPosePane copyPosePane;
-        private HandPresetPane handPresetPane;
-        private SaveHandPane saveHandPane;
-        private MaidIKPane maidIKPane;
-        private Toggle freeLookToggle;
-        private Toggle savePoseToggle;
-        private Toggle saveHandToggle;
-        private Button flipButton;
+        private readonly MeidoManager meidoManager;
+        private readonly MaidPoseSelectorPane maidPosePane;
+        private readonly SavePosePane savePosePane;
+        private readonly MaidSwitcherPane maidSwitcherPane;
+        private readonly MaidFaceLookPane maidFaceLookPane;
+        private readonly MpnAttachPropPane mpnAttachPropPane;
+        private readonly MaidDressingPane maidDressingPane;
+        private readonly GravityControlPane gravityControlPane;
+        private readonly CopyPosePane copyPosePane;
+        private readonly HandPresetPane handPresetPane;
+        private readonly SaveHandPane saveHandPane;
+        private readonly MaidIKPane maidIKPane;
+        private readonly Toggle freeLookToggle;
+        private readonly Toggle savePoseToggle;
+        private readonly Toggle saveHandToggle;
+        private readonly Button flipButton;
         private bool savePoseMode = false;
         private bool saveHandMode = false;
         private string handPresetHeader;
@@ -30,59 +30,61 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.meidoManager = meidoManager;
             this.maidSwitcherPane = maidSwitcherPane;
 
-            this.maidPosePane = AddPane(new MaidPoseSelectorPane(meidoManager));
-            this.savePosePane = AddPane(new SavePosePane(meidoManager));
+            maidPosePane = AddPane(new MaidPoseSelectorPane(meidoManager));
+            savePosePane = AddPane(new SavePosePane(meidoManager));
 
-            this.maidFaceLookPane = AddPane(new MaidFaceLookPane(meidoManager));
-            this.maidFaceLookPane.Enabled = false;
+            maidFaceLookPane = AddPane(new MaidFaceLookPane(meidoManager));
+            maidFaceLookPane.Enabled = false;
 
-            this.freeLookToggle = new Toggle(Translation.Get("freeLookPane", "freeLookToggle"), false);
-            this.freeLookToggle.ControlEvent += (s, a) => SetMaidFreeLook();
+            freeLookToggle = new Toggle(Translation.Get("freeLookPane", "freeLookToggle"), false);
+            freeLookToggle.ControlEvent += (s, a) => SetMaidFreeLook();
 
-            this.savePoseToggle = new Toggle(Translation.Get("posePane", "saveToggle"));
-            this.savePoseToggle.ControlEvent += (s, a) => savePoseMode = !savePoseMode;
+            savePoseToggle = new Toggle(Translation.Get("posePane", "saveToggle"));
+            savePoseToggle.ControlEvent += (s, a) => savePoseMode = !savePoseMode;
 
-            this.mpnAttachPropPane = new MpnAttachPropPane(this.meidoManager);
+            mpnAttachPropPane = new MpnAttachPropPane(this.meidoManager);
 
-            this.maidDressingPane = AddPane(new MaidDressingPane(meidoManager));
+            maidDressingPane = AddPane(new MaidDressingPane(this.meidoManager));
 
-            this.maidIKPane = AddPane(new MaidIKPane(meidoManager));
+            maidIKPane = AddPane(new MaidIKPane(this.meidoManager));
 
-            this.gravityControlPane = AddPane(new GravityControlPane(meidoManager));
+            gravityControlPane = AddPane(new GravityControlPane(this.meidoManager));
 
-            this.copyPosePane = AddPane(new CopyPosePane(meidoManager));
+            copyPosePane = AddPane(new CopyPosePane(this.meidoManager));
 
-            this.saveHandToggle = new Toggle(Translation.Get("handPane", "saveToggle"));
-            this.saveHandToggle.ControlEvent += (s, a) => saveHandMode = !saveHandMode;
+            saveHandToggle = new Toggle(Translation.Get("handPane", "saveToggle"));
+            saveHandToggle.ControlEvent += (s, a) => saveHandMode = !saveHandMode;
 
-            this.handPresetPane = AddPane(new HandPresetPane(meidoManager));
-            this.saveHandPane = AddPane(new SaveHandPane(meidoManager));
+            handPresetPane = AddPane(new HandPresetPane(meidoManager));
+            saveHandPane = AddPane(new SaveHandPane(meidoManager));
 
-            this.flipButton = new Button(Translation.Get("flipIK", "flipButton"));
-            this.flipButton.ControlEvent += (s, a) => this.meidoManager.ActiveMeido.IKManager.Flip();
+            flipButton = new Button(Translation.Get("flipIK", "flipButton"));
+            flipButton.ControlEvent += (s, a) => this.meidoManager.ActiveMeido.IKManager.Flip();
 
-            this.handPresetHeader = Translation.Get("handPane", "header");
-            this.flipIKHeader = Translation.Get("flipIK", "header");
+            handPresetHeader = Translation.Get("handPane", "header");
+            flipIKHeader = Translation.Get("flipIK", "header");
         }
 
         protected override void ReloadTranslation()
         {
-            this.freeLookToggle.Label = Translation.Get("freeLookPane", "freeLookToggle");
-            this.savePoseToggle.Label = Translation.Get("posePane", "saveToggle");
-            this.saveHandToggle.Label = Translation.Get("handPane", "saveToggle");
-            this.flipButton.Label = Translation.Get("flipIK", "flipButton");
-            this.handPresetHeader = Translation.Get("handPane", "header");
+            freeLookToggle.Label = Translation.Get("freeLookPane", "freeLookToggle");
+            savePoseToggle.Label = Translation.Get("posePane", "saveToggle");
+            saveHandToggle.Label = Translation.Get("handPane", "saveToggle");
+            flipButton.Label = Translation.Get("flipIK", "flipButton");
+            handPresetHeader = Translation.Get("handPane", "header");
+            flipIKHeader = Translation.Get("flipIK", "header");
         }
 
         public override void Draw()
         {
-            this.tabsPane.Draw();
-            this.maidSwitcherPane.Draw();
+            tabsPane.Draw();
+
+            maidSwitcherPane.Draw();
             maidPosePane.Draw();
 
-            this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
+            scrollPos = GUILayout.BeginScrollView(scrollPos);
 
-            GUI.enabled = this.meidoManager.HasActiveMeido;
+            GUI.enabled = meidoManager.HasActiveMeido;
             GUILayout.BeginHorizontal();
             freeLookToggle.Draw();
             savePoseToggle.Draw();
@@ -102,10 +104,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             MiscGUI.WhiteLine();
 
-            this.gravityControlPane.Draw();
+            gravityControlPane.Draw();
 
-            GUI.enabled = this.meidoManager.HasActiveMeido;
-            MiscGUI.Header(this.handPresetHeader);
+            GUI.enabled = meidoManager.HasActiveMeido;
+            MiscGUI.Header(handPresetHeader);
             MiscGUI.WhiteLine();
             saveHandToggle.Draw();
             GUI.enabled = true;
@@ -116,8 +118,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             copyPosePane.Draw();
 
             GUILayout.BeginHorizontal();
-            GUI.enabled = this.meidoManager.HasActiveMeido;
-            GUILayout.Label(this.flipIKHeader, GUILayout.ExpandWidth(false));
+            GUI.enabled = meidoManager.HasActiveMeido;
+            GUILayout.Label(flipIKHeader, GUILayout.ExpandWidth(false));
             flipButton.Draw(GUILayout.ExpandWidth(false));
             GUI.enabled = true;
             GUILayout.EndHorizontal();
@@ -127,19 +129,19 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void SetMaidFreeLook()
         {
-            if (this.updating) return;
-            this.meidoManager.ActiveMeido.FreeLook = this.freeLookToggle.Value;
+            if (updating) return;
+            meidoManager.ActiveMeido.FreeLook = freeLookToggle.Value;
         }
 
         public override void UpdatePanes()
         {
-            if (this.meidoManager.ActiveMeido == null) return;
+            if (meidoManager.ActiveMeido == null) return;
 
             if (ActiveWindow)
             {
-                this.updating = true;
-                this.freeLookToggle.Value = this.meidoManager.ActiveMeido?.FreeLook ?? false;
-                this.updating = false;
+                updating = true;
+                freeLookToggle.Value = meidoManager.ActiveMeido?.FreeLook ?? false;
+                updating = false;
                 base.UpdatePanes();
             }
         }

+ 4 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/MainWindowPanes/SettingsWindowPane.cs

@@ -7,14 +7,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SettingsWindowPane : BaseMainWindowPane
     {
-        private Button reloadTranslationButton;
-        private KeyRebindButton[] rebindButtons;
-        private static readonly string[] actionTranslationKeys;
-        private static readonly string[] actionLabels;
         private static readonly string[] headerTranslationKeys = {
             "controls", "controlsGeneral", "controlsMaids", "controlsCamera", "controlsDragPoint", "controlsScene"
         };
         private static readonly Dictionary<string, string> headers = new Dictionary<string, string>();
+        private static readonly string[] actionTranslationKeys;
+        private static readonly string[] actionLabels;
+        private readonly Button reloadTranslationButton;
+        private readonly KeyRebindButton[] rebindButtons;
 
         static SettingsWindowPane()
         {

+ 5 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/OtherPanes/MaidSwitcherPane.cs

@@ -4,10 +4,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MaidSwitcherPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Button PreviousButton;
-        private Button NextButton;
-        private int SelectedMeido => meidoManager.SelectedMeido;
+        private readonly MeidoManager meidoManager;
+        private readonly Button PreviousButton;
+        private readonly Button NextButton;
         public MaidSwitcherPane(MeidoManager meidoManager)
         {
             this.meidoManager = meidoManager;
@@ -58,9 +57,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             dir = (int)Mathf.Sign(dir);
             int selected = Utility.Wrap(
-                this.meidoManager.SelectedMeido + dir, 0, this.meidoManager.ActiveMeidoList.Count
+                meidoManager.SelectedMeido + dir, 0, meidoManager.ActiveMeidoList.Count
             );
-            this.meidoManager.ChangeMaid(selected);
+            meidoManager.ChangeMaid(selected);
         }
     }
 }

+ 2 - 4
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/OtherPanes/TabsPane.cs

@@ -5,17 +5,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class TabsPane : BasePane
     {
-        private SelectionGrid Tabs;
+        private static readonly string[] tabNames = { "call", "pose", "face", "bg", "bg2" };
+        private readonly SelectionGrid Tabs;
         private Constants.Window selectedTab;
         public Constants.Window SelectedTab
         {
             get => selectedTab;
             set => Tabs.SelectedItemIndex = (int)value;
-
         }
         public event EventHandler TabChange;
-        private new bool updating;
-        private readonly string[] tabNames = { "call", "pose", "face", "bg", "bg2" };
 
         public TabsPane()
         {

+ 25 - 28
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/CopyPosePane.cs

@@ -6,15 +6,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class CopyPosePane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Button copyButton;
-        private Dropdown meidoDropdown;
+        private readonly MeidoManager meidoManager;
+        private readonly Button copyButton;
+        private readonly Dropdown meidoDropdown;
         private int[] copyMeidoSlot;
-        private bool PlentyOfMaids => this.meidoManager.ActiveMeidoList.Count >= 2;
+        private bool PlentyOfMaids => meidoManager.ActiveMeidoList.Count >= 2;
         private Meido FromMeido
         {
-            get => this.meidoManager.HasActiveMeido
-                ? this.meidoManager.ActiveMeidoList[this.copyMeidoSlot[this.meidoDropdown.SelectedItemIndex]]
+            get => meidoManager.HasActiveMeido
+                ? meidoManager.ActiveMeidoList[copyMeidoSlot[meidoDropdown.SelectedItemIndex]]
                 : null;
         }
         private string copyIKHeader;
@@ -23,64 +23,61 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.meidoManager = meidoManager;
 
-            this.meidoDropdown = new Dropdown(new[] { Translation.Get("systemMessage", "noMaids") });
+            meidoDropdown = new Dropdown(new[] { Translation.Get("systemMessage", "noMaids") });
 
-            this.copyButton = new Button(Translation.Get("copyPosePane", "copyButton"));
-            this.copyButton.ControlEvent += (s, a) => CopyPose();
+            copyButton = new Button(Translation.Get("copyPosePane", "copyButton"));
+            copyButton.ControlEvent += (s, a) => CopyPose();
 
-            this.copyIKHeader = Translation.Get("copyPosePane", "header");
+            copyIKHeader = Translation.Get("copyPosePane", "header");
         }
 
         protected override void ReloadTranslation()
         {
             if (!PlentyOfMaids)
             {
-                this.meidoDropdown.SetDropdownItem(0, Translation.Get("systemMessage", "noMaids"));
+                meidoDropdown.SetDropdownItem(0, Translation.Get("systemMessage", "noMaids"));
             }
-            this.copyButton.Label = Translation.Get("copyPosePane", "copyButton");
-            this.copyIKHeader = Translation.Get("copyPosePane", "header");
+            copyButton.Label = Translation.Get("copyPosePane", "copyButton");
+            copyIKHeader = Translation.Get("copyPosePane", "header");
         }
 
         public override void Draw()
         {
             GUI.enabled = PlentyOfMaids;
+
             MiscGUI.Header(copyIKHeader);
             MiscGUI.WhiteLine();
+
             GUILayout.BeginHorizontal();
-            this.meidoDropdown.Draw(GUILayout.Width(160f));
-            this.copyButton.Draw(GUILayout.ExpandWidth(false));
+            meidoDropdown.Draw(GUILayout.Width(160f));
+            copyButton.Draw(GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
+
             GUI.enabled = true;
         }
 
-        public override void UpdatePane()
-        {
-            SetMeidoDropdown();
-        }
+        public override void UpdatePane() => SetMeidoDropdown();
 
         private void CopyPose()
         {
-            if (this.meidoManager.ActiveMeidoList.Count >= 2)
-            {
-                this.meidoManager.ActiveMeido.CopyPose(FromMeido);
-            }
+            if (meidoManager.ActiveMeidoList.Count >= 2) meidoManager.ActiveMeido.CopyPose(FromMeido);
         }
 
         private void SetMeidoDropdown()
         {
-            if (this.meidoManager.ActiveMeidoList.Count >= 2)
+            if (meidoManager.ActiveMeidoList.Count >= 2)
             {
-                IEnumerable<Meido> copyMeidoList = this.meidoManager.ActiveMeidoList
-                    .Where(meido => meido.Slot != this.meidoManager.ActiveMeido.Slot);
+                IEnumerable<Meido> copyMeidoList = meidoManager.ActiveMeidoList
+                    .Where(meido => meido.Slot != meidoManager.ActiveMeido.Slot);
 
                 copyMeidoSlot = copyMeidoList.Select(meido => meido.Slot).ToArray();
 
                 string[] dropdownList = copyMeidoList
                     .Select((meido, i) => $"{copyMeidoSlot[i] + 1}: {meido.LastName} {meido.FirstName}").ToArray();
 
-                this.meidoDropdown.SetDropdownItems(dropdownList, 0);
+                meidoDropdown.SetDropdownItems(dropdownList, 0);
             }
-            else this.meidoDropdown.SetDropdownItems(new[] { Translation.Get("systemMessage", "noMaids") });
+            else meidoDropdown.SetDropdownItems(new[] { Translation.Get("systemMessage", "noMaids") });
         }
     }
 }

+ 14 - 14
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/GravityControlPane.cs

@@ -5,10 +5,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class GravityControlPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Toggle hairToggle;
-        private Toggle skirtToggle;
-        private Toggle globalToggle;
+        private readonly MeidoManager meidoManager;
+        private readonly Toggle hairToggle;
+        private readonly Toggle skirtToggle;
+        private readonly Toggle globalToggle;
 
         public GravityControlPane(MeidoManager meidoManager)
         {
@@ -26,10 +26,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw()
         {
-            bool enabled = this.meidoManager.HasActiveMeido;
+            bool enabled = meidoManager.HasActiveMeido;
             GUI.enabled = enabled;
 
-            Meido meido = this.meidoManager.ActiveMeido;
+            Meido meido = meidoManager.ActiveMeido;
             GUILayout.BeginHorizontal();
 
             GUI.enabled = enabled && meido.HairGravityValid;
@@ -48,25 +48,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void UpdatePane()
         {
-            if (!this.meidoManager.HasActiveMeido) return;
+            if (!meidoManager.HasActiveMeido) return;
 
             Meido meido = meidoManager.ActiveMeido;
 
-            this.updating = true;
+            updating = true;
 
             hairToggle.Value = meido.HairGravityActive;
             skirtToggle.Value = meido.SkirtGravityActive;
 
-            this.updating = false;
+            updating = false;
         }
 
         private void ToggleGravity(bool value, bool skirt = false)
         {
             if (updating) return;
 
-            if (this.meidoManager.GlobalGravity)
+            if (meidoManager.GlobalGravity)
             {
-                foreach (Meido meido in this.meidoManager.ActiveMeidoList)
+                foreach (Meido meido in meidoManager.ActiveMeidoList)
                 {
                     if (skirt) meido.SkirtGravityActive = value;
                     else meido.HairGravityActive = value;
@@ -74,11 +74,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
             else
             {
-                if (skirt) this.meidoManager.ActiveMeido.SkirtGravityActive = value;
-                else this.meidoManager.ActiveMeido.HairGravityActive = value;
+                if (skirt) meidoManager.ActiveMeido.SkirtGravityActive = value;
+                else meidoManager.ActiveMeido.HairGravityActive = value;
             }
         }
 
-        private void SetGlobalGravity(bool value) => this.meidoManager.GlobalGravity = value;
+        private void SetGlobalGravity(bool value) => meidoManager.GlobalGravity = value;
     }
 }

+ 47 - 53
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/HandPresetPane.cs

@@ -1,4 +1,3 @@
-using System;
 using System.IO;
 using System.Collections.Generic;
 using System.Linq;
@@ -8,15 +7,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class HandPresetPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Dropdown presetCategoryDropdown;
-        private Button nextCategoryButton;
-        private Button previousCategoryButton;
-        private Dropdown presetDropdown;
-        private Button nextPresetButton;
-        private Button previousPresetButton;
-        private Button leftHandButton;
-        private Button rightHandButton;
+        private readonly MeidoManager meidoManager;
+        private readonly Dropdown presetCategoryDropdown;
+        private readonly Button nextCategoryButton;
+        private readonly Button previousCategoryButton;
+        private readonly Dropdown presetDropdown;
+        private readonly Button nextPresetButton;
+        private readonly Button previousPresetButton;
+        private readonly Button leftHandButton;
+        private readonly Button rightHandButton;
         private string SelectedCategory => Constants.CustomHandGroupList[presetCategoryDropdown.SelectedItemIndex];
         private List<string> CurrentPresetList => Constants.CustomHandDict[SelectedCategory];
         private string CurrentPreset => CurrentPresetList[presetDropdown.SelectedItemIndex];
@@ -25,44 +24,41 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public HandPresetPane(MeidoManager meidoManager)
         {
-            Constants.customHandChange += SaveHandEnd;
+            Constants.CustomHandChange += SaveHandEnd;
             this.meidoManager = meidoManager;
 
-            this.presetCategoryDropdown = new Dropdown(Constants.CustomHandGroupList.ToArray());
-            this.presetCategoryDropdown.SelectionChange += (s, a) => ChangePresetCategory();
+            presetCategoryDropdown = new Dropdown(Constants.CustomHandGroupList.ToArray());
+            presetCategoryDropdown.SelectionChange += (s, a) => ChangePresetCategory();
 
-            this.nextCategoryButton = new Button(">");
-            this.nextCategoryButton.ControlEvent += (s, a) => this.presetCategoryDropdown.Step(1);
+            nextCategoryButton = new Button(">");
+            nextCategoryButton.ControlEvent += (s, a) => presetCategoryDropdown.Step(1);
 
-            this.previousCategoryButton = new Button("<");
-            this.previousCategoryButton.ControlEvent += (s, a) =>
-            {
-                this.presetCategoryDropdown.Step(-1);
-            };
+            previousCategoryButton = new Button("<");
+            previousCategoryButton.ControlEvent += (s, a) => presetCategoryDropdown.Step(-1);
 
-            this.presetDropdown = new Dropdown(UIPresetList());
+            presetDropdown = new Dropdown(UIPresetList());
 
-            this.nextPresetButton = new Button(">");
-            this.nextPresetButton.ControlEvent += (s, a) => this.presetDropdown.Step(1);
+            nextPresetButton = new Button(">");
+            nextPresetButton.ControlEvent += (s, a) => presetDropdown.Step(1);
 
-            this.previousPresetButton = new Button("<");
-            this.previousPresetButton.ControlEvent += (s, a) => this.presetDropdown.Step(-1);
+            previousPresetButton = new Button("<");
+            previousPresetButton.ControlEvent += (s, a) => presetDropdown.Step(-1);
 
-            this.leftHandButton = new Button(Translation.Get("handPane", "leftHand"));
-            this.leftHandButton.ControlEvent += (s, a) => SetHandPreset(right: false);
+            leftHandButton = new Button(Translation.Get("handPane", "leftHand"));
+            leftHandButton.ControlEvent += (s, a) => SetHandPreset(right: false);
 
-            this.rightHandButton = new Button(Translation.Get("handPane", "rightHand"));
-            this.rightHandButton.ControlEvent += (s, a) => SetHandPreset(right: true);
+            rightHandButton = new Button(Translation.Get("handPane", "rightHand"));
+            rightHandButton.ControlEvent += (s, a) => SetHandPreset(right: true);
 
-            this.previousCategory = SelectedCategory;
-            this.presetListEnabled = CurrentPresetList.Count > 0;
+            previousCategory = SelectedCategory;
+            presetListEnabled = CurrentPresetList.Count > 0;
         }
 
         protected override void ReloadTranslation()
         {
-            this.leftHandButton.Label = Translation.Get("handPane", "leftHand");
-            this.rightHandButton.Label = Translation.Get("handPane", "rightHand");
-            if (CurrentPresetList.Count == 0) this.presetDropdown.SetDropdownItems(UIPresetList());
+            leftHandButton.Label = Translation.Get("handPane", "leftHand");
+            rightHandButton.Label = Translation.Get("handPane", "rightHand");
+            if (CurrentPresetList.Count == 0) presetDropdown.SetDropdownItems(UIPresetList());
         }
 
         public override void Draw()
@@ -70,25 +66,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayoutOption dropdownWidth = GUILayout.Width(156f);
             GUILayoutOption noExpandWidth = GUILayout.ExpandWidth(false);
 
-            GUI.enabled = this.meidoManager.HasActiveMeido;
+            GUI.enabled = meidoManager.HasActiveMeido;
 
             GUILayout.BeginHorizontal();
-            this.presetCategoryDropdown.Draw(dropdownWidth);
-            this.previousCategoryButton.Draw(noExpandWidth);
-            this.nextCategoryButton.Draw(noExpandWidth);
+            presetCategoryDropdown.Draw(dropdownWidth);
+            previousCategoryButton.Draw(noExpandWidth);
+            nextCategoryButton.Draw(noExpandWidth);
             GUILayout.EndHorizontal();
 
             GUI.enabled = GUI.enabled && presetListEnabled;
 
             GUILayout.BeginHorizontal();
-            this.presetDropdown.Draw(dropdownWidth);
-            this.previousPresetButton.Draw(noExpandWidth);
-            this.nextPresetButton.Draw(noExpandWidth);
+            presetDropdown.Draw(dropdownWidth);
+            previousPresetButton.Draw(noExpandWidth);
+            nextPresetButton.Draw(noExpandWidth);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.rightHandButton.Draw();
-            this.leftHandButton.Draw();
+            rightHandButton.Draw();
+            leftHandButton.Draw();
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;
@@ -97,14 +93,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private void ChangePresetCategory()
         {
             presetListEnabled = CurrentPresetList.Count > 0;
-            if (previousCategory == SelectedCategory)
-            {
-                this.presetDropdown.SelectedItemIndex = 0;
-            }
+            if (previousCategory == SelectedCategory) presetDropdown.SelectedItemIndex = 0;
             else
             {
                 previousCategory = SelectedCategory;
-                this.presetDropdown.SetDropdownItems(UIPresetList(), 0);
+                presetDropdown.SetDropdownItems(UIPresetList(), 0);
             }
         }
 
@@ -112,21 +105,22 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (!meidoManager.HasActiveMeido) return;
 
-            this.meidoManager.ActiveMeido.SetHandPreset(CurrentPreset, right);
+            meidoManager.ActiveMeido.SetHandPreset(CurrentPreset, right);
         }
 
         private void SaveHandEnd(object sender, CustomPoseEventArgs args)
         {
-            this.presetCategoryDropdown.SetDropdownItems(
+            presetCategoryDropdown.SetDropdownItems(
                 Constants.CustomHandGroupList.ToArray(), Constants.CustomHandGroupList.IndexOf(args.Category)
             );
-            this.presetDropdown.SetDropdownItems(UIPresetList(), CurrentPresetList.IndexOf(args.Path));
+            presetDropdown.SetDropdownItems(UIPresetList(), CurrentPresetList.IndexOf(args.Path));
         }
 
         private string[] UIPresetList()
         {
-            if (CurrentPresetList.Count == 0) return new[] { Translation.Get("handPane", "noPresetsMessage") };
-            else return CurrentPresetList.Select(file => Path.GetFileNameWithoutExtension(file)).ToArray();
+            return CurrentPresetList.Count == 0
+                ? new[] { Translation.Get("handPane", "noPresetsMessage") }
+                : CurrentPresetList.Select(file => Path.GetFileNameWithoutExtension(file)).ToArray();
         }
     }
 }

+ 26 - 31
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidDressingPane.cs

@@ -6,9 +6,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MaidDressingPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Dictionary<SlotID, Toggle> ClothingToggles;
-        private Dictionary<SlotID, bool> LoadedSlots;
         public static readonly SlotID[] clothingSlots = {
             // main slots
             SlotID.wear, SlotID.skirt, SlotID.bra, SlotID.panz, SlotID.headset, SlotID.megane,
@@ -17,7 +14,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             SlotID.accAshi, SlotID.accHana, SlotID.accHat, SlotID.accHeso, SlotID.accKamiSubL,
             SlotID.accKamiSubR, SlotID.accKami_1_, SlotID.accKami_2_, SlotID.accKami_3_, SlotID.accKubi,
             SlotID.accKubiwa, SlotID.accMiMiL, SlotID.accMiMiR, SlotID.accNipL, SlotID.accNipR,
-            SlotID.accShippo, SlotID.accXXX, 
+            SlotID.accShippo, SlotID.accXXX
             // unused slots
             // SlotID.mizugi, SlotID.onepiece, SlotID.accHead,
         };
@@ -33,11 +30,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             SlotID.headset, SlotID.accHat, SlotID.accKamiSubL,
             SlotID.accKamiSubR, SlotID.accKami_1_, SlotID.accKami_2_, SlotID.accKami_3_
         };
-
-        private Toggle detailedClothingToggle;
-        private Toggle curlingFrontToggle;
-        private Toggle curlingBackToggle;
-        private Toggle pantsuShiftToggle;
+        private readonly MeidoManager meidoManager;
+        private readonly Dictionary<SlotID, Toggle> ClothingToggles;
+        private readonly Dictionary<SlotID, bool> LoadedSlots;
+        private readonly Toggle detailedClothingToggle;
+        private readonly Toggle curlingFrontToggle;
+        private readonly Toggle curlingBackToggle;
+        private readonly Toggle pantsuShiftToggle;
         private bool detailedClothing = false;
 
         public MaidDressingPane(MeidoManager meidoManager)
@@ -78,10 +77,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                         ? Translation.Get("clothing", "headset")
                         : Translation.Get("clothing", "headwear");
                 }
-                else
-                {
-                    clothingToggle.Label = Translation.Get("clothing", slot.ToString());
-                }
+                else clothingToggle.Label = Translation.Get("clothing", slot.ToString());
             }
 
             detailedClothingToggle.Label = Translation.Get("clothing", "detail");
@@ -92,25 +88,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void ToggleClothing(SlotID slot, bool enabled)
         {
-            if (this.updating) return;
+            if (updating) return;
 
             if (slot == SlotID.body)
             {
-                this.meidoManager.ActiveMeido.SetBodyMask(enabled);
+                meidoManager.ActiveMeido.SetBodyMask(enabled);
                 return;
             }
 
-            TBody body = this.meidoManager.ActiveMeido.Maid.body0;
+            TBody body = meidoManager.ActiveMeido.Maid.body0;
 
             if (!detailedClothing && slot == SlotID.headset)
             {
-                this.updating = true;
+                updating = true;
                 foreach (SlotID wearSlot in headwearSlots)
                 {
                     body.SetMask(wearSlot, enabled);
                     ClothingToggles[wearSlot].Value = enabled;
                 }
-                this.updating = false;
+                updating = false;
             }
             else
             {
@@ -134,11 +130,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (updating) return;
 
-            this.meidoManager.ActiveMeido.SetCurling(curl, enabled);
+            meidoManager.ActiveMeido.SetCurling(curl, enabled);
 
             if (enabled)
             {
-                this.updating = true;
+                updating = true;
                 if (curl == Meido.Curl.front && curlingBackToggle.Value)
                 {
                     curlingBackToggle.Value = false;
@@ -147,17 +143,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 {
                     curlingFrontToggle.Value = false;
                 }
-                this.updating = false;
+                updating = false;
             }
         }
 
         public override void UpdatePane()
         {
-            if (!this.meidoManager.HasActiveMeido) return;
+            if (!meidoManager.HasActiveMeido) return;
 
-            this.updating = true;
+            updating = true;
 
-            Meido meido = this.meidoManager.ActiveMeido;
+            Meido meido = meidoManager.ActiveMeido;
             TBody body = meido.Maid.body0;
             foreach (SlotID clothingSlot in clothingSlots)
             {
@@ -192,7 +188,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     hasSlot = body.GetSlotLoaded(clothingSlot);
                 }
 
-                ClothingToggles[clothingSlot].Value = hasSlot ? toggleValue : false;
+                ClothingToggles[clothingSlot].Value = hasSlot && toggleValue;
                 LoadedSlots[clothingSlot] = hasSlot;
             }
 
@@ -200,7 +196,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             curlingBackToggle.Value = meido.CurlingBack;
             pantsuShiftToggle.Value = meido.PantsuShift;
 
-            this.updating = false;
+            updating = false;
         }
 
         private void DrawSlotGroup(params SlotID[] slots)
@@ -209,8 +205,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             for (int i = 0; i < slots.Length; i++)
             {
                 SlotID slot = slots[i];
-                if (!this.Enabled) GUI.enabled = false;
-                else GUI.enabled = LoadedSlots[slot];
+                GUI.enabled = Enabled && LoadedSlots[slot];
                 ClothingToggles[slot].Draw();
                 if (i < slots.Length - 1) GUILayout.FlexibleSpace();
             }
@@ -228,9 +223,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw()
         {
-            this.Enabled = this.meidoManager.HasActiveMeido;
+            Enabled = meidoManager.HasActiveMeido;
 
-            GUI.enabled = this.Enabled;
+            GUI.enabled = Enabled;
             detailedClothingToggle.Draw();
             MiscGUI.BlackLine();
 
@@ -252,7 +247,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 DrawSlotGroup(SlotID.accHeso, SlotID.accAshi, SlotID.accXXX);
             }
 
-            GUI.enabled = this.Enabled;
+            GUI.enabled = Enabled;
 
             GUILayout.BeginHorizontal();
             curlingFrontToggle.Draw();

+ 35 - 35
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidFreeLookPane.cs

@@ -4,41 +4,41 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MaidFaceLookPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Slider lookXSlider;
-        private Slider lookYSlider;
-        private Toggle headToCamToggle;
-        private Toggle eyeToCamToggle;
+        private readonly MeidoManager meidoManager;
+        private readonly Slider lookXSlider;
+        private readonly Slider lookYSlider;
+        private readonly Toggle headToCamToggle;
+        private readonly Toggle eyeToCamToggle;
 
         public MaidFaceLookPane(MeidoManager meidoManager)
         {
             this.meidoManager = meidoManager;
-            this.lookXSlider = new Slider(Translation.Get("freeLookPane", "xSlider"), -0.6f, 0.6f);
-            this.lookXSlider.ControlEvent += (s, a) => SetMaidLook();
+            lookXSlider = new Slider(Translation.Get("freeLookPane", "xSlider"), -0.6f, 0.6f);
+            lookXSlider.ControlEvent += (s, a) => SetMaidLook();
 
-            this.lookYSlider = new Slider(Translation.Get("freeLookPane", "ySlider"), 0.5f, -0.55f);
-            this.lookYSlider.ControlEvent += (s, a) => SetMaidLook();
+            lookYSlider = new Slider(Translation.Get("freeLookPane", "ySlider"), 0.5f, -0.55f);
+            lookYSlider.ControlEvent += (s, a) => SetMaidLook();
 
-            this.headToCamToggle = new Toggle(Translation.Get("freeLookPane", "headToCamToggle"));
-            this.headToCamToggle.ControlEvent += (s, a) => SetHeadToCam(headToCamToggle.Value, eye: false);
+            headToCamToggle = new Toggle(Translation.Get("freeLookPane", "headToCamToggle"));
+            headToCamToggle.ControlEvent += (s, a) => SetHeadToCam(headToCamToggle.Value, eye: false);
 
-            this.eyeToCamToggle = new Toggle(Translation.Get("freeLookPane", "eyeToCamToggle"));
-            this.eyeToCamToggle.ControlEvent += (s, a) => SetHeadToCam(eyeToCamToggle.Value, eye: true);
+            eyeToCamToggle = new Toggle(Translation.Get("freeLookPane", "eyeToCamToggle"));
+            eyeToCamToggle.ControlEvent += (s, a) => SetHeadToCam(eyeToCamToggle.Value, eye: true);
         }
 
         protected override void ReloadTranslation()
         {
-            this.lookXSlider.Label = Translation.Get("freeLookPane", "xSlider");
-            this.lookYSlider.Label = Translation.Get("freeLookPane", "ySlider");
-            this.headToCamToggle.Label = Translation.Get("freeLookPane", "headToCamToggle");
-            this.eyeToCamToggle.Label = Translation.Get("freeLookPane", "eyeToCamToggle");
+            lookXSlider.Label = Translation.Get("freeLookPane", "xSlider");
+            lookYSlider.Label = Translation.Get("freeLookPane", "ySlider");
+            headToCamToggle.Label = Translation.Get("freeLookPane", "headToCamToggle");
+            eyeToCamToggle.Label = Translation.Get("freeLookPane", "eyeToCamToggle");
         }
 
         public void SetHeadToCam(bool value, bool eye = false)
         {
             if (updating) return;
 
-            Meido meido = this.meidoManager.ActiveMeido;
+            Meido meido = meidoManager.ActiveMeido;
 
             if (eye) meido.EyeToCam = value;
             else meido.HeadToCam = value;
@@ -48,7 +48,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (updating) return;
 
-            TBody body = this.meidoManager.ActiveMeido.Body;
+            TBody body = meidoManager.ActiveMeido.Body;
             body.offsetLookTarget = new Vector3(lookYSlider.Value, 1f, lookXSlider.Value);
         }
 
@@ -56,39 +56,39 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             float left = 0.5f;
             float right = -0.55f;
-            if (this.meidoManager.ActiveMeido.Stop)
+            if (meidoManager.ActiveMeido.Stop)
             {
                 left *= 0.6f;
                 right *= 0.6f;
             }
-            this.lookYSlider.SetBounds(left, right);
+            lookYSlider.SetBounds(left, right);
         }
 
         public override void UpdatePane()
         {
-            Meido meido = this.meidoManager.ActiveMeido;
-            this.updating = true;
-            this.SetBounds();
-            this.lookXSlider.Value = meido.Body.offsetLookTarget.z;
-            this.lookYSlider.Value = meido.Body.offsetLookTarget.x;
-            this.eyeToCamToggle.Value = meido.EyeToCam;
-            this.headToCamToggle.Value = meido.HeadToCam;
-            this.updating = false;
+            Meido meido = meidoManager.ActiveMeido;
+            updating = true;
+            SetBounds();
+            lookXSlider.Value = meido.Body.offsetLookTarget.z;
+            lookYSlider.Value = meido.Body.offsetLookTarget.x;
+            eyeToCamToggle.Value = meido.EyeToCam;
+            headToCamToggle.Value = meido.HeadToCam;
+            updating = false;
         }
 
         public override void Draw()
         {
-            GUI.enabled = this.meidoManager.HasActiveMeido && this.meidoManager.ActiveMeido.FreeLook;
+            GUI.enabled = meidoManager.HasActiveMeido && meidoManager.ActiveMeido.FreeLook;
             GUILayout.BeginHorizontal();
-            this.lookXSlider.Draw();
-            this.lookYSlider.Draw();
+            lookXSlider.Draw();
+            lookYSlider.Draw();
             GUILayout.EndHorizontal();
 
-            GUI.enabled = this.meidoManager.HasActiveMeido;
+            GUI.enabled = meidoManager.HasActiveMeido;
 
             GUILayout.BeginHorizontal();
-            this.eyeToCamToggle.Draw();
-            this.headToCamToggle.Draw();
+            eyeToCamToggle.Draw();
+            headToCamToggle.Draw();
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;

+ 27 - 27
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MaidIKPane.cs

@@ -4,10 +4,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MaidIKPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Toggle ikToggle;
-        private Toggle releaseIKToggle;
-        private Toggle boneIKToggle;
+        private readonly MeidoManager meidoManager;
+        private readonly Toggle ikToggle;
+        private readonly Toggle releaseIKToggle;
+        private readonly Toggle boneIKToggle;
         private enum IKToggle
         {
             IK, Release, Bone
@@ -17,53 +17,53 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             this.meidoManager = meidoManager;
 
-            this.ikToggle = new Toggle(Translation.Get("maidPoseWindow", "ikToggle"), true);
-            this.ikToggle.ControlEvent += (s, a) => SetIK(IKToggle.IK, this.ikToggle.Value);
+            ikToggle = new Toggle(Translation.Get("maidPoseWindow", "ikToggle"), true);
+            ikToggle.ControlEvent += (s, a) => SetIK(IKToggle.IK, ikToggle.Value);
 
-            this.releaseIKToggle = new Toggle(Translation.Get("maidPoseWindow", "releaseToggle"));
-            this.releaseIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Release, this.releaseIKToggle.Value);
+            releaseIKToggle = new Toggle(Translation.Get("maidPoseWindow", "releaseToggle"));
+            releaseIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Release, releaseIKToggle.Value);
 
-            this.boneIKToggle = new Toggle(Translation.Get("maidPoseWindow", "boneToggle"));
-            this.boneIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Bone, this.boneIKToggle.Value);
+            boneIKToggle = new Toggle(Translation.Get("maidPoseWindow", "boneToggle"));
+            boneIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Bone, boneIKToggle.Value);
         }
 
         protected override void ReloadTranslation()
         {
-            this.ikToggle.Label = Translation.Get("maidPoseWindow", "ikToggle");
-            this.releaseIKToggle.Label = Translation.Get("maidPoseWindow", "releaseToggle");
-            this.boneIKToggle.Label = Translation.Get("maidPoseWindow", "boneToggle");
+            ikToggle.Label = Translation.Get("maidPoseWindow", "ikToggle");
+            releaseIKToggle.Label = Translation.Get("maidPoseWindow", "releaseToggle");
+            boneIKToggle.Label = Translation.Get("maidPoseWindow", "boneToggle");
         }
 
         private void SetIK(IKToggle toggle, bool value)
         {
             if (updating) return;
-            if (toggle == IKToggle.IK) this.meidoManager.ActiveMeido.IK = value;
-            else if (toggle == IKToggle.Release) this.meidoManager.ActiveMeido.Stop = false;
-            else if (toggle == IKToggle.Bone) this.meidoManager.ActiveMeido.Bone = value;
+            if (toggle == IKToggle.IK) meidoManager.ActiveMeido.IK = value;
+            else if (toggle == IKToggle.Release) meidoManager.ActiveMeido.Stop = false;
+            else if (toggle == IKToggle.Bone) meidoManager.ActiveMeido.Bone = value;
         }
 
         public override void UpdatePane()
         {
-            this.updating = true;
-            this.ikToggle.Value = this.meidoManager.ActiveMeido.IK;
-            this.releaseIKToggle.Value = this.meidoManager.ActiveMeido.Stop;
-            this.boneIKToggle.Value = this.meidoManager.ActiveMeido.Bone;
-            this.updating = false;
+            updating = true;
+            ikToggle.Value = meidoManager.ActiveMeido.IK;
+            releaseIKToggle.Value = meidoManager.ActiveMeido.Stop;
+            boneIKToggle.Value = meidoManager.ActiveMeido.Bone;
+            updating = false;
         }
 
         public override void Draw()
         {
-            bool active = this.meidoManager.HasActiveMeido;
+            bool active = meidoManager.HasActiveMeido;
 
             GUILayout.BeginHorizontal();
             GUI.enabled = active;
-            this.ikToggle.Draw();
+            ikToggle.Draw();
 
-            GUI.enabled = active ? this.meidoManager.ActiveMeido.Stop : false;
-            this.releaseIKToggle.Draw();
+            GUI.enabled = active && meidoManager.ActiveMeido.Stop;
+            releaseIKToggle.Draw();
 
-            GUI.enabled = active ? this.ikToggle.Value : false;
-            this.boneIKToggle.Draw();
+            GUI.enabled = active && ikToggle.Value;
+            boneIKToggle.Draw();
             GUILayout.EndHorizontal();
             GUI.enabled = true;
         }

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

@@ -8,16 +8,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MaidPoseSelectorPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Button poseLeftButton;
-        private Button poseRightButton;
-        private Button poseGroupLeftButton;
-        private Button poseGroupRightButton;
-        private Dropdown poseGroupDropdown;
-        private Dropdown poseDropdown;
-        private SelectionGrid poseModeGrid;
-        private bool customPoseMode;
-        private bool poseListEnabled;
+        private static readonly string[] tabTranslations = new[] { "baseTab", "customTab" };
+        private readonly MeidoManager meidoManager;
+        private readonly Button poseLeftButton;
+        private readonly Button poseRightButton;
+        private readonly Button poseGroupLeftButton;
+        private readonly Button poseGroupRightButton;
+        private readonly Dropdown poseGroupDropdown;
+        private readonly Dropdown poseDropdown;
+        private readonly SelectionGrid poseModeGrid;
         private Dictionary<string, List<string>> CurrentPoseDict
         {
             get => customPoseMode ? Constants.CustomPoseDict : Constants.PoseDict;
@@ -31,84 +30,84 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private int SelectedPoseIndex => poseDropdown.SelectedItemIndex;
         private string SelectedPose => CurrentPoseList[SelectedPoseIndex];
         private PoseInfo CurrentPoseInfo => new PoseInfo(SelectedPoseGroup, SelectedPose, customPoseMode);
+        private bool customPoseMode;
+        private bool poseListEnabled;
         private string previousPoseGroup;
-        private static readonly string[] tabTranslations = new[] { "baseTab", "customTab" };
 
         public MaidPoseSelectorPane(MeidoManager meidoManager)
         {
-            Constants.customPoseChange += SavePoseEnd;
+            Constants.CustomPoseChange += SavePoseEnd;
             this.meidoManager = meidoManager;
 
-            this.poseModeGrid = new SelectionGrid(Translation.GetArray("posePane", tabTranslations));
-            this.poseModeGrid.ControlEvent += (s, a) => SetPoseMode();
+            poseModeGrid = new SelectionGrid(Translation.GetArray("posePane", tabTranslations));
+            poseModeGrid.ControlEvent += (s, a) => SetPoseMode();
 
-            this.poseGroupDropdown = new Dropdown(Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList));
-            this.poseGroupDropdown.SelectionChange += (s, a) => ChangePoseGroup();
+            poseGroupDropdown = new Dropdown(Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList));
+            poseGroupDropdown.SelectionChange += (s, a) => ChangePoseGroup();
 
-            this.poseDropdown = new Dropdown(UIPoseList());
-            this.poseDropdown.SelectionChange += (s, a) => ChangePose();
+            poseDropdown = new Dropdown(UIPoseList());
+            poseDropdown.SelectionChange += (s, a) => ChangePose();
 
-            this.poseGroupLeftButton = new Button("<");
-            this.poseGroupLeftButton.ControlEvent += (s, a) => poseGroupDropdown.Step(-1);
+            poseGroupLeftButton = new Button("<");
+            poseGroupLeftButton.ControlEvent += (s, a) => poseGroupDropdown.Step(-1);
 
-            this.poseGroupRightButton = new Button(">");
-            this.poseGroupRightButton.ControlEvent += (s, a) => poseGroupDropdown.Step(1);
+            poseGroupRightButton = new Button(">");
+            poseGroupRightButton.ControlEvent += (s, a) => poseGroupDropdown.Step(1);
 
-            this.poseLeftButton = new Button("<");
-            this.poseLeftButton.ControlEvent += (s, a) => poseDropdown.Step(-1);
+            poseLeftButton = new Button("<");
+            poseLeftButton.ControlEvent += (s, a) => poseDropdown.Step(-1);
 
-            this.poseRightButton = new Button(">");
-            this.poseRightButton.ControlEvent += (s, a) => poseDropdown.Step(1);
+            poseRightButton = new Button(">");
+            poseRightButton.ControlEvent += (s, a) => poseDropdown.Step(1);
 
-            this.customPoseMode = poseModeGrid.SelectedItemIndex == 1;
-            this.previousPoseGroup = SelectedPoseGroup;
-            this.poseListEnabled = CurrentPoseList.Count > 0;
+            customPoseMode = poseModeGrid.SelectedItemIndex == 1;
+            previousPoseGroup = SelectedPoseGroup;
+            poseListEnabled = CurrentPoseList.Count > 0;
         }
 
         protected override void ReloadTranslation()
         {
-            this.updating = true;
-            this.poseModeGrid.SetItems(Translation.GetArray("posePane", tabTranslations));
+            updating = true;
+            poseModeGrid.SetItems(Translation.GetArray("posePane", tabTranslations));
             if (!customPoseMode)
             {
-                this.poseGroupDropdown.SetDropdownItems(
+                poseGroupDropdown.SetDropdownItems(
                     Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList)
                 );
             }
-            this.updating = false;
+            updating = false;
         }
 
         public override void Draw()
         {
-            float arrowButtonSize = 30f;
+            const float buttonHeight = 30f;
             GUILayoutOption[] arrowLayoutOptions = {
-                GUILayout.Width(arrowButtonSize),
-                GUILayout.Height(arrowButtonSize)
+                GUILayout.Width(buttonHeight),
+                GUILayout.Height(buttonHeight)
             };
 
-            float dropdownButtonHeight = arrowButtonSize;
-            float dropdownButtonWidth = 153f;
+            const float dropdownButtonWidth = 153f;
             GUILayoutOption[] dropdownLayoutOptions = new GUILayoutOption[] {
-                GUILayout.Height(dropdownButtonHeight),
+                GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth)
             };
 
             GUI.enabled = meidoManager.HasActiveMeido && !meidoManager.ActiveMeido.Stop;
 
-            this.poseModeGrid.Draw();
+            poseModeGrid.Draw();
             MiscGUI.WhiteLine();
 
             GUILayout.BeginHorizontal();
-            this.poseGroupLeftButton.Draw(arrowLayoutOptions);
-            this.poseGroupDropdown.Draw(dropdownLayoutOptions);
-            this.poseGroupRightButton.Draw(arrowLayoutOptions);
+            poseGroupLeftButton.Draw(arrowLayoutOptions);
+            poseGroupDropdown.Draw(dropdownLayoutOptions);
+            poseGroupRightButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
             GUI.enabled = GUI.enabled && poseListEnabled;
-            this.poseLeftButton.Draw(arrowLayoutOptions);
-            this.poseDropdown.Draw(dropdownLayoutOptions);
-            this.poseRightButton.Draw(arrowLayoutOptions);
+            poseLeftButton.Draw(arrowLayoutOptions);
+            poseDropdown.Draw(dropdownLayoutOptions);
+            poseRightButton.Draw(arrowLayoutOptions);
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;
@@ -116,9 +115,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void UpdatePane()
         {
-            this.updating = true;
+            updating = true;
 
-            PoseInfo poseInfo = this.meidoManager.ActiveMeido.CachedPose;
+            PoseInfo poseInfo = meidoManager.ActiveMeido.CachedPose;
 
             bool oldPoseMode = customPoseMode;
 
@@ -138,25 +137,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     ? CurrentPoseGroupList.ToArray()
                     : Translation.GetArray("poseGroupDropdown", CurrentPoseGroupList);
 
-                this.poseGroupDropdown.SetDropdownItems(list);
+                poseGroupDropdown.SetDropdownItems(list);
             }
 
-            this.poseGroupDropdown.SelectedItemIndex = poseGroupIndex;
-            this.poseDropdown.SelectedItemIndex = poseIndex;
+            poseGroupDropdown.SelectedItemIndex = poseGroupIndex;
+            poseDropdown.SelectedItemIndex = poseIndex;
 
-            this.updating = false;
+            updating = false;
         }
 
         private void SavePoseEnd(object sender, CustomPoseEventArgs args)
         {
-            this.updating = true;
-            this.poseModeGrid.SelectedItemIndex = 1;
-            this.poseGroupDropdown.SetDropdownItems(
+            updating = true;
+            poseModeGrid.SelectedItemIndex = 1;
+            poseGroupDropdown.SetDropdownItems(
                 CurrentPoseGroupList.ToArray(), CurrentPoseGroupList.IndexOf(args.Category)
             );
-            this.updating = false;
+            updating = false;
 
-            this.poseDropdown.SetDropdownItems(UIPoseList(), CurrentPoseDict[args.Category].IndexOf(args.Path));
+            poseDropdown.SetDropdownItems(UIPoseList(), CurrentPoseDict[args.Category].IndexOf(args.Path));
             poseListEnabled = true;
         }
 
@@ -164,25 +163,25 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             customPoseMode = poseModeGrid.SelectedItemIndex == 1;
 
-            if (this.updating) return;
+            if (updating) return;
 
             string[] list = customPoseMode
                 ? CurrentPoseGroupList.ToArray()
                 : Translation.GetArray("poseGroupDropdown", CurrentPoseGroupList);
 
-            this.poseGroupDropdown.SetDropdownItems(list, 0);
+            poseGroupDropdown.SetDropdownItems(list, 0);
         }
 
         private void ChangePoseGroup()
         {
             if (previousPoseGroup == SelectedPoseGroup)
             {
-                this.poseDropdown.SelectedItemIndex = 0;
+                poseDropdown.SelectedItemIndex = 0;
             }
             else
             {
                 previousPoseGroup = SelectedPoseGroup;
-                this.poseDropdown.SetDropdownItems(UIPoseList(), 0);
+                poseDropdown.SetDropdownItems(UIPoseList(), 0);
             }
         }
 
@@ -197,10 +196,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (CurrentPoseList.Count == 0) return new[] { "No Poses" };
             else
             {
-                return CurrentPoseList.Select((pose, i) =>
-                {
-                    return $"{i + 1}:{(customPoseMode ? Path.GetFileNameWithoutExtension(pose) : pose)}";
-                }).ToArray();
+                return CurrentPoseList
+                    .Select((pose, i) => $"{i + 1}:{(customPoseMode ? Path.GetFileNameWithoutExtension(pose) : pose)}")
+                    .ToArray();
             }
         }
     }

+ 34 - 34
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/MpnAttachPropPane.cs

@@ -6,65 +6,65 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MpnAttachPropPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Dropdown mpnAttachDropdown;
-        private Button previousPropButton;
-        private Button nextPropButton;
-        private Button attachPropButton;
-        private Button detachPropButton;
-        private Button detachAllButton;
+        private readonly MeidoManager meidoManager;
+        private readonly Dropdown mpnAttachDropdown;
+        private readonly Button previousPropButton;
+        private readonly Button nextPropButton;
+        private readonly Button attachPropButton;
+        private readonly Button detachPropButton;
+        private readonly Button detachAllButton;
 
         public MpnAttachPropPane(MeidoManager meidoManager)
         {
             this.meidoManager = meidoManager;
 
-            this.mpnAttachDropdown = new Dropdown(new[] { string.Empty });
+            mpnAttachDropdown = new Dropdown(new[] { string.Empty });
 
             if (!Constants.MpnAttachInitialized) Constants.MenuFilesChange += InitializeMpnAttach;
 
             SetDropdownList();
 
-            this.previousPropButton = new Button("<");
-            this.previousPropButton.ControlEvent += (s, a) => this.mpnAttachDropdown.Step(-1);
+            previousPropButton = new Button("<");
+            previousPropButton.ControlEvent += (s, a) => mpnAttachDropdown.Step(-1);
 
-            this.nextPropButton = new Button(">");
-            this.nextPropButton.ControlEvent += (s, a) => this.mpnAttachDropdown.Step(1);
+            nextPropButton = new Button(">");
+            nextPropButton.ControlEvent += (s, a) => mpnAttachDropdown.Step(1);
 
-            this.attachPropButton = new Button(Translation.Get("attachMpnPropPane", "attachButton"));
-            this.attachPropButton.ControlEvent += (s, a) => AttachProp();
+            attachPropButton = new Button(Translation.Get("attachMpnPropPane", "attachButton"));
+            attachPropButton.ControlEvent += (s, a) => AttachProp();
 
-            this.detachPropButton = new Button(Translation.Get("attachMpnPropPane", "detachButton"));
-            this.detachPropButton.ControlEvent += (s, a) => AttachProp(detach: true);
+            detachPropButton = new Button(Translation.Get("attachMpnPropPane", "detachButton"));
+            detachPropButton.ControlEvent += (s, a) => AttachProp(detach: true);
 
-            this.detachAllButton = new Button(Translation.Get("attachMpnPropPane", "detachAllButton"));
-            this.detachAllButton.ControlEvent += (s, a) => DetachAll();
+            detachAllButton = new Button(Translation.Get("attachMpnPropPane", "detachAllButton"));
+            detachAllButton.ControlEvent += (s, a) => DetachAll();
         }
 
         protected override void ReloadTranslation()
         {
-            this.attachPropButton.Label = Translation.Get("attachMpnPropPane", "attachButton");
-            this.detachPropButton.Label = Translation.Get("attachMpnPropPane", "detachButton");
-            this.detachAllButton.Label = Translation.Get("attachMpnPropPane", "detachAllButton");
+            attachPropButton.Label = Translation.Get("attachMpnPropPane", "attachButton");
+            detachPropButton.Label = Translation.Get("attachMpnPropPane", "detachButton");
+            detachAllButton.Label = Translation.Get("attachMpnPropPane", "detachAllButton");
             SetDropdownList();
         }
 
         public override void Draw()
         {
-            GUI.enabled = this.meidoManager.HasActiveMeido && Constants.MpnAttachInitialized;
+            GUI.enabled = meidoManager.HasActiveMeido && Constants.MpnAttachInitialized;
 
             GUILayoutOption noExpand = GUILayout.ExpandWidth(false);
 
             GUILayout.BeginHorizontal();
-            this.previousPropButton.Draw(noExpand);
-            this.mpnAttachDropdown.Draw(GUILayout.Width(153f));
-            this.nextPropButton.Draw(noExpand);
+            previousPropButton.Draw(noExpand);
+            mpnAttachDropdown.Draw(GUILayout.Width(153f));
+            nextPropButton.Draw(noExpand);
             GUILayout.EndHorizontal();
 
             GUILayout.BeginHorizontal();
-            this.attachPropButton.Draw();
-            this.detachPropButton.Draw();
+            attachPropButton.Draw();
+            detachPropButton.Draw();
             GUILayout.EndHorizontal();
-            this.detachAllButton.Draw();
+            detachAllButton.Draw();
 
             GUI.enabled = true;
         }
@@ -82,23 +82,23 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     "mpnAttachPropNames", Constants.MpnAttachPropList.Select(mpnProp => mpnProp.MenuFile)
                 );
 
-            this.mpnAttachDropdown.SetDropdownItems(dropdownList.ToArray());
+            mpnAttachDropdown.SetDropdownItems(dropdownList.ToArray());
         }
 
         private void AttachProp(bool detach = false)
         {
-            if (!this.meidoManager.HasActiveMeido) return;
+            if (!meidoManager.HasActiveMeido) return;
 
-            MpnAttachProp prop = Constants.MpnAttachPropList[this.mpnAttachDropdown.SelectedItemIndex];
+            MpnAttachProp prop = Constants.MpnAttachPropList[mpnAttachDropdown.SelectedItemIndex];
 
-            this.meidoManager.ActiveMeido.SetMpnProp(prop, detach);
+            meidoManager.ActiveMeido.SetMpnProp(prop, detach);
         }
 
         private void DetachAll()
         {
-            if (!this.meidoManager.HasActiveMeido) return;
+            if (!meidoManager.HasActiveMeido) return;
 
-            this.meidoManager.ActiveMeido.DetachAllMpnAttach();
+            meidoManager.ActiveMeido.DetachAllMpnAttach();
         }
     }
 }

+ 26 - 26
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/SaveHandPane.cs

@@ -4,59 +4,59 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SaveHandPane : BasePane
     {
-        private MeidoManager meidoManager;
-        private ComboBox categoryComboBox;
-        private TextField handNameTextField;
-        private Button saveLeftHandButton;
-        private Button saveRightHandButton;
+        private readonly MeidoManager meidoManager;
+        private readonly ComboBox categoryComboBox;
+        private readonly TextField handNameTextField;
+        private readonly Button saveLeftHandButton;
+        private readonly Button saveRightHandButton;
         private string categoryHeader;
         private string nameHeader;
 
         public SaveHandPane(MeidoManager meidoManager)
         {
-            Constants.customHandChange += (s, a) =>
+            Constants.CustomHandChange += (s, a) =>
             {
-                this.categoryComboBox.SetDropdownItems(Constants.CustomHandGroupList.ToArray());
+                categoryComboBox.SetDropdownItems(Constants.CustomHandGroupList.ToArray());
             };
 
             this.meidoManager = meidoManager;
 
-            this.categoryHeader = Translation.Get("handPane", "categoryHeader");
+            categoryHeader = Translation.Get("handPane", "categoryHeader");
 
-            this.nameHeader = Translation.Get("handPane", "nameHeader");
+            nameHeader = Translation.Get("handPane", "nameHeader");
 
-            this.saveLeftHandButton = new Button(Translation.Get("handPane", "saveLeftButton"));
-            this.saveLeftHandButton.ControlEvent += (s, a) => SaveHand(right: false);
+            saveLeftHandButton = new Button(Translation.Get("handPane", "saveLeftButton"));
+            saveLeftHandButton.ControlEvent += (s, a) => SaveHand(right: false);
 
-            this.saveRightHandButton = new Button(Translation.Get("handPane", "saveRightButton"));
-            this.saveRightHandButton.ControlEvent += (s, a) => SaveHand(right: true);
+            saveRightHandButton = new Button(Translation.Get("handPane", "saveRightButton"));
+            saveRightHandButton.ControlEvent += (s, a) => SaveHand(right: true);
 
-            this.categoryComboBox = new ComboBox(Constants.CustomHandGroupList.ToArray());
+            categoryComboBox = new ComboBox(Constants.CustomHandGroupList.ToArray());
 
-            this.handNameTextField = new TextField();
+            handNameTextField = new TextField();
         }
 
         protected override void ReloadTranslation()
         {
-            this.categoryHeader = Translation.Get("handPane", "categoryHeader");
-            this.nameHeader = Translation.Get("handPane", "nameHeader");
-            this.saveLeftHandButton.Label = Translation.Get("handPane", "saveLeftButton");
-            this.saveRightHandButton.Label = Translation.Get("handPane", "saveRightButton");
+            categoryHeader = Translation.Get("handPane", "categoryHeader");
+            nameHeader = Translation.Get("handPane", "nameHeader");
+            saveLeftHandButton.Label = Translation.Get("handPane", "saveLeftButton");
+            saveRightHandButton.Label = Translation.Get("handPane", "saveRightButton");
         }
 
         public override void Draw()
         {
-            GUI.enabled = this.meidoManager.HasActiveMeido;
+            GUI.enabled = meidoManager.HasActiveMeido;
 
             MiscGUI.Header(categoryHeader);
-            this.categoryComboBox.Draw(GUILayout.Width(165f));
+            categoryComboBox.Draw(GUILayout.Width(165f));
 
             MiscGUI.Header(nameHeader);
-            this.handNameTextField.Draw(GUILayout.Width(165f));
+            handNameTextField.Draw(GUILayout.Width(165f));
 
             GUILayout.BeginHorizontal();
-            this.saveRightHandButton.Draw();
-            this.saveLeftHandButton.Draw();
+            saveRightHandButton.Draw();
+            saveLeftHandButton.Draw();
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;
@@ -64,8 +64,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void SaveHand(bool right)
         {
-            byte[] handBinary = this.meidoManager.ActiveMeido.IKManager.SerializeHand(right);
-            Constants.AddHand(handBinary, right, this.handNameTextField.Value, this.categoryComboBox.Value);
+            byte[] handBinary = meidoManager.ActiveMeido.IKManager.SerializeHand(right);
+            Constants.AddHand(handBinary, right, handNameTextField.Value, categoryComboBox.Value);
             this.handNameTextField.Value = string.Empty;
         }
     }

+ 22 - 22
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/PoseWindowPanes/SavePosePane.cs

@@ -5,51 +5,51 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SavePosePane : BasePane
     {
-        private MeidoManager meidoManager;
-        private Button savePoseButton;
-        private TextField poseNameTextField;
-        private ComboBox categoryComboBox;
+        private readonly MeidoManager meidoManager;
+        private readonly Button savePoseButton;
+        private readonly TextField poseNameTextField;
+        private readonly ComboBox categoryComboBox;
         private string categoryHeader;
         private string nameHeader;
 
         public SavePosePane(MeidoManager meidoManager)
         {
-            Constants.customPoseChange += (s, a) =>
+            Constants.CustomPoseChange += (s, a) =>
             {
-                this.categoryComboBox.SetDropdownItems(Constants.CustomPoseGroupList.ToArray());
+                categoryComboBox.SetDropdownItems(Constants.CustomPoseGroupList.ToArray());
             };
 
             this.meidoManager = meidoManager;
 
-            this.categoryHeader = Translation.Get("posePane", "categoryHeader");
-            this.nameHeader = Translation.Get("posePane", "nameHeader");
+            categoryHeader = Translation.Get("posePane", "categoryHeader");
+            nameHeader = Translation.Get("posePane", "nameHeader");
 
-            this.savePoseButton = new Button(Translation.Get("posePane", "saveButton"));
-            this.savePoseButton.ControlEvent += OnSavePose;
+            savePoseButton = new Button(Translation.Get("posePane", "saveButton"));
+            savePoseButton.ControlEvent += OnSavePose;
 
-            this.categoryComboBox = new ComboBox(Constants.CustomPoseGroupList.ToArray());
-            this.poseNameTextField = new TextField();
-            this.poseNameTextField.ControlEvent += OnSavePose;
+            categoryComboBox = new ComboBox(Constants.CustomPoseGroupList.ToArray());
+            poseNameTextField = new TextField();
+            poseNameTextField.ControlEvent += OnSavePose;
         }
 
         protected override void ReloadTranslation()
         {
-            this.categoryHeader = Translation.Get("posePane", "categoryHeader");
-            this.nameHeader = Translation.Get("posePane", "nameHeader");
-            this.savePoseButton.Label = Translation.Get("posePane", "saveButton");
+            categoryHeader = Translation.Get("posePane", "categoryHeader");
+            nameHeader = Translation.Get("posePane", "nameHeader");
+            savePoseButton.Label = Translation.Get("posePane", "saveButton");
         }
 
         public override void Draw()
         {
-            GUI.enabled = this.meidoManager.HasActiveMeido;
+            GUI.enabled = meidoManager.HasActiveMeido;
 
             MiscGUI.Header(categoryHeader);
-            this.categoryComboBox.Draw(GUILayout.Width(160f));
+            categoryComboBox.Draw(GUILayout.Width(160f));
 
             MiscGUI.Header(nameHeader);
             GUILayout.BeginHorizontal();
-            this.poseNameTextField.Draw(GUILayout.Width(160f));
-            this.savePoseButton.Draw(GUILayout.ExpandWidth(false));
+            poseNameTextField.Draw(GUILayout.Width(160f));
+            savePoseButton.Draw(GUILayout.ExpandWidth(false));
             GUILayout.EndHorizontal();
 
             GUI.enabled = true;
@@ -57,8 +57,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void OnSavePose(object sender, EventArgs args)
         {
-            byte[] anmBinary = this.meidoManager.ActiveMeido.SerializePose();
-            Constants.AddPose(anmBinary, this.poseNameTextField.Value, this.categoryComboBox.Value);
+            byte[] anmBinary = meidoManager.ActiveMeido.SerializePose();
+            Constants.AddPose(anmBinary, poseNameTextField.Value, categoryComboBox.Value);
             this.poseNameTextField.Value = String.Empty;
         }
     }

+ 24 - 23
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/SceneManagerPanes/SceneManagerDirectoryPane.cs

@@ -5,51 +5,53 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class SceneManagerDirectoryPane : BasePane
     {
         public static readonly int listWidth = 200;
-        private SceneManager sceneManager;
-        private SceneModalWindow sceneModalWindow;
-        private Button createDirectoryButton;
-        private Button deleteDirectoryButton;
-        private TextField directoryTextField;
-        private Button cancelButton;
+        private readonly SceneManager sceneManager;
+        private readonly SceneModalWindow sceneModalWindow;
+        private readonly Button createDirectoryButton;
+        private readonly Button deleteDirectoryButton;
+        private readonly TextField directoryTextField;
+        private readonly Button cancelButton;
+        private readonly Texture2D selectedTexture = Utility.MakeTex(2, 2, new Color(0.5f, 0.5f, 0.5f, 0.4f));
         private Vector2 listScrollPos;
         private bool createDirectoryMode;
-        private Texture2D selectedTexture = Utility.MakeTex(2, 2, new Color(0.5f, 0.5f, 0.5f, 0.4f));
 
         public SceneManagerDirectoryPane(SceneManager sceneManager, SceneModalWindow sceneModalWindow)
         {
             this.sceneManager = sceneManager;
             this.sceneModalWindow = sceneModalWindow;
 
-            this.createDirectoryButton = new Button(Translation.Get("sceneManager", "createDirectoryButton"));
-            this.createDirectoryButton.ControlEvent += (s, a) => createDirectoryMode = true;
+            createDirectoryButton = new Button(Translation.Get("sceneManager", "createDirectoryButton"));
+            createDirectoryButton.ControlEvent += (s, a) => createDirectoryMode = true;
 
-            this.deleteDirectoryButton = new Button(Translation.Get("sceneManager", "deleteDirectoryButton"));
-            this.deleteDirectoryButton.ControlEvent += (s, a) => sceneModalWindow.ShowDirectoryDialogue();
+            deleteDirectoryButton = new Button(Translation.Get("sceneManager", "deleteDirectoryButton"));
+            deleteDirectoryButton.ControlEvent += (s, a) => this.sceneModalWindow.ShowDirectoryDialogue();
 
-            this.directoryTextField = new TextField();
-            this.directoryTextField.ControlEvent += (s, a) =>
+            directoryTextField = new TextField();
+            directoryTextField.ControlEvent += (s, a) =>
             {
                 sceneManager.AddDirectory(directoryTextField.Value);
                 createDirectoryMode = false;
                 directoryTextField.Value = string.Empty;
             };
 
-            this.cancelButton = new Button("X");
-            this.cancelButton.ControlEvent += (s, a) => createDirectoryMode = false;
+            cancelButton = new Button("X");
+            cancelButton.ControlEvent += (s, a) => createDirectoryMode = false;
         }
 
         protected override void ReloadTranslation()
         {
-            this.createDirectoryButton.Label = Translation.Get("sceneManager", "createDirectoryButton");
-            this.deleteDirectoryButton.Label = Translation.Get("sceneManager", "deleteDirectoryButton");
+            createDirectoryButton.Label = Translation.Get("sceneManager", "createDirectoryButton");
+            deleteDirectoryButton.Label = Translation.Get("sceneManager", "deleteDirectoryButton");
         }
 
         public override void Draw()
         {
-            GUIStyle directoryStyle = new GUIStyle(GUI.skin.button);
-            directoryStyle.fontSize = Utility.GetPix(12);
-            directoryStyle.alignment = TextAnchor.MiddleLeft;
-            directoryStyle.margin = new RectOffset(0, 0, 0, 0);
+            GUIStyle directoryStyle = new GUIStyle(GUI.skin.button)
+            {
+                fontSize = Utility.GetPix(12),
+                alignment = TextAnchor.MiddleLeft,
+                margin = new RectOffset(0, 0, 0, 0)
+            };
 
             GUIStyle directorySelectedStyle = new GUIStyle(directoryStyle);
             directorySelectedStyle.normal.textColor = Color.white;
@@ -74,8 +76,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             GUILayout.BeginHorizontal();
 
-            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
-            buttonStyle.fontSize = Utility.GetPix(12);
+            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) { fontSize = Utility.GetPix(12) };
 
             GUILayoutOption buttonHeight = GUILayout.Height(Utility.GetPix(20));
 

+ 16 - 13
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/SceneManagerPanes/SceneManagerScenePane.cs

@@ -1,14 +1,13 @@
 using UnityEngine;
 
-
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SceneManagerScenePane : BasePane
     {
         public static readonly float thumbnailScale = 0.55f;
-        private SceneManager sceneManager;
-        private SceneModalWindow sceneModalWindow;
-        private Button addSceneButton;
+        private readonly SceneManager sceneManager;
+        private readonly SceneModalWindow sceneModalWindow;
+        private readonly Button addSceneButton;
         private Vector2 sceneScrollPos;
 
         public SceneManagerScenePane(SceneManager sceneManager, SceneModalWindow sceneModalWindow)
@@ -16,19 +15,23 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             this.sceneManager = sceneManager;
             this.sceneModalWindow = sceneModalWindow;
 
-            this.addSceneButton = new Button("+");
-            this.addSceneButton.ControlEvent += (s, a) => sceneManager.SaveScene(overwrite: false);
+            addSceneButton = new Button("+");
+            addSceneButton.ControlEvent += (s, a) => sceneManager.SaveScene(overwrite: false);
         }
 
         public override void Draw()
         {
-            GUIStyle sceneImageStyle = new GUIStyle(GUI.skin.label);
-            sceneImageStyle.alignment = TextAnchor.MiddleCenter;
-            sceneImageStyle.padding = new RectOffset(0, 0, 0, 0);
+            GUIStyle sceneImageStyle = new GUIStyle(GUI.skin.label)
+            {
+                alignment = TextAnchor.MiddleCenter,
+                padding = new RectOffset(0, 0, 0, 0)
+            };
 
-            GUIStyle addSceneStyle = new GUIStyle(GUI.skin.button);
-            addSceneStyle.alignment = TextAnchor.MiddleCenter;
-            addSceneStyle.fontSize = 60;
+            GUIStyle addSceneStyle = new GUIStyle(GUI.skin.button)
+            {
+                alignment = TextAnchor.MiddleCenter,
+                fontSize = 60
+            };
 
             GUILayout.BeginVertical();
 
@@ -39,7 +42,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayoutOption[] sceneLayoutOptions = new[] { GUILayout.Height(sceneHeight), GUILayout.Width(sceneWidth) };
 
             int columns = Mathf.Max(1, (int)(sceneGridWidth / sceneWidth));
-            int rows = (int)Mathf.Ceil((float)sceneManager.SceneList.Count + 1 / (float)columns);
+            int rows = (int)Mathf.Ceil(sceneManager.SceneList.Count + (1 / (float)columns));
 
             sceneScrollPos = GUILayout.BeginScrollView(sceneScrollPos);
 

+ 16 - 17
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/SceneManagerPanes/SceneManagerTitleBar.cs

@@ -4,15 +4,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SceneManagerTitleBarPane : BasePane
     {
-        public event System.EventHandler closeChange;
-        private SceneManager sceneManager;
-        private Button kankyoToggle;
-        private Button refreshButton;
-        private Dropdown sortDropdown;
-        private Toggle descendingToggle;
-        private Button closeButton;
-        private string sortLabel;
         private static readonly string[] sortModes = new[] { "sortName", "sortCreated", "sortModified" };
+        private readonly SceneManager sceneManager;
+        private readonly Button kankyoToggle;
+        private readonly Button refreshButton;
+        private readonly Dropdown sortDropdown;
+        private readonly Toggle descendingToggle;
+        private readonly Button closeButton;
+        private string sortLabel;
+        public event System.EventHandler CloseChange;
 
         public SceneManagerTitleBarPane(SceneManager sceneManager)
         {
@@ -43,7 +43,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             };
 
             closeButton = new Button("X");
-            closeButton.ControlEvent += (s, a) => closeChange?.Invoke(this, System.EventArgs.Empty);
+            closeButton.ControlEvent += (s, a) => CloseChange?.Invoke(this, System.EventArgs.Empty);
 
             sortLabel = Translation.Get("sceneManager", "sortLabel");
         }
@@ -59,8 +59,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Draw()
         {
-            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
-            buttonStyle.fontSize = Utility.GetPix(12);
+            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button) { fontSize = Utility.GetPix(12) };
 
             GUILayoutOption buttonHeight = GUILayout.Height(Utility.GetPix(20));
             GUILayout.BeginHorizontal();
@@ -82,18 +81,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             GUILayout.Space(Utility.GetPix(15));
 
-            GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
-            labelStyle.fontSize = buttonStyle.fontSize;
+            GUIStyle labelStyle = new GUIStyle(GUI.skin.label) { fontSize = buttonStyle.fontSize };
 
             GUILayout.Label(sortLabel, labelStyle);
 
-            GUIStyle dropdownStyle = new GUIStyle(DropdownHelper.DefaultDropdownStyle);
-            dropdownStyle.fontSize = buttonStyle.fontSize;
+            GUIStyle dropdownStyle = new GUIStyle(DropdownHelper.DefaultDropdownStyle)
+            {
+                fontSize = buttonStyle.fontSize
+            };
 
             sortDropdown.Draw(buttonStyle, dropdownStyle, buttonHeight, GUILayout.Width(Utility.GetPix(100)));
 
-            GUIStyle toggleStyle = new GUIStyle(GUI.skin.toggle);
-            toggleStyle.fontSize = buttonStyle.fontSize;
+            GUIStyle toggleStyle = new GUIStyle(GUI.skin.toggle) { fontSize = buttonStyle.fontSize };
 
             descendingToggle.Draw(toggleStyle);
 

+ 5 - 12
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/BaseWindow.cs

@@ -1,4 +1,3 @@
-using System.Collections.Generic;
 using UnityEngine;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
@@ -24,23 +23,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
         }
         protected Vector2 MiddlePosition => new Vector2(
-            Screen.width / 2 - windowRect.width / 2,
-            Screen.height / 2 - windowRect.height / 2
+            (Screen.width / 2) - (windowRect.width / 2), (Screen.height / 2) - (windowRect.height / 2)
         );
 
-        public BaseWindow ModalWindow { get; private set; }
-
-        public BaseWindow() : base() => windowID = ID;
+        protected BaseWindow() => windowID = ID;
 
         public virtual void HandleZoom()
         {
-            if (Input.mouseScrollDelta.y != 0f)
+            if (Input.mouseScrollDelta.y != 0f && Visible)
             {
-                if (Visible)
-                {
-                    Vector2 mousePos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
-                    if (WindowRect.Contains(mousePos)) Input.ResetInputAxes();
-                }
+                Vector2 mousePos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
+                if (WindowRect.Contains(mousePos)) Input.ResetInputAxes();
             }
         }
 

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/BaseWindowPane.cs

@@ -11,7 +11,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public T AddPane<T>(T pane) where T : BasePane
         {
-            this.Panes.Add(pane);
+            Panes.Add(pane);
             return pane;
         }
 

+ 11 - 14
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MainWindow.cs

@@ -5,12 +5,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MainWindow : BaseWindow
     {
-        private MeidoManager meidoManager;
-        private PropManager propManager;
-        private LightManager lightManager;
-        private Dictionary<Constants.Window, BaseMainWindowPane> windowPanes;
-        private TabsPane tabsPane;
-        private Button settingsButton;
+        private readonly MeidoManager meidoManager;
+        private readonly Dictionary<Constants.Window, BaseMainWindowPane> windowPanes;
+        private readonly PropManager propManager;
+        private readonly LightManager lightManager;
+        private readonly TabsPane tabsPane;
+        private readonly Button settingsButton;
         private BaseMainWindowPane currentWindowPane;
         public override Rect WindowRect
         {
@@ -63,10 +63,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public override void Activate()
         {
-            this.updating = true;
+            updating = true;
             tabsPane.SelectedTab = Constants.Window.Call;
-            this.updating = false;
-            this.Visible = true;
+            updating = false;
+            Visible = true;
         }
 
         public void AddWindow(Constants.Window id, BaseMainWindowPane window)
@@ -98,10 +98,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void Update()
         {
             base.Update();
-            if (InputManager.GetKeyDown(MpsKey.ToggleUI))
-            {
-                this.Visible = !this.Visible;
-            }
+            if (InputManager.GetKeyDown(MpsKey.ToggleUI)) Visible = !Visible;
         }
 
         public override void Draw()
@@ -139,7 +136,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void ChangeWindow(Constants.Window window)
         {
-            if (this.selectedWindow == window) currentWindowPane.UpdatePanes();
+            if (selectedWindow == window) currentWindowPane.UpdatePanes();
             else tabsPane.SelectedTab = window;
         }
     }

+ 7 - 10
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/MessageWindow.cs

@@ -5,11 +5,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class MessageWindow : BaseWindow
     {
-        private MessageWindowManager messageWindowManager;
-        private TextField nameTextField;
-        private Slider fontSizeSlider;
-        private TextArea messageTextArea;
-        private Button okButton;
+        private readonly MessageWindowManager messageWindowManager;
+        private readonly TextField nameTextField;
+        private readonly Slider fontSizeSlider;
+        private readonly TextArea messageTextArea;
+        private readonly Button okButton;
         public override Rect WindowRect
         {
             set
@@ -50,10 +50,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 messageWindowManager.CloseMessagePanel();
                 showingMessage = false;
             }
-            else
-            {
-                Visible = !Visible;
-            }
+            else Visible = !Visible;
         }
 
         private void ChangeFontSize(object sender, EventArgs args)
@@ -85,7 +82,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             GUILayout.Label("Font Size", GUILayout.ExpandWidth(false));
             fontSizeSlider.Draw(GUILayout.Width(120), GUILayout.ExpandWidth(false));
-            GUILayout.Label($"{(int)fontSize}pt");
+            GUILayout.Label($"{fontSize}pt");
             GUILayout.EndHorizontal();
 
             messageTextArea.Draw(GUILayout.MinHeight(90));

+ 36 - 30
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/SceneModalWindow.cs

@@ -5,8 +5,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SceneModalWindow : BaseWindow
     {
-        private static Texture2D infoHighlight = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.8f));
-        private SceneManager sceneManager;
+        private static readonly Texture2D infoHighlight = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.8f));
+        private readonly SceneManager sceneManager;
         public override Rect WindowRect
         {
             set
@@ -32,10 +32,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
         }
 
-        private Button okButton;
-        private Button cancelButton;
-        private Button deleteButton;
-        private Button overwriteButton;
+        private readonly Button okButton;
+        private readonly Button cancelButton;
+        private readonly Button deleteButton;
+        private readonly Button overwriteButton;
         private string deleteDirectoryMessage;
         private string deleteSceneMessage;
         private string directoryDeleteCommit;
@@ -55,21 +55,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             windowRect.x = MiddlePosition.x;
             windowRect.y = MiddlePosition.y;
-            this.okButton = new Button(sceneLoadCommit);
-            this.okButton.ControlEvent += (s, a) => Commit();
+            okButton = new Button(sceneLoadCommit);
+            okButton.ControlEvent += (s, a) => Commit();
 
-            this.cancelButton = new Button("Cancel");
-            this.cancelButton.ControlEvent += (s, a) => Cancel();
+            cancelButton = new Button("Cancel");
+            cancelButton.ControlEvent += (s, a) => Cancel();
 
-            this.deleteButton = new Button("Delete");
-            this.deleteButton.ControlEvent += (s, a) =>
+            deleteButton = new Button("Delete");
+            deleteButton.ControlEvent += (s, a) =>
             {
                 okButton.Label = sceneDeleteCommit;
                 deleteScene = true;
             };
 
-            this.overwriteButton = new Button("Overwrite");
-            this.overwriteButton.ControlEvent += (s, a) =>
+            overwriteButton = new Button("Overwrite");
+            overwriteButton.ControlEvent += (s, a) =>
             {
                 sceneManager.OverwriteScene();
                 Visible = false;
@@ -82,10 +82,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             deleteSceneMessage = Translation.Get("sceneManagerModal", "deleteFileConfirm");
             directoryDeleteCommit = Translation.Get("sceneManagerModal", "deleteDirectoryButton");
             sceneDeleteCommit = Translation.Get("sceneManagerModal", "deleteFileCommit");
-            sceneLoadCommit = Translation.Get("sceneManagerModal", "fileLoadCommit"); ;
+            sceneLoadCommit = Translation.Get("sceneManagerModal", "fileLoadCommit");
             infoKankyo = Translation.Get("sceneManagerModal", "infoKankyo");
-            infoMaidSingular = Translation.Get("sceneManagerModal", "infoMaidSingular"); ;
-            infoMaidPlural = Translation.Get("sceneManagerModal", "infoMaidPlural"); ;
+            infoMaidSingular = Translation.Get("sceneManagerModal", "infoMaidSingular");
+            infoMaidPlural = Translation.Get("sceneManagerModal", "infoMaidPlural");
         }
 
         public override void Draw()
@@ -99,19 +99,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 Texture2D thumb = scene.Thumbnail;
 
                 float scale = Mathf.Min(
-                    (WindowRect.width - 20f) / (float)thumb.width, (WindowRect.height - 110f) / (float)thumb.height
+                    (WindowRect.width - 20f) / thumb.width, (WindowRect.height - 110f) / thumb.height
                 );
-                float width = Mathf.Min(thumb.width, (float)thumb.width * scale);
-                float height = Mathf.Min(thumb.height, (float)thumb.height * scale);
+                float width = Mathf.Min(thumb.width, thumb.width * scale);
+                float height = Mathf.Min(thumb.height, thumb.height * scale);
 
                 GUILayout.BeginHorizontal();
                 GUILayout.FlexibleSpace();
 
                 MiscGUI.DrawTexture(thumb, GUILayout.Width(width), GUILayout.Height(height));
 
-                GUIStyle labelStyle = new GUIStyle(GUI.skin.label);
-                labelStyle.fontSize = Utility.GetPix(12);
-                labelStyle.alignment = TextAnchor.MiddleCenter;
+                GUIStyle labelStyle = new GUIStyle(GUI.skin.label)
+                {
+                    fontSize = Utility.GetPix(12),
+                    alignment = TextAnchor.MiddleCenter
+                };
                 labelStyle.normal.background = infoHighlight;
 
                 Rect labelBox = GUILayoutUtility.GetLastRect();
@@ -138,8 +140,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
 
             // message
-            string currentMessage = string.Empty;
-            string context = string.Empty;
+            string currentMessage;
+            string context;
 
             if (directoryMode)
             {
@@ -160,9 +162,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 }
             }
 
-            GUIStyle messageStyle = new GUIStyle(GUI.skin.label);
-            messageStyle.alignment = TextAnchor.MiddleCenter;
-            messageStyle.fontSize = Utility.GetPix(12);
+            GUIStyle messageStyle = new GUIStyle(GUI.skin.label)
+            {
+                alignment = TextAnchor.MiddleCenter,
+                fontSize = Utility.GetPix(12)
+            };
 
             GUILayout.FlexibleSpace();
 
@@ -172,8 +176,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             // Buttons
 
-            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
-            buttonStyle.fontSize = Utility.GetPix(12);
+            GUIStyle buttonStyle = new GUIStyle(GUI.skin.button)
+            {
+                fontSize = Utility.GetPix(12)
+            };
 
             GUILayoutOption buttonHeight = GUILayout.Height(Utility.GetPix(20));
 

+ 12 - 13
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Windows/SceneWindow.cs

@@ -4,13 +4,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal class SceneWindow : BaseWindow
     {
-        private SceneManager sceneManager;
-        private SceneManagerTitleBarPane titleBar;
-        private SceneManagerDirectoryPane directoryList;
-        private SceneManagerScenePane sceneGrid;
+        private const float resizeHandleSize = 15f;
+        private readonly SceneManager sceneManager;
+        private readonly SceneManagerTitleBarPane titleBar;
+        private readonly SceneManagerDirectoryPane directoryList;
+        private readonly SceneManagerScenePane sceneGrid;
         private Rect resizeHandleRect;
         private bool resizing;
-        private float resizeHandleSize = 15f;
         private bool visible;
         public override bool Visible
         {
@@ -26,23 +26,22 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             windowRect.width = Screen.width * 0.65f;
             windowRect.height = Screen.height * 0.75f;
-            windowRect.x = Screen.width * 0.5f - windowRect.width * 0.5f;
-            windowRect.y = Screen.height * 0.5f - windowRect.height * 0.5f;
+            windowRect.x = (Screen.width * 0.5f) - (windowRect.width * 0.5f);
+            windowRect.y = (Screen.height * 0.5f) - (windowRect.height * 0.5f);
 
             resizeHandleRect = new Rect(0f, 0f, resizeHandleSize, resizeHandleSize);
 
-
             this.sceneManager = sceneManager;
             SceneModalWindow sceneModalWindow = new SceneModalWindow(this.sceneManager);
 
-            this.titleBar = AddPane(new SceneManagerTitleBarPane(sceneManager));
-            this.titleBar.closeChange += (s, a) => Visible = false;
+            titleBar = AddPane(new SceneManagerTitleBarPane(sceneManager));
+            titleBar.CloseChange += (s, a) => Visible = false;
 
-            this.directoryList = AddPane(new SceneManagerDirectoryPane(sceneManager, sceneModalWindow));
+            directoryList = AddPane(new SceneManagerDirectoryPane(sceneManager, sceneModalWindow));
 
-            this.sceneGrid = AddPane(new SceneManagerScenePane(sceneManager, sceneModalWindow));
+            sceneGrid = AddPane(new SceneManagerScenePane(sceneManager, sceneModalWindow));
 
-            this.sceneGrid.SetParent(this);
+            sceneGrid.SetParent(this);
         }
 
         public override void GUIFunc(int id)

+ 6 - 9
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MaidPlacementUtility.cs

@@ -5,17 +5,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 {
     internal static class MaidPlacementUtility
     {
-        private static readonly float pi = Mathf.PI;
-        private static readonly float tau = Mathf.PI * 2f;
+        private const float pi = Mathf.PI;
+        private const float tau = Mathf.PI * 2f;
         public static readonly string[] placementTypes = {
             "horizontalRow", "verticalRow", "diagonalRow", "diagonalRowInverse", "wave", "waveInverse",
             "v", "vInverse", "circleInner", "circleOuter", "fanInner", "fanOuter"
         };
 
-        public static int AlternatingSequence(int x)
-        {
-            return (int)((x % 2 == 0 ? 1 : -1) * Mathf.Ceil(x / 2f));
-        }
+        public static int AlternatingSequence(int x) => (int)((x % 2 == 0 ? 1 : -1) * Mathf.Ceil(x / 2f));
 
         public static void ApplyPlacement(string placementType, IList<Meido> list)
         {
@@ -100,13 +97,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             int maidCount = list.Count;
 
-            float radius = (0.3f + 0.1f * maidCount);
+            float radius = 0.3f + (0.1f * maidCount);
 
             for (int i = 0; i < maidCount; i++)
             {
                 Maid maid = list[i].Maid;
 
-                float angle = (pi / 2f) + tau * AlternatingSequence(i) / maidCount;
+                float angle = (pi / 2f) + (tau * AlternatingSequence(i) / maidCount);
 
                 float x = Mathf.Cos(angle) * radius;
                 float z = Mathf.Sin(angle) * radius;
@@ -123,7 +120,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             int maidCount = list.Count;
 
-            float radius = (0.2f + 0.2f * maidCount);
+            float radius = 0.2f + (0.2f * maidCount);
 
             list[0].Maid.SetPos(Vector3.zero);
             list[0].Maid.SetRot(Vector3.zero);

+ 3 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManager.cs

@@ -7,8 +7,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     {
         public const string header = "EFFECT";
         public const string footer = "END_EFFECT";
-        private Dictionary<Type, IEffectManager> EffectManagers = new Dictionary<Type, IEffectManager>();
-        private BloomEffectManager bloomEffectManager;
+        private readonly Dictionary<Type, IEffectManager> EffectManagers = new Dictionary<Type, IEffectManager>();
+        private readonly BloomEffectManager bloomEffectManager;
 
         public EffectManager()
         {
@@ -22,7 +22,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public T Get<T>() where T : IEffectManager
         {
             if (EffectManagers.ContainsKey(typeof(T))) return (T)EffectManagers[typeof(T)];
-            else return default(T);
+            else return default;
         }
 
         private T AddManager<T>() where T : IEffectManager, new()

+ 4 - 10
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/BloomEffectManager.cs

@@ -12,12 +12,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         private Bloom.HDRBloomMode initialHDRBloomMode;
         public bool Ready { get; private set; }
         public bool Active { get; private set; }
-        private float intensity;
-        public float Intensity
-        {
-            get => intensity;// m_gcBloom.GetValue();
-            set => intensity = value;
-        }
+        public float Intensity { get; set; }
         private int blurIterations;
         public int BlurIterations
         {
@@ -92,7 +87,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (Bloom == null)
             {
                 Ready = true;
-                Bloom = GameMain.Instance.MainCamera.GetOrAddComponent<Bloom>();
+                Bloom = Utility.GetFieldValue<CameraMain, Bloom>(GameMain.Instance.MainCamera, "m_gcBloom");
                 initialIntensity = Intensity = Bloom.bloomIntensity;
                 initialBlurIterations = BlurIterations = Bloom.bloomBlurIterations;
                 initialThresholdColour = BloomThresholdColour = Bloom.bloomThreshholdColor;
@@ -123,8 +118,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void SetEffectActive(bool active)
         {
             Bloom.enabled = active;
-            Active = active;
-            if (this.Active)
+            if (Active = active)
             {
                 Bloom.bloomIntensity = Intensity;
                 Bloom.bloomBlurIterations = BlurIterations;
@@ -142,7 +136,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 // 2020/08/15 this stupid shit doesn't even work anymore
                 // TODO: Fix this stupid shit
                 Bloom.enabled = true;
-                Bloom.bloomIntensity = intensity;
+                Bloom.bloomIntensity = Intensity;
             }
         }
     }

+ 1 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/DepthOfFieldManager.cs

@@ -105,8 +105,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void SetEffectActive(bool active)
         {
             DepthOfField.enabled = active;
-            this.Active = active;
-            if (this.Active)
+            if (Active = active)
             {
                 DepthOfField.focalLength = FocalLength;
                 DepthOfField.focalSize = FocalSize;

+ 6 - 7
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/FogEffectManager.cs

@@ -6,12 +6,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     {
         public const string header = "EFFECT_FOG";
         private GlobalFog Fog { get; set; }
-        public bool Ready { get; private set; }
+        public bool Ready { get; }
         public bool Active { get; private set; }
-        public static float InitialDistance { get; private set; } = 4f;
-        public static float InitialDensity { get; private set; } = 1f;
-        public static float InitialHeightScale { get; private set; } = 1f;
-        public static float InitialHeight { get; private set; } = 0f;
+        public static float InitialDistance { get; } = 4f;
+        public static float InitialDensity { get; } = 1f;
+        public static float InitialHeightScale { get; } = 1f;
+        public static float InitialHeight { get; }
         public static Color InitialColour { get; private set; } = Color.white;
         private float distance;
         public float Distance
@@ -129,8 +129,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void SetEffectActive(bool active)
         {
             Fog.enabled = active;
-            this.Active = active;
-            if (this.Active)
+            if (Active = active)
             {
                 Fog.startDistance = Distance;
                 Fog.globalDensity = Density;

+ 1 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EffectManagers/VignetteEffectManager.cs

@@ -90,8 +90,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void SetEffectActive(bool active)
         {
             Vignette.enabled = active;
-            Active = active;
-            if (this.Active)
+            if (Active = active)
             {
                 Vignette.intensity = Intensity;
                 Vignette.blur = Blur;

+ 19 - 28
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/EnvironmentManager.cs

@@ -49,8 +49,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => bgVisible;
             set
             {
-                this.bgVisible = value;
-                bgObject.SetActive(this.bgVisible);
+                bgVisible = value;
+                bgObject.SetActive(bgVisible);
             }
         }
 
@@ -62,10 +62,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Input.Register(MpsKey.CameraReset, KeyCode.R, "Reset camera transform");
         }
 
-        public EnvironmentManager(MeidoManager meidoManager)
-        {
-            DragPointLight.environmentManager = this;
-        }
+        public EnvironmentManager() => DragPointLight.EnvironmentManager = this;
 
         public void Serialize(System.IO.BinaryWriter binaryWriter) => Serialize(binaryWriter, false);
 
@@ -73,9 +70,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             binaryWriter.Write(header);
             binaryWriter.Write(currentBGAsset);
-            binaryWriter.WriteVector3(this.bg.position);
-            binaryWriter.WriteQuaternion(this.bg.rotation);
-            binaryWriter.WriteVector3(this.bg.localScale);
+            binaryWriter.WriteVector3(bg.position);
+            binaryWriter.WriteQuaternion(bg.rotation);
+            binaryWriter.WriteVector3(bg.localScale);
 
             binaryWriter.Write(kankyo);
 
@@ -106,9 +103,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             else bgAsset = bgList[assetIndex];
 
             ChangeBackground(bgAsset, isCreative);
-            this.bg.position = binaryReader.ReadVector3();
-            this.bg.rotation = binaryReader.ReadQuaternion();
-            this.bg.localScale = binaryReader.ReadVector3();
+            bg.position = binaryReader.ReadVector3();
+            bg.rotation = binaryReader.ReadQuaternion();
+            bg.localScale = binaryReader.ReadVector3();
 
             bool kankyo = binaryReader.ReadBoolean();
 
@@ -216,10 +213,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public void ChangeBackground(string assetName, bool creative = false)
         {
             currentBGAsset = assetName;
-            if (creative)
-            {
-                GameMain.Instance.BgMgr.ChangeBgMyRoom(assetName);
-            }
+            if (creative) GameMain.Instance.BgMgr.ChangeBgMyRoom(assetName);
             else
             {
                 GameMain.Instance.BgMgr.ChangeBg(assetName);
@@ -234,7 +228,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void SaveCameraInfo()
         {
-            this.cameraInfo = new CameraInfo(GameMain.Instance.MainCamera);
+            cameraInfo = new CameraInfo(GameMain.Instance.MainCamera);
             StopCameraSpin();
         }
 
@@ -253,8 +247,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             UltimateOrbitCamera uoCamera = Utility.GetFieldValue<CameraMain, UltimateOrbitCamera>(
                 GameMain.Instance.MainCamera, "m_UOCamera"
             );
-            Utility.SetFieldValue<UltimateOrbitCamera, float>(uoCamera, "xVelocity", 0f);
-            Utility.SetFieldValue<UltimateOrbitCamera, float>(uoCamera, "yVelocity", 0f);
+            Utility.SetFieldValue(uoCamera, "xVelocity", 0f);
+            Utility.SetFieldValue(uoCamera, "yVelocity", 0f);
         }
 
         private void ResetCamera()
@@ -267,13 +261,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void OnCubeSmall(object sender, EventArgs args)
         {
-            this.bgDragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
+            bgDragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
         }
 
-        private void OnCubeActive(object sender, EventArgs args)
-        {
-            this.bgDragPoint.gameObject.SetActive(CubeActive);
-        }
+        private void OnCubeActive(object sender, EventArgs args) => bgDragPoint.gameObject.SetActive(CubeActive);
     }
 
     public struct CameraInfo
@@ -284,10 +275,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public float Distance { get; }
         public CameraInfo(CameraMain camera)
         {
-            this.TargetPos = camera.GetTargetPos();
-            this.Pos = camera.GetPos();
-            this.Angle = camera.transform.eulerAngles;
-            this.Distance = camera.GetDistance();
+            TargetPos = camera.GetTargetPos();
+            Pos = camera.GetPos();
+            Angle = camera.transform.eulerAngles;
+            Distance = camera.GetDistance();
         }
     }
 }

+ 2 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/InputManager.cs

@@ -6,7 +6,7 @@ using BepInEx.Configuration;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
-    internal class InputManager
+    internal static class InputManager
     {
         private static InputListener inputListener;
         private static readonly Dictionary<MpsKey, KeyCode> ActionKeys = new Dictionary<MpsKey, KeyCode>();
@@ -70,7 +70,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public static void StopListening()
         {
-            if (inputListener == null || !inputListener.gameObject.activeSelf) return;
+            if (!inputListener || !inputListener.gameObject.activeSelf) return;
             inputListener.gameObject.SetActive(false);
             inputListener.KeyChange -= OnKeyChange;
             CurrentKeyCode = KeyCode.None;

+ 5 - 11
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/LightManager.cs

@@ -22,7 +22,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             }
         }
         private static event EventHandler CubeActiveChange;
-        private List<DragPointLight> lightList = new List<DragPointLight>();
+        private readonly List<DragPointLight> lightList = new List<DragPointLight>();
         private int selectedLightIndex = 0;
         public int SelectedLightIndex
         {
@@ -35,13 +35,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         }
         public string[] LightNameList => lightList.Select(light => LightName(light.Name)).ToArray();
         public string ActiveLightName => LightName(lightList[SelectedLightIndex].Name);
-        public DragPointLight CurrentLight
-        {
-            get
-            {
-                return lightList[SelectedLightIndex];
-            }
-        }
+        public DragPointLight CurrentLight => lightList[SelectedLightIndex];
         public event EventHandler Rotate;
         public event EventHandler Scale;
         public event EventHandler ListModified;
@@ -129,7 +123,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             DestroyLight(lightList[lightIndex]);
             lightList.RemoveAt(lightIndex);
 
-            if (lightIndex <= SelectedLightIndex) SelectedLightIndex -= 1;
+            if (lightIndex <= SelectedLightIndex) SelectedLightIndex--;
 
             if (noUpdate) return;
             OnListModified();
@@ -202,8 +196,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             int select = lightList.FindIndex(light => light == theLight);
             if (select >= 0)
             {
-                this.SelectedLightIndex = select;
-                this.Select?.Invoke(this, EventArgs.Empty);
+                SelectedLightIndex = select;
+                Select?.Invoke(this, EventArgs.Empty);
             }
         }
 

+ 21 - 28
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MeidoManager.cs

@@ -8,12 +8,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class MeidoManager : IManager, ISerializable
     {
         public const string header = "MEIDO";
-        private static CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
+        private static readonly CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
         private int undress = 0;
         private int numberOfMeidos;
-        public Meido[] meidos { get; private set; }
-        public List<int> SelectMeidoList { get; private set; } = new List<int>();
-        public List<Meido> ActiveMeidoList { get; private set; } = new List<Meido>();
+        public Meido[] Meidos { get; private set; }
+        public List<int> SelectMeidoList { get; } = new List<int>();
+        public List<Meido> ActiveMeidoList { get; } = new List<Meido>();
         public Meido ActiveMeido => ActiveMeidoList.Count > 0 ? ActiveMeidoList[SelectedMeido] : null;
         public bool HasActiveMeido => ActiveMeido != null;
         public event EventHandler<MeidoUpdateEventArgs> UpdateMeido;
@@ -32,7 +32,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => globalGravity;
             set
             {
-                this.globalGravity = value;
+                globalGravity = value;
                 Meido activeMeido = ActiveMeido;
                 int activeMeidoSlot = activeMeido.Slot;
 
@@ -40,8 +40,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 {
                     if (meido.Slot != activeMeidoSlot)
                     {
-                        meido.HairGravityActive = value ? activeMeido.HairGravityActive : false;
-                        meido.SkirtGravityActive = value ? activeMeido.SkirtGravityActive : false;
+                        meido.HairGravityActive = value && activeMeido.HairGravityActive;
+                        meido.SkirtGravityActive = value && activeMeido.SkirtGravityActive;
                     }
                 }
             }
@@ -58,17 +58,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             GameMain.Instance.CharacterMgr.ResetCharaPosAll();
             numberOfMeidos = characterMgr.GetStockMaidCount();
-            meidos = new Meido[numberOfMeidos];
+            Meidos = new Meido[numberOfMeidos];
 
             for (int stockMaidIndex = 0; stockMaidIndex < numberOfMeidos; stockMaidIndex++)
             {
-                meidos[stockMaidIndex] = new Meido(stockMaidIndex);
+                Meidos[stockMaidIndex] = new Meido(stockMaidIndex);
             }
         }
 
         public void Deactivate()
         {
-            foreach (Meido meido in meidos)
+            foreach (Meido meido in Meidos)
             {
                 meido.UpdateMeido -= OnUpdateMeido;
                 meido.GravityMove -= OnGravityMove;
@@ -128,7 +128,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void CallMeidos()
         {
-            this.BeginCallMeidos?.Invoke(this, EventArgs.Empty);
+            BeginCallMeidos?.Invoke(this, EventArgs.Empty);
 
             bool hadActiveMeidos = HasActiveMeido;
 
@@ -148,9 +148,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private System.Collections.IEnumerator LoadMeidos()
         {
-            foreach (int slot in this.SelectMeidoList)
+            foreach (int slot in SelectMeidoList)
             {
-                Meido meido = meidos[slot];
+                Meido meido = Meidos[slot];
                 ActiveMeidoList.Add(meido);
                 meido.BeginLoad();
             }
@@ -170,7 +170,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public Meido GetMeido(string guid)
         {
             if (string.IsNullOrEmpty(guid)) return null;
-            else return ActiveMeidoList.FirstOrDefault(meido => meido.Maid.status.guid == guid);
+            else return ActiveMeidoList.Find(meido => meido.Maid.status.guid == guid);
         }
 
         public Meido GetMeido(int activeIndex)
@@ -201,13 +201,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 activeMeido.SetMaskMode(maskMode);
             }
 
-            this.UpdateMeido?.Invoke(ActiveMeido, new MeidoUpdateEventArgs(SelectedMeido));
+            UpdateMeido?.Invoke(ActiveMeido, new MeidoUpdateEventArgs(SelectedMeido));
         }
 
         private void OnUpdateMeido(object sender, MeidoUpdateEventArgs args)
         {
-            if (!args.IsEmpty) this.SelectedMeido = args.SelectedMeido;
-            this.UpdateMeido?.Invoke(ActiveMeido, args);
+            if (!args.IsEmpty) SelectedMeido = args.SelectedMeido;
+            UpdateMeido?.Invoke(ActiveMeido, args);
         }
 
         private void OnEndCallMeidos(object sender, EventArgs args)
@@ -235,22 +235,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     public class MeidoUpdateEventArgs : EventArgs
     {
         public static new MeidoUpdateEventArgs Empty { get; } = new MeidoUpdateEventArgs(-1);
-        public bool IsEmpty
-        {
-            get
-            {
-                return (this == MeidoUpdateEventArgs.Empty) ||
-                    (this.SelectedMeido == -1 && !this.FromMeido && this.IsBody);
-            }
-        }
+        public bool IsEmpty => (this == Empty) || (SelectedMeido == -1 && !FromMeido && IsBody);
         public int SelectedMeido { get; }
         public bool IsBody { get; }
         public bool FromMeido { get; }
         public MeidoUpdateEventArgs(int meidoIndex = -1, bool fromMaid = false, bool isBody = true)
         {
-            this.SelectedMeido = meidoIndex;
-            this.IsBody = isBody;
-            this.FromMeido = fromMaid;
+            SelectedMeido = meidoIndex;
+            IsBody = isBody;
+            FromMeido = fromMaid;
         }
     }
 }

+ 33 - 36
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/MessageWindowManager.cs

@@ -8,39 +8,39 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public const string header = "TEXTBOX";
         public static readonly SliderProp fontBounds = new SliderProp(25f, 60f);
         private static GameObject sysRoot;
-        private MessageClass msgClass;
-        private MessageWindowMgr msgWnd;
-        private UILabel msgLabel;
-        private UILabel nameLabel;
-        private GameObject msgGameObject;
+        private readonly MessageClass msgClass;
+        private readonly MessageWindowMgr msgWnd;
+        private readonly UILabel msgLabel;
+        private readonly UILabel nameLabel;
+        private readonly GameObject msgGameObject;
         public bool ShowingMessage { get; private set; }
         private string messageName;
         private string messageText;
 
-        static MessageWindowManager() => InputManager.Register(MpsKey.ToggleMessage, KeyCode.M, "Show/hide message box");
+        static MessageWindowManager()
+        {
+            InputManager.Register(MpsKey.ToggleMessage, KeyCode.M, "Show/hide message box");
+        }
 
         public MessageWindowManager()
         {
             sysRoot = GameObject.Find("__GameMain__/SystemUI Root");
-            this.msgWnd = GameMain.Instance.MsgWnd;
-            this.msgGameObject = sysRoot.transform.Find("MessageWindowPanel").gameObject;
-            this.msgClass = new MessageClass(this.msgGameObject, this.msgWnd);
-            this.nameLabel = UTY.GetChildObject(this.msgGameObject, "MessageViewer/MsgParent/SpeakerName/Name", false)
+            msgWnd = GameMain.Instance.MsgWnd;
+            msgGameObject = sysRoot.transform.Find("MessageWindowPanel").gameObject;
+            msgClass = new MessageClass(msgGameObject, msgWnd);
+            nameLabel = UTY.GetChildObject(msgGameObject, "MessageViewer/MsgParent/SpeakerName/Name", false)
                 .GetComponent<UILabel>();
-            this.msgLabel = UTY.GetChildObject(this.msgGameObject, "MessageViewer/MsgParent/Message", false)
+            msgLabel = UTY.GetChildObject(msgGameObject, "MessageViewer/MsgParent/Message", false)
                 .GetComponent<UILabel>();
-            Utility.SetFieldValue<MessageClass, UILabel>(this.msgClass, "message_label_", this.msgLabel);
-            Utility.SetFieldValue<MessageClass, UILabel>(this.msgClass, "name_label_", this.nameLabel);
+            Utility.SetFieldValue(msgClass, "message_label_", msgLabel);
+            Utility.SetFieldValue(msgClass, "name_label_", nameLabel);
         }
 
-        public void Activate()
-        {
-            SetPhotoMessageWindowActive(true);
-        }
+        public void Activate() => SetPhotoMessageWindowActive(true);
 
         public void Deactivate()
         {
-            this.msgWnd.CloseMessageWindowPanel();
+            msgWnd.CloseMessageWindowPanel();
             SetPhotoMessageWindowActive(false);
         }
 
@@ -48,7 +48,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             binaryWriter.Write(header);
             binaryWriter.Write(ShowingMessage);
-            binaryWriter.Write(this.msgLabel.fontSize);
+            binaryWriter.Write(msgLabel.fontSize);
             binaryWriter.WriteNullableString(messageName);
             binaryWriter.WriteNullableString(messageText);
         }
@@ -57,7 +57,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             CloseMessagePanel();
             bool showingMessage = binaryReader.ReadBoolean();
-            this.msgLabel.fontSize = binaryReader.ReadInt32();
+            msgLabel.fontSize = binaryReader.ReadInt32();
             messageName = binaryReader.ReadNullableString();
             messageText = binaryReader.ReadNullableString();
             if (showingMessage) ShowMessage(messageName, messageText);
@@ -67,12 +67,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void SetPhotoMessageWindowActive(bool active)
         {
-            UTY.GetChildObject(this.msgGameObject, "MessageViewer/MsgParent/MessageBox", false)
+            UTY.GetChildObject(msgGameObject, "MessageViewer/MsgParent/MessageBox", false)
                 .SetActive(active);
-            UTY.GetChildObject(this.msgGameObject, "MessageViewer/MsgParent/Hitret", false)
+            UTY.GetChildObject(msgGameObject, "MessageViewer/MsgParent/Hitret", false)
                 .GetComponent<UISprite>().enabled = !active;
-            this.nameLabel.gameObject.SetActive(active);
-            this.msgLabel.gameObject.SetActive(active);
+            nameLabel.gameObject.SetActive(active);
+            msgLabel.gameObject.SetActive(active);
 
             Transform transform = sysRoot.transform.Find("MessageWindowPanel/MessageViewer/MsgParent/Buttons");
             MessageWindowMgr.MessageWindowUnderButton[] msgButtons = new[]
@@ -87,10 +87,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 transform.Find(msgButton.ToString()).gameObject.SetActive(!active);
             }
-            if (this.msgClass.subtitles_manager_ != null)
+            if (msgClass.subtitles_manager_ != null)
             {
-                this.msgClass.subtitles_manager_.visible = false;
-                this.msgClass.subtitles_manager_ = null;
+                msgClass.subtitles_manager_.visible = false;
+                msgClass.subtitles_manager_ = null;
             }
         }
 
@@ -99,21 +99,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             messageName = name;
             messageText = message;
             ShowingMessage = true;
-            this.msgWnd.OpenMessageWindowPanel();
-            this.msgLabel.ProcessText();
-            this.msgClass.SetText(name, message, "", 0, AudioSourceMgr.Type.System);
-            this.msgClass.FinishChAnime();
+            msgWnd.OpenMessageWindowPanel();
+            msgLabel.ProcessText();
+            msgClass.SetText(name, message, "", 0, AudioSourceMgr.Type.System);
+            msgClass.FinishChAnime();
         }
 
-        public void SetFontSize(int fontSize)
-        {
-            this.msgLabel.fontSize = fontSize;
-        }
+        public void SetFontSize(int fontSize) => msgLabel.fontSize = fontSize;
 
         public void CloseMessagePanel()
         {
             ShowingMessage = false;
-            this.msgWnd.CloseMessageWindowPanel();
+            msgWnd.CloseMessageWindowPanel();
         }
     }
 }

+ 11 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/PropManager.cs

@@ -15,7 +15,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public const int propDataVersion = 1000;
         private static readonly ConfigEntry<bool> modItemsOnly;
         public static bool ModItemsOnly => modItemsOnly.Value;
-        private MeidoManager meidoManager;
+        private readonly MeidoManager meidoManager;
         private static bool cubeActive = true;
         public static bool CubeActive
         {
@@ -44,7 +44,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         }
         private static event EventHandler CubeActiveChange;
         private static event EventHandler CubeSmallChange;
-        private List<DragPointDogu> doguList = new List<DragPointDogu>();
+        private readonly List<DragPointDogu> doguList = new List<DragPointDogu>();
         public int DoguCount => doguList.Count;
         public event EventHandler DoguListChange;
         public event EventHandler DoguSelectChange;
@@ -303,9 +303,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     MeshRenderer[] meshRenderers = dogu.GetComponentsInChildren<MeshRenderer>();
                     for (int i = 0; i < meshRenderers.Length; i++)
                     {
-                        if (meshRenderers[i] != null
-                            && meshRenderers[i].gameObject.name.ToLower().IndexOf("castshadow") < 0
-                        ) meshRenderers[i].shadowCastingMode = ShadowCastingMode.Off;
+                        if (meshRenderers[i])
+                        {
+                            string name = meshRenderers[i].gameObject.name;
+                            if (name.IndexOf("castshadow", StringComparison.OrdinalIgnoreCase) < 0)
+                            {
+                                meshRenderers[i].shadowCastingMode = ShadowCastingMode.Off;
+                            }
+                        }
                     }
 
                     Collider collider = dogu.transform.GetComponent<Collider>();
@@ -365,7 +370,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private bool SpawnFromAssetString(string assetName, Dictionary<string, string> modDict = null)
         {
-            bool result = false;
+            bool result;
             if (assetName.EndsWith(".menu"))
             {
                 if (assetName.Contains('#'))

+ 17 - 33
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/SceneManager.cs

@@ -10,12 +10,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     using Input = InputManager;
     internal class SceneManager : IManager
     {
-        public static bool Busy { get; private set; } = false;
-        public bool Initialized { get; private set; } = false;
-        private MeidoPhotoStudio meidoPhotoStudio;
-        private SceneModalWindow sceneModal;
+        public static bool Busy { get; private set; }
+        public bool Initialized { get; private set; }
+        public static readonly Vector2 sceneDimensions = new Vector2(480, 270);
+        private readonly MeidoPhotoStudio meidoPhotoStudio;
         private int SortDirection => SortDescending ? -1 : 1;
-        public static Vector2 sceneDimensions = new Vector2(480, 270);
         public bool KankyoMode { get; set; } = false;
         private static readonly ConfigEntry<bool> sortDescending;
         public bool SortDescending
@@ -23,7 +22,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => sortDescending.Value;
             set => sortDescending.Value = value;
         }
-        public List<Scene> SceneList { get; private set; } = new List<Scene>();
+        public List<Scene> SceneList { get; } = new List<Scene>();
         public int CurrentDirectoryIndex { get; private set; } = -1;
         public string CurrentDirectoryName => CurrentDirectoryList[CurrentDirectoryIndex];
         public List<string> CurrentDirectoryList
@@ -42,14 +41,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             private set => currentSortMode.Value = value;
         }
         public int CurrentSceneIndex { get; private set; } = -1;
-        public Scene CurrentScene
-        {
-            get
-            {
-                if (SceneList.Count == 0) return null;
-                return SceneList[CurrentSceneIndex];
-            }
-        }
+        public Scene CurrentScene => SceneList.Count == 0 ? null : SceneList[CurrentSceneIndex];
         public enum SortMode
         {
             Name, DateCreated, DateModified
@@ -57,13 +49,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         static SceneManager()
         {
-            sortDescending = Configuration.Config.Bind<bool>(
+            sortDescending = Configuration.Config.Bind(
                 "SceneManager", "SortDescending",
                 false,
                 "Sort scenes descending (Z-A)"
             );
 
-            currentSortMode = Configuration.Config.Bind<SortMode>(
+            currentSortMode = Configuration.Config.Bind(
                 "SceneManager", "SortMode",
                 SortMode.Name,
                 "Scene sorting mode"
@@ -74,11 +66,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Input.Register(MpsKey.LoadScene, KeyCode.A, "Load quick saved scene");
         }
 
-        public SceneManager(MeidoPhotoStudio meidoPhotoStudio)
-        {
-            this.meidoPhotoStudio = meidoPhotoStudio;
-            this.sceneModal = new SceneModalWindow(this);
-        }
+        public SceneManager(MeidoPhotoStudio meidoPhotoStudio) => this.meidoPhotoStudio = meidoPhotoStudio;
 
         public void Activate() { }
 
@@ -104,10 +92,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void DeleteDirectory()
         {
-            if (Directory.Exists(CurrentScenesDirectory))
-            {
-                Directory.Delete(CurrentScenesDirectory, true);
-            }
+            if (Directory.Exists(CurrentScenesDirectory)) Directory.Delete(CurrentScenesDirectory, true);
 
             CurrentDirectoryList.RemoveAt(CurrentDirectoryIndex);
             CurrentDirectoryIndex = Mathf.Clamp(CurrentDirectoryIndex, 0, CurrentDirectoryList.Count - 1);
@@ -118,7 +103,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public void ToggleKankyoMode()
         {
-            this.KankyoMode = !this.KankyoMode;
+            KankyoMode = !KankyoMode;
             CurrentDirectoryIndex = 0;
             UpdateSceneList();
         }
@@ -189,6 +174,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 case SortMode.DateModified: comparator = SortByDateModified; break;
                 case SortMode.DateCreated: comparator = SortByDateCreated; break;
+                case SortMode.Name: comparator = SortByName; break;
                 default: comparator = SortByName; break;
             }
             SceneList.Sort(comparator);
@@ -248,8 +234,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             string baseDirectoryName = KankyoMode ? Constants.kankyoDirectory : Constants.sceneDirectory;
             CurrentDirectoryList.Sort((a, b) =>
             {
-                if (a.Equals(baseDirectoryName, StringComparison.InvariantCultureIgnoreCase)) return -1;
-                else return a.CompareTo(b);
+                return a.Equals(baseDirectoryName, StringComparison.InvariantCultureIgnoreCase) ? -1 : a.CompareTo(b);
             });
         }
 
@@ -289,7 +274,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 while (!File.Exists(screenshotPath));
 
                 string scenePrefix = KankyoMode ? "mpskankyo" : "mpsscene";
-                string fileName = $"{scenePrefix}{System.DateTime.Now:yyyyMMddHHmmss}.png";
+                string fileName = $"{scenePrefix}{DateTime.Now:yyyyMMddHHmmss}.png";
                 string savePath = Path.Combine(CurrentScenesDirectory, fileName);
 
                 if (overwrite && CurrentScene != null)
@@ -301,8 +286,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 Texture2D screenshot = new Texture2D(1, 1, TextureFormat.ARGB32, false);
                 screenshot.LoadImage(File.ReadAllBytes(screenshotPath));
 
-                int sceneWidth = (int)SceneManager.sceneDimensions.x;
-                int sceneHeight = (int)SceneManager.sceneDimensions.y;
+                int sceneWidth = (int)sceneDimensions.x;
+                int sceneHeight = (int)sceneDimensions.y;
                 Utility.ResizeToFit(screenshot, sceneWidth, sceneHeight);
 
                 using (FileStream fileStream = File.Create(savePath))
@@ -323,7 +308,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
                 SceneList.Add(new Scene(savePath));
                 SortScenes(CurrentSortMode);
-
             }
 
             Busy = false;
@@ -332,7 +316,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public class Scene
         {
             public const int initialNumberOfMaids = -2;
-            public Texture2D Thumbnail { get; private set; }
+            public Texture2D Thumbnail { get; }
             public FileInfo FileInfo { get; set; }
             public int NumberOfMaids { get; private set; } = initialNumberOfMaids;
 

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Managers/WindowManager.cs

@@ -6,7 +6,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     using static Constants;
     internal class WindowManager : IManager
     {
-        private Dictionary<Window, BaseWindow> Windows = new Dictionary<Window, BaseWindow>();
+        private readonly Dictionary<Window, BaseWindow> Windows = new Dictionary<Window, BaseWindow>();
         public BaseWindow this[Window id]
         {
             get => Windows[id];

+ 9 - 9
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointChain.cs

@@ -6,8 +6,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class DragPointChain : DragPointMeido
     {
         private readonly TBody.IKCMO IK = new TBody.IKCMO();
+        private readonly Quaternion[] jointRotation = new Quaternion[3];
         private Transform[] ikChain;
-        private Quaternion[] jointRotation = new Quaternion[3];
         private int foot = 1;
         private bool isLower = false;
         private bool isMiddle = false;
@@ -17,17 +17,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void Set(Transform lower)
         {
             base.Set(lower);
-            this.isMune = lower.name.StartsWith("Mune");
-            this.foot = lower.name.EndsWith("Foot") ? -1 : 1;
-            this.isLower = lower.name.EndsWith("Hand") || foot == -1;
-            this.isMiddle = lower.name.EndsWith("Calf") || lower.name.EndsWith("Forearm");
-            this.isUpper = !(isMiddle || isLower) && !isMune;
-            this.ikChain = new Transform[] {
+            isMune = lower.name.StartsWith("Mune");
+            foot = lower.name.EndsWith("Foot") ? -1 : 1;
+            isLower = lower.name.EndsWith("Hand") || foot == -1;
+            isMiddle = lower.name.EndsWith("Calf") || lower.name.EndsWith("Forearm");
+            isUpper = !(isMiddle || isLower) && !isMune;
+            ikChain = new Transform[] {
                 lower.parent,
                 lower.parent,
                 lower
             };
-            if (this.isLower) ikChain[0] = ikChain[0].parent;
+            if (isLower) ikChain[0] = ikChain[0].parent;
         }
 
         private void InitializeRotation()
@@ -65,7 +65,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 if (isLower) ApplyProperties(true, isBone, false);
                 else ApplyProperties();
             }
-            else ApplyProperties(!isMune, (isBone && !isMune), false);
+            else ApplyProperties(!isMune, isBone && !isMune, false);
         }
 
         protected override void UpdateDragType()

+ 3 - 3
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointFinger.cs

@@ -6,8 +6,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class DragPointFinger : DragPointMeido
     {
         private readonly TBody.IKCMO IK = new TBody.IKCMO();
+        private readonly Quaternion[] jointRotation = new Quaternion[2];
         private Transform[] ikChain;
-        private Quaternion[] jointRotation = new Quaternion[2];
         private bool baseFinger;
         private static readonly Color dragpointColour = new Color(0.1f, 0.4f, 0.95f, defaultAlpha);
 
@@ -16,8 +16,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             base.Set(finger);
             string parentName = finger.parent.name.Split(' ')[2];
             // Base finger names have the form 'FingerN' or 'ToeN' where N is a natural number
-            this.baseFinger = (parentName.Length == 7) || (parentName.Length == 4);
-            this.ikChain = new Transform[2] {
+            baseFinger = (parentName.Length == 7) || (parentName.Length == 4);
+            ikChain = new Transform[2] {
                 finger.parent,
                 finger
             };

+ 8 - 15
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointHead.cs

@@ -6,19 +6,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     using Input = InputManager;
     internal class DragPointHead : DragPointMeido
     {
-        TBody body;
         private Quaternion headRotation;
         private Vector3 eyeRotationL;
         private Vector3 eyeRotationR;
         public event EventHandler Select;
         public bool IsIK { get; set; }
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
-            this.body = this.maid.body0;
-        }
-
         protected override void ApplyDragType()
         {
             if (IsBone)
@@ -62,16 +55,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             headRotation = MyObject.rotation;
 
-            eyeRotationL = body.quaDefEyeL.eulerAngles;
-            eyeRotationR = body.quaDefEyeR.eulerAngles;
+            eyeRotationL = meido.Body.quaDefEyeL.eulerAngles;
+            eyeRotationR = meido.Body.quaDefEyeR.eulerAngles;
         }
 
         protected override void OnDoubleClick()
         {
             if (CurrentDragType == DragType.MoveXZ || CurrentDragType == DragType.MoveY)
             {
-                body.quaDefEyeL = this.meido.DefaultEyeRotL;
-                body.quaDefEyeR = this.meido.DefaultEyeRotR;
+                meido.Body.quaDefEyeL = meido.DefaultEyeRotL;
+                meido.Body.quaDefEyeR = meido.DefaultEyeRotR;
             }
             else if (CurrentDragType == DragType.RotLocalY || CurrentDragType == DragType.RotLocalXZ)
             {
@@ -107,11 +100,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 int inv = CurrentDragType == DragType.MoveY ? -1 : 1;
 
-                body.quaDefEyeL.eulerAngles = new Vector3(
-                    eyeRotationL.x, eyeRotationL.y - mouseDelta.x / 10f, eyeRotationL.z - mouseDelta.y / 10f
+                meido.Body.quaDefEyeL.eulerAngles = new Vector3(
+                    eyeRotationL.x, eyeRotationL.y - (mouseDelta.x / 10f), eyeRotationL.z - (mouseDelta.y / 10f)
                 );
-                body.quaDefEyeR.eulerAngles = new Vector3(
-                    eyeRotationR.x, eyeRotationR.y + inv * mouseDelta.x / 10f, eyeRotationR.z + mouseDelta.y / 10f
+                meido.Body.quaDefEyeR.eulerAngles = new Vector3(
+                    eyeRotationR.x, eyeRotationR.y + (inv * mouseDelta.x / 10f), eyeRotationR.z + (mouseDelta.y / 10f)
                 );
             }
         }

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointSpine.cs

@@ -13,7 +13,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void AddGizmo(float scale = 0.25f, CustomGizmo.GizmoMode mode = CustomGizmo.GizmoMode.Local)
         {
             base.AddGizmo(scale, mode);
-            if (isHead) this.Gizmo.GizmoDrag += (s, a) => meido.HeadToCam = false;
+            if (isHead) Gizmo.GizmoDrag += (s, a) => meido.HeadToCam = false;
         }
 
         public override void Set(Transform spine)

+ 2 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/IK/DragPointTorso.cs

@@ -7,8 +7,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     {
         private static readonly float[] blah = new[] { 0.03f, 0.1f, 0.09f, 0.07f };
         private static readonly float[] something = new[] { 0.08f, 0.15f };
-        private Transform[] spine = new Transform[4];
-        private Quaternion[] spineRotation = new Quaternion[4];
+        private readonly Quaternion[] spineRotation = new Quaternion[4];
+        private readonly Transform[] spine = new Transform[4];
 
         public override void Set(Transform spine1a)
         {

+ 19 - 21
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/Meido.cs

@@ -44,10 +44,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         }
         public event EventHandler<MeidoUpdateEventArgs> UpdateMeido;
         public int StockNo { get; }
-        public Maid Maid { get; private set; }
+        public Maid Maid { get; }
         public TBody Body => Maid.body0;
-        public MeidoDragPointManager IKManager { get; private set; }
-        public Texture2D Portrait { get; private set; }
+        public MeidoDragPointManager IKManager { get; }
+        public Texture2D Portrait { get; }
         public PoseInfo CachedPose { get; private set; } = DefaultPose;
         public string CurrentFaceBlendSet { get; private set; } = defaultFaceBlendSet;
         public int Slot { get; private set; }
@@ -67,15 +67,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             get => freeLook;
             set
             {
-                if (this.freeLook == value) return;
-                this.freeLook = value;
-                Body.trsLookTarget = this.freeLook ? null : GameMain.Instance.MainCamera.transform;
+                if (freeLook == value) return;
+                freeLook = value;
+                Body.trsLookTarget = freeLook ? null : GameMain.Instance.MainCamera.transform;
                 OnUpdateMeido();
             }
         }
         public bool HeadToCam
         {
-            get => !Body.isLoadedBody ? false : Body.boHeadToCam;
+            get => Body.isLoadedBody && Body.boHeadToCam;
             set
             {
                 if (!Body.isLoadedBody || HeadToCam == value) return;
@@ -87,7 +87,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         }
         public bool EyeToCam
         {
-            get => !Body.isLoadedBody ? false : Body.boEyeToCam;
+            get => Body.isLoadedBody && Body.boEyeToCam;
             set
             {
                 if (!Body.isLoadedBody || EyeToCam == value) return;
@@ -113,7 +113,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     {
                         Body.boEyeToCam = true;
                         Body.boHeadToCam = true;
-                        this.SetPose(this.CachedPose.Pose);
+                        SetPose(CachedPose.Pose);
                     }
                     OnUpdateMeido();
                 }
@@ -168,11 +168,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public Meido(int stockMaidIndex)
         {
-            this.StockNo = stockMaidIndex;
-            this.Maid = GameMain.Instance.CharacterMgr.GetStockMaid(stockMaidIndex);
-            this.Portrait = Maid.GetThumIcon();
+            StockNo = stockMaidIndex;
+            Maid = GameMain.Instance.CharacterMgr.GetStockMaid(stockMaidIndex);
+            Portrait = Maid.GetThumIcon();
             IKManager = new MeidoDragPointManager(this);
-            IKManager.SelectMaid += (s, args) => OnUpdateMeido((MeidoUpdateEventArgs)args);
+            IKManager.SelectMaid += (s, args) => OnUpdateMeido(args);
         }
 
         public void BeginLoad()
@@ -476,7 +476,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Maid.AllProcProp();
         }
 
-        public void DetachAllMpnAttach(bool unload = false)
+        public void DetachAllMpnAttach()
         {
             Maid.ResetProp(MPN.kousoku_lower, false);
             Maid.ResetProp(MPN.kousoku_upper, false);
@@ -504,11 +504,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private CacheBoneDataArray GetCacheBoneData()
         {
-            CacheBoneDataArray cache = this.Maid.gameObject.GetComponent<CacheBoneDataArray>();
+            CacheBoneDataArray cache = Maid.gameObject.GetComponent<CacheBoneDataArray>();
             if (cache == null)
             {
-                cache = this.Maid.gameObject.AddComponent<CacheBoneDataArray>();
-                cache.CreateCache(this.Maid.body0.GetBone("Bip01"));
+                cache = Maid.gameObject.AddComponent<CacheBoneDataArray>();
+                cache.CreateCache(Body.GetBone("Bip01"));
             }
             return cache;
         }
@@ -576,15 +576,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Transform gravityTransform = Maid.gameObject.transform.Find(gravityGoName);
             if (gravityTransform == null)
             {
-                GameObject go = new GameObject();
-                go.name = gravityGoName;
+                GameObject go = new GameObject(gravityGoName);
                 go.transform.SetParent(bone, false);
                 go.transform.SetParent(Maid.transform, true);
                 go.transform.localScale = Vector3.one;
                 go.transform.rotation = Quaternion.identity;
-                GameObject go2 = new GameObject();
+                GameObject go2 = new GameObject(gravityGoName);
                 go2.transform.SetParent(go.transform, false);
-                go2.name = gravityGoName;
                 gravityTransform = go2.transform;
             }
             else

+ 15 - 15
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Meido/MeidoDragPointManager.cs

@@ -92,12 +92,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         }
         private static EventHandler CubeActiveChange;
         private static EventHandler CubeSmallChange;
-        private bool initialized = false;
-        private Meido meido;
+        private readonly Meido meido;
+        private readonly Dictionary<Bone, DragPointMeido> DragPoints = new Dictionary<Bone, DragPointMeido>();
         private Dictionary<Bone, Transform> BoneTransform = new Dictionary<Bone, Transform>();
-        private Dictionary<Bone, DragPointMeido> DragPoints = new Dictionary<Bone, DragPointMeido>();
         private DragPointBody dragBody;
         private DragPointBody dragCube;
+        private bool initialized = false;
         public event EventHandler<MeidoUpdateEventArgs> SelectMaid;
         private bool isBone = false;
         public bool IsBone
@@ -244,31 +244,31 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             Bone start = right ? Bone.Finger0R : Bone.Finger0L;
             Bone end = right ? Bone.Finger4R : Bone.Finger4L;
-            return SerializeFinger(start, end, right);
+            return SerializeFinger(start, end);
         }
 
         public void DeserializeHand(byte[] handBinary, bool right, bool mirroring = false)
         {
             Bone start = right ? Bone.Finger0R : Bone.Finger0L;
             Bone end = right ? Bone.Finger4R : Bone.Finger4L;
-            DeserializeFinger(start, end, handBinary, right, mirroring);
+            DeserializeFinger(start, end, handBinary, mirroring);
         }
 
         public byte[] SerializeFoot(bool right)
         {
             Bone start = right ? Bone.Toe0R : Bone.Toe0L;
             Bone end = right ? Bone.Toe2R : Bone.Toe2L;
-            return SerializeFinger(start, end, right);
+            return SerializeFinger(start, end);
         }
 
         public void DeserializeFoot(byte[] footBinary, bool right, bool mirroring = false)
         {
             Bone start = right ? Bone.Toe0R : Bone.Toe0L;
             Bone end = right ? Bone.Toe2R : Bone.Toe2L;
-            DeserializeFinger(start, end, footBinary, right, mirroring);
+            DeserializeFinger(start, end, footBinary, mirroring);
         }
 
-        private byte[] SerializeFinger(Bone start, Bone end, bool right)
+        private byte[] SerializeFinger(Bone start, Bone end)
         {
             int joints = BoneTransform[start].name.Split(' ')[2].StartsWith("Finger") ? 4 : 3;
 
@@ -290,7 +290,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             return buf;
         }
 
-        private void DeserializeFinger(Bone start, Bone end, byte[] fingerBinary, bool right, bool mirroring = false)
+        private void DeserializeFinger(Bone start, Bone end, byte[] fingerBinary, bool mirroring = false)
         {
             int joints = BoneTransform[start].name.Split(' ')[2].StartsWith("Finger") ? 4 : 3;
 
@@ -379,7 +379,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             dragNeck.Initialize(meido,
                 () => new Vector3(
                     BoneTransform[Bone.Head].position.x,
-                    (BoneTransform[Bone.Head].position.y * 1.2f + BoneTransform[Bone.HeadNub].position.y * 0.8f) / 2f,
+                    ((BoneTransform[Bone.Head].position.y * 1.2f) + (BoneTransform[Bone.HeadNub].position.y * 0.8f)) / 2f,
                     BoneTransform[Bone.Head].position.z
                 ),
                 () => new Vector3(
@@ -555,7 +555,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void OnSetDragPointScale(object sender, EventArgs args)
         {
-            this.SetDragPointScale(meido.Maid.transform.localScale.x);
+            SetDragPointScale(meido.Maid.transform.localScale.x);
         }
 
         private void OnSelectBody(object sender, EventArgs args)
@@ -685,9 +685,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public AttachPointInfo(AttachPoint attachPoint, string maidGuid, int maidIndex)
         {
-            this.AttachPoint = attachPoint;
-            this.MaidGuid = maidGuid;
-            this.MaidIndex = maidIndex;
+            AttachPoint = attachPoint;
+            MaidGuid = maidGuid;
+            MaidIndex = maidIndex;
         }
 
         public void Serialize(BinaryWriter binaryWriter)
@@ -700,7 +700,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             return new AttachPointInfo(
                 (AttachPoint)binaryReader.ReadInt32(),
-                String.Empty,
+                string.Empty,
                 binaryReader.ReadInt32()
             );
         }

+ 6 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MeidoPhotoStudio.cs

@@ -13,7 +13,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     [BepInPlugin(pluginGuid, pluginName, pluginVersion)]
     public class MeidoPhotoStudio : BaseUnityPlugin
     {
-        private static CameraMain mainCamera = GameMain.Instance.MainCamera;
+        private static readonly CameraMain mainCamera = GameMain.Instance.MainCamera;
         private static event EventHandler<ScreenshotEventArgs> ScreenshotEvent;
         private const string pluginGuid = "com.habeebweeb.com3d2.meidophotostudio";
         public const string pluginName = "MeidoPhotoStudio";
@@ -258,7 +258,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             sysShortcut.SetActive(false);
             uiActive = false;
 
-            List<Meido> activeMeidoList = this.meidoManager.ActiveMeidoList;
+            List<Meido> activeMeidoList = meidoManager.ActiveMeidoList;
             bool[] isIK = new bool[activeMeidoList.Count];
             bool[] isVisible = new bool[activeMeidoList.Count];
             for (int i = 0; i < activeMeidoList.Count; i++)
@@ -347,7 +347,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             initialized = true;
 
             meidoManager = new MeidoManager();
-            environmentManager = new EnvironmentManager(meidoManager);
+            environmentManager = new EnvironmentManager();
             messageWindowManager = new MessageWindowManager();
             lightManager = new LightManager();
             propManager = new PropManager(meidoManager);
@@ -408,7 +408,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             SystemDialog sysDialog = GameMain.Instance.SysDlg;
 
-            SystemDialog.OnClick exit = () =>
+            void exit()
             {
                 sysDialog.Close();
                 ResetCalcNearClip();
@@ -420,14 +420,14 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 effectManager.Deactivate();
                 messageWindowManager.Deactivate();
                 windowManager.Deactivate();
-                InputManager.Deactivate();
+                Input.Deactivate();
 
                 Modal.Close();
 
                 GameObject dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
                 dailyPanel?.SetActive(true);
                 Configuration.Config.Save();
-            };
+            }
 
             if (force || sysDialog.IsDecided)
             {

+ 2 - 2
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MenuFileCache.cs

@@ -13,7 +13,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     {
         private const int cacheVersion = 765;
         public static readonly string cachePath = Path.Combine(Constants.configPath, "cache.dat");
-        private Dictionary<string, ModItem> modItems;
+        private readonly Dictionary<string, ModItem> modItems;
         private bool rebuild = false;
         public ModItem this[string menu]
         {
@@ -45,7 +45,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 if (binaryReader.ReadInt32() != cacheVersion)
                 {
-                    Utility.LogInfo($"Cache version out of date. Rebuilding");
+                    Utility.LogInfo("Cache version out of date. Rebuilding");
                     return;
                 }
                 while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)

+ 33 - 69
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MenuFileUtility.cs

@@ -56,18 +56,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 binaryReader.ReadString(); // description
                 binaryReader.ReadInt32(); // idk (as long)
 
-                string menuPropString = String.Empty;
-                string menuPropStringTemp = String.Empty;
-                // string tempString3 = String.Empty;
-                // string slotName = String.Empty;
+                string menuPropString = string.Empty;
+                string menuPropStringTemp = string.Empty;
 
                 try
                 {
                     while (true)
                     {
-                        int numberOfProps = (int)binaryReader.ReadByte();
+                        int numberOfProps = binaryReader.ReadByte();
                         menuPropStringTemp = menuPropString;
-                        menuPropString = String.Empty;
+                        menuPropString = string.Empty;
 
                         if (numberOfProps != 0)
                         {
@@ -81,26 +79,17 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                                 string header = UTY.GetStringCom(menuPropString);
                                 string[] menuProps = UTY.GetStringList(menuPropString);
 
-                                if (header == "end")
-                                {
-                                    break;
-                                }
+                                if (header == "end") break;
                                 else if (header == "マテリアル変更")
                                 {
                                     int matNo = int.Parse(menuProps[2]);
                                     string materialFile = menuProps[3];
                                     modelInfo.MaterialChanges.Add(new MaterialChange(matNo, materialFile));
                                 }
-                                else if (header == "additem")
-                                {
-                                    modelInfo.ModelFile = menuProps[1];
-                                }
+                                else if (header == "additem") modelInfo.ModelFile = menuProps[1];
                             }
                         }
-                        else
-                        {
-                            break;
-                        }
+                        else break;
                     }
                 }
                 catch
@@ -148,7 +137,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             using (StringReader stringReader = new StringReader(s))
             {
                 IMode mode = IMode.None;
-                string slotname = String.Empty;
                 Material material = null;
                 int num3 = 0;
                 string line;
@@ -157,21 +145,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 {
                     string[] array = line.Split(new[] { '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
 
-                    if (array[0] == "アイテム変更" || array[0] == "マテリアル変更")
-                    {
-                        mode = IMode.ItemChange;
-                    }
-                    else if (array[0] == "テクスチャ変更")
-                    {
-                        mode = IMode.TexChange;
-                    }
+                    if (array[0] == "アイテム変更" || array[0] == "マテリアル変更") mode = IMode.ItemChange;
+                    else if (array[0] == "テクスチャ変更") mode = IMode.TexChange;
                     if (mode == IMode.ItemChange)
                     {
-                        if (array[0] == "スロット名")
-                        {
-                            slotname = array[1];
-                            change = true;
-                        }
+                        if (array[0] == "スロット名") change = true;
                         if (change)
                         {
                             if (array[0] == "マテリアル番号")
@@ -180,7 +158,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                                 foreach (Transform transform in go.GetComponentsInChildren<Transform>(true))
                                 {
                                     Renderer component = transform.GetComponent<Renderer>();
-                                    if (component != null && component.materials != null)
+                                    if (component && component.materials != null)
                                     {
                                         Material[] materials = component.materials;
                                         for (int k = 0; k < materials.Length; k++)
@@ -211,10 +189,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                                         )
                                     );
                                 }
-                                else if (array[0] == "数値設定")
-                                {
-                                    material.SetFloat(array[1], float.Parse(array[2]));
-                                }
+                                else if (array[0] == "数値設定") material.SetFloat(array[1], float.Parse(array[2]));
                             }
                         }
                     }
@@ -231,22 +206,19 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             int matno, string prop, string filename, Dictionary<string, byte[]> matDict, GameObject go
         )
         {
-            TextureResource textureResource = null;
+            TextureResource textureResource;
             byte[] buf = matDict[filename.ToLowerInvariant()];
             textureResource = new TextureResource(2, 2, TextureFormat.ARGB32, null, buf);
             List<Renderer> list = new List<Renderer>(3);
-            go.transform.GetComponentsInChildren<Renderer>(true, list);
+            go.transform.GetComponentsInChildren(true, list);
             foreach (Renderer r in list)
             {
-                if (r != null && r.material != null)
+                if (r && r.material && matno < r.materials.Length)
                 {
-                    if (matno < r.materials.Length)
-                    {
-                        r.materials[matno].SetTexture(prop, null);
-                        Texture2D texture2D = textureResource.CreateTexture2D();
-                        texture2D.name = filename;
-                        r.materials[matno].SetTexture(prop, texture2D);
-                    }
+                    r.materials[matno].SetTexture(prop, null);
+                    Texture2D texture2D = textureResource.CreateTexture2D();
+                    texture2D.name = filename;
+                    r.materials[matno].SetTexture(prop, texture2D);
                 }
             }
         }
@@ -259,7 +231,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 {
                     if (menuFileBuffer == null)
                     {
-                        menuFileBuffer = new byte[System.Math.Max(500000, afileBase.GetSize())];
+                        menuFileBuffer = new byte[Math.Max(500000, afileBase.GetSize())];
                     }
                     else if (menuFileBuffer.Length < afileBase.GetSize())
                     {
@@ -491,7 +463,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
             using (AFileBase afileBase = GameUty.FileOpen(menu))
             {
-                if (afileBase == null || !afileBase.IsValid())
+                if (afileBase?.IsValid() != true)
                 {
                     Utility.LogWarning($"Could not open menu file '{menu}'");
                     return null;
@@ -501,10 +473,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                     Utility.LogWarning($"Mod menu is empty '{menu}'");
                     return null;
                 }
-                else
-                {
-                    menuBuffer = afileBase.ReadAll();
-                }
+                else menuBuffer = afileBase.ReadAll();
             }
 
             ModelInfo modelInfo = new ModelInfo();
@@ -529,9 +498,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                         foreach (Transform transform in gameObject.transform.GetComponentsInChildren<Transform>(true))
                         {
                             Renderer renderer = transform.GetComponent<Renderer>();
-                            if (renderer != null && renderer.material != null
-                                && matChange.MaterialIndex < renderer.materials.Length
-                            )
+                            if (renderer && renderer.material && matChange.MaterialIndex < renderer.materials.Length)
                             {
                                 renderer.materials[matChange.MaterialIndex] = ImportCM.LoadMaterial(
                                     matChange.MaterialFile, null, renderer.materials[matChange.MaterialIndex]
@@ -540,10 +507,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                         }
                     }
 
-                    if (modItem.IsOfficialMod)
-                    {
-                        ProcModScriptBin(modMenuBuffer, gameObject);
-                    }
+                    if (modItem.IsOfficialMod) ProcModScriptBin(modMenuBuffer, gameObject);
                 }
 
                 return gameObject;
@@ -578,10 +542,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 using (AFileBase afileBase = GameUty.FileOpen(menuFile))
                 {
-                    if (afileBase == null || !afileBase.IsValid() || afileBase.GetSize() == 0) return false;
+                    if (afileBase?.IsValid() != true || afileBase.GetSize() == 0) return false;
                     if (menuFileBuffer == null)
                     {
-                        menuFileBuffer = new byte[System.Math.Max(500000, afileBase.GetSize())];
+                        menuFileBuffer = new byte[Math.Max(500000, afileBase.GetSize())];
                     }
                     else if (menuFileBuffer.Length < afileBase.GetSize())
                     {
@@ -609,16 +573,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
                 binaryReader.ReadString(); // description
                 binaryReader.ReadInt32(); // idk (as long)
 
-                string menuPropString = String.Empty;
-                string menuPropStringTemp = String.Empty;
+                string menuPropString = string.Empty;
+                string menuPropStringTemp = string.Empty;
 
                 try
                 {
                     while (true)
                     {
-                        int numberOfProps = (int)binaryReader.ReadByte();
+                        int numberOfProps = binaryReader.ReadByte();
                         menuPropStringTemp = menuPropString;
-                        menuPropString = String.Empty;
+                        menuPropString = string.Empty;
 
                         if (numberOfProps != 0)
                         {
@@ -848,10 +812,10 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             public int MaterialIndex { get; }
             public string MaterialFile { get; }
 
-            public MaterialChange(int matno, string matf)
+            public MaterialChange(int materialIndex, string materialFile)
             {
-                this.MaterialIndex = matno;
-                this.MaterialFile = matf;
+                MaterialIndex = materialIndex;
+                MaterialFile = materialFile;
             }
         }
     }

+ 5 - 10
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/MiscGUI.cs

@@ -7,9 +7,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public static readonly GUILayoutOption HalfSlider = GUILayout.Width(98);
         public static readonly Texture2D white = Utility.MakeTex(2, 2, Color.white);
         public static readonly Texture2D transparentBlack = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.8f));
-        private static GUIStyle lineStyleWhite;
-        private static GUIStyle lineStyleBlack;
-        private static GUIStyle textureBoxStyle;
+        private static readonly GUIStyle lineStyleWhite;
+        private static readonly GUIStyle lineStyleBlack;
+        private static readonly GUIStyle textureBoxStyle;
 
         static MiscGUI()
         {
@@ -37,16 +37,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             GUILayout.Box(texture, textureBoxStyle, layoutOptions);
         }
 
-        public static int ClampFont(int size, int min, int max)
-        {
-            return Mathf.Clamp(Utility.GetPix(size), min, max);
-        }
+        public static int ClampFont(int size, int min, int max) => Mathf.Clamp(Utility.GetPix(size), min, max);
 
         public static void Header(string text, params GUILayoutOption[] layoutOptions)
         {
-            GUIStyle style = new GUIStyle(GUI.skin.label);
-            style.padding = new RectOffset(7, 0, 0, -5);
-
+            GUIStyle style = new GUIStyle(GUI.skin.label) { padding = new RectOffset(7, 0, 0, -5) };
             GUILayout.Label(text, style, layoutOptions);
         }
     }

+ 3 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Translation.cs

@@ -21,7 +21,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         static Translation()
         {
-            currentLanguage = Configuration.Config.Bind<string>(
+            currentLanguage = Configuration.Config.Bind(
                 "Translation", "Language",
                 "en",
                 "Directory to pull translations from"
@@ -31,7 +31,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             Configuration.Config.ConfigReloaded += OnSettingChange;
         }
 
-        static void OnSettingChange(object sender, EventArgs args) => ReloadTranslation();
+        private static void OnSettingChange(object sender, EventArgs args) => ReloadTranslation();
 
         public static void Initialize(string language)
         {
@@ -93,10 +93,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         {
             if (!Translations.ContainsKey(category))
             {
-                if (warn)
-                {
-                    Utility.LogWarning($"Could not translate '{text}': category '{category}' was not found");
-                }
+                if (warn) Utility.LogWarning($"Could not translate '{text}': category '{category}' was not found");
                 return false;
             }
 

+ 32 - 34
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

@@ -3,6 +3,7 @@ using System.Text.RegularExpressions;
 using System.IO;
 using System.Reflection;
 using UnityEngine;
+using System.Linq;
 
 namespace COM3D2.MeidoPhotoStudio.Plugin
 {
@@ -32,25 +33,20 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public static int Wrap(int value, int min, int max)
         {
-            max -= 1;
+            max--;
             return value < min ? max : value > max ? min : value;
         }
 
-        public static int GetPix(int num)
-        {
-            return (int)((1f + (Screen.width / 1280f - 1f) * 0.6f) * num);
-        }
+        public static int GetPix(int num) => (int)((1f + (((Screen.width / 1280f) - 1f) * 0.6f)) * num);
 
         public static float Bound(float value, float left, float right)
         {
-            if ((double)left > (double)right) return Mathf.Clamp(value, right, left);
-            else return Mathf.Clamp(value, left, right);
+            return left > (double)right ? Mathf.Clamp(value, right, left) : Mathf.Clamp(value, left, right);
         }
 
         public static int Bound(int value, int left, int right)
         {
-            if (left > right) return Mathf.Clamp(value, right, left);
-            else return Mathf.Clamp(value, left, right);
+            return left > right ? Mathf.Clamp(value, right, left) : Mathf.Clamp(value, left, right);
         }
 
         public static Texture2D MakeTex(int width, int height, Color color)
@@ -68,15 +64,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         public static FieldInfo GetFieldInfo<T>(string field)
         {
-            BindingFlags bindingFlags = BindingFlags.Instance
-                | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
+            const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
+                | BindingFlags.Static;
             return typeof(T).GetField(field, bindingFlags);
         }
 
         public static TValue GetFieldValue<TType, TValue>(TType instance, string field)
         {
             FieldInfo fieldInfo = GetFieldInfo<TType>(field);
-            if (fieldInfo == null || !fieldInfo.IsStatic && instance == null) return default(TValue);
+            if (fieldInfo == null || (!fieldInfo.IsStatic && instance == null)) return default;
             return (TValue)fieldInfo.GetValue(instance);
         }
 
@@ -95,16 +91,13 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             string screenShotDir = Path.Combine(
                 GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "ScreenShot"
             );
-            if (!Directory.Exists(screenShotDir))
-            {
-                Directory.CreateDirectory(screenShotDir);
-            }
+            if (!Directory.Exists(screenShotDir)) Directory.CreateDirectory(screenShotDir);
             return Path.Combine(screenShotDir, $"img{DateTime.Now:yyyyMMddHHmmss}.png");
         }
 
         public static string TempScreenshotFilename()
         {
-            return Path.Combine(Path.GetTempPath(), $"cm3d2_{System.Guid.NewGuid().ToString()}.png");
+            return Path.Combine(Path.GetTempPath(), $"cm3d2_{Guid.NewGuid()}.png");
         }
 
         public static void ShowMouseExposition(string text, float time = 2f)
@@ -158,9 +151,9 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             int height = texture.height;
             if (width != maxWidth || height != maxHeight)
             {
-                float scale = Mathf.Min((float)maxWidth / (float)width, (float)maxHeight / (float)height);
-                width = Mathf.RoundToInt((float)width * scale);
-                height = Mathf.RoundToInt((float)height * scale);
+                float scale = Mathf.Min(maxWidth / (float)width, maxHeight / (float)height);
+                width = Mathf.RoundToInt(width * scale);
+                height = Mathf.RoundToInt(height * scale);
                 TextureScale.Bilinear(texture, width, height);
             }
         }
@@ -193,12 +186,18 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 stream.Read(buffer, 0, 4);
                 if (BitConverter.IsLittleEndian) Array.Reverse(buffer);
-                uint length = System.BitConverter.ToUInt32(buffer, 0);
+                uint length = BitConverter.ToUInt32(buffer, 0);
                 stream.Read(buffer, 0, 4);
                 stream.Seek(length + 4L, SeekOrigin.Current);
             } while (!BytesEqual(buffer, pngEnd));
             return true;
         }
+
+        public static void WriteToFile(string name, System.Collections.Generic.IEnumerable<string> list)
+        {
+            if (Path.GetExtension(name) != ".txt") name += ".txt";
+            File.WriteAllLines(Path.Combine(Constants.configPath, name), list.ToArray());
+        }
     }
 
     internal static class BinaryExtensions
@@ -214,21 +213,21 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             if (str != null) binaryWriter.Write(str);
         }
 
-        public static void WriteVector3(this BinaryWriter binaryWriter, UnityEngine.Vector3 vector3)
+        public static void WriteVector3(this BinaryWriter binaryWriter, Vector3 vector3)
         {
             binaryWriter.Write(vector3.x);
             binaryWriter.Write(vector3.y);
             binaryWriter.Write(vector3.z);
         }
 
-        public static UnityEngine.Vector3 ReadVector3(this BinaryReader binaryReader)
+        public static Vector3 ReadVector3(this BinaryReader binaryReader)
         {
-            return new UnityEngine.Vector3(
+            return new Vector3(
                 binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle()
             );
         }
 
-        public static void WriteQuaternion(this BinaryWriter binaryWriter, UnityEngine.Quaternion quaternion)
+        public static void WriteQuaternion(this BinaryWriter binaryWriter, Quaternion quaternion)
         {
             binaryWriter.Write(quaternion.x);
             binaryWriter.Write(quaternion.y);
@@ -236,16 +235,16 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             binaryWriter.Write(quaternion.w);
         }
 
-        public static UnityEngine.Quaternion ReadQuaternion(this BinaryReader binaryReader)
+        public static Quaternion ReadQuaternion(this BinaryReader binaryReader)
         {
-            return new UnityEngine.Quaternion
+            return new Quaternion
             (
                 binaryReader.ReadSingle(), binaryReader.ReadSingle(),
                 binaryReader.ReadSingle(), binaryReader.ReadSingle()
             );
         }
 
-        public static void WriteColour(this BinaryWriter binaryWriter, UnityEngine.Color colour)
+        public static void WriteColour(this BinaryWriter binaryWriter, Color colour)
         {
             binaryWriter.Write(colour.r);
             binaryWriter.Write(colour.g);
@@ -253,13 +252,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             binaryWriter.Write(colour.a);
         }
 
-        public static UnityEngine.Color ReadColour(this BinaryReader binaryReader)
+        public static Color ReadColour(this BinaryReader binaryReader)
         {
-            return new Color(
-                binaryReader.ReadSingle(),
-                binaryReader.ReadSingle(),
-                binaryReader.ReadSingle(),
-                binaryReader.ReadSingle()
+            return new Color
+            (
+                binaryReader.ReadSingle(), binaryReader.ReadSingle(),
+                binaryReader.ReadSingle(), binaryReader.ReadSingle()
             );
         }
     }