Browse Source

Reformat part 2 file scoped namespace

The formatting changes had to be done in parts because changing to file
scoped namespaces pretty much changes every single line so I can't
really tell what was actually changed.

This formatting has left a bunch of indent issues because I don't know
how to configure neovim so I'm gonna fix those next.
habeebweeb 2 years ago
parent
commit
db55b0c89d
151 changed files with 14485 additions and 14640 deletions
  1. 4 5
      src/MeidoPhotoStudio.Converter/Converters/IConverter.cs
  2. 91 92
      src/MeidoPhotoStudio.Converter/Converters/MMConverter.cs
  3. 68 69
      src/MeidoPhotoStudio.Converter/Converters/MMPngConverter.cs
  4. 33 34
      src/MeidoPhotoStudio.Converter/MPSSceneSerializer.cs
  5. 33 34
      src/MeidoPhotoStudio.Converter/MultipleMaids/ConversionUtility.cs
  6. 27 28
      src/MeidoPhotoStudio.Converter/MultipleMaids/MMConstants.cs
  7. 9 10
      src/MeidoPhotoStudio.Converter/MultipleMaids/MMScene.cs
  8. 637 638
      src/MeidoPhotoStudio.Converter/MultipleMaids/MMSceneConverter.cs
  9. 27 29
      src/MeidoPhotoStudio.Converter/Plugin.cs
  10. 23 24
      src/MeidoPhotoStudio.Converter/PluginCore.cs
  11. 27 28
      src/MeidoPhotoStudio.Converter/UI.cs
  12. 21 22
      src/MeidoPhotoStudio.Converter/Utility/LZMA.cs
  13. 43 44
      src/MeidoPhotoStudio.Converter/Utility/PngUtility.cs
  14. 8 9
      src/MeidoPhotoStudio.Plugin/Configuration.cs
  15. 774 775
      src/MeidoPhotoStudio.Plugin/Constants.cs
  16. 138 139
      src/MeidoPhotoStudio.Plugin/DragPoint/CustomGizmo.cs
  17. 220 221
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPoint.cs
  18. 186 187
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPointGeneral.cs
  19. 72 73
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPointGravity.cs
  20. 237 238
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPointLight.cs
  21. 48 49
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPointMeido.cs
  22. 33 34
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPointOther.cs
  23. 93 94
      src/MeidoPhotoStudio.Plugin/DragPoint/DragPointProp.cs
  24. 7 8
      src/MeidoPhotoStudio.Plugin/GUI/Controls/BaseControl.cs
  25. 15 16
      src/MeidoPhotoStudio.Plugin/GUI/Controls/Button.cs
  26. 39 40
      src/MeidoPhotoStudio.Plugin/GUI/Controls/ComboBox.cs
  27. 293 294
      src/MeidoPhotoStudio.Plugin/GUI/Controls/DropDown.cs
  28. 44 45
      src/MeidoPhotoStudio.Plugin/GUI/Controls/KeyRebindButton.cs
  29. 30 31
      src/MeidoPhotoStudio.Plugin/GUI/Controls/Modal.cs
  30. 79 80
      src/MeidoPhotoStudio.Plugin/GUI/Controls/SelectionGrid.cs
  31. 128 129
      src/MeidoPhotoStudio.Plugin/GUI/Controls/Slider.cs
  32. 8 9
      src/MeidoPhotoStudio.Plugin/GUI/Controls/TextArea.cs
  33. 17 18
      src/MeidoPhotoStudio.Plugin/GUI/Controls/TextField.cs
  34. 31 32
      src/MeidoPhotoStudio.Plugin/GUI/Controls/Toggle.cs
  35. 163 164
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/AttachPropPane.cs
  36. 152 153
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/ModPropsPane.cs
  37. 70 71
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/MyRoomPropsPane.cs
  38. 143 144
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/PropManagerPane.cs
  39. 129 130
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/PropsPane.cs
  40. 63 64
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/BackgroundSelectorPane.cs
  41. 72 73
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/CameraPane.cs
  42. 59 60
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/DragPointPane.cs
  43. 113 114
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/BloomPane.cs
  44. 90 91
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/DepthOfFieldPane.cs
  45. 60 61
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectPane.cs
  46. 36 37
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectsPane.cs
  47. 106 107
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/FogPane.cs
  48. 53 54
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/OtherEffectsPane.cs
  49. 70 71
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/VignettePane.cs
  50. 249 250
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/LightsPane.cs
  51. 21 22
      src/MeidoPhotoStudio.Plugin/GUI/Panes/BasePane.cs
  52. 97 98
      src/MeidoPhotoStudio.Plugin/GUI/Panes/CallWindowPanes/MaidSelectorPane.cs
  53. 122 123
      src/MeidoPhotoStudio.Plugin/GUI/Panes/FaceWindowPanes/MaidFaceBlendPane.cs
  54. 188 189
      src/MeidoPhotoStudio.Plugin/GUI/Panes/FaceWindowPanes/MaidFaceSliderPane.cs
  55. 46 47
      src/MeidoPhotoStudio.Plugin/GUI/Panes/FaceWindowPanes/SaveFacePane.cs
  56. 55 56
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/BG2WindowPane.cs
  57. 49 50
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/BGWindowPane.cs
  58. 6 7
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/BaseMainWindowPane.cs
  59. 31 32
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/CallWindowPane.cs
  60. 45 46
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/FaceWindowPane.cs
  61. 115 117
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/PoseWindowPane.cs
  62. 100 101
      src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/SettingsWindowPane.cs
  63. 95 96
      src/MeidoPhotoStudio.Plugin/GUI/Panes/OtherPanes/MaidSwitcherPane.cs
  64. 42 43
      src/MeidoPhotoStudio.Plugin/GUI/Panes/OtherPanes/TabsPane.cs
  65. 58 59
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/CopyPosePane.cs
  66. 72 73
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/GravityControlPane.cs
  67. 103 104
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/HandPresetPane.cs
  68. 232 233
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidDressingPane.cs
  69. 84 85
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidFreeLookPane.cs
  70. 57 58
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidIKPane.cs
  71. 179 180
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidPoseSelectorPane.cs
  72. 82 83
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MpnAttachPropPane.cs
  73. 49 50
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/SaveHandPane.cs
  74. 45 46
      src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/SavePosePane.cs
  75. 77 78
      src/MeidoPhotoStudio.Plugin/GUI/Panes/SceneManagerPanes/SceneManagerDirectoryPane.cs
  76. 61 62
      src/MeidoPhotoStudio.Plugin/GUI/Panes/SceneManagerPanes/SceneManagerScenePane.cs
  77. 84 85
      src/MeidoPhotoStudio.Plugin/GUI/Panes/SceneManagerPanes/SceneManagerTitleBar.cs
  78. 65 66
      src/MeidoPhotoStudio.Plugin/GUI/Windows/BaseWindow.cs
  79. 133 134
      src/MeidoPhotoStudio.Plugin/GUI/Windows/MainWindow.cs
  80. 82 83
      src/MeidoPhotoStudio.Plugin/GUI/Windows/MessageWindow.cs
  81. 189 190
      src/MeidoPhotoStudio.Plugin/GUI/Windows/SceneModalWindow.cs
  82. 77 78
      src/MeidoPhotoStudio.Plugin/GUI/Windows/SceneWindow.cs
  83. 50 51
      src/MeidoPhotoStudio.Plugin/MPSScene.cs
  84. 100 101
      src/MeidoPhotoStudio.Plugin/MaidPlacementUtility.cs
  85. 155 156
      src/MeidoPhotoStudio.Plugin/Managers/CameraManager.cs
  86. 26 27
      src/MeidoPhotoStudio.Plugin/Managers/EffectManager.cs
  87. 121 122
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/BloomEffectManager.cs
  88. 59 60
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/BlurEffectManager.cs
  89. 82 83
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/DepthOfFieldManager.cs
  90. 107 108
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/FogEffectManager.cs
  91. 7 8
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/IEffectManager.cs
  92. 23 24
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/SepiaToneEffectManager.cs
  93. 77 78
      src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/VignetteEffectManager.cs
  94. 117 118
      src/MeidoPhotoStudio.Plugin/Managers/EnvironmentManager.cs
  95. 6 7
      src/MeidoPhotoStudio.Plugin/Managers/IManager.cs
  96. 124 125
      src/MeidoPhotoStudio.Plugin/Managers/InputManager.cs
  97. 143 144
      src/MeidoPhotoStudio.Plugin/Managers/LightManager.cs
  98. 289 290
      src/MeidoPhotoStudio.Plugin/Managers/MeidoManager.cs
  99. 99 100
      src/MeidoPhotoStudio.Plugin/Managers/MessageWindowManager.cs
  100. 253 254
      src/MeidoPhotoStudio.Plugin/Managers/PropManager.cs
  101. 254 255
      src/MeidoPhotoStudio.Plugin/Managers/SceneManager.cs
  102. 39 40
      src/MeidoPhotoStudio.Plugin/Managers/WindowManager.cs
  103. 68 69
      src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointFinger.cs
  104. 76 77
      src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointHead.cs
  105. 43 44
      src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointPelvis.cs
  106. 83 84
      src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointSpine.cs
  107. 61 62
      src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointTorso.cs
  108. 25 26
      src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointChain.cs
  109. 98 99
      src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointLimb.cs
  110. 45 46
      src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointMune.cs
  111. 655 656
      src/MeidoPhotoStudio.Plugin/Meido/Meido.cs
  112. 638 639
      src/MeidoPhotoStudio.Plugin/Meido/MeidoDragPointManager.cs
  113. 408 409
      src/MeidoPhotoStudio.Plugin/MeidoPhotoStudio.cs
  114. 44 46
      src/MeidoPhotoStudio.Plugin/MenuFileCache.cs
  115. 194 195
      src/MeidoPhotoStudio.Plugin/MenuFileUtility.cs
  116. 65 67
      src/MeidoPhotoStudio.Plugin/MenuItem.cs
  117. 445 446
      src/MeidoPhotoStudio.Plugin/ModelUtility.cs
  118. 102 103
      src/MeidoPhotoStudio.Plugin/MyGui.cs
  119. 15 16
      src/MeidoPhotoStudio.Plugin/Patchers/AllProcPropSeqStartPatcher.cs
  120. 15 16
      src/MeidoPhotoStudio.Plugin/Patchers/BgMgrPatcher.cs
  121. 5 6
      src/MeidoPhotoStudio.Plugin/Serialization/ISerializer.cs
  122. 5 6
      src/MeidoPhotoStudio.Plugin/Serialization/ISimpleSerializer.cs
  123. 28 29
      src/MeidoPhotoStudio.Plugin/Serialization/SceneMetadata.cs
  124. 33 34
      src/MeidoPhotoStudio.Plugin/Serialization/Serialization.cs
  125. 9 10
      src/MeidoPhotoStudio.Plugin/Serialization/Serializer.cs
  126. 16 17
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/AttachPointInfoSerializer.cs
  127. 19 20
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/CameraInfoSerializer.cs
  128. 29 30
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/DragPointLightSerializer.cs
  129. 23 24
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/BloomEffectSerializer.cs
  130. 17 18
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/BlurEffectSerializer.cs
  131. 30 31
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/DepthOfFieldEffectSerializer.cs
  132. 30 31
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/FogEffectSerializer.cs
  133. 14 15
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/SepiaToneEffectSerializer.cs
  134. 23 24
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/VignetteEffectSerializer.cs
  135. 23 24
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/LightPropertySerializer.cs
  136. 34 35
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/CameraManagerSerializer.cs
  137. 24 25
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/EffectManagerSerializer.cs
  138. 47 48
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/EnvironmentManagerSerializer.cs
  139. 28 29
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/LightManagerSerializer.cs
  140. 62 63
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/MeidoManagerSerializer.cs
  141. 23 24
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/MessageWindowManagerSerializer.cs
  142. 47 48
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/PropManagerSerializer.cs
  143. 242 243
      src/MeidoPhotoStudio.Plugin/Serialization/Serializers/MeidoSerializer.cs
  144. 9 10
      src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializer.cs
  145. 48 49
      src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/DragPointPropDTOSerializer.cs
  146. 15 16
      src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/PoseInfoSerializer.cs
  147. 22 23
      src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/PropInfoSerializer.cs
  148. 39 40
      src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/TransformDTOSerializer.cs
  149. 90 91
      src/MeidoPhotoStudio.Plugin/Translation.cs
  150. 321 322
      src/MeidoPhotoStudio.Plugin/Utility.cs
  151. 7 8
      src/MeidoPhotoStudio.Plugin/WindowsLogicalComparer.cs

+ 4 - 5
src/MeidoPhotoStudio.Converter/Converters/IConverter.cs

@@ -1,7 +1,6 @@
-namespace MeidoPhotoStudio.Converter.Converters
+namespace MeidoPhotoStudio.Converter.Converters;
+
+public interface IConverter
 {
-    public interface IConverter
-    {
-        void Convert(string workingDirectory);
-    }
+    void Convert(string workingDirectory);
 }

+ 91 - 92
src/MeidoPhotoStudio.Converter/Converters/MMConverter.cs

@@ -4,132 +4,131 @@ using System.Linq;
 using ExIni;
 using MeidoPhotoStudio.Converter.MultipleMaids;
 
-namespace MeidoPhotoStudio.Converter.Converters
+namespace MeidoPhotoStudio.Converter.Converters;
+
+public class MMConverter : IConverter
 {
-    public class MMConverter : IConverter
-    {
-        public const string ConverterName = "MultipleMaids";
+    public const string ConverterName = "MultipleMaids";
 
-        private const string InputDirectoryName = "Input";
+    private const string InputDirectoryName = "Input";
 
-        private static void Convert(string workingDirectory, string destination)
-        {
-            var directory = new DirectoryInfo(workingDirectory);
+    private static void Convert(string workingDirectory, string destination)
+    {
+        var directory = new DirectoryInfo(workingDirectory);
 
-            if (!directory.Exists)
-                return;
+        if (!directory.Exists)
+            return;
 
-            Directory.CreateDirectory(destination);
+        Directory.CreateDirectory(destination);
 
-            foreach (var iniFile in directory.GetFiles("*.ini"))
-                ConvertIniFile(iniFile, destination);
+        foreach (var iniFile in directory.GetFiles("*.ini"))
+            ConvertIniFile(iniFile, destination);
 
-            foreach (var subDirectory in directory.GetDirectories())
-            {
-                var subDestination = Path.Combine(destination, subDirectory.Name);
-                Convert(subDirectory.FullName, subDestination);
-            }
+        foreach (var subDirectory in directory.GetDirectories())
+        {
+            var subDestination = Path.Combine(destination, subDirectory.Name);
+            Convert(subDirectory.FullName, subDestination);
         }
+    }
 
-        private static void ConvertIniFile(FileInfo iniFile, string destination)
-        {
-            var section = GetSceneSection(iniFile.FullName);
+    private static void ConvertIniFile(FileInfo iniFile, string destination)
+    {
+        var section = GetSceneSection(iniFile.FullName);
 
-            if (section is null)
-                return;
+        if (section is null)
+            return;
 
-            var outputDirectory = Path.Combine(destination, Path.GetFileNameWithoutExtension(iniFile.Name));
+        var outputDirectory = Path.Combine(destination, Path.GetFileNameWithoutExtension(iniFile.Name));
 
-            Directory.CreateDirectory(outputDirectory);
+        Directory.CreateDirectory(outputDirectory);
 
-            foreach (var key in section.Keys.Where(
-                key => !key.Key.StartsWith("ss") && !string.IsNullOrEmpty(key.Value)
-            ))
-                ConvertScene(section, key, Path.Combine(outputDirectory, GenerateFilename(iniFile.Name, key)));
-        }
+        foreach (var key in section.Keys.Where(
+                    key => !key.Key.StartsWith("ss") && !string.IsNullOrEmpty(key.Value)
+                    ))
+            ConvertScene(section, key, Path.Combine(outputDirectory, GenerateFilename(iniFile.Name, key)));
+    }
 
-        private static void ConvertScene(IniSection section, IniKey key, string filePath)
-        {
-            var background = int.Parse(key.Key.Substring(1)) >= 10000;
-
-            byte[] convertedData;
-            MeidoPhotoStudio.Plugin.SceneMetadata sceneMetadata;
-
-            try
-            {
-                convertedData = MMSceneConverter.Convert(key.Value, background);
-                sceneMetadata = MMSceneConverter.GetSceneMetadata(key.Value, background);
-            }
-            catch (Exception e)
-            {
-                if (Plugin.Instance == null)
-                    return;
-
-                Plugin.Instance.Logger.LogError($"Could not convert {Path.GetFileName(filePath)} scene because {e}");
-                return;
-            }
+    private static void ConvertScene(IniSection section, IniKey key, string filePath)
+    {
+        var background = int.Parse(key.Key.Substring(1)) >= 10000;
 
-            var screenshotKey = $"s{key.Key}"; // ex. ss100=thumb_base64
-            string? screenshotBase64 = null;
+        byte[] convertedData;
+        MeidoPhotoStudio.Plugin.SceneMetadata sceneMetadata;
 
-            if (section.HasKey(screenshotKey) && !string.IsNullOrEmpty(section[screenshotKey].Value))
-                screenshotBase64 = section[screenshotKey].Value;
+        try
+        {
+            convertedData = MMSceneConverter.Convert(key.Value, background);
+            sceneMetadata = MMSceneConverter.GetSceneMetadata(key.Value, background);
+        }
+        catch (Exception e)
+        {
+            if (Plugin.Instance == null)
+                return;
 
-            MPSSceneSerializer.SaveToFile(filePath, sceneMetadata, convertedData, screenshotBase64);
+            Plugin.Instance.Logger.LogError($"Could not convert {Path.GetFileName(filePath)} scene because {e}");
+            return;
         }
 
-        private static string GenerateFilename(string iniFilePath, IniKey sceneKey)
-        {
-            var background = int.Parse(sceneKey.Key.Substring(1)) >= 10000;
+        var screenshotKey = $"s{key.Key}"; // ex. ss100=thumb_base64
+        string? screenshotBase64 = null;
 
-            var iniFilename = Path.GetFileNameWithoutExtension(iniFilePath);
+        if (section.HasKey(screenshotKey) && !string.IsNullOrEmpty(section[screenshotKey].Value))
+            screenshotBase64 = section[screenshotKey].Value;
 
-            var sceneName = sceneKey.Key;
+        MPSSceneSerializer.SaveToFile(filePath, sceneMetadata, convertedData, screenshotBase64);
+    }
 
-            var data = sceneKey.Value;
-            var date = DateTime.Parse(data.Substring(0, data.IndexOf(',')));
+    private static string GenerateFilename(string iniFilePath, IniKey sceneKey)
+    {
+        var background = int.Parse(sceneKey.Key.Substring(1)) >= 10000;
 
-            var sceneDate = MPSSceneSerializer.FormatDate(date);
+        var iniFilename = Path.GetFileNameWithoutExtension(iniFilePath);
 
-            return $"mm{(background ? "kankyo" : "scene")}_{iniFilename}_{sceneName}_{sceneDate}.png";
-        }
+        var sceneName = sceneKey.Key;
 
-        private static IniSection? GetSceneSection(string filePath)
-        {
-            IniFile iniFile;
-
-            try
-            {
-                iniFile = IniFile.FromFile(filePath);
-            }
-            catch (Exception e)
-            {
-                if (Plugin.Instance != null)
-                    Plugin.Instance.Logger.LogWarning(
-                        $"Could not {(e is IOException ? "read" : "parse")} ini file {filePath}"
-                    );
+        var data = sceneKey.Value;
+        var date = DateTime.Parse(data.Substring(0, data.IndexOf(',')));
 
-                return null;
-            }
+        var sceneDate = MPSSceneSerializer.FormatDate(date);
 
-            if (iniFile.HasSection("scene"))
-                return iniFile.GetSection("scene");
+        return $"mm{(background ? "kankyo" : "scene")}_{iniFilename}_{sceneName}_{sceneDate}.png";
+    }
 
+    private static IniSection? GetSceneSection(string filePath)
+    {
+        IniFile iniFile;
+
+        try
+        {
+            iniFile = IniFile.FromFile(filePath);
+        }
+        catch (Exception e)
+        {
             if (Plugin.Instance != null)
                 Plugin.Instance.Logger.LogWarning(
-                    $"{filePath} is not a valid MM config because '[scene]' section is missing"
-                );
+                        $"Could not {(e is IOException ? "read" : "parse")} ini file {filePath}"
+                        );
 
             return null;
         }
 
-        public void Convert(string workingDirectory)
-        {
-            var baseDirectory = Path.Combine(workingDirectory, ConverterName);
-            var baseInputDirectory = Path.Combine(baseDirectory, InputDirectoryName);
-            var baseOutputDirectory = Path.Combine(baseDirectory, MPSSceneSerializer.FormatDate(DateTime.Now));
+        if (iniFile.HasSection("scene"))
+            return iniFile.GetSection("scene");
 
-            Convert(baseInputDirectory, baseOutputDirectory);
-        }
+        if (Plugin.Instance != null)
+            Plugin.Instance.Logger.LogWarning(
+                    $"{filePath} is not a valid MM config because '[scene]' section is missing"
+                    );
+
+        return null;
+    }
+
+    public void Convert(string workingDirectory)
+    {
+        var baseDirectory = Path.Combine(workingDirectory, ConverterName);
+        var baseInputDirectory = Path.Combine(baseDirectory, InputDirectoryName);
+        var baseOutputDirectory = Path.Combine(baseDirectory, MPSSceneSerializer.FormatDate(DateTime.Now));
+
+        Convert(baseInputDirectory, baseOutputDirectory);
     }
 }

+ 68 - 69
src/MeidoPhotoStudio.Converter/Converters/MMPngConverter.cs

@@ -4,99 +4,98 @@ using System.Text;
 using MeidoPhotoStudio.Converter.MultipleMaids;
 using MeidoPhotoStudio.Converter.Utility;
 
-namespace MeidoPhotoStudio.Converter.Converters
-{
-    public class MMPngConverter : IConverter
-    {
-        private const string InputDirectoryName = "Input";
-        public const string ConverterName = "ModifiedMM PNG";
+namespace MeidoPhotoStudio.Converter.Converters;
 
-        private static readonly byte[] KankyoHeader = Encoding.ASCII.GetBytes("KANKYO");
+public class MMPngConverter : IConverter
+{
+    private const string InputDirectoryName = "Input";
+    public const string ConverterName = "ModifiedMM PNG";
 
-        private static void Convert(string workingDirectory, string destination)
-        {
-            var directory = new DirectoryInfo(workingDirectory);
+    private static readonly byte[] KankyoHeader = Encoding.ASCII.GetBytes("KANKYO");
 
-            if (!directory.Exists)
-                return;
+    private static void Convert(string workingDirectory, string destination)
+    {
+        var directory = new DirectoryInfo(workingDirectory);
 
-            Directory.CreateDirectory(destination);
+        if (!directory.Exists)
+            return;
 
-            foreach (var file in directory.GetFiles("*.png"))
-                ConvertScene(file.FullName, Path.Combine(destination, file.Name));
+        Directory.CreateDirectory(destination);
 
-            foreach (var subDirectory in directory.GetDirectories())
-            {
-                var subDestination = Path.Combine(destination, subDirectory.Name);
-                Convert(subDirectory.FullName, subDestination);
-            }
-        }
+        foreach (var file in directory.GetFiles("*.png"))
+            ConvertScene(file.FullName, Path.Combine(destination, file.Name));
 
-        private static void ConvertScene(string pngFile, string outputFilename)
+        foreach (var subDirectory in directory.GetDirectories())
         {
-            var fileStream = File.OpenRead(pngFile);
-
-            var thumbnailData = PngUtility.ExtractPng(fileStream) ?? MPSSceneSerializer.NoThumb;
+            var subDestination = Path.Combine(destination, subDirectory.Name);
+            Convert(subDirectory.FullName, subDestination);
+        }
+    }
 
-            var kankyo = new byte[KankyoHeader.Length];
-            fileStream.Read(kankyo, 0, KankyoHeader.Length);
+    private static void ConvertScene(string pngFile, string outputFilename)
+    {
+        var fileStream = File.OpenRead(pngFile);
 
-            var background = false;
+        var thumbnailData = PngUtility.ExtractPng(fileStream) ?? MPSSceneSerializer.NoThumb;
 
-            // ModifiedMM habeebweeb fork scene data uses 'KANKYO' as a header to identify saved environments.
-            // Regular scenes will lack a 'KANKYO' header so the filestream position has to be pulled back. 
-            if (MeidoPhotoStudio.Plugin.Utility.BytesEqual(kankyo, KankyoHeader))
-                background = true;
-            else
-                fileStream.Position -= KankyoHeader.Length;
+        var kankyo = new byte[KankyoHeader.Length];
+        fileStream.Read(kankyo, 0, KankyoHeader.Length);
 
-            string sceneData;
+        var background = false;
 
-            try
-            {
-                using var sceneStream = LZMA.Decompress(fileStream);
-                sceneData = Encoding.Unicode.GetString(sceneStream.ToArray());
-            }
-            catch (Exception e)
-            {
-                if (Plugin.Instance == null)
-                    return;
+        // ModifiedMM habeebweeb fork scene data uses 'KANKYO' as a header to identify saved environments.
+        // Regular scenes will lack a 'KANKYO' header so the filestream position has to be pulled back. 
+        if (MeidoPhotoStudio.Plugin.Utility.BytesEqual(kankyo, KankyoHeader))
+            background = true;
+        else
+            fileStream.Position -= KankyoHeader.Length;
 
-                Plugin.Instance.Logger.LogWarning($"Could not decompress scene data from {pngFile} because {e}");
+        string sceneData;
 
+        try
+        {
+            using var sceneStream = LZMA.Decompress(fileStream);
+            sceneData = Encoding.Unicode.GetString(sceneStream.ToArray());
+        }
+        catch (Exception e)
+        {
+            if (Plugin.Instance == null)
                 return;
-            }
 
-            if (string.IsNullOrEmpty(sceneData))
-                return;
+            Plugin.Instance.Logger.LogWarning($"Could not decompress scene data from {pngFile} because {e}");
 
-            byte[] convertedData;
-            MeidoPhotoStudio.Plugin.SceneMetadata sceneMetadata;
+            return;
+        }
 
-            try
-            {
-                convertedData = MMSceneConverter.Convert(sceneData, background);
-                sceneMetadata = MMSceneConverter.GetSceneMetadata(sceneData, background);
-            }
-            catch (Exception e)
-            {
-                if (Plugin.Instance == null)
-                    return;
+        if (string.IsNullOrEmpty(sceneData))
+            return;
 
-                Plugin.Instance.Logger.LogError($"Could not convert {pngFile} because {e}");
-                return;
-            }
+        byte[] convertedData;
+        MeidoPhotoStudio.Plugin.SceneMetadata sceneMetadata;
 
-            MPSSceneSerializer.SaveToFile(outputFilename, sceneMetadata, convertedData, thumbnailData);
+        try
+        {
+            convertedData = MMSceneConverter.Convert(sceneData, background);
+            sceneMetadata = MMSceneConverter.GetSceneMetadata(sceneData, background);
         }
-
-        public void Convert(string workingDirectory)
+        catch (Exception e)
         {
-            var baseDirectory = Path.Combine(workingDirectory, ConverterName);
-            var baseInputDirectory = Path.Combine(baseDirectory, InputDirectoryName);
-            var baseOutputDirectory = Path.Combine(baseDirectory, MPSSceneSerializer.FormatDate(DateTime.Now));
+            if (Plugin.Instance == null)
+                return;
 
-            Convert(baseInputDirectory, baseOutputDirectory);
+            Plugin.Instance.Logger.LogError($"Could not convert {pngFile} because {e}");
+            return;
         }
+
+        MPSSceneSerializer.SaveToFile(outputFilename, sceneMetadata, convertedData, thumbnailData);
+    }
+
+    public void Convert(string workingDirectory)
+    {
+        var baseDirectory = Path.Combine(workingDirectory, ConverterName);
+        var baseInputDirectory = Path.Combine(baseDirectory, InputDirectoryName);
+        var baseOutputDirectory = Path.Combine(baseDirectory, MPSSceneSerializer.FormatDate(DateTime.Now));
+
+        Convert(baseInputDirectory, baseOutputDirectory);
     }
 }

+ 33 - 34
src/MeidoPhotoStudio.Converter/MPSSceneSerializer.cs

@@ -4,53 +4,52 @@ using System.Text;
 using Ionic.Zlib;
 using MeidoPhotoStudio.Plugin;
 
-namespace MeidoPhotoStudio.Converter
-{
-    public static class MPSSceneSerializer
-    {
-        private const string NoThumbBase64 =
-            "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7D"
-            + "AcdvqGQAAAFOSURBVFhH3dJbjoMwEETRLIRP9r+zrCGpqJABY+x+2Ua5ys9EcteJNK/3sj7ws7E+j2ln8Q9+O7eE2Vjpq4kdJTsLTZRl"
-            + "jBMLTZFdDTkLDZYVAQUWGia7Wy+z0ABZZfqWhbrK6rs1Fuoka442WChcJllss1CgTDgnYqEQmXxLykJOmWpIwUJmmXZFx0IGmWFCzUKq"
-            + "J7b7FhYSvjIfN7JQ86Hnsp2FKm+dZ10sVHzuv+lloexCyMEAFkpHoq7FsBDuBJ76a1Y6EnXtT//li8/9N12sylvnWTur+dBz2cgSvjIf"
-            + "t7BUT2z31azePwOpWQYT064oWGYTUw1JWU4Tk2+JWCEmJpxrswJNTLLYYIWbWHO0xupkYvXdW1ZXE6tMl1kDTOxuvcAaZmJFQM4abGJX"
-            + "w4k1xcQyxs6aaGJHycaabmIJ82M9xMTo2VjP+izrF8NPHwq3SYqeAAAAAElFTkSuQmCC";
+namespace MeidoPhotoStudio.Converter;
 
-        private static byte[]? noThumb;
+public static class MPSSceneSerializer
+{
+    private const string NoThumbBase64 =
+        "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7D"
+        + "AcdvqGQAAAFOSURBVFhH3dJbjoMwEETRLIRP9r+zrCGpqJABY+x+2Ua5ys9EcteJNK/3sj7ws7E+j2ln8Q9+O7eE2Vjpq4kdJTsLTZRl"
+        + "jBMLTZFdDTkLDZYVAQUWGia7Wy+z0ABZZfqWhbrK6rs1Fuoka442WChcJllss1CgTDgnYqEQmXxLykJOmWpIwUJmmXZFx0IGmWFCzUKq"
+        + "J7b7FhYSvjIfN7JQ86Hnsp2FKm+dZ10sVHzuv+lloexCyMEAFkpHoq7FsBDuBJ76a1Y6EnXtT//li8/9N12sylvnWTur+dBz2cgSvjIf"
+        + "t7BUT2z31azePwOpWQYT064oWGYTUw1JWU4Tk2+JWCEmJpxrswJNTLLYYIWbWHO0xupkYvXdW1ZXE6tMl1kDTOxuvcAaZmJFQM4abGJX"
+        + "w4k1xcQyxs6aaGJHycaabmIJ82M9xMTo2VjP+izrF8NPHwq3SYqeAAAAAElFTkSuQmCC";
 
-        public static byte[] NoThumb =>
-            noThumb ??= Convert.FromBase64String(NoThumbBase64);
+    private static byte[]? noThumb;
 
-        public static void SaveToFile(string filename, SceneMetadata metadata, byte[] rawSceneData, string? thumbnail)
-        {
-            var rawThumbnail = string.IsNullOrEmpty(thumbnail) ? NoThumb : Convert.FromBase64String(thumbnail);
+    public static byte[] NoThumb =>
+        noThumb ??= Convert.FromBase64String(NoThumbBase64);
 
-            SaveToFile(filename, metadata, rawSceneData, rawThumbnail);
-        }
+    public static void SaveToFile(string filename, SceneMetadata metadata, byte[] rawSceneData, string? thumbnail)
+    {
+        var rawThumbnail = string.IsNullOrEmpty(thumbnail) ? NoThumb : Convert.FromBase64String(thumbnail);
 
-        public static void SaveToFile(string filename, SceneMetadata metadata, byte[] rawSceneData, byte[] thumbnail)
-        {
-            if (!string.Equals(Path.GetExtension(filename), ".png", StringComparison.OrdinalIgnoreCase))
-                filename += ".png";
+        SaveToFile(filename, metadata, rawSceneData, rawThumbnail);
+    }
 
-            using var fileStream = File.Create(filename);
+    public static void SaveToFile(string filename, SceneMetadata metadata, byte[] rawSceneData, byte[] thumbnail)
+    {
+        if (!string.Equals(Path.GetExtension(filename), ".png", StringComparison.OrdinalIgnoreCase))
+            filename += ".png";
 
-            fileStream.Write(thumbnail, 0, thumbnail.Length);
+        using var fileStream = File.Create(filename);
 
-            using var headerWriter = new BinaryWriter(fileStream, Encoding.UTF8);
+        fileStream.Write(thumbnail, 0, thumbnail.Length);
 
-            headerWriter.Write(MeidoPhotoStudio.Plugin.MeidoPhotoStudio.SceneHeader);
+        using var headerWriter = new BinaryWriter(fileStream, Encoding.UTF8);
 
-            metadata.WriteMetadata(headerWriter);
+        headerWriter.Write(MeidoPhotoStudio.Plugin.MeidoPhotoStudio.SceneHeader);
 
-            using var compressionStream = new DeflateStream(fileStream, CompressionMode.Compress);
+        metadata.WriteMetadata(headerWriter);
 
-            compressionStream.Write(rawSceneData, 0, rawSceneData.Length);
+        using var compressionStream = new DeflateStream(fileStream, CompressionMode.Compress);
 
-            compressionStream.Close();
-        }
+        compressionStream.Write(rawSceneData, 0, rawSceneData.Length);
 
-        public static string FormatDate(DateTime date) =>
-            date.ToString("yyyyMMddHHmmss");
+        compressionStream.Close();
     }
+
+    public static string FormatDate(DateTime date) =>
+        date.ToString("yyyyMMddHHmmss");
 }

+ 33 - 34
src/MeidoPhotoStudio.Converter/MultipleMaids/ConversionUtility.cs

@@ -1,48 +1,47 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Converter.MultipleMaids
+namespace MeidoPhotoStudio.Converter.MultipleMaids;
+
+internal static class ConversionUtility
 {
-    internal static class ConversionUtility
+    public static Quaternion ParseEulerAngle(string euler)
     {
-        public static Quaternion ParseEulerAngle(string euler)
-        {
-            var data = euler.Split(',');
-
-            return Quaternion.Euler(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
-        }
+        var data = euler.Split(',');
 
-        public static Vector3 ParseVector3(string vector3)
-        {
-            var data = vector3.Split(',');
+        return Quaternion.Euler(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
+    }
 
-            return new(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
-        }
+    public static Vector3 ParseVector3(string vector3)
+    {
+        var data = vector3.Split(',');
 
-        /// <summary>
-        /// Checks if the string has 3 euler angle components delimited by commas before parsing
-        /// </summary>
-        /// <param name="euler">Euler angle string in the form "x,y,z"</param>
-        /// <param name="result">Resulting angle as a <c>Quaternion</c></param>
-        /// <returns>Whether or not the euler string can be safely parsed</returns>
-        public static bool TryParseEulerAngle(string euler, out Quaternion result)
-        {
-            result = Quaternion.identity;
+        return new(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
+    }
 
-            var data = euler.Split(',');
+    /// <summary>
+    /// Checks if the string has 3 euler angle components delimited by commas before parsing
+    /// </summary>
+    /// <param name="euler">Euler angle string in the form "x,y,z"</param>
+    /// <param name="result">Resulting angle as a <c>Quaternion</c></param>
+    /// <returns>Whether or not the euler string can be safely parsed</returns>
+    public static bool TryParseEulerAngle(string euler, out Quaternion result)
+    {
+        result = Quaternion.identity;
 
-            if (data.Length is not 3)
-                return false;
+        var data = euler.Split(',');
 
-            try
-            {
-                result = Quaternion.Euler(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
-            }
-            catch
-            {
-                return false;
-            }
+        if (data.Length is not 3)
+            return false;
 
-            return true;
+        try
+        {
+            result = Quaternion.Euler(float.Parse(data[0]), float.Parse(data[1]), float.Parse(data[2]));
         }
+        catch
+        {
+            return false;
+        }
+
+        return true;
     }
 }

+ 27 - 28
src/MeidoPhotoStudio.Converter/MultipleMaids/MMConstants.cs

@@ -4,38 +4,37 @@ using System.Linq;
 using MyRoomCustom;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Converter.MultipleMaids
+namespace MeidoPhotoStudio.Converter.MultipleMaids;
+
+public static class MMConstants
 {
-    public static class MMConstants
-    {
-        public static readonly Vector3 DefaultSoftG = new(0f, -3f / 1000f, 0f);
+    public static readonly Vector3 DefaultSoftG = new(0f, -3f / 1000f, 0f);
 
-        public static readonly string[] FaceKeys =
-        {
-            "eyeclose", "eyeclose2", "eyeclose3", "eyeclose6", "hitomih", "hitomis", "mayuha",
-            "mayuup", "mayuv", "mayuvhalf", "moutha", "mouths", "mouthdw", "mouthup", "tangout",
-            "tangup", "eyebig", "eyeclose5", "mayuw", "mouthhe", "mouthc", "mouthi", "mouthuphalf",
-            "tangopen",
-            "namida", "tear1", "tear2", "tear3", "shock", "yodare", "hoho", "hoho2", "hohos", "hohol",
-            "toothoff", "nosefook",
-        };
+    public static readonly string[] FaceKeys =
+    {
+        "eyeclose", "eyeclose2", "eyeclose3", "eyeclose6", "hitomih", "hitomis", "mayuha",
+        "mayuup", "mayuv", "mayuvhalf", "moutha", "mouths", "mouthdw", "mouthup", "tangout",
+        "tangup", "eyebig", "eyeclose5", "mayuw", "mouthhe", "mouthc", "mouthi", "mouthuphalf",
+        "tangopen",
+        "namida", "tear1", "tear2", "tear3", "shock", "yodare", "hoho", "hoho2", "hohos", "hohol",
+        "toothoff", "nosefook",
+    };
 
-        public static readonly string[] MpnAttachProps =
-        {
-            /* "", "", "", "", "", "", "", "", "", */
-            "kousokuu_tekaseone_i_.menu", "kousokuu_tekasetwo_i_.menu", "kousokul_ashikaseup_i_.menu",
-            "kousokuu_tekasetwo_i_.menu", "kousokul_ashikasedown_i_.menu", "kousokuu_tekasetwodown_i_.menu",
-            "kousokuu_ushirode_i_.menu", "kousokuu_smroom_haritsuke_i_.menu",
-        };
+    public static readonly string[] MpnAttachProps =
+    {
+        /* "", "", "", "", "", "", "", "", "", */
+        "kousokuu_tekaseone_i_.menu", "kousokuu_tekasetwo_i_.menu", "kousokul_ashikaseup_i_.menu",
+        "kousokuu_tekasetwo_i_.menu", "kousokul_ashikasedown_i_.menu", "kousokuu_tekasetwodown_i_.menu",
+        "kousokuu_ushirode_i_.menu", "kousokuu_smroom_haritsuke_i_.menu",
+    };
 
-        private static Dictionary<string, PlacementData.Data>? myrAssetNameToData;
+    private static Dictionary<string, PlacementData.Data>? myrAssetNameToData;
 
-        public static Dictionary<string, PlacementData.Data> MyrAssetNameToData =>
-            myrAssetNameToData ??= PlacementData.GetAllDatas(false)
-                .ToDictionary(
-                    data => string.IsNullOrEmpty(data.assetName) ? data.resourceName : data.assetName,
-                    data => data,
-                    StringComparer.InvariantCultureIgnoreCase
+    public static Dictionary<string, PlacementData.Data> MyrAssetNameToData =>
+        myrAssetNameToData ??= PlacementData.GetAllDatas(false)
+        .ToDictionary(
+                data => string.IsNullOrEmpty(data.assetName) ? data.resourceName : data.assetName,
+                data => data,
+                StringComparer.InvariantCultureIgnoreCase
                 );
-    }
 }

+ 9 - 10
src/MeidoPhotoStudio.Converter/MultipleMaids/MMScene.cs

@@ -1,14 +1,13 @@
-namespace MeidoPhotoStudio.Converter.MultipleMaids
+namespace MeidoPhotoStudio.Converter.MultipleMaids;
+
+public class MMScene
 {
-    public class MMScene
-    {
-        public readonly string Data;
-        public readonly string? ScreenshotBase64;
+    public readonly string Data;
+    public readonly string? ScreenshotBase64;
 
-        public MMScene(string data, string? screenshotBase64)
-        {
-            Data = data;
-            ScreenshotBase64 = screenshotBase64;
-        }
+    public MMScene(string data, string? screenshotBase64)
+    {
+        Data = data;
+        ScreenshotBase64 = screenshotBase64;
     }
 }

File diff suppressed because it is too large
+ 637 - 638
src/MeidoPhotoStudio.Converter/MultipleMaids/MMSceneConverter.cs


+ 27 - 29
src/MeidoPhotoStudio.Converter/Plugin.cs

@@ -2,47 +2,45 @@ using System.IO;
 using BepInEx;
 using BepInEx.Logging;
 using MeidoPhotoStudio.Converter.Converters;
-using UnityEngine;
 using UnityEngine.SceneManagement;
 
-namespace MeidoPhotoStudio.Converter
-{
-    [BepInPlugin(PluginGuid, PluginName, PluginVersion)]
-    [BepInDependency("com.habeebweeb.com3d2.meidophotostudio")]
-    public class Plugin : BaseUnityPlugin
-    {
-        public const string PluginName = "MeidoPhotoStudio Converter";
-        public const string PluginVersion = "0.0.1";
+namespace MeidoPhotoStudio.Converter;
 
-        private const string PluginGuid = "com.habeebweeb.com3d2.meidophotostudio.converter";
+[BepInPlugin(PluginGuid, PluginName, PluginVersion)]
+[BepInDependency("com.habeebweeb.com3d2.meidophotostudio")]
+public class Plugin : BaseUnityPlugin
+{
+    public const string PluginName = "MeidoPhotoStudio Converter";
+    public const string PluginVersion = "0.0.1";
 
-        public static Plugin? Instance { get; private set; }
+    private const string PluginGuid = "com.habeebweeb.com3d2.meidophotostudio.converter";
 
-        private PluginCore? pluginCore;
-        private UI? ui;
+    public static Plugin? Instance { get; private set; }
 
-        public new ManualLogSource? Logger { get; private set; }
+    private PluginCore? pluginCore;
+    private UI? ui;
 
-        private void Awake()
-        {
-            DontDestroyOnLoad(this);
+    public new ManualLogSource? Logger { get; private set; }
 
-            Instance = this;
-            Logger = base.Logger;
+    private void Awake()
+    {
+        DontDestroyOnLoad(this);
 
-            var workingDirectory = Path.Combine(Paths.ConfigPath, PluginName);
+        Instance = this;
+        Logger = base.Logger;
 
-            if (!Directory.Exists(workingDirectory))
-                Directory.CreateDirectory(workingDirectory);
+        var workingDirectory = Path.Combine(Paths.ConfigPath, PluginName);
 
-            pluginCore = new(workingDirectory, new MMConverter(), new MMPngConverter());
-            ui = new(pluginCore);
+        if (!Directory.Exists(workingDirectory))
+            Directory.CreateDirectory(workingDirectory);
 
-            SceneManager.sceneLoaded += (scene, _) =>
-                ui.Visible = scene.buildIndex is 3 or 9;
-        }
+        pluginCore = new(workingDirectory, new MMConverter(), new MMPngConverter());
+        ui = new(pluginCore);
 
-        private void OnGUI() =>
-            ui.Draw();
+        SceneManager.sceneLoaded += (scene, _) =>
+            ui.Visible = scene.buildIndex is 3 or 9;
     }
+
+    private void OnGUI() =>
+        ui.Draw();
 }

+ 23 - 24
src/MeidoPhotoStudio.Converter/PluginCore.cs

@@ -2,37 +2,36 @@ using System;
 using System.IO;
 using MeidoPhotoStudio.Converter.Converters;
 
-namespace MeidoPhotoStudio.Converter
+namespace MeidoPhotoStudio.Converter;
+
+public class PluginCore
 {
-    public class PluginCore
-    {
-        private readonly IConverter[] converters;
+    private readonly IConverter[] converters;
 
-        public string WorkingDirectory { get; set; }
+    public string WorkingDirectory { get; set; }
 
-        public PluginCore(string workingDirectory, params IConverter[] converters)
-        {
-            WorkingDirectory = workingDirectory;
-            this.converters = converters;
-        }
+    public PluginCore(string workingDirectory, params IConverter[] converters)
+    {
+        WorkingDirectory = workingDirectory;
+        this.converters = converters;
+    }
 
-        public void Convert()
-        {
-            Directory.CreateDirectory(WorkingDirectory);
+    public void Convert()
+    {
+        Directory.CreateDirectory(WorkingDirectory);
 
-            foreach (var converter in converters)
+        foreach (var converter in converters)
+        {
+            try
+            {
+                converter.Convert(WorkingDirectory);
+            }
+            catch (Exception e)
             {
-                try
-                {
-                    converter.Convert(WorkingDirectory);
-                }
-                catch (Exception e)
-                {
-                    if (Plugin.Instance == null)
-                        continue;
+                if (Plugin.Instance == null)
+                    continue;
 
-                    Plugin.Instance.Logger.LogError($"Could not convert data because {e}");
-                }
+                Plugin.Instance.Logger.LogError($"Could not convert data because {e}");
             }
         }
     }

+ 27 - 28
src/MeidoPhotoStudio.Converter/UI.cs

@@ -1,41 +1,40 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Converter
-{
-    public class UI
-    {
-        private const int WindowID = 0xEA4040;
-        private const string WindowTitle = Plugin.PluginName + " " + Plugin.PluginVersion;
+namespace MeidoPhotoStudio.Converter;
 
-        private readonly PluginCore core;
+public class UI
+{
+    private const int WindowID = 0xEA4040;
+    private const string WindowTitle = Plugin.PluginName + " " + Plugin.PluginVersion;
 
-        public bool Visible;
+    private readonly PluginCore core;
 
-        private Rect windowRect;
+    public bool Visible;
 
-        public UI(PluginCore pluginCore) =>
-            core = pluginCore;
+    private Rect windowRect;
 
-        public void Draw()
-        {
-            if (!Visible)
-                return;
+    public UI(PluginCore pluginCore) =>
+        core = pluginCore;
 
-            windowRect.width = 230f;
-            windowRect.height = 100f;
-            windowRect.x = Mathf.Clamp(windowRect.x, 0, Screen.width - windowRect.width);
-            windowRect.y = Mathf.Clamp(windowRect.y, 0, Screen.height - windowRect.height);
-            windowRect = GUI.Window(WindowID, windowRect, GUIFunc, WindowTitle);
-        }
+    public void Draw()
+    {
+        if (!Visible)
+            return;
+
+        windowRect.width = 230f;
+        windowRect.height = 100f;
+        windowRect.x = Mathf.Clamp(windowRect.x, 0, Screen.width - windowRect.width);
+        windowRect.y = Mathf.Clamp(windowRect.y, 0, Screen.height - windowRect.height);
+        windowRect = GUI.Window(WindowID, windowRect, GUIFunc, WindowTitle);
+    }
 
-        private void GUIFunc(int windowId)
-        {
-            GUILayout.FlexibleSpace();
+    private void GUIFunc(int windowId)
+    {
+        GUILayout.FlexibleSpace();
 
-            if (GUILayout.Button("Convert"))
-                core.Convert();
+        if (GUILayout.Button("Convert"))
+            core.Convert();
 
-            GUI.DragWindow();
-        }
+        GUI.DragWindow();
     }
 }

+ 21 - 22
src/MeidoPhotoStudio.Converter/Utility/LZMA.cs

@@ -1,40 +1,39 @@
 using System.IO;
 using SevenZip.Compression.LZMA;
 
-namespace MeidoPhotoStudio.Converter.Utility
+namespace MeidoPhotoStudio.Converter.Utility;
+
+internal static class LZMA
 {
-    internal static class LZMA
+    public static MemoryStream Decompress(Stream inStream)
     {
-        public static MemoryStream Decompress(Stream inStream)
-        {
-            var outStream = new MemoryStream();
+        var outStream = new MemoryStream();
 
-            var properties = new byte[5];
+        var properties = new byte[5];
 
-            if (inStream.Read(properties, 0, 5) != 5)
-                throw new("input .lzma is too short");
+        if (inStream.Read(properties, 0, 5) != 5)
+            throw new("input .lzma is too short");
 
-            var decoder = new Decoder();
+        var decoder = new Decoder();
 
-            decoder.SetDecoderProperties(properties);
+        decoder.SetDecoderProperties(properties);
 
-            var outSize = 0L;
+        var outSize = 0L;
 
-            for (var i = 0; i < 8; i++)
-            {
-                var v = inStream.ReadByte();
+        for (var i = 0; i < 8; i++)
+        {
+            var v = inStream.ReadByte();
 
-                if (v < 0)
-                    throw new("Can't Read 1");
+            if (v < 0)
+                throw new("Can't Read 1");
 
-                outSize |= ((long)(byte)v) << (8 * i);
-            }
+            outSize |= ((long)(byte)v) << (8 * i);
+        }
 
-            var compressedSize = inStream.Length - inStream.Position;
+        var compressedSize = inStream.Length - inStream.Position;
 
-            decoder.Code(inStream, outStream, compressedSize, outSize, null);
+        decoder.Code(inStream, outStream, compressedSize, outSize, null);
 
-            return outStream;
-        }
+        return outStream;
     }
 }

+ 43 - 44
src/MeidoPhotoStudio.Converter/Utility/PngUtility.cs

@@ -1,60 +1,59 @@
 using System;
 using System.IO;
 
-namespace MeidoPhotoStudio.Converter.Utility
+namespace MeidoPhotoStudio.Converter.Utility;
+
+internal static class PngUtility
 {
-    internal static class PngUtility
-    {
-        private static readonly byte[] PngHeader = { 137, 80, 78, 71, 13, 10, 26, 10 };
-        private static readonly byte[] PngEnd = System.Text.Encoding.ASCII.GetBytes("IEND");
+    private static readonly byte[] PngHeader = { 137, 80, 78, 71, 13, 10, 26, 10 };
+    private static readonly byte[] PngEnd = System.Text.Encoding.ASCII.GetBytes("IEND");
 
-        public static byte[]? ExtractPng(Stream stream)
-        {
-            var memoryStream = new MemoryStream();
+    public static byte[]? ExtractPng(Stream stream)
+    {
+        var memoryStream = new MemoryStream();
 
-            var headerBuffer = new byte[PngHeader.Length];
+        var headerBuffer = new byte[PngHeader.Length];
 
-            stream.Read(headerBuffer, 0, headerBuffer.Length);
+        stream.Read(headerBuffer, 0, headerBuffer.Length);
 
-            if (!MeidoPhotoStudio.Plugin.Utility.BytesEqual(headerBuffer, PngHeader))
-                return null;
+        if (!MeidoPhotoStudio.Plugin.Utility.BytesEqual(headerBuffer, PngHeader))
+            return null;
 
-            memoryStream.Write(headerBuffer, 0, headerBuffer.Length);
+        memoryStream.Write(headerBuffer, 0, headerBuffer.Length);
 
-            var fourByteBuffer = new byte[4];
-            var chunkBuffer = new byte[1024];
+        var fourByteBuffer = new byte[4];
+        var chunkBuffer = new byte[1024];
 
-            try
-            {
-                do
-                {
-                    // chunk length
-                    var read = stream.Read(fourByteBuffer, 0, 4);
-                    memoryStream.Write(fourByteBuffer, 0, read);
-
-                    if (BitConverter.IsLittleEndian)
-                        Array.Reverse(fourByteBuffer);
-
-                    var length = BitConverter.ToUInt32(fourByteBuffer, 0);
-
-                    // chunk type
-                    read = stream.Read(fourByteBuffer, 0, 4);
-                    memoryStream.Write(fourByteBuffer, 0, read);
-
-                    if (chunkBuffer.Length < length + 4L)
-                        chunkBuffer = new byte[length + 4L];
-
-                    // chunk data + CRC
-                    read = stream.Read(chunkBuffer, 0, (int)(length + 4L));
-                    memoryStream.Write(chunkBuffer, 0, read);
-                } while (!MeidoPhotoStudio.Plugin.Utility.BytesEqual(fourByteBuffer, PngEnd));
-            }
-            catch
+        try
+        {
+            do
             {
-                return null;
-            }
+                // chunk length
+                var read = stream.Read(fourByteBuffer, 0, 4);
+                memoryStream.Write(fourByteBuffer, 0, read);
+
+                if (BitConverter.IsLittleEndian)
+                    Array.Reverse(fourByteBuffer);
 
-            return memoryStream.ToArray();
+                var length = BitConverter.ToUInt32(fourByteBuffer, 0);
+
+                // chunk type
+                read = stream.Read(fourByteBuffer, 0, 4);
+                memoryStream.Write(fourByteBuffer, 0, read);
+
+                if (chunkBuffer.Length < length + 4L)
+                    chunkBuffer = new byte[length + 4L];
+
+                // chunk data + CRC
+                read = stream.Read(chunkBuffer, 0, (int)(length + 4L));
+                memoryStream.Write(chunkBuffer, 0, read);
+            } while (!MeidoPhotoStudio.Plugin.Utility.BytesEqual(fourByteBuffer, PngEnd));
         }
+        catch
+        {
+            return null;
+        }
+
+        return memoryStream.ToArray();
     }
 }

+ 8 - 9
src/MeidoPhotoStudio.Plugin/Configuration.cs

@@ -1,16 +1,15 @@
 using BepInEx.Configuration;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class Configuration
 {
-    public static class Configuration
-    {
-        public static ConfigFile Config { get; }
+    public static ConfigFile Config { get; }
 
-        static Configuration()
-        {
-            var configPath = System.IO.Path.Combine(Constants.configPath, $"{MeidoPhotoStudio.pluginName}.cfg");
+    static Configuration()
+    {
+        var configPath = System.IO.Path.Combine(Constants.configPath, $"{MeidoPhotoStudio.pluginName}.cfg");
 
-            Config = new(configPath, false);
-        }
+        Config = new(configPath, false);
     }
 }

File diff suppressed because it is too large
+ 774 - 775
src/MeidoPhotoStudio.Plugin/Constants.cs


+ 138 - 139
src/MeidoPhotoStudio.Plugin/DragPoint/CustomGizmo.cs

@@ -2,173 +2,172 @@ using System;
 using System.Reflection;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class CustomGizmo : GizmoRender
 {
-    public class CustomGizmo : GizmoRender
-    {
-        public enum GizmoType { Rotate, Move, Scale }
-        public enum GizmoMode { Local, World, Global }
+    public enum GizmoType { Rotate, Move, Scale }
+    public enum GizmoMode { Local, World, Global }
 
-        private static readonly Camera camera = GameMain.Instance.MainCamera.camera;
-        private static new readonly FieldInfo is_drag_ = Utility.GetFieldInfo<GizmoRender>("is_drag_");
+    private static readonly Camera camera = GameMain.Instance.MainCamera.camera;
+    private static new readonly FieldInfo is_drag_ = Utility.GetFieldInfo<GizmoRender>("is_drag_");
 
-        private new readonly FieldInfo beSelectedType = Utility.GetFieldInfo<GizmoRender>("beSelectedType");
+    private new readonly FieldInfo beSelectedType = Utility.GetFieldInfo<GizmoRender>("beSelectedType");
 
-        public static bool IsDrag
-        {
-            get => (bool)is_drag_.GetValue(null);
-            private set => is_drag_.SetValue(null, value);
-        }
+    public static bool IsDrag
+    {
+        get => (bool)is_drag_.GetValue(null);
+        private set => is_drag_.SetValue(null, value);
+    }
 
-        public event EventHandler GizmoDrag;
-        public GizmoMode gizmoMode;
-
-        private GizmoType gizmoType;
-        private Transform target;
-        private bool hasAlternateTarget;
-        private Transform positionTransform;
-        private Vector3 positionOld = Vector3.zero;
-        private Vector3 deltaPosition = Vector3.zero;
-        private Vector3 deltaLocalPosition = Vector3.zero;
-        private Quaternion rotationOld = Quaternion.identity;
-        private Quaternion deltaRotation = Quaternion.identity;
-        private Quaternion deltaLocalRotation = Quaternion.identity;
-        private Vector3 deltaScale = Vector3.zero;
-        private Vector3 scaleOld = Vector3.one;
-        private GizmoType gizmoTypeOld;
-        private int SelectedType =>
-            (int)beSelectedType.GetValue(this);
-
-        public GizmoType CurrentGizmoType
+    public event EventHandler GizmoDrag;
+    public GizmoMode gizmoMode;
+
+    private GizmoType gizmoType;
+    private Transform target;
+    private bool hasAlternateTarget;
+    private Transform positionTransform;
+    private Vector3 positionOld = Vector3.zero;
+    private Vector3 deltaPosition = Vector3.zero;
+    private Vector3 deltaLocalPosition = Vector3.zero;
+    private Quaternion rotationOld = Quaternion.identity;
+    private Quaternion deltaRotation = Quaternion.identity;
+    private Quaternion deltaLocalRotation = Quaternion.identity;
+    private Vector3 deltaScale = Vector3.zero;
+    private Vector3 scaleOld = Vector3.one;
+    private GizmoType gizmoTypeOld;
+    private int SelectedType =>
+        (int)beSelectedType.GetValue(this);
+
+    public GizmoType CurrentGizmoType
+    {
+        get => gizmoType;
+        set
         {
-            get => gizmoType;
-            set
-            {
-                gizmoType = value;
-
-                if (gizmoTypeOld == gizmoType)
-                    return;
-
-                gizmoTypeOld = gizmoType;
-                eAxis = gizmoType == GizmoType.Move;
-                eScal = gizmoType == GizmoType.Scale;
-                eRotate = gizmoType == GizmoType.Rotate;
-            }
+            gizmoType = value;
+
+            if (gizmoTypeOld == gizmoType)
+                return;
+
+            gizmoTypeOld = gizmoType;
+            eAxis = gizmoType == GizmoType.Move;
+            eScal = gizmoType == GizmoType.Scale;
+            eRotate = gizmoType == GizmoType.Rotate;
         }
+    }
 
-        public bool IsGizmoDrag =>
-            GizmoVisible && IsDrag && SelectedType != 0;
+    public bool IsGizmoDrag =>
+        GizmoVisible && IsDrag && SelectedType != 0;
 
-        public bool GizmoVisible
+    public bool GizmoVisible
+    {
+        get => Visible;
+        set
         {
-            get => Visible;
-            set
-            {
-                if (value && IsDrag)
-                    IsDrag = false;
-
-                Visible = value;
-            }
+            if (value && IsDrag)
+                IsDrag = false;
+
+            Visible = value;
         }
+    }
 
-        public static CustomGizmo Make(Transform target, float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
-        {
-            var gizmoGo = new GameObject($"[MPS Gizmo {target.gameObject.name}]");
-            gizmoGo.transform.SetParent(target);
+    public static CustomGizmo Make(Transform target, float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
+    {
+        var gizmoGo = new GameObject($"[MPS Gizmo {target.gameObject.name}]");
+        gizmoGo.transform.SetParent(target);
 
-            var gizmo = gizmoGo.AddComponent<CustomGizmo>();
-            gizmo.target = target;
-            gizmo.lineRSelectedThick = 0.25f;
-            gizmo.offsetScale = scale;
-            gizmo.gizmoMode = mode;
-            gizmo.CurrentGizmoType = GizmoType.Rotate;
+        var gizmo = gizmoGo.AddComponent<CustomGizmo>();
+        gizmo.target = target;
+        gizmo.lineRSelectedThick = 0.25f;
+        gizmo.offsetScale = scale;
+        gizmo.gizmoMode = mode;
+        gizmo.CurrentGizmoType = GizmoType.Rotate;
 
-            return gizmo;
-        }
+        return gizmo;
+    }
 
-        public void SetAlternateTarget(Transform trans)
-        {
-            positionTransform = trans;
-            hasAlternateTarget = trans != null;
-        }
+    public void SetAlternateTarget(Transform trans)
+    {
+        positionTransform = trans;
+        hasAlternateTarget = trans != null;
+    }
 
-        public override void Update()
-        {
-            BeginUpdate();
+    public override void Update()
+    {
+        BeginUpdate();
 
-            base.Update();
+        base.Update();
 
-            if (IsGizmoDrag)
-                SetTargetTransform();
+        if (IsGizmoDrag)
+            SetTargetTransform();
 
-            SetTransform();
+        SetTransform();
 
-            EndUpdate();
-        }
+        EndUpdate();
+    }
 
-        private void BeginUpdate()
-        {
-            var rotation = transform.rotation;
+    private void BeginUpdate()
+    {
+        var rotation = transform.rotation;
 
-            deltaPosition = transform.position - positionOld;
-            deltaRotation = rotation * Quaternion.Inverse(rotationOld);
-            deltaLocalPosition = transform.InverseTransformVector(deltaPosition);
-            deltaLocalRotation = Quaternion.Inverse(rotationOld) * rotation;
-            deltaScale = transform.localScale - scaleOld;
-        }
+        deltaPosition = transform.position - positionOld;
+        deltaRotation = rotation * Quaternion.Inverse(rotationOld);
+        deltaLocalPosition = transform.InverseTransformVector(deltaPosition);
+        deltaLocalRotation = Quaternion.Inverse(rotationOld) * rotation;
+        deltaScale = transform.localScale - scaleOld;
+    }
 
-        private void EndUpdate()
-        {
-            var transform = this.transform;
+    private void EndUpdate()
+    {
+        var transform = this.transform;
 
-            positionOld = transform.position;
-            rotationOld = transform.rotation;
-            scaleOld = transform.localScale;
-        }
+        positionOld = transform.position;
+        rotationOld = transform.rotation;
+        scaleOld = transform.localScale;
+    }
 
-        private void SetTargetTransform()
-        {
-            bool dragged;
-
-            switch (gizmoMode)
-            {
-                case GizmoMode.Local:
-                    target.position += target.transform.TransformVector(deltaLocalPosition).normalized
-                        * deltaLocalPosition.magnitude;
-                    target.rotation *= deltaLocalRotation;
-                    target.localScale += deltaScale;
-                    dragged = deltaLocalRotation != Quaternion.identity || deltaLocalPosition != Vector3.zero
-                        || deltaScale != Vector3.zero;
-                    break;
-                case GizmoMode.World:
-                case GizmoMode.Global:
-                    target.position += deltaPosition;
-                    target.rotation = deltaRotation * target.rotation;
-                    dragged = deltaRotation != Quaternion.identity || deltaPosition != Vector3.zero;
-                    break;
-                default: throw new ArgumentOutOfRangeException();
-            }
-
-            if (dragged)
-                OnGizmoDrag();
-        }
+    private void SetTargetTransform()
+    {
+        bool dragged;
 
-        private void SetTransform()
+        switch (gizmoMode)
         {
-            var transform = this.transform;
-
-            transform.position = (hasAlternateTarget ? positionTransform : target).position;
-            transform.localScale = Vector3.one;
-            transform.rotation = gizmoMode switch
-            {
-                GizmoMode.Local => target.rotation,
-                GizmoMode.World => Quaternion.identity,
-                GizmoMode.Global => Quaternion.LookRotation(transform.position - camera.transform.position),
-                _ => target.rotation
-            };
+            case GizmoMode.Local:
+                target.position += target.transform.TransformVector(deltaLocalPosition).normalized
+                    * deltaLocalPosition.magnitude;
+                target.rotation *= deltaLocalRotation;
+                target.localScale += deltaScale;
+                dragged = deltaLocalRotation != Quaternion.identity || deltaLocalPosition != Vector3.zero
+                    || deltaScale != Vector3.zero;
+                break;
+            case GizmoMode.World:
+            case GizmoMode.Global:
+                target.position += deltaPosition;
+                target.rotation = deltaRotation * target.rotation;
+                dragged = deltaRotation != Quaternion.identity || deltaPosition != Vector3.zero;
+                break;
+            default: throw new ArgumentOutOfRangeException();
         }
 
-        private void OnGizmoDrag() =>
-            GizmoDrag?.Invoke(this, EventArgs.Empty);
+        if (dragged)
+            OnGizmoDrag();
+    }
+
+    private void SetTransform()
+    {
+        var transform = this.transform;
+
+        transform.position = (hasAlternateTarget ? positionTransform : target).position;
+        transform.localScale = Vector3.one;
+        transform.rotation = gizmoMode switch
+        {
+            GizmoMode.Local => target.rotation,
+            GizmoMode.World => Quaternion.identity,
+            GizmoMode.Global => Quaternion.LookRotation(transform.position - camera.transform.position),
+            _ => target.rotation
+        };
     }
+
+    private void OnGizmoDrag() =>
+        GizmoDrag?.Invoke(this, EventArgs.Empty);
 }

+ 220 - 221
src/MeidoPhotoStudio.Plugin/DragPoint/DragPoint.cs

@@ -3,293 +3,292 @@ using UnityEngine;
 
 using static MeidoPhotoStudio.Plugin.CustomGizmo;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class DragPoint : MonoBehaviour
 {
-    public abstract class DragPoint : MonoBehaviour
+    public enum DragType
     {
-        public enum DragType
-        {
-            None, Ignore, Select, Delete, MoveXZ, MoveY, RotLocalXZ, RotY, RotLocalY, Scale
-        }
+        None, Ignore, Select, Delete, MoveXZ, MoveY, RotLocalXZ, RotY, RotLocalY, Scale
+    }
 
-        public const float defaultAlpha = 0.75f;
-
-        private const float doubleClickSensitivity = 0.3f;
-
-        public static Material dragPointMaterial = new(Shader.Find("CM3D2/Trans_AbsoluteFront"));
-        public static readonly Color defaultColour = new(0f, 0f, 0f, 0.4f);
-
-        protected static Camera camera = GameMain.Instance.MainCamera.camera;
-
-        // TODO: Use this value or just throw it away.
-        private static readonly int layer = (int)Mathf.Log(LayerMask.GetMask("AbsolutFront"), 2);
-        private static GameObject dragPointParent;
-
-        private Func<Vector3> position;
-        private Func<Vector3> rotation;
-        private Collider collider;
-        private Renderer renderer;
-        private bool reinitializeDrag;
-        private Vector3 startMousePosition;
-        private float startDoubleClick;
-        private Vector3 screenPoint;
-        private Vector3 startOffset;
-        private Vector3 newOffset;
-        private Vector3 baseScale;
-        private DragType oldDragType;
-        private DragType currentDragType;
-        private bool dragPointEnabled = true;
-        private float dragPointScale = 1f;
-        private bool gizmoEnabled = true;
-
-        public GameObject MyGameObject =>
-            MyObject.gameObject;
-
-        public Vector3 OriginalScale { get; private set; }
-        public Transform MyObject { get; protected set; }
-        public GameObject GizmoGo { get; protected set; }
-        public CustomGizmo Gizmo { get; protected set; }
-
-        public Vector3 BaseScale
+    public const float defaultAlpha = 0.75f;
+
+    private const float doubleClickSensitivity = 0.3f;
+
+    public static Material dragPointMaterial = new(Shader.Find("CM3D2/Trans_AbsoluteFront"));
+    public static readonly Color defaultColour = new(0f, 0f, 0f, 0.4f);
+
+    protected static Camera camera = GameMain.Instance.MainCamera.camera;
+
+    // TODO: Use this value or just throw it away.
+    private static readonly int layer = (int)Mathf.Log(LayerMask.GetMask("AbsolutFront"), 2);
+    private static GameObject dragPointParent;
+
+    private Func<Vector3> position;
+    private Func<Vector3> rotation;
+    private Collider collider;
+    private Renderer renderer;
+    private bool reinitializeDrag;
+    private Vector3 startMousePosition;
+    private float startDoubleClick;
+    private Vector3 screenPoint;
+    private Vector3 startOffset;
+    private Vector3 newOffset;
+    private Vector3 baseScale;
+    private DragType oldDragType;
+    private DragType currentDragType;
+    private bool dragPointEnabled = true;
+    private float dragPointScale = 1f;
+    private bool gizmoEnabled = true;
+
+    public GameObject MyGameObject =>
+        MyObject.gameObject;
+
+    public Vector3 OriginalScale { get; private set; }
+    public Transform MyObject { get; protected set; }
+    public GameObject GizmoGo { get; protected set; }
+    public CustomGizmo Gizmo { get; protected set; }
+
+    public Vector3 BaseScale
+    {
+        get => baseScale;
+        protected set
         {
-            get => baseScale;
-            protected set
-            {
-                baseScale = value;
-                transform.localScale = BaseScale * DragPointScale;
-            }
+            baseScale = value;
+            transform.localScale = BaseScale * DragPointScale;
         }
+    }
 
-        public float DragPointScale
+    public float DragPointScale
+    {
+        get => dragPointScale;
+        set
         {
-            get => dragPointScale;
-            set
-            {
-                dragPointScale = value;
-                transform.localScale = BaseScale * dragPointScale;
-            }
+            dragPointScale = value;
+            transform.localScale = BaseScale * dragPointScale;
         }
+    }
 
-        public bool DragPointEnabled
+    public bool DragPointEnabled
+    {
+        get => dragPointEnabled;
+        set
         {
-            get => dragPointEnabled;
-            set
-            {
-                if (dragPointEnabled == value)
-                    return;
+            if (dragPointEnabled == value)
+                return;
 
-                dragPointEnabled = value;
-                ApplyDragType();
-            }
+            dragPointEnabled = value;
+            ApplyDragType();
         }
+    }
 
-        public bool GizmoEnabled
+    public bool GizmoEnabled
+    {
+        get => GizmoGo != null && gizmoEnabled;
+        set
         {
-            get => GizmoGo != null && gizmoEnabled;
-            set
-            {
-                if (GizmoGo == null || gizmoEnabled == value)
-                    return;
+            if (GizmoGo == null || gizmoEnabled == value)
+                return;
 
-                gizmoEnabled = value;
-                ApplyDragType();
-            }
+            gizmoEnabled = value;
+            ApplyDragType();
         }
+    }
 
-        protected DragType CurrentDragType
+    protected DragType CurrentDragType
+    {
+        get => currentDragType;
+        set
         {
-            get => currentDragType;
-            set
+            if (value != oldDragType)
             {
-                if (value != oldDragType)
-                {
-                    currentDragType = value;
-                    reinitializeDrag = true;
-                    oldDragType = currentDragType;
-                    ApplyDragType();
-                }
+                currentDragType = value;
+                reinitializeDrag = true;
+                oldDragType = currentDragType;
+                ApplyDragType();
             }
         }
+    }
 
-        protected bool Transforming =>
-            CurrentDragType >= DragType.MoveXZ;
+    protected bool Transforming =>
+        CurrentDragType >= DragType.MoveXZ;
 
-        protected bool Special =>
-            CurrentDragType is DragType.Select or DragType.Delete;
+    protected bool Special =>
+        CurrentDragType is DragType.Select or DragType.Delete;
 
-        protected bool Moving =>
-            CurrentDragType is DragType.MoveXZ or DragType.MoveY;
+    protected bool Moving =>
+        CurrentDragType is DragType.MoveXZ or DragType.MoveY;
 
-        protected bool Rotating =>
-            CurrentDragType is >= DragType.RotLocalXZ and <= DragType.RotLocalY;
+    protected bool Rotating =>
+        CurrentDragType is >= DragType.RotLocalXZ and <= DragType.RotLocalY;
 
-        protected bool Scaling =>
-            CurrentDragType is DragType.Scale;
+    protected bool Scaling =>
+        CurrentDragType is DragType.Scale;
 
-        protected bool Selecting =>
-            CurrentDragType is DragType.Select;
+    protected bool Selecting =>
+        CurrentDragType is DragType.Select;
 
-        protected bool Deleting =>
-            CurrentDragType is DragType.Delete;
+    protected bool Deleting =>
+        CurrentDragType is DragType.Delete;
 
-        static DragPoint()
-        {
-            InputManager.Register(MpsKey.DragSelect, KeyCode.A, "Select handle mode");
-            InputManager.Register(MpsKey.DragDelete, KeyCode.D, "Delete handle mode");
-            InputManager.Register(MpsKey.DragMove, KeyCode.Z, "Move handle mode");
-            InputManager.Register(MpsKey.DragRotate, KeyCode.X, "Rotate handle mode");
-            InputManager.Register(MpsKey.DragScale, KeyCode.C, "Scale handle mode");
-            InputManager.Register(MpsKey.DragFinger, KeyCode.Space, "Show finger handles");
-        }
+    static DragPoint()
+    {
+        InputManager.Register(MpsKey.DragSelect, KeyCode.A, "Select handle mode");
+        InputManager.Register(MpsKey.DragDelete, KeyCode.D, "Delete handle mode");
+        InputManager.Register(MpsKey.DragMove, KeyCode.Z, "Move handle mode");
+        InputManager.Register(MpsKey.DragRotate, KeyCode.X, "Rotate handle mode");
+        InputManager.Register(MpsKey.DragScale, KeyCode.C, "Scale handle mode");
+        InputManager.Register(MpsKey.DragFinger, KeyCode.Space, "Show finger handles");
+    }
 
-        public static T Make<T>(PrimitiveType primitiveType, Vector3 scale) where T : DragPoint
-        {
-            var dragPointGo = GameObject.CreatePrimitive(primitiveType);
+    public static T Make<T>(PrimitiveType primitiveType, Vector3 scale) where T : DragPoint
+    {
+        var dragPointGo = GameObject.CreatePrimitive(primitiveType);
 
-            dragPointGo.transform.SetParent(DragPointParent().transform, false);
-            dragPointGo.transform.localScale = scale;
-            dragPointGo.layer = 8;
+        dragPointGo.transform.SetParent(DragPointParent().transform, false);
+        dragPointGo.transform.localScale = scale;
+        dragPointGo.layer = 8;
 
-            var dragPoint = dragPointGo.AddComponent<T>();
+        var dragPoint = dragPointGo.AddComponent<T>();
 
-            dragPoint.renderer.material = dragPointMaterial;
-            dragPoint.renderer.material.color = defaultColour;
+        dragPoint.renderer.material = dragPointMaterial;
+        dragPoint.renderer.material.color = defaultColour;
 
-            return dragPoint;
-        }
+        return dragPoint;
+    }
 
-        private static GameObject DragPointParent() =>
-            dragPointParent ? dragPointParent : (dragPointParent = new("[MPS DragPoint Parent]"));
+    private static GameObject DragPointParent() =>
+        dragPointParent ? dragPointParent : (dragPointParent = new("[MPS DragPoint Parent]"));
 
-        protected abstract void UpdateDragType();
+    protected abstract void UpdateDragType();
 
-        protected abstract void Drag();
+    protected abstract void Drag();
 
-        public virtual void Initialize(Func<Vector3> position, Func<Vector3> rotation)
-        {
-            this.position = position;
-            this.rotation = rotation;
-        }
+    public virtual void Initialize(Func<Vector3> position, Func<Vector3> rotation)
+    {
+        this.position = position;
+        this.rotation = rotation;
+    }
 
-        public virtual void Set(Transform myObject)
-        {
-            MyObject = myObject;
-            gameObject.name = $"[MPS DragPoint: {MyObject.name}]";
-        }
+    public virtual void Set(Transform myObject)
+    {
+        MyObject = myObject;
+        gameObject.name = $"[MPS DragPoint: {MyObject.name}]";
+    }
 
-        public virtual void AddGizmo(float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
-        {
-            Gizmo = CustomGizmo.Make(MyObject, scale, mode);
-            GizmoGo = Gizmo.gameObject;
-            Gizmo.GizmoVisible = false;
-            ApplyDragType();
-        }
+    public virtual void AddGizmo(float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
+    {
+        Gizmo = CustomGizmo.Make(MyObject, scale, mode);
+        GizmoGo = Gizmo.gameObject;
+        Gizmo.GizmoVisible = false;
+        ApplyDragType();
+    }
 
-        public void ApplyProperties(bool active = false, bool visible = false, bool gizmo = false)
-        {
-            collider.enabled = active;
-            renderer.enabled = visible;
+    public void ApplyProperties(bool active = false, bool visible = false, bool gizmo = false)
+    {
+        collider.enabled = active;
+        renderer.enabled = visible;
 
-            if (Gizmo)
-                Gizmo.GizmoVisible = gizmo;
-        }
+        if (Gizmo)
+            Gizmo.GizmoVisible = gizmo;
+    }
 
-        protected virtual void ApplyDragType() { }
+    protected virtual void ApplyDragType() { }
 
-        protected virtual void Update()
-        {
-            transform.position = position();
-            transform.eulerAngles = rotation();
+    protected virtual void Update()
+    {
+        transform.position = position();
+        transform.eulerAngles = rotation();
 
-            UpdateDragType();
-        }
+        UpdateDragType();
+    }
 
-        protected virtual void OnMouseDown()
-        {
-            screenPoint = camera.WorldToScreenPoint(transform.position);
-            startMousePosition = Utility.MousePosition;
-            startOffset = transform.position - camera.ScreenToWorldPoint(
+    protected virtual void OnMouseDown()
+    {
+        screenPoint = camera.WorldToScreenPoint(transform.position);
+        startMousePosition = Utility.MousePosition;
+        startOffset = transform.position - camera.ScreenToWorldPoint(
                 new(startMousePosition.x, startMousePosition.y, screenPoint.z)
-            );
-            newOffset = transform.position - MyObject.position;
-        }
+                );
+        newOffset = transform.position - MyObject.position;
+    }
 
-        protected virtual void OnMouseDrag()
+    protected virtual void OnMouseDrag()
+    {
+        if (reinitializeDrag)
         {
-            if (reinitializeDrag)
-            {
-                reinitializeDrag = false;
-                OnMouseDown();
-            }
-
-            if (collider.enabled && startMousePosition != Utility.MousePosition)
-                Drag();
+            reinitializeDrag = false;
+            OnMouseDown();
         }
 
-        protected virtual void OnMouseUp()
+        if (collider.enabled && startMousePosition != Utility.MousePosition)
+            Drag();
+    }
+
+    protected virtual void OnMouseUp()
+    {
+        if (Time.time - startDoubleClick < doubleClickSensitivity)
         {
-            if (Time.time - startDoubleClick < doubleClickSensitivity)
-            {
-                startDoubleClick = -1f;
-                OnDoubleClick();
-            }
-            else
-                startDoubleClick = Time.time;
+            startDoubleClick = -1f;
+            OnDoubleClick();
         }
+        else
+            startDoubleClick = Time.time;
+    }
 
-        protected virtual void OnDoubleClick() { }
+    protected virtual void OnDoubleClick() { }
 
-        protected virtual void OnDestroy() =>
-            Destroy(GizmoGo);
+    protected virtual void OnDestroy() =>
+        Destroy(GizmoGo);
 
-        protected void ApplyColour(Color colour) =>
-            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) =>
-            ApplyColour(new(r, g, b, a));
+    protected void ApplyColour(float r, float g, float b, float a = defaultAlpha) =>
+        ApplyColour(new(r, g, b, a));
 
-        protected Vector3 MouseDelta() =>
-            Utility.MousePosition - startMousePosition;
+    protected Vector3 MouseDelta() =>
+        Utility.MousePosition - startMousePosition;
 
-        protected bool OtherDragType() =>
-            InputManager.GetKey(MpsKey.DragSelect) || InputManager.GetKey(MpsKey.DragDelete)
-            || InputManager.GetKey(MpsKey.DragMove) || InputManager.GetKey(MpsKey.DragRotate)
-            || InputManager.GetKey(MpsKey.DragScale) || InputManager.GetKey(MpsKey.DragFinger);
+    protected bool OtherDragType() =>
+        InputManager.GetKey(MpsKey.DragSelect) || InputManager.GetKey(MpsKey.DragDelete)
+        || InputManager.GetKey(MpsKey.DragMove) || InputManager.GetKey(MpsKey.DragRotate)
+        || InputManager.GetKey(MpsKey.DragScale) || InputManager.GetKey(MpsKey.DragFinger);
 
-        protected Vector3 CursorPosition()
-        {
-            var mousePosition = Utility.MousePosition;
+    protected Vector3 CursorPosition()
+    {
+        var mousePosition = Utility.MousePosition;
 
-            return camera.ScreenToWorldPoint(new Vector3(mousePosition.x, mousePosition.y, screenPoint.z))
-                + startOffset - newOffset;
-        }
+        return camera.ScreenToWorldPoint(new Vector3(mousePosition.x, mousePosition.y, screenPoint.z))
+            + startOffset - newOffset;
+    }
 
-        private void Awake()
-        {
-            BaseScale = OriginalScale = transform.localScale;
-            collider = GetComponent<Collider>();
-            renderer = GetComponent<Renderer>();
-            ApplyDragType();
-        }
+    private void Awake()
+    {
+        BaseScale = OriginalScale = transform.localScale;
+        collider = GetComponent<Collider>();
+        renderer = GetComponent<Renderer>();
+        ApplyDragType();
+    }
 
-        private void OnEnable()
+    private void OnEnable()
+    {
+        if (position != null)
         {
-            if (position != null)
-            {
-                transform.position = position();
-                transform.eulerAngles = rotation();
-            }
+            transform.position = position();
+            transform.eulerAngles = rotation();
+        }
 
-            if (GizmoGo)
-                GizmoGo.SetActive(true);
+        if (GizmoGo)
+            GizmoGo.SetActive(true);
 
-            ApplyDragType();
-        }
+        ApplyDragType();
+    }
 
-        private void OnDisable()
-        {
-            if (GizmoGo)
-                GizmoGo.SetActive(false);
-        }
+    private void OnDisable()
+    {
+        if (GizmoGo)
+            GizmoGo.SetActive(false);
     }
 }

+ 186 - 187
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointGeneral.cs

@@ -5,242 +5,241 @@ using static MeidoPhotoStudio.Plugin.CustomGizmo;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class DragPointGeneral : DragPoint
 {
-    public abstract class DragPointGeneral : DragPoint
+    public const float smallCube = 0.5f;
+
+    public static readonly Color moveColour = new(0.2f, 0.5f, 0.95f, defaultAlpha);
+    public static readonly Color rotateColour = new(0.2f, 0.75f, 0.3f, defaultAlpha);
+    public static readonly Color scaleColour = new(0.8f, 0.7f, 0.3f, defaultAlpha);
+    public static readonly Color selectColour = new(0.9f, 0.5f, 1f, defaultAlpha);
+    public static readonly Color deleteColour = new(1f, 0.1f, 0.1f, defaultAlpha);
+
+    public event EventHandler Move;
+    public event EventHandler Rotate;
+    public event EventHandler Scale;
+    public event EventHandler EndScale;
+    public event EventHandler Delete;
+    public event EventHandler Select;
+
+    private float currentScale;
+    private bool scaling;
+    private Quaternion currentRotation;
+
+    public Quaternion DefaultRotation { get; set; } = Quaternion.identity;
+    public Vector3 DefaultPosition { get; set; } = Vector3.zero;
+    public Vector3 DefaultScale { get; set; } = Vector3.one;
+    public float ScaleFactor { get; set; } = 1f;
+    public bool ConstantScale { get; set; }
+
+    public override void AddGizmo(float scale = 0.35f, GizmoMode mode = GizmoMode.Local)
     {
-        public const float smallCube = 0.5f;
-
-        public static readonly Color moveColour = new(0.2f, 0.5f, 0.95f, defaultAlpha);
-        public static readonly Color rotateColour = new(0.2f, 0.75f, 0.3f, defaultAlpha);
-        public static readonly Color scaleColour = new(0.8f, 0.7f, 0.3f, defaultAlpha);
-        public static readonly Color selectColour = new(0.9f, 0.5f, 1f, defaultAlpha);
-        public static readonly Color deleteColour = new(1f, 0.1f, 0.1f, defaultAlpha);
-
-        public event EventHandler Move;
-        public event EventHandler Rotate;
-        public event EventHandler Scale;
-        public event EventHandler EndScale;
-        public event EventHandler Delete;
-        public event EventHandler Select;
-
-        private float currentScale;
-        private bool scaling;
-        private Quaternion currentRotation;
-
-        public Quaternion DefaultRotation { get; set; } = Quaternion.identity;
-        public Vector3 DefaultPosition { get; set; } = Vector3.zero;
-        public Vector3 DefaultScale { get; set; } = Vector3.one;
-        public float ScaleFactor { get; set; } = 1f;
-        public bool ConstantScale { get; set; }
-
-        public override void AddGizmo(float scale = 0.35f, GizmoMode mode = GizmoMode.Local)
+        base.AddGizmo(scale, mode);
+
+        Gizmo.GizmoDrag += (s, a) =>
         {
-            base.AddGizmo(scale, mode);
+            if (Gizmo.CurrentGizmoType is GizmoType.Rotate)
+                OnRotate();
+        };
+    }
 
-            Gizmo.GizmoDrag += (s, a) =>
-            {
-                if (Gizmo.CurrentGizmoType is GizmoType.Rotate)
-                    OnRotate();
-            };
-        }
+    protected override void Update()
+    {
+        base.Update();
 
-        protected override void Update()
+        if (ConstantScale)
         {
-            base.Update();
-
-            if (ConstantScale)
-            {
-                var distance = Vector3.Distance(camera.transform.position, transform.position);
+            var distance = Vector3.Distance(camera.transform.position, transform.position);
 
-                transform.localScale = Vector3.one * (0.4f * BaseScale.x * DragPointScale * distance);
-            }
+            transform.localScale = Vector3.one * (0.4f * BaseScale.x * DragPointScale * distance);
         }
+    }
+
+    protected override void UpdateDragType()
+    {
+        var shift = Input.Shift;
 
-        protected override void UpdateDragType()
+        if (Input.GetKey(MpsKey.DragSelect))
+            CurrentDragType = DragType.Select;
+        else if (Input.GetKey(MpsKey.DragDelete))
+            CurrentDragType = DragType.Delete;
+        else if (Input.GetKey(MpsKey.DragMove))
         {
-            var shift = Input.Shift;
-
-            if (Input.GetKey(MpsKey.DragSelect))
-                CurrentDragType = DragType.Select;
-            else if (Input.GetKey(MpsKey.DragDelete))
-                CurrentDragType = DragType.Delete;
-            else if (Input.GetKey(MpsKey.DragMove))
-            {
-                if (Input.Control)
-                    CurrentDragType = DragType.MoveY;
-                else
-                    CurrentDragType = shift ? DragType.RotY : DragType.MoveXZ;
-            }
-            else if (Input.GetKey(MpsKey.DragRotate))
-                CurrentDragType = shift ? DragType.RotLocalY : DragType.RotLocalXZ;
-            else if (Input.GetKey(MpsKey.DragScale))
-                CurrentDragType = DragType.Scale;
+            if (Input.Control)
+                CurrentDragType = DragType.MoveY;
             else
-                CurrentDragType = DragType.None;
+                CurrentDragType = shift ? DragType.RotY : DragType.MoveXZ;
         }
+        else if (Input.GetKey(MpsKey.DragRotate))
+            CurrentDragType = shift ? DragType.RotLocalY : DragType.RotLocalXZ;
+        else if (Input.GetKey(MpsKey.DragScale))
+            CurrentDragType = DragType.Scale;
+        else
+            CurrentDragType = DragType.None;
+    }
 
-        protected override void OnMouseDown()
+    protected override void OnMouseDown()
+    {
+        if (Deleting)
         {
-            if (Deleting)
-            {
-                OnDelete();
+            OnDelete();
 
-                return;
-            }
+            return;
+        }
 
-            if (Selecting)
-            {
-                OnSelect();
+        if (Selecting)
+        {
+            OnSelect();
 
-                return;
-            }
+            return;
+        }
 
-            base.OnMouseDown();
+        base.OnMouseDown();
 
-            currentScale = MyObject.localScale.x;
-            currentRotation = MyObject.rotation;
-        }
+        currentScale = MyObject.localScale.x;
+        currentRotation = MyObject.rotation;
+    }
 
-        protected override void OnDoubleClick()
+    protected override void OnDoubleClick()
+    {
+        if (Scaling)
         {
-            if (Scaling)
-            {
-                MyObject.localScale = DefaultScale;
-                OnScale();
-                OnEndScale();
-            }
-
-            if (Rotating)
-            {
-                ResetRotation();
-                OnRotate();
-            }
-
-            if (Moving)
-            {
-                ResetPosition();
-                OnMove();
-            }
+            MyObject.localScale = DefaultScale;
+            OnScale();
+            OnEndScale();
         }
 
-        protected override void OnMouseUp()
+        if (Rotating)
         {
-            base.OnMouseUp();
-
-            if (scaling)
-            {
-                scaling = false;
-                OnScale();
-                OnEndScale();
-            }
+            ResetRotation();
+            OnRotate();
         }
 
-        protected override void Drag()
+        if (Moving)
         {
-            if (CurrentDragType is DragType.Select or DragType.Delete)
-                return;
+            ResetPosition();
+            OnMove();
+        }
+    }
 
-            var cursorPosition = CursorPosition();
-            var mouseDelta = MouseDelta();
+    protected override void OnMouseUp()
+    {
+        base.OnMouseUp();
 
-            if (CurrentDragType is DragType.MoveXZ)
-            {
-                MyObject.position = new(cursorPosition.x, MyObject.position.y, cursorPosition.z);
-                OnMove();
-            }
+        if (scaling)
+        {
+            scaling = false;
+            OnScale();
+            OnEndScale();
+        }
+    }
 
-            if (CurrentDragType is DragType.MoveY)
-            {
-                MyObject.position = new(
-                    MyObject.position.x, cursorPosition.y, MyObject.position.z
-                );
-                OnMove();
-            }
-
-            if (CurrentDragType is DragType.RotY)
-            {
-                MyObject.rotation = currentRotation;
-                MyObject.Rotate(Vector3.up, -mouseDelta.x / 3f, Space.World);
-                OnRotate();
-            }
+    protected override void Drag()
+    {
+        if (CurrentDragType is DragType.Select or DragType.Delete)
+            return;
 
-            if (CurrentDragType is DragType.RotLocalXZ)
-            {
-                MyObject.rotation = currentRotation;
+        var cursorPosition = CursorPosition();
+        var mouseDelta = MouseDelta();
 
-                var forward = camera.transform.forward;
-                var right = camera.transform.right;
+        if (CurrentDragType is DragType.MoveXZ)
+        {
+            MyObject.position = new(cursorPosition.x, MyObject.position.y, cursorPosition.z);
+            OnMove();
+        }
 
-                forward.y = 0f;
-                right.y = 0f;
-                MyObject.Rotate(forward, -mouseDelta.x / 6f, Space.World);
-                MyObject.Rotate(right, mouseDelta.y / 4f, Space.World);
-                OnRotate();
-            }
+        if (CurrentDragType is DragType.MoveY)
+        {
+            MyObject.position = new(
+                    MyObject.position.x, cursorPosition.y, MyObject.position.z
+                    );
+            OnMove();
+        }
 
-            if (CurrentDragType is DragType.RotLocalY)
-            {
-                MyObject.rotation = currentRotation;
-                MyObject.Rotate(Vector3.up * -mouseDelta.x / 2.2f);
-                OnRotate();
-            }
+        if (CurrentDragType is DragType.RotY)
+        {
+            MyObject.rotation = currentRotation;
+            MyObject.Rotate(Vector3.up, -mouseDelta.x / 3f, Space.World);
+            OnRotate();
+        }
 
-            if (CurrentDragType is DragType.Scale)
-            {
-                scaling = true;
+        if (CurrentDragType is DragType.RotLocalXZ)
+        {
+            MyObject.rotation = currentRotation;
 
-                var scale = currentScale + mouseDelta.y / 200f * ScaleFactor;
+            var forward = camera.transform.forward;
+            var right = camera.transform.right;
 
-                if (scale < 0f)
-                    scale = 0f;
+            forward.y = 0f;
+            right.y = 0f;
+            MyObject.Rotate(forward, -mouseDelta.x / 6f, Space.World);
+            MyObject.Rotate(right, mouseDelta.y / 4f, Space.World);
+            OnRotate();
+        }
 
-                MyObject.localScale = new(scale, scale, scale);
-                OnScale();
-            }
+        if (CurrentDragType is DragType.RotLocalY)
+        {
+            MyObject.rotation = currentRotation;
+            MyObject.Rotate(Vector3.up * -mouseDelta.x / 2.2f);
+            OnRotate();
         }
 
-        protected virtual void ApplyColours()
+        if (CurrentDragType is DragType.Scale)
         {
-            var colour = moveColour;
-
-            if (Rotating)
-                colour = rotateColour;
-            else if (Scaling)
-                colour = scaleColour;
-            else if (Selecting)
-                colour = selectColour;
-            else if (Deleting)
-                colour = deleteColour;
-
-            ApplyColour(colour);
+            scaling = true;
+
+            var scale = currentScale + mouseDelta.y / 200f * ScaleFactor;
+
+            if (scale < 0f)
+                scale = 0f;
+
+            MyObject.localScale = new(scale, scale, scale);
+            OnScale();
         }
+    }
+
+    protected virtual void ApplyColours()
+    {
+        var colour = moveColour;
+
+        if (Rotating)
+            colour = rotateColour;
+        else if (Scaling)
+            colour = scaleColour;
+        else if (Selecting)
+            colour = selectColour;
+        else if (Deleting)
+            colour = deleteColour;
+
+        ApplyColour(colour);
+    }
 
-        protected virtual void ResetPosition() =>
-            MyObject.position = DefaultPosition;
+    protected virtual void ResetPosition() =>
+        MyObject.position = DefaultPosition;
 
-        protected virtual void ResetRotation() =>
-            MyObject.rotation = DefaultRotation;
+    protected virtual void ResetRotation() =>
+        MyObject.rotation = DefaultRotation;
 
-        protected virtual void OnEndScale() =>
-            OnEvent(EndScale);
+    protected virtual void OnEndScale() =>
+        OnEvent(EndScale);
 
-        protected virtual void OnScale() =>
-            OnEvent(Scale);
+    protected virtual void OnScale() =>
+        OnEvent(Scale);
 
-        protected virtual void OnMove() =>
-            OnEvent(Move);
+    protected virtual void OnMove() =>
+        OnEvent(Move);
 
-        protected virtual void OnRotate() =>
-            OnEvent(Rotate);
+    protected virtual void OnRotate() =>
+        OnEvent(Rotate);
 
-        protected virtual void OnSelect() =>
-            OnEvent(Select);
+    protected virtual void OnSelect() =>
+        OnEvent(Select);
 
-        protected virtual void OnDelete() =>
-            OnEvent(Delete);
+    protected virtual void OnDelete() =>
+        OnEvent(Delete);
 
-        private void OnEvent(EventHandler handler) =>
-            handler?.Invoke(this, EventArgs.Empty);
-    }
+    private void OnEvent(EventHandler handler) =>
+        handler?.Invoke(this, EventArgs.Empty);
 }

+ 72 - 73
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointGravity.cs

@@ -2,106 +2,105 @@ using UnityEngine;
 
 using static TBody;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointGravity : DragPointGeneral
 {
-    public class DragPointGravity : DragPointGeneral
-    {
-        private static readonly SlotID[] skirtSlots = { SlotID.skirt, SlotID.onepiece, SlotID.mizugi, SlotID.panz };
-        private static readonly SlotID[] hairSlots = { SlotID.hairF, SlotID.hairR, SlotID.hairS, SlotID.hairT };
+    private static readonly SlotID[] skirtSlots = { SlotID.skirt, SlotID.onepiece, SlotID.mizugi, SlotID.panz };
+    private static readonly SlotID[] hairSlots = { SlotID.hairF, SlotID.hairR, SlotID.hairS, SlotID.hairT };
 
-        public GravityTransformControl Control { get; private set; }
+    public GravityTransformControl Control { get; private set; }
 
-        public bool Valid =>
-            Control.isValid;
+    public bool Valid =>
+        Control.isValid;
 
-        public bool Active =>
-            Valid && gameObject.activeSelf;
+    public bool Active =>
+        Valid && gameObject.activeSelf;
 
-        public static GravityTransformControl MakeGravityControl(Maid maid, bool skirt = false)
-        {
-            var category = skirt ? "skirt" : "hair";
+    public static GravityTransformControl MakeGravityControl(Maid maid, bool skirt = false)
+    {
+        var category = skirt ? "skirt" : "hair";
 
-            var bone = maid.body0.GetBone("Bip01");
-            var gravityGoName = $"GravityDatas_{maid.status.guid}_{category}";
-            var gravityTransform = maid.gameObject.transform.Find(gravityGoName);
+        var bone = maid.body0.GetBone("Bip01");
+        var gravityGoName = $"GravityDatas_{maid.status.guid}_{category}";
+        var gravityTransform = maid.gameObject.transform.Find(gravityGoName);
 
-            if (gravityTransform == null)
-            {
-                var go = new GameObject(gravityGoName);
+        if (gravityTransform == null)
+        {
+            var 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;
+            go.transform.SetParent(bone, false);
+            go.transform.SetParent(maid.transform, true);
+            go.transform.localScale = Vector3.one;
+            go.transform.rotation = Quaternion.identity;
 
-                var go2 = new GameObject(gravityGoName);
+            var go2 = new GameObject(gravityGoName);
 
-                go2.transform.SetParent(go.transform, false);
-                gravityTransform = go2.transform;
-            }
-            else
-            {
-                gravityTransform = gravityTransform.GetChild(0);
+            go2.transform.SetParent(go.transform, false);
+            gravityTransform = go2.transform;
+        }
+        else
+        {
+            gravityTransform = gravityTransform.GetChild(0);
 
-                var control = gravityTransform.GetComponent<GravityTransformControl>();
+            var control = gravityTransform.GetComponent<GravityTransformControl>();
 
-                if (control != null)
-                    Destroy(control);
-            }
+            if (control != null)
+                Destroy(control);
+        }
 
-            var gravityControl = gravityTransform.gameObject.AddComponent<GravityTransformControl>();
+        var gravityControl = gravityTransform.gameObject.AddComponent<GravityTransformControl>();
 
-            var slots = skirt ? skirtSlots : hairSlots;
+        var slots = skirt ? skirtSlots : hairSlots;
 
-            gravityControl.SetTargetSlods(slots);
-            gravityControl.forceRate = 0.1f;
+        gravityControl.SetTargetSlods(slots);
+        gravityControl.forceRate = 0.1f;
 
-            return gravityControl;
-        }
+        return gravityControl;
+    }
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-            Control = myObject.GetComponent<GravityTransformControl>();
-            gameObject.SetActive(false);
-        }
+        Control = myObject.GetComponent<GravityTransformControl>();
+        gameObject.SetActive(false);
+    }
 
-        protected override void ResetPosition() =>
-            Control.transform.localPosition = DefaultPosition;
+    protected override void ResetPosition() =>
+        Control.transform.localPosition = DefaultPosition;
 
-        protected override void ApplyDragType()
-        {
-            ApplyProperties(Moving, Moving, false);
-            ApplyColours();
-        }
+    protected override void ApplyDragType()
+    {
+        ApplyProperties(Moving, Moving, false);
+        ApplyColours();
+    }
 
-        protected override void OnDestroy()
+    protected override void OnDestroy()
+    {
+        if (Control.isValid)
         {
-            if (Control.isValid)
-            {
-                Control.transform.localPosition = Vector3.zero;
-                Control.Update();
-            }
+            Control.transform.localPosition = Vector3.zero;
+            Control.Update();
+        }
 
-            Destroy(Control.transform.parent.gameObject);
+        Destroy(Control.transform.parent.gameObject);
 
-            base.OnDestroy();
-        }
+        base.OnDestroy();
+    }
 
-        private void OnDisable() =>
-            Control.isEnabled = false;
+    private void OnDisable() =>
+        Control.isEnabled = false;
 
-        private void OnEnable()
+    private void OnEnable()
+    {
+        if (Control)
         {
-            if (Control)
-            {
-                // TODO: WTF?
-                Control.isEnabled = true;
-
-                if (!Control.isEnabled)
-                    gameObject.SetActive(false);
-            }
+            // TODO: WTF?
+            Control.isEnabled = true;
+
+            if (!Control.isEnabled)
+                gameObject.SetActive(false);
         }
     }
 }

+ 237 - 238
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointLight.cs

@@ -1,306 +1,305 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointLight : DragPointGeneral
 {
-    public class DragPointLight : DragPointGeneral
+    public enum MPSLightType { Normal, Spot, Point, Disabled }
+    public enum LightProp
     {
-        public enum MPSLightType { Normal, Spot, Point, Disabled }
-        public enum LightProp
-        {
-            LightRotX, LightRotY, Intensity, ShadowStrength, SpotAngle, Range, Red, Green, Blue
-        }
+        LightRotX, LightRotY, Intensity, ShadowStrength, SpotAngle, Range, Red, Green, Blue
+    }
 
-        public static EnvironmentManager EnvironmentManager { private get; set; }
+    public static EnvironmentManager EnvironmentManager { private get; set; }
 
-        private readonly LightProperty[] LightProperties = new LightProperty[]
-        {
-            new(), new(), new()
-        };
+    private readonly LightProperty[] LightProperties = new LightProperty[]
+    {
+        new(), new(), new()
+    };
 
-        private Light light;
-        private bool isDisabled;
-        private bool isColourMode;
+    private Light light;
+    private bool isDisabled;
+    private bool isColourMode;
 
-        public bool IsActiveLight { get; set; }
-        public string Name { get; private set; } = string.Empty;
-        public bool IsMain { get; set; }
-        public MPSLightType SelectedLightType { get; private set; }
+    public bool IsActiveLight { get; set; }
+    public string Name { get; private set; } = string.Empty;
+    public bool IsMain { get; set; }
+    public MPSLightType SelectedLightType { get; private set; }
 
-        public LightProperty CurrentLightProperty =>
-            LightProperties[(int)SelectedLightType];
+    public LightProperty CurrentLightProperty =>
+        LightProperties[(int)SelectedLightType];
 
-        public bool IsDisabled
+    public bool IsDisabled
+    {
+        get => isDisabled;
+        set
         {
-            get => isDisabled;
-            set
-            {
-                isDisabled = value;
-                light.gameObject.SetActive(!isDisabled);
-            }
+            isDisabled = value;
+            light.gameObject.SetActive(!isDisabled);
         }
+    }
 
-        public bool IsColourMode
+    public bool IsColourMode
+    {
+        get => IsMain && isColourMode && SelectedLightType is MPSLightType.Normal;
+        set
         {
-            get => IsMain && isColourMode && SelectedLightType is MPSLightType.Normal;
-            set
-            {
-                if (!IsMain)
-                    return;
-
-                light.color = value ? Color.white : LightColour;
-                camera.backgroundColor = value ? LightColour : Color.black;
-                isColourMode = value;
-                LightColour = isColourMode ? camera.backgroundColor : light.color;
-                EnvironmentManager.BGVisible = !IsColourMode;
-            }
-        }
+            if (!IsMain)
+                return;
 
-        public Quaternion Rotation
-        {
-            get => CurrentLightProperty.Rotation;
-            set => light.transform.rotation = CurrentLightProperty.Rotation = value;
+            light.color = value ? Color.white : LightColour;
+            camera.backgroundColor = value ? LightColour : Color.black;
+            isColourMode = value;
+            LightColour = isColourMode ? camera.backgroundColor : light.color;
+            EnvironmentManager.BGVisible = !IsColourMode;
         }
+    }
 
-        public float Intensity
-        {
-            get => CurrentLightProperty.Intensity;
-            set => light.intensity = CurrentLightProperty.Intensity = value;
-        }
+    public Quaternion Rotation
+    {
+        get => CurrentLightProperty.Rotation;
+        set => light.transform.rotation = CurrentLightProperty.Rotation = value;
+    }
 
-        public float Range
-        {
-            get => CurrentLightProperty.Range;
-            set => light.range = CurrentLightProperty.Range = value;
-        }
+    public float Intensity
+    {
+        get => CurrentLightProperty.Intensity;
+        set => light.intensity = CurrentLightProperty.Intensity = value;
+    }
 
-        public float SpotAngle
-        {
-            get => CurrentLightProperty.SpotAngle;
-            set
-            {
-                light.spotAngle = CurrentLightProperty.SpotAngle = value;
-                light.transform.localScale = Vector3.one * value;
-            }
-        }
+    public float Range
+    {
+        get => CurrentLightProperty.Range;
+        set => light.range = CurrentLightProperty.Range = value;
+    }
 
-        public float ShadowStrength
+    public float SpotAngle
+    {
+        get => CurrentLightProperty.SpotAngle;
+        set
         {
-            get => CurrentLightProperty.ShadowStrength;
-            set => light.shadowStrength = CurrentLightProperty.ShadowStrength = value;
+            light.spotAngle = CurrentLightProperty.SpotAngle = value;
+            light.transform.localScale = Vector3.one * value;
         }
+    }
+
+    public float ShadowStrength
+    {
+        get => CurrentLightProperty.ShadowStrength;
+        set => light.shadowStrength = CurrentLightProperty.ShadowStrength = value;
+    }
 
-        public float LightColorRed
+    public float LightColorRed
+    {
+        get => IsColourMode ? camera.backgroundColor.r : CurrentLightProperty.LightColour.r;
+        set
         {
-            get => IsColourMode ? camera.backgroundColor.r : CurrentLightProperty.LightColour.r;
-            set
-            {
-                var color = IsColourMode ? camera.backgroundColor : light.color;
+            var color = IsColourMode ? camera.backgroundColor : light.color;
 
-                LightColour = new(value, color.g, color.b);
-            }
+            LightColour = new(value, color.g, color.b);
         }
+    }
 
-        public float LightColorGreen
+    public float LightColorGreen
+    {
+        get => IsColourMode ? camera.backgroundColor.g : CurrentLightProperty.LightColour.r;
+        set
         {
-            get => IsColourMode ? camera.backgroundColor.g : CurrentLightProperty.LightColour.r;
-            set
-            {
-                var color = IsColourMode ? camera.backgroundColor : light.color;
+            var color = IsColourMode ? camera.backgroundColor : light.color;
 
-                LightColour = new(color.r, value, color.b);
-            }
+            LightColour = new(color.r, value, color.b);
         }
+    }
 
-        public float LightColorBlue
+    public float LightColorBlue
+    {
+        get => IsColourMode ? camera.backgroundColor.b : CurrentLightProperty.LightColour.r;
+        set
         {
-            get => IsColourMode ? camera.backgroundColor.b : CurrentLightProperty.LightColour.r;
-            set
-            {
-                var color = IsColourMode ? camera.backgroundColor : light.color;
+            var color = IsColourMode ? camera.backgroundColor : light.color;
 
-                LightColour = new(color.r, color.g, value);
-            }
+            LightColour = new(color.r, color.g, value);
         }
+    }
 
-        public Color LightColour
+    public Color LightColour
+    {
+        get => IsColourMode ? camera.backgroundColor : CurrentLightProperty.LightColour;
+        set
         {
-            get => IsColourMode ? camera.backgroundColor : CurrentLightProperty.LightColour;
-            set
-            {
-                var colour = CurrentLightProperty.LightColour = value;
-
-                if (IsColourMode)
-                    camera.backgroundColor = colour;
-                else
-                    light.color = colour;
-            }
-        }
+            var colour = CurrentLightProperty.LightColour = value;
 
-        public static void SetLightProperties(Light light, LightProperty prop)
-        {
-            light.transform.rotation = prop.Rotation;
-            light.intensity = prop.Intensity;
-            light.range = prop.Range;
-            light.spotAngle = prop.SpotAngle;
-            light.shadowStrength = prop.ShadowStrength;
-            light.color = prop.LightColour;
-
-            if (light.type is LightType.Spot)
-                light.transform.localScale = Vector3.one * prop.SpotAngle;
-            else if (light.type is LightType.Point)
-                light.transform.localScale = Vector3.one * prop.Range;
+            if (IsColourMode)
+                camera.backgroundColor = colour;
+            else
+                light.color = colour;
         }
+    }
 
-        public void SetLightType(MPSLightType type)
-        {
-            var lightType = LightType.Directional;
-            var name = "normal";
-
-            SelectedLightType = type;
-
-            if (type is MPSLightType.Spot)
-            {
-                lightType = LightType.Spot;
-                name = "spot";
-            }
-            else if (type is MPSLightType.Point)
-            {
-                lightType = LightType.Point;
-                name = "point";
-            }
-
-            light.type = lightType;
-            Name = IsMain ? "main" : name;
-
-            if (IsMain)
-                EnvironmentManager.BGVisible = !(IsColourMode && SelectedLightType is MPSLightType.Normal);
-
-            SetProps();
-            ApplyDragType();
-        }
+    public static void SetLightProperties(Light light, LightProperty prop)
+    {
+        light.transform.rotation = prop.Rotation;
+        light.intensity = prop.Intensity;
+        light.range = prop.Range;
+        light.spotAngle = prop.SpotAngle;
+        light.shadowStrength = prop.ShadowStrength;
+        light.color = prop.LightColour;
+
+        if (light.type is LightType.Spot)
+            light.transform.localScale = Vector3.one * prop.SpotAngle;
+        else if (light.type is LightType.Point)
+            light.transform.localScale = Vector3.one * prop.Range;
+    }
 
-        public void SetRotation(float x, float y) =>
-            Rotation = Quaternion.Euler(x, y, Rotation.eulerAngles.z);
+    public void SetLightType(MPSLightType type)
+    {
+        var lightType = LightType.Directional;
+        var name = "normal";
+
+        SelectedLightType = type;
 
-        public void SetProp(LightProp prop, float value)
+        if (type is MPSLightType.Spot)
         {
-            switch (prop)
-            {
-                case LightProp.Intensity:
-                    Intensity = value;
-                    break;
-                case LightProp.ShadowStrength:
-                    ShadowStrength = value;
-                    break;
-                case LightProp.SpotAngle:
-                    SpotAngle = value;
-                    break;
-                case LightProp.Range:
-                    Range = value;
-                    break;
-                case LightProp.Red:
-                    LightColorRed = value;
-                    break;
-                case LightProp.Green:
-                    LightColorGreen = value;
-                    break;
-                case LightProp.Blue:
-                    LightColorBlue = value;
-                    break;
-            }
+            lightType = LightType.Spot;
+            name = "spot";
         }
-
-        public void ResetLightProps()
+        else if (type is MPSLightType.Point)
         {
-            LightProperties[(int)SelectedLightType] = new();
-            SetProps();
+            lightType = LightType.Point;
+            name = "point";
         }
 
-        public void ResetLightPosition() =>
-            light.transform.position = LightProperty.DefaultPosition;
+        light.type = lightType;
+        Name = IsMain ? "main" : name;
+
+        if (IsMain)
+            EnvironmentManager.BGVisible = !(IsColourMode && SelectedLightType is MPSLightType.Normal);
+
+        SetProps();
+        ApplyDragType();
+    }
+
+    public void SetRotation(float x, float y) =>
+        Rotation = Quaternion.Euler(x, y, Rotation.eulerAngles.z);
 
-        public override void Set(Transform myObject)
+    public void SetProp(LightProp prop, float value)
+    {
+        switch (prop)
         {
-            base.Set(myObject);
+            case LightProp.Intensity:
+                Intensity = value;
+                break;
+            case LightProp.ShadowStrength:
+                ShadowStrength = value;
+                break;
+            case LightProp.SpotAngle:
+                SpotAngle = value;
+                break;
+            case LightProp.Range:
+                Range = value;
+                break;
+            case LightProp.Red:
+                LightColorRed = value;
+                break;
+            case LightProp.Green:
+                LightColorGreen = value;
+                break;
+            case LightProp.Blue:
+                LightColorBlue = value;
+                break;
+        }
+    }
 
-            light = myObject.gameObject.GetOrAddComponent<Light>();
+    public void ResetLightProps()
+    {
+        LightProperties[(int)SelectedLightType] = new();
+        SetProps();
+    }
 
-            // TODO: Use trasnform.SetPositionAndRotation
-            light.transform.position = LightProperty.DefaultPosition;
-            light.transform.rotation = LightProperty.DefaultRotation;
+    public void ResetLightPosition() =>
+        light.transform.position = LightProperty.DefaultPosition;
 
-            SetLightType(MPSLightType.Normal);
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-            ScaleFactor = 50f;
-            DefaultRotation = LightProperty.DefaultRotation;
-            DefaultPosition = LightProperty.DefaultPosition;
-        }
+        light = myObject.gameObject.GetOrAddComponent<Light>();
 
-        protected override void OnDestroy()
-        {
-            if (!IsMain)
-                Destroy(light.gameObject);
+        // TODO: Use trasnform.SetPositionAndRotation
+        light.transform.position = LightProperty.DefaultPosition;
+        light.transform.rotation = LightProperty.DefaultRotation;
 
-            base.OnDestroy();
-        }
+        SetLightType(MPSLightType.Normal);
 
-        protected override void OnRotate()
-        {
-            CurrentLightProperty.Rotation = light.transform.rotation;
+        ScaleFactor = 50f;
+        DefaultRotation = LightProperty.DefaultRotation;
+        DefaultPosition = LightProperty.DefaultPosition;
+    }
 
-            base.OnRotate();
-        }
+    protected override void OnDestroy()
+    {
+        if (!IsMain)
+            Destroy(light.gameObject);
 
-        protected override void OnScale()
-        {
-            var value = light.transform.localScale.x;
+        base.OnDestroy();
+    }
 
-            if (SelectedLightType is MPSLightType.Point)
-                Range = value;
-            else if (SelectedLightType is MPSLightType.Spot)
-                SpotAngle = value;
+    protected override void OnRotate()
+    {
+        CurrentLightProperty.Rotation = light.transform.rotation;
 
-            base.OnScale();
-        }
+        base.OnRotate();
+    }
 
-        protected override void ApplyDragType()
-        {
-            if (Selecting || Moving)
-                ApplyProperties(true, true, false);
-            else if (SelectedLightType is not MPSLightType.Point && Rotating)
-                ApplyProperties(true, true, false);
-            else if (SelectedLightType is not MPSLightType.Normal && Scaling)
-                ApplyProperties(true, true, false);
-            else if (!IsMain && Deleting)
-                ApplyProperties(true, true, false);
-            else
-                ApplyProperties(false, false, false);
+    protected override void OnScale()
+    {
+        var value = light.transform.localScale.x;
 
-            ApplyColours();
-        }
+        if (SelectedLightType is MPSLightType.Point)
+            Range = value;
+        else if (SelectedLightType is MPSLightType.Spot)
+            SpotAngle = value;
 
-        private void SetProps()
-        {
-            SetLightProperties(light, CurrentLightProperty);
+        base.OnScale();
+    }
 
-            if (IsColourMode)
-            {
-                light.color = Color.white;
-                camera.backgroundColor = CurrentLightProperty.LightColour;
-            }
-        }
+    protected override void ApplyDragType()
+    {
+        if (Selecting || Moving)
+            ApplyProperties(true, true, false);
+        else if (SelectedLightType is not MPSLightType.Point && Rotating)
+            ApplyProperties(true, true, false);
+        else if (SelectedLightType is not MPSLightType.Normal && Scaling)
+            ApplyProperties(true, true, false);
+        else if (!IsMain && Deleting)
+            ApplyProperties(true, true, false);
+        else
+            ApplyProperties(false, false, false);
+
+        ApplyColours();
     }
 
-    public class LightProperty
+    private void SetProps()
     {
-        public static readonly Vector3 DefaultPosition = new(0f, 1.9f, 0.4f);
-        public static readonly Quaternion DefaultRotation = Quaternion.Euler(40f, 180f, 0f);
-
-        public Quaternion Rotation { get; set; } = DefaultRotation;
-        public float Intensity { get; set; } = 0.95f;
-        public float Range { get; set; } = GameMain.Instance.MainLight.GetComponent<Light>().range;
-        public float SpotAngle { get; set; } = 50f;
-        public float ShadowStrength { get; set; } = 0.10f;
-        public Color LightColour { get; set; } = Color.white;
+        SetLightProperties(light, CurrentLightProperty);
+
+        if (IsColourMode)
+        {
+            light.color = Color.white;
+            camera.backgroundColor = CurrentLightProperty.LightColour;
+        }
     }
 }
+
+public class LightProperty
+{
+    public static readonly Vector3 DefaultPosition = new(0f, 1.9f, 0.4f);
+    public static readonly Quaternion DefaultRotation = Quaternion.Euler(40f, 180f, 0f);
+
+    public Quaternion Rotation { get; set; } = DefaultRotation;
+    public float Intensity { get; set; } = 0.95f;
+    public float Range { get; set; } = GameMain.Instance.MainLight.GetComponent<Light>().range;
+    public float SpotAngle { get; set; } = 50f;
+    public float ShadowStrength { get; set; } = 0.10f;
+    public Color LightColour { get; set; } = Color.white;
+}

+ 48 - 49
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointMeido.cs

@@ -3,68 +3,67 @@ using UnityEngine;
 
 using static MeidoPhotoStudio.Plugin.CustomGizmo;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public abstract class DragPointMeido : DragPoint
-    {
-        protected const int jointUpper = 0;
-        protected const int jointMiddle = 1;
-        protected const int jointLower = 2;
+namespace MeidoPhotoStudio.Plugin;
 
-        public static readonly Vector3 boneScale = Vector3.one * 0.04f;
+public abstract class DragPointMeido : DragPoint
+{
+    protected const int jointUpper = 0;
+    protected const int jointMiddle = 1;
+    protected const int jointLower = 2;
 
-        protected Meido meido;
-        protected Maid maid;
-        protected bool isPlaying;
-        protected bool isBone;
+    public static readonly Vector3 boneScale = Vector3.one * 0.04f;
 
-        protected IKCtrlData IkCtrlData =>
-            meido.Body.IKCtrl.GetIKData("左手");
+    protected Meido meido;
+    protected Maid maid;
+    protected bool isPlaying;
+    protected bool isBone;
 
-        public virtual bool IsBone
-        {
-            get => isBone;
-            set
-            {
-                if (value == isBone)
-                    return;
-
-                isBone = value;
-                ApplyDragType();
-            }
-        }
+    protected IKCtrlData IkCtrlData =>
+        meido.Body.IKCtrl.GetIKData("左手");
 
-        public virtual void Initialize(Meido meido, Func<Vector3> position, Func<Vector3> rotation)
+    public virtual bool IsBone
+    {
+        get => isBone;
+        set
         {
-            base.Initialize(position, rotation);
+            if (value == isBone)
+                return;
 
-            this.meido = meido;
-            maid = meido.Maid;
-            isPlaying = !meido.Stop;
+            isBone = value;
+            ApplyDragType();
         }
+    }
 
-        public override void AddGizmo(float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
-        {
-            base.AddGizmo(scale, mode);
+    public virtual void Initialize(Meido meido, Func<Vector3> position, Func<Vector3> rotation)
+    {
+        base.Initialize(position, rotation);
 
-            Gizmo.GizmoDrag += (s, a) =>
-            {
-                meido.Stop = true;
-                isPlaying = false;
-            };
-        }
+        this.meido = meido;
+        maid = meido.Maid;
+        isPlaying = !meido.Stop;
+    }
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+    public override void AddGizmo(float scale = 0.25f, GizmoMode mode = GizmoMode.Local)
+    {
+        base.AddGizmo(scale, mode);
 
-            isPlaying = !meido.Stop;
-        }
+        Gizmo.GizmoDrag += (s, a) =>
+        {
+            meido.Stop = true;
+            isPlaying = false;
+        };
+    }
 
-        protected void InitializeIK(TBody.IKCMO iKCmo, Transform upper, Transform middle, Transform lower) =>
-            iKCmo.Init(upper, middle, lower, maid.body0);
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-        protected void Porc(TBody.IKCMO ikCmo, IKCtrlData ikData, Transform upper, Transform middle, Transform lower) =>
-            ikCmo.Porc(upper, middle, lower, CursorPosition(), Vector3.zero, ikData);
+        isPlaying = !meido.Stop;
     }
+
+    protected void InitializeIK(TBody.IKCMO iKCmo, Transform upper, Transform middle, Transform lower) =>
+        iKCmo.Init(upper, middle, lower, maid.body0);
+
+    protected void Porc(TBody.IKCMO ikCmo, IKCtrlData ikData, Transform upper, Transform middle, Transform lower) =>
+        ikCmo.Porc(upper, middle, lower, CursorPosition(), Vector3.zero, ikData);
 }

+ 33 - 34
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointOther.cs

@@ -1,51 +1,50 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointBody : DragPointGeneral
 {
-    public class DragPointBody : DragPointGeneral
-    {
-        public bool IsCube;
+    public bool IsCube;
 
-        private bool isIK;
+    private bool isIK;
 
-        public bool IsIK
+    public bool IsIK
+    {
+        get => isIK;
+        set
         {
-            get => isIK;
-            set
-            {
-                if (isIK == value)
-                    return;
-
-                isIK = value;
-                ApplyDragType();
-            }
+            if (isIK == value)
+                return;
+
+            isIK = value;
+            ApplyDragType();
         }
+    }
 
-        protected override void ApplyDragType()
-        {
-            var enabled = !IsIK && (Transforming || Selecting);
-            var select = IsIK && Selecting;
+    protected override void ApplyDragType()
+    {
+        var enabled = !IsIK && (Transforming || Selecting);
+        var select = IsIK && Selecting;
 
-            ApplyProperties(enabled || select, IsCube && enabled, false);
+        ApplyProperties(enabled || select, IsCube && enabled, false);
 
-            if (IsCube)
-                ApplyColours();
-        }
+        if (IsCube)
+            ApplyColours();
     }
+}
 
-    public class DragPointBG : DragPointGeneral
+public class DragPointBG : DragPointGeneral
+{
+    public override void Set(Transform myObject)
     {
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+        base.Set(myObject);
 
-            DefaultPosition = myObject.position;
-        }
+        DefaultPosition = myObject.position;
+    }
 
-        protected override void ApplyDragType()
-        {
-            ApplyProperties(Transforming, Transforming, Rotating);
-            ApplyColours();
-        }
+    protected override void ApplyDragType()
+    {
+        ApplyProperties(Transforming, Transforming, Rotating);
+        ApplyColours();
     }
 }

+ 93 - 94
src/MeidoPhotoStudio.Plugin/DragPoint/DragPointProp.cs

@@ -4,123 +4,122 @@ using System.Linq;
 using UnityEngine;
 using UnityEngine.Rendering;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointProp : DragPointGeneral
 {
-    public class DragPointProp : DragPointGeneral
-    {
-        public AttachPointInfo AttachPointInfo { get; private set; } = AttachPointInfo.Empty;
-        public string assetName = string.Empty;
+    public AttachPointInfo AttachPointInfo { get; private set; } = AttachPointInfo.Empty;
+    public string assetName = string.Empty;
 
-        private List<Renderer> renderers;
+    private List<Renderer> renderers;
 
-        public PropInfo Info { get; set; }
+    public PropInfo Info { get; set; }
 
-        public string Name =>
-            MyGameObject.name;
+    public string Name =>
+        MyGameObject.name;
 
-        public bool ShadowCasting
+    public bool ShadowCasting
+    {
+        get => renderers.Count is not 0 && renderers.Any(r => r.shadowCastingMode is ShadowCastingMode.On);
+        set
         {
-            get => renderers.Count is not 0 && renderers.Any(r => r.shadowCastingMode is ShadowCastingMode.On);
-            set
-            {
-                foreach (var renderer in renderers)
-                    renderer.shadowCastingMode = value ? ShadowCastingMode.On : ShadowCastingMode.Off;
-            }
+            foreach (var renderer in renderers)
+                renderer.shadowCastingMode = value ? ShadowCastingMode.On : ShadowCastingMode.Off;
         }
+    }
 
-        public void AttachTo(Meido meido, AttachPoint point, bool keepWorldPosition = true)
-        {
-            var attachPoint = meido?.IKManager.GetAttachPointTransform(point);
-
-            AttachPointInfo = meido == null ? AttachPointInfo.Empty : new(point, meido);
-
-            var position = MyObject.position;
-            var rotation = MyObject.rotation;
-            var scale = MyObject.localScale;
+    public void AttachTo(Meido meido, AttachPoint point, bool keepWorldPosition = true)
+    {
+        var attachPoint = meido?.IKManager.GetAttachPointTransform(point);
 
-            MyObject.transform.SetParent(attachPoint, keepWorldPosition);
+        AttachPointInfo = meido == null ? AttachPointInfo.Empty : new(point, meido);
 
-            if (keepWorldPosition)
-            {
-                // TODO: Use transform.SetPositionAndRotation MyObject.position = position;
-                MyObject.rotation = rotation;
-            }
-            else
-            {
-                MyObject.localPosition = Vector3.zero;
-                MyObject.rotation = Quaternion.identity;
-            }
+        var position = MyObject.position;
+        var rotation = MyObject.rotation;
+        var scale = MyObject.localScale;
 
-            MyObject.localScale = scale;
+        MyObject.transform.SetParent(attachPoint, keepWorldPosition);
 
-            if (attachPoint == null)
-                Utility.FixGameObjectScale(MyGameObject);
+        if (keepWorldPosition)
+        {
+            // TODO: Use transform.SetPositionAndRotation MyObject.position = position;
+            MyObject.rotation = rotation;
+        }
+        else
+        {
+            MyObject.localPosition = Vector3.zero;
+            MyObject.rotation = Quaternion.identity;
         }
 
-        public void DetachFrom(bool keepWorldPosition = true) =>
-            AttachTo(null, AttachPoint.None, keepWorldPosition);
+        MyObject.localScale = scale;
 
-        public void DetachTemporary()
-        {
-            MyObject.transform.SetParent(null, true);
+        if (attachPoint == null)
             Utility.FixGameObjectScale(MyGameObject);
-        }
+    }
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+    public void DetachFrom(bool keepWorldPosition = true) =>
+        AttachTo(null, AttachPoint.None, keepWorldPosition);
 
-            DefaultRotation = MyObject.rotation;
-            DefaultPosition = MyObject.position;
-            DefaultScale = MyObject.localScale;
-            renderers = new List<Renderer>(MyObject.GetComponentsInChildren<Renderer>());
-        }
+    public void DetachTemporary()
+    {
+        MyObject.transform.SetParent(null, true);
+        Utility.FixGameObjectScale(MyGameObject);
+    }
 
-        protected override void ApplyDragType()
-        {
-            var active = DragPointEnabled && Transforming || Special;
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-            ApplyProperties(active, active, GizmoEnabled && Rotating);
-            ApplyColours();
-        }
+        DefaultRotation = MyObject.rotation;
+        DefaultPosition = MyObject.position;
+        DefaultScale = MyObject.localScale;
+        renderers = new List<Renderer>(MyObject.GetComponentsInChildren<Renderer>());
+    }
 
-        protected override void OnDestroy()
-        {
-            Destroy(MyGameObject);
-            base.OnDestroy();
-        }
+    protected override void ApplyDragType()
+    {
+        var active = DragPointEnabled && Transforming || Special;
+
+        ApplyProperties(active, active, GizmoEnabled && Rotating);
+        ApplyColours();
     }
 
-    public class PropInfo
+    protected override void OnDestroy()
     {
-        public enum PropType { Mod, MyRoom, Bg, Odogu }
-
-        public PropType Type { get; }
-        public string IconFile { get; set; }
-        public string Filename { get; set; }
-        public string SubFilename { get; set; }
-        public int MyRoomID { get; set; }
-
-        public PropInfo(PropType type) => Type = type;
-
-        public static PropInfo FromModItem(ModItem modItem) =>
-            new(PropType.Mod)
-            {
-                Filename = modItem.IsOfficialMod ? Path.GetFileName(modItem.MenuFile) : modItem.MenuFile,
-                SubFilename = modItem.BaseMenuFile
-            };
-
-        public static PropInfo FromMyRoom(MyRoomItem myRoomItem) =>
-            new(PropType.MyRoom)
-            {
-                MyRoomID = myRoomItem.ID,
-                Filename = myRoomItem.PrefabName
-            };
-
-        public static PropInfo FromBg(string name) =>
-            new(PropType.Bg) { Filename = name };
-
-        public static PropInfo FromGameProp(string name) =>
-            new(PropType.Odogu) { Filename = name };
+        Destroy(MyGameObject);
+        base.OnDestroy();
     }
 }
+
+public class PropInfo
+{
+    public enum PropType { Mod, MyRoom, Bg, Odogu }
+
+    public PropType Type { get; }
+    public string IconFile { get; set; }
+    public string Filename { get; set; }
+    public string SubFilename { get; set; }
+    public int MyRoomID { get; set; }
+
+    public PropInfo(PropType type) => Type = type;
+
+    public static PropInfo FromModItem(ModItem modItem) =>
+        new(PropType.Mod)
+        {
+            Filename = modItem.IsOfficialMod ? Path.GetFileName(modItem.MenuFile) : modItem.MenuFile,
+            SubFilename = modItem.BaseMenuFile
+        };
+
+    public static PropInfo FromMyRoom(MyRoomItem myRoomItem) =>
+        new(PropType.MyRoom)
+        {
+            MyRoomID = myRoomItem.ID,
+            Filename = myRoomItem.PrefabName
+        };
+
+    public static PropInfo FromBg(string name) =>
+        new(PropType.Bg) { Filename = name };
+
+    public static PropInfo FromGameProp(string name) =>
+        new(PropType.Odogu) { Filename = name };
+}

+ 7 - 8
src/MeidoPhotoStudio.Plugin/GUI/Controls/BaseControl.cs

@@ -1,15 +1,14 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class BaseControl
 {
-    public abstract class BaseControl
-    {
-        public event EventHandler ControlEvent;
+    public event EventHandler ControlEvent;
 
-        public virtual void Draw(params GUILayoutOption[] layoutOptions) { }
+    public virtual void Draw(params GUILayoutOption[] layoutOptions) { }
 
-        public virtual void OnControlEvent(EventArgs args) =>
-            ControlEvent?.Invoke(this, args);
-    }
+    public virtual void OnControlEvent(EventArgs args) =>
+        ControlEvent?.Invoke(this, args);
 }

+ 15 - 16
src/MeidoPhotoStudio.Plugin/GUI/Controls/Button.cs

@@ -1,26 +1,25 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class Button : BaseControl
 {
-    public class Button : BaseControl
-    {
-        public string Label { get; set; }
+    public string Label { get; set; }
 
-        public Button(string label) =>
-            Label = label;
+    public Button(string label) =>
+        Label = label;
 
-        public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
-        {
-            if (GUILayout.Button(Label, buttonStyle, layoutOptions))
-                OnControlEvent(EventArgs.Empty);
-        }
+    public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
+    {
+        if (GUILayout.Button(Label, buttonStyle, layoutOptions))
+            OnControlEvent(EventArgs.Empty);
+    }
 
-        public override void Draw(params GUILayoutOption[] layoutOptions)
-        {
-            var buttonStyle = new GUIStyle(GUI.skin.button);
+    public override void Draw(params GUILayoutOption[] layoutOptions)
+    {
+        var buttonStyle = new GUIStyle(GUI.skin.button);
 
-            Draw(buttonStyle, layoutOptions);
-        }
+        Draw(buttonStyle, layoutOptions);
     }
 }

+ 39 - 40
src/MeidoPhotoStudio.Plugin/GUI/Controls/ComboBox.cs

@@ -1,56 +1,55 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class ComboBox : BaseControl
 {
-    public class ComboBox : BaseControl
-    {
-        private readonly TextField textField = new();
+    private readonly TextField textField = new();
 
-        public Dropdown BaseDropDown { get; }
+    public Dropdown BaseDropDown { get; }
 
-        public string Value
-        {
-            get => textField.Value;
-            set => textField.Value = value;
-        }
+    public string Value
+    {
+        get => textField.Value;
+        set => textField.Value = value;
+    }
 
-        public ComboBox(string[] itemList)
-        {
-            BaseDropDown = new("▾", itemList);
-            BaseDropDown.SelectionChange += (s, a) => textField.Value = BaseDropDown.SelectedItem;
-            Value = itemList[0];
-        }
+    public ComboBox(string[] itemList)
+    {
+        BaseDropDown = new("▾", itemList);
+        BaseDropDown.SelectionChange += (s, a) => textField.Value = BaseDropDown.SelectedItem;
+        Value = itemList[0];
+    }
 
-        public void SetDropdownItems(string[] itemList)
-        {
-            var oldValue = Value;
+    public void SetDropdownItems(string[] itemList)
+    {
+        var oldValue = Value;
 
-            BaseDropDown.SetDropdownItems(itemList);
-            Value = oldValue;
-        }
+        BaseDropDown.SetDropdownItems(itemList);
+        Value = oldValue;
+    }
 
-        public void SetDropdownItem(int index, string newItem) =>
-            BaseDropDown.SetDropdownItem(index, newItem);
+    public void SetDropdownItem(int index, string newItem) =>
+        BaseDropDown.SetDropdownItem(index, newItem);
 
-        public void SetDropdownItem(string newItem) =>
-            BaseDropDown.SetDropdownItem(newItem);
+    public void SetDropdownItem(string newItem) =>
+        BaseDropDown.SetDropdownItem(newItem);
 
-        public void Draw(GUIStyle style, params GUILayoutOption[] layoutOptions)
-        {
-            GUILayout.BeginHorizontal();
-            textField.Draw(new(GUI.skin.textField), layoutOptions);
-            BaseDropDown.Draw(style, GUILayout.ExpandWidth(false));
-            GUILayout.EndHorizontal();
-        }
+    public void Draw(GUIStyle style, params GUILayoutOption[] layoutOptions)
+    {
+        GUILayout.BeginHorizontal();
+        textField.Draw(new(GUI.skin.textField), layoutOptions);
+        BaseDropDown.Draw(style, GUILayout.ExpandWidth(false));
+        GUILayout.EndHorizontal();
+    }
 
-        public override void Draw(params GUILayoutOption[] layoutOptions)
+    public override void Draw(params GUILayoutOption[] layoutOptions)
+    {
+        var buttonStyle = new GUIStyle(GUI.skin.button)
         {
-            var buttonStyle = new GUIStyle(GUI.skin.button)
-            {
-                alignment = TextAnchor.MiddleCenter,
-            };
+            alignment = TextAnchor.MiddleCenter,
+        };
 
-            Draw(buttonStyle, layoutOptions);
-        }
+        Draw(buttonStyle, layoutOptions);
     }
 }

+ 293 - 294
src/MeidoPhotoStudio.Plugin/GUI/Controls/DropDown.cs

@@ -3,402 +3,401 @@ using UnityEngine;
 using DropdownCloseArgs = MeidoPhotoStudio.Plugin.DropdownHelper.DropdownCloseArgs;
 using DropdownSelectArgs = MeidoPhotoStudio.Plugin.DropdownHelper.DropdownSelectArgs;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class Dropdown : BaseControl
 {
-    public class Dropdown : BaseControl
-    {
-        private readonly string label;
-        private readonly bool isMenu;
+    private readonly string label;
+    private readonly bool isMenu;
 
-        public event EventHandler SelectionChange;
-        public event EventHandler DropdownOpen;
-        public event EventHandler DropdownClose;
+    public event EventHandler SelectionChange;
+    public event EventHandler DropdownOpen;
+    public event EventHandler DropdownClose;
 
-        private Vector2 elementSize;
-        private int selectedItemIndex;
-        private bool clickedYou;
-        private bool showDropdown;
-        private Vector2 scrollPos;
-        private Rect buttonRect;
+    private Vector2 elementSize;
+    private int selectedItemIndex;
+    private bool clickedYou;
+    private bool showDropdown;
+    private Vector2 scrollPos;
+    private Rect buttonRect;
 
-        public int DropdownID { get; }
+    public int DropdownID { get; }
 
-        public string[] DropdownList { get; private set; }
+    public string[] DropdownList { get; private set; }
 
-        public Vector2 ScrollPos =>
-            scrollPos;
+    public Vector2 ScrollPos =>
+        scrollPos;
 
-        public Rect ButtonRect
-        {
-            get => buttonRect;
-            private set => buttonRect = value;
-        }
+    public Rect ButtonRect
+    {
+        get => buttonRect;
+        private set => buttonRect = value;
+    }
 
-        public Vector2 ElementSize =>
-            elementSize;
+    public Vector2 ElementSize =>
+        elementSize;
 
-        public int SelectedItemIndex
+    public int SelectedItemIndex
+    {
+        get => selectedItemIndex;
+        set
         {
-            get => selectedItemIndex;
-            set
-            {
-                selectedItemIndex = Mathf.Clamp(value, 0, DropdownList.Length - 1);
-                OnDropdownEvent(SelectionChange);
-            }
+            selectedItemIndex = Mathf.Clamp(value, 0, DropdownList.Length - 1);
+            OnDropdownEvent(SelectionChange);
         }
+    }
 
-        public string SelectedItem =>
-            DropdownList[SelectedItemIndex];
+    public string SelectedItem =>
+        DropdownList[SelectedItemIndex];
 
-        public Dropdown(string label, string[] itemList, int selectedItemIndex = 0)
-            : this(itemList, selectedItemIndex)
-        {
-            this.label = label;
+    public Dropdown(string label, string[] itemList, int selectedItemIndex = 0)
+        : this(itemList, selectedItemIndex)
+    {
+        this.label = label;
 
-            isMenu = true;
-        }
+        isMenu = true;
+    }
 
-        public Dropdown(string[] itemList, int selectedItemIndex = 0)
-        {
-            DropdownID = DropdownHelper.DropdownID;
-            SetDropdownItems(itemList, selectedItemIndex);
+    public Dropdown(string[] itemList, int selectedItemIndex = 0)
+    {
+        DropdownID = DropdownHelper.DropdownID;
+        SetDropdownItems(itemList, selectedItemIndex);
 
-            DropdownHelper.SelectionChange += OnChangeSelection;
-            DropdownHelper.DropdownClose += OnCloseDropdown;
-        }
+        DropdownHelper.SelectionChange += OnChangeSelection;
+        DropdownHelper.DropdownClose += OnCloseDropdown;
+    }
 
-        // TODO: I don't think this works the way I think it does
-        ~Dropdown()
-        {
-            DropdownHelper.SelectionChange -= OnChangeSelection;
-            DropdownHelper.DropdownClose -= OnCloseDropdown;
-        }
+    // TODO: I don't think this works the way I think it does
+    ~Dropdown()
+    {
+        DropdownHelper.SelectionChange -= OnChangeSelection;
+        DropdownHelper.DropdownClose -= OnCloseDropdown;
+    }
 
-        public void SetDropdownItems(string[] itemList, int selectedItemIndex = -1)
-        {
-            if (selectedItemIndex < 0)
-                selectedItemIndex = SelectedItemIndex;
+    public void SetDropdownItems(string[] itemList, int selectedItemIndex = -1)
+    {
+        if (selectedItemIndex < 0)
+            selectedItemIndex = SelectedItemIndex;
 
-            elementSize = Vector2.zero;
+        elementSize = Vector2.zero;
 
-            // TODO: Calculate scrollpos position maybe
-            if (selectedItemIndex != this.selectedItemIndex || itemList.Length != DropdownList?.Length)
-                scrollPos = Vector2.zero;
+        // TODO: Calculate scrollpos position maybe
+        if (selectedItemIndex != this.selectedItemIndex || itemList.Length != DropdownList?.Length)
+            scrollPos = Vector2.zero;
 
-            DropdownList = itemList;
-            SelectedItemIndex = selectedItemIndex;
-        }
+        DropdownList = itemList;
+        SelectedItemIndex = selectedItemIndex;
+    }
 
-        public void SetDropdownItem(int index, string newItem)
-        {
-            if (index < 0 || index >= DropdownList.Length)
-                return;
+    public void SetDropdownItem(int index, string newItem)
+    {
+        if (index < 0 || index >= DropdownList.Length)
+            return;
 
-            var itemSize = DropdownHelper.CalculateElementSize(newItem);
+        var itemSize = DropdownHelper.CalculateElementSize(newItem);
 
-            if (itemSize.x > ElementSize.x)
-                elementSize = itemSize;
+        if (itemSize.x > ElementSize.x)
+            elementSize = itemSize;
 
-            DropdownList[index] = newItem;
-        }
+        DropdownList[index] = newItem;
+    }
 
-        public void SetDropdownItem(string newItem) =>
-            SetDropdownItem(SelectedItemIndex, newItem);
+    public void SetDropdownItem(string newItem) =>
+        SetDropdownItem(SelectedItemIndex, newItem);
 
-        public void Step(int dir)
-        {
-            dir = (int)Mathf.Sign(dir);
-            SelectedItemIndex = Utility.Wrap(SelectedItemIndex + dir, 0, DropdownList.Length);
-        }
+    public void Step(int dir)
+    {
+        dir = (int)Mathf.Sign(dir);
+        SelectedItemIndex = Utility.Wrap(SelectedItemIndex + dir, 0, DropdownList.Length);
+    }
 
-        public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions) =>
-            Draw(buttonStyle, null, layoutOptions);
+    public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions) =>
+        Draw(buttonStyle, null, layoutOptions);
 
-        public void Draw(GUIStyle buttonStyle, GUIStyle dropdownStyle = null, params GUILayoutOption[] layoutOptions)
-        {
-            var clicked = GUILayout.Button(
+    public void Draw(GUIStyle buttonStyle, GUIStyle dropdownStyle = null, params GUILayoutOption[] layoutOptions)
+    {
+        var clicked = GUILayout.Button(
                 isMenu ? label : DropdownList[selectedItemIndex], buttonStyle, layoutOptions
-            );
-
-            if (clicked)
-            {
-                showDropdown = !clickedYou;
-                clickedYou = false;
-            }
+                );
 
-            if (showDropdown && Event.current.type is EventType.Repaint)
-                InitializeDropdown(dropdownStyle);
-        }
-
-        public override void Draw(params GUILayoutOption[] layoutOptions)
+        if (clicked)
         {
-            var buttonStyle = new GUIStyle(GUI.skin.button)
-            {
-                alignment = TextAnchor.MiddleLeft,
-            };
-
-            Draw(buttonStyle, layoutOptions);
+            showDropdown = !clickedYou;
+            clickedYou = false;
         }
 
-        private void OnChangeSelection(object sender, DropdownSelectArgs args)
-        {
-            if (args.DropdownID == DropdownID)
-                SelectedItemIndex = args.SelectedItemIndex;
-        }
+        if (showDropdown && Event.current.type is EventType.Repaint)
+            InitializeDropdown(dropdownStyle);
+    }
 
-        private void OnCloseDropdown(object sender, DropdownCloseArgs args)
+    public override void Draw(params GUILayoutOption[] layoutOptions)
+    {
+        var buttonStyle = new GUIStyle(GUI.skin.button)
         {
-            if (args.DropdownID != DropdownID)
-                return;
+            alignment = TextAnchor.MiddleLeft,
+        };
 
-            scrollPos = args.ScrollPos;
-            clickedYou = args.ClickedYou;
+        Draw(buttonStyle, layoutOptions);
+    }
 
-            if (clickedYou)
-                OnDropdownEvent(SelectionChange);
+    private void OnChangeSelection(object sender, DropdownSelectArgs args)
+    {
+        if (args.DropdownID == DropdownID)
+            SelectedItemIndex = args.SelectedItemIndex;
+    }
 
-            OnDropdownEvent(DropdownClose);
-        }
+    private void OnCloseDropdown(object sender, DropdownCloseArgs args)
+    {
+        if (args.DropdownID != DropdownID)
+            return;
 
-        private void InitializeDropdown(GUIStyle dropdownStyle)
-        {
-            showDropdown = false;
+        scrollPos = args.ScrollPos;
+        clickedYou = args.ClickedYou;
 
-            buttonRect = GUILayoutUtility.GetLastRect();
+        if (clickedYou)
+            OnDropdownEvent(SelectionChange);
 
-            var rectPos = GUIUtility.GUIToScreenPoint(new Vector2(buttonRect.x, buttonRect.y));
+        OnDropdownEvent(DropdownClose);
+    }
 
-            buttonRect.x = rectPos.x;
-            buttonRect.y = rectPos.y;
+    private void InitializeDropdown(GUIStyle dropdownStyle)
+    {
+        showDropdown = false;
 
-            if (elementSize == Vector2.zero)
-                elementSize = DropdownHelper.CalculateElementSize(DropdownList, dropdownStyle);
+        buttonRect = GUILayoutUtility.GetLastRect();
 
-            DropdownHelper.Set(this, dropdownStyle);
+        var rectPos = GUIUtility.GUIToScreenPoint(new Vector2(buttonRect.x, buttonRect.y));
 
-            OnDropdownEvent(DropdownOpen);
-        }
+        buttonRect.x = rectPos.x;
+        buttonRect.y = rectPos.y;
 
-        private void OnDropdownEvent(EventHandler handler) =>
-            handler?.Invoke(this, EventArgs.Empty);
-    }
+        if (elementSize == Vector2.zero)
+            elementSize = DropdownHelper.CalculateElementSize(DropdownList, dropdownStyle);
 
-    public static class DropdownHelper
-    {
-        public static event EventHandler<DropdownSelectArgs> SelectionChange;
-        public static event EventHandler<DropdownCloseArgs> DropdownClose;
-        public static Rect dropdownWindow;
-
-        private static int dropdownID = 100;
-        private static GUIStyle defaultDropdownStyle;
-        private static bool onScrollBar;
-        private static Rect dropdownScrollRect;
-        private static Rect dropdownRect;
-        private static GUIStyle dropdownStyle;
-        private static GUIStyle windowStyle;
-        private static Rect buttonRect;
-        private static string[] dropdownList;
-        private static Vector2 scrollPos;
-        private static int currentDropdownID;
-        private static int selectedItemIndex;
-        private static bool initialized;
-
-        public static int DropdownID =>
-            dropdownID++;
-
-        public static GUIStyle DefaultDropdownStyle
-        {
-            get
-            {
-                if (!initialized)
-                    InitializeStyle();
+        DropdownHelper.Set(this, dropdownStyle);
 
-                return defaultDropdownStyle;
-            }
-        }
+        OnDropdownEvent(DropdownOpen);
+    }
 
-        public static bool Visible { get; set; }
-        public static bool DropdownOpen { get; private set; }
+    private void OnDropdownEvent(EventHandler handler) =>
+        handler?.Invoke(this, EventArgs.Empty);
+}
 
-        public static Vector2 CalculateElementSize(string item, GUIStyle style = null)
+public static class DropdownHelper
+{
+    public static event EventHandler<DropdownSelectArgs> SelectionChange;
+    public static event EventHandler<DropdownCloseArgs> DropdownClose;
+    public static Rect dropdownWindow;
+
+    private static int dropdownID = 100;
+    private static GUIStyle defaultDropdownStyle;
+    private static bool onScrollBar;
+    private static Rect dropdownScrollRect;
+    private static Rect dropdownRect;
+    private static GUIStyle dropdownStyle;
+    private static GUIStyle windowStyle;
+    private static Rect buttonRect;
+    private static string[] dropdownList;
+    private static Vector2 scrollPos;
+    private static int currentDropdownID;
+    private static int selectedItemIndex;
+    private static bool initialized;
+
+    public static int DropdownID =>
+        dropdownID++;
+
+    public static GUIStyle DefaultDropdownStyle
+    {
+        get
         {
             if (!initialized)
                 InitializeStyle();
 
-            style ??= DefaultDropdownStyle;
-
-            return style.CalcSize(new GUIContent(item));
+            return defaultDropdownStyle;
         }
+    }
 
-        public static Vector2 CalculateElementSize(string[] list, GUIStyle style = null)
-        {
-            if (!initialized)
-                InitializeStyle();
+    public static bool Visible { get; set; }
+    public static bool DropdownOpen { get; private set; }
 
-            style ??= DefaultDropdownStyle;
+    public static Vector2 CalculateElementSize(string item, GUIStyle style = null)
+    {
+        if (!initialized)
+            InitializeStyle();
 
-            var content = new GUIContent(list[0]);
-            var calculatedSize = style.CalcSize(content);
+        style ??= DefaultDropdownStyle;
 
-            for (var i = 1; i < list.Length; i++)
-            {
-                content.text = list[i];
+        return style.CalcSize(new GUIContent(item));
+    }
 
-                var calcSize = style.CalcSize(content);
+    public static Vector2 CalculateElementSize(string[] list, GUIStyle style = null)
+    {
+        if (!initialized)
+            InitializeStyle();
 
-                if (calcSize.x > calculatedSize.x)
-                    calculatedSize = calcSize;
-            }
+        style ??= DefaultDropdownStyle;
 
-            return calculatedSize;
-        }
+        var content = new GUIContent(list[0]);
+        var calculatedSize = style.CalcSize(content);
 
-        public static void Set(Dropdown dropdown, GUIStyle style = null)
+        for (var i = 1; i < list.Length; i++)
         {
-            dropdownStyle = style ?? DefaultDropdownStyle;
-            currentDropdownID = dropdown.DropdownID;
-            dropdownList = dropdown.DropdownList;
-            scrollPos = dropdown.ScrollPos;
-            selectedItemIndex = dropdown.SelectedItemIndex;
-            scrollPos = dropdown.ScrollPos;
-            buttonRect = dropdown.ButtonRect;
+            content.text = list[i];
 
-            var calculatedSize = dropdown.ElementSize;
+            var calcSize = style.CalcSize(content);
 
-            var calculatedListHeight = calculatedSize.y * dropdownList.Length;
-
-            var heightAbove = buttonRect.y;
-            var heightBelow = Screen.height - heightAbove - buttonRect.height;
+            if (calcSize.x > calculatedSize.x)
+                calculatedSize = calcSize;
+        }
 
-            var rectWidth = Mathf.Max(calculatedSize.x + 5, buttonRect.width);
-            var rectHeight = Mathf.Min(calculatedListHeight, Mathf.Max(heightAbove, heightBelow));
+        return calculatedSize;
+    }
 
-            if (calculatedListHeight > heightBelow && heightAbove > heightBelow)
-                dropdownWindow = new(buttonRect.x, buttonRect.y - rectHeight, rectWidth + 18, rectHeight);
-            else
-            {
-                if (calculatedListHeight > heightBelow)
-                    rectHeight -= calculatedSize.y;
+    public static void Set(Dropdown dropdown, GUIStyle style = null)
+    {
+        dropdownStyle = style ?? DefaultDropdownStyle;
+        currentDropdownID = dropdown.DropdownID;
+        dropdownList = dropdown.DropdownList;
+        scrollPos = dropdown.ScrollPos;
+        selectedItemIndex = dropdown.SelectedItemIndex;
+        scrollPos = dropdown.ScrollPos;
+        buttonRect = dropdown.ButtonRect;
 
-                dropdownWindow = new(buttonRect.x, buttonRect.y + buttonRect.height, rectWidth + 18, rectHeight);
-            }
+        var calculatedSize = dropdown.ElementSize;
 
-            dropdownWindow.x = Mathf.Clamp(dropdownWindow.x, 0, Screen.width - rectWidth - 18);
+        var calculatedListHeight = calculatedSize.y * dropdownList.Length;
 
-            dropdownScrollRect = new(0, 0, dropdownWindow.width, dropdownWindow.height);
-            dropdownRect = new(0, 0, dropdownWindow.width - 18, calculatedListHeight);
+        var heightAbove = buttonRect.y;
+        var heightBelow = Screen.height - heightAbove - buttonRect.height;
 
-            DropdownOpen = true;
-            Visible = true;
-        }
+        var rectWidth = Mathf.Max(calculatedSize.x + 5, buttonRect.width);
+        var rectHeight = Mathf.Min(calculatedListHeight, Mathf.Max(heightAbove, heightBelow));
 
-        public static void HandleDropdown()
+        if (calculatedListHeight > heightBelow && heightAbove > heightBelow)
+            dropdownWindow = new(buttonRect.x, buttonRect.y - rectHeight, rectWidth + 18, rectHeight);
+        else
         {
-            dropdownWindow = GUI.Window(Constants.dropdownWindowID, dropdownWindow, GUIFunc, "", windowStyle);
+            if (calculatedListHeight > heightBelow)
+                rectHeight -= calculatedSize.y;
 
-            if (Input.mouseScrollDelta.y is not 0f && Visible && dropdownWindow.Contains(Event.current.mousePosition))
-                Input.ResetInputAxes();
+            dropdownWindow = new(buttonRect.x, buttonRect.y + buttonRect.height, rectWidth + 18, rectHeight);
         }
 
-        private static void GUIFunc(int id)
-        {
-            var clicked = false;
+        dropdownWindow.x = Mathf.Clamp(dropdownWindow.x, 0, Screen.width - rectWidth - 18);
+
+        dropdownScrollRect = new(0, 0, dropdownWindow.width, dropdownWindow.height);
+        dropdownRect = new(0, 0, dropdownWindow.width - 18, calculatedListHeight);
+
+        DropdownOpen = true;
+        Visible = true;
+    }
 
-            if (Event.current.type is EventType.MouseUp)
-                clicked = true;
+    public static void HandleDropdown()
+    {
+        dropdownWindow = GUI.Window(Constants.dropdownWindowID, dropdownWindow, GUIFunc, "", windowStyle);
 
-            scrollPos = GUI.BeginScrollView(dropdownScrollRect, scrollPos, dropdownRect);
+        if (Input.mouseScrollDelta.y is not 0f && Visible && dropdownWindow.Contains(Event.current.mousePosition))
+            Input.ResetInputAxes();
+    }
 
-            var selection = GUI.SelectionGrid(dropdownRect, selectedItemIndex, dropdownList, 1, dropdownStyle);
+    private static void GUIFunc(int id)
+    {
+        var clicked = false;
 
-            GUI.EndScrollView();
+        if (Event.current.type is EventType.MouseUp)
+            clicked = true;
 
-            var clickedYou = false;
+        scrollPos = GUI.BeginScrollView(dropdownScrollRect, scrollPos, dropdownRect);
 
-            if (Utility.AnyMouseDown())
-            {
-                var mousePos = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
-                var clickedMe = dropdownWindow.Contains(mousePos);
+        var selection = GUI.SelectionGrid(dropdownRect, selectedItemIndex, dropdownList, 1, dropdownStyle);
 
-                onScrollBar = mousePos.x > dropdownWindow.x + dropdownWindow.width - 12f;
+        GUI.EndScrollView();
 
-                if (buttonRect.Contains(mousePos))
-                    clickedYou = true;
+        var clickedYou = false;
 
-                if (!clickedMe)
-                    DropdownOpen = false;
-            }
+        if (Utility.AnyMouseDown())
+        {
+            var mousePos = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
+            var clickedMe = dropdownWindow.Contains(mousePos);
 
-            if (selection != selectedItemIndex || clicked && !onScrollBar)
-            {
-                SelectionChange?.Invoke(null, new(currentDropdownID, selection));
+            onScrollBar = mousePos.x > dropdownWindow.x + dropdownWindow.width - 12f;
+
+            if (buttonRect.Contains(mousePos))
+                clickedYou = true;
+
+            if (!clickedMe)
                 DropdownOpen = false;
-            }
+        }
 
-            if (!DropdownOpen)
-            {
-                Visible = false;
-                DropdownClose?.Invoke(null, new(currentDropdownID, scrollPos, clickedYou));
-            }
+        if (selection != selectedItemIndex || clicked && !onScrollBar)
+        {
+            SelectionChange?.Invoke(null, new(currentDropdownID, selection));
+            DropdownOpen = false;
         }
 
-        private static void InitializeStyle()
+        if (!DropdownOpen)
         {
-            defaultDropdownStyle = new(GUI.skin.button)
-            {
-                alignment = TextAnchor.MiddleLeft,
-                margin = new(0, 0, 0, 0),
-            };
-
-            defaultDropdownStyle.padding.top = defaultDropdownStyle.padding.bottom = 2;
-            defaultDropdownStyle.normal.background = Utility.MakeTex(2, 2, new(0f, 0f, 0f, 0.5f));
-
-            var whiteBackground = new Texture2D(2, 2);
-
-            defaultDropdownStyle.onHover.background
-                = defaultDropdownStyle.hover.background
-                = defaultDropdownStyle.onNormal.background
-                = whiteBackground;
-            defaultDropdownStyle.onHover.textColor
-                = defaultDropdownStyle.onNormal.textColor
-                = defaultDropdownStyle.hover.textColor
-                = Color.black;
-
-            windowStyle = new(GUI.skin.box)
-            {
-                padding = new(0, 0, 0, 0),
-                alignment = TextAnchor.UpperRight,
-            };
-
-            initialized = true;
+            Visible = false;
+            DropdownClose?.Invoke(null, new(currentDropdownID, scrollPos, clickedYou));
         }
+    }
 
-        public class DropdownEventArgs : EventArgs
+    private static void InitializeStyle()
+    {
+        defaultDropdownStyle = new(GUI.skin.button)
         {
-            public int DropdownID { get; }
+            alignment = TextAnchor.MiddleLeft,
+            margin = new(0, 0, 0, 0),
+        };
 
-            public DropdownEventArgs(int dropdownID) =>
-                DropdownID = dropdownID;
-        }
+        defaultDropdownStyle.padding.top = defaultDropdownStyle.padding.bottom = 2;
+        defaultDropdownStyle.normal.background = Utility.MakeTex(2, 2, new(0f, 0f, 0f, 0.5f));
+
+        var whiteBackground = new Texture2D(2, 2);
+
+        defaultDropdownStyle.onHover.background
+            = defaultDropdownStyle.hover.background
+            = defaultDropdownStyle.onNormal.background
+            = whiteBackground;
+        defaultDropdownStyle.onHover.textColor
+            = defaultDropdownStyle.onNormal.textColor
+            = defaultDropdownStyle.hover.textColor
+            = Color.black;
 
-        public class DropdownSelectArgs : DropdownEventArgs
+        windowStyle = new(GUI.skin.box)
         {
-            public int SelectedItemIndex { get; }
+            padding = new(0, 0, 0, 0),
+            alignment = TextAnchor.UpperRight,
+        };
 
-            public DropdownSelectArgs(int dropdownID, int selection) : base(dropdownID) =>
-                SelectedItemIndex = selection;
-        }
+        initialized = true;
+    }
+
+    public class DropdownEventArgs : EventArgs
+    {
+        public int DropdownID { get; }
+
+        public DropdownEventArgs(int dropdownID) =>
+            DropdownID = dropdownID;
+    }
+
+    public class DropdownSelectArgs : DropdownEventArgs
+    {
+        public int SelectedItemIndex { get; }
+
+        public DropdownSelectArgs(int dropdownID, int selection) : base(dropdownID) =>
+                                                                   SelectedItemIndex = selection;
+    }
+
+    public class DropdownCloseArgs : DropdownEventArgs
+    {
+        public Vector2 ScrollPos { get; }
+        public bool ClickedYou { get; }
 
-        public class DropdownCloseArgs : DropdownEventArgs
+        public DropdownCloseArgs(int dropdownID, Vector2 scrollPos, bool clickedYou = false) : base(dropdownID)
         {
-            public Vector2 ScrollPos { get; }
-            public bool ClickedYou { get; }
-
-            public DropdownCloseArgs(int dropdownID, Vector2 scrollPos, bool clickedYou = false) : base(dropdownID)
-            {
-                ScrollPos = scrollPos;
-                ClickedYou = clickedYou;
-            }
+            ScrollPos = scrollPos;
+            ClickedYou = clickedYou;
         }
     }
 }

+ 44 - 45
src/MeidoPhotoStudio.Plugin/GUI/Controls/KeyRebindButton.cs

@@ -1,64 +1,63 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class KeyRebindButton : BaseControl
 {
-    public class KeyRebindButton : BaseControl
-    {
-        private readonly Button button;
+    private readonly Button button;
 
-        private bool listening;
-        private KeyCode keyCode;
+    private bool listening;
+    private KeyCode keyCode;
 
-        public KeyCode KeyCode
+    public KeyCode KeyCode
+    {
+        get => keyCode;
+        set
         {
-            get => keyCode;
-            set
-            {
-                keyCode = value;
-                button.Label = keyCode.ToString();
-            }
+            keyCode = value;
+            button.Label = keyCode.ToString();
         }
+    }
 
-        public KeyRebindButton(KeyCode code)
-        {
-            button = new(code.ToString());
-            button.ControlEvent += (s, a) => StartListening();
-        }
+    public KeyRebindButton(KeyCode code)
+    {
+        button = new(code.ToString());
+        button.ControlEvent += (s, a) => StartListening();
+    }
 
-        public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
-        {
-            GUI.enabled = !listening && !InputManager.Listening;
-            button.Draw(buttonStyle, layoutOptions);
-            GUI.enabled = true;
-        }
+    public void Draw(GUIStyle buttonStyle, params GUILayoutOption[] layoutOptions)
+    {
+        GUI.enabled = !listening && !InputManager.Listening;
+        button.Draw(buttonStyle, layoutOptions);
+        GUI.enabled = true;
+    }
 
-        public override void Draw(params GUILayoutOption[] layoutOptions)
-        {
-            var buttonStyle = new GUIStyle(GUI.skin.button);
+    public override void Draw(params GUILayoutOption[] layoutOptions)
+    {
+        var buttonStyle = new GUIStyle(GUI.skin.button);
 
-            Draw(buttonStyle, layoutOptions);
-        }
+        Draw(buttonStyle, layoutOptions);
+    }
 
-        private void StartListening()
-        {
-            listening = true;
-            button.Label = string.Empty;
-            InputManager.StartListening();
-            InputManager.KeyChange += KeyChange;
-        }
+    private void StartListening()
+    {
+        listening = true;
+        button.Label = string.Empty;
+        InputManager.StartListening();
+        InputManager.KeyChange += KeyChange;
+    }
 
-        private void KeyChange(object sender, EventArgs args)
-        {
-            listening = false;
+    private void KeyChange(object sender, EventArgs args)
+    {
+        listening = false;
 
-            KeyCode = InputManager.CurrentKeyCode is not KeyCode.Escape
-                ? InputManager.CurrentKeyCode
-                : KeyCode;
+        KeyCode = InputManager.CurrentKeyCode is not KeyCode.Escape
+            ? InputManager.CurrentKeyCode
+            : KeyCode;
 
-            InputManager.KeyChange -= KeyChange;
+        InputManager.KeyChange -= KeyChange;
 
-            OnControlEvent(EventArgs.Empty);
-        }
+        OnControlEvent(EventArgs.Empty);
     }
 }

+ 30 - 31
src/MeidoPhotoStudio.Plugin/GUI/Controls/Modal.cs

@@ -1,45 +1,44 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class Modal
 {
-    public static class Modal
-    {
-        private static BaseWindow currentModal;
+    private static BaseWindow currentModal;
 
-        public static bool Visible
+    public static bool Visible
+    {
+        get => currentModal?.Visible ?? false;
+        set
         {
-            get => currentModal?.Visible ?? false;
-            set
-            {
-                if (currentModal is null)
-                    return;
-
-                currentModal.Visible = value;
-            }
+            if (currentModal is null)
+                return;
+
+            currentModal.Visible = value;
         }
+    }
 
-        public static void Show(BaseWindow modalWindow)
-        {
-            if (currentModal is not null)
-                Close();
+    public static void Show(BaseWindow modalWindow)
+    {
+        if (currentModal is not null)
+            Close();
 
-            currentModal = modalWindow;
-            Visible = true;
-        }
+        currentModal = modalWindow;
+        Visible = true;
+    }
 
-        public static void Close()
-        {
-            Visible = false;
-            currentModal = null;
-        }
+    public static void Close()
+    {
+        Visible = false;
+        currentModal = null;
+    }
 
-        public static void Draw()
-        {
-            var windowStyle = new GUIStyle(GUI.skin.box);
+    public static void Draw()
+    {
+        var windowStyle = new GUIStyle(GUI.skin.box);
 
-            currentModal.WindowRect = GUI.ModalWindow(
+        currentModal.WindowRect = GUI.ModalWindow(
                 currentModal.windowID, currentModal.WindowRect, currentModal.GUIFunc, "", windowStyle
-            );
-        }
+                );
     }
 }

+ 79 - 80
src/MeidoPhotoStudio.Plugin/GUI/Controls/SelectionGrid.cs

@@ -1,117 +1,116 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SelectionGrid : BaseControl
 {
-    public class SelectionGrid : BaseControl
-    {
-        private SimpleToggle[] toggles;
-        private int selectedItemIndex;
+    private SimpleToggle[] toggles;
+    private int selectedItemIndex;
 
-        public int SelectedItemIndex
+    public int SelectedItemIndex
+    {
+        get => selectedItemIndex;
+        set
         {
-            get => selectedItemIndex;
-            set
-            {
-                selectedItemIndex = Mathf.Clamp(value, 0, toggles.Length - 1);
+            selectedItemIndex = Mathf.Clamp(value, 0, toggles.Length - 1);
 
-                foreach (var toggle in toggles)
-                    toggle.value = toggle.toggleIndex == selectedItemIndex;
+            foreach (var toggle in toggles)
+                toggle.value = toggle.toggleIndex == selectedItemIndex;
 
-                OnControlEvent(EventArgs.Empty);
-            }
+            OnControlEvent(EventArgs.Empty);
         }
+    }
 
-        public SelectionGrid(string[] items, int selected = 0)
-        {
-            selectedItemIndex = Mathf.Clamp(selected, 0, items.Length - 1);
-            toggles = MakeToggles(items);
-        }
+    public SelectionGrid(string[] items, int selected = 0)
+    {
+        selectedItemIndex = Mathf.Clamp(selected, 0, items.Length - 1);
+        toggles = MakeToggles(items);
+    }
 
-        public void SetItems(string[] items, int selectedItemIndex = -1)
-        {
-            if (selectedItemIndex < 0)
-                selectedItemIndex = SelectedItemIndex;
+    public void SetItems(string[] items, int selectedItemIndex = -1)
+    {
+        if (selectedItemIndex < 0)
+            selectedItemIndex = SelectedItemIndex;
 
-            if (items.Length != toggles.Length)
-                toggles = MakeToggles(items);
-            else
+        if (items.Length != toggles.Length)
+            toggles = MakeToggles(items);
+        else
+        {
+            for (var i = 0; i < items.Length; i++)
             {
-                for (var i = 0; i < items.Length; i++)
-                {
-                    var item = items[i];
+                var item = items[i];
 
-                    toggles[i].value = i == SelectedItemIndex;
-                    toggles[i].label = item;
-                }
+                toggles[i].value = i == SelectedItemIndex;
+                toggles[i].label = item;
             }
-
-            SelectedItemIndex = Mathf.Clamp(selectedItemIndex, 0, items.Length - 1);
         }
 
-        public override void Draw(params GUILayoutOption[] layoutOptions)
-        {
-            GUILayout.BeginHorizontal();
+        SelectedItemIndex = Mathf.Clamp(selectedItemIndex, 0, items.Length - 1);
+    }
 
-            foreach (var toggle in toggles)
-                toggle.Draw(layoutOptions);
+    public override void Draw(params GUILayoutOption[] layoutOptions)
+    {
+        GUILayout.BeginHorizontal();
 
-            GUILayout.EndHorizontal();
-        }
+        foreach (var toggle in toggles)
+            toggle.Draw(layoutOptions);
+
+        GUILayout.EndHorizontal();
+    }
+
+    private SimpleToggle[] MakeToggles(string[] items)
+    {
+        var toggles = new SimpleToggle[items.Length];
 
-        private SimpleToggle[] MakeToggles(string[] items)
+        for (var i = 0; i < items.Length; i++)
         {
-            var toggles = new SimpleToggle[items.Length];
+            var toggle = new SimpleToggle(items[i], i == SelectedItemIndex)
+            {
+                toggleIndex = i
+            };
 
-            for (var i = 0; i < items.Length; i++)
+            toggle.ControlEvent += (s, a) =>
             {
-                var toggle = new SimpleToggle(items[i], i == SelectedItemIndex)
-                {
-                    toggleIndex = i
-                };
+                var value = (s as SimpleToggle).toggleIndex;
 
-                toggle.ControlEvent += (s, a) =>
-                {
-                    var value = (s as SimpleToggle).toggleIndex;
+                if (value != SelectedItemIndex)
+                    SelectedItemIndex = value;
+            };
 
-                    if (value != SelectedItemIndex)
-                        SelectedItemIndex = value;
-                };
+            toggles[i] = toggle;
+        }
 
-                toggles[i] = toggle;
-            }
+        return toggles;
+    }
 
-            return toggles;
+    private class SimpleToggle
+    {
+        public int toggleIndex;
+        public bool value;
+        public string label;
+        public event EventHandler ControlEvent;
+
+        public SimpleToggle(string label, bool value = false)
+        {
+            this.label = label;
+            this.value = value;
         }
 
-        private class SimpleToggle
+        public void Draw(params GUILayoutOption[] layoutOptions)
         {
-            public int toggleIndex;
-            public bool value;
-            public string label;
-            public event EventHandler ControlEvent;
+            var value = GUILayout.Toggle(this.value, label, layoutOptions);
 
-            public SimpleToggle(string label, bool value = false)
-            {
-                this.label = label;
-                this.value = value;
-            }
+            if (value == this.value)
+                return;
 
-            public void Draw(params GUILayoutOption[] layoutOptions)
+            if (!value)
+                this.value = true;
+            else
             {
-                var value = GUILayout.Toggle(this.value, label, layoutOptions);
-
-                if (value == this.value)
-                    return;
-
-                if (!value)
-                    this.value = true;
-                else
-                {
-                    this.value = value;
+                this.value = value;
 
-                    ControlEvent?.Invoke(this, EventArgs.Empty);
-                }
+                ControlEvent?.Invoke(this, EventArgs.Empty);
             }
         }
     }

+ 128 - 129
src/MeidoPhotoStudio.Plugin/GUI/Controls/Slider.cs

@@ -2,179 +2,178 @@ using System;
 using System.Globalization;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class Slider : BaseControl
 {
-    public class Slider : BaseControl
+    private bool hasLabel;
+    private string label;
+    private float value;
+    private float left;
+    private float right;
+    private float defaultValue;
+    private string textFieldValue;
+    private bool hasTextField;
+
+    public string Label
     {
-        private bool hasLabel;
-        private string label;
-        private float value;
-        private float left;
-        private float right;
-        private float defaultValue;
-        private string textFieldValue;
-        private bool hasTextField;
-
-        public string Label
+        get => label;
+        set
         {
-            get => label;
-            set
-            {
-                label = value;
-                hasLabel = !string.IsNullOrEmpty(label);
-            }
+            label = value;
+            hasLabel = !string.IsNullOrEmpty(label);
         }
+    }
 
-        public float Value
+    public float Value
+    {
+        get => value;
+        set
         {
-            get => value;
-            set
-            {
-                this.value = Utility.Bound(value, Left, Right);
+            this.value = Utility.Bound(value, Left, Right);
 
-                if (hasTextField)
-                    textFieldValue = FormatValue(value);
+            if (hasTextField)
+                textFieldValue = FormatValue(value);
 
-                OnControlEvent(EventArgs.Empty);
-            }
+            OnControlEvent(EventArgs.Empty);
         }
+    }
 
-        public float Left
+    public float Left
+    {
+        get => left;
+        set
         {
-            get => left;
-            set
-            {
-                left = value;
-                this.value = Utility.Bound(value, left, right);
-            }
+            left = value;
+            this.value = Utility.Bound(value, left, right);
         }
+    }
 
-        public float Right
+    public float Right
+    {
+        get => right;
+        set
         {
-            get => right;
-            set
-            {
-                right = value;
-                this.value = Utility.Bound(value, left, right);
-            }
+            right = value;
+            this.value = Utility.Bound(value, left, right);
         }
+    }
 
-        public float DefaultValue
-        {
-            get => defaultValue;
-            set => defaultValue = Utility.Bound(value, Left, Right);
-        }
+    public float DefaultValue
+    {
+        get => defaultValue;
+        set => defaultValue = Utility.Bound(value, Left, Right);
+    }
 
-        public bool HasTextField
+    public bool HasTextField
+    {
+        get => hasTextField;
+        set
         {
-            get => hasTextField;
-            set
-            {
-                hasTextField = value;
+            hasTextField = value;
 
-                if (hasTextField)
-                    textFieldValue = FormatValue(Value);
-            }
+            if (hasTextField)
+                textFieldValue = FormatValue(Value);
         }
+    }
 
-        public bool HasReset { get; set; }
-
-        public Slider(string label, float left, float right, float value = 0, float defaultValue = 0)
-        {
-            Label = label;
-            this.left = left;
-            this.right = right;
-            this.value = Utility.Bound(value, left, right);
-            textFieldValue = FormatValue(this.value);
-            DefaultValue = defaultValue;
-        }
+    public bool HasReset { get; set; }
 
-        public Slider(string label, SliderProp prop)
-            : this(label, prop.Left, prop.Right, prop.Initial, prop.Default) { }
+    public Slider(string label, float left, float right, float value = 0, float defaultValue = 0)
+    {
+        Label = label;
+        this.left = left;
+        this.right = right;
+        this.value = Utility.Bound(value, left, right);
+        textFieldValue = FormatValue(this.value);
+        DefaultValue = defaultValue;
+    }
 
-        public Slider(SliderProp prop)
-            : this(string.Empty, prop.Left, prop.Right, prop.Initial, prop.Default) { }
+    public Slider(string label, SliderProp prop)
+        : this(label, prop.Left, prop.Right, prop.Initial, prop.Default) { }
 
-        public void SetBounds(float left, float right)
-        {
-            this.left = left;
-            this.right = right;
-            value = Utility.Bound(value, left, right);
-        }
+    public Slider(SliderProp prop)
+        : this(string.Empty, prop.Left, prop.Right, prop.Initial, prop.Default) { }
 
-        public override void Draw(params GUILayoutOption[] layoutOptions)
-        {
-            var hasUpper = hasLabel || HasTextField || HasReset;
+    public void SetBounds(float left, float right)
+    {
+        this.left = left;
+        this.right = right;
+        value = Utility.Bound(value, left, right);
+    }
 
-            var tempText = string.Empty;
+    public override void Draw(params GUILayoutOption[] layoutOptions)
+    {
+        var hasUpper = hasLabel || HasTextField || HasReset;
 
-            if (hasUpper)
-            {
-                GUILayout.BeginVertical(GUILayout.ExpandWidth(false));
-                GUILayout.BeginHorizontal();
+        var tempText = string.Empty;
 
-                if (hasLabel)
-                {
-                    GUILayout.Label(Label, MpsGui.SliderLabelStyle, GUILayout.ExpandWidth(false));
-                    GUILayout.FlexibleSpace();
-                }
+        if (hasUpper)
+        {
+            GUILayout.BeginVertical(GUILayout.ExpandWidth(false));
+            GUILayout.BeginHorizontal();
 
-                if (HasTextField)
-                    tempText = GUILayout.TextField(textFieldValue, MpsGui.SliderTextBoxStyle, GUILayout.Width(60f));
+            if (hasLabel)
+            {
+                GUILayout.Label(Label, MpsGui.SliderLabelStyle, GUILayout.ExpandWidth(false));
+                GUILayout.FlexibleSpace();
+            }
 
-                if (HasReset && GUILayout.Button("|", MpsGui.SliderResetButtonStyle, GUILayout.Width(15f)))
-                {
-                    Value = DefaultValue;
-                    tempText = textFieldValue = FormatValue(Value);
-                }
+            if (HasTextField)
+                tempText = GUILayout.TextField(textFieldValue, MpsGui.SliderTextBoxStyle, GUILayout.Width(60f));
 
-                GUILayout.EndHorizontal();
+            if (HasReset && GUILayout.Button("|", MpsGui.SliderResetButtonStyle, GUILayout.Width(15f)))
+            {
+                Value = DefaultValue;
+                tempText = textFieldValue = FormatValue(Value);
             }
 
-            var sliderStyle = hasUpper ? MpsGui.SliderStyle : MpsGui.SliderStyleNoLabel;
+            GUILayout.EndHorizontal();
+        }
+
+        var sliderStyle = hasUpper ? MpsGui.SliderStyle : MpsGui.SliderStyleNoLabel;
 
-            var tempValue = GUILayout.HorizontalSlider(
+        var tempValue = GUILayout.HorizontalSlider(
                 Value, Left, Right, sliderStyle, MpsGui.SliderThumbStyle, layoutOptions
-            );
+                );
 
-            if (hasUpper)
-                GUILayout.EndVertical();
+        if (hasUpper)
+            GUILayout.EndVertical();
 
-            if (HasTextField)
-            {
-                if (tempValue != Value)
-                    tempText = textFieldValue = FormatValue(tempValue);
+        if (HasTextField)
+        {
+            if (tempValue != Value)
+                tempText = textFieldValue = FormatValue(tempValue);
 
-                if (tempText != textFieldValue)
-                {
-                    textFieldValue = tempText;
+            if (tempText != textFieldValue)
+            {
+                textFieldValue = tempText;
 
-                    if (float.TryParse(tempText, out var newValue))
-                        tempValue = newValue;
-                }
+                if (float.TryParse(tempText, out var newValue))
+                    tempValue = newValue;
             }
-
-            if (tempValue != Value)
-                Value = tempValue;
         }
 
-        private static string FormatValue(float value) =>
-            value.ToString("0.####", CultureInfo.InvariantCulture);
+        if (tempValue != Value)
+            Value = tempValue;
     }
 
-    public readonly struct SliderProp
-    {
-        public float Left { get; }
-        public float Right { get; }
-        public float Initial { get; }
-        public float Default { get; }
+    private static string FormatValue(float value) =>
+        value.ToString("0.####", CultureInfo.InvariantCulture);
+}
 
-        public SliderProp(float left, float right, float initial = 0f, float @default = 0f)
-        {
-            Left = left;
-            Right = right;
-            Initial = Utility.Bound(initial, left, right);
-            Default = Utility.Bound(@default, left, right);
-        }
+public readonly struct SliderProp
+{
+    public float Left { get; }
+    public float Right { get; }
+    public float Initial { get; }
+    public float Default { get; }
+
+    public SliderProp(float left, float right, float initial = 0f, float @default = 0f)
+    {
+        Left = left;
+        Right = right;
+        Initial = Utility.Bound(initial, left, right);
+        Default = Utility.Bound(@default, left, right);
     }
 }

+ 8 - 9
src/MeidoPhotoStudio.Plugin/GUI/Controls/TextArea.cs

@@ -1,15 +1,14 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class TextArea : BaseControl
 {
-    public class TextArea : BaseControl
-    {
-        public string Value { get; set; } = string.Empty;
+    public string Value { get; set; } = string.Empty;
 
-        public void Draw(GUIStyle textAreaStyle, params GUILayoutOption[] layoutOptions) =>
-            Value = GUILayout.TextArea(Value, textAreaStyle, layoutOptions);
+    public void Draw(GUIStyle textAreaStyle, params GUILayoutOption[] layoutOptions) =>
+        Value = GUILayout.TextArea(Value, textAreaStyle, layoutOptions);
 
-        public override void Draw(params GUILayoutOption[] layoutOptions) =>
-            Draw(new(GUI.skin.textArea), layoutOptions);
-    }
+    public override void Draw(params GUILayoutOption[] layoutOptions) =>
+        Draw(new(GUI.skin.textArea), layoutOptions);
 }

+ 17 - 18
src/MeidoPhotoStudio.Plugin/GUI/Controls/TextField.cs

@@ -1,29 +1,28 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class TextField : BaseControl
-    {
-        private static int textFieldID = 961;
+namespace MeidoPhotoStudio.Plugin;
 
-        private static int ID =>
-            ++textFieldID;
+public class TextField : BaseControl
+{
+    private static int textFieldID = 961;
 
-        private readonly string controlName = $"textField{ID}";
+    private static int ID =>
+        ++textFieldID;
 
-        public string Value { get; set; } = string.Empty;
+    private readonly string controlName = $"textField{ID}";
 
-        public void Draw(GUIStyle textFieldStyle, params GUILayoutOption[] layoutOptions)
-        {
-            GUI.SetNextControlName(controlName);
-            Value = GUILayout.TextField(Value, textFieldStyle, layoutOptions);
+    public string Value { get; set; } = string.Empty;
 
-            if (Event.current.isKey && Event.current.keyCode == KeyCode.Return)
-                OnControlEvent(EventArgs.Empty);
-        }
+    public void Draw(GUIStyle textFieldStyle, params GUILayoutOption[] layoutOptions)
+    {
+        GUI.SetNextControlName(controlName);
+        Value = GUILayout.TextField(Value, textFieldStyle, layoutOptions);
 
-        public override void Draw(params GUILayoutOption[] layoutOptions) =>
-            Draw(new(GUI.skin.textField), layoutOptions);
+        if (Event.current.isKey && Event.current.keyCode == KeyCode.Return)
+            OnControlEvent(EventArgs.Empty);
     }
+
+    public override void Draw(params GUILayoutOption[] layoutOptions) =>
+        Draw(new(GUI.skin.textField), layoutOptions);
 }

+ 31 - 32
src/MeidoPhotoStudio.Plugin/GUI/Controls/Toggle.cs

@@ -1,48 +1,47 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class Toggle : BaseControl
 {
-    public class Toggle : BaseControl
-    {
-        private bool value;
+    private bool value;
 
-        public bool Value
+    public bool Value
+    {
+        get => value;
+        set
         {
-            get => value;
-            set
-            {
-                this.value = value;
+            this.value = value;
 
-                OnControlEvent(EventArgs.Empty);
-            }
+            OnControlEvent(EventArgs.Empty);
         }
+    }
 
-        public string Label { get; set; }
+    public string Label { get; set; }
 
-        public Toggle(string label, bool state = false)
-        {
-            Label = label;
-            value = state;
-        }
-
-        public void Draw(GUIStyle toggleStyle, params GUILayoutOption[] layoutOptions)
-        {
-            var value = GUILayout.Toggle(Value, Label, toggleStyle, layoutOptions);
+    public Toggle(string label, bool state = false)
+    {
+        Label = label;
+        value = state;
+    }
 
-            if (value != Value)
-                Value = value;
-        }
+    public void Draw(GUIStyle toggleStyle, params GUILayoutOption[] layoutOptions)
+    {
+        var value = GUILayout.Toggle(Value, Label, toggleStyle, layoutOptions);
 
-        public void Draw(Rect rect)
-        {
-            var value = GUI.Toggle(rect, Value, Label);
+        if (value != Value)
+            Value = value;
+    }
 
-            if (value != Value)
-                Value = value;
-        }
+    public void Draw(Rect rect)
+    {
+        var value = GUI.Toggle(rect, Value, Label);
 
-        public override void Draw(params GUILayoutOption[] layoutOptions) =>
-            Draw(new(GUI.skin.toggle), layoutOptions);
+        if (value != Value)
+            Value = value;
     }
+
+    public override void Draw(params GUILayoutOption[] layoutOptions) =>
+        Draw(new(GUI.skin.toggle), layoutOptions);
 }

+ 163 - 164
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/AttachPropPane.cs

@@ -3,214 +3,213 @@ using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class AttachPropPane : BasePane
 {
-    public class AttachPropPane : BasePane
-    {
-        private static readonly Dictionary<AttachPoint, string> toggleTranslation =
-            new()
-            {
-                [AttachPoint.Head] = "head",
-                [AttachPoint.Neck] = "neck",
-                [AttachPoint.UpperArmL] = "upperArmL",
-                [AttachPoint.UpperArmR] = "upperArmR",
-                [AttachPoint.ForearmL] = "forearmL",
-                [AttachPoint.ForearmR] = "forearmR",
-                [AttachPoint.MuneL] = "muneL",
-                [AttachPoint.MuneR] = "muneR",
-                [AttachPoint.HandL] = "handL",
-                [AttachPoint.HandR] = "handR",
-                [AttachPoint.Pelvis] = "pelvis",
-                [AttachPoint.ThighL] = "thighL",
-                [AttachPoint.ThighR] = "thighR",
-                [AttachPoint.CalfL] = "calfL",
-                [AttachPoint.CalfR] = "calfR",
-                [AttachPoint.FootL] = "footL",
-                [AttachPoint.FootR] = "footR",
-                [AttachPoint.Spine1a] = "spine1a",
-                [AttachPoint.Spine1] = "spine1",
-                [AttachPoint.Spine0a] = "spine0a",
-                [AttachPoint.Spine0] = "spine0"
-            };
-
-        private readonly PropManager propManager;
-        private readonly MeidoManager meidoManager;
-        private readonly Dictionary<AttachPoint, Toggle> toggles = new();
-        private readonly Toggle keepWorldPositionToggle;
-        private readonly Dropdown meidoDropdown;
-
-        private Toggle activeToggle;
-        private bool meidoDropdownActive;
-        private bool doguDropdownActive;
-        private string header;
-
-        private bool PaneActive =>
-            meidoDropdownActive && doguDropdownActive;
-
-        private Meido SelectedMeido =>
-            meidoManager.ActiveMeidoList[meidoDropdown.SelectedItemIndex];
-
-        private DragPointProp SelectedProp =>
-            propManager.CurrentProp;
-
-        private bool KeepWoldPosition =>
-            keepWorldPositionToggle.Value;
-
-        public AttachPropPane(MeidoManager meidoManager, PropManager propManager)
+    private static readonly Dictionary<AttachPoint, string> toggleTranslation =
+        new()
         {
-            header = Translation.Get("attachPropPane", "header");
+            [AttachPoint.Head] = "head",
+            [AttachPoint.Neck] = "neck",
+            [AttachPoint.UpperArmL] = "upperArmL",
+            [AttachPoint.UpperArmR] = "upperArmR",
+            [AttachPoint.ForearmL] = "forearmL",
+            [AttachPoint.ForearmR] = "forearmR",
+            [AttachPoint.MuneL] = "muneL",
+            [AttachPoint.MuneR] = "muneR",
+            [AttachPoint.HandL] = "handL",
+            [AttachPoint.HandR] = "handR",
+            [AttachPoint.Pelvis] = "pelvis",
+            [AttachPoint.ThighL] = "thighL",
+            [AttachPoint.ThighR] = "thighR",
+            [AttachPoint.CalfL] = "calfL",
+            [AttachPoint.CalfR] = "calfR",
+            [AttachPoint.FootL] = "footL",
+            [AttachPoint.FootR] = "footR",
+            [AttachPoint.Spine1a] = "spine1a",
+            [AttachPoint.Spine1] = "spine1",
+            [AttachPoint.Spine0a] = "spine0a",
+            [AttachPoint.Spine0] = "spine0"
+        };
+
+    private readonly PropManager propManager;
+    private readonly MeidoManager meidoManager;
+    private readonly Dictionary<AttachPoint, Toggle> toggles = new();
+    private readonly Toggle keepWorldPositionToggle;
+    private readonly Dropdown meidoDropdown;
+
+    private Toggle activeToggle;
+    private bool meidoDropdownActive;
+    private bool doguDropdownActive;
+    private string header;
+
+    private bool PaneActive =>
+        meidoDropdownActive && doguDropdownActive;
+
+    private Meido SelectedMeido =>
+        meidoManager.ActiveMeidoList[meidoDropdown.SelectedItemIndex];
+
+    private DragPointProp SelectedProp =>
+        propManager.CurrentProp;
+
+    private bool KeepWoldPosition =>
+        keepWorldPositionToggle.Value;
+
+    public AttachPropPane(MeidoManager meidoManager, PropManager propManager)
+    {
+        header = Translation.Get("attachPropPane", "header");
 
-            this.propManager = propManager;
-            this.meidoManager = meidoManager;
+        this.propManager = propManager;
+        this.meidoManager = meidoManager;
 
-            this.meidoManager.EndCallMeidos += (s, a) => SetMeidoDropdown();
-            this.propManager.PropSelectionChange += (s, a) => UpdateToggles();
+        this.meidoManager.EndCallMeidos += (s, a) => SetMeidoDropdown();
+        this.propManager.PropSelectionChange += (s, a) => UpdateToggles();
 
-            this.propManager.PropListChange += (s, a) =>
-            {
-                doguDropdownActive = this.propManager.PropCount > 0;
-                UpdateToggles();
-            };
+        this.propManager.PropListChange += (s, a) =>
+        {
+            doguDropdownActive = this.propManager.PropCount > 0;
+            UpdateToggles();
+        };
 
-            meidoDropdown = new(new[] { Translation.Get("systemMessage", "noMaids") });
-            meidoDropdown.SelectionChange += (s, a) => UpdateToggles();
+        meidoDropdown = new(new[] { Translation.Get("systemMessage", "noMaids") });
+        meidoDropdown.SelectionChange += (s, a) => UpdateToggles();
 
-            keepWorldPositionToggle = new(Translation.Get("attachPropPane", "keepWorldPosition"));
+        keepWorldPositionToggle = new(Translation.Get("attachPropPane", "keepWorldPosition"));
 
-            foreach (var attachPoint in Enum.GetValues(typeof(AttachPoint)).Cast<AttachPoint>())
-            {
-                if (attachPoint is AttachPoint.None)
-                    continue;
+        foreach (var attachPoint in Enum.GetValues(typeof(AttachPoint)).Cast<AttachPoint>())
+        {
+            if (attachPoint is AttachPoint.None)
+                continue;
 
-                var point = attachPoint;
-                var toggle = new Toggle(Translation.Get("attachPropPane", toggleTranslation[point]));
+            var point = attachPoint;
+            var toggle = new Toggle(Translation.Get("attachPropPane", toggleTranslation[point]));
 
-                toggle.ControlEvent += (s, a) => OnToggleChange(point);
-                toggles[point] = toggle;
-            }
+            toggle.ControlEvent += (s, a) => OnToggleChange(point);
+            toggles[point] = toggle;
         }
+    }
 
-        protected override void ReloadTranslation()
-        {
-            header = Translation.Get("attachPropPane", "header");
-            keepWorldPositionToggle.Label = Translation.Get("attachPropPane", "keepWorldPosition");
+    protected override void ReloadTranslation()
+    {
+        header = Translation.Get("attachPropPane", "header");
+        keepWorldPositionToggle.Label = Translation.Get("attachPropPane", "keepWorldPosition");
 
-            foreach (var attachPoint in Enum.GetValues(typeof(AttachPoint)).Cast<AttachPoint>())
-            {
-                if (attachPoint is AttachPoint.None)
-                    continue;
+        foreach (var attachPoint in Enum.GetValues(typeof(AttachPoint)).Cast<AttachPoint>())
+        {
+            if (attachPoint is AttachPoint.None)
+                continue;
 
-                toggles[attachPoint].Label = Translation.Get("attachPropPane", toggleTranslation[attachPoint]);
-            }
+            toggles[attachPoint].Label = Translation.Get("attachPropPane", toggleTranslation[attachPoint]);
         }
+    }
 
-        public override void Draw()
-        {
-            const float dropdownButtonHeight = 30;
-            const float dropdownButtonWidth = 153f;
+    public override void Draw()
+    {
+        const float dropdownButtonHeight = 30;
+        const float dropdownButtonWidth = 153f;
 
-            var dropdownLayoutOptions = new[]
-            {
-                GUILayout.Height(dropdownButtonHeight),
+        var dropdownLayoutOptions = new[]
+        {
+            GUILayout.Height(dropdownButtonHeight),
                 GUILayout.Width(dropdownButtonWidth),
-            };
+        };
 
-            MpsGui.Header(header);
-            MpsGui.WhiteLine();
+        MpsGui.Header(header);
+        MpsGui.WhiteLine();
 
-            GUI.enabled = PaneActive;
+        GUI.enabled = PaneActive;
 
-            meidoDropdown.Draw(dropdownLayoutOptions);
+        meidoDropdown.Draw(dropdownLayoutOptions);
 
-            keepWorldPositionToggle.Draw();
+        keepWorldPositionToggle.Draw();
 
-            DrawToggleGroup(AttachPoint.Head, AttachPoint.Neck);
-            DrawToggleGroup(AttachPoint.UpperArmR, AttachPoint.Spine1a, AttachPoint.UpperArmL);
-            DrawToggleGroup(AttachPoint.ForearmR, AttachPoint.Spine1, AttachPoint.ForearmL);
-            DrawToggleGroup(AttachPoint.MuneR, AttachPoint.Spine0a, AttachPoint.MuneL);
-            DrawToggleGroup(AttachPoint.HandR, AttachPoint.Spine0, AttachPoint.HandL);
-            DrawToggleGroup(AttachPoint.ThighR, AttachPoint.Pelvis, AttachPoint.ThighL);
-            DrawToggleGroup(AttachPoint.CalfR, AttachPoint.CalfL);
-            DrawToggleGroup(AttachPoint.FootR, AttachPoint.FootL);
+        DrawToggleGroup(AttachPoint.Head, AttachPoint.Neck);
+        DrawToggleGroup(AttachPoint.UpperArmR, AttachPoint.Spine1a, AttachPoint.UpperArmL);
+        DrawToggleGroup(AttachPoint.ForearmR, AttachPoint.Spine1, AttachPoint.ForearmL);
+        DrawToggleGroup(AttachPoint.MuneR, AttachPoint.Spine0a, AttachPoint.MuneL);
+        DrawToggleGroup(AttachPoint.HandR, AttachPoint.Spine0, AttachPoint.HandL);
+        DrawToggleGroup(AttachPoint.ThighR, AttachPoint.Pelvis, AttachPoint.ThighL);
+        DrawToggleGroup(AttachPoint.CalfR, AttachPoint.CalfL);
+        DrawToggleGroup(AttachPoint.FootR, AttachPoint.FootL);
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        private void DrawToggleGroup(params AttachPoint[] attachPoints)
-        {
-            GUILayout.BeginHorizontal();
-            GUILayout.FlexibleSpace();
+    private void DrawToggleGroup(params AttachPoint[] attachPoints)
+    {
+        GUILayout.BeginHorizontal();
+        GUILayout.FlexibleSpace();
 
-            foreach (var point in attachPoints)
-                toggles[point].Draw();
+        foreach (var point in attachPoints)
+            toggles[point].Draw();
 
-            GUILayout.FlexibleSpace();
-            GUILayout.EndHorizontal();
-        }
+        GUILayout.FlexibleSpace();
+        GUILayout.EndHorizontal();
+    }
 
-        private void OnToggleChange(AttachPoint point)
-        {
-            if (updating)
-                return;
+    private void OnToggleChange(AttachPoint point)
+    {
+        if (updating)
+            return;
 
-            var toggle = toggles[point];
+        var toggle = toggles[point];
 
-            if (toggle.Value)
-            {
-                if (activeToggle is not null)
-                {
-                    updating = true;
-                    activeToggle.Value = false;
-                    updating = false;
-                }
-
-                activeToggle = toggle;
-                SelectedProp.AttachTo(SelectedMeido, point, KeepWoldPosition);
-            }
-            else
+        if (toggle.Value)
+        {
+            if (activeToggle is not null)
             {
-                SelectedProp.DetachFrom(KeepWoldPosition);
-                activeToggle = null;
+                updating = true;
+                activeToggle.Value = false;
+                updating = false;
             }
-        }
 
-        private void UpdateToggles()
+            activeToggle = toggle;
+            SelectedProp.AttachTo(SelectedMeido, point, KeepWoldPosition);
+        }
+        else
         {
-            updating = true;
+            SelectedProp.DetachFrom(KeepWoldPosition);
+            activeToggle = null;
+        }
+    }
 
-            if (activeToggle is not null)
-                activeToggle.Value = false;
+    private void UpdateToggles()
+    {
+        updating = true;
 
-            activeToggle = null;
-            updating = false;
+        if (activeToggle is not null)
+            activeToggle.Value = false;
 
-            if (!meidoManager.HasActiveMeido || propManager.PropCount is 0)
-                return;
+        activeToggle = null;
+        updating = false;
 
-            var info = SelectedProp.AttachPointInfo;
+        if (!meidoManager.HasActiveMeido || propManager.PropCount is 0)
+            return;
 
-            if (SelectedMeido.Maid.status.guid != info.MaidGuid)
-                return;
+        var info = SelectedProp.AttachPointInfo;
 
-            updating = true;
+        if (SelectedMeido.Maid.status.guid != info.MaidGuid)
+            return;
 
-            var toggle = toggles[info.AttachPoint];
+        updating = true;
 
-            toggle.Value = true;
-            activeToggle = toggle;
-            updating = false;
-        }
+        var toggle = toggles[info.AttachPoint];
 
-        private void SetMeidoDropdown()
-        {
-            meidoDropdownActive = meidoManager.HasActiveMeido;
+        toggle.Value = true;
+        activeToggle = toggle;
+        updating = false;
+    }
 
-            var dropdownList = meidoManager.ActiveMeidoList.Count is 0
-                ? new[] { Translation.Get("systemMessage", "noMaids") }
-                : meidoManager.ActiveMeidoList.Select(meido => $"{meido.Slot + 1}: {meido.FirstName} {meido.LastName}")
-                    .ToArray();
+    private void SetMeidoDropdown()
+    {
+        meidoDropdownActive = meidoManager.HasActiveMeido;
 
-            meidoDropdown.SetDropdownItems(dropdownList, 0);
-        }
+        var dropdownList = meidoManager.ActiveMeidoList.Count is 0
+            ? new[] { Translation.Get("systemMessage", "noMaids") }
+        : meidoManager.ActiveMeidoList.Select(meido => $"{meido.Slot + 1}: {meido.FirstName} {meido.LastName}")
+            .ToArray();
+
+        meidoDropdown.SetDropdownItems(dropdownList, 0);
     }
 }

+ 152 - 153
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/ModPropsPane.cs

@@ -4,209 +4,208 @@ using UnityEngine;
 
 using static MeidoPhotoStudio.Plugin.MenuFileUtility;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class ModPropsPane : BasePane
 {
-    public class ModPropsPane : BasePane
+    private enum FilterType { None, Mod, Base }
+
+    private readonly PropManager propManager;
+    private readonly Dropdown propCategoryDropdown;
+    private readonly Toggle modFilterToggle;
+    private readonly Toggle baseFilterToggle;
+    private readonly bool isModsOnly = PropManager.ModItemsOnly;
+
+    private Vector2 propListScrollPos;
+    private List<ModItem> modPropList;
+    private string currentCategory;
+    private bool modItemsReady;
+    private bool shouldDraw;
+    private int categoryIndex;
+    private bool modFilter;
+    private bool baseFilter;
+    private int currentListCount;
+
+    private string SelectedCategory =>
+        MenuCategories[propCategoryDropdown.SelectedItemIndex];
+
+    public ModPropsPane(PropManager propManager)
     {
-        private enum FilterType { None, Mod, Base }
-
-        private readonly PropManager propManager;
-        private readonly Dropdown propCategoryDropdown;
-        private readonly Toggle modFilterToggle;
-        private readonly Toggle baseFilterToggle;
-        private readonly bool isModsOnly = PropManager.ModItemsOnly;
-
-        private Vector2 propListScrollPos;
-        private List<ModItem> modPropList;
-        private string currentCategory;
-        private bool modItemsReady;
-        private bool shouldDraw;
-        private int categoryIndex;
-        private bool modFilter;
-        private bool baseFilter;
-        private int currentListCount;
-
-        private string SelectedCategory =>
-            MenuCategories[propCategoryDropdown.SelectedItemIndex];
-
-        public ModPropsPane(PropManager propManager)
-        {
-            this.propManager = propManager;
+        this.propManager = propManager;
 
-            modItemsReady = MenuFilesReady || PropManager.ModItemsOnly;
+        modItemsReady = MenuFilesReady || PropManager.ModItemsOnly;
 
-            var listItems = Translation.GetArray("clothing", MenuCategories);
+        var listItems = Translation.GetArray("clothing", MenuCategories);
 
-            if (!modItemsReady)
-            {
-                listItems[0] = Translation.Get("systemMessage", "initializing");
-
-                MenuFilesReadyChange += (s, a) =>
-                {
-                    modItemsReady = true;
-                    propCategoryDropdown.SetDropdownItems(
-                        Translation.GetArray("clothing", MenuCategories)
-                    );
-                };
-            }
+        if (!modItemsReady)
+        {
+            listItems[0] = Translation.Get("systemMessage", "initializing");
 
-            propCategoryDropdown = new(listItems);
-            propCategoryDropdown.SelectionChange += (s, a) =>
+            MenuFilesReadyChange += (s, a) =>
             {
-                if (!modItemsReady)
-                    return;
-
-                ChangePropCategory();
+                modItemsReady = true;
+                propCategoryDropdown.SetDropdownItems(
+                    Translation.GetArray("clothing", MenuCategories)
+                );
             };
+        }
 
-            if (isModsOnly)
+        propCategoryDropdown = new(listItems);
+        propCategoryDropdown.SelectionChange += (s, a) =>
+        {
+            if (!modItemsReady)
                 return;
 
-            modFilterToggle = new(Translation.Get("background2Window", "modsToggle"));
-            modFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Mod);
+            ChangePropCategory();
+        };
 
-            baseFilterToggle = new(Translation.Get("background2Window", "baseToggle"));
-            baseFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Base);
-        }
+        if (isModsOnly)
+            return;
 
-        public override void Draw()
-        {
-            const float dropdownButtonHeight = 30f;
+        modFilterToggle = new(Translation.Get("background2Window", "modsToggle"));
+        modFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Mod);
 
-            var dropdownButtonWidth = isModsOnly ? 120f : 90f;
+        baseFilterToggle = new(Translation.Get("background2Window", "baseToggle"));
+        baseFilterToggle.ControlEvent += (s, a) => ChangeFilter(FilterType.Base);
+    }
 
-            var dropdownLayoutOptions = new[] {
-                GUILayout.Height(dropdownButtonHeight),
-                GUILayout.Width(dropdownButtonWidth),
-            };
+    public override void Draw()
+    {
+        const float dropdownButtonHeight = 30f;
 
-            GUILayout.BeginHorizontal();
+        var dropdownButtonWidth = isModsOnly ? 120f : 90f;
 
-            if (isModsOnly)
-            {
-                GUILayout.FlexibleSpace();
-                propCategoryDropdown.Draw(dropdownLayoutOptions);
-                GUILayout.FlexibleSpace();
-            }
-            else
-            {
-                GUI.enabled = modItemsReady;
-                propCategoryDropdown.Draw(dropdownLayoutOptions);
+        var dropdownLayoutOptions = new[] {
+            GUILayout.Height(dropdownButtonHeight),
+            GUILayout.Width(dropdownButtonWidth),
+        };
 
-                GUI.enabled = shouldDraw;
-                modFilterToggle.Draw();
-                baseFilterToggle.Draw();
-                GUI.enabled = true;
-            }
+        GUILayout.BeginHorizontal();
 
-            GUILayout.EndHorizontal();
+        if (isModsOnly)
+        {
+            GUILayout.FlexibleSpace();
+            propCategoryDropdown.Draw(dropdownLayoutOptions);
+            GUILayout.FlexibleSpace();
+        }
+        else
+        {
+            GUI.enabled = modItemsReady;
+            propCategoryDropdown.Draw(dropdownLayoutOptions);
 
-            if (shouldDraw)
-            {
-                var windowRect = parent.WindowRect;
-                var windowHeight = windowRect.height;
-                var windowWidth = windowRect.width;
+            GUI.enabled = shouldDraw;
+            modFilterToggle.Draw();
+            baseFilterToggle.Draw();
+            GUI.enabled = true;
+        }
 
-                const float offsetTop = 80f;
-                const int columns = 4;
+        GUILayout.EndHorizontal();
 
-                var buttonSize = windowWidth / columns - 10f;
+        if (shouldDraw)
+        {
+            var windowRect = parent.WindowRect;
+            var windowHeight = windowRect.height;
+            var windowWidth = windowRect.width;
 
-                var positionRect = new Rect(
-                    5f, offsetTop + dropdownButtonHeight, windowWidth - 10f, windowHeight - 145f
-                );
+            const float offsetTop = 80f;
+            const int columns = 4;
 
-                var viewRect = new Rect(
-                    0f, 0f, buttonSize * columns, buttonSize * Mathf.Ceil(currentListCount / (float)columns) + 5
-                );
+            var buttonSize = windowWidth / columns - 10f;
 
-                propListScrollPos = GUI.BeginScrollView(positionRect, propListScrollPos, viewRect);
+            var positionRect = new Rect(
+                5f, offsetTop + dropdownButtonHeight, windowWidth - 10f, windowHeight - 145f
+            );
 
-                var modIndex = 0;
+            var viewRect = new Rect(
+                0f, 0f, buttonSize * columns, buttonSize * Mathf.Ceil(currentListCount / (float)columns) + 5
+            );
 
-                foreach (var modItem in modPropList)
-                {
-                    if (modFilter && !modItem.IsMod || baseFilter && modItem.IsMod)
-                        continue;
+            propListScrollPos = GUI.BeginScrollView(positionRect, propListScrollPos, viewRect);
 
-                    var x = modIndex % columns * buttonSize;
-                    var y = modIndex / columns * buttonSize;
-                    var iconRect = new Rect(x, y, buttonSize, buttonSize);
+            var modIndex = 0;
 
-                    if (GUI.Button(iconRect, ""))
-                        propManager.AddModProp(modItem);
+            foreach (var modItem in modPropList)
+            {
+                if (modFilter && !modItem.IsMod || baseFilter && modItem.IsMod)
+                    continue;
 
-                    GUI.DrawTexture(iconRect, modItem.Icon);
-                    modIndex++;
-                }
+                var x = modIndex % columns * buttonSize;
+                var y = modIndex / columns * buttonSize;
+                var iconRect = new Rect(x, y, buttonSize, buttonSize);
 
-                GUI.EndScrollView();
-            }
-        }
+                if (GUI.Button(iconRect, ""))
+                    propManager.AddModProp(modItem);
 
-        protected override void ReloadTranslation()
-        {
-            var listItems = Translation.GetArray("clothing", MenuCategories);
+                GUI.DrawTexture(iconRect, modItem.Icon);
+                modIndex++;
+            }
 
-            if (!modItemsReady)
-                listItems[0] = Translation.Get("systemMessage", "initializing");
+            GUI.EndScrollView();
+        }
+    }
 
-            propCategoryDropdown.SetDropdownItems(listItems);
+    protected override void ReloadTranslation()
+    {
+        var listItems = Translation.GetArray("clothing", MenuCategories);
 
-            if (isModsOnly)
-                return;
+        if (!modItemsReady)
+            listItems[0] = Translation.Get("systemMessage", "initializing");
 
-            modFilterToggle.Label = Translation.Get("background2Window", "modsToggle");
-            baseFilterToggle.Label = Translation.Get("background2Window", "baseToggle");
-        }
+        propCategoryDropdown.SetDropdownItems(listItems);
 
-        private void ChangeFilter(FilterType filterType)
-        {
-            if (updating)
-                return;
+        if (isModsOnly)
+            return;
 
-            if (modFilterToggle.Value && baseFilterToggle.Value)
-            {
-                updating = true;
-                modFilterToggle.Value = filterType is FilterType.Mod;
-                baseFilterToggle.Value = filterType is FilterType.Base;
-                updating = false;
-            }
+        modFilterToggle.Label = Translation.Get("background2Window", "modsToggle");
+        baseFilterToggle.Label = Translation.Get("background2Window", "baseToggle");
+    }
 
-            modFilter = modFilterToggle.Value;
-            baseFilter = baseFilterToggle.Value;
+    private void ChangeFilter(FilterType filterType)
+    {
+        if (updating)
+            return;
 
-            SetListCount();
+        if (modFilterToggle.Value && baseFilterToggle.Value)
+        {
+            updating = true;
+            modFilterToggle.Value = filterType is FilterType.Mod;
+            baseFilterToggle.Value = filterType is FilterType.Base;
+            updating = false;
         }
 
-        private void ChangePropCategory()
-        {
-            var category = SelectedCategory;
+        modFilter = modFilterToggle.Value;
+        baseFilter = baseFilterToggle.Value;
 
-            if (currentCategory == category)
-                return;
+        SetListCount();
+    }
 
-            currentCategory = category;
+    private void ChangePropCategory()
+    {
+        var category = SelectedCategory;
 
-            categoryIndex = propCategoryDropdown.SelectedItemIndex;
+        if (currentCategory == category)
+            return;
 
-            shouldDraw = categoryIndex > 0;
+        currentCategory = category;
 
-            if (!shouldDraw)
-                return;
+        categoryIndex = propCategoryDropdown.SelectedItemIndex;
 
-            propListScrollPos = Vector2.zero;
+        shouldDraw = categoryIndex > 0;
 
-            modPropList = Constants.GetModPropList(category);
+        if (!shouldDraw)
+            return;
 
-            SetListCount();
-        }
+        propListScrollPos = Vector2.zero;
+
+        modPropList = Constants.GetModPropList(category);
 
-        private void SetListCount() =>
-            currentListCount = modFilter
-                ? modPropList.Count(mod => mod.IsMod)
-                : baseFilter
-                    ? modPropList.Count(mod => !mod.IsMod)
-                    : modPropList.Count;
+        SetListCount();
     }
+
+    private void SetListCount() =>
+        currentListCount = modFilter
+            ? modPropList.Count(mod => mod.IsMod)
+            : baseFilter
+                ? modPropList.Count(mod => !mod.IsMod)
+                : modPropList.Count;
 }

+ 70 - 71
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/MyRoomPropsPane.cs

@@ -1,101 +1,100 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class MyRoomPropsPane : BasePane
-    {
-        private readonly PropManager propManager;
-        private readonly Dropdown propCategoryDropdown;
+namespace MeidoPhotoStudio.Plugin;
 
-        private Vector2 propListScrollPos;
-        private List<MyRoomItem> myRoomPropList;
-        private string currentCategory;
+public class MyRoomPropsPane : BasePane
+{
+    private readonly PropManager propManager;
+    private readonly Dropdown propCategoryDropdown;
 
-        private string SelectedCategory =>
-            Constants.MyRoomPropCategories[propCategoryDropdown.SelectedItemIndex];
+    private Vector2 propListScrollPos;
+    private List<MyRoomItem> myRoomPropList;
+    private string currentCategory;
 
-        public MyRoomPropsPane(PropManager propManager)
-        {
-            this.propManager = propManager;
+    private string SelectedCategory =>
+        Constants.MyRoomPropCategories[propCategoryDropdown.SelectedItemIndex];
 
-            propCategoryDropdown = new(Translation.GetArray("doguCategories", Constants.MyRoomPropCategories));
-            propCategoryDropdown.SelectionChange += (s, a) => ChangePropCategory(SelectedCategory);
+    public MyRoomPropsPane(PropManager propManager)
+    {
+        this.propManager = propManager;
 
-            ChangePropCategory(SelectedCategory);
-        }
+        propCategoryDropdown = new(Translation.GetArray("doguCategories", Constants.MyRoomPropCategories));
+        propCategoryDropdown.SelectionChange += (s, a) => ChangePropCategory(SelectedCategory);
 
-        public override void Draw()
-        {
-            const float dropdownButtonHeight = 30f;
-            const float dropdownButtonWidth = 120f;
+        ChangePropCategory(SelectedCategory);
+    }
 
-            var dropdownLayoutOptions = new[] {
-                GUILayout.Height(dropdownButtonHeight),
-                GUILayout.Width(dropdownButtonWidth),
-            };
+    public override void Draw()
+    {
+        const float dropdownButtonHeight = 30f;
+        const float dropdownButtonWidth = 120f;
 
-            GUILayout.BeginHorizontal();
-            GUILayout.FlexibleSpace();
-            propCategoryDropdown.Draw(dropdownLayoutOptions);
-            GUILayout.FlexibleSpace();
-            GUILayout.EndHorizontal();
+        var dropdownLayoutOptions = new[] {
+            GUILayout.Height(dropdownButtonHeight),
+            GUILayout.Width(dropdownButtonWidth),
+        };
 
-            var windowRect = parent.WindowRect;
+        GUILayout.BeginHorizontal();
+        GUILayout.FlexibleSpace();
+        propCategoryDropdown.Draw(dropdownLayoutOptions);
+        GUILayout.FlexibleSpace();
+        GUILayout.EndHorizontal();
 
-            var windowHeight = windowRect.height;
-            var windowWidth = windowRect.width;
+        var windowRect = parent.WindowRect;
 
-            const float offsetTop = 80f;
-            const int columns = 3;
+        var windowHeight = windowRect.height;
+        var windowWidth = windowRect.width;
 
-            var buttonSize = windowWidth / columns - 10f;
+        const float offsetTop = 80f;
+        const int columns = 3;
 
-            var listCount = myRoomPropList.Count;
+        var buttonSize = windowWidth / columns - 10f;
 
-            var positionRect = new Rect(
-                5f, offsetTop + dropdownButtonHeight, windowWidth - 10f, windowHeight - 145f
-            );
+        var listCount = myRoomPropList.Count;
 
-            var viewRect = new Rect(
-                0f, 0f, buttonSize * columns, buttonSize * Mathf.Ceil(listCount / (float)columns) + 5f
-            );
+        var positionRect = new Rect(
+            5f, offsetTop + dropdownButtonHeight, windowWidth - 10f, windowHeight - 145f
+        );
 
-            propListScrollPos = GUI.BeginScrollView(positionRect, propListScrollPos, viewRect);
+        var viewRect = new Rect(
+            0f, 0f, buttonSize * columns, buttonSize * Mathf.Ceil(listCount / (float)columns) + 5f
+        );
 
-            for (var i = 0; i < listCount; i++)
-            {
-                var x = i % columns * buttonSize;
-                var y = i / columns * buttonSize;
-                var myRoomItem = myRoomPropList[i];
-                var iconRect = new Rect(x, y, buttonSize, buttonSize);
+        propListScrollPos = GUI.BeginScrollView(positionRect, propListScrollPos, viewRect);
 
-                if (GUI.Button(iconRect, ""))
-                    propManager.AddMyRoomProp(myRoomItem);
+        for (var i = 0; i < listCount; i++)
+        {
+            var x = i % columns * buttonSize;
+            var y = i / columns * buttonSize;
+            var myRoomItem = myRoomPropList[i];
+            var iconRect = new Rect(x, y, buttonSize, buttonSize);
 
-                GUI.DrawTexture(iconRect, myRoomItem.Icon);
-            }
+            if (GUI.Button(iconRect, ""))
+                propManager.AddMyRoomProp(myRoomItem);
 
-            GUI.EndScrollView();
+            GUI.DrawTexture(iconRect, myRoomItem.Icon);
         }
 
-        protected override void ReloadTranslation() =>
-            propCategoryDropdown.SetDropdownItems(
-                Translation.GetArray("doguCategories", Constants.MyRoomPropCategories)
-            );
+        GUI.EndScrollView();
+    }
 
-        private void ChangePropCategory(string category)
-        {
-            if (currentCategory == category)
-                return;
+    protected override void ReloadTranslation() =>
+        propCategoryDropdown.SetDropdownItems(
+            Translation.GetArray("doguCategories", Constants.MyRoomPropCategories)
+        );
 
-            currentCategory = category;
-            propListScrollPos = Vector2.zero;
-            myRoomPropList = Constants.MyRoomPropDict[category];
+    private void ChangePropCategory(string category)
+    {
+        if (currentCategory == category)
+            return;
 
-            if (myRoomPropList[0].Icon == null)
-                foreach (var item in myRoomPropList)
-                    item.Icon = (Texture2D)MyRoomCustom.PlacementData.GetData(item.ID).GetThumbnail();
-        }
+        currentCategory = category;
+        propListScrollPos = Vector2.zero;
+        myRoomPropList = Constants.MyRoomPropDict[category];
+
+        if (myRoomPropList[0].Icon == null)
+            foreach (var item in myRoomPropList)
+                item.Icon = (Texture2D)MyRoomCustom.PlacementData.GetData(item.ID).GetThumbnail();
     }
 }

+ 143 - 144
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/PropManagerPane.cs

@@ -1,166 +1,165 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class PropManagerPane : BasePane
 {
-    public class PropManagerPane : BasePane
+    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 string propManagerHeader;
+
+    private int CurrentDoguIndex =>
+        propManager.CurrentPropIndex;
+
+    public PropManagerPane(PropManager propManager)
     {
-        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 string propManagerHeader;
-
-        private int CurrentDoguIndex =>
-            propManager.CurrentPropIndex;
-
-        public PropManagerPane(PropManager propManager)
-        {
-            this.propManager = propManager;
-            this.propManager.PropListChange += (s, a) =>
-            {
-                UpdatePropList();
-                UpdateToggles();
-            };
-
-            this.propManager.FromPropSelect += (s, a) =>
-            {
-                updating = true;
-                propDropdown.SelectedItemIndex = CurrentDoguIndex;
-                updating = false;
-                UpdateToggles();
-            };
-
-            propDropdown = new(this.propManager.PropNameList);
-            propDropdown.SelectionChange += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                this.propManager.CurrentPropIndex = propDropdown.SelectedItemIndex;
-
-                UpdateToggles();
-            };
-
-            previousPropButton = new("<");
-            previousPropButton.ControlEvent += (s, a) => propDropdown.Step(-1);
-
-            nextPropButton = new(">");
-            nextPropButton.ControlEvent += (s, a) => propDropdown.Step(1);
-
-            dragPointToggle = new(Translation.Get("propManagerPane", "dragPointToggle"));
-            dragPointToggle.ControlEvent += (s, a) =>
-            {
-                if (updating || this.propManager.PropCount == 0)
-                    return;
-
-                this.propManager.CurrentProp.DragPointEnabled = dragPointToggle.Value;
-            };
-
-            gizmoToggle = new(Translation.Get("propManagerPane", "gizmoToggle"));
-            gizmoToggle.ControlEvent += (s, a) =>
-            {
-                if (updating || this.propManager.PropCount == 0)
-                    return;
-
-                this.propManager.CurrentProp.GizmoEnabled = gizmoToggle.Value;
-            };
-
-            shadowCastingToggle = new(Translation.Get("propManagerPane", "shadowCastingToggle"));
-            shadowCastingToggle.ControlEvent += (s, a) =>
-            {
-                if (updating || this.propManager.PropCount == 0)
-                    return;
-
-                this.propManager.CurrentProp.ShadowCasting = shadowCastingToggle.Value;
-            };
-
-            copyPropButton = new(Translation.Get("propManagerPane", "copyButton"));
-            copyPropButton.ControlEvent += (s, a) => this.propManager.CopyProp(CurrentDoguIndex);
-
-            deletePropButton = new(Translation.Get("propManagerPane", "deleteButton"));
-            deletePropButton.ControlEvent += (s, a) => this.propManager.RemoveProp(CurrentDoguIndex);
-
-            propManagerHeader = Translation.Get("propManagerPane", "header");
-        }
-
-        public override void Draw()
+        this.propManager = propManager;
+        this.propManager.PropListChange += (s, a) =>
         {
-            const float buttonHeight = 30;
+            UpdatePropList();
+            UpdateToggles();
+        };
 
-            var arrowLayoutOptions = new[] {
-                GUILayout.Width(buttonHeight),
-                GUILayout.Height(buttonHeight),
-            };
+        this.propManager.FromPropSelect += (s, a) =>
+        {
+            updating = true;
+            propDropdown.SelectedItemIndex = CurrentDoguIndex;
+            updating = false;
+            UpdateToggles();
+        };
 
-            const float dropdownButtonWidth = 140f;
+        propDropdown = new(this.propManager.PropNameList);
+        propDropdown.SelectionChange += (s, a) =>
+        {
+            if (updating)
+                return;
 
-            var dropdownLayoutOptions = new[] {
-                GUILayout.Height(buttonHeight),
-                GUILayout.Width(dropdownButtonWidth),
-            };
+            this.propManager.CurrentPropIndex = propDropdown.SelectedItemIndex;
 
-            MpsGui.Header(propManagerHeader);
-            MpsGui.WhiteLine();
+            UpdateToggles();
+        };
 
-            GUI.enabled = propManager.PropCount > 0;
+        previousPropButton = new("<");
+        previousPropButton.ControlEvent += (s, a) => propDropdown.Step(-1);
 
-            GUILayout.BeginHorizontal();
-            propDropdown.Draw(dropdownLayoutOptions);
-            previousPropButton.Draw(arrowLayoutOptions);
-            nextPropButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
+        nextPropButton = new(">");
+        nextPropButton.ControlEvent += (s, a) => propDropdown.Step(1);
 
-            var noExpandWidth = GUILayout.ExpandWidth(false);
+        dragPointToggle = new(Translation.Get("propManagerPane", "dragPointToggle"));
+        dragPointToggle.ControlEvent += (s, a) =>
+        {
+            if (updating || this.propManager.PropCount == 0)
+                return;
 
-            GUILayout.BeginHorizontal();
-            dragPointToggle.Draw(noExpandWidth);
-            gizmoToggle.Draw(noExpandWidth);
-            copyPropButton.Draw(noExpandWidth);
-            deletePropButton.Draw(noExpandWidth);
-            GUILayout.EndHorizontal();
+            this.propManager.CurrentProp.DragPointEnabled = dragPointToggle.Value;
+        };
 
-            GUILayout.BeginHorizontal();
-            shadowCastingToggle.Draw(noExpandWidth);
-            GUILayout.EndHorizontal();
+        gizmoToggle = new(Translation.Get("propManagerPane", "gizmoToggle"));
+        gizmoToggle.ControlEvent += (s, a) =>
+        {
+            if (updating || this.propManager.PropCount == 0)
+                return;
 
-            GUI.enabled = true;
-        }
+            this.propManager.CurrentProp.GizmoEnabled = gizmoToggle.Value;
+        };
 
-        protected override void ReloadTranslation()
+        shadowCastingToggle = new(Translation.Get("propManagerPane", "shadowCastingToggle"));
+        shadowCastingToggle.ControlEvent += (s, a) =>
         {
-            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");
-            propManagerHeader = Translation.Get("propManagerPane", "header");
-        }
-
-        private void UpdatePropList()
-        {
-            updating = true;
-            propDropdown.SetDropdownItems(propManager.PropNameList, CurrentDoguIndex);
-            updating = false;
-        }
+            if (updating || this.propManager.PropCount == 0)
+                return;
 
-        private void UpdateToggles()
-        {
-            var prop = propManager.CurrentProp;
+            this.propManager.CurrentProp.ShadowCasting = shadowCastingToggle.Value;
+        };
 
-            if (prop == null)
-                return;
+        copyPropButton = new(Translation.Get("propManagerPane", "copyButton"));
+        copyPropButton.ControlEvent += (s, a) => this.propManager.CopyProp(CurrentDoguIndex);
 
-            updating = true;
-            dragPointToggle.Value = prop.DragPointEnabled;
-            gizmoToggle.Value = prop.GizmoEnabled;
-            shadowCastingToggle.Value = prop.ShadowCasting;
-            updating = false;
-        }
+        deletePropButton = new(Translation.Get("propManagerPane", "deleteButton"));
+        deletePropButton.ControlEvent += (s, a) => this.propManager.RemoveProp(CurrentDoguIndex);
+
+        propManagerHeader = Translation.Get("propManagerPane", "header");
+    }
+
+    public override void Draw()
+    {
+        const float buttonHeight = 30;
+
+        var arrowLayoutOptions = new[] {
+            GUILayout.Width(buttonHeight),
+            GUILayout.Height(buttonHeight),
+        };
+
+        const float dropdownButtonWidth = 140f;
+
+        var dropdownLayoutOptions = new[] {
+            GUILayout.Height(buttonHeight),
+            GUILayout.Width(dropdownButtonWidth),
+        };
+
+        MpsGui.Header(propManagerHeader);
+        MpsGui.WhiteLine();
+
+        GUI.enabled = propManager.PropCount > 0;
+
+        GUILayout.BeginHorizontal();
+        propDropdown.Draw(dropdownLayoutOptions);
+        previousPropButton.Draw(arrowLayoutOptions);
+        nextPropButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
+
+        var noExpandWidth = GUILayout.ExpandWidth(false);
+
+        GUILayout.BeginHorizontal();
+        dragPointToggle.Draw(noExpandWidth);
+        gizmoToggle.Draw(noExpandWidth);
+        copyPropButton.Draw(noExpandWidth);
+        deletePropButton.Draw(noExpandWidth);
+        GUILayout.EndHorizontal();
+
+        GUILayout.BeginHorizontal();
+        shadowCastingToggle.Draw(noExpandWidth);
+        GUILayout.EndHorizontal();
+
+        GUI.enabled = true;
+    }
+
+    protected override void ReloadTranslation()
+    {
+        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");
+        propManagerHeader = Translation.Get("propManagerPane", "header");
+    }
+
+    private void UpdatePropList()
+    {
+        updating = true;
+        propDropdown.SetDropdownItems(propManager.PropNameList, CurrentDoguIndex);
+        updating = false;
+    }
+
+    private void UpdateToggles()
+    {
+        var prop = propManager.CurrentProp;
+
+        if (prop == null)
+            return;
+
+        updating = true;
+        dragPointToggle.Value = prop.DragPointEnabled;
+        gizmoToggle.Value = prop.GizmoEnabled;
+        shadowCastingToggle.Value = prop.ShadowCasting;
+        updating = false;
     }
 }

+ 129 - 130
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindow2Panes/PropsPane.cs

@@ -2,172 +2,171 @@ using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class PropsPane : BasePane
 {
-    public class PropsPane : BasePane
-    {
-        private static bool handItemsReady;
+    private static bool handItemsReady;
 
-        private readonly PropManager propManager;
-        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 readonly PropManager propManager;
+    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 string currentCategory;
-        private bool itemSelectorEnabled = true;
+    private string currentCategory;
+    private bool itemSelectorEnabled = true;
 
-        private string SelectedCategory =>
-            Constants.DoguCategories[doguCategoryDropdown.SelectedItemIndex];
+    private string SelectedCategory =>
+        Constants.DoguCategories[doguCategoryDropdown.SelectedItemIndex];
 
-        public PropsPane(PropManager propManager)
-        {
-            this.propManager = propManager;
+    public PropsPane(PropManager propManager)
+    {
+        this.propManager = propManager;
 
-            handItemsReady = Constants.HandItemsInitialized;
+        handItemsReady = Constants.HandItemsInitialized;
 
-            if (!handItemsReady)
-                Constants.MenuFilesChange += InitializeHandItems;
+        if (!handItemsReady)
+            Constants.MenuFilesChange += InitializeHandItems;
 
-            doguCategoryDropdown = new(Translation.GetArray("doguCategories", Constants.DoguCategories));
-            doguCategoryDropdown.SelectionChange += (s, a) => ChangeDoguCategory(SelectedCategory);
+        doguCategoryDropdown = new(Translation.GetArray("doguCategories", Constants.DoguCategories));
+        doguCategoryDropdown.SelectionChange += (s, a) => ChangeDoguCategory(SelectedCategory);
 
-            doguDropdown = new(new[] { string.Empty });
+        doguDropdown = new(new[] { string.Empty });
 
-            addDoguButton = new("+");
-            addDoguButton.ControlEvent += (s, a) => SpawnObject();
+        addDoguButton = new("+");
+        addDoguButton.ControlEvent += (s, a) => SpawnObject();
 
-            nextDoguButton = new(">");
-            nextDoguButton.ControlEvent += (s, a) => doguDropdown.Step(1);
+        nextDoguButton = new(">");
+        nextDoguButton.ControlEvent += (s, a) => doguDropdown.Step(1);
 
-            prevDoguButton = new("<");
-            prevDoguButton.ControlEvent += (s, a) => doguDropdown.Step(-1);
+        prevDoguButton = new("<");
+        prevDoguButton.ControlEvent += (s, a) => doguDropdown.Step(-1);
 
-            nextDoguCategoryButton = new(">");
-            nextDoguCategoryButton.ControlEvent += (s, a) => doguCategoryDropdown.Step(1);
+        nextDoguCategoryButton = new(">");
+        nextDoguCategoryButton.ControlEvent += (s, a) => doguCategoryDropdown.Step(1);
 
-            prevDoguCategoryButton = new("<");
-            prevDoguCategoryButton.ControlEvent += (s, a) => doguCategoryDropdown.Step(-1);
+        prevDoguCategoryButton = new("<");
+        prevDoguCategoryButton.ControlEvent += (s, a) => doguCategoryDropdown.Step(-1);
 
-            ChangeDoguCategory(SelectedCategory);
-        }
+        ChangeDoguCategory(SelectedCategory);
+    }
 
-        public override void Draw()
-        {
-            const float buttonHeight = 30;
-
-            var arrowLayoutOptions = new[] {
-                GUILayout.Width(buttonHeight),
-                GUILayout.Height(buttonHeight),
-            };
-
-            const float dropdownButtonWidth = 120f;
-
-            var dropdownLayoutOptions = new[] {
-                GUILayout.Height(buttonHeight),
-                GUILayout.Width(dropdownButtonWidth),
-            };
-
-            GUILayout.BeginHorizontal();
-            prevDoguCategoryButton.Draw(arrowLayoutOptions);
-            doguCategoryDropdown.Draw(dropdownLayoutOptions);
-            nextDoguCategoryButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
-
-            GUI.enabled = itemSelectorEnabled;
-            GUILayout.BeginHorizontal();
-            doguDropdown.Draw(dropdownLayoutOptions);
-            prevDoguButton.Draw(arrowLayoutOptions);
-            nextDoguButton.Draw(arrowLayoutOptions);
-            addDoguButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
-            GUI.enabled = true;
-        }
+    public override void Draw()
+    {
+        const float buttonHeight = 30;
+
+        var arrowLayoutOptions = new[] {
+            GUILayout.Width(buttonHeight),
+            GUILayout.Height(buttonHeight),
+        };
+
+        const float dropdownButtonWidth = 120f;
+
+        var dropdownLayoutOptions = new[] {
+            GUILayout.Height(buttonHeight),
+            GUILayout.Width(dropdownButtonWidth),
+        };
+
+        GUILayout.BeginHorizontal();
+        prevDoguCategoryButton.Draw(arrowLayoutOptions);
+        doguCategoryDropdown.Draw(dropdownLayoutOptions);
+        nextDoguCategoryButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
+
+        GUI.enabled = itemSelectorEnabled;
+        GUILayout.BeginHorizontal();
+        doguDropdown.Draw(dropdownLayoutOptions);
+        prevDoguButton.Draw(arrowLayoutOptions);
+        nextDoguButton.Draw(arrowLayoutOptions);
+        addDoguButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            doguCategoryDropdown.SetDropdownItems(
-                Translation.GetArray("doguCategories", Constants.DoguCategories)
-            );
+    protected override void ReloadTranslation()
+    {
+        doguCategoryDropdown.SetDropdownItems(
+            Translation.GetArray("doguCategories", Constants.DoguCategories)
+        );
 
-            var category = SelectedCategory;
+        var category = SelectedCategory;
 
-            var translationArray =
-                category == Constants.customDoguCategories[Constants.DoguCategory.HandItem] && !handItemsReady
-                    ? new[] { Translation.Get("systemMessage", "initializing") }
-                    : GetTranslations(category);
+        var translationArray =
+            category == Constants.customDoguCategories[Constants.DoguCategory.HandItem] && !handItemsReady
+                ? new[] { Translation.Get("systemMessage", "initializing") }
+                : GetTranslations(category);
 
-            doguDropdown.SetDropdownItems(translationArray);
-        }
+        doguDropdown.SetDropdownItems(translationArray);
+    }
 
-        private void InitializeHandItems(object sender, MenuFilesEventArgs args)
+    private void InitializeHandItems(object sender, MenuFilesEventArgs args)
+    {
+        if (args.Type == MenuFilesEventArgs.EventType.HandItems)
         {
-            if (args.Type == MenuFilesEventArgs.EventType.HandItems)
-            {
-                handItemsReady = true;
-                var selectedCategory = SelectedCategory;
+            handItemsReady = true;
+            var selectedCategory = SelectedCategory;
 
-                if (selectedCategory == Constants.customDoguCategories[Constants.DoguCategory.HandItem])
-                    ChangeDoguCategory(selectedCategory, true);
-            }
+            if (selectedCategory == Constants.customDoguCategories[Constants.DoguCategory.HandItem])
+                ChangeDoguCategory(selectedCategory, true);
         }
+    }
 
-        private void ChangeDoguCategory(string category, bool force = false)
+    private void ChangeDoguCategory(string category, bool force = false)
+    {
+        if (category != currentCategory || force)
         {
-            if (category != currentCategory || force)
+            currentCategory = category;
+
+            string[] translationArray;
+
+            if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem] && !handItemsReady)
+            {
+                translationArray = new[] { Translation.Get("systemMessage", "initializing") };
+                itemSelectorEnabled = false;
+            }
+            else
             {
-                currentCategory = category;
-
-                string[] translationArray;
-
-                if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem] && !handItemsReady)
-                {
-                    translationArray = new[] { Translation.Get("systemMessage", "initializing") };
-                    itemSelectorEnabled = false;
-                }
-                else
-                {
-                    translationArray = GetTranslations(category);
-                    itemSelectorEnabled = true;
-                }
-
-                doguDropdown.SetDropdownItems(translationArray, 0);
+                translationArray = GetTranslations(category);
+                itemSelectorEnabled = true;
             }
+
+            doguDropdown.SetDropdownItems(translationArray, 0);
         }
+    }
 
-        private string[] GetTranslations(string category)
-        {
-            IEnumerable<string> itemList = Constants.DoguDict[category];
+    private string[] GetTranslations(string category)
+    {
+        IEnumerable<string> itemList = Constants.DoguDict[category];
 
-            if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem])
+        if (category == Constants.customDoguCategories[Constants.DoguCategory.HandItem])
+        {
+            // TODO: itemList should not be reused
+            itemList = itemList.Select(item =>
             {
-                // TODO: itemList should not be reused
-                itemList = itemList.Select(item =>
-                {
-                    var handItemAsOdogu = Utility.HandItemToOdogu(item);
+                var handItemAsOdogu = Utility.HandItemToOdogu(item);
 
-                    return Translation.Has("propNames", handItemAsOdogu) ? handItemAsOdogu : item;
-                });
-            }
+                return Translation.Has("propNames", handItemAsOdogu) ? handItemAsOdogu : item;
+            });
+        }
 
-            var translationCategory = category == Constants.customDoguCategories[Constants.DoguCategory.BGSmall]
-                ? "bgNames"
-                : "propNames";
+        var translationCategory = category == Constants.customDoguCategories[Constants.DoguCategory.BGSmall]
+            ? "bgNames"
+            : "propNames";
 
-            return Translation.GetArray(translationCategory, itemList);
-        }
+        return Translation.GetArray(translationCategory, itemList);
+    }
 
-        private void SpawnObject()
-        {
-            var assetName = Constants.DoguDict[SelectedCategory][doguDropdown.SelectedItemIndex];
+    private void SpawnObject()
+    {
+        var assetName = Constants.DoguDict[SelectedCategory][doguDropdown.SelectedItemIndex];
 
-            if (SelectedCategory == Constants.customDoguCategories[Constants.DoguCategory.BGSmall])
-                propManager.AddBgProp(assetName);
-            else
-                propManager.AddGameProp(assetName);
-        }
+        if (SelectedCategory == Constants.customDoguCategories[Constants.DoguCategory.BGSmall])
+            propManager.AddBgProp(assetName);
+        else
+            propManager.AddGameProp(assetName);
     }
 }

+ 63 - 64
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/BackgroundSelectorPane.cs

@@ -2,83 +2,82 @@ using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BackgroundSelectorPane : BasePane
 {
-    public class BackgroundSelectorPane : BasePane
-    {
-        private readonly EnvironmentManager environmentManager;
-        private readonly Dropdown bgDropdown;
-        private readonly Button prevBGButton;
-        private readonly Button nextBGButton;
+    private readonly EnvironmentManager environmentManager;
+    private readonly Dropdown bgDropdown;
+    private readonly Button prevBGButton;
+    private readonly Button nextBGButton;
 
-        public BackgroundSelectorPane(EnvironmentManager environmentManager)
-        {
-            this.environmentManager = environmentManager;
+    public BackgroundSelectorPane(EnvironmentManager environmentManager)
+    {
+        this.environmentManager = environmentManager;
 
-            var theaterIndex = Constants.BGList.FindIndex(bg => bg == EnvironmentManager.defaultBg);
+        var theaterIndex = Constants.BGList.FindIndex(bg => bg == EnvironmentManager.defaultBg);
 
-            var bgList = new List<string>(Translation.GetList("bgNames", Constants.BGList));
+        var bgList = new List<string>(Translation.GetList("bgNames", Constants.BGList));
 
-            if (Constants.MyRoomCustomBGIndex >= 0)
-                bgList.AddRange(Constants.MyRoomCustomBGList.Select(kvp => kvp.Value));
+        if (Constants.MyRoomCustomBGIndex >= 0)
+            bgList.AddRange(Constants.MyRoomCustomBGList.Select(kvp => kvp.Value));
 
-            bgDropdown = new(bgList.ToArray(), theaterIndex);
-            bgDropdown.SelectionChange += (s, a) => ChangeBackground();
+        bgDropdown = new(bgList.ToArray(), theaterIndex);
+        bgDropdown.SelectionChange += (s, a) => ChangeBackground();
 
-            prevBGButton = new("<");
-            prevBGButton.ControlEvent += (s, a) => bgDropdown.Step(-1);
+        prevBGButton = new("<");
+        prevBGButton.ControlEvent += (s, a) => bgDropdown.Step(-1);
 
-            nextBGButton = new(">");
-            nextBGButton.ControlEvent += (s, a) => bgDropdown.Step(1);
-        }
+        nextBGButton = new(">");
+        nextBGButton.ControlEvent += (s, a) => bgDropdown.Step(1);
+    }
 
-        public override void Draw()
-        {
-            const float buttonHeight = 30;
+    public override void Draw()
+    {
+        const float buttonHeight = 30;
 
-            var arrowLayoutOptions = new[] {
-                GUILayout.Width(buttonHeight),
+        var arrowLayoutOptions = new[] {
+            GUILayout.Width(buttonHeight),
                 GUILayout.Height(buttonHeight)
-            };
+        };
 
-            const float dropdownButtonWidth = 153f;
+        const float dropdownButtonWidth = 153f;
 
-            var dropdownLayoutOptions = new[] {
-                GUILayout.Height(buttonHeight),
+        var dropdownLayoutOptions = new[] {
+            GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth)
-            };
-
-            GUILayout.BeginHorizontal();
-            prevBGButton.Draw(arrowLayoutOptions);
-            bgDropdown.Draw(dropdownLayoutOptions);
-            nextBGButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
-        }
-
-        protected override void ReloadTranslation()
-        {
-            var bgList = new List<string>(Translation.GetList("bgNames", Constants.BGList));
-
-            if (Constants.MyRoomCustomBGIndex >= 0)
-                bgList.AddRange(Constants.MyRoomCustomBGList.Select(kvp => kvp.Value));
-
-            updating = true;
-            bgDropdown.SetDropdownItems(bgList.ToArray());
-            updating = false;
-        }
-
-        private void ChangeBackground()
-        {
-            if (updating)
-                return;
-
-            var selectedIndex = bgDropdown.SelectedItemIndex;
-            var isCreative = bgDropdown.SelectedItemIndex >= Constants.MyRoomCustomBGIndex;
-            var bg = isCreative
-                ? Constants.MyRoomCustomBGList[selectedIndex - Constants.MyRoomCustomBGIndex].Key
-                : Constants.BGList[selectedIndex];
-
-            environmentManager.ChangeBackground(bg, isCreative);
-        }
+        };
+
+        GUILayout.BeginHorizontal();
+        prevBGButton.Draw(arrowLayoutOptions);
+        bgDropdown.Draw(dropdownLayoutOptions);
+        nextBGButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
+    }
+
+    protected override void ReloadTranslation()
+    {
+        var bgList = new List<string>(Translation.GetList("bgNames", Constants.BGList));
+
+        if (Constants.MyRoomCustomBGIndex >= 0)
+            bgList.AddRange(Constants.MyRoomCustomBGList.Select(kvp => kvp.Value));
+
+        updating = true;
+        bgDropdown.SetDropdownItems(bgList.ToArray());
+        updating = false;
+    }
+
+    private void ChangeBackground()
+    {
+        if (updating)
+            return;
+
+        var selectedIndex = bgDropdown.SelectedItemIndex;
+        var isCreative = bgDropdown.SelectedItemIndex >= Constants.MyRoomCustomBGIndex;
+        var bg = isCreative
+            ? Constants.MyRoomCustomBGList[selectedIndex - Constants.MyRoomCustomBGIndex].Key
+            : Constants.BGList[selectedIndex];
+
+        environmentManager.ChangeBackground(bg, isCreative);
     }
 }

+ 72 - 73
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/CameraPane.cs

@@ -1,101 +1,100 @@
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class CameraPane : BasePane
 {
-    public class CameraPane : BasePane
+    private readonly CameraManager cameraManager;
+    private readonly SelectionGrid cameraGrid;
+    private readonly Slider zRotationSlider;
+    private readonly Slider fovSlider;
+
+    private string header;
+
+    public CameraPane(CameraManager cameraManager)
     {
-        private readonly CameraManager cameraManager;
-        private readonly SelectionGrid cameraGrid;
-        private readonly Slider zRotationSlider;
-        private readonly Slider fovSlider;
+        this.cameraManager = cameraManager;
+        this.cameraManager.CameraChange += (s, a) => UpdatePane();
 
-        private string header;
+        var camera = CameraUtility.MainCamera.camera;
+        var eulerAngles = camera.transform.eulerAngles;
 
-        public CameraPane(CameraManager cameraManager)
+        zRotationSlider = new(Translation.Get("cameraPane", "zRotation"), 0f, 360f, eulerAngles.z)
         {
-            this.cameraManager = cameraManager;
-            this.cameraManager.CameraChange += (s, a) => UpdatePane();
+            HasReset = true,
+            HasTextField = true
+        };
 
-            var camera = CameraUtility.MainCamera.camera;
-            var eulerAngles = camera.transform.eulerAngles;
-
-            zRotationSlider = new(Translation.Get("cameraPane", "zRotation"), 0f, 360f, eulerAngles.z)
-            {
-                HasReset = true,
-                HasTextField = true
-            };
+        zRotationSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-            zRotationSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+            var newRotation = camera.transform.eulerAngles;
 
-                var newRotation = camera.transform.eulerAngles;
+            newRotation.z = zRotationSlider.Value;
+            camera.transform.rotation = Quaternion.Euler(newRotation);
+        };
 
-                newRotation.z = zRotationSlider.Value;
-                camera.transform.rotation = Quaternion.Euler(newRotation);
-            };
+        var fieldOfView = camera.fieldOfView;
 
-            var fieldOfView = camera.fieldOfView;
+        fovSlider = new(Translation.Get("cameraPane", "fov"), 20f, 150f, fieldOfView, fieldOfView)
+        {
+            HasReset = true,
+            HasTextField = true
+        };
 
-            fovSlider = new(Translation.Get("cameraPane", "fov"), 20f, 150f, fieldOfView, fieldOfView)
-            {
-                HasReset = true,
-                HasTextField = true
-            };
+        fovSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-            fovSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+            camera.fieldOfView = fovSlider.Value;
+        };
 
-                camera.fieldOfView = fovSlider.Value;
-            };
+        cameraGrid = new(
+            Enumerable.Range(1, cameraManager.CameraCount).Select(x => x.ToString()).ToArray()
+        );
 
-            cameraGrid = new(
-                Enumerable.Range(1, cameraManager.CameraCount).Select(x => x.ToString()).ToArray()
-            );
+        cameraGrid.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-            cameraGrid.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+            cameraManager.CurrentCameraIndex = cameraGrid.SelectedItemIndex;
+        };
 
-                cameraManager.CurrentCameraIndex = cameraGrid.SelectedItemIndex;
-            };
+        header = Translation.Get("cameraPane", "header");
+    }
 
-            header = Translation.Get("cameraPane", "header");
-        }
+    public override void Draw()
+    {
+        MpsGui.Header(header);
+        MpsGui.WhiteLine();
+        cameraGrid.Draw();
+        zRotationSlider.Draw();
+        fovSlider.Draw();
+    }
 
-        public override void Draw()
-        {
-            MpsGui.Header(header);
-            MpsGui.WhiteLine();
-            cameraGrid.Draw();
-            zRotationSlider.Draw();
-            fovSlider.Draw();
-        }
-
-        public override void UpdatePane()
-        {
-            updating = true;
+    public override void UpdatePane()
+    {
+        updating = true;
 
-            var camera = CameraUtility.MainCamera.camera;
+        var camera = CameraUtility.MainCamera.camera;
 
-            zRotationSlider.Value = camera.transform.eulerAngles.z;
-            fovSlider.Value = camera.fieldOfView;
+        zRotationSlider.Value = camera.transform.eulerAngles.z;
+        fovSlider.Value = camera.fieldOfView;
 
-            cameraGrid.SelectedItemIndex = cameraManager.CurrentCameraIndex;
+        cameraGrid.SelectedItemIndex = cameraManager.CurrentCameraIndex;
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            zRotationSlider.Label = Translation.Get("cameraPane", "zRotation");
-            fovSlider.Label = Translation.Get("cameraPane", "fov");
-            header = Translation.Get("cameraPane", "header");
-        }
+    protected override void ReloadTranslation()
+    {
+        zRotationSlider.Label = Translation.Get("cameraPane", "zRotation");
+        fovSlider.Label = Translation.Get("cameraPane", "fov");
+        header = Translation.Get("cameraPane", "header");
     }
 }

+ 59 - 60
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/DragPointPane.cs

@@ -1,78 +1,77 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointPane : BasePane
 {
-    public class DragPointPane : BasePane
-    {
-        private enum Setting { Prop, Maid, Background, Size }
+    private enum Setting { Prop, Maid, Background, Size }
 
-        private readonly Toggle propsCubeToggle;
-        private readonly Toggle smallCubeToggle;
-        private readonly Toggle maidCubeToggle;
-        private readonly Toggle bgCubeToggle;
+    private readonly Toggle propsCubeToggle;
+    private readonly Toggle smallCubeToggle;
+    private readonly Toggle maidCubeToggle;
+    private readonly Toggle bgCubeToggle;
 
-        private string header;
+    private string header;
 
-        public DragPointPane()
-        {
-            header = Translation.Get("movementCube", "header");
+    public DragPointPane()
+    {
+        header = Translation.Get("movementCube", "header");
 
-            propsCubeToggle = new(Translation.Get("movementCube", "props"), PropManager.CubeActive);
-            propsCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Prop, propsCubeToggle.Value);
+        propsCubeToggle = new(Translation.Get("movementCube", "props"), PropManager.CubeActive);
+        propsCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Prop, propsCubeToggle.Value);
 
-            smallCubeToggle = new(Translation.Get("movementCube", "small"));
-            smallCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Size, smallCubeToggle.Value);
+        smallCubeToggle = new(Translation.Get("movementCube", "small"));
+        smallCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Size, smallCubeToggle.Value);
 
-            maidCubeToggle = new(Translation.Get("movementCube", "maid"), MeidoDragPointManager.CubeActive);
-            maidCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Maid, maidCubeToggle.Value);
+        maidCubeToggle = new(Translation.Get("movementCube", "maid"), MeidoDragPointManager.CubeActive);
+        maidCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Maid, maidCubeToggle.Value);
 
-            bgCubeToggle = new(Translation.Get("movementCube", "bg"), EnvironmentManager.CubeActive);
-            bgCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Background, bgCubeToggle.Value);
-        }
+        bgCubeToggle = new(Translation.Get("movementCube", "bg"), EnvironmentManager.CubeActive);
+        bgCubeToggle.ControlEvent += (s, a) => ChangeDragPointSetting(Setting.Background, bgCubeToggle.Value);
+    }
 
-        public override void Draw()
-        {
-            MpsGui.Header(header);
-            MpsGui.WhiteLine();
+    public override void Draw()
+    {
+        MpsGui.Header(header);
+        MpsGui.WhiteLine();
 
-            GUILayout.BeginHorizontal();
-            propsCubeToggle.Draw();
-            smallCubeToggle.Draw();
-            maidCubeToggle.Draw();
-            bgCubeToggle.Draw();
-            GUILayout.EndHorizontal();
-        }
+        GUILayout.BeginHorizontal();
+        propsCubeToggle.Draw();
+        smallCubeToggle.Draw();
+        maidCubeToggle.Draw();
+        bgCubeToggle.Draw();
+        GUILayout.EndHorizontal();
+    }
 
-        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");
-        }
+    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");
+    }
 
-        private void ChangeDragPointSetting(Setting setting, bool value)
+    private void ChangeDragPointSetting(Setting setting, bool value)
+    {
+        switch (setting)
         {
-            switch (setting)
-            {
-                case Setting.Prop:
-                    PropManager.CubeActive = value;
-                    break;
-                case Setting.Background:
-                    EnvironmentManager.CubeActive = value;
-                    break;
-                case Setting.Maid:
-                    MeidoDragPointManager.CubeActive = value;
-                    break;
-                case Setting.Size:
-                    MeidoDragPointManager.CubeSmall = value;
-                    EnvironmentManager.CubeSmall = value;
-                    PropManager.CubeSmall = value;
-                    break;
-                default:
-                    break;
-            }
+            case Setting.Prop:
+                PropManager.CubeActive = value;
+                break;
+            case Setting.Background:
+                EnvironmentManager.CubeActive = value;
+                break;
+            case Setting.Maid:
+                MeidoDragPointManager.CubeActive = value;
+                break;
+            case Setting.Size:
+                MeidoDragPointManager.CubeSmall = value;
+                EnvironmentManager.CubeSmall = value;
+                PropManager.CubeSmall = value;
+                break;
+            default:
+                break;
         }
     }
 }

+ 113 - 114
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/BloomPane.cs

@@ -1,126 +1,125 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BloomPane : EffectPane<BloomEffectManager>
 {
-    public class BloomPane : EffectPane<BloomEffectManager>
+    private readonly Slider intensitySlider;
+    private readonly Slider blurSlider;
+    private readonly Slider redSlider;
+    private readonly Slider greenSlider;
+    private readonly Slider blueSlider;
+    private readonly Toggle hdrToggle;
+
+    protected override BloomEffectManager EffectManager { get; set; }
+
+    public BloomPane(EffectManager effectManager) : base(effectManager)
     {
-        private readonly Slider intensitySlider;
-        private readonly Slider blurSlider;
-        private readonly Slider redSlider;
-        private readonly Slider greenSlider;
-        private readonly Slider blueSlider;
-        private readonly Toggle hdrToggle;
+        intensitySlider = new(
+            Translation.Get("effectBloom", "intensity"), 0f, 100f, EffectManager.BloomValue
+        );
 
-        protected override BloomEffectManager EffectManager { get; set; }
+        intensitySlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-        public BloomPane(EffectManager effectManager) : base(effectManager)
+            EffectManager.BloomValue = intensitySlider.Value;
+        };
+
+        blurSlider = new(Translation.Get("effectBloom", "blur"), 0f, 15f, EffectManager.BlurIterations);
+        blurSlider.ControlEvent += (s, a) =>
         {
-            intensitySlider = new(
-                Translation.Get("effectBloom", "intensity"), 0f, 100f, EffectManager.BloomValue
-            );
-
-            intensitySlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BloomValue = intensitySlider.Value;
-            };
-
-            blurSlider = new(Translation.Get("effectBloom", "blur"), 0f, 15f, EffectManager.BlurIterations);
-            blurSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BlurIterations = (int)blurSlider.Value;
-            };
-
-            redSlider = new(
-                Translation.Get("backgroundWindow", "red"), 1f, 0.5f, EffectManager.BloomThresholdColorRed
-            );
-
-            redSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BloomThresholdColorRed = redSlider.Value;
-            };
-
-            greenSlider = new(
-                Translation.Get("backgroundWindow", "green"), 1f, 0.5f, EffectManager.BloomThresholdColorGreen
-            );
-
-            greenSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BloomThresholdColorGreen = greenSlider.Value;
-            };
-
-            blueSlider = new(
-                Translation.Get("backgroundWindow", "blue"), 1f, 0.5f, EffectManager.BloomThresholdColorBlue
-            );
-
-            blueSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BloomThresholdColorBlue = blueSlider.Value;
-            };
-
-            hdrToggle = new(Translation.Get("effectBloom", "hdrToggle"), EffectManager.BloomHDR);
-            hdrToggle.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BloomHDR = hdrToggle.Value;
-            };
-        }
-
-        protected override void TranslatePane()
+            if (updating)
+                return;
+
+            EffectManager.BlurIterations = (int)blurSlider.Value;
+        };
+
+        redSlider = new(
+            Translation.Get("backgroundWindow", "red"), 1f, 0.5f, EffectManager.BloomThresholdColorRed
+        );
+
+        redSlider.ControlEvent += (s, a) =>
         {
-            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()
+            if (updating)
+                return;
+
+            EffectManager.BloomThresholdColorRed = redSlider.Value;
+        };
+
+        greenSlider = new(
+            Translation.Get("backgroundWindow", "green"), 1f, 0.5f, EffectManager.BloomThresholdColorGreen
+        );
+
+        greenSlider.ControlEvent += (s, a) =>
         {
-            intensitySlider.Value = EffectManager.BloomValue;
-            blurSlider.Value = EffectManager.BlurIterations;
-            redSlider.Value = EffectManager.BloomThresholdColorRed;
-            greenSlider.Value = EffectManager.BloomThresholdColorGreen;
-            blueSlider.Value = EffectManager.BloomThresholdColorBlue;
-            hdrToggle.Value = EffectManager.BloomHDR;
-        }
-
-        protected override void DrawPane()
+            if (updating)
+                return;
+
+            EffectManager.BloomThresholdColorGreen = greenSlider.Value;
+        };
+
+        blueSlider = new(
+            Translation.Get("backgroundWindow", "blue"), 1f, 0.5f, EffectManager.BloomThresholdColorBlue
+        );
+
+        blueSlider.ControlEvent += (s, a) =>
         {
-            var sliderWidth = MpsGui.HalfSlider;
-
-            GUILayout.BeginHorizontal();
-            intensitySlider.Draw(sliderWidth);
-            blurSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
-
-            GUILayout.BeginHorizontal();
-            redSlider.Draw(sliderWidth);
-            greenSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
-
-            GUILayout.BeginHorizontal();
-            blueSlider.Draw(sliderWidth);
-            GUILayout.FlexibleSpace();
-            hdrToggle.Draw(GUILayout.ExpandWidth(false));
-            GUILayout.EndHorizontal();
-        }
+            if (updating)
+                return;
+
+            EffectManager.BloomThresholdColorBlue = blueSlider.Value;
+        };
+
+        hdrToggle = new(Translation.Get("effectBloom", "hdrToggle"), EffectManager.BloomHDR);
+        hdrToggle.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
+
+            EffectManager.BloomHDR = hdrToggle.Value;
+        };
+    }
+
+    protected override void TranslatePane()
+    {
+        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()
+    {
+        intensitySlider.Value = EffectManager.BloomValue;
+        blurSlider.Value = EffectManager.BlurIterations;
+        redSlider.Value = EffectManager.BloomThresholdColorRed;
+        greenSlider.Value = EffectManager.BloomThresholdColorGreen;
+        blueSlider.Value = EffectManager.BloomThresholdColorBlue;
+        hdrToggle.Value = EffectManager.BloomHDR;
+    }
+
+    protected override void DrawPane()
+    {
+        var sliderWidth = MpsGui.HalfSlider;
+
+        GUILayout.BeginHorizontal();
+        intensitySlider.Draw(sliderWidth);
+        blurSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
+
+        GUILayout.BeginHorizontal();
+        redSlider.Draw(sliderWidth);
+        greenSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
+
+        GUILayout.BeginHorizontal();
+        blueSlider.Draw(sliderWidth);
+        GUILayout.FlexibleSpace();
+        hdrToggle.Draw(GUILayout.ExpandWidth(false));
+        GUILayout.EndHorizontal();
     }
 }

+ 90 - 91
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/DepthOfFieldPane.cs

@@ -1,103 +1,102 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DepthOfFieldPane : EffectPane<DepthOfFieldEffectManager>
 {
-    public class DepthOfFieldPane : EffectPane<DepthOfFieldEffectManager>
+    private readonly Slider focalLengthSlider;
+    private readonly Slider focalSizeSlider;
+    private readonly Slider apertureSlider;
+    private readonly Slider blurSlider;
+    private readonly Toggle thicknessToggle;
+
+    protected override DepthOfFieldEffectManager EffectManager { get; set; }
+
+    public DepthOfFieldPane(EffectManager effectManager) : base(effectManager)
     {
-        private readonly Slider focalLengthSlider;
-        private readonly Slider focalSizeSlider;
-        private readonly Slider apertureSlider;
-        private readonly Slider blurSlider;
-        private readonly Toggle thicknessToggle;
+        focalLengthSlider = new(
+            Translation.Get("effectDof", "focalLength"), 0f, 10f, EffectManager.FocalLength
+        );
 
-        protected override DepthOfFieldEffectManager EffectManager { get; set; }
+        focalLengthSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
+
+            EffectManager.FocalLength = focalLengthSlider.Value;
+        };
 
-        public DepthOfFieldPane(EffectManager effectManager) : base(effectManager)
+        focalSizeSlider = new(Translation.Get("effectDof", "focalArea"), 0f, 2f, EffectManager.FocalSize);
+        focalSizeSlider.ControlEvent += (s, a) =>
         {
-            focalLengthSlider = new(
-                Translation.Get("effectDof", "focalLength"), 0f, 10f, EffectManager.FocalLength
-            );
-
-            focalLengthSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.FocalLength = focalLengthSlider.Value;
-            };
-
-            focalSizeSlider = new(Translation.Get("effectDof", "focalArea"), 0f, 2f, EffectManager.FocalSize);
-            focalSizeSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.FocalSize = focalSizeSlider.Value;
-            };
-
-            apertureSlider = new(Translation.Get("effectDof", "aperture"), 0f, 60f, EffectManager.Aperture);
-            apertureSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.Aperture = apertureSlider.Value;
-            };
-
-            blurSlider = new(Translation.Get("effectDof", "blur"), 0f, 10f, EffectManager.MaxBlurSize);
-            blurSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.MaxBlurSize = blurSlider.Value;
-            };
-
-            thicknessToggle = new(Translation.Get("effectDof", "thicknessToggle"), EffectManager.VisualizeFocus);
-            thicknessToggle.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.VisualizeFocus = thicknessToggle.Value;
-            };
-        }
-
-        protected override void TranslatePane()
+            if (updating)
+                return;
+
+            EffectManager.FocalSize = focalSizeSlider.Value;
+        };
+
+        apertureSlider = new(Translation.Get("effectDof", "aperture"), 0f, 60f, EffectManager.Aperture);
+        apertureSlider.ControlEvent += (s, a) =>
         {
-            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()
+            if (updating)
+                return;
+
+            EffectManager.Aperture = apertureSlider.Value;
+        };
+
+        blurSlider = new(Translation.Get("effectDof", "blur"), 0f, 10f, EffectManager.MaxBlurSize);
+        blurSlider.ControlEvent += (s, a) =>
         {
-            focalLengthSlider.Value = EffectManager.FocalLength;
-            focalSizeSlider.Value = EffectManager.FocalSize;
-            apertureSlider.Value = EffectManager.Aperture;
-            blurSlider.Value = EffectManager.MaxBlurSize;
-            thicknessToggle.Value = EffectManager.VisualizeFocus;
-        }
-
-        protected override void DrawPane()
+            if (updating)
+                return;
+
+            EffectManager.MaxBlurSize = blurSlider.Value;
+        };
+
+        thicknessToggle = new(Translation.Get("effectDof", "thicknessToggle"), EffectManager.VisualizeFocus);
+        thicknessToggle.ControlEvent += (s, a) =>
         {
-            focalLengthSlider.Draw();
-
-            var sliderWidth = MpsGui.HalfSlider;
-
-            GUILayout.BeginHorizontal();
-            focalSizeSlider.Draw(sliderWidth);
-            apertureSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
-
-            GUILayout.BeginHorizontal();
-            blurSlider.Draw(sliderWidth);
-            GUILayout.FlexibleSpace();
-            thicknessToggle.Draw();
-            GUILayout.EndHorizontal();
-            GUI.enabled = true;
-        }
+            if (updating)
+                return;
+
+            EffectManager.VisualizeFocus = thicknessToggle.Value;
+        };
+    }
+
+    protected override void TranslatePane()
+    {
+        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()
+    {
+        focalLengthSlider.Value = EffectManager.FocalLength;
+        focalSizeSlider.Value = EffectManager.FocalSize;
+        apertureSlider.Value = EffectManager.Aperture;
+        blurSlider.Value = EffectManager.MaxBlurSize;
+        thicknessToggle.Value = EffectManager.VisualizeFocus;
+    }
+
+    protected override void DrawPane()
+    {
+        focalLengthSlider.Draw();
+
+        var sliderWidth = MpsGui.HalfSlider;
+
+        GUILayout.BeginHorizontal();
+        focalSizeSlider.Draw(sliderWidth);
+        apertureSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
+
+        GUILayout.BeginHorizontal();
+        blurSlider.Draw(sliderWidth);
+        GUILayout.FlexibleSpace();
+        thicknessToggle.Draw();
+        GUILayout.EndHorizontal();
+        GUI.enabled = true;
     }
 }

+ 60 - 61
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectPane.cs

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

+ 36 - 37
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectsPane.cs

@@ -1,51 +1,50 @@
 using System.Collections.Generic;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class EffectsPane : BasePane
 {
-    public class EffectsPane : BasePane
-    {
-        private readonly Dictionary<string, BasePane> effectPanes = new();
-        private readonly List<string> effectList = new();
-        private readonly SelectionGrid effectToggles;
+    private readonly Dictionary<string, BasePane> effectPanes = new();
+    private readonly List<string> effectList = new();
+    private readonly SelectionGrid effectToggles;
 
-        private BasePane currentEffectPane;
+    private BasePane currentEffectPane;
 
-        public BasePane this[string effectUI]
+    public BasePane this[string effectUI]
+    {
+        private get => effectPanes[effectUI];
+        set
         {
-            private get => effectPanes[effectUI];
-            set
-            {
-                effectPanes[effectUI] = value;
-                effectList.Add(effectUI);
-                effectToggles.SetItems(Translation.GetArray("effectsPane", effectList), 0);
-            }
+            effectPanes[effectUI] = value;
+            effectList.Add(effectUI);
+            effectToggles.SetItems(Translation.GetArray("effectsPane", effectList), 0);
         }
+    }
 
-        public EffectsPane()
-        {
-            effectToggles = new(new[] { "dummy" /* thicc */ });
-            effectToggles.ControlEvent += (s, a) => SetEffectPane(effectList[effectToggles.SelectedItemIndex]);
-        }
+    public EffectsPane()
+    {
+        effectToggles = new(new[] { "dummy" /* thicc */ });
+        effectToggles.ControlEvent += (s, a) => SetEffectPane(effectList[effectToggles.SelectedItemIndex]);
+    }
 
-        public override void UpdatePane() =>
-            currentEffectPane.UpdatePane();
+    public override void UpdatePane() =>
+        currentEffectPane.UpdatePane();
 
-        public override void Draw()
-        {
-            MpsGui.Header("Effects");
-            MpsGui.WhiteLine();
-            effectToggles.Draw();
-            MpsGui.BlackLine();
-            currentEffectPane.Draw();
-        }
+    public override void Draw()
+    {
+        MpsGui.Header("Effects");
+        MpsGui.WhiteLine();
+        effectToggles.Draw();
+        MpsGui.BlackLine();
+        currentEffectPane.Draw();
+    }
 
-        protected override void ReloadTranslation() =>
-            effectToggles.SetItems(Translation.GetArray("effectsPane", effectList));
+    protected override void ReloadTranslation() =>
+        effectToggles.SetItems(Translation.GetArray("effectsPane", effectList));
 
-        private void SetEffectPane(string effectUI)
-        {
-            currentEffectPane = effectPanes[effectUI];
-            currentEffectPane.UpdatePane();
-        }
+    private void SetEffectPane(string effectUI)
+    {
+        currentEffectPane = effectPanes[effectUI];
+        currentEffectPane.UpdatePane();
     }
 }

+ 106 - 107
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/FogPane.cs

@@ -1,141 +1,140 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class FogPane : EffectPane<FogEffectManager>
 {
-    public class FogPane : EffectPane<FogEffectManager>
-    {
-        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;
+    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;
 
-        protected override FogEffectManager EffectManager { get; set; }
+    protected override FogEffectManager EffectManager { get; set; }
 
-        public FogPane(EffectManager effectManager) : base(effectManager)
-        {
-            distanceSlider = new(
+    public FogPane(EffectManager effectManager) : base(effectManager)
+    {
+        distanceSlider = new(
                 Translation.Get("effectFog", "distance"), 0f, 30f, EffectManager.Distance
-            );
+                );
 
-            distanceSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+        distanceSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-                EffectManager.Distance = distanceSlider.Value;
-            };
+            EffectManager.Distance = distanceSlider.Value;
+        };
 
-            densitySlider = new(
+        densitySlider = new(
                 Translation.Get("effectFog", "density"), 0f, 10f, EffectManager.Density
-            );
+                );
 
-            densitySlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+        densitySlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-                EffectManager.Density = densitySlider.Value;
-            };
+            EffectManager.Density = densitySlider.Value;
+        };
 
-            heightScaleSlider = new(
+        heightScaleSlider = new(
                 Translation.Get("effectFog", "strength"), -5f, 20f, EffectManager.HeightScale
-            );
+                );
 
-            heightScaleSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+        heightScaleSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-                EffectManager.HeightScale = heightScaleSlider.Value;
-            };
+            EffectManager.HeightScale = heightScaleSlider.Value;
+        };
 
-            heightSlider = new(
+        heightSlider = new(
                 Translation.Get("effectFog", "height"), -10f, 10f, EffectManager.Height
-            );
+                );
+
+        heightSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-            heightSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+            EffectManager.Height = heightSlider.Value;
+        };
 
-                EffectManager.Height = heightSlider.Value;
-            };
+        var initialFogColour = EffectManager.FogColour;
+
+        redSlider = new(Translation.Get("backgroundWIndow", "red"), 0f, 1f, initialFogColour.r);
+        redSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-            var initialFogColour = EffectManager.FogColour;
+            EffectManager.FogColourRed = redSlider.Value;
+        };
 
-            redSlider = new(Translation.Get("backgroundWIndow", "red"), 0f, 1f, initialFogColour.r);
-            redSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+        greenSlider = new(Translation.Get("backgroundWIndow", "green"), 0f, 1f, initialFogColour.g);
+        greenSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-                EffectManager.FogColourRed = redSlider.Value;
-            };
+            EffectManager.FogColourGreen = greenSlider.Value;
+        };
 
-            greenSlider = new(Translation.Get("backgroundWIndow", "green"), 0f, 1f, initialFogColour.g);
-            greenSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+        blueSlider = new(Translation.Get("backgroundWIndow", "blue"), 0f, 1f, initialFogColour.b);
+        blueSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-                EffectManager.FogColourGreen = greenSlider.Value;
-            };
+            EffectManager.FogColourBlue = blueSlider.Value;
+        };
+    }
 
-            blueSlider = new(Translation.Get("backgroundWIndow", "blue"), 0f, 1f, initialFogColour.b);
-            blueSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+    protected override void TranslatePane()
+    {
+        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");
+    }
 
-                EffectManager.FogColourBlue = blueSlider.Value;
-            };
-        }
+    protected override void UpdateControls()
+    {
+        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 TranslatePane()
-        {
-            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()
-        {
-            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()
-        {
-            var sliderWidth = MpsGui.HalfSlider;
+    protected override void DrawPane()
+    {
+        var sliderWidth = MpsGui.HalfSlider;
 
-            GUILayout.BeginHorizontal();
-            distanceSlider.Draw(sliderWidth);
-            densitySlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        distanceSlider.Draw(sliderWidth);
+        densitySlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
-            heightScaleSlider.Draw(sliderWidth);
-            heightSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        heightScaleSlider.Draw(sliderWidth);
+        heightSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
-            redSlider.Draw(sliderWidth);
-            greenSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        redSlider.Draw(sliderWidth);
+        greenSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
 
-            blueSlider.Draw(sliderWidth);
-        }
+        blueSlider.Draw(sliderWidth);
     }
 }

+ 53 - 54
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/OtherEffectsPane.cs

@@ -1,72 +1,71 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class OtherEffectsPane : BasePane
 {
-    public class OtherEffectsPane : BasePane
-    {
-        private readonly EffectManager effectManager;
-        private readonly SepiaToneEffectManger sepiaToneEffectManger;
-        private readonly BlurEffectManager blurEffectManager;
-        private readonly Toggle sepiaToggle;
-        private readonly Slider blurSlider;
+    private readonly EffectManager effectManager;
+    private readonly SepiaToneEffectManger sepiaToneEffectManger;
+    private readonly BlurEffectManager blurEffectManager;
+    private readonly Toggle sepiaToggle;
+    private readonly Slider blurSlider;
 
-        public OtherEffectsPane(EffectManager effectManager)
-        {
-            this.effectManager = effectManager;
+    public OtherEffectsPane(EffectManager effectManager)
+    {
+        this.effectManager = effectManager;
 
-            sepiaToneEffectManger = this.effectManager.Get<SepiaToneEffectManger>();
-            blurEffectManager = this.effectManager.Get<BlurEffectManager>();
+        sepiaToneEffectManger = this.effectManager.Get<SepiaToneEffectManger>();
+        blurEffectManager = this.effectManager.Get<BlurEffectManager>();
 
-            sepiaToggle = new(Translation.Get("otherEffectsPane", "sepiaToggle"));
-            sepiaToggle.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-                sepiaToneEffectManger.SetEffectActive(sepiaToggle.Value);
-            };
+        sepiaToggle = new(Translation.Get("otherEffectsPane", "sepiaToggle"));
+        sepiaToggle.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
+            sepiaToneEffectManger.SetEffectActive(sepiaToggle.Value);
+        };
 
-            blurSlider = new(Translation.Get("otherEffectsPane", "blurSlider"), 0f, 18f);
-            blurSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
+        blurSlider = new(Translation.Get("otherEffectsPane", "blurSlider"), 0f, 18f);
+        blurSlider.ControlEvent += (s, a) =>
+        {
+            if (updating)
+                return;
 
-                var value = blurSlider.Value;
+            var value = blurSlider.Value;
 
-                if (!blurEffectManager.Active && value > 0f)
-                    blurEffectManager.SetEffectActive(true);
-                else if (blurEffectManager.Active && Mathf.Approximately(value, 0f))
-                    blurEffectManager.SetEffectActive(false);
+            if (!blurEffectManager.Active && value > 0f)
+                blurEffectManager.SetEffectActive(true);
+            else if (blurEffectManager.Active && Mathf.Approximately(value, 0f))
+                blurEffectManager.SetEffectActive(false);
 
-                blurEffectManager.BlurSize = value;
-            };
-        }
+            blurEffectManager.BlurSize = value;
+        };
+    }
 
-        protected override void ReloadTranslation()
-        {
-            sepiaToggle.Label = Translation.Get("otherEffectsPane", "sepiaToggle");
-            blurSlider.Label = Translation.Get("otherEffectsPane", "blurSlider");
-        }
+    protected override void ReloadTranslation()
+    {
+        sepiaToggle.Label = Translation.Get("otherEffectsPane", "sepiaToggle");
+        blurSlider.Label = Translation.Get("otherEffectsPane", "blurSlider");
+    }
 
-        public override void Draw()
-        {
-            GUILayout.BeginHorizontal();
-            sepiaToggle.Draw();
-            blurSlider.Draw();
-            GUILayout.EndHorizontal();
-        }
+    public override void Draw()
+    {
+        GUILayout.BeginHorizontal();
+        sepiaToggle.Draw();
+        blurSlider.Draw();
+        GUILayout.EndHorizontal();
+    }
 
-        public override void UpdatePane()
-        {
-            updating = true;
+    public override void UpdatePane()
+    {
+        updating = true;
 
-            if (sepiaToneEffectManger.Ready)
-                sepiaToggle.Value = sepiaToneEffectManger.Active;
+        if (sepiaToneEffectManger.Ready)
+            sepiaToggle.Value = sepiaToneEffectManger.Active;
 
-            if (blurEffectManager.Ready)
-                blurSlider.Value = blurEffectManager.BlurSize;
+        if (blurEffectManager.Ready)
+            blurSlider.Value = blurEffectManager.BlurSize;
 
-            updating = false;
-        }
+        updating = false;
     }
 }

+ 70 - 71
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/EffectsPanes/VignettePane.cs

@@ -1,84 +1,83 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class VignettePane : EffectPane<VignetteEffectManager>
 {
-    public class VignettePane : EffectPane<VignetteEffectManager>
-    {
-        private readonly Slider intensitySlider;
-        private readonly Slider blurSlider;
-        private readonly Slider blurSpreadSlider;
-        private readonly Slider aberrationSlider;
+    private readonly Slider intensitySlider;
+    private readonly Slider blurSlider;
+    private readonly Slider blurSpreadSlider;
+    private readonly Slider aberrationSlider;
 
-        protected override VignetteEffectManager EffectManager { get; set; }
+    protected override VignetteEffectManager EffectManager { get; set; }
 
-        public VignettePane(EffectManager effectManager) : base(effectManager)
+    public VignettePane(EffectManager effectManager) : base(effectManager)
+    {
+        intensitySlider = new(Translation.Get("effectVignette", "intensity"), -40f, 70f);
+        intensitySlider.ControlEvent += (s, a) =>
         {
-            intensitySlider = new(Translation.Get("effectVignette", "intensity"), -40f, 70f);
-            intensitySlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.Intensity = intensitySlider.Value;
-            };
-
-            blurSlider = new(Translation.Get("effectVignette", "blur"), 0f, 5f);
-            blurSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.Blur = blurSlider.Value;
-            };
-
-            blurSpreadSlider = new(Translation.Get("effectVignette", "blurSpread"), 0f, 40f);
-            blurSpreadSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.BlurSpread = blurSpreadSlider.Value;
-            };
-
-            aberrationSlider = new(Translation.Get("effectVignette", "aberration"), -30f, 30f);
-            aberrationSlider.ControlEvent += (s, a) =>
-            {
-                if (updating)
-                    return;
-
-                EffectManager.ChromaticAberration = aberrationSlider.Value;
-            };
-        }
-
-        protected override void TranslatePane()
+            if (updating)
+                return;
+
+            EffectManager.Intensity = intensitySlider.Value;
+        };
+
+        blurSlider = new(Translation.Get("effectVignette", "blur"), 0f, 5f);
+        blurSlider.ControlEvent += (s, a) =>
         {
-            intensitySlider.Label = Translation.Get("effectVignette", "intensity");
-            blurSlider.Label = Translation.Get("effectVignette", "blur");
-            blurSpreadSlider.Label = Translation.Get("effectVignette", "blurSpread");
-            aberrationSlider.Label = Translation.Get("effectVignette", "aberration");
-        }
+            if (updating)
+                return;
 
-        protected override void UpdateControls()
+            EffectManager.Blur = blurSlider.Value;
+        };
+
+        blurSpreadSlider = new(Translation.Get("effectVignette", "blurSpread"), 0f, 40f);
+        blurSpreadSlider.ControlEvent += (s, a) =>
         {
-            intensitySlider.Value = EffectManager.Intensity;
-            blurSlider.Value = EffectManager.Blur;
-            blurSpreadSlider.Value = EffectManager.BlurSpread;
-            aberrationSlider.Value = EffectManager.ChromaticAberration;
-        }
+            if (updating)
+                return;
+
+            EffectManager.BlurSpread = blurSpreadSlider.Value;
+        };
 
-        protected override void DrawPane()
+        aberrationSlider = new(Translation.Get("effectVignette", "aberration"), -30f, 30f);
+        aberrationSlider.ControlEvent += (s, a) =>
         {
-            var sliderWidth = MpsGui.HalfSlider;
-
-            GUILayout.BeginHorizontal();
-            intensitySlider.Draw(sliderWidth);
-            blurSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
-
-            GUILayout.BeginHorizontal();
-            blurSpreadSlider.Draw(sliderWidth);
-            aberrationSlider.Draw(sliderWidth);
-            GUILayout.EndHorizontal();
-        }
+            if (updating)
+                return;
+
+            EffectManager.ChromaticAberration = aberrationSlider.Value;
+        };
+    }
+
+    protected override void TranslatePane()
+    {
+        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()
+    {
+        intensitySlider.Value = EffectManager.Intensity;
+        blurSlider.Value = EffectManager.Blur;
+        blurSpreadSlider.Value = EffectManager.BlurSpread;
+        aberrationSlider.Value = EffectManager.ChromaticAberration;
+    }
+
+    protected override void DrawPane()
+    {
+        var sliderWidth = MpsGui.HalfSlider;
+
+        GUILayout.BeginHorizontal();
+        intensitySlider.Draw(sliderWidth);
+        blurSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
+
+        GUILayout.BeginHorizontal();
+        blurSpreadSlider.Draw(sliderWidth);
+        aberrationSlider.Draw(sliderWidth);
+        GUILayout.EndHorizontal();
     }
 }

+ 249 - 250
src/MeidoPhotoStudio.Plugin/GUI/Panes/BackgroundWindowPanes/LightsPane.cs

@@ -4,339 +4,338 @@ using UnityEngine;
 
 using static MeidoPhotoStudio.Plugin.DragPointLight;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class LightsPane : BasePane
 {
-    public class LightsPane : BasePane
+    private static readonly string[] lightTypes = { "normal", "spot", "point" };
+    private static readonly Dictionary<LightProp, SliderProp> lightSliderProp;
+    private static readonly string[,] sliderNames = {
+        { "lights", "x" }, { "lights", "y" }, { "lights", "intensity" }, { "lights", "shadow" },
+        { "lights", "spot" }, { "lights", "range" }, { "backgroundWindow", "red" }, { "backgroundWindow", "green" },
+        { "backgroundWindow", "blue" }
+    };
+
+    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;
+    private string lightHeader;
+    private string resetLabel;
+
+    static LightsPane()
     {
-        private static readonly string[] lightTypes = { "normal", "spot", "point" };
-        private static readonly Dictionary<LightProp, SliderProp> lightSliderProp;
-        private static readonly string[,] sliderNames = {
-            { "lights", "x" }, { "lights", "y" }, { "lights", "intensity" }, { "lights", "shadow" },
-            { "lights", "spot" }, { "lights", "range" }, { "backgroundWindow", "red" }, { "backgroundWindow", "green" },
-            { "backgroundWindow", "blue" }
-        };
+        var rotation = LightProperty.DefaultRotation.eulerAngles;
+        var range = GameMain.Instance.MainLight.GetComponent<Light>().range;
 
-        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;
-        private string lightHeader;
-        private string resetLabel;
-
-        static LightsPane()
+        lightSliderProp = new()
         {
-            var rotation = LightProperty.DefaultRotation.eulerAngles;
-            var range = GameMain.Instance.MainLight.GetComponent<Light>().range;
-
-            lightSliderProp = new()
-            {
-                [LightProp.LightRotX] = new(0f, 360f, rotation.x, rotation.x),
-                [LightProp.LightRotY] = new(0f, 360f, rotation.y, rotation.y),
-                [LightProp.Intensity] = new(0f, 2f, 0.95f, 0.95f),
-                [LightProp.ShadowStrength] = new(0f, 1f, 0.098f, 0.098f),
-                [LightProp.Range] = new(0f, 150f, range, range),
-                [LightProp.SpotAngle] = new(0f, 150f, 50f, 50f),
-                [LightProp.Red] = new(0f, 1f, 1f, 1f),
-                [LightProp.Green] = new(0f, 1f, 1f, 1f),
-                [LightProp.Blue] = new(0f, 1f, 1f, 1f),
-            };
-        }
+            [LightProp.LightRotX] = new(0f, 360f, rotation.x, rotation.x),
+            [LightProp.LightRotY] = new(0f, 360f, rotation.y, rotation.y),
+            [LightProp.Intensity] = new(0f, 2f, 0.95f, 0.95f),
+            [LightProp.ShadowStrength] = new(0f, 1f, 0.098f, 0.098f),
+            [LightProp.Range] = new(0f, 150f, range, range),
+            [LightProp.SpotAngle] = new(0f, 150f, 50f, 50f),
+            [LightProp.Red] = new(0f, 1f, 1f, 1f),
+            [LightProp.Green] = new(0f, 1f, 1f, 1f),
+            [LightProp.Blue] = new(0f, 1f, 1f, 1f),
+        };
+    }
 
-        public LightsPane(LightManager lightManager)
-        {
-            this.lightManager = lightManager;
-            this.lightManager.Rotate += (s, a) => UpdateRotation();
-            this.lightManager.Scale += (s, a) => UpdateScale();
-            this.lightManager.Select += (s, a) => UpdateCurrentLight();
-            this.lightManager.ListModified += (s, a) => UpdateList();
+    public LightsPane(LightManager lightManager)
+    {
+        this.lightManager = lightManager;
+        this.lightManager.Rotate += (s, a) => UpdateRotation();
+        this.lightManager.Scale += (s, a) => UpdateScale();
+        this.lightManager.Select += (s, a) => UpdateCurrentLight();
+        this.lightManager.ListModified += (s, a) => UpdateList();
 
-            lightTypeGrid = new(Translation.GetArray("lightType", lightTypes));
+        lightTypeGrid = new(Translation.GetArray("lightType", lightTypes));
 
-            lightTypeGrid.ControlEvent += (s, a) => SetCurrentLightType();
+        lightTypeGrid.ControlEvent += (s, a) => SetCurrentLightType();
 
-            lightDropdown = new(new[] { "Main" });
+        lightDropdown = new(new[] { "Main" });
 
-            lightDropdown.SelectionChange += (s, a) => SetCurrentLight();
+        lightDropdown.SelectionChange += (s, a) => SetCurrentLight();
 
-            addLightButton = new("+");
+        addLightButton = new("+");
 
-            addLightButton.ControlEvent += (s, a) => lightManager.AddLight();
+        addLightButton.ControlEvent += (s, a) => lightManager.AddLight();
 
-            deleteLightButton = new(Translation.Get("lightsPane", "delete"));
+        deleteLightButton = new(Translation.Get("lightsPane", "delete"));
 
-            deleteLightButton.ControlEvent += (s, a) => lightManager.DeleteActiveLight();
+        deleteLightButton.ControlEvent += (s, a) => lightManager.DeleteActiveLight();
 
-            disableToggle = new(Translation.Get("lightsPane", "disable"));
+        disableToggle = new(Translation.Get("lightsPane", "disable"));
 
-            disableToggle.ControlEvent += (s, a) => lightManager.CurrentLight.IsDisabled = disableToggle.Value;
+        disableToggle.ControlEvent += (s, a) => lightManager.CurrentLight.IsDisabled = disableToggle.Value;
 
-            clearLightsButton = new(Translation.Get("lightsPane", "clear"));
+        clearLightsButton = new(Translation.Get("lightsPane", "clear"));
 
-            clearLightsButton.ControlEvent += (s, a) => ClearLights();
+        clearLightsButton.ControlEvent += (s, a) => ClearLights();
 
-            var numberOfLightProps = Enum.GetNames(typeof(LightProp)).Length;
+        var numberOfLightProps = Enum.GetNames(typeof(LightProp)).Length;
 
-            lightSlider = new(numberOfLightProps);
+        lightSlider = new(numberOfLightProps);
 
-            for (var i = 0; i < numberOfLightProps; i++)
+        for (var i = 0; i < numberOfLightProps; i++)
+        {
+            var lightProp = (LightProp)i;
+            var sliderProp = lightSliderProp[lightProp];
+            var slider = new Slider(Translation.Get(sliderNames[i, 0], sliderNames[i, 1]), sliderProp)
             {
-                var lightProp = (LightProp)i;
-                var sliderProp = lightSliderProp[lightProp];
-                var slider = new Slider(Translation.Get(sliderNames[i, 0], sliderNames[i, 1]), sliderProp)
-                {
-                    HasTextField = true,
-                    HasReset = true
-                };
+                HasTextField = true,
+                HasReset = true
+            };
 
-                if (lightProp <= LightProp.LightRotY)
-                    slider.ControlEvent += (s, a) => SetLightRotation();
-                else
-                    slider.ControlEvent += (s, a) => SetLightProp(lightProp, slider.Value);
+            if (lightProp <= LightProp.LightRotY)
+                slider.ControlEvent += (s, a) => SetLightRotation();
+            else
+                slider.ControlEvent += (s, a) => SetLightProp(lightProp, slider.Value);
 
-                lightSlider[lightProp] = slider;
-            }
+            lightSlider[lightProp] = slider;
+        }
 
-            colorToggle = new(Translation.Get("lightsPane", "colour"));
+        colorToggle = new(Translation.Get("lightsPane", "colour"));
 
-            colorToggle.ControlEvent += (s, a) => SetColourMode();
+        colorToggle.ControlEvent += (s, a) => SetColourMode();
 
-            resetPropsButton = new(Translation.Get("lightsPane", "resetProperties"));
+        resetPropsButton = new(Translation.Get("lightsPane", "resetProperties"));
 
-            resetPropsButton.ControlEvent += (s, a) => ResetLightProps();
+        resetPropsButton.ControlEvent += (s, a) => ResetLightProps();
 
-            resetPositionButton = new(Translation.Get("lightsPane", "resetPosition"));
+        resetPositionButton = new(Translation.Get("lightsPane", "resetPosition"));
 
-            resetPositionButton.ControlEvent += (s, a) => lightManager.CurrentLight.ResetLightPosition();
+        resetPositionButton.ControlEvent += (s, a) => lightManager.CurrentLight.ResetLightPosition();
 
-            lightHeader = Translation.Get("lightsPane", "header");
+        lightHeader = Translation.Get("lightsPane", "header");
 
-            resetLabel = Translation.Get("lightsPane", "resetLabel");
-        }
+        resetLabel = Translation.Get("lightsPane", "resetLabel");
+    }
 
-        public override void UpdatePane()
-        {
-            updating = true;
-
-            var 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 UpdatePane()
+    {
+        updating = true;
+
+        var 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()
-        {
-            var isMain = lightManager.SelectedLightIndex == 0;
+    public override void Draw()
+    {
+        var isMain = lightManager.SelectedLightIndex == 0;
 
-            var noExpandWidth = GUILayout.ExpandWidth(false);
+        var noExpandWidth = GUILayout.ExpandWidth(false);
 
-            MpsGui.Header(lightHeader);
-            MpsGui.WhiteLine();
+        MpsGui.Header(lightHeader);
+        MpsGui.WhiteLine();
 
-            GUILayout.BeginHorizontal();
-            lightDropdown.Draw(GUILayout.Width(84));
-            addLightButton.Draw(noExpandWidth);
+        GUILayout.BeginHorizontal();
+        lightDropdown.Draw(GUILayout.Width(84));
+        addLightButton.Draw(noExpandWidth);
 
-            GUILayout.FlexibleSpace();
-            GUI.enabled = !isMain;
-            deleteLightButton.Draw(noExpandWidth);
-            GUI.enabled = true;
-            clearLightsButton.Draw(noExpandWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.FlexibleSpace();
+        GUI.enabled = !isMain;
+        deleteLightButton.Draw(noExpandWidth);
+        GUI.enabled = true;
+        clearLightsButton.Draw(noExpandWidth);
+        GUILayout.EndHorizontal();
 
-            var isDisabled = !isMain && lightManager.CurrentLight.IsDisabled;
+        var isDisabled = !isMain && lightManager.CurrentLight.IsDisabled;
 
-            GUILayout.BeginHorizontal();
-            GUI.enabled = !isDisabled;
-            lightTypeGrid.Draw(noExpandWidth);
+        GUILayout.BeginHorizontal();
+        GUI.enabled = !isDisabled;
+        lightTypeGrid.Draw(noExpandWidth);
 
-            if (!isMain)
-            {
-                GUI.enabled = true;
-                disableToggle.Draw();
-            }
+        if (!isMain)
+        {
+            GUI.enabled = true;
+            disableToggle.Draw();
+        }
 
-            if (lightManager.SelectedLightIndex == 0 && currentLightType == MPSLightType.Normal)
-                colorToggle.Draw();
+        if (lightManager.SelectedLightIndex == 0 && currentLightType == MPSLightType.Normal)
+            colorToggle.Draw();
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = !isDisabled;
+        GUI.enabled = !isDisabled;
 
-            if (currentLightType != MPSLightType.Point)
-            {
-                lightSlider[LightProp.LightRotX].Draw();
-                lightSlider[LightProp.LightRotY].Draw();
-            }
+        if (currentLightType != MPSLightType.Point)
+        {
+            lightSlider[LightProp.LightRotX].Draw();
+            lightSlider[LightProp.LightRotY].Draw();
+        }
 
-            lightSlider[LightProp.Intensity].Draw();
+        lightSlider[LightProp.Intensity].Draw();
 
-            if (currentLightType == MPSLightType.Normal)
-                lightSlider[LightProp.ShadowStrength].Draw();
-            else
-                lightSlider[LightProp.Range].Draw();
+        if (currentLightType == MPSLightType.Normal)
+            lightSlider[LightProp.ShadowStrength].Draw();
+        else
+            lightSlider[LightProp.Range].Draw();
 
-            if (currentLightType == MPSLightType.Spot)
-                lightSlider[LightProp.SpotAngle].Draw();
+        if (currentLightType == MPSLightType.Spot)
+            lightSlider[LightProp.SpotAngle].Draw();
 
-            MpsGui.BlackLine();
+        MpsGui.BlackLine();
 
-            lightSlider[LightProp.Red].Draw();
-            lightSlider[LightProp.Green].Draw();
-            lightSlider[LightProp.Blue].Draw();
+        lightSlider[LightProp.Red].Draw();
+        lightSlider[LightProp.Green].Draw();
+        lightSlider[LightProp.Blue].Draw();
 
-            GUILayout.BeginHorizontal();
-            GUILayout.Label(resetLabel, noExpandWidth);
-            resetPropsButton.Draw(noExpandWidth);
-            resetPositionButton.Draw(noExpandWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        GUILayout.Label(resetLabel, noExpandWidth);
+        resetPropsButton.Draw(noExpandWidth);
+        resetPositionButton.Draw(noExpandWidth);
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            updating = true;
+    protected override void ReloadTranslation()
+    {
+        updating = true;
 
-            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");
+        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 (var lightProp = LightProp.LightRotX; lightProp <= LightProp.Blue; lightProp++)
-                lightSlider[lightProp].Label =
-                    Translation.Get(sliderNames[(int)lightProp, 0], sliderNames[(int)lightProp, 1]);
+        for (var lightProp = LightProp.LightRotX; lightProp <= LightProp.Blue; lightProp++)
+            lightSlider[lightProp].Label =
+                Translation.Get(sliderNames[(int)lightProp, 0], sliderNames[(int)lightProp, 1]);
 
-            colorToggle.Label = Translation.Get("lightsPane", "colour");
-            resetPropsButton.Label = Translation.Get("lightsPane", "resetProperties");
-            resetPositionButton.Label = Translation.Get("lightsPane", "resetPosition");
-            lightHeader = Translation.Get("lightsPane", "header");
-            resetLabel = Translation.Get("lightsPane", "resetLabel");
+        colorToggle.Label = Translation.Get("lightsPane", "colour");
+        resetPropsButton.Label = Translation.Get("lightsPane", "resetProperties");
+        resetPositionButton.Label = Translation.Get("lightsPane", "resetPosition");
+        lightHeader = Translation.Get("lightsPane", "header");
+        resetLabel = Translation.Get("lightsPane", "resetLabel");
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        private void SetColourMode()
-        {
-            lightManager.SetColourModeActive(colorToggle.Value);
-            UpdatePane();
-        }
+    private void SetColourMode()
+    {
+        lightManager.SetColourModeActive(colorToggle.Value);
+        UpdatePane();
+    }
 
-        private void ClearLights()
-        {
-            lightManager.ClearLights();
-            UpdatePane();
-        }
+    private void ClearLights()
+    {
+        lightManager.ClearLights();
+        UpdatePane();
+    }
 
-        private void SetCurrentLight()
-        {
-            if (updating)
-                return;
+    private void SetCurrentLight()
+    {
+        if (updating)
+            return;
 
-            lightManager.SelectedLightIndex = lightDropdown.SelectedItemIndex;
-            UpdatePane();
-        }
+        lightManager.SelectedLightIndex = lightDropdown.SelectedItemIndex;
+        UpdatePane();
+    }
 
-        private void ResetLightProps()
-        {
-            lightManager.CurrentLight.ResetLightProps();
-            UpdatePane();
-        }
+    private void ResetLightProps()
+    {
+        lightManager.CurrentLight.ResetLightProps();
+        UpdatePane();
+    }
 
-        private void SetCurrentLightType()
-        {
-            if (updating)
-                return;
+    private void SetCurrentLightType()
+    {
+        if (updating)
+            return;
 
-            currentLightType = (MPSLightType)lightTypeGrid.SelectedItemIndex;
+        currentLightType = (MPSLightType)lightTypeGrid.SelectedItemIndex;
 
-            var currentLight = lightManager.CurrentLight;
+        var currentLight = lightManager.CurrentLight;
 
-            currentLight.SetLightType(currentLightType);
+        currentLight.SetLightType(currentLightType);
 
-            lightDropdown.SetDropdownItem(lightManager.ActiveLightName);
-            UpdatePane();
-        }
+        lightDropdown.SetDropdownItem(lightManager.ActiveLightName);
+        UpdatePane();
+    }
 
-        private void SetLightProp(LightProp prop, float value)
-        {
-            if (updating)
-                return;
+    private void SetLightProp(LightProp prop, float value)
+    {
+        if (updating)
+            return;
 
-            lightManager.CurrentLight.SetProp(prop, value);
-        }
+        lightManager.CurrentLight.SetProp(prop, value);
+    }
 
-        private void SetLightRotation()
-        {
-            if (updating)
-                return;
+    private void SetLightRotation()
+    {
+        if (updating)
+            return;
 
-            var lightRotX = lightSlider[LightProp.LightRotX].Value;
-            var lightRotY = lightSlider[LightProp.LightRotY].Value;
+        var lightRotX = lightSlider[LightProp.LightRotX].Value;
+        var lightRotY = lightSlider[LightProp.LightRotY].Value;
 
-            lightManager.CurrentLight.SetRotation(lightRotX, lightRotY);
-        }
+        lightManager.CurrentLight.SetRotation(lightRotX, lightRotY);
+    }
 
-        private void UpdateList()
-        {
-            var newList = lightManager.LightNameList;
+    private void UpdateList()
+    {
+        var newList = lightManager.LightNameList;
 
-            lightDropdown.SetDropdownItems(newList, lightManager.SelectedLightIndex);
-            UpdatePane();
-        }
+        lightDropdown.SetDropdownItems(newList, lightManager.SelectedLightIndex);
+        UpdatePane();
+    }
 
-        private void UpdateRotation()
-        {
-            updating = true;
+    private void UpdateRotation()
+    {
+        updating = true;
 
-            var prop = lightManager.CurrentLight.CurrentLightProperty;
+        var prop = lightManager.CurrentLight.CurrentLightProperty;
 
-            lightSlider[LightProp.LightRotX].Value = prop.Rotation.eulerAngles.x;
-            lightSlider[LightProp.LightRotY].Value = prop.Rotation.eulerAngles.y;
+        lightSlider[LightProp.LightRotX].Value = prop.Rotation.eulerAngles.x;
+        lightSlider[LightProp.LightRotY].Value = prop.Rotation.eulerAngles.y;
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        private void UpdateScale()
-        {
-            updating = true;
+    private void UpdateScale()
+    {
+        updating = true;
 
-            lightSlider[LightProp.SpotAngle].Value = lightManager.CurrentLight.CurrentLightProperty.SpotAngle;
-            lightSlider[LightProp.Range].Value = lightManager.CurrentLight.CurrentLightProperty.Range;
+        lightSlider[LightProp.SpotAngle].Value = lightManager.CurrentLight.CurrentLightProperty.SpotAngle;
+        lightSlider[LightProp.Range].Value = lightManager.CurrentLight.CurrentLightProperty.Range;
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        private void UpdateCurrentLight()
-        {
-            updating = true;
+    private void UpdateCurrentLight()
+    {
+        updating = true;
 
-            lightDropdown.SelectedItemIndex = lightManager.SelectedLightIndex;
+        lightDropdown.SelectedItemIndex = lightManager.SelectedLightIndex;
 
-            updating = false;
+        updating = false;
 
-            UpdatePane();
-        }
+        UpdatePane();
     }
 }

+ 21 - 22
src/MeidoPhotoStudio.Plugin/GUI/Panes/BasePane.cs

@@ -1,36 +1,35 @@
 using System;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class BasePane
 {
-    public abstract class BasePane
-    {
-        protected BaseWindow parent;
-        protected bool updating;
+    protected BaseWindow parent;
+    protected bool updating;
 
-        public virtual bool Visible { get; set; }
-        public virtual bool Enabled { get; set; }
+    public virtual bool Visible { get; set; }
+    public virtual bool Enabled { get; set; }
 
-        protected BasePane() =>
-            Translation.ReloadTranslationEvent += OnReloadTranslation;
+    protected BasePane() =>
+        Translation.ReloadTranslationEvent += OnReloadTranslation;
 
-        // TODO: This does not work how I think it works. Probably just remove entirely.
-        ~BasePane() =>
-            Translation.ReloadTranslationEvent -= OnReloadTranslation;
+    // TODO: This does not work how I think it works. Probably just remove entirely.
+    ~BasePane() =>
+        Translation.ReloadTranslationEvent -= OnReloadTranslation;
 
-        public virtual void SetParent(BaseWindow window) =>
-            parent = window;
+    public virtual void SetParent(BaseWindow window) =>
+        parent = window;
 
-        public virtual void UpdatePane() { }
+    public virtual void UpdatePane() { }
 
-        public virtual void Draw() { }
+    public virtual void Draw() { }
 
-        public virtual void Activate() { }
+    public virtual void Activate() { }
 
-        public virtual void Deactivate() { }
+    public virtual void Deactivate() { }
 
-        protected virtual void ReloadTranslation() { }
+    protected virtual void ReloadTranslation() { }
 
-        private void OnReloadTranslation(object sender, EventArgs args) =>
-            ReloadTranslation();
-    }
+    private void OnReloadTranslation(object sender, EventArgs args) =>
+        ReloadTranslation();
 }

+ 97 - 98
src/MeidoPhotoStudio.Plugin/GUI/Panes/CallWindowPanes/MaidSelectorPane.cs

@@ -1,137 +1,136 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidSelectorPane : BasePane
 {
-    public class MaidSelectorPane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly Button clearMaidsButton;
-        private readonly Button callMaidsButton;
-        private readonly Toggle activeMeidoListToggle;
+    private readonly MeidoManager meidoManager;
+    private readonly Button clearMaidsButton;
+    private readonly Button callMaidsButton;
+    private readonly Toggle activeMeidoListToggle;
 
-        private Vector2 maidListScrollPos;
-        private Vector2 activeMaidListScrollPos;
+    private Vector2 maidListScrollPos;
+    private Vector2 activeMaidListScrollPos;
 
-        public MaidSelectorPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+    public MaidSelectorPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            clearMaidsButton = new(Translation.Get("maidCallWindow", "clearButton"));
-            clearMaidsButton.ControlEvent += (s, a) => this.meidoManager.ClearSelectList();
+        clearMaidsButton = new(Translation.Get("maidCallWindow", "clearButton"));
+        clearMaidsButton.ControlEvent += (s, a) => this.meidoManager.ClearSelectList();
 
-            callMaidsButton = new(Translation.Get("maidCallWindow", "callButton"));
-            callMaidsButton.ControlEvent += (s, a) => this.meidoManager.CallMeidos();
+        callMaidsButton = new(Translation.Get("maidCallWindow", "callButton"));
+        callMaidsButton.ControlEvent += (s, a) => this.meidoManager.CallMeidos();
 
-            activeMeidoListToggle = new(Translation.Get("maidCallWindow", "activeOnlyToggle"));
-            this.meidoManager.BeginCallMeidos += (_, _) =>
-            {
-                if (meidoManager.SelectedMeidoSet.Count == 0)
-                    activeMeidoListToggle.Value = false;
-            };
-        }
-
-        public override void Activate()
+        activeMeidoListToggle = new(Translation.Get("maidCallWindow", "activeOnlyToggle"));
+        this.meidoManager.BeginCallMeidos += (_, _) =>
         {
-            base.Activate();
+            if (meidoManager.SelectedMeidoSet.Count == 0)
+                activeMeidoListToggle.Value = false;
+        };
+    }
 
-            // NOTE: Leaving this mode enabled pretty much softlocks meido selection so disable it on activation
-            activeMeidoListToggle.Value = false;
-        }
+    public override void Activate()
+    {
+        base.Activate();
 
-        public override void Draw()
-        {
-            GUILayout.BeginHorizontal();
-            clearMaidsButton.Draw(GUILayout.ExpandWidth(false));
-            callMaidsButton.Draw();
-            GUILayout.EndHorizontal();
+        // NOTE: Leaving this mode enabled pretty much softlocks meido selection so disable it on activation
+        activeMeidoListToggle.Value = false;
+    }
 
-            MpsGui.WhiteLine();
+    public override void Draw()
+    {
+        GUILayout.BeginHorizontal();
+        clearMaidsButton.Draw(GUILayout.ExpandWidth(false));
+        callMaidsButton.Draw();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = meidoManager.HasActiveMeido;
+        MpsGui.WhiteLine();
 
-            activeMeidoListToggle.Draw();
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            GUI.enabled = true;
+        activeMeidoListToggle.Draw();
 
-            var onlyActiveMeido = activeMeidoListToggle.Value;
+        GUI.enabled = true;
 
-            IList<Meido> meidoList = onlyActiveMeido
-                ? meidoManager.ActiveMeidoList
-                : meidoManager.Meidos;
+        var onlyActiveMeido = activeMeidoListToggle.Value;
 
-            var labelStyle = new GUIStyle(GUI.skin.label)
-            {
-                fontSize = 14,
-            };
+        IList<Meido> meidoList = onlyActiveMeido
+            ? meidoManager.ActiveMeidoList
+            : meidoManager.Meidos;
 
-            var selectLabelStyle = new GUIStyle(labelStyle)
-            {
-                normal = {
-                    textColor = Color.black,
-                },
-                alignment = TextAnchor.UpperRight,
-            };
+        var labelStyle = new GUIStyle(GUI.skin.label)
+        {
+            fontSize = 14,
+        };
 
-            var labelSelectedStyle = new GUIStyle(labelStyle)
-            {
-                normal = {
-                    textColor = Color.black,
-                },
-            };
+        var selectLabelStyle = new GUIStyle(labelStyle)
+        {
+            normal = {
+                textColor = Color.black,
+            },
+            alignment = TextAnchor.UpperRight,
+        };
 
-            var windowRect = parent.WindowRect;
-            var windowHeight = windowRect.height;
-            var buttonWidth = windowRect.width - 30f;
+        var labelSelectedStyle = new GUIStyle(labelStyle)
+        {
+            normal = {
+                textColor = Color.black,
+            },
+        };
 
-            const float buttonHeight = 85f;
-            const float offsetTop = 130f;
+        var windowRect = parent.WindowRect;
+        var windowHeight = windowRect.height;
+        var buttonWidth = windowRect.width - 30f;
 
-            var positionRect = new Rect(5f, offsetTop, windowRect.width - 10f, windowHeight - (offsetTop + 35));
-            var viewRect = new Rect(0f, 0f, buttonWidth, buttonHeight * meidoList.Count + 5f);
+        const float buttonHeight = 85f;
+        const float offsetTop = 130f;
 
-            if (onlyActiveMeido)
-                activeMaidListScrollPos = GUI.BeginScrollView(positionRect, activeMaidListScrollPos, viewRect);
-            else
-                maidListScrollPos = GUI.BeginScrollView(positionRect, maidListScrollPos, viewRect);
+        var positionRect = new Rect(5f, offsetTop, windowRect.width - 10f, windowHeight - (offsetTop + 35));
+        var viewRect = new Rect(0f, 0f, buttonWidth, buttonHeight * meidoList.Count + 5f);
 
-            for (var i = 0; i < meidoList.Count; i++)
-            {
-                var meido = meidoList[i];
-                var y = i * buttonHeight;
-                var selectedMaid = meidoManager.SelectedMeidoSet.Contains(meido.StockNo);
+        if (onlyActiveMeido)
+            activeMaidListScrollPos = GUI.BeginScrollView(positionRect, activeMaidListScrollPos, viewRect);
+        else
+            maidListScrollPos = GUI.BeginScrollView(positionRect, maidListScrollPos, viewRect);
 
-                if (GUI.Button(new(0f, y, buttonWidth, buttonHeight), string.Empty))
-                    meidoManager.SelectMeido(meido.StockNo);
+        for (var i = 0; i < meidoList.Count; i++)
+        {
+            var meido = meidoList[i];
+            var y = i * buttonHeight;
+            var selectedMaid = meidoManager.SelectedMeidoSet.Contains(meido.StockNo);
 
-                if (selectedMaid)
-                {
-                    var selectedIndex = meidoManager.SelectMeidoList.IndexOf(meido.StockNo) + 1;
+            if (GUI.Button(new(0f, y, buttonWidth, buttonHeight), string.Empty))
+                meidoManager.SelectMeido(meido.StockNo);
+
+            if (selectedMaid)
+            {
+                var selectedIndex = meidoManager.SelectMeidoList.IndexOf(meido.StockNo) + 1;
 
-                    GUI.DrawTexture(new(5f, y + 5f, buttonWidth - 10f, buttonHeight - 10f), Texture2D.whiteTexture);
+                GUI.DrawTexture(new(5f, y + 5f, buttonWidth - 10f, buttonHeight - 10f), Texture2D.whiteTexture);
 
-                    GUI.Label(
+                GUI.Label(
                         new(0f, y + 5f, buttonWidth - 10f, buttonHeight), selectedIndex.ToString(), selectLabelStyle
-                    );
-                }
+                        );
+            }
 
-                if (meido.Portrait != null)
-                    GUI.DrawTexture(new(5f, y, buttonHeight, buttonHeight), meido.Portrait);
+            if (meido.Portrait != null)
+                GUI.DrawTexture(new(5f, y, buttonHeight, buttonHeight), meido.Portrait);
 
-                GUI.Label(
+            GUI.Label(
                     new(95f, y + 30f, buttonWidth - 80f, buttonHeight),
                     $"{meido.LastName}\n{meido.FirstName}", selectedMaid ? labelSelectedStyle : labelStyle
-                );
-            }
-
-            GUI.EndScrollView();
+                    );
         }
 
-        protected override void ReloadTranslation()
-        {
-            clearMaidsButton.Label = Translation.Get("maidCallWindow", "clearButton");
-            callMaidsButton.Label = Translation.Get("maidCallWindow", "callButton");
-            activeMeidoListToggle.Label = Translation.Get("maidCallWindow", "activeOnlyToggle");
-        }
+        GUI.EndScrollView();
+    }
+
+    protected override void ReloadTranslation()
+    {
+        clearMaidsButton.Label = Translation.Get("maidCallWindow", "clearButton");
+        callMaidsButton.Label = Translation.Get("maidCallWindow", "callButton");
+        activeMeidoListToggle.Label = Translation.Get("maidCallWindow", "activeOnlyToggle");
     }
 }

+ 122 - 123
src/MeidoPhotoStudio.Plugin/GUI/Panes/FaceWindowPanes/MaidFaceBlendPane.cs

@@ -3,178 +3,177 @@ using System.IO;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidFaceBlendPane : BasePane
 {
-    public class MaidFaceBlendPane : BasePane
-    {
-        private static readonly string[] tabTranslations = { "baseTab", "customTab" };
+    private static readonly string[] tabTranslations = { "baseTab", "customTab" };
 
-        private readonly MeidoManager meidoManager;
-        private readonly SelectionGrid faceBlendSourceGrid;
-        private readonly Dropdown faceBlendCategoryDropdown;
-        private readonly Button prevCategoryButton;
-        private readonly Button nextCategoryButton;
-        private readonly Dropdown faceBlendDropdown;
-        private readonly Button facePrevButton;
-        private readonly Button faceNextButton;
+    private readonly MeidoManager meidoManager;
+    private readonly SelectionGrid faceBlendSourceGrid;
+    private readonly Dropdown faceBlendCategoryDropdown;
+    private readonly Button prevCategoryButton;
+    private readonly Button nextCategoryButton;
+    private readonly Dropdown faceBlendDropdown;
+    private readonly Button facePrevButton;
+    private readonly Button faceNextButton;
 
-        private bool facePresetMode;
-        private bool faceListEnabled;
+    private bool facePresetMode;
+    private bool faceListEnabled;
 
-        private Dictionary<string, List<string>> CurrentFaceDict => facePresetMode
-            ? Constants.CustomFaceDict : Constants.FaceDict;
+    private Dictionary<string, List<string>> CurrentFaceDict => facePresetMode
+        ? Constants.CustomFaceDict : Constants.FaceDict;
 
-        private List<string> CurrentFaceGroupList => facePresetMode
-            ? Constants.CustomFaceGroupList : Constants.FaceGroupList;
+    private List<string> CurrentFaceGroupList => facePresetMode
+        ? Constants.CustomFaceGroupList : Constants.FaceGroupList;
 
-        private string SelectedFaceGroup =>
-            CurrentFaceGroupList[faceBlendCategoryDropdown.SelectedItemIndex];
+    private string SelectedFaceGroup =>
+        CurrentFaceGroupList[faceBlendCategoryDropdown.SelectedItemIndex];
 
-        private List<string> CurrentFaceList =>
-            CurrentFaceDict[SelectedFaceGroup];
+    private List<string> CurrentFaceList =>
+        CurrentFaceDict[SelectedFaceGroup];
 
-        private int SelectedFaceIndex =>
-            faceBlendDropdown.SelectedItemIndex;
+    private int SelectedFaceIndex =>
+        faceBlendDropdown.SelectedItemIndex;
 
-        private string SelectedFace =>
-            CurrentFaceList[SelectedFaceIndex];
+    private string SelectedFace =>
+        CurrentFaceList[SelectedFaceIndex];
 
-        public MaidFaceBlendPane(MeidoManager meidoManager)
-        {
-            Constants.CustomFaceChange += OnPresetChange;
+    public MaidFaceBlendPane(MeidoManager meidoManager)
+    {
+        Constants.CustomFaceChange += OnPresetChange;
 
-            this.meidoManager = meidoManager;
+        this.meidoManager = meidoManager;
 
-            faceBlendSourceGrid = new(Translation.GetArray("maidFaceWindow", tabTranslations));
+        faceBlendSourceGrid = new(Translation.GetArray("maidFaceWindow", tabTranslations));
 
-            faceBlendSourceGrid.ControlEvent += (s, a) =>
-            {
-                facePresetMode = faceBlendSourceGrid.SelectedItemIndex is 1;
+        faceBlendSourceGrid.ControlEvent += (s, a) =>
+        {
+            facePresetMode = faceBlendSourceGrid.SelectedItemIndex is 1;
 
-                if (updating)
-                    return;
+            if (updating)
+                return;
 
-                var list = facePresetMode
-                    ? CurrentFaceGroupList.ToArray()
-                    : Translation.GetArray("faceBlendCategory", Constants.FaceGroupList);
+            var list = facePresetMode
+                ? CurrentFaceGroupList.ToArray()
+                : Translation.GetArray("faceBlendCategory", Constants.FaceGroupList);
 
-                faceBlendCategoryDropdown.SetDropdownItems(list, 0);
-            };
+            faceBlendCategoryDropdown.SetDropdownItems(list, 0);
+        };
 
-            faceBlendCategoryDropdown = new(
+        faceBlendCategoryDropdown = new(
                 Translation.GetArray("faceBlendCategory", Constants.FaceGroupList)
-            );
+                );
 
-            faceBlendCategoryDropdown.SelectionChange += (s, a) =>
-            {
-                faceListEnabled = CurrentFaceList.Count > 0;
-                faceBlendDropdown.SetDropdownItems(UIFaceList(), 0);
-            };
+        faceBlendCategoryDropdown.SelectionChange += (s, a) =>
+        {
+            faceListEnabled = CurrentFaceList.Count > 0;
+            faceBlendDropdown.SetDropdownItems(UIFaceList(), 0);
+        };
 
-            prevCategoryButton = new("<");
-            prevCategoryButton.ControlEvent += (s, a) => faceBlendCategoryDropdown.Step(-1);
+        prevCategoryButton = new("<");
+        prevCategoryButton.ControlEvent += (s, a) => faceBlendCategoryDropdown.Step(-1);
 
-            nextCategoryButton = new(">");
-            nextCategoryButton.ControlEvent += (s, a) => faceBlendCategoryDropdown.Step(1);
+        nextCategoryButton = new(">");
+        nextCategoryButton.ControlEvent += (s, a) => faceBlendCategoryDropdown.Step(1);
 
-            faceBlendDropdown = new(UIFaceList());
-            faceBlendDropdown.SelectionChange += (s, a) =>
-            {
-                if (!faceListEnabled || updating)
-                    return;
+        faceBlendDropdown = new(UIFaceList());
+        faceBlendDropdown.SelectionChange += (s, a) =>
+        {
+            if (!faceListEnabled || updating)
+                return;
 
-                this.meidoManager.ActiveMeido.SetFaceBlendSet(SelectedFace);
-            };
+            this.meidoManager.ActiveMeido.SetFaceBlendSet(SelectedFace);
+        };
 
-            facePrevButton = new("<");
-            facePrevButton.ControlEvent += (s, a) => faceBlendDropdown.Step(-1);
+        facePrevButton = new("<");
+        facePrevButton.ControlEvent += (s, a) => faceBlendDropdown.Step(-1);
 
-            faceNextButton = new(">");
-            faceNextButton.ControlEvent += (s, a) => faceBlendDropdown.Step(1);
+        faceNextButton = new(">");
+        faceNextButton.ControlEvent += (s, a) => faceBlendDropdown.Step(1);
 
-            faceListEnabled = CurrentFaceList.Count > 0;
-        }
+        faceListEnabled = CurrentFaceList.Count > 0;
+    }
 
-        public override void Draw()
-        {
-            const float buttonHeight = 30;
+    public override void Draw()
+    {
+        const float buttonHeight = 30;
 
-            var arrowLayoutOptions = new[] {
-                GUILayout.Width(buttonHeight),
+        var arrowLayoutOptions = new[] {
+            GUILayout.Width(buttonHeight),
                 GUILayout.Height(buttonHeight),
-            };
+        };
 
-            const float dropdownButtonWidth = 153f;
+        const float dropdownButtonWidth = 153f;
 
-            var dropdownLayoutOptions = new[] {
-                GUILayout.Height(buttonHeight),
+        var dropdownLayoutOptions = new[] {
+            GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth),
-            };
+        };
 
-            GUI.enabled = meidoManager.HasActiveMeido;
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            faceBlendSourceGrid.Draw();
+        faceBlendSourceGrid.Draw();
 
-            MpsGui.WhiteLine();
+        MpsGui.WhiteLine();
 
-            GUILayout.BeginHorizontal();
-            prevCategoryButton.Draw(arrowLayoutOptions);
-            faceBlendCategoryDropdown.Draw(dropdownLayoutOptions);
-            nextCategoryButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        prevCategoryButton.Draw(arrowLayoutOptions);
+        faceBlendCategoryDropdown.Draw(dropdownLayoutOptions);
+        nextCategoryButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
-            GUI.enabled = GUI.enabled && faceListEnabled;
-            facePrevButton.Draw(arrowLayoutOptions);
-            faceBlendDropdown.Draw(dropdownLayoutOptions);
-            faceNextButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
-            GUI.enabled = true;
-        }
+        GUILayout.BeginHorizontal();
+        GUI.enabled = GUI.enabled && faceListEnabled;
+        facePrevButton.Draw(arrowLayoutOptions);
+        faceBlendDropdown.Draw(dropdownLayoutOptions);
+        faceNextButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            updating = true;
-            faceBlendSourceGrid.SetItems(Translation.GetArray("maidFaceWindow", tabTranslations));
+    protected override void ReloadTranslation()
+    {
+        updating = true;
+        faceBlendSourceGrid.SetItems(Translation.GetArray("maidFaceWindow", tabTranslations));
 
-            if (!facePresetMode)
-                faceBlendCategoryDropdown.SetDropdownItems(
+        if (!facePresetMode)
+            faceBlendCategoryDropdown.SetDropdownItems(
                     Translation.GetArray("faceBlendCategory", Constants.FaceGroupList)
-                );
+                    );
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        private string[] UIFaceList() =>
-            CurrentFaceList.Count is 0
-                ? (new[] { "No Face Presets" })
-                : CurrentFaceList.Select(face => facePresetMode
-                    ? Path.GetFileNameWithoutExtension(face)
-                    : Translation.Get("faceBlendPresetsDropdown", face)
+    private string[] UIFaceList() =>
+        CurrentFaceList.Count is 0
+        ? (new[] { "No Face Presets" })
+        : CurrentFaceList.Select(face => facePresetMode
+                ? Path.GetFileNameWithoutExtension(face)
+                : Translation.Get("faceBlendPresetsDropdown", face)
                 ).ToArray();
 
-        private void OnPresetChange(object sender, PresetChangeEventArgs args)
+    private void OnPresetChange(object sender, PresetChangeEventArgs args)
+    {
+        if (args == PresetChangeEventArgs.Empty)
         {
-            if (args == PresetChangeEventArgs.Empty)
-            {
-                if (facePresetMode)
-                {
-                    updating = true;
-                    faceBlendCategoryDropdown.SetDropdownItems(CurrentFaceGroupList.ToArray(), 0);
-                    faceBlendDropdown.SetDropdownItems(UIFaceList(), 0);
-                    updating = false;
-                }
-            }
-            else
+            if (facePresetMode)
             {
                 updating = true;
-                faceBlendSourceGrid.SelectedItemIndex = 1;
-                faceBlendCategoryDropdown.SetDropdownItems(
-                    CurrentFaceGroupList.ToArray(), CurrentFaceGroupList.IndexOf(args.Category)
-                );
+                faceBlendCategoryDropdown.SetDropdownItems(CurrentFaceGroupList.ToArray(), 0);
+                faceBlendDropdown.SetDropdownItems(UIFaceList(), 0);
                 updating = false;
-                faceBlendDropdown.SetDropdownItems(UIFaceList(), CurrentFaceList.IndexOf(args.Path));
             }
         }
+        else
+        {
+            updating = true;
+            faceBlendSourceGrid.SelectedItemIndex = 1;
+            faceBlendCategoryDropdown.SetDropdownItems(
+                    CurrentFaceGroupList.ToArray(), CurrentFaceGroupList.IndexOf(args.Category)
+                    );
+            updating = false;
+            faceBlendDropdown.SetDropdownItems(UIFaceList(), CurrentFaceList.IndexOf(args.Path));
+        }
     }
 }

+ 188 - 189
src/MeidoPhotoStudio.Plugin/GUI/Panes/FaceWindowPanes/MaidFaceSliderPane.cs

@@ -6,242 +6,241 @@ using Newtonsoft.Json;
 using UnityEngine;
 using static MeidoPhotoStudio.Plugin.Meido;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidFaceSliderPane : BasePane
 {
-    public class MaidFaceSliderPane : BasePane
+    private static readonly Dictionary<string, float> SliderLimits = new()
     {
-        private static readonly Dictionary<string, float> SliderLimits = new()
-        {
-            // Eye Shut
-            ["eyeclose"] = 1f,
-            // Eye Smile
-            ["eyeclose2"] = 1f,
-            // Glare
-            ["eyeclose3"] = 1f,
-            // Wide Eyes
-            ["eyebig"] = 1f,
-            // Wink 1
-            ["eyeclose6"] = 1f,
-            // Wink 2
-            ["eyeclose5"] = 1f,
-            // Highlight
-            ["hitomih"] = 2f,
-            // Pupil Size
-            ["hitomis"] = 3f,
-            // Brow 1
-            ["mayuha"] = 1f,
-            // Brow 2
-            ["mayuw"] = 1f,
-            // Brow Up
-            ["mayuup"] = 1f,
-            // Brow Down 1
-            ["mayuv"] = 1f,
-            // Brow Down 2
-            ["mayuvhalf"] = 1f,
-            // Mouth Open 1
-            ["moutha"] = 1f,
-            // Mouth Open 2
-            ["mouths"] = 1f,
-            // Mouth Narrow
-            ["mouthc"] = 1f,
-            // Mouth Widen
-            ["mouthi"] = 1f,
-            // Smile
-            ["mouthup"] = 1.4f,
-            // Frown
-            ["mouthdw"] = 1f,
-            // Mouth Pucker
-            ["mouthhe"] = 1f,
-            // Grin
-            ["mouthuphalf"] = 2f,
-            // Tongue Out
-            ["tangout"] = 1f,
-            // Tongue Up
-            ["tangup"] = 1f,
-            // Tongue Base
-            ["tangopen"] = 1f
-        };
-
-        private readonly MeidoManager meidoManager;
-        private readonly Dictionary<string, BaseControl> faceControls;
-
-        private bool hasTangOpen;
-
-        private static void InitializeSliderLimits(Dictionary<string, BaseControl> controls)
+        // Eye Shut
+        ["eyeclose"] = 1f,
+        // Eye Smile
+        ["eyeclose2"] = 1f,
+        // Glare
+        ["eyeclose3"] = 1f,
+        // Wide Eyes
+        ["eyebig"] = 1f,
+        // Wink 1
+        ["eyeclose6"] = 1f,
+        // Wink 2
+        ["eyeclose5"] = 1f,
+        // Highlight
+        ["hitomih"] = 2f,
+        // Pupil Size
+        ["hitomis"] = 3f,
+        // Brow 1
+        ["mayuha"] = 1f,
+        // Brow 2
+        ["mayuw"] = 1f,
+        // Brow Up
+        ["mayuup"] = 1f,
+        // Brow Down 1
+        ["mayuv"] = 1f,
+        // Brow Down 2
+        ["mayuvhalf"] = 1f,
+        // Mouth Open 1
+        ["moutha"] = 1f,
+        // Mouth Open 2
+        ["mouths"] = 1f,
+        // Mouth Narrow
+        ["mouthc"] = 1f,
+        // Mouth Widen
+        ["mouthi"] = 1f,
+        // Smile
+        ["mouthup"] = 1.4f,
+        // Frown
+        ["mouthdw"] = 1f,
+        // Mouth Pucker
+        ["mouthhe"] = 1f,
+        // Grin
+        ["mouthuphalf"] = 2f,
+        // Tongue Out
+        ["tangout"] = 1f,
+        // Tongue Up
+        ["tangup"] = 1f,
+        // Tongue Base
+        ["tangopen"] = 1f
+    };
+
+    private readonly MeidoManager meidoManager;
+    private readonly Dictionary<string, BaseControl> faceControls;
+
+    private bool hasTangOpen;
+
+    private static void InitializeSliderLimits(Dictionary<string, BaseControl> controls)
+    {
+        try
         {
-            try
+            var sliderLimitsPath = Path.Combine(Constants.databasePath, "face_slider_limits.json");
+            var sliderLimitsJson = File.ReadAllText(sliderLimitsPath);
+
+            foreach (var kvp in JsonConvert.DeserializeObject<Dictionary<string, float>>(sliderLimitsJson))
             {
-                var sliderLimitsPath = Path.Combine(Constants.databasePath, "face_slider_limits.json");
-                var sliderLimitsJson = File.ReadAllText(sliderLimitsPath);
+                var key = kvp.Key;
 
-                foreach (var kvp in JsonConvert.DeserializeObject<Dictionary<string, float>>(sliderLimitsJson))
+                if (faceKeys.Contains(key) && controls.ContainsKey(key))
                 {
-                    var key = kvp.Key;
+                    var limit = kvp.Value;
 
-                    if (faceKeys.Contains(key) && controls.ContainsKey(key))
-                    {
-                        var limit = kvp.Value;
+                    limit = kvp.Value >= 1f ? limit : SliderLimits[key];
 
-                        limit = kvp.Value >= 1f ? limit : SliderLimits[key];
+                    var slider = (Slider)controls[kvp.Key];
 
-                        var slider = (Slider)controls[kvp.Key];
-
-                        slider.SetBounds(slider.Left, limit);
-                    }
-                    else
-                        Utility.LogWarning($"'{key}' is not a valid face key");
+                    slider.SetBounds(slider.Left, limit);
                 }
-            }
-            catch (IOException e)
-            {
-                Utility.LogWarning($"Could not open face slider limit database because {e.Message}");
-            }
-            catch (Exception e)
-            {
-                Utility.LogError($"Could not apply face slider limit database because {e.Message}");
+                else
+                    Utility.LogWarning($"'{key}' is not a valid face key");
             }
         }
-
-        public MaidFaceSliderPane(MeidoManager meidoManager)
+        catch (IOException e)
+        {
+            Utility.LogWarning($"Could not open face slider limit database because {e.Message}");
+        }
+        catch (Exception e)
         {
-            this.meidoManager = meidoManager;
+            Utility.LogError($"Could not apply face slider limit database because {e.Message}");
+        }
+    }
 
-            faceControls = new();
+    public MaidFaceSliderPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            foreach (var key in faceKeys)
-            {
-                var uiName = Translation.Get("faceBlendValues", key);
-                var slider = new Slider(uiName, 0f, SliderLimits[key]);
-                var sliderKey = key;
+        faceControls = new();
 
-                slider.ControlEvent += (s, a) => SetFaceValue(sliderKey, slider.Value);
+        foreach (var key in faceKeys)
+        {
+            var uiName = Translation.Get("faceBlendValues", key);
+            var slider = new Slider(uiName, 0f, SliderLimits[key]);
+            var sliderKey = key;
 
-                faceControls[key] = slider;
-            }
+            slider.ControlEvent += (s, a) => SetFaceValue(sliderKey, slider.Value);
 
-            foreach (var key in faceToggleKeys)
-            {
-                var uiName = Translation.Get("faceBlendValues", key);
-                var toggle = new Toggle(uiName);
-                var sliderKey = key;
+            faceControls[key] = slider;
+        }
 
-                toggle.ControlEvent += (s, a) => SetFaceValue(sliderKey, toggle.Value);
+        foreach (var key in faceToggleKeys)
+        {
+            var uiName = Translation.Get("faceBlendValues", key);
+            var toggle = new Toggle(uiName);
+            var sliderKey = key;
 
-                faceControls[key] = toggle;
-            }
+            toggle.ControlEvent += (s, a) => SetFaceValue(sliderKey, toggle.Value);
 
-            InitializeSliderLimits(faceControls);
+            faceControls[key] = toggle;
         }
 
-        public override void UpdatePane()
-        {
-            updating = true;
-            var meido = meidoManager.ActiveMeido;
+        InitializeSliderLimits(faceControls);
+    }
 
-            for (var i = 0; i < faceKeys.Length; i++)
-            {
-                var slider = (Slider)faceControls[faceKeys[i]];
+    public override void UpdatePane()
+    {
+        updating = true;
+        var meido = meidoManager.ActiveMeido;
 
-                try
-                {
-                    slider.Value = meido.GetFaceBlendValue(faceKeys[i]);
-                }
-                catch { /* Ignored */ }
-            }
+        for (var i = 0; i < faceKeys.Length; i++)
+        {
+            var slider = (Slider)faceControls[faceKeys[i]];
 
-            for (var i = 0; i < faceToggleKeys.Length; i++)
+            try
             {
-                var hash = faceToggleKeys[i];
-                var toggle = (Toggle)faceControls[hash];
-
-                toggle.Value = meido.GetFaceBlendValue(hash) > 0f;
-
-                if (hash == "toothoff")
-                    toggle.Value = !toggle.Value;
+                slider.Value = meido.GetFaceBlendValue(faceKeys[i]);
             }
-
-            hasTangOpen = meido.Body.Face.morph.Contains("tangopen");
-            updating = false;
+            catch { /* Ignored */ }
         }
 
-        public override void Draw()
+        for (var i = 0; i < faceToggleKeys.Length; i++)
         {
-            GUI.enabled = meidoManager.HasActiveMeido;
-            DrawSliders("eyeclose", "eyeclose2");
-            DrawSliders("eyeclose3", "eyebig");
-            DrawSliders("eyeclose6", "eyeclose5");
-            DrawSliders("hitomih", "hitomis");
-            DrawSliders("mayuha", "mayuw");
-            DrawSliders("mayuup", "mayuv");
-            DrawSliders("mayuvhalf");
-            DrawSliders("moutha", "mouths");
-            DrawSliders("mouthc", "mouthi");
-            DrawSliders("mouthup", "mouthdw");
-            DrawSliders("mouthhe", "mouthuphalf");
-            DrawSliders("tangout", "tangup");
-
-            if (hasTangOpen)
-                DrawSliders("tangopen");
-
-            MpsGui.WhiteLine();
-            DrawToggles("hoho2", "shock", "nosefook");
-            DrawToggles("namida", "yodare", "toothoff");
-            DrawToggles("tear1", "tear2", "tear3");
-            DrawToggles("hohos", "hoho", "hohol");
-            GUI.enabled = true;
+            var hash = faceToggleKeys[i];
+            var toggle = (Toggle)faceControls[hash];
+
+            toggle.Value = meido.GetFaceBlendValue(hash) > 0f;
+
+            if (hash == "toothoff")
+                toggle.Value = !toggle.Value;
         }
 
-        protected override void ReloadTranslation()
-        {
-            for (var i = 0; i < faceKeys.Length; i++)
-            {
-                var slider = (Slider)faceControls[faceKeys[i]];
+        hasTangOpen = meido.Body.Face.morph.Contains("tangopen");
+        updating = false;
+    }
 
-                slider.Label = Translation.Get("faceBlendValues", faceKeys[i]);
-            }
+    public override void Draw()
+    {
+        GUI.enabled = meidoManager.HasActiveMeido;
+        DrawSliders("eyeclose", "eyeclose2");
+        DrawSliders("eyeclose3", "eyebig");
+        DrawSliders("eyeclose6", "eyeclose5");
+        DrawSliders("hitomih", "hitomis");
+        DrawSliders("mayuha", "mayuw");
+        DrawSliders("mayuup", "mayuv");
+        DrawSliders("mayuvhalf");
+        DrawSliders("moutha", "mouths");
+        DrawSliders("mouthc", "mouthi");
+        DrawSliders("mouthup", "mouthdw");
+        DrawSliders("mouthhe", "mouthuphalf");
+        DrawSliders("tangout", "tangup");
+
+        if (hasTangOpen)
+            DrawSliders("tangopen");
+
+        MpsGui.WhiteLine();
+        DrawToggles("hoho2", "shock", "nosefook");
+        DrawToggles("namida", "yodare", "toothoff");
+        DrawToggles("tear1", "tear2", "tear3");
+        DrawToggles("hohos", "hoho", "hohol");
+        GUI.enabled = true;
+    }
 
-            for (var i = 0; i < faceToggleKeys.Length; i++)
-            {
-                var toggle = (Toggle)faceControls[faceToggleKeys[i]];
+    protected override void ReloadTranslation()
+    {
+        for (var i = 0; i < faceKeys.Length; i++)
+        {
+            var slider = (Slider)faceControls[faceKeys[i]];
 
-                toggle.Label = Translation.Get("faceBlendValues", faceToggleKeys[i]);
-            }
+            slider.Label = Translation.Get("faceBlendValues", faceKeys[i]);
         }
 
-        private void DrawSliders(params string[] keys)
+        for (var i = 0; i < faceToggleKeys.Length; i++)
         {
-            GUILayout.BeginHorizontal();
+            var toggle = (Toggle)faceControls[faceToggleKeys[i]];
 
-            foreach (var key in keys)
-                faceControls[key].Draw(MpsGui.HalfSlider);
-
-            GUILayout.EndHorizontal();
+            toggle.Label = Translation.Get("faceBlendValues", faceToggleKeys[i]);
         }
+    }
 
-        private void DrawToggles(params string[] keys)
-        {
-            GUILayout.BeginHorizontal();
+    private void DrawSliders(params string[] keys)
+    {
+        GUILayout.BeginHorizontal();
 
-            foreach (var key in keys)
-                faceControls[key].Draw();
+        foreach (var key in keys)
+            faceControls[key].Draw(MpsGui.HalfSlider);
 
-            GUILayout.EndHorizontal();
-        }
+        GUILayout.EndHorizontal();
+    }
 
-        private void SetFaceValue(string key, float value)
-        {
-            if (updating)
-                return;
+    private void DrawToggles(params string[] keys)
+    {
+        GUILayout.BeginHorizontal();
 
-            meidoManager.ActiveMeido.SetFaceBlendValue(key, value);
-        }
+        foreach (var key in keys)
+            faceControls[key].Draw();
 
-        private void SetFaceValue(string key, bool value)
-        {
-            if (key == "toothoff")
-                value = !value;
+        GUILayout.EndHorizontal();
+    }
 
-            SetFaceValue(key, value ? 1f : 0f);
-        }
+    private void SetFaceValue(string key, float value)
+    {
+        if (updating)
+            return;
+
+        meidoManager.ActiveMeido.SetFaceBlendValue(key, value);
+    }
+
+    private void SetFaceValue(string key, bool value)
+    {
+        if (key == "toothoff")
+            value = !value;
+
+        SetFaceValue(key, value ? 1f : 0f);
     }
 }

+ 46 - 47
src/MeidoPhotoStudio.Plugin/GUI/Panes/FaceWindowPanes/SaveFacePane.cs

@@ -1,67 +1,66 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SaveFacePane : BasePane
 {
-    public class SaveFacePane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly ComboBox categoryComboBox;
-        private readonly TextField faceNameTextField;
-        private readonly Button saveFaceButton;
+    private readonly MeidoManager meidoManager;
+    private readonly ComboBox categoryComboBox;
+    private readonly TextField faceNameTextField;
+    private readonly Button saveFaceButton;
 
-        private string categoryHeader;
-        private string nameHeader;
+    private string categoryHeader;
+    private string nameHeader;
 
-        public SaveFacePane(MeidoManager meidoManager)
-        {
-            Constants.CustomFaceChange += (s, a) =>
-                categoryComboBox.SetDropdownItems(Constants.CustomFaceGroupList.ToArray());
+    public SaveFacePane(MeidoManager meidoManager)
+    {
+        Constants.CustomFaceChange += (s, a) =>
+            categoryComboBox.SetDropdownItems(Constants.CustomFaceGroupList.ToArray());
 
-            this.meidoManager = meidoManager;
+        this.meidoManager = meidoManager;
 
-            categoryHeader = Translation.Get("faceSave", "categoryHeader");
-            nameHeader = Translation.Get("faceSave", "nameHeader");
+        categoryHeader = Translation.Get("faceSave", "categoryHeader");
+        nameHeader = Translation.Get("faceSave", "nameHeader");
 
-            saveFaceButton = new(Translation.Get("faceSave", "saveButton"));
-            saveFaceButton.ControlEvent += (s, a) => SaveFace();
+        saveFaceButton = new(Translation.Get("faceSave", "saveButton"));
+        saveFaceButton.ControlEvent += (s, a) => SaveFace();
 
-            categoryComboBox = new(Constants.CustomFaceGroupList.ToArray());
+        categoryComboBox = new(Constants.CustomFaceGroupList.ToArray());
 
-            faceNameTextField = new();
-        }
+        faceNameTextField = new();
+    }
 
-        public override void Draw()
-        {
-            GUI.enabled = meidoManager.HasActiveMeido;
+    public override void Draw()
+    {
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            MpsGui.Header(categoryHeader);
-            categoryComboBox.Draw(GUILayout.Width(165f));
+        MpsGui.Header(categoryHeader);
+        categoryComboBox.Draw(GUILayout.Width(165f));
 
-            MpsGui.Header(nameHeader);
-            GUILayout.BeginHorizontal();
-            faceNameTextField.Draw(GUILayout.Width(160f));
-            saveFaceButton.Draw(GUILayout.ExpandWidth(false));
-            GUILayout.EndHorizontal();
+        MpsGui.Header(nameHeader);
+        GUILayout.BeginHorizontal();
+        faceNameTextField.Draw(GUILayout.Width(160f));
+        saveFaceButton.Draw(GUILayout.ExpandWidth(false));
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            categoryHeader = Translation.Get("faceSave", "categoryHeader");
-            nameHeader = Translation.Get("faceSave", "nameHeader");
-            saveFaceButton.Label = Translation.Get("faceSave", "saveButton");
-        }
+    protected override void ReloadTranslation()
+    {
+        categoryHeader = Translation.Get("faceSave", "categoryHeader");
+        nameHeader = Translation.Get("faceSave", "nameHeader");
+        saveFaceButton.Label = Translation.Get("faceSave", "saveButton");
+    }
 
-        private void SaveFace()
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    private void SaveFace()
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            var meido = meidoManager.ActiveMeido;
+        var meido = meidoManager.ActiveMeido;
 
-            Constants.AddFacePreset(meido.SerializeFace(), faceNameTextField.Value, categoryComboBox.Value);
-            faceNameTextField.Value = string.Empty;
-        }
+        Constants.AddFacePreset(meido.SerializeFace(), faceNameTextField.Value, categoryComboBox.Value);
+        faceNameTextField.Value = string.Empty;
     }
 }

+ 55 - 56
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/BG2WindowPane.cs

@@ -1,62 +1,61 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BG2WindowPane : BaseMainWindowPane
 {
-    public class BG2WindowPane : BaseMainWindowPane
+    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)
     {
-        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.FromPropSelect += (s, a) => propTabs.SelectedItemIndex = 0;
-
-            // should be added in this order
-            AddPane(new PropsPane(propManager));
-            AddPane(new MyRoomPropsPane(propManager));
-            AddPane(new ModPropsPane(propManager));
-
-            attachPropPane = AddPane(new AttachPropPane(this.meidoManager, propManager));
-            propManagerPane = AddPane(new PropManagerPane(propManager));
-
-            propTabs = new(Translation.GetArray("propsPaneTabs", tabNames));
-            propTabs.ControlEvent += (s, a) => currentPropsPane = Panes[propTabs.SelectedItemIndex];
-
-            currentPropsPane = Panes[0];
-        }
-
-        public override void Draw()
-        {
-            tabsPane.Draw();
-            propTabs.Draw();
-            MpsGui.WhiteLine();
-            currentPropsPane.Draw();
-
-            if (propTabs.SelectedItemIndex != 0)
-                return;
-
-            propManagerPane.Draw();
-            scrollPos = GUILayout.BeginScrollView(scrollPos);
-            attachPropPane.Draw();
-            GUILayout.EndScrollView();
-        }
-
-        public override void UpdatePanes()
-        {
-            if (ActiveWindow)
-                base.UpdatePanes();
-        }
-
-        protected override void ReloadTranslation() =>
-            propTabs.SetItems(Translation.GetArray("propsPaneTabs", tabNames));
+        this.meidoManager = meidoManager;
+        this.propManager = propManager;
+        this.propManager.FromPropSelect += (s, a) => propTabs.SelectedItemIndex = 0;
+
+        // should be added in this order
+        AddPane(new PropsPane(propManager));
+        AddPane(new MyRoomPropsPane(propManager));
+        AddPane(new ModPropsPane(propManager));
+
+        attachPropPane = AddPane(new AttachPropPane(this.meidoManager, propManager));
+        propManagerPane = AddPane(new PropManagerPane(propManager));
+
+        propTabs = new(Translation.GetArray("propsPaneTabs", tabNames));
+        propTabs.ControlEvent += (s, a) => currentPropsPane = Panes[propTabs.SelectedItemIndex];
+
+        currentPropsPane = Panes[0];
     }
+
+    public override void Draw()
+    {
+        tabsPane.Draw();
+        propTabs.Draw();
+        MpsGui.WhiteLine();
+        currentPropsPane.Draw();
+
+        if (propTabs.SelectedItemIndex != 0)
+            return;
+
+        propManagerPane.Draw();
+        scrollPos = GUILayout.BeginScrollView(scrollPos);
+        attachPropPane.Draw();
+        GUILayout.EndScrollView();
+    }
+
+    public override void UpdatePanes()
+    {
+        if (ActiveWindow)
+            base.UpdatePanes();
+    }
+
+    protected override void ReloadTranslation() =>
+        propTabs.SetItems(Translation.GetArray("propsPaneTabs", tabNames));
 }

+ 49 - 50
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/BGWindowPane.cs

@@ -1,64 +1,63 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class BGWindowPane : BaseMainWindowPane
-    {
-        private readonly BackgroundSelectorPane backgroundSelectorPane;
-        private readonly CameraPane cameraPane;
-        private readonly LightsPane lightsPane;
-        private readonly EffectsPane effectsPane;
-        private readonly DragPointPane dragPointPane;
-        private readonly OtherEffectsPane otherEffectsPane;
-        private readonly Button sceneManagerButton;
+namespace MeidoPhotoStudio.Plugin;
 
-        public BGWindowPane(
+public class BGWindowPane : BaseMainWindowPane
+{
+    private readonly BackgroundSelectorPane backgroundSelectorPane;
+    private readonly CameraPane cameraPane;
+    private readonly LightsPane lightsPane;
+    private readonly EffectsPane effectsPane;
+    private readonly DragPointPane dragPointPane;
+    private readonly OtherEffectsPane otherEffectsPane;
+    private readonly Button sceneManagerButton;
+
+    public BGWindowPane(
             EnvironmentManager environmentManager, LightManager lightManager, EffectManager effectManager,
             SceneWindow sceneWindow, CameraManager cameraManager
-        )
+            )
+    {
+        sceneManagerButton = new(Translation.Get("backgroundWindow", "manageScenesButton"));
+        sceneManagerButton.ControlEvent += (s, a) => sceneWindow.Visible = !sceneWindow.Visible;
+
+        backgroundSelectorPane = AddPane(new BackgroundSelectorPane(environmentManager));
+        cameraPane = AddPane(new CameraPane(cameraManager));
+        dragPointPane = AddPane(new DragPointPane());
+        lightsPane = AddPane(new LightsPane(lightManager));
+        effectsPane = AddPane(new EffectsPane()
         {
-            sceneManagerButton = new(Translation.Get("backgroundWindow", "manageScenesButton"));
-            sceneManagerButton.ControlEvent += (s, a) => sceneWindow.Visible = !sceneWindow.Visible;
+            ["bloom"] = new BloomPane(effectManager),
+            ["dof"] = new DepthOfFieldPane(effectManager),
+            ["vignette"] = new VignettePane(effectManager),
+            ["fog"] = new FogPane(effectManager)
+        });
 
-            backgroundSelectorPane = AddPane(new BackgroundSelectorPane(environmentManager));
-            cameraPane = AddPane(new CameraPane(cameraManager));
-            dragPointPane = AddPane(new DragPointPane());
-            lightsPane = AddPane(new LightsPane(lightManager));
-            effectsPane = AddPane(new EffectsPane()
-            {
-                ["bloom"] = new BloomPane(effectManager),
-                ["dof"] = new DepthOfFieldPane(effectManager),
-                ["vignette"] = new VignettePane(effectManager),
-                ["fog"] = new FogPane(effectManager)
-            });
-
-            otherEffectsPane = AddPane(new OtherEffectsPane(effectManager));
-        }
-
-        public override void Draw()
-        {
-            tabsPane.Draw();
-            sceneManagerButton.Draw();
-            backgroundSelectorPane.Draw();
-            dragPointPane.Draw();
+        otherEffectsPane = AddPane(new OtherEffectsPane(effectManager));
+    }
 
-            scrollPos = GUILayout.BeginScrollView(scrollPos);
+    public override void Draw()
+    {
+        tabsPane.Draw();
+        sceneManagerButton.Draw();
+        backgroundSelectorPane.Draw();
+        dragPointPane.Draw();
 
-            cameraPane.Draw();
-            lightsPane.Draw();
-            effectsPane.Draw();
-            otherEffectsPane.Draw();
+        scrollPos = GUILayout.BeginScrollView(scrollPos);
 
-            GUILayout.EndScrollView();
-        }
+        cameraPane.Draw();
+        lightsPane.Draw();
+        effectsPane.Draw();
+        otherEffectsPane.Draw();
 
-        public override void UpdatePanes()
-        {
-            if (ActiveWindow)
-                base.UpdatePanes();
-        }
+        GUILayout.EndScrollView();
+    }
 
-        protected override void ReloadTranslation() =>
-            sceneManagerButton.Label = Translation.Get("backgroundWindow", "manageScenesButton");
+    public override void UpdatePanes()
+    {
+        if (ActiveWindow)
+            base.UpdatePanes();
     }
+
+    protected override void ReloadTranslation() =>
+        sceneManagerButton.Label = Translation.Get("backgroundWindow", "manageScenesButton");
 }

+ 6 - 7
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/BaseMainWindowPane.cs

@@ -1,10 +1,9 @@
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class BaseMainWindowPane : BaseWindow
 {
-    public abstract class BaseMainWindowPane : BaseWindow
-    {
-        protected TabsPane tabsPane;
+    protected TabsPane tabsPane;
 
-        public void SetTabsPane(TabsPane tabsPane) =>
-            this.tabsPane = tabsPane;
-    }
+    public void SetTabsPane(TabsPane tabsPane) =>
+        this.tabsPane = tabsPane;
 }

+ 31 - 32
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/CallWindowPane.cs

@@ -1,49 +1,48 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class CallWindowPane : BaseMainWindowPane
 {
-    public class CallWindowPane : BaseMainWindowPane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly MaidSelectorPane maidSelectorPane;
-        private readonly Dropdown placementDropdown;
-        private readonly Button placementOKButton;
+    private readonly MeidoManager meidoManager;
+    private readonly MaidSelectorPane maidSelectorPane;
+    private readonly Dropdown placementDropdown;
+    private readonly Button placementOKButton;
 
-        public CallWindowPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+    public CallWindowPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            placementDropdown = new(
+        placementDropdown = new(
                 Translation.GetArray("placementDropdown", MaidPlacementUtility.placementTypes)
-            );
+                );
 
-            placementOKButton = new(Translation.Get("maidCallWindow", "okButton"));
-            placementOKButton.ControlEvent += (o, a) => this.meidoManager.PlaceMeidos(
+        placementOKButton = new(Translation.Get("maidCallWindow", "okButton"));
+        placementOKButton.ControlEvent += (o, a) => this.meidoManager.PlaceMeidos(
                 MaidPlacementUtility.placementTypes[placementDropdown.SelectedItemIndex]
-            );
+                );
 
-            maidSelectorPane = AddPane(new MaidSelectorPane(this.meidoManager));
-        }
+        maidSelectorPane = AddPane(new MaidSelectorPane(this.meidoManager));
+    }
 
-        public override void Draw()
-        {
-            tabsPane.Draw();
+    public override void Draw()
+    {
+        tabsPane.Draw();
 
-            GUILayout.BeginHorizontal();
-            placementDropdown.Draw(GUILayout.Width(150));
-            placementOKButton.Draw();
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        placementDropdown.Draw(GUILayout.Width(150));
+        placementOKButton.Draw();
+        GUILayout.EndHorizontal();
 
-            maidSelectorPane.Draw();
-        }
+        maidSelectorPane.Draw();
+    }
 
-        protected override void ReloadTranslation()
-        {
-            placementDropdown.SetDropdownItems(
+    protected override void ReloadTranslation()
+    {
+        placementDropdown.SetDropdownItems(
                 Translation.GetArray("placementDropdown", MaidPlacementUtility.placementTypes)
-            );
+                );
 
-            placementOKButton.Label = Translation.Get("maidCallWindow", "okButton");
-        }
+        placementOKButton.Label = Translation.Get("maidCallWindow", "okButton");
     }
 }

+ 45 - 46
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/FaceWindowPane.cs

@@ -1,66 +1,65 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class FaceWindowPane : BaseMainWindowPane
 {
-    public class FaceWindowPane : BaseMainWindowPane
+    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;
+
+    public FaceWindowPane(MeidoManager meidoManager, 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;
-
-        public FaceWindowPane(MeidoManager meidoManager, MaidSwitcherPane maidSwitcherPane)
-        {
-            this.meidoManager = meidoManager;
+        this.meidoManager = meidoManager;
 
-            this.maidSwitcherPane = maidSwitcherPane;
+        this.maidSwitcherPane = maidSwitcherPane;
 
-            maidFaceSliderPane = AddPane(new MaidFaceSliderPane(this.meidoManager));
-            maidFaceBlendPane = AddPane(new MaidFaceBlendPane(this.meidoManager));
-            saveFacePane = AddPane(new SaveFacePane(this.meidoManager));
+        maidFaceSliderPane = AddPane(new MaidFaceSliderPane(this.meidoManager));
+        maidFaceBlendPane = AddPane(new MaidFaceBlendPane(this.meidoManager));
+        saveFacePane = AddPane(new SaveFacePane(this.meidoManager));
 
-            saveFaceToggle = new(Translation.Get("maidFaceWindow", "savePaneToggle"));
-            saveFaceToggle.ControlEvent += (s, a) => saveFaceMode = !saveFaceMode;
-        }
+        saveFaceToggle = new(Translation.Get("maidFaceWindow", "savePaneToggle"));
+        saveFaceToggle.ControlEvent += (s, a) => saveFaceMode = !saveFaceMode;
+    }
 
-        public override void Draw()
-        {
-            tabsPane.Draw();
-            maidSwitcherPane.Draw();
+    public override void Draw()
+    {
+        tabsPane.Draw();
+        maidSwitcherPane.Draw();
 
-            maidFaceBlendPane.Draw();
+        maidFaceBlendPane.Draw();
 
-            scrollPos = GUILayout.BeginScrollView(scrollPos);
+        scrollPos = GUILayout.BeginScrollView(scrollPos);
 
-            maidFaceSliderPane.Draw();
+        maidFaceSliderPane.Draw();
 
-            GUI.enabled = meidoManager.HasActiveMeido;
-            saveFaceToggle.Draw();
-            GUI.enabled = true;
+        GUI.enabled = meidoManager.HasActiveMeido;
+        saveFaceToggle.Draw();
+        GUI.enabled = true;
 
-            if (saveFaceMode)
-                saveFacePane.Draw();
+        if (saveFaceMode)
+            saveFacePane.Draw();
 
-            GUILayout.EndScrollView();
-        }
+        GUILayout.EndScrollView();
+    }
 
-        public override void UpdatePanes()
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    public override void UpdatePanes()
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            if (ActiveWindow)
-            {
-                meidoManager.ActiveMeido.StopBlink();
+        if (ActiveWindow)
+        {
+            meidoManager.ActiveMeido.StopBlink();
 
-                base.UpdatePanes();
-            }
+            base.UpdatePanes();
         }
-
-        protected override void ReloadTranslation() =>
-            saveFaceToggle.Label = Translation.Get("maidFaceWindow", "savePaneToggle");
     }
+
+    protected override void ReloadTranslation() =>
+        saveFaceToggle.Label = Translation.Get("maidFaceWindow", "savePaneToggle");
 }

+ 115 - 117
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/PoseWindowPane.cs

@@ -1,155 +1,153 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class PoseWindowPane : BaseMainWindowPane
 {
-    public class PoseWindowPane : BaseMainWindowPane
+    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;
+    private bool saveHandMode;
+    private string handPresetHeader;
+    private string flipIKHeader;
+
+    public PoseWindowPane(MeidoManager meidoManager, MaidSwitcherPane maidSwitcherPane)
     {
-        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;
-        private bool saveHandMode;
-        private string handPresetHeader;
-        private string flipIKHeader;
-
-        public PoseWindowPane(MeidoManager meidoManager, MaidSwitcherPane maidSwitcherPane)
-        {
-            this.meidoManager = meidoManager;
-            this.maidSwitcherPane = maidSwitcherPane;
-
-            maidPosePane = AddPane(new MaidPoseSelectorPane(meidoManager));
-            savePosePane = AddPane(new SavePosePane(meidoManager));
+        this.meidoManager = meidoManager;
+        this.maidSwitcherPane = maidSwitcherPane;
 
-            maidFaceLookPane = AddPane(new MaidFaceLookPane(meidoManager));
-            maidFaceLookPane.Enabled = false;
+        maidPosePane = AddPane(new MaidPoseSelectorPane(meidoManager));
+        savePosePane = AddPane(new SavePosePane(meidoManager));
 
-            freeLookToggle = new(Translation.Get("freeLookPane", "freeLookToggle"), false);
-            freeLookToggle.ControlEvent += (s, a) => SetMaidFreeLook();
+        maidFaceLookPane = AddPane(new MaidFaceLookPane(meidoManager));
+        maidFaceLookPane.Enabled = false;
 
-            savePoseToggle = new(Translation.Get("posePane", "saveToggle"));
-            savePoseToggle.ControlEvent += (s, a) => savePoseMode = !savePoseMode;
+        freeLookToggle = new(Translation.Get("freeLookPane", "freeLookToggle"), false);
+        freeLookToggle.ControlEvent += (s, a) => SetMaidFreeLook();
 
-            // TODO: Why are only some panes added to the pane list?
-            mpnAttachPropPane = new(this.meidoManager);
+        savePoseToggle = new(Translation.Get("posePane", "saveToggle"));
+        savePoseToggle.ControlEvent += (s, a) => savePoseMode = !savePoseMode;
 
-            maidDressingPane = AddPane(new MaidDressingPane(this.meidoManager));
-            maidIKPane = AddPane(new MaidIKPane(this.meidoManager));
-            gravityControlPane = AddPane(new GravityControlPane(this.meidoManager));
-            copyPosePane = AddPane(new CopyPosePane(this.meidoManager));
+        // TODO: Why are only some panes added to the pane list?
+        mpnAttachPropPane = new(this.meidoManager);
 
-            saveHandToggle = new(Translation.Get("handPane", "saveToggle"));
-            saveHandToggle.ControlEvent += (s, a) => saveHandMode = !saveHandMode;
+        maidDressingPane = AddPane(new MaidDressingPane(this.meidoManager));
+        maidIKPane = AddPane(new MaidIKPane(this.meidoManager));
+        gravityControlPane = AddPane(new GravityControlPane(this.meidoManager));
+        copyPosePane = AddPane(new CopyPosePane(this.meidoManager));
 
-            handPresetPane = AddPane(new HandPresetPane(meidoManager));
-            saveHandPane = AddPane(new SaveHandPane(meidoManager));
+        saveHandToggle = new(Translation.Get("handPane", "saveToggle"));
+        saveHandToggle.ControlEvent += (s, a) => saveHandMode = !saveHandMode;
 
-            flipButton = new(Translation.Get("flipIK", "flipButton"));
-            flipButton.ControlEvent += (s, a) => this.meidoManager.ActiveMeido.IKManager.Flip();
-
-            handPresetHeader = Translation.Get("handPane", "header");
-            flipIKHeader = Translation.Get("flipIK", "header");
-        }
+        handPresetPane = AddPane(new HandPresetPane(meidoManager));
+        saveHandPane = AddPane(new SaveHandPane(meidoManager));
 
-        public override void Draw()
-        {
-            tabsPane.Draw();
+        flipButton = new(Translation.Get("flipIK", "flipButton"));
+        flipButton.ControlEvent += (s, a) => this.meidoManager.ActiveMeido.IKManager.Flip();
 
-            maidSwitcherPane.Draw();
-            maidPosePane.Draw();
+        handPresetHeader = Translation.Get("handPane", "header");
+        flipIKHeader = Translation.Get("flipIK", "header");
+    }
 
-            maidIKPane.Draw();
+    public override void Draw()
+    {
+        tabsPane.Draw();
 
-            MpsGui.WhiteLine();
+        maidSwitcherPane.Draw();
+        maidPosePane.Draw();
 
-            scrollPos = GUILayout.BeginScrollView(scrollPos);
+        maidIKPane.Draw();
 
-            GUI.enabled = meidoManager.HasActiveMeido;
-            GUILayout.BeginHorizontal();
-            freeLookToggle.Draw();
-            savePoseToggle.Draw();
-            GUILayout.EndHorizontal();
-            GUI.enabled = true;
+        MpsGui.WhiteLine();
 
-            if (savePoseMode)
-                savePosePane.Draw();
-            else
-                maidFaceLookPane.Draw();
+        scrollPos = GUILayout.BeginScrollView(scrollPos);
 
-            mpnAttachPropPane.Draw();
+        GUI.enabled = meidoManager.HasActiveMeido;
+        GUILayout.BeginHorizontal();
+        freeLookToggle.Draw();
+        savePoseToggle.Draw();
+        GUILayout.EndHorizontal();
+        GUI.enabled = true;
 
-            maidDressingPane.Draw();
+        if (savePoseMode)
+            savePosePane.Draw();
+        else
+            maidFaceLookPane.Draw();
 
-            GUI.enabled = meidoManager.HasActiveMeido;
-            MpsGui.Header(handPresetHeader);
-            MpsGui.WhiteLine();
-            saveHandToggle.Draw();
-            GUI.enabled = true;
+        mpnAttachPropPane.Draw();
 
-            if (saveHandMode)
-                saveHandPane.Draw();
-            else
-                handPresetPane.Draw();
+        maidDressingPane.Draw();
 
-            gravityControlPane.Draw();
+        GUI.enabled = meidoManager.HasActiveMeido;
+        MpsGui.Header(handPresetHeader);
+        MpsGui.WhiteLine();
+        saveHandToggle.Draw();
+        GUI.enabled = true;
 
-            copyPosePane.Draw();
+        if (saveHandMode)
+            saveHandPane.Draw();
+        else
+            handPresetPane.Draw();
 
-            GUILayout.BeginHorizontal();
-            GUI.enabled = meidoManager.HasActiveMeido;
-            GUILayout.Label(flipIKHeader, GUILayout.ExpandWidth(false));
-            flipButton.Draw(GUILayout.ExpandWidth(false));
-            GUI.enabled = true;
-            GUILayout.EndHorizontal();
+        gravityControlPane.Draw();
 
-            GUILayout.EndScrollView();
-        }
+        copyPosePane.Draw();
 
-        public override void UpdatePanes()
-        {
-            if (meidoManager.ActiveMeido == null)
-                return;
+        GUILayout.BeginHorizontal();
+        GUI.enabled = meidoManager.HasActiveMeido;
+        GUILayout.Label(flipIKHeader, GUILayout.ExpandWidth(false));
+        flipButton.Draw(GUILayout.ExpandWidth(false));
+        GUI.enabled = true;
+        GUILayout.EndHorizontal();
 
-            if (ActiveWindow)
-            {
-                updating = true;
-                freeLookToggle.Value = meidoManager.ActiveMeido?.FreeLook ?? false;
-                updating = false;
+        GUILayout.EndScrollView();
+    }
 
-                base.UpdatePanes();
-            }
-        }
+    public override void UpdatePanes()
+    {
+        if (meidoManager.ActiveMeido == null)
+            return;
 
-        protected override void ReloadTranslation()
+        if (ActiveWindow)
         {
-            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");
+            updating = true;
+            freeLookToggle.Value = meidoManager.ActiveMeido?.FreeLook ?? false;
+            updating = false;
+
+            base.UpdatePanes();
         }
+    }
 
+    protected override void ReloadTranslation()
+    {
+        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");
+    }
 
-        private void SetMaidFreeLook()
-        {
-            if (updating)
-                return;
+    private void SetMaidFreeLook()
+    {
+        if (updating)
+            return;
 
-            meidoManager.ActiveMeido.FreeLook = freeLookToggle.Value;
-        }
+        meidoManager.ActiveMeido.FreeLook = freeLookToggle.Value;
     }
 }

+ 100 - 101
src/MeidoPhotoStudio.Plugin/GUI/Panes/MainWindowPanes/SettingsWindowPane.cs

@@ -3,143 +3,142 @@ using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class SettingsWindowPane : BaseMainWindowPane
-    {
-        private static readonly string[] headerTranslationKeys = {
-            "controls", "controlsGeneral", "controlsMaids", "controlsCamera", "controlsDragPoint", "controlsScene"
-        };
+namespace MeidoPhotoStudio.Plugin;
 
-        private static readonly Dictionary<string, string> headers = new();
-        private static readonly string[] actionTranslationKeys;
-        private static readonly string[] actionLabels;
+public class SettingsWindowPane : BaseMainWindowPane
+{
+    private static readonly string[] headerTranslationKeys = {
+        "controls", "controlsGeneral", "controlsMaids", "controlsCamera", "controlsDragPoint", "controlsScene"
+    };
 
-        private readonly Button reloadTranslationButton;
-        private readonly Button reloadAllPresetsButton;
-        private readonly KeyRebindButton[] rebindButtons;
+    private static readonly Dictionary<string, string> headers = new();
+    private static readonly string[] actionTranslationKeys;
+    private static readonly string[] actionLabels;
 
-        static SettingsWindowPane()
-        {
-            actionTranslationKeys = Enum.GetNames(typeof(MpsKey))
-                .Select(action => char.ToLowerInvariant(action[0]) + action.Substring(1))
-                .ToArray();
-            actionLabels = new string[actionTranslationKeys.Length];
-        }
+    private readonly Button reloadTranslationButton;
+    private readonly Button reloadAllPresetsButton;
+    private readonly KeyRebindButton[] rebindButtons;
 
-        public SettingsWindowPane()
-        {
-            rebindButtons = new KeyRebindButton[actionTranslationKeys.Length];
+    static SettingsWindowPane()
+    {
+        actionTranslationKeys = Enum.GetNames(typeof(MpsKey))
+            .Select(action => char.ToLowerInvariant(action[0]) + action.Substring(1))
+            .ToArray();
+        actionLabels = new string[actionTranslationKeys.Length];
+    }
 
-            for (var i = 0; i < rebindButtons.Length; i++)
-            {
-                var action = (MpsKey)i;
-                var button = new KeyRebindButton(KeyCode.None);
+    public SettingsWindowPane()
+    {
+        rebindButtons = new KeyRebindButton[actionTranslationKeys.Length];
 
-                button.ControlEvent += (s, a) => InputManager.Rebind(action, button.KeyCode);
-                rebindButtons[i] = button;
+        for (var i = 0; i < rebindButtons.Length; i++)
+        {
+            var action = (MpsKey)i;
+            var button = new KeyRebindButton(KeyCode.None);
 
-                actionLabels[i] = Translation.Get("controls", actionTranslationKeys[i]);
-            }
+            button.ControlEvent += (s, a) => InputManager.Rebind(action, button.KeyCode);
+            rebindButtons[i] = button;
 
-            for (var i = 0; i < headerTranslationKeys.Length; i++)
-                headers[headerTranslationKeys[i]] = Translation.Get("settingsHeaders", headerTranslationKeys[i]);
+            actionLabels[i] = Translation.Get("controls", actionTranslationKeys[i]);
+        }
 
-            reloadTranslationButton = new(Translation.Get("settingsLabels", "reloadTranslation"));
-            reloadTranslationButton.ControlEvent += (s, a) => Translation.ReinitializeTranslation();
+        for (var i = 0; i < headerTranslationKeys.Length; i++)
+            headers[headerTranslationKeys[i]] = Translation.Get("settingsHeaders", headerTranslationKeys[i]);
 
-            reloadAllPresetsButton = new(Translation.Get("settingsLabels", "reloadAllPresets"));
-            reloadAllPresetsButton.ControlEvent += (s, a) =>
-            {
-                Constants.InitializeCustomFaceBlends();
-                Constants.InitializeHandPresets();
-                Constants.InitializeCustomPoses();
-            };
-        }
+        reloadTranslationButton = new(Translation.Get("settingsLabels", "reloadTranslation"));
+        reloadTranslationButton.ControlEvent += (s, a) => Translation.ReinitializeTranslation();
 
-        public override void Draw()
+        reloadAllPresetsButton = new(Translation.Get("settingsLabels", "reloadAllPresets"));
+        reloadAllPresetsButton.ControlEvent += (s, a) =>
         {
-            scrollPos = GUILayout.BeginScrollView(scrollPos);
+            Constants.InitializeCustomFaceBlends();
+            Constants.InitializeHandPresets();
+            Constants.InitializeCustomPoses();
+        };
+    }
 
-            MpsGui.Header(headers["controls"]);
-            MpsGui.WhiteLine();
+    public override void Draw()
+    {
+        scrollPos = GUILayout.BeginScrollView(scrollPos);
 
-            MpsGui.Header(headers["controlsGeneral"]);
-            MpsGui.WhiteLine();
+        MpsGui.Header(headers["controls"]);
+        MpsGui.WhiteLine();
 
-            for (var key = MpsKey.Activate; key <= MpsKey.ToggleMessage; key++)
-                DrawSetting(key);
+        MpsGui.Header(headers["controlsGeneral"]);
+        MpsGui.WhiteLine();
 
-            MpsGui.Header(headers["controlsMaids"]);
-            MpsGui.WhiteLine();
-            DrawSetting(MpsKey.MeidoUndressing);
+        for (var key = MpsKey.Activate; key <= MpsKey.ToggleMessage; key++)
+            DrawSetting(key);
 
-            MpsGui.Header(headers["controlsCamera"]);
-            MpsGui.WhiteLine();
+        MpsGui.Header(headers["controlsMaids"]);
+        MpsGui.WhiteLine();
+        DrawSetting(MpsKey.MeidoUndressing);
 
-            for (var key = MpsKey.CameraLayer; key <= MpsKey.CameraLoad; key++)
-                DrawSetting(key);
+        MpsGui.Header(headers["controlsCamera"]);
+        MpsGui.WhiteLine();
 
-            MpsGui.Header(headers["controlsDragPoint"]);
-            MpsGui.WhiteLine();
+        for (var key = MpsKey.CameraLayer; key <= MpsKey.CameraLoad; key++)
+            DrawSetting(key);
 
-            for (var key = MpsKey.DragSelect; key <= MpsKey.DragFinger; key++)
-                DrawSetting(key);
+        MpsGui.Header(headers["controlsDragPoint"]);
+        MpsGui.WhiteLine();
 
-            MpsGui.Header(headers["controlsScene"]);
-            MpsGui.WhiteLine();
+        for (var key = MpsKey.DragSelect; key <= MpsKey.DragFinger; key++)
+            DrawSetting(key);
 
-            for (var key = MpsKey.SaveScene; key <= MpsKey.OpenSceneManager; key++)
-                DrawSetting(key);
+        MpsGui.Header(headers["controlsScene"]);
+        MpsGui.WhiteLine();
 
-            GUI.enabled = !InputManager.Listening;
+        for (var key = MpsKey.SaveScene; key <= MpsKey.OpenSceneManager; key++)
+            DrawSetting(key);
 
-            // Translation settings
-            MpsGui.WhiteLine();
-            reloadTranslationButton.Draw();
+        GUI.enabled = !InputManager.Listening;
 
-            reloadAllPresetsButton.Draw();
+        // Translation settings
+        MpsGui.WhiteLine();
+        reloadTranslationButton.Draw();
 
-            GUILayout.EndScrollView();
+        reloadAllPresetsButton.Draw();
 
-            GUI.enabled = true;
-        }
+        GUILayout.EndScrollView();
 
-        public override void UpdatePanes()
-        {
-            for (var i = 0; i < rebindButtons.Length; i++)
-                rebindButtons[i].KeyCode = InputManager.GetActionKey((MpsKey)i);
-        }
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            for (var i = 0; i < rebindButtons.Length; i++)
-                actionLabels[i] = Translation.Get("controls", actionTranslationKeys[i]);
+    public override void UpdatePanes()
+    {
+        for (var i = 0; i < rebindButtons.Length; i++)
+            rebindButtons[i].KeyCode = InputManager.GetActionKey((MpsKey)i);
+    }
 
-            for (var i = 0; i < headerTranslationKeys.Length; i++)
-                headers[headerTranslationKeys[i]] = Translation.Get("settingsHeaders", headerTranslationKeys[i]);
+    protected override void ReloadTranslation()
+    {
+        for (var i = 0; i < rebindButtons.Length; i++)
+            actionLabels[i] = Translation.Get("controls", actionTranslationKeys[i]);
 
-            reloadTranslationButton.Label = Translation.Get("settingsLabels", "reloadTranslation");
-            reloadAllPresetsButton.Label = Translation.Get("settingsLabels", "reloadAllPresets");
-        }
+        for (var i = 0; i < headerTranslationKeys.Length; i++)
+            headers[headerTranslationKeys[i]] = Translation.Get("settingsHeaders", headerTranslationKeys[i]);
 
-        private void DrawSetting(MpsKey key)
-        {
-            var keyIndex = (int)key;
+        reloadTranslationButton.Label = Translation.Get("settingsLabels", "reloadTranslation");
+        reloadAllPresetsButton.Label = Translation.Get("settingsLabels", "reloadAllPresets");
+    }
 
-            GUILayout.BeginHorizontal();
-            GUILayout.Label(actionLabels[keyIndex]);
-            GUILayout.FlexibleSpace();
-            rebindButtons[keyIndex].Draw(GUILayout.Width(90f));
+    private void DrawSetting(MpsKey key)
+    {
+        var keyIndex = (int)key;
 
-            if (GUILayout.Button("×", GUILayout.ExpandWidth(false)))
-            {
-                rebindButtons[keyIndex].KeyCode = KeyCode.None;
-                InputManager.Rebind(key, KeyCode.None);
-            }
+        GUILayout.BeginHorizontal();
+        GUILayout.Label(actionLabels[keyIndex]);
+        GUILayout.FlexibleSpace();
+        rebindButtons[keyIndex].Draw(GUILayout.Width(90f));
 
-            GUILayout.EndHorizontal();
+        if (GUILayout.Button("×", GUILayout.ExpandWidth(false)))
+        {
+            rebindButtons[keyIndex].KeyCode = KeyCode.None;
+            InputManager.Rebind(key, KeyCode.None);
         }
 
+        GUILayout.EndHorizontal();
     }
+
 }

+ 95 - 96
src/MeidoPhotoStudio.Plugin/GUI/Panes/OtherPanes/MaidSwitcherPane.cs

@@ -1,139 +1,138 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidSwitcherPane : BasePane
 {
-    public class MaidSwitcherPane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly Button previousButton;
-        private readonly Button nextButton;
-        private readonly Toggle editToggle;
+    private readonly MeidoManager meidoManager;
+    private readonly Button previousButton;
+    private readonly Button nextButton;
+    private readonly Toggle editToggle;
 
-        public MaidSwitcherPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
-            this.meidoManager.UpdateMeido += (s, a) => UpdatePane();
+    public MaidSwitcherPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
+        this.meidoManager.UpdateMeido += (s, a) => UpdatePane();
 
-            previousButton = new("<");
-            previousButton.ControlEvent += (s, a) => ChangeMaid(-1);
+        previousButton = new("<");
+        previousButton.ControlEvent += (s, a) => ChangeMaid(-1);
 
-            nextButton = new(">");
-            nextButton.ControlEvent += (s, a) => ChangeMaid(1);
+        nextButton = new(">");
+        nextButton.ControlEvent += (s, a) => ChangeMaid(1);
 
-            editToggle = new("Edit", true);
-            editToggle.ControlEvent += (s, a) => SetEditMaid();
-        }
+        editToggle = new("Edit", true);
+        editToggle.ControlEvent += (s, a) => SetEditMaid();
+    }
 
-        public override void Draw()
-        {
-            const float boxSize = 70;
-            const int margin = (int)(boxSize / 2.8f);
+    public override void Draw()
+    {
+        const float boxSize = 70;
+        const int margin = (int)(boxSize / 2.8f);
 
-            var buttonStyle = new GUIStyle(GUI.skin.button);
+        var buttonStyle = new GUIStyle(GUI.skin.button);
 
-            buttonStyle.margin.top = margin;
+        buttonStyle.margin.top = margin;
 
-            var labelStyle = new GUIStyle(GUI.skin.label);
+        var labelStyle = new GUIStyle(GUI.skin.label);
 
-            labelStyle.margin.top = margin;
+        labelStyle.margin.top = margin;
 
-            var boxStyle = new GUIStyle(GUI.skin.box)
-            {
-                margin = new RectOffset(0, 0, 0, 0),
-            };
+        var boxStyle = new GUIStyle(GUI.skin.box)
+        {
+            margin = new RectOffset(0, 0, 0, 0),
+        };
 
-            var horizontalStyle = new GUIStyle
-            {
-                padding = new RectOffset(4, 4, 0, 0),
-            };
+        var horizontalStyle = new GUIStyle
+        {
+            padding = new RectOffset(4, 4, 0, 0),
+        };
 
-            var buttonOptions = new[] {
-                GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(false)
-            };
+        var buttonOptions = new[] {
+            GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(false)
+        };
 
-            var boxLayoutOptions = new[] {
-                GUILayout.Height(boxSize), GUILayout.Width(boxSize)
-            };
+        var boxLayoutOptions = new[] {
+            GUILayout.Height(boxSize), GUILayout.Width(boxSize)
+        };
 
-            GUI.enabled = meidoManager.HasActiveMeido;
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            var meido = meidoManager.ActiveMeido;
+        var meido = meidoManager.ActiveMeido;
 
-            GUILayout.BeginHorizontal(horizontalStyle, GUILayout.Height(boxSize));
+        GUILayout.BeginHorizontal(horizontalStyle, GUILayout.Height(boxSize));
 
-            previousButton.Draw(buttonStyle, buttonOptions);
+        previousButton.Draw(buttonStyle, buttonOptions);
 
-            GUILayout.Space(20);
+        GUILayout.Space(20);
 
-            if (meidoManager.HasActiveMeido && meido.Portrait)
-                MpsGui.DrawTexture(meido.Portrait, boxLayoutOptions);
-            else
-                GUILayout.Box(GUIContent.none, boxStyle, boxLayoutOptions);
+        if (meidoManager.HasActiveMeido && meido.Portrait)
+            MpsGui.DrawTexture(meido.Portrait, boxLayoutOptions);
+        else
+            GUILayout.Box(GUIContent.none, boxStyle, boxLayoutOptions);
 
-            var label = meidoManager.HasActiveMeido ? $"{meido.LastName}\n{meido.FirstName}" : string.Empty;
+        var label = meidoManager.HasActiveMeido ? $"{meido.LastName}\n{meido.FirstName}" : string.Empty;
 
-            GUILayout.Label(label, labelStyle, GUILayout.ExpandWidth(false));
+        GUILayout.Label(label, labelStyle, GUILayout.ExpandWidth(false));
 
-            GUILayout.FlexibleSpace();
+        GUILayout.FlexibleSpace();
 
-            nextButton.Draw(buttonStyle, buttonOptions);
+        nextButton.Draw(buttonStyle, buttonOptions);
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            var previousRect = GUILayoutUtility.GetLastRect();
+        var previousRect = GUILayoutUtility.GetLastRect();
 
-            if (MeidoPhotoStudio.EditMode)
-                editToggle.Draw(new Rect(previousRect.x + 4f, previousRect.y, 40f, 20f));
+        if (MeidoPhotoStudio.EditMode)
+            editToggle.Draw(new Rect(previousRect.x + 4f, previousRect.y, 40f, 20f));
 
-            var labelRect = new Rect(previousRect.width - 45f, previousRect.y, 40f, 20f);
-            var slotStyle = new GUIStyle()
-            {
-                alignment = TextAnchor.UpperRight,
-                fontSize = 13,
-            };
+        var labelRect = new Rect(previousRect.width - 45f, previousRect.y, 40f, 20f);
+        var slotStyle = new GUIStyle()
+        {
+            alignment = TextAnchor.UpperRight,
+            fontSize = 13,
+        };
 
-            slotStyle.padding.right = 5;
-            slotStyle.normal.textColor = Color.white;
+        slotStyle.padding.right = 5;
+        slotStyle.normal.textColor = Color.white;
 
-            if (meidoManager.HasActiveMeido)
-                GUI.Label(labelRect, $"{meidoManager.ActiveMeido.Slot + 1}", slotStyle);
-        }
+        if (meidoManager.HasActiveMeido)
+            GUI.Label(labelRect, $"{meidoManager.ActiveMeido.Slot + 1}", slotStyle);
+    }
 
-        public override void UpdatePane()
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    public override void UpdatePane()
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            updating = true;
-            editToggle.Value = meidoManager.ActiveMeido.IsEditMaid;
-            updating = false;
-        }
+        updating = true;
+        editToggle.Value = meidoManager.ActiveMeido.IsEditMaid;
+        updating = false;
+    }
 
-        private void ChangeMaid(int dir)
-        {
-            var selected = Utility.Wrap(
+    private void ChangeMaid(int dir)
+    {
+        var selected = Utility.Wrap(
                 meidoManager.SelectedMeido + (int)Mathf.Sign(dir), 0, meidoManager.ActiveMeidoList.Count
-            );
-
-            meidoManager.ChangeMaid(selected);
-        }
+                );
 
-        private void SetEditMaid()
-        {
-            if (updating)
-                return;
+        meidoManager.ChangeMaid(selected);
+    }
 
-            if (!editToggle.Value)
-            {
-                updating = true;
-                editToggle.Value = true;
-                updating = false;
+    private void SetEditMaid()
+    {
+        if (updating)
+            return;
 
-                return;
-            }
+        if (!editToggle.Value)
+        {
+            updating = true;
+            editToggle.Value = true;
+            updating = false;
 
-            if (meidoManager.HasActiveMeido)
-                meidoManager.SetEditMaid(meidoManager.ActiveMeido);
+            return;
         }
+
+        if (meidoManager.HasActiveMeido)
+            meidoManager.SetEditMaid(meidoManager.ActiveMeido);
     }
 }

+ 42 - 43
src/MeidoPhotoStudio.Plugin/GUI/Panes/OtherPanes/TabsPane.cs

@@ -1,50 +1,49 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class TabsPane : BasePane
 {
-    public class TabsPane : BasePane
+    private static readonly string[] tabNames = { "call", "pose", "face", "bg", "bg2" };
+
+    private readonly SelectionGrid Tabs;
+
+    private Constants.Window selectedTab;
+
+    public event EventHandler TabChange;
+
+    public Constants.Window SelectedTab
     {
-        private static readonly string[] tabNames = { "call", "pose", "face", "bg", "bg2" };
-
-        private readonly SelectionGrid Tabs;
-
-        private Constants.Window selectedTab;
-
-        public event EventHandler TabChange;
-
-        public Constants.Window SelectedTab
-        {
-            get => selectedTab;
-            set => Tabs.SelectedItemIndex = (int)value;
-        }
-
-        public TabsPane()
-        {
-            Translation.ReloadTranslationEvent += (s, a) => ReloadTranslation();
-            Tabs = new(Translation.GetArray("tabs", tabNames));
-            Tabs.ControlEvent += (s, a) => OnChangeTab();
-        }
-
-        public override void Draw()
-        {
-            Tabs.Draw(GUILayout.ExpandWidth(false));
-            MpsGui.BlackLine();
-        }
-
-        protected override void ReloadTranslation()
-        {
-            updating = true;
-            Tabs.SetItems(Translation.GetArray("tabs", tabNames), Tabs.SelectedItemIndex);
-            updating = false;
-        }
-        private void OnChangeTab()
-        {
-            if (updating)
-                return;
-
-            selectedTab = (Constants.Window)Tabs.SelectedItemIndex;
-            TabChange?.Invoke(null, EventArgs.Empty);
-        }
+        get => selectedTab;
+        set => Tabs.SelectedItemIndex = (int)value;
+    }
+
+    public TabsPane()
+    {
+        Translation.ReloadTranslationEvent += (s, a) => ReloadTranslation();
+        Tabs = new(Translation.GetArray("tabs", tabNames));
+        Tabs.ControlEvent += (s, a) => OnChangeTab();
+    }
+
+    public override void Draw()
+    {
+        Tabs.Draw(GUILayout.ExpandWidth(false));
+        MpsGui.BlackLine();
+    }
+
+    protected override void ReloadTranslation()
+    {
+        updating = true;
+        Tabs.SetItems(Translation.GetArray("tabs", tabNames), Tabs.SelectedItemIndex);
+        updating = false;
+    }
+    private void OnChangeTab()
+    {
+        if (updating)
+            return;
+
+        selectedTab = (Constants.Window)Tabs.SelectedItemIndex;
+        TabChange?.Invoke(null, EventArgs.Empty);
     }
 }

+ 58 - 59
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/CopyPosePane.cs

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

+ 72 - 73
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/GravityControlPane.cs

@@ -1,107 +1,106 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class GravityControlPane : BasePane
 {
-    public class GravityControlPane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly Toggle hairToggle;
-        private readonly Toggle skirtToggle;
-        private readonly Toggle globalToggle;
+    private readonly MeidoManager meidoManager;
+    private readonly Toggle hairToggle;
+    private readonly Toggle skirtToggle;
+    private readonly Toggle globalToggle;
 
-        private string header;
+    private string header;
 
-        public GravityControlPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+    public GravityControlPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            hairToggle = new(Translation.Get("gravityControlPane", "hairToggle"));
-            hairToggle.ControlEvent += (s, a) => ToggleGravity(hairToggle.Value, skirt: false);
+        hairToggle = new(Translation.Get("gravityControlPane", "hairToggle"));
+        hairToggle.ControlEvent += (s, a) => ToggleGravity(hairToggle.Value, skirt: false);
 
-            skirtToggle = new(Translation.Get("gravityControlPane", "skirtToggle"));
-            skirtToggle.ControlEvent += (s, a) => ToggleGravity(skirtToggle.Value, skirt: true);
+        skirtToggle = new(Translation.Get("gravityControlPane", "skirtToggle"));
+        skirtToggle.ControlEvent += (s, a) => ToggleGravity(skirtToggle.Value, skirt: true);
 
-            globalToggle = new(Translation.Get("gravityControlPane", "globalToggle"));
-            globalToggle.ControlEvent += (s, a) => SetGlobalGravity(globalToggle.Value);
+        globalToggle = new(Translation.Get("gravityControlPane", "globalToggle"));
+        globalToggle.ControlEvent += (s, a) => SetGlobalGravity(globalToggle.Value);
 
-            header = Translation.Get("gravityControlPane", "gravityHeader");
-        }
+        header = Translation.Get("gravityControlPane", "gravityHeader");
+    }
 
-        protected override void ReloadTranslation()
-        {
-            hairToggle.Label = Translation.Get("gravityControlPane", "hairToggle");
-            skirtToggle.Label = Translation.Get("gravityControlPane", "skirtToggle");
-            globalToggle.Label = Translation.Get("gravityControlPane", "globalToggle");
-            header = Translation.Get("gravityControlPane", "gravityHeader");
-        }
+    protected override void ReloadTranslation()
+    {
+        hairToggle.Label = Translation.Get("gravityControlPane", "hairToggle");
+        skirtToggle.Label = Translation.Get("gravityControlPane", "skirtToggle");
+        globalToggle.Label = Translation.Get("gravityControlPane", "globalToggle");
+        header = Translation.Get("gravityControlPane", "gravityHeader");
+    }
 
-        public override void Draw()
-        {
-            var enabled = meidoManager.HasActiveMeido;
+    public override void Draw()
+    {
+        var enabled = meidoManager.HasActiveMeido;
 
-            GUI.enabled = enabled;
+        GUI.enabled = enabled;
 
-            MpsGui.Header(header);
-            MpsGui.WhiteLine();
+        MpsGui.Header(header);
+        MpsGui.WhiteLine();
 
-            var meido = meidoManager.ActiveMeido;
+        var meido = meidoManager.ActiveMeido;
 
-            GUILayout.BeginHorizontal();
+        GUILayout.BeginHorizontal();
 
-            GUI.enabled = enabled && meido.HairGravityControl.Valid;
-            hairToggle.Draw();
+        GUI.enabled = enabled && meido.HairGravityControl.Valid;
+        hairToggle.Draw();
 
-            GUI.enabled = enabled && meido.SkirtGravityControl.Valid;
-            skirtToggle.Draw();
+        GUI.enabled = enabled && meido.SkirtGravityControl.Valid;
+        skirtToggle.Draw();
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = enabled;
-            globalToggle.Draw();
+        GUI.enabled = enabled;
+        globalToggle.Draw();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        public override void UpdatePane()
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    public override void UpdatePane()
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            var meido = meidoManager.ActiveMeido;
+        var meido = meidoManager.ActiveMeido;
 
-            updating = true;
+        updating = true;
 
-            hairToggle.Value = meido.HairGravityActive;
-            skirtToggle.Value = meido.SkirtGravityActive;
+        hairToggle.Value = meido.HairGravityActive;
+        skirtToggle.Value = meido.SkirtGravityActive;
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        private void ToggleGravity(bool value, bool skirt = false)
-        {
-            if (updating)
-                return;
+    private void ToggleGravity(bool value, bool skirt = false)
+    {
+        if (updating)
+            return;
 
-            if (meidoManager.GlobalGravity)
-            {
-                foreach (var meido in meidoManager.ActiveMeidoList)
-                {
-                    if (skirt)
-                        meido.SkirtGravityActive = value;
-                    else
-                        meido.HairGravityActive = value;
-                }
-            }
-            else
+        if (meidoManager.GlobalGravity)
+        {
+            foreach (var meido in meidoManager.ActiveMeidoList)
             {
                 if (skirt)
-                    meidoManager.ActiveMeido.SkirtGravityActive = value;
+                    meido.SkirtGravityActive = value;
                 else
-                    meidoManager.ActiveMeido.HairGravityActive = value;
+                    meido.HairGravityActive = value;
             }
         }
-
-        private void SetGlobalGravity(bool value) =>
-            meidoManager.GlobalGravity = value;
+        else
+        {
+            if (skirt)
+                meidoManager.ActiveMeido.SkirtGravityActive = value;
+            else
+                meidoManager.ActiveMeido.HairGravityActive = value;
+        }
     }
+
+    private void SetGlobalGravity(bool value) =>
+        meidoManager.GlobalGravity = value;
 }

+ 103 - 104
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/HandPresetPane.cs

@@ -3,143 +3,142 @@ using System.IO;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class HandPresetPane : BasePane
 {
-    public class HandPresetPane : BasePane
-    {
-        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 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 previousCategory;
-        private bool presetListEnabled = true;
+    private string previousCategory;
+    private bool presetListEnabled = true;
 
-        private string SelectedCategory =>
-            Constants.CustomHandGroupList[presetCategoryDropdown.SelectedItemIndex];
+    private string SelectedCategory =>
+        Constants.CustomHandGroupList[presetCategoryDropdown.SelectedItemIndex];
 
-        private List<string> CurrentPresetList =>
-            Constants.CustomHandDict[SelectedCategory];
+    private List<string> CurrentPresetList =>
+        Constants.CustomHandDict[SelectedCategory];
 
-        private string CurrentPreset =>
-            CurrentPresetList[presetDropdown.SelectedItemIndex];
+    private string CurrentPreset =>
+        CurrentPresetList[presetDropdown.SelectedItemIndex];
 
-        public HandPresetPane(MeidoManager meidoManager)
-        {
-            Constants.CustomHandChange += OnPresetChange;
+    public HandPresetPane(MeidoManager meidoManager)
+    {
+        Constants.CustomHandChange += OnPresetChange;
 
-            this.meidoManager = meidoManager;
+        this.meidoManager = meidoManager;
 
-            presetCategoryDropdown = new(Constants.CustomHandGroupList.ToArray());
-            presetCategoryDropdown.SelectionChange += (s, a) => ChangePresetCategory();
+        presetCategoryDropdown = new(Constants.CustomHandGroupList.ToArray());
+        presetCategoryDropdown.SelectionChange += (s, a) => ChangePresetCategory();
 
-            nextCategoryButton = new(">");
-            nextCategoryButton.ControlEvent += (s, a) => presetCategoryDropdown.Step(1);
+        nextCategoryButton = new(">");
+        nextCategoryButton.ControlEvent += (s, a) => presetCategoryDropdown.Step(1);
 
-            previousCategoryButton = new("<");
-            previousCategoryButton.ControlEvent += (s, a) => presetCategoryDropdown.Step(-1);
+        previousCategoryButton = new("<");
+        previousCategoryButton.ControlEvent += (s, a) => presetCategoryDropdown.Step(-1);
 
-            presetDropdown = new(UIPresetList());
+        presetDropdown = new(UIPresetList());
 
-            nextPresetButton = new(">");
-            nextPresetButton.ControlEvent += (s, a) => presetDropdown.Step(1);
+        nextPresetButton = new(">");
+        nextPresetButton.ControlEvent += (s, a) => presetDropdown.Step(1);
 
-            previousPresetButton = new("<");
-            previousPresetButton.ControlEvent += (s, a) => presetDropdown.Step(-1);
+        previousPresetButton = new("<");
+        previousPresetButton.ControlEvent += (s, a) => presetDropdown.Step(-1);
 
-            leftHandButton = new(Translation.Get("handPane", "leftHand"));
-            leftHandButton.ControlEvent += (s, a) => SetHandPreset(right: false);
+        leftHandButton = new(Translation.Get("handPane", "leftHand"));
+        leftHandButton.ControlEvent += (s, a) => SetHandPreset(right: false);
 
-            rightHandButton = new(Translation.Get("handPane", "rightHand"));
-            rightHandButton.ControlEvent += (s, a) => SetHandPreset(right: true);
+        rightHandButton = new(Translation.Get("handPane", "rightHand"));
+        rightHandButton.ControlEvent += (s, a) => SetHandPreset(right: true);
 
-            previousCategory = SelectedCategory;
-            presetListEnabled = CurrentPresetList.Count > 0;
-        }
+        previousCategory = SelectedCategory;
+        presetListEnabled = CurrentPresetList.Count > 0;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            leftHandButton.Label = Translation.Get("handPane", "leftHand");
-            rightHandButton.Label = Translation.Get("handPane", "rightHand");
+    protected override void ReloadTranslation()
+    {
+        leftHandButton.Label = Translation.Get("handPane", "leftHand");
+        rightHandButton.Label = Translation.Get("handPane", "rightHand");
 
-            if (CurrentPresetList.Count == 0)
-                presetDropdown.SetDropdownItems(UIPresetList());
-        }
+        if (CurrentPresetList.Count == 0)
+            presetDropdown.SetDropdownItems(UIPresetList());
+    }
 
-        public override void Draw()
-        {
-            var dropdownWidth = GUILayout.Width(156f);
-            var noExpandWidth = GUILayout.ExpandWidth(false);
+    public override void Draw()
+    {
+        var dropdownWidth = GUILayout.Width(156f);
+        var noExpandWidth = GUILayout.ExpandWidth(false);
 
-            GUI.enabled = meidoManager.HasActiveMeido;
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            GUILayout.BeginHorizontal();
-            presetCategoryDropdown.Draw(dropdownWidth);
-            previousCategoryButton.Draw(noExpandWidth);
-            nextCategoryButton.Draw(noExpandWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        presetCategoryDropdown.Draw(dropdownWidth);
+        previousCategoryButton.Draw(noExpandWidth);
+        nextCategoryButton.Draw(noExpandWidth);
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = GUI.enabled && presetListEnabled;
+        GUI.enabled = GUI.enabled && presetListEnabled;
 
-            GUILayout.BeginHorizontal();
-            presetDropdown.Draw(dropdownWidth);
-            previousPresetButton.Draw(noExpandWidth);
-            nextPresetButton.Draw(noExpandWidth);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        presetDropdown.Draw(dropdownWidth);
+        previousPresetButton.Draw(noExpandWidth);
+        nextPresetButton.Draw(noExpandWidth);
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
-            rightHandButton.Draw();
-            leftHandButton.Draw();
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        rightHandButton.Draw();
+        leftHandButton.Draw();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
+
+    private void ChangePresetCategory()
+    {
+        presetListEnabled = CurrentPresetList.Count > 0;
 
-        private void ChangePresetCategory()
+        if (previousCategory == SelectedCategory)
+            presetDropdown.SelectedItemIndex = 0;
+        else
         {
-            presetListEnabled = CurrentPresetList.Count > 0;
-
-            if (previousCategory == SelectedCategory)
-                presetDropdown.SelectedItemIndex = 0;
-            else
-            {
-                previousCategory = SelectedCategory;
-                presetDropdown.SetDropdownItems(UIPresetList(), 0);
-            }
+            previousCategory = SelectedCategory;
+            presetDropdown.SetDropdownItems(UIPresetList(), 0);
         }
+    }
 
-        private void SetHandPreset(bool right = false)
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    private void SetHandPreset(bool right = false)
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            meidoManager.ActiveMeido.SetHandPreset(CurrentPreset, right);
-        }
+        meidoManager.ActiveMeido.SetHandPreset(CurrentPreset, right);
+    }
 
-        private void OnPresetChange(object sender, PresetChangeEventArgs args)
+    private void OnPresetChange(object sender, PresetChangeEventArgs args)
+    {
+        if (args == PresetChangeEventArgs.Empty)
         {
-            if (args == PresetChangeEventArgs.Empty)
-            {
-                presetCategoryDropdown.SetDropdownItems(Constants.CustomHandGroupList.ToArray(), 0);
-                presetDropdown.SetDropdownItems(UIPresetList(), 0);
-            }
-            else
-            {
-                presetCategoryDropdown.SetDropdownItems(
+            presetCategoryDropdown.SetDropdownItems(Constants.CustomHandGroupList.ToArray(), 0);
+            presetDropdown.SetDropdownItems(UIPresetList(), 0);
+        }
+        else
+        {
+            presetCategoryDropdown.SetDropdownItems(
                     Constants.CustomHandGroupList.ToArray(), Constants.CustomHandGroupList.IndexOf(args.Category)
-                );
-                presetDropdown.SetDropdownItems(UIPresetList(), CurrentPresetList.IndexOf(args.Path));
-            }
+                    );
+            presetDropdown.SetDropdownItems(UIPresetList(), CurrentPresetList.IndexOf(args.Path));
         }
-
-        private string[] UIPresetList() =>
-            CurrentPresetList.Count == 0
-                ? new[] { Translation.Get("handPane", "noPresetsMessage") }
-                : CurrentPresetList.Select(Path.GetFileNameWithoutExtension).ToArray();
     }
+
+    private string[] UIPresetList() =>
+        CurrentPresetList.Count == 0
+        ? new[] { Translation.Get("handPane", "noPresetsMessage") }
+    : CurrentPresetList.Select(Path.GetFileNameWithoutExtension).ToArray();
 }

+ 232 - 233
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidDressingPane.cs

@@ -3,320 +3,319 @@ using UnityEngine;
 using static MeidoPhotoStudio.Plugin.Meido;
 using static TBody;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidDressingPane : BasePane
 {
-    public class MaidDressingPane : BasePane
+    public static readonly SlotID[] ClothingSlots =
     {
-        public static readonly SlotID[] ClothingSlots =
-        {
-            // main slots
-            SlotID.wear, SlotID.skirt, SlotID.bra, SlotID.panz, SlotID.headset, SlotID.megane, SlotID.accUde,
-            SlotID.glove, SlotID.accSenaka, SlotID.stkg, SlotID.shoes, SlotID.body,
-            // detailed slots
-            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
+        // main slots
+        SlotID.wear, SlotID.skirt, SlotID.bra, SlotID.panz, SlotID.headset, SlotID.megane, SlotID.accUde,
+        SlotID.glove, SlotID.accSenaka, SlotID.stkg, SlotID.shoes, SlotID.body,
+        // detailed slots
+        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
             // unused slots
             // SlotID.mizugi, SlotID.onepiece, SlotID.accHead,
-        };
+    };
 
-        public static readonly SlotID[] BodySlots =
-        {
-            SlotID.body, SlotID.head, SlotID.eye, SlotID.hairF, SlotID.hairR, SlotID.hairS, SlotID.hairT,
-            SlotID.hairAho, SlotID.chikubi, SlotID.underhair, SlotID.moza, SlotID.accHa
-        };
+    public static readonly SlotID[] BodySlots =
+    {
+        SlotID.body, SlotID.head, SlotID.eye, SlotID.hairF, SlotID.hairR, SlotID.hairS, SlotID.hairT,
+        SlotID.hairAho, SlotID.chikubi, SlotID.underhair, SlotID.moza, SlotID.accHa
+    };
 
-        public static readonly SlotID[] WearSlots = { SlotID.wear, SlotID.mizugi, SlotID.onepiece };
+    public static readonly SlotID[] WearSlots = { SlotID.wear, SlotID.mizugi, SlotID.onepiece };
 
-        public static readonly SlotID[] HeadwearSlots =
-        {
-            SlotID.headset, SlotID.accHat, SlotID.accKamiSubL, SlotID.accKamiSubR, SlotID.accKami_1_,
-            SlotID.accKami_2_, SlotID.accKami_3_
-        };
+    public static readonly SlotID[] HeadwearSlots =
+    {
+        SlotID.headset, SlotID.accHat, SlotID.accKamiSubL, SlotID.accKamiSubR, SlotID.accKami_1_,
+        SlotID.accKami_2_, SlotID.accKami_3_
+    };
 
-        private static readonly string[] maskLabels = { "all", "underwear", "nude" };
+    private static readonly string[] maskLabels = { "all", "underwear", "nude" };
 
-        private readonly MeidoManager meidoManager;
-        private readonly Dictionary<SlotID, Toggle> clothingToggles;
-        private readonly Dictionary<SlotID, bool> loadedSlots;
-        private readonly Toggle detailedClothingToggle;
-        private readonly SelectionGrid maskModeGrid;
-        private readonly Toggle curlingFrontToggle;
-        private readonly Toggle curlingBackToggle;
-        private readonly Toggle pantsuShiftToggle;
+    private readonly MeidoManager meidoManager;
+    private readonly Dictionary<SlotID, Toggle> clothingToggles;
+    private readonly Dictionary<SlotID, bool> loadedSlots;
+    private readonly Toggle detailedClothingToggle;
+    private readonly SelectionGrid maskModeGrid;
+    private readonly Toggle curlingFrontToggle;
+    private readonly Toggle curlingBackToggle;
+    private readonly Toggle pantsuShiftToggle;
 
-        private bool detailedClothing;
+    private bool detailedClothing;
 
-        public MaidDressingPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+    public MaidDressingPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            clothingToggles = new(ClothingSlots.Length);
-            loadedSlots = new(ClothingSlots.Length);
+        clothingToggles = new(ClothingSlots.Length);
+        loadedSlots = new(ClothingSlots.Length);
 
-            foreach (var slot in ClothingSlots)
-            {
-                var slotToggle = new Toggle(Translation.Get("clothing", slot.ToString()));
+        foreach (var slot in ClothingSlots)
+        {
+            var slotToggle = new Toggle(Translation.Get("clothing", slot.ToString()));
 
-                slotToggle.ControlEvent += (s, a) => ToggleClothing(slot, slotToggle.Value);
-                clothingToggles.Add(slot, slotToggle);
-                loadedSlots[slot] = true;
-            }
+            slotToggle.ControlEvent += (s, a) => ToggleClothing(slot, slotToggle.Value);
+            clothingToggles.Add(slot, slotToggle);
+            loadedSlots[slot] = true;
+        }
 
-            detailedClothingToggle = new(Translation.Get("clothing", "detail"));
-            detailedClothingToggle.ControlEvent += (s, a) => UpdateDetailedClothing();
+        detailedClothingToggle = new(Translation.Get("clothing", "detail"));
+        detailedClothingToggle.ControlEvent += (s, a) => UpdateDetailedClothing();
 
-            curlingFrontToggle = new(Translation.Get("clothing", "curlingFront"));
-            curlingFrontToggle.ControlEvent += (s, a) => ToggleCurling(Curl.Front, curlingFrontToggle.Value);
+        curlingFrontToggle = new(Translation.Get("clothing", "curlingFront"));
+        curlingFrontToggle.ControlEvent += (s, a) => ToggleCurling(Curl.Front, curlingFrontToggle.Value);
 
-            curlingBackToggle = new(Translation.Get("clothing", "curlingBack"));
-            curlingBackToggle.ControlEvent += (s, a) => ToggleCurling(Curl.Back, curlingBackToggle.Value);
+        curlingBackToggle = new(Translation.Get("clothing", "curlingBack"));
+        curlingBackToggle.ControlEvent += (s, a) => ToggleCurling(Curl.Back, curlingBackToggle.Value);
 
-            pantsuShiftToggle = new(Translation.Get("clothing", "shiftPanties"));
-            pantsuShiftToggle.ControlEvent += (s, a) => ToggleCurling(Curl.Shift, pantsuShiftToggle.Value);
+        pantsuShiftToggle = new(Translation.Get("clothing", "shiftPanties"));
+        pantsuShiftToggle.ControlEvent += (s, a) => ToggleCurling(Curl.Shift, pantsuShiftToggle.Value);
 
-            maskModeGrid = new(Translation.GetArray("clothing", maskLabels));
-            maskModeGrid.ControlEvent += (s, a) => SetMaskMode((Mask)maskModeGrid.SelectedItemIndex);
+        maskModeGrid = new(Translation.GetArray("clothing", maskLabels));
+        maskModeGrid.ControlEvent += (s, a) => SetMaskMode((Mask)maskModeGrid.SelectedItemIndex);
 
-            UpdateDetailedClothing();
-        }
+        UpdateDetailedClothing();
+    }
 
-        public override void UpdatePane()
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    public override void UpdatePane()
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            updating = true;
+        updating = true;
 
-            var meido = meidoManager.ActiveMeido;
-            var body = meido.Maid.body0;
+        var meido = meidoManager.ActiveMeido;
+        var body = meido.Maid.body0;
 
-            foreach (var clothingSlot in ClothingSlots)
-            {
-                var toggleValue = false;
-                var hasSlot = false;
+        foreach (var clothingSlot in ClothingSlots)
+        {
+            var toggleValue = false;
+            var hasSlot = false;
 
-                if (clothingSlot == SlotID.wear)
+            if (clothingSlot == SlotID.wear)
+            {
+                foreach (var wearSlot in WearSlots)
                 {
-                    foreach (var wearSlot in WearSlots)
-                    {
-                        if (body.GetMask(wearSlot))
-                            toggleValue = true;
+                    if (body.GetMask(wearSlot))
+                        toggleValue = true;
 
-                        if (body.GetSlotLoaded(wearSlot))
-                            hasSlot = true;
+                    if (body.GetSlotLoaded(wearSlot))
+                        hasSlot = true;
 
-                        if (hasSlot && toggleValue)
-                            break;
-                    }
-                }
-                else if (clothingSlot == SlotID.megane)
-                {
-                    toggleValue = body.GetMask(SlotID.megane) || body.GetMask(SlotID.accHead);
-                    hasSlot = body.GetSlotLoaded(SlotID.megane) || body.GetSlotLoaded(SlotID.accHead);
+                    if (hasSlot && toggleValue)
+                        break;
                 }
-                else if (!detailedClothing && clothingSlot == SlotID.headset)
+            }
+            else if (clothingSlot == SlotID.megane)
+            {
+                toggleValue = body.GetMask(SlotID.megane) || body.GetMask(SlotID.accHead);
+                hasSlot = body.GetSlotLoaded(SlotID.megane) || body.GetSlotLoaded(SlotID.accHead);
+            }
+            else if (!detailedClothing && clothingSlot == SlotID.headset)
+            {
+                foreach (var headwearSlot in HeadwearSlots)
                 {
-                    foreach (var headwearSlot in HeadwearSlots)
-                    {
-                        if (body.GetMask(headwearSlot))
-                            toggleValue = true;
+                    if (body.GetMask(headwearSlot))
+                        toggleValue = true;
 
-                        if (body.GetSlotLoaded(headwearSlot))
-                            hasSlot = true;
+                    if (body.GetSlotLoaded(headwearSlot))
+                        hasSlot = true;
 
-                        if (hasSlot && toggleValue)
-                            break;
-                    }
-                }
-                else
-                {
-                    toggleValue = body.GetMask(clothingSlot);
-                    hasSlot = body.GetSlotLoaded(clothingSlot);
+                    if (hasSlot && toggleValue)
+                        break;
                 }
-
-                clothingToggles[clothingSlot].Value = hasSlot && toggleValue;
-                loadedSlots[clothingSlot] = hasSlot;
+            }
+            else
+            {
+                toggleValue = body.GetMask(clothingSlot);
+                hasSlot = body.GetSlotLoaded(clothingSlot);
             }
 
-            curlingFrontToggle.Value = meido.CurlingFront;
-            curlingBackToggle.Value = meido.CurlingBack;
-            pantsuShiftToggle.Value = meido.PantsuShift;
+            clothingToggles[clothingSlot].Value = hasSlot && toggleValue;
+            loadedSlots[clothingSlot] = hasSlot;
+        }
 
-            var maskMode = meido.CurrentMaskMode;
+        curlingFrontToggle.Value = meido.CurlingFront;
+        curlingBackToggle.Value = meido.CurlingBack;
+        pantsuShiftToggle.Value = meido.PantsuShift;
 
-            maskModeGrid.SelectedItemIndex = maskMode == MaskMode.Nude ? (int)Mask.Nude : (int)maskMode;
+        var maskMode = meido.CurrentMaskMode;
 
-            updating = false;
-        }
+        maskModeGrid.SelectedItemIndex = maskMode == MaskMode.Nude ? (int)Mask.Nude : (int)maskMode;
 
-        public override void Draw()
-        {
-            GUI.enabled = Enabled = meidoManager.HasActiveMeido;
+        updating = false;
+    }
 
-            detailedClothingToggle.Draw();
+    public override void Draw()
+    {
+        GUI.enabled = Enabled = meidoManager.HasActiveMeido;
 
-            MpsGui.BlackLine();
+        detailedClothingToggle.Draw();
 
-            maskModeGrid.Draw();
+        MpsGui.BlackLine();
 
-            MpsGui.BlackLine();
+        maskModeGrid.Draw();
 
-            DrawSlotGroup(SlotID.wear, SlotID.skirt);
-            DrawSlotGroup(SlotID.bra, SlotID.panz);
-            DrawSlotGroup(SlotID.headset, SlotID.megane);
-            DrawSlotGroup(SlotID.accUde, SlotID.glove, SlotID.accSenaka);
-            DrawSlotGroup(SlotID.stkg, SlotID.shoes, SlotID.body);
+        MpsGui.BlackLine();
 
-            if (detailedClothing)
-            {
-                MpsGui.BlackLine();
-                DrawSlotGroup(SlotID.accShippo, SlotID.accHat);
-                DrawSlotGroup(SlotID.accKami_1_, SlotID.accKami_2_, SlotID.accKami_3_);
-                DrawSlotGroup(SlotID.accKamiSubL, SlotID.accKamiSubR);
-                DrawSlotGroup(SlotID.accMiMiL, SlotID.accMiMiR);
-                DrawSlotGroup(SlotID.accNipL, SlotID.accNipR);
-                DrawSlotGroup(SlotID.accHana, SlotID.accKubi, SlotID.accKubiwa);
-                DrawSlotGroup(SlotID.accHeso, SlotID.accAshi, SlotID.accXXX);
-            }
+        DrawSlotGroup(SlotID.wear, SlotID.skirt);
+        DrawSlotGroup(SlotID.bra, SlotID.panz);
+        DrawSlotGroup(SlotID.headset, SlotID.megane);
+        DrawSlotGroup(SlotID.accUde, SlotID.glove, SlotID.accSenaka);
+        DrawSlotGroup(SlotID.stkg, SlotID.shoes, SlotID.body);
 
+        if (detailedClothing)
+        {
             MpsGui.BlackLine();
+            DrawSlotGroup(SlotID.accShippo, SlotID.accHat);
+            DrawSlotGroup(SlotID.accKami_1_, SlotID.accKami_2_, SlotID.accKami_3_);
+            DrawSlotGroup(SlotID.accKamiSubL, SlotID.accKamiSubR);
+            DrawSlotGroup(SlotID.accMiMiL, SlotID.accMiMiR);
+            DrawSlotGroup(SlotID.accNipL, SlotID.accNipR);
+            DrawSlotGroup(SlotID.accHana, SlotID.accKubi, SlotID.accKubiwa);
+            DrawSlotGroup(SlotID.accHeso, SlotID.accAshi, SlotID.accXXX);
+        }
 
-            GUILayout.BeginHorizontal();
-            curlingFrontToggle.Draw();
-            GUILayout.FlexibleSpace();
-            curlingBackToggle.Draw();
-            GUILayout.FlexibleSpace();
-            pantsuShiftToggle.Draw();
-            GUILayout.FlexibleSpace();
-            GUILayout.EndHorizontal();
+        MpsGui.BlackLine();
 
-            GUI.enabled = true;
-        }
+        GUILayout.BeginHorizontal();
+        curlingFrontToggle.Draw();
+        GUILayout.FlexibleSpace();
+        curlingBackToggle.Draw();
+        GUILayout.FlexibleSpace();
+        pantsuShiftToggle.Draw();
+        GUILayout.FlexibleSpace();
+        GUILayout.EndHorizontal();
 
-        protected override void ReloadTranslation()
-        {
-            foreach (var slot in ClothingSlots)
-            {
-                var clothingToggle = clothingToggles[slot];
-
-                if (slot == SlotID.headset)
-                    clothingToggle.Label = detailedClothing
-                        ? Translation.Get("clothing", "headset")
-                        : Translation.Get("clothing", "headwear");
-                else
-                    clothingToggle.Label = Translation.Get("clothing", slot.ToString());
-            }
+        GUI.enabled = true;
+    }
 
-            updating = true;
-            maskModeGrid.SetItems(Translation.GetArray("clothing", maskLabels));
-            updating = false;
+    protected override void ReloadTranslation()
+    {
+        foreach (var slot in ClothingSlots)
+        {
+            var clothingToggle = clothingToggles[slot];
 
-            detailedClothingToggle.Label = Translation.Get("clothing", "detail");
-            curlingFrontToggle.Label = Translation.Get("clothing", "curlingFront");
-            curlingBackToggle.Label = Translation.Get("clothing", "curlingBack");
-            pantsuShiftToggle.Label = Translation.Get("clothing", "shiftPanties");
+            if (slot == SlotID.headset)
+                clothingToggle.Label = detailedClothing
+                    ? Translation.Get("clothing", "headset")
+                    : Translation.Get("clothing", "headwear");
+            else
+                clothingToggle.Label = Translation.Get("clothing", slot.ToString());
         }
 
-        private void ToggleClothing(SlotID slot, bool enabled)
+        updating = true;
+        maskModeGrid.SetItems(Translation.GetArray("clothing", maskLabels));
+        updating = false;
+
+        detailedClothingToggle.Label = Translation.Get("clothing", "detail");
+        curlingFrontToggle.Label = Translation.Get("clothing", "curlingFront");
+        curlingBackToggle.Label = Translation.Get("clothing", "curlingBack");
+        pantsuShiftToggle.Label = Translation.Get("clothing", "shiftPanties");
+    }
+
+    private void ToggleClothing(SlotID slot, bool enabled)
+    {
+        if (updating)
+            return;
+
+        if (slot == SlotID.body)
         {
-            if (updating)
-                return;
+            meidoManager.ActiveMeido.SetBodyMask(enabled);
 
-            if (slot == SlotID.body)
-            {
-                meidoManager.ActiveMeido.SetBodyMask(enabled);
+            return;
+        }
 
-                return;
-            }
+        var body = meidoManager.ActiveMeido.Maid.body0;
 
-            var body = meidoManager.ActiveMeido.Maid.body0;
+        if (!detailedClothing && slot == SlotID.headset)
+        {
+            updating = true;
 
-            if (!detailedClothing && slot == SlotID.headset)
+            foreach (var wearSlot in HeadwearSlots)
             {
-                updating = true;
+                body.SetMask(wearSlot, enabled);
+                clothingToggles[wearSlot].Value = enabled;
+            }
 
-                foreach (var wearSlot in HeadwearSlots)
-                {
+            updating = false;
+        }
+        else
+        {
+            if (slot == SlotID.wear)
+                foreach (var wearSlot in WearSlots)
                     body.SetMask(wearSlot, enabled);
-                    clothingToggles[wearSlot].Value = enabled;
-                }
-
-                updating = false;
-            }
-            else
+            else if (slot == SlotID.megane)
             {
-                if (slot == SlotID.wear)
-                    foreach (var wearSlot in WearSlots)
-                        body.SetMask(wearSlot, enabled);
-                else if (slot == SlotID.megane)
-                {
-                    body.SetMask(SlotID.megane, enabled);
-                    body.SetMask(SlotID.accHead, enabled);
-                }
-                else
-                    body.SetMask(slot, enabled);
+                body.SetMask(SlotID.megane, enabled);
+                body.SetMask(SlotID.accHead, enabled);
             }
+            else
+                body.SetMask(slot, enabled);
         }
+    }
 
-        private void ToggleCurling(Curl curl, bool enabled)
-        {
-            if (updating)
-                return;
+    private void ToggleCurling(Curl curl, bool enabled)
+    {
+        if (updating)
+            return;
 
-            meidoManager.ActiveMeido.SetCurling(curl, enabled);
+        meidoManager.ActiveMeido.SetCurling(curl, enabled);
 
-            if (!enabled)
-                return;
+        if (!enabled)
+            return;
 
-            updating = true;
+        updating = true;
 
-            if (curl == Curl.Front && curlingBackToggle.Value)
-                curlingBackToggle.Value = false;
-            else if (curl == Curl.Back && curlingFrontToggle.Value)
-                curlingFrontToggle.Value = false;
+        if (curl == Curl.Front && curlingBackToggle.Value)
+            curlingBackToggle.Value = false;
+        else if (curl == Curl.Back && curlingFrontToggle.Value)
+            curlingFrontToggle.Value = false;
 
-            updating = false;
-        }
+        updating = false;
+    }
 
-        private void SetMaskMode(Mask mask)
-        {
-            if (updating)
-                return;
+    private void SetMaskMode(Mask mask)
+    {
+        if (updating)
+            return;
 
-            meidoManager.ActiveMeido.SetMaskMode(mask);
+        meidoManager.ActiveMeido.SetMaskMode(mask);
 
-            UpdatePane();
-        }
+        UpdatePane();
+    }
 
-        private void DrawSlotGroup(params SlotID[] slots)
-        {
-            GUILayout.BeginHorizontal();
+    private void DrawSlotGroup(params SlotID[] slots)
+    {
+        GUILayout.BeginHorizontal();
 
-            for (var i = 0; i < slots.Length; i++)
-            {
-                var slot = slots[i];
+        for (var i = 0; i < slots.Length; i++)
+        {
+            var slot = slots[i];
 
-                GUI.enabled = Enabled && loadedSlots[slot];
-                clothingToggles[slot].Draw();
+            GUI.enabled = Enabled && loadedSlots[slot];
+            clothingToggles[slot].Draw();
 
-                if (i < slots.Length - 1)
-                    GUILayout.FlexibleSpace();
-            }
+            if (i < slots.Length - 1)
+                GUILayout.FlexibleSpace();
+        }
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = Enabled;
-        }
+        GUI.enabled = Enabled;
+    }
 
-        private void UpdateDetailedClothing()
-        {
-            detailedClothing = detailedClothingToggle.Value;
-            clothingToggles[SlotID.headset].Label = detailedClothing
-                ? Translation.Get("clothing", "headset")
-                : Translation.Get("clothing", "headwear");
+    private void UpdateDetailedClothing()
+    {
+        detailedClothing = detailedClothingToggle.Value;
+        clothingToggles[SlotID.headset].Label = detailedClothing
+            ? Translation.Get("clothing", "headset")
+            : Translation.Get("clothing", "headwear");
 
-            UpdatePane();
-        }
+        UpdatePane();
     }
 }

+ 84 - 85
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidFreeLookPane.cs

@@ -1,112 +1,111 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class MaidFaceLookPane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly Slider lookXSlider;
-        private readonly Slider lookYSlider;
-        private readonly Toggle headToCamToggle;
-        private readonly Toggle eyeToCamToggle;
+namespace MeidoPhotoStudio.Plugin;
 
-        private string bindLabel;
-
-        public MaidFaceLookPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+public class MaidFaceLookPane : BasePane
+{
+    private readonly MeidoManager meidoManager;
+    private readonly Slider lookXSlider;
+    private readonly Slider lookYSlider;
+    private readonly Toggle headToCamToggle;
+    private readonly Toggle eyeToCamToggle;
 
-            lookXSlider = new(Translation.Get("freeLookPane", "xSlider"), -0.6f, 0.6f);
-            lookXSlider.ControlEvent += (s, a) => SetMaidLook();
+    private string bindLabel;
 
-            lookYSlider = new(Translation.Get("freeLookPane", "ySlider"), 0.5f, -0.55f);
-            lookYSlider.ControlEvent += (s, a) => SetMaidLook();
+    public MaidFaceLookPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            headToCamToggle = new(Translation.Get("freeLookPane", "headToCamToggle"));
-            headToCamToggle.ControlEvent += (s, a) => SetHeadToCam(headToCamToggle.Value, eye: false);
+        lookXSlider = new(Translation.Get("freeLookPane", "xSlider"), -0.6f, 0.6f);
+        lookXSlider.ControlEvent += (s, a) => SetMaidLook();
 
-            eyeToCamToggle = new(Translation.Get("freeLookPane", "eyeToCamToggle"));
-            eyeToCamToggle.ControlEvent += (s, a) => SetHeadToCam(eyeToCamToggle.Value, eye: true);
+        lookYSlider = new(Translation.Get("freeLookPane", "ySlider"), 0.5f, -0.55f);
+        lookYSlider.ControlEvent += (s, a) => SetMaidLook();
 
-            bindLabel = Translation.Get("freeLookPane", "bindLabel");
-        }
+        headToCamToggle = new(Translation.Get("freeLookPane", "headToCamToggle"));
+        headToCamToggle.ControlEvent += (s, a) => SetHeadToCam(headToCamToggle.Value, eye: false);
 
-        public void SetHeadToCam(bool value, bool eye = false)
-        {
-            if (updating)
-                return;
+        eyeToCamToggle = new(Translation.Get("freeLookPane", "eyeToCamToggle"));
+        eyeToCamToggle.ControlEvent += (s, a) => SetHeadToCam(eyeToCamToggle.Value, eye: true);
 
-            var meido = meidoManager.ActiveMeido;
+        bindLabel = Translation.Get("freeLookPane", "bindLabel");
+    }
 
-            if (eye)
-                meido.EyeToCam = value;
-            else
-                meido.HeadToCam = value;
-        }
+    public void SetHeadToCam(bool value, bool eye = false)
+    {
+        if (updating)
+            return;
 
-        public void SetMaidLook()
-        {
-            if (updating)
-                return;
+        var meido = meidoManager.ActiveMeido;
 
-            var body = meidoManager.ActiveMeido.Body;
+        if (eye)
+            meido.EyeToCam = value;
+        else
+            meido.HeadToCam = value;
+    }
 
-            body.offsetLookTarget = new Vector3(lookYSlider.Value, 1f, lookXSlider.Value);
-        }
+    public void SetMaidLook()
+    {
+        if (updating)
+            return;
 
-        public void SetBounds()
-        {
-            var left = 0.5f;
-            var right = -0.55f;
+        var body = meidoManager.ActiveMeido.Body;
 
-            if (meidoManager.ActiveMeido.Stop)
-            {
-                left *= 0.6f;
-                right *= 0.6f;
-            }
+        body.offsetLookTarget = new Vector3(lookYSlider.Value, 1f, lookXSlider.Value);
+    }
 
-            lookYSlider.SetBounds(left, right);
-        }
+    public void SetBounds()
+    {
+        var left = 0.5f;
+        var right = -0.55f;
 
-        public override void UpdatePane()
+        if (meidoManager.ActiveMeido.Stop)
         {
-            var 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;
+            left *= 0.6f;
+            right *= 0.6f;
         }
 
-        public override void Draw()
-        {
-            GUI.enabled = meidoManager.HasActiveMeido && meidoManager.ActiveMeido.FreeLook;
-            GUILayout.BeginHorizontal();
-            lookXSlider.Draw();
-            lookYSlider.Draw();
-            GUILayout.EndHorizontal();
+        lookYSlider.SetBounds(left, right);
+    }
 
-            GUI.enabled = meidoManager.HasActiveMeido;
+    public override void UpdatePane()
+    {
+        var 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;
+    }
 
-            GUILayout.BeginHorizontal();
-            GUILayout.Label(bindLabel, GUILayout.ExpandWidth(false));
-            eyeToCamToggle.Draw();
-            headToCamToggle.Draw();
-            GUILayout.EndHorizontal();
+    public override void Draw()
+    {
+        GUI.enabled = meidoManager.HasActiveMeido && meidoManager.ActiveMeido.FreeLook;
+        GUILayout.BeginHorizontal();
+        lookXSlider.Draw();
+        lookYSlider.Draw();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-        protected override void ReloadTranslation()
-        {
-            lookXSlider.Label = Translation.Get("freeLookPane", "xSlider");
-            lookYSlider.Label = Translation.Get("freeLookPane", "ySlider");
-            headToCamToggle.Label = Translation.Get("freeLookPane", "headToCamToggle");
-            eyeToCamToggle.Label = Translation.Get("freeLookPane", "eyeToCamToggle");
-            bindLabel = Translation.Get("freeLookPane", "bindLabel");
-        }
+        GUILayout.BeginHorizontal();
+        GUILayout.Label(bindLabel, GUILayout.ExpandWidth(false));
+        eyeToCamToggle.Draw();
+        headToCamToggle.Draw();
+        GUILayout.EndHorizontal();
+
+        GUI.enabled = true;
+    }
+
+    protected override void ReloadTranslation()
+    {
+        lookXSlider.Label = Translation.Get("freeLookPane", "xSlider");
+        lookYSlider.Label = Translation.Get("freeLookPane", "ySlider");
+        headToCamToggle.Label = Translation.Get("freeLookPane", "headToCamToggle");
+        eyeToCamToggle.Label = Translation.Get("freeLookPane", "eyeToCamToggle");
+        bindLabel = Translation.Get("freeLookPane", "bindLabel");
     }
 }

+ 57 - 58
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidIKPane.cs

@@ -1,76 +1,75 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidIKPane : BasePane
 {
-    public class MaidIKPane : BasePane
+    private readonly MeidoManager meidoManager;
+    private readonly Toggle ikToggle;
+    private readonly Toggle releaseIKToggle;
+    private readonly Toggle boneIKToggle;
+    private enum IKToggle
     {
-        private readonly MeidoManager meidoManager;
-        private readonly Toggle ikToggle;
-        private readonly Toggle releaseIKToggle;
-        private readonly Toggle boneIKToggle;
-        private enum IKToggle
-        {
-            IK, Release, Bone
-        }
+        IK, Release, Bone
+    }
 
-        public MaidIKPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+    public MaidIKPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            ikToggle = new(Translation.Get("maidPoseWindow", "ikToggle"), true);
-            ikToggle.ControlEvent += (s, a) => SetIK(IKToggle.IK, ikToggle.Value);
+        ikToggle = new(Translation.Get("maidPoseWindow", "ikToggle"), true);
+        ikToggle.ControlEvent += (s, a) => SetIK(IKToggle.IK, ikToggle.Value);
 
-            releaseIKToggle = new(Translation.Get("maidPoseWindow", "releaseToggle"));
-            releaseIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Release, releaseIKToggle.Value);
+        releaseIKToggle = new(Translation.Get("maidPoseWindow", "releaseToggle"));
+        releaseIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Release, releaseIKToggle.Value);
 
-            boneIKToggle = new(Translation.Get("maidPoseWindow", "boneToggle"));
-            boneIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Bone, boneIKToggle.Value);
-        }
+        boneIKToggle = new(Translation.Get("maidPoseWindow", "boneToggle"));
+        boneIKToggle.ControlEvent += (s, a) => SetIK(IKToggle.Bone, boneIKToggle.Value);
+    }
 
-        public override void UpdatePane()
-        {
-            updating = true;
-            ikToggle.Value = meidoManager.ActiveMeido.IK;
-            releaseIKToggle.Value = meidoManager.ActiveMeido.Stop;
-            boneIKToggle.Value = meidoManager.ActiveMeido.Bone;
-            updating = false;
-        }
+    public override void UpdatePane()
+    {
+        updating = true;
+        ikToggle.Value = meidoManager.ActiveMeido.IK;
+        releaseIKToggle.Value = meidoManager.ActiveMeido.Stop;
+        boneIKToggle.Value = meidoManager.ActiveMeido.Bone;
+        updating = false;
+    }
 
-        public override void Draw()
-        {
-            var active = meidoManager.HasActiveMeido;
+    public override void Draw()
+    {
+        var active = meidoManager.HasActiveMeido;
 
-            GUILayout.BeginHorizontal();
-            GUI.enabled = active;
-            ikToggle.Draw();
+        GUILayout.BeginHorizontal();
+        GUI.enabled = active;
+        ikToggle.Draw();
 
-            GUI.enabled = active && meidoManager.ActiveMeido.Stop;
-            releaseIKToggle.Draw();
+        GUI.enabled = active && meidoManager.ActiveMeido.Stop;
+        releaseIKToggle.Draw();
 
-            GUI.enabled = active && ikToggle.Value;
-            boneIKToggle.Draw();
-            GUILayout.EndHorizontal();
-            GUI.enabled = true;
-        }
+        GUI.enabled = active && ikToggle.Value;
+        boneIKToggle.Draw();
+        GUILayout.EndHorizontal();
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            ikToggle.Label = Translation.Get("maidPoseWindow", "ikToggle");
-            releaseIKToggle.Label = Translation.Get("maidPoseWindow", "releaseToggle");
-            boneIKToggle.Label = Translation.Get("maidPoseWindow", "boneToggle");
-        }
+    protected override void ReloadTranslation()
+    {
+        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;
+    private void SetIK(IKToggle toggle, bool value)
+    {
+        if (updating)
+            return;
 
-            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;
-        }
+        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;
     }
 }

+ 179 - 180
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MaidPoseSelectorPane.cs

@@ -3,250 +3,249 @@ using System.IO;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MaidPoseSelectorPane : BasePane
 {
-    public class MaidPoseSelectorPane : BasePane
-    {
-        private static readonly string[] tabTranslations = new[] { "baseTab", "customTab" };
+    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 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 bool customPoseMode;
-        private bool poseListEnabled;
-        private string previousPoseGroup;
+    private bool customPoseMode;
+    private bool poseListEnabled;
+    private string previousPoseGroup;
 
-        private Dictionary<string, List<string>> CurrentPoseDict =>
-            customPoseMode ? Constants.CustomPoseDict : Constants.PoseDict;
+    private Dictionary<string, List<string>> CurrentPoseDict =>
+        customPoseMode ? Constants.CustomPoseDict : Constants.PoseDict;
 
-        private List<string> CurrentPoseGroupList =>
-            customPoseMode ? Constants.CustomPoseGroupList : Constants.PoseGroupList;
+    private List<string> CurrentPoseGroupList =>
+        customPoseMode ? Constants.CustomPoseGroupList : Constants.PoseGroupList;
 
-        private string SelectedPoseGroup =>
-            CurrentPoseGroupList[poseGroupDropdown.SelectedItemIndex];
+    private string SelectedPoseGroup =>
+        CurrentPoseGroupList[poseGroupDropdown.SelectedItemIndex];
 
-        private List<string> CurrentPoseList =>
-            CurrentPoseDict[SelectedPoseGroup];
+    private List<string> CurrentPoseList =>
+        CurrentPoseDict[SelectedPoseGroup];
 
-        private int SelectedPoseIndex =>
-            poseDropdown.SelectedItemIndex;
+    private int SelectedPoseIndex =>
+        poseDropdown.SelectedItemIndex;
 
-        private string SelectedPose =>
-            CurrentPoseList[SelectedPoseIndex];
+    private string SelectedPose =>
+        CurrentPoseList[SelectedPoseIndex];
 
-        private PoseInfo CurrentPoseInfo =>
-            new(SelectedPoseGroup, SelectedPose, customPoseMode);
+    private PoseInfo CurrentPoseInfo =>
+        new(SelectedPoseGroup, SelectedPose, customPoseMode);
 
-        public MaidPoseSelectorPane(MeidoManager meidoManager)
-        {
-            Constants.CustomPoseChange += OnPresetChange;
-            this.meidoManager = meidoManager;
+    public MaidPoseSelectorPane(MeidoManager meidoManager)
+    {
+        Constants.CustomPoseChange += OnPresetChange;
+        this.meidoManager = meidoManager;
 
-            poseModeGrid = new(Translation.GetArray("posePane", tabTranslations));
-            poseModeGrid.ControlEvent += (s, a) => SetPoseMode();
+        poseModeGrid = new(Translation.GetArray("posePane", tabTranslations));
+        poseModeGrid.ControlEvent += (s, a) => SetPoseMode();
 
-            poseGroupDropdown = new(Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList));
-            poseGroupDropdown.SelectionChange += (s, a) => ChangePoseGroup();
+        poseGroupDropdown = new(Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList));
+        poseGroupDropdown.SelectionChange += (s, a) => ChangePoseGroup();
 
-            poseDropdown = new(UIPoseList());
-            poseDropdown.SelectionChange += (s, a) => ChangePose();
+        poseDropdown = new(UIPoseList());
+        poseDropdown.SelectionChange += (s, a) => ChangePose();
 
-            poseGroupLeftButton = new("<");
-            poseGroupLeftButton.ControlEvent += (s, a) => poseGroupDropdown.Step(-1);
+        poseGroupLeftButton = new("<");
+        poseGroupLeftButton.ControlEvent += (s, a) => poseGroupDropdown.Step(-1);
 
-            poseGroupRightButton = new(">");
-            poseGroupRightButton.ControlEvent += (s, a) => poseGroupDropdown.Step(1);
+        poseGroupRightButton = new(">");
+        poseGroupRightButton.ControlEvent += (s, a) => poseGroupDropdown.Step(1);
 
-            poseLeftButton = new("<");
-            poseLeftButton.ControlEvent += (s, a) => poseDropdown.Step(-1);
+        poseLeftButton = new("<");
+        poseLeftButton.ControlEvent += (s, a) => poseDropdown.Step(-1);
 
-            poseRightButton = new(">");
-            poseRightButton.ControlEvent += (s, a) => poseDropdown.Step(1);
+        poseRightButton = new(">");
+        poseRightButton.ControlEvent += (s, a) => poseDropdown.Step(1);
 
-            customPoseMode = poseModeGrid.SelectedItemIndex == 1;
-            previousPoseGroup = SelectedPoseGroup;
-            poseListEnabled = CurrentPoseList.Count > 0;
-        }
+        customPoseMode = poseModeGrid.SelectedItemIndex == 1;
+        previousPoseGroup = SelectedPoseGroup;
+        poseListEnabled = CurrentPoseList.Count > 0;
+    }
 
-        public override void Draw()
-        {
-            const float buttonHeight = 30f;
+    public override void Draw()
+    {
+        const float buttonHeight = 30f;
 
-            var arrowLayoutOptions = new[] {
-                GUILayout.Width(buttonHeight),
+        var arrowLayoutOptions = new[] {
+            GUILayout.Width(buttonHeight),
                 GUILayout.Height(buttonHeight),
-            };
+        };
 
-            const float dropdownButtonWidth = 153f;
+        const float dropdownButtonWidth = 153f;
 
-            var dropdownLayoutOptions = new GUILayoutOption[] {
-                GUILayout.Height(buttonHeight),
+        var dropdownLayoutOptions = new GUILayoutOption[] {
+            GUILayout.Height(buttonHeight),
                 GUILayout.Width(dropdownButtonWidth),
-            };
+        };
 
-            GUI.enabled = meidoManager.HasActiveMeido && !meidoManager.ActiveMeido.Stop;
+        GUI.enabled = meidoManager.HasActiveMeido && !meidoManager.ActiveMeido.Stop;
 
-            poseModeGrid.Draw();
-            MpsGui.WhiteLine();
+        poseModeGrid.Draw();
+        MpsGui.WhiteLine();
 
-            GUILayout.BeginHorizontal();
-            poseGroupLeftButton.Draw(arrowLayoutOptions);
-            poseGroupDropdown.Draw(dropdownLayoutOptions);
-            poseGroupRightButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        poseGroupLeftButton.Draw(arrowLayoutOptions);
+        poseGroupDropdown.Draw(dropdownLayoutOptions);
+        poseGroupRightButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
-            GUI.enabled = GUI.enabled && poseListEnabled;
-            poseLeftButton.Draw(arrowLayoutOptions);
-            poseDropdown.Draw(dropdownLayoutOptions);
-            poseRightButton.Draw(arrowLayoutOptions);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        GUI.enabled = GUI.enabled && poseListEnabled;
+        poseLeftButton.Draw(arrowLayoutOptions);
+        poseDropdown.Draw(dropdownLayoutOptions);
+        poseRightButton.Draw(arrowLayoutOptions);
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        public override void UpdatePane()
-        {
-            updating = true;
+    public override void UpdatePane()
+    {
+        updating = true;
 
-            try
-            {
-                var cachedPose = meidoManager.ActiveMeido.CachedPose;
+        try
+        {
+            var cachedPose = meidoManager.ActiveMeido.CachedPose;
 
-                poseModeGrid.SelectedItemIndex = cachedPose.CustomPose ? 1 : 0;
+            poseModeGrid.SelectedItemIndex = cachedPose.CustomPose ? 1 : 0;
 
-                var oldCustomPoseMode = customPoseMode;
-                customPoseMode = cachedPose.CustomPose;
+            var oldCustomPoseMode = customPoseMode;
+            customPoseMode = cachedPose.CustomPose;
 
-                if (oldCustomPoseMode != customPoseMode)
-                    poseGroupDropdown.SetDropdownItems(
+            if (oldCustomPoseMode != customPoseMode)
+                poseGroupDropdown.SetDropdownItems(
                         customPoseMode ? CurrentPoseGroupList.ToArray() : Translation.GetArray(
                             "poseGroupDropdown", CurrentPoseGroupList
-                        )
-                    );
+                            )
+                        );
 
-                var newPoseGroupIndex = CurrentPoseGroupList.IndexOf(cachedPose.PoseGroup);
+            var newPoseGroupIndex = CurrentPoseGroupList.IndexOf(cachedPose.PoseGroup);
 
-                if (newPoseGroupIndex < 0)
-                    poseGroupDropdown.SelectedItemIndex = 0;
-                else if (oldCustomPoseMode != customPoseMode
+            if (newPoseGroupIndex < 0)
+                poseGroupDropdown.SelectedItemIndex = 0;
+            else if (oldCustomPoseMode != customPoseMode
                     || poseGroupDropdown.SelectedItemIndex != newPoseGroupIndex)
-                {
-                    poseGroupDropdown.SelectedItemIndex = newPoseGroupIndex;
-                    poseDropdown.SetDropdownItems(UIPoseList());
-                }
+            {
+                poseGroupDropdown.SelectedItemIndex = newPoseGroupIndex;
+                poseDropdown.SetDropdownItems(UIPoseList());
+            }
 
-                var newPoseIndex = CurrentPoseDict.TryGetValue(cachedPose.PoseGroup, out var poseList)
-                    ? poseList.IndexOf(cachedPose.Pose)
-                    : 0;
+            var newPoseIndex = CurrentPoseDict.TryGetValue(cachedPose.PoseGroup, out var poseList)
+                ? poseList.IndexOf(cachedPose.Pose)
+                : 0;
 
-                if (newPoseIndex < 0)
-                    newPoseIndex = 0;
+            if (newPoseIndex < 0)
+                newPoseIndex = 0;
 
-                poseDropdown.SelectedItemIndex = newPoseIndex;
-                poseListEnabled = CurrentPoseList.Count > 0;
-            }
-            catch
-            {
-                // Do nothing
-            }
-            finally
-            {
-                updating = false;
-            }
+            poseDropdown.SelectedItemIndex = newPoseIndex;
+            poseListEnabled = CurrentPoseList.Count > 0;
         }
-
-        protected override void ReloadTranslation()
+        catch
         {
-            updating = true;
-            poseModeGrid.SetItems(Translation.GetArray("posePane", tabTranslations));
+            // Do nothing
+        }
+        finally
+        {
+            updating = false;
+        }
+    }
 
-            if (!customPoseMode)
-            {
-                poseGroupDropdown.SetDropdownItems(
-                    Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList)
-                );
-            }
+    protected override void ReloadTranslation()
+    {
+        updating = true;
+        poseModeGrid.SetItems(Translation.GetArray("posePane", tabTranslations));
 
-            updating = false;
+        if (!customPoseMode)
+        {
+            poseGroupDropdown.SetDropdownItems(
+                    Translation.GetArray("poseGroupDropdown", Constants.PoseGroupList)
+                    );
         }
 
-        private void OnPresetChange(object sender, PresetChangeEventArgs args)
+        updating = false;
+    }
+
+    private void OnPresetChange(object sender, PresetChangeEventArgs args)
+    {
+        if (args == PresetChangeEventArgs.Empty)
         {
-            if (args == PresetChangeEventArgs.Empty)
-            {
-                if (poseModeGrid.SelectedItemIndex == 1)
-                {
-                    updating = true;
-                    poseGroupDropdown.SetDropdownItems(CurrentPoseGroupList.ToArray(), 0);
-                    poseDropdown.SetDropdownItems(UIPoseList(), 0);
-                    updating = false;
-                }
-            }
-            else
+            if (poseModeGrid.SelectedItemIndex == 1)
             {
                 updating = true;
-                poseModeGrid.SelectedItemIndex = 1;
-                poseGroupDropdown.SetDropdownItems(
-                    CurrentPoseGroupList.ToArray(), CurrentPoseGroupList.IndexOf(args.Category)
-                );
+                poseGroupDropdown.SetDropdownItems(CurrentPoseGroupList.ToArray(), 0);
+                poseDropdown.SetDropdownItems(UIPoseList(), 0);
                 updating = false;
-
-                poseDropdown.SetDropdownItems(UIPoseList(), CurrentPoseList.IndexOf(args.Path));
-                poseListEnabled = true;
             }
         }
-
-        private void SetPoseMode()
+        else
         {
-            if (updating)
-                return;
+            updating = true;
+            poseModeGrid.SelectedItemIndex = 1;
+            poseGroupDropdown.SetDropdownItems(
+                    CurrentPoseGroupList.ToArray(), CurrentPoseGroupList.IndexOf(args.Category)
+                    );
+            updating = false;
 
-            customPoseMode = poseModeGrid.SelectedItemIndex == 1;
+            poseDropdown.SetDropdownItems(UIPoseList(), CurrentPoseList.IndexOf(args.Path));
+            poseListEnabled = true;
+        }
+    }
 
-            var list = customPoseMode
-                ? CurrentPoseGroupList.ToArray()
-                : Translation.GetArray("poseGroupDropdown", CurrentPoseGroupList);
+    private void SetPoseMode()
+    {
+        if (updating)
+            return;
 
-            poseGroupDropdown.SetDropdownItems(list, 0);
-        }
+        customPoseMode = poseModeGrid.SelectedItemIndex == 1;
 
-        private void ChangePoseGroup()
-        {
-            if (updating)
-                return;
+        var list = customPoseMode
+            ? CurrentPoseGroupList.ToArray()
+            : Translation.GetArray("poseGroupDropdown", CurrentPoseGroupList);
 
-            poseListEnabled = CurrentPoseList.Count > 0;
-            if (previousPoseGroup == SelectedPoseGroup)
-            {
-                poseDropdown.SelectedItemIndex = 0;
-            }
-            else
-            {
-                previousPoseGroup = SelectedPoseGroup;
-                poseDropdown.SetDropdownItems(UIPoseList(), 0);
-            }
-        }
+        poseGroupDropdown.SetDropdownItems(list, 0);
+    }
 
-        private void ChangePose()
-        {
-            if (!poseListEnabled || updating)
-                return;
+    private void ChangePoseGroup()
+    {
+        if (updating)
+            return;
 
-            meidoManager.ActiveMeido.SetPose(CurrentPoseInfo);
+        poseListEnabled = CurrentPoseList.Count > 0;
+        if (previousPoseGroup == SelectedPoseGroup)
+        {
+            poseDropdown.SelectedItemIndex = 0;
+        }
+        else
+        {
+            previousPoseGroup = SelectedPoseGroup;
+            poseDropdown.SetDropdownItems(UIPoseList(), 0);
         }
+    }
 
-        private string[] UIPoseList() =>
-            CurrentPoseList.Count == 0
-                ? new[] { "No Poses" }
-                : CurrentPoseList
-                    .Select((pose, i) => $"{i + 1}:{(customPoseMode ? Path.GetFileNameWithoutExtension(pose) : pose)}")
-                    .ToArray();
+    private void ChangePose()
+    {
+        if (!poseListEnabled || updating)
+            return;
+
+        meidoManager.ActiveMeido.SetPose(CurrentPoseInfo);
     }
+
+    private string[] UIPoseList() =>
+        CurrentPoseList.Count == 0
+        ? new[] { "No Poses" }
+    : CurrentPoseList
+        .Select((pose, i) => $"{i + 1}:{(customPoseMode ? Path.GetFileNameWithoutExtension(pose) : pose)}")
+        .ToArray();
 }

+ 82 - 83
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/MpnAttachPropPane.cs

@@ -2,116 +2,115 @@ using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MpnAttachPropPane : BasePane
 {
-    public class MpnAttachPropPane : BasePane
-    {
-        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;
+    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;
 
-        private string header;
+    private string header;
 
-        public MpnAttachPropPane(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
+    public MpnAttachPropPane(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
 
-            mpnAttachDropdown = new(new[] { string.Empty });
+        mpnAttachDropdown = new(new[] { string.Empty });
 
-            if (!Constants.MpnAttachInitialized)
-                Constants.MenuFilesChange += InitializeMpnAttach;
+        if (!Constants.MpnAttachInitialized)
+            Constants.MenuFilesChange += InitializeMpnAttach;
 
-            SetDropdownList();
+        SetDropdownList();
 
-            previousPropButton = new("<");
-            previousPropButton.ControlEvent += (s, a) => mpnAttachDropdown.Step(-1);
+        previousPropButton = new("<");
+        previousPropButton.ControlEvent += (s, a) => mpnAttachDropdown.Step(-1);
 
-            nextPropButton = new(">");
-            nextPropButton.ControlEvent += (s, a) => mpnAttachDropdown.Step(1);
+        nextPropButton = new(">");
+        nextPropButton.ControlEvent += (s, a) => mpnAttachDropdown.Step(1);
 
-            attachPropButton = new(Translation.Get("attachMpnPropPane", "attachButton"));
-            attachPropButton.ControlEvent += (s, a) => AttachProp();
+        attachPropButton = new(Translation.Get("attachMpnPropPane", "attachButton"));
+        attachPropButton.ControlEvent += (s, a) => AttachProp();
 
-            detachPropButton = new(Translation.Get("attachMpnPropPane", "detachButton"));
-            detachPropButton.ControlEvent += (s, a) => AttachProp(detach: true);
+        detachPropButton = new(Translation.Get("attachMpnPropPane", "detachButton"));
+        detachPropButton.ControlEvent += (s, a) => AttachProp(detach: true);
 
-            detachAllButton = new(Translation.Get("attachMpnPropPane", "detachAllButton"));
-            detachAllButton.ControlEvent += (s, a) => DetachAll();
+        detachAllButton = new(Translation.Get("attachMpnPropPane", "detachAllButton"));
+        detachAllButton.ControlEvent += (s, a) => DetachAll();
 
-            header = Translation.Get("attachMpnPropPane", "header");
-        }
+        header = Translation.Get("attachMpnPropPane", "header");
+    }
 
-        public override void Draw()
-        {
-            GUI.enabled = meidoManager.HasActiveMeido && Constants.MpnAttachInitialized;
+    public override void Draw()
+    {
+        GUI.enabled = meidoManager.HasActiveMeido && Constants.MpnAttachInitialized;
+
+        var noExpand = GUILayout.ExpandWidth(false);
 
-            var noExpand = GUILayout.ExpandWidth(false);
+        MpsGui.Header(header);
+        MpsGui.WhiteLine();
 
-            MpsGui.Header(header);
-            MpsGui.WhiteLine();
+        GUILayout.BeginHorizontal();
+        previousPropButton.Draw(noExpand);
+        mpnAttachDropdown.Draw(GUILayout.Width(153f));
+        nextPropButton.Draw(noExpand);
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
-            previousPropButton.Draw(noExpand);
-            mpnAttachDropdown.Draw(GUILayout.Width(153f));
-            nextPropButton.Draw(noExpand);
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        attachPropButton.Draw();
+        detachPropButton.Draw();
+        GUILayout.EndHorizontal();
+        detachAllButton.Draw();
 
-            GUILayout.BeginHorizontal();
-            attachPropButton.Draw();
-            detachPropButton.Draw();
-            GUILayout.EndHorizontal();
-            detachAllButton.Draw();
+        GUI.enabled = true;
+    }
 
-            GUI.enabled = true;
-        }
+    protected override void ReloadTranslation()
+    {
+        attachPropButton.Label = Translation.Get("attachMpnPropPane", "attachButton");
+        detachPropButton.Label = Translation.Get("attachMpnPropPane", "detachButton");
+        detachAllButton.Label = Translation.Get("attachMpnPropPane", "detachAllButton");
+        header = Translation.Get("attachMpnPropPane", "header");
 
-        protected override void ReloadTranslation()
-        {
-            attachPropButton.Label = Translation.Get("attachMpnPropPane", "attachButton");
-            detachPropButton.Label = Translation.Get("attachMpnPropPane", "detachButton");
-            detachAllButton.Label = Translation.Get("attachMpnPropPane", "detachAllButton");
-            header = Translation.Get("attachMpnPropPane", "header");
+        SetDropdownList();
+    }
 
+    private void InitializeMpnAttach(object sender, MenuFilesEventArgs args)
+    {
+        if (args.Type == MenuFilesEventArgs.EventType.MpnAttach)
             SetDropdownList();
-        }
-
-        private void InitializeMpnAttach(object sender, MenuFilesEventArgs args)
-        {
-            if (args.Type == MenuFilesEventArgs.EventType.MpnAttach)
-                SetDropdownList();
-        }
-
-        private void SetDropdownList()
-        {
-            IEnumerable<string> dropdownList = !Constants.MpnAttachInitialized
-                ? new[] { Translation.Get("systemMessage", "initializing") }
-                : Translation.GetArray(
-                    "mpnAttachPropNames", Constants.MpnAttachPropList.Select(mpnProp => mpnProp.MenuFile)
+    }
+
+    private void SetDropdownList()
+    {
+        IEnumerable<string> dropdownList = !Constants.MpnAttachInitialized
+            ? new[] { Translation.Get("systemMessage", "initializing") }
+        : Translation.GetArray(
+                "mpnAttachPropNames", Constants.MpnAttachPropList.Select(mpnProp => mpnProp.MenuFile)
                 );
 
-            mpnAttachDropdown.SetDropdownItems(dropdownList.ToArray());
-        }
+        mpnAttachDropdown.SetDropdownItems(dropdownList.ToArray());
+    }
 
-        private void AttachProp(bool detach = false)
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    private void AttachProp(bool detach = false)
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            var prop = Constants.MpnAttachPropList[mpnAttachDropdown.SelectedItemIndex];
+        var prop = Constants.MpnAttachPropList[mpnAttachDropdown.SelectedItemIndex];
 
-            meidoManager.ActiveMeido.SetMpnProp(prop, detach);
-        }
+        meidoManager.ActiveMeido.SetMpnProp(prop, detach);
+    }
 
-        private void DetachAll()
-        {
-            if (!meidoManager.HasActiveMeido)
-                return;
+    private void DetachAll()
+    {
+        if (!meidoManager.HasActiveMeido)
+            return;
 
-            meidoManager.ActiveMeido.DetachAllMpnAttach();
-        }
+        meidoManager.ActiveMeido.DetachAllMpnAttach();
     }
 }

+ 49 - 50
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/SaveHandPane.cs

@@ -1,72 +1,71 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SaveHandPane : BasePane
 {
-    public class SaveHandPane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly ComboBox categoryComboBox;
-        private readonly TextField handNameTextField;
-        private readonly Button saveLeftHandButton;
-        private readonly 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;
+    private string categoryHeader;
+    private string nameHeader;
 
-        public SaveHandPane(MeidoManager meidoManager)
-        {
-            Constants.CustomHandChange += (s, a) =>
-                categoryComboBox.SetDropdownItems(Constants.CustomHandGroupList.ToArray());
+    public SaveHandPane(MeidoManager meidoManager)
+    {
+        Constants.CustomHandChange += (s, a) =>
+            categoryComboBox.SetDropdownItems(Constants.CustomHandGroupList.ToArray());
 
-            this.meidoManager = meidoManager;
+        this.meidoManager = meidoManager;
 
-            categoryHeader = Translation.Get("handPane", "categoryHeader");
+        categoryHeader = Translation.Get("handPane", "categoryHeader");
 
-            nameHeader = Translation.Get("handPane", "nameHeader");
+        nameHeader = Translation.Get("handPane", "nameHeader");
 
-            saveLeftHandButton = new(Translation.Get("handPane", "saveLeftButton"));
-            saveLeftHandButton.ControlEvent += (s, a) => SaveHand(right: false);
+        saveLeftHandButton = new(Translation.Get("handPane", "saveLeftButton"));
+        saveLeftHandButton.ControlEvent += (s, a) => SaveHand(right: false);
 
-            saveRightHandButton = new(Translation.Get("handPane", "saveRightButton"));
-            saveRightHandButton.ControlEvent += (s, a) => SaveHand(right: true);
+        saveRightHandButton = new(Translation.Get("handPane", "saveRightButton"));
+        saveRightHandButton.ControlEvent += (s, a) => SaveHand(right: true);
 
-            categoryComboBox = new(Constants.CustomHandGroupList.ToArray());
+        categoryComboBox = new(Constants.CustomHandGroupList.ToArray());
 
-            handNameTextField = new();
-        }
+        handNameTextField = new();
+    }
 
-        public override void Draw()
-        {
-            GUI.enabled = meidoManager.HasActiveMeido;
+    public override void Draw()
+    {
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            MpsGui.Header(categoryHeader);
-            categoryComboBox.Draw(GUILayout.Width(165f));
+        MpsGui.Header(categoryHeader);
+        categoryComboBox.Draw(GUILayout.Width(165f));
 
-            MpsGui.Header(nameHeader);
-            handNameTextField.Draw(GUILayout.Width(165f));
+        MpsGui.Header(nameHeader);
+        handNameTextField.Draw(GUILayout.Width(165f));
 
-            GUILayout.BeginHorizontal();
-            saveRightHandButton.Draw();
-            saveLeftHandButton.Draw();
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        saveRightHandButton.Draw();
+        saveLeftHandButton.Draw();
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            categoryHeader = Translation.Get("handPane", "categoryHeader");
-            nameHeader = Translation.Get("handPane", "nameHeader");
-            saveLeftHandButton.Label = Translation.Get("handPane", "saveLeftButton");
-            saveRightHandButton.Label = Translation.Get("handPane", "saveRightButton");
-        }
+    protected override void ReloadTranslation()
+    {
+        categoryHeader = Translation.Get("handPane", "categoryHeader");
+        nameHeader = Translation.Get("handPane", "nameHeader");
+        saveLeftHandButton.Label = Translation.Get("handPane", "saveLeftButton");
+        saveRightHandButton.Label = Translation.Get("handPane", "saveRightButton");
+    }
 
-        private void SaveHand(bool right)
-        {
-            var handBinary = meidoManager.ActiveMeido.IKManager.SerializeHand(right);
+    private void SaveHand(bool right)
+    {
+        var handBinary = meidoManager.ActiveMeido.IKManager.SerializeHand(right);
 
-            Constants.AddHand(handBinary, right, handNameTextField.Value, categoryComboBox.Value);
-            handNameTextField.Value = string.Empty;
-        }
+        Constants.AddHand(handBinary, right, handNameTextField.Value, categoryComboBox.Value);
+        handNameTextField.Value = string.Empty;
     }
 }

+ 45 - 46
src/MeidoPhotoStudio.Plugin/GUI/Panes/PoseWindowPanes/SavePosePane.cs

@@ -1,66 +1,65 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SavePosePane : BasePane
 {
-    public class SavePosePane : BasePane
-    {
-        private readonly MeidoManager meidoManager;
-        private readonly Button savePoseButton;
-        private readonly TextField poseNameTextField;
-        private readonly ComboBox categoryComboBox;
+    private readonly MeidoManager meidoManager;
+    private readonly Button savePoseButton;
+    private readonly TextField poseNameTextField;
+    private readonly ComboBox categoryComboBox;
 
-        private string categoryHeader;
-        private string nameHeader;
+    private string categoryHeader;
+    private string nameHeader;
 
-        public SavePosePane(MeidoManager meidoManager)
-        {
-            Constants.CustomPoseChange += (s, a) =>
-                categoryComboBox.SetDropdownItems(Constants.CustomPoseGroupList.ToArray());
+    public SavePosePane(MeidoManager meidoManager)
+    {
+        Constants.CustomPoseChange += (s, a) =>
+            categoryComboBox.SetDropdownItems(Constants.CustomPoseGroupList.ToArray());
 
-            this.meidoManager = meidoManager;
+        this.meidoManager = meidoManager;
 
-            categoryHeader = Translation.Get("posePane", "categoryHeader");
-            nameHeader = Translation.Get("posePane", "nameHeader");
+        categoryHeader = Translation.Get("posePane", "categoryHeader");
+        nameHeader = Translation.Get("posePane", "nameHeader");
 
-            savePoseButton = new(Translation.Get("posePane", "saveButton"));
-            savePoseButton.ControlEvent += OnSavePose;
+        savePoseButton = new(Translation.Get("posePane", "saveButton"));
+        savePoseButton.ControlEvent += OnSavePose;
 
-            categoryComboBox = new(Constants.CustomPoseGroupList.ToArray());
+        categoryComboBox = new(Constants.CustomPoseGroupList.ToArray());
 
-            poseNameTextField = new();
-            poseNameTextField.ControlEvent += OnSavePose;
-        }
+        poseNameTextField = new();
+        poseNameTextField.ControlEvent += OnSavePose;
+    }
 
-        public override void Draw()
-        {
-            GUI.enabled = meidoManager.HasActiveMeido;
+    public override void Draw()
+    {
+        GUI.enabled = meidoManager.HasActiveMeido;
 
-            MpsGui.Header(categoryHeader);
-            categoryComboBox.Draw(GUILayout.Width(160f));
+        MpsGui.Header(categoryHeader);
+        categoryComboBox.Draw(GUILayout.Width(160f));
 
-            MpsGui.Header(nameHeader);
-            GUILayout.BeginHorizontal();
-            poseNameTextField.Draw(GUILayout.Width(160f));
-            savePoseButton.Draw(GUILayout.ExpandWidth(false));
-            GUILayout.EndHorizontal();
+        MpsGui.Header(nameHeader);
+        GUILayout.BeginHorizontal();
+        poseNameTextField.Draw(GUILayout.Width(160f));
+        savePoseButton.Draw(GUILayout.ExpandWidth(false));
+        GUILayout.EndHorizontal();
 
-            GUI.enabled = true;
-        }
+        GUI.enabled = true;
+    }
 
-        protected override void ReloadTranslation()
-        {
-            categoryHeader = Translation.Get("posePane", "categoryHeader");
-            nameHeader = Translation.Get("posePane", "nameHeader");
-            savePoseButton.Label = Translation.Get("posePane", "saveButton");
-        }
+    protected override void ReloadTranslation()
+    {
+        categoryHeader = Translation.Get("posePane", "categoryHeader");
+        nameHeader = Translation.Get("posePane", "nameHeader");
+        savePoseButton.Label = Translation.Get("posePane", "saveButton");
+    }
 
-        private void OnSavePose(object sender, EventArgs args)
-        {
-            var anmBinary = meidoManager.ActiveMeido.SerializePose();
+    private void OnSavePose(object sender, EventArgs args)
+    {
+        var anmBinary = meidoManager.ActiveMeido.SerializePose();
 
-            Constants.AddPose(anmBinary, poseNameTextField.Value, categoryComboBox.Value);
-            poseNameTextField.Value = string.Empty;
-        }
+        Constants.AddPose(anmBinary, poseNameTextField.Value, categoryComboBox.Value);
+        poseNameTextField.Value = string.Empty;
     }
 }

+ 77 - 78
src/MeidoPhotoStudio.Plugin/GUI/Panes/SceneManagerPanes/SceneManagerDirectoryPane.cs

@@ -1,106 +1,105 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class SceneManagerDirectoryPane : BasePane
-    {
-        public static readonly int listWidth = 200;
-
-        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(0.5f, 0.5f, 0.5f, 0.4f));
+namespace MeidoPhotoStudio.Plugin;
 
-        private Vector2 listScrollPos;
-        private bool createDirectoryMode;
+public class SceneManagerDirectoryPane : BasePane
+{
+    public static readonly int listWidth = 200;
 
-        public SceneManagerDirectoryPane(SceneManager sceneManager, SceneModalWindow sceneModalWindow)
-        {
-            this.sceneManager = sceneManager;
-            this.sceneModalWindow = sceneModalWindow;
+    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(0.5f, 0.5f, 0.5f, 0.4f));
 
-            createDirectoryButton = new(Translation.Get("sceneManager", "createDirectoryButton"));
-            createDirectoryButton.ControlEvent += (s, a) => createDirectoryMode = true;
+    private Vector2 listScrollPos;
+    private bool createDirectoryMode;
 
-            deleteDirectoryButton = new(Translation.Get("sceneManager", "deleteDirectoryButton"));
-            deleteDirectoryButton.ControlEvent += (s, a) => this.sceneModalWindow.ShowDirectoryDialogue();
+    public SceneManagerDirectoryPane(SceneManager sceneManager, SceneModalWindow sceneModalWindow)
+    {
+        this.sceneManager = sceneManager;
+        this.sceneModalWindow = sceneModalWindow;
 
-            directoryTextField = new();
-            directoryTextField.ControlEvent += (s, a) =>
-            {
-                sceneManager.AddDirectory(directoryTextField.Value);
-                createDirectoryMode = false;
-                directoryTextField.Value = string.Empty;
-            };
+        createDirectoryButton = new(Translation.Get("sceneManager", "createDirectoryButton"));
+        createDirectoryButton.ControlEvent += (s, a) => createDirectoryMode = true;
 
-            cancelButton = new("X");
-            cancelButton.ControlEvent += (s, a) => createDirectoryMode = false;
-        }
+        deleteDirectoryButton = new(Translation.Get("sceneManager", "deleteDirectoryButton"));
+        deleteDirectoryButton.ControlEvent += (s, a) => this.sceneModalWindow.ShowDirectoryDialogue();
 
-        public override void Draw()
+        directoryTextField = new();
+        directoryTextField.ControlEvent += (s, a) =>
         {
-            var directoryStyle = new GUIStyle(GUI.skin.button)
-            {
-                fontSize = Utility.GetPix(12),
-                alignment = TextAnchor.MiddleLeft,
-                margin = new(0, 0, 0, 0),
-            };
+            sceneManager.AddDirectory(directoryTextField.Value);
+            createDirectoryMode = false;
+            directoryTextField.Value = string.Empty;
+        };
 
-            var directorySelectedStyle = new GUIStyle(directoryStyle);
+        cancelButton = new("X");
+        cancelButton.ControlEvent += (s, a) => createDirectoryMode = false;
+    }
 
-            directorySelectedStyle.normal.textColor = Color.white;
-            directorySelectedStyle.normal.background = selectedTexture;
-            directorySelectedStyle.hover.background = selectedTexture;
+    public override void Draw()
+    {
+        var directoryStyle = new GUIStyle(GUI.skin.button)
+        {
+            fontSize = Utility.GetPix(12),
+            alignment = TextAnchor.MiddleLeft,
+            margin = new(0, 0, 0, 0),
+        };
 
-            GUILayout.BeginVertical(GUILayout.Width(Utility.GetPix(listWidth)));
+        var directorySelectedStyle = new GUIStyle(directoryStyle);
 
-            listScrollPos = GUILayout.BeginScrollView(listScrollPos);
+        directorySelectedStyle.normal.textColor = Color.white;
+        directorySelectedStyle.normal.background = selectedTexture;
+        directorySelectedStyle.hover.background = selectedTexture;
 
-            for (var i = 0; i < sceneManager.CurrentDirectoryList.Count; i++)
-            {
-                var style = i == sceneManager.CurrentDirectoryIndex ? directorySelectedStyle : directoryStyle;
-                var directoryName = sceneManager.CurrentDirectoryList[i];
+        GUILayout.BeginVertical(GUILayout.Width(Utility.GetPix(listWidth)));
 
-                if (GUILayout.Button(directoryName, style, GUILayout.Height(Utility.GetPix(20))))
-                    sceneManager.SelectDirectory(i);
-            }
+        listScrollPos = GUILayout.BeginScrollView(listScrollPos);
 
-            GUILayout.EndScrollView();
+        for (var i = 0; i < sceneManager.CurrentDirectoryList.Count; i++)
+        {
+            var style = i == sceneManager.CurrentDirectoryIndex ? directorySelectedStyle : directoryStyle;
+            var directoryName = sceneManager.CurrentDirectoryList[i];
 
-            GUILayout.BeginHorizontal();
+            if (GUILayout.Button(directoryName, style, GUILayout.Height(Utility.GetPix(20))))
+                sceneManager.SelectDirectory(i);
+        }
 
-            var buttonStyle = new GUIStyle(GUI.skin.button)
-            {
-                fontSize = Utility.GetPix(12),
-            };
+        GUILayout.EndScrollView();
 
-            var buttonHeight = GUILayout.Height(Utility.GetPix(20));
+        GUILayout.BeginHorizontal();
 
-            if (createDirectoryMode)
-            {
-                directoryTextField.Draw(buttonHeight, GUILayout.Width(Utility.GetPix(listWidth - 30)));
-                cancelButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
-            }
-            else
-            {
-                createDirectoryButton.Draw(buttonStyle, buttonHeight);
-                GUI.enabled = sceneManager.CurrentDirectoryIndex > 0;
-                deleteDirectoryButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
-                GUI.enabled = true;
-            }
+        var buttonStyle = new GUIStyle(GUI.skin.button)
+        {
+            fontSize = Utility.GetPix(12),
+        };
 
-            GUILayout.EndHorizontal();
+        var buttonHeight = GUILayout.Height(Utility.GetPix(20));
 
-            GUILayout.EndVertical();
+        if (createDirectoryMode)
+        {
+            directoryTextField.Draw(buttonHeight, GUILayout.Width(Utility.GetPix(listWidth - 30)));
+            cancelButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
         }
-
-        protected override void ReloadTranslation()
+        else
         {
-            createDirectoryButton.Label = Translation.Get("sceneManager", "createDirectoryButton");
-            deleteDirectoryButton.Label = Translation.Get("sceneManager", "deleteDirectoryButton");
+            createDirectoryButton.Draw(buttonStyle, buttonHeight);
+            GUI.enabled = sceneManager.CurrentDirectoryIndex > 0;
+            deleteDirectoryButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
+            GUI.enabled = true;
         }
+
+        GUILayout.EndHorizontal();
+
+        GUILayout.EndVertical();
+    }
+
+    protected override void ReloadTranslation()
+    {
+        createDirectoryButton.Label = Translation.Get("sceneManager", "createDirectoryButton");
+        deleteDirectoryButton.Label = Translation.Get("sceneManager", "deleteDirectoryButton");
     }
 }

+ 61 - 62
src/MeidoPhotoStudio.Plugin/GUI/Panes/SceneManagerPanes/SceneManagerScenePane.cs

@@ -1,91 +1,90 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SceneManagerScenePane : BasePane
 {
-    public class SceneManagerScenePane : BasePane
-    {
-        public static readonly float thumbnailScale = 0.55f;
-        private readonly SceneManager sceneManager;
-        private readonly SceneModalWindow sceneModalWindow;
-        private readonly Button addSceneButton;
-        private Vector2 sceneScrollPos;
+    public static readonly float thumbnailScale = 0.55f;
+    private readonly SceneManager sceneManager;
+    private readonly SceneModalWindow sceneModalWindow;
+    private readonly Button addSceneButton;
+    private Vector2 sceneScrollPos;
 
-        public SceneManagerScenePane(SceneManager sceneManager, SceneModalWindow sceneModalWindow)
-        {
-            this.sceneManager = sceneManager;
-            this.sceneModalWindow = sceneModalWindow;
+    public SceneManagerScenePane(SceneManager sceneManager, SceneModalWindow sceneModalWindow)
+    {
+        this.sceneManager = sceneManager;
+        this.sceneModalWindow = sceneModalWindow;
 
-            addSceneButton = new("+");
-            addSceneButton.ControlEvent += (s, a) => sceneManager.SaveScene(overwrite: false);
-        }
+        addSceneButton = new("+");
+        addSceneButton.ControlEvent += (s, a) => sceneManager.SaveScene(overwrite: false);
+    }
 
-        public override void Draw()
+    public override void Draw()
+    {
+        var sceneImageStyle = new GUIStyle(GUI.skin.label)
         {
-            var sceneImageStyle = new GUIStyle(GUI.skin.label)
-            {
-                alignment = TextAnchor.MiddleCenter,
-                padding = new RectOffset(0, 0, 0, 0)
-            };
+            alignment = TextAnchor.MiddleCenter,
+            padding = new RectOffset(0, 0, 0, 0)
+        };
 
-            var addSceneStyle = new GUIStyle(GUI.skin.button)
-            {
-                alignment = TextAnchor.MiddleCenter,
-                fontSize = 60
-            };
+        var addSceneStyle = new GUIStyle(GUI.skin.button)
+        {
+            alignment = TextAnchor.MiddleCenter,
+            fontSize = 60
+        };
 
-            GUILayout.BeginVertical();
+        GUILayout.BeginVertical();
 
-            var sceneWidth = SceneManager.sceneDimensions.x * thumbnailScale;
-            var sceneHeight = SceneManager.sceneDimensions.y * thumbnailScale;
-            var sceneGridWidth = parent.WindowRect.width - SceneManagerDirectoryPane.listWidth;
+        var sceneWidth = SceneManager.sceneDimensions.x * thumbnailScale;
+        var sceneHeight = SceneManager.sceneDimensions.y * thumbnailScale;
+        var sceneGridWidth = parent.WindowRect.width - SceneManagerDirectoryPane.listWidth;
 
-            var sceneLayoutOptions = new[]
-            {
-                GUILayout.Height(sceneHeight),
+        var sceneLayoutOptions = new[]
+        {
+            GUILayout.Height(sceneHeight),
                 GUILayout.Width(sceneWidth),
-            };
+        };
 
-            var columns = Mathf.Max(1, (int)(sceneGridWidth / sceneWidth));
-            var rows = (int)Mathf.Ceil(sceneManager.SceneList.Count + 1 / (float)columns);
+        var columns = Mathf.Max(1, (int)(sceneGridWidth / sceneWidth));
+        var rows = (int)Mathf.Ceil(sceneManager.SceneList.Count + 1 / (float)columns);
 
-            sceneScrollPos = GUILayout.BeginScrollView(sceneScrollPos);
+        sceneScrollPos = GUILayout.BeginScrollView(sceneScrollPos);
 
-            GUILayout.BeginHorizontal();
-            GUILayout.FlexibleSpace();
-            GUILayout.BeginVertical();
+        GUILayout.BeginHorizontal();
+        GUILayout.FlexibleSpace();
+        GUILayout.BeginVertical();
 
-            var currentScene = -1;
+        var currentScene = -1;
 
-            for (var i = 0; i < rows; i++)
-            {
-                GUILayout.BeginHorizontal();
+        for (var i = 0; i < rows; i++)
+        {
+            GUILayout.BeginHorizontal();
 
-                for (var j = 0; j < columns; j++, currentScene++)
+            for (var j = 0; j < columns; j++, currentScene++)
+            {
+                if (currentScene == -1)
+                    addSceneButton.Draw(addSceneStyle, sceneLayoutOptions);
+                else if (currentScene < sceneManager.SceneList.Count)
                 {
-                    if (currentScene == -1)
-                        addSceneButton.Draw(addSceneStyle, sceneLayoutOptions);
-                    else if (currentScene < sceneManager.SceneList.Count)
-                    {
-                        var scene = sceneManager.SceneList[currentScene];
+                    var scene = sceneManager.SceneList[currentScene];
 
-                        if (GUILayout.Button(scene.Thumbnail, sceneImageStyle, sceneLayoutOptions))
-                        {
-                            sceneManager.SelectScene(currentScene);
-                            sceneModalWindow.ShowSceneDialogue();
-                        }
+                    if (GUILayout.Button(scene.Thumbnail, sceneImageStyle, sceneLayoutOptions))
+                    {
+                        sceneManager.SelectScene(currentScene);
+                        sceneModalWindow.ShowSceneDialogue();
                     }
                 }
-
-                GUILayout.EndHorizontal();
             }
 
-            GUILayout.EndVertical();
-            GUILayout.FlexibleSpace();
             GUILayout.EndHorizontal();
+        }
 
-            GUILayout.EndScrollView();
+        GUILayout.EndVertical();
+        GUILayout.FlexibleSpace();
+        GUILayout.EndHorizontal();
 
-            GUILayout.EndVertical();
-        }
+        GUILayout.EndScrollView();
+
+        GUILayout.EndVertical();
     }
 }

+ 84 - 85
src/MeidoPhotoStudio.Plugin/GUI/Panes/SceneManagerPanes/SceneManagerTitleBar.cs

@@ -1,129 +1,128 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SceneManagerTitleBarPane : BasePane
 {
-    public class SceneManagerTitleBarPane : BasePane
-    {
-        private static readonly string[] sortModes = new[] { "sortName", "sortCreated", "sortModified" };
+    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 readonly SceneManager sceneManager;
+    private readonly Button kankyoToggle;
+    private readonly Button refreshButton;
+    private readonly Dropdown sortDropdown;
+    private readonly Toggle descendingToggle;
+    private readonly Button closeButton;
 
-        public event System.EventHandler CloseChange;
+    public event System.EventHandler CloseChange;
 
-        private string sortLabel;
+    private string sortLabel;
 
-        public SceneManagerTitleBarPane(SceneManager sceneManager)
-        {
-            this.sceneManager = sceneManager;
-            kankyoToggle = new(Translation.Get("sceneManager", "kankyoToggle"));
-            kankyoToggle.ControlEvent += (s, a) => sceneManager.ToggleKankyoMode();
+    public SceneManagerTitleBarPane(SceneManager sceneManager)
+    {
+        this.sceneManager = sceneManager;
+        kankyoToggle = new(Translation.Get("sceneManager", "kankyoToggle"));
+        kankyoToggle.ControlEvent += (s, a) => sceneManager.ToggleKankyoMode();
 
-            refreshButton = new(Translation.Get("sceneManager", "refreshButton"));
-            refreshButton.ControlEvent += (s, a) => sceneManager.Refresh();
+        refreshButton = new(Translation.Get("sceneManager", "refreshButton"));
+        refreshButton.ControlEvent += (s, a) => sceneManager.Refresh();
 
-            sortDropdown = new(
+        sortDropdown = new(
                 Translation.GetArray("sceneManager", sortModes), (int)sceneManager.CurrentSortMode
-            );
+                );
 
-            sortDropdown.SelectionChange += (s, a) =>
-            {
-                var sortMode = (SceneManager.SortMode)sortDropdown.SelectedItemIndex;
+        sortDropdown.SelectionChange += (s, a) =>
+        {
+            var sortMode = (SceneManager.SortMode)sortDropdown.SelectedItemIndex;
 
-                if (sceneManager.CurrentSortMode == sortMode)
-                    return;
+            if (sceneManager.CurrentSortMode == sortMode)
+                return;
 
-                sceneManager.SortScenes(sortMode);
-            };
+            sceneManager.SortScenes(sortMode);
+        };
 
-            descendingToggle = new(
+        descendingToggle = new(
                 Translation.Get("sceneManager", "descendingToggle"), sceneManager.SortDescending
-            );
+                );
 
-            descendingToggle.ControlEvent += (s, a) =>
-            {
-                sceneManager.SortDescending = descendingToggle.Value;
-                sceneManager.SortScenes(sceneManager.CurrentSortMode);
-            };
+        descendingToggle.ControlEvent += (s, a) =>
+        {
+            sceneManager.SortDescending = descendingToggle.Value;
+            sceneManager.SortScenes(sceneManager.CurrentSortMode);
+        };
 
-            closeButton = new("X");
-            closeButton.ControlEvent += (s, a) => CloseChange?.Invoke(this, System.EventArgs.Empty);
+        closeButton = new("X");
+        closeButton.ControlEvent += (s, a) => CloseChange?.Invoke(this, System.EventArgs.Empty);
 
-            sortLabel = Translation.Get("sceneManager", "sortLabel");
-        }
+        sortLabel = Translation.Get("sceneManager", "sortLabel");
+    }
 
-        public override void Draw()
+    public override void Draw()
+    {
+        var buttonStyle = new GUIStyle(GUI.skin.button)
         {
-            var buttonStyle = new GUIStyle(GUI.skin.button)
-            {
-                fontSize = Utility.GetPix(12),
-            };
+            fontSize = Utility.GetPix(12),
+        };
 
-            var buttonHeight = GUILayout.Height(Utility.GetPix(20));
+        var buttonHeight = GUILayout.Height(Utility.GetPix(20));
 
-            GUILayout.BeginHorizontal();
+        GUILayout.BeginHorizontal();
 
-            GUILayout.BeginHorizontal(GUILayout.Width(Utility.GetPix(SceneManagerDirectoryPane.listWidth)));
+        GUILayout.BeginHorizontal(GUILayout.Width(Utility.GetPix(SceneManagerDirectoryPane.listWidth)));
 
-            var originalColour = GUI.backgroundColor;
+        var originalColour = GUI.backgroundColor;
 
-            if (sceneManager.KankyoMode)
-                GUI.backgroundColor = Color.green;
+        if (sceneManager.KankyoMode)
+            GUI.backgroundColor = Color.green;
 
-            kankyoToggle.Draw(buttonStyle, buttonHeight);
-            GUI.backgroundColor = originalColour;
+        kankyoToggle.Draw(buttonStyle, buttonHeight);
+        GUI.backgroundColor = originalColour;
 
-            GUILayout.FlexibleSpace();
+        GUILayout.FlexibleSpace();
 
-            refreshButton.Draw(buttonStyle, buttonHeight);
+        refreshButton.Draw(buttonStyle, buttonHeight);
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUILayout.BeginHorizontal();
+        GUILayout.BeginHorizontal();
 
-            GUILayout.Space(Utility.GetPix(15));
+        GUILayout.Space(Utility.GetPix(15));
 
-            var labelStyle = new GUIStyle(GUI.skin.label)
-            {
-                fontSize = buttonStyle.fontSize,
-            };
+        var labelStyle = new GUIStyle(GUI.skin.label)
+        {
+            fontSize = buttonStyle.fontSize,
+        };
 
-            GUILayout.Label(sortLabel, labelStyle);
+        GUILayout.Label(sortLabel, labelStyle);
 
-            var dropdownStyle = new GUIStyle(DropdownHelper.DefaultDropdownStyle)
-            {
-                fontSize = buttonStyle.fontSize,
-            };
+        var dropdownStyle = new GUIStyle(DropdownHelper.DefaultDropdownStyle)
+        {
+            fontSize = buttonStyle.fontSize,
+        };
 
-            sortDropdown.Draw(buttonStyle, dropdownStyle, buttonHeight, GUILayout.Width(Utility.GetPix(100)));
+        sortDropdown.Draw(buttonStyle, dropdownStyle, buttonHeight, GUILayout.Width(Utility.GetPix(100)));
 
-            var toggleStyle = new GUIStyle(GUI.skin.toggle)
-            {
-                fontSize = buttonStyle.fontSize,
-            };
+        var toggleStyle = new GUIStyle(GUI.skin.toggle)
+        {
+            fontSize = buttonStyle.fontSize,
+        };
 
-            descendingToggle.Draw(toggleStyle);
+        descendingToggle.Draw(toggleStyle);
 
-            GUILayout.FlexibleSpace();
+        GUILayout.FlexibleSpace();
 
-            closeButton.Draw();
+        closeButton.Draw();
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUILayout.EndHorizontal();
-        }
+        GUILayout.EndHorizontal();
+    }
 
-        protected override void ReloadTranslation()
-        {
-            kankyoToggle.Label = Translation.Get("sceneManager", "kankyoToggle");
-            refreshButton.Label = Translation.Get("sceneManager", "refreshButton");
-            sortDropdown.SetDropdownItems(Translation.GetArray("sceneManager", sortModes));
-            descendingToggle.Label = Translation.Get("sceneManager", "descendingToggle");
-            sortLabel = Translation.Get("sceneManager", "sortLabel");
-        }
+    protected override void ReloadTranslation()
+    {
+        kankyoToggle.Label = Translation.Get("sceneManager", "kankyoToggle");
+        refreshButton.Label = Translation.Get("sceneManager", "refreshButton");
+        sortDropdown.SetDropdownItems(Translation.GetArray("sceneManager", sortModes));
+        descendingToggle.Label = Translation.Get("sceneManager", "descendingToggle");
+        sortLabel = Translation.Get("sceneManager", "sortLabel");
     }
 }

+ 65 - 66
src/MeidoPhotoStudio.Plugin/GUI/Windows/BaseWindow.cs

@@ -1,98 +1,97 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class BaseWindow : BasePane
 {
-    public abstract class BaseWindow : BasePane
-    {
-        private static int id = 765;
+    private static int id = 765;
 
-        private static int ID =>
-            id++;
+    private static int ID =>
+        id++;
 
-        public readonly int windowID = ID;
+    public readonly int windowID = ID;
 
-        protected readonly List<BasePane> Panes = new();
+    protected readonly List<BasePane> Panes = new();
 
-        public bool ActiveWindow { get; set; }
+    public bool ActiveWindow { get; set; }
 
-        protected Vector2 scrollPos;
-        protected Rect windowRect = new(0f, 0f, 480f, 270f);
+    protected Vector2 scrollPos;
+    protected Rect windowRect = new(0f, 0f, 480f, 270f);
 
-        public virtual Rect WindowRect
+    public virtual Rect WindowRect
+    {
+        get => windowRect;
+        set
         {
-            get => windowRect;
-            set
-            {
-                value.x = Mathf.Clamp(
+            value.x = Mathf.Clamp(
                     value.x, -value.width + Utility.GetPix(20), Screen.width - Utility.GetPix(20)
-                );
+                    );
 
-                value.y = Mathf.Clamp(
+            value.y = Mathf.Clamp(
                     value.y, -value.height + Utility.GetPix(20), Screen.height - Utility.GetPix(20)
-                );
+                    );
 
-                windowRect = value;
-            }
+            windowRect = value;
         }
+    }
 
-        public virtual void Update() =>
-            HandleZoom();
+    public virtual void Update() =>
+        HandleZoom();
 
-        public virtual void GUIFunc(int id)
-        {
-            Draw();
-            GUI.DragWindow();
-        }
+    public virtual void GUIFunc(int id)
+    {
+        Draw();
+        GUI.DragWindow();
+    }
 
-        public virtual void UpdatePanes()
-        {
-            foreach (var pane in Panes)
-                pane.UpdatePane();
-        }
+    public virtual void UpdatePanes()
+    {
+        foreach (var pane in Panes)
+            pane.UpdatePane();
+    }
 
-        public override void SetParent(BaseWindow window)
-        {
-            foreach (var pane in Panes)
-                pane.SetParent(window);
-        }
+    public override void SetParent(BaseWindow window)
+    {
+        foreach (var pane in Panes)
+            pane.SetParent(window);
+    }
 
-        public override void Activate()
-        {
-            base.Activate();
+    public override void Activate()
+    {
+        base.Activate();
 
-            foreach (var pane in Panes)
-                pane.Activate();
-        }
+        foreach (var pane in Panes)
+            pane.Activate();
+    }
 
-        public override void Deactivate()
-        {
-            base.Deactivate();
+    public override void Deactivate()
+    {
+        base.Deactivate();
 
-            foreach (var pane in Panes)
-                pane.Deactivate();
-        }
+        foreach (var pane in Panes)
+            pane.Deactivate();
+    }
 
-        protected Vector2 MiddlePosition =>
-            new((float)Screen.width / 2 - windowRect.width / 2, (float)Screen.height / 2 - windowRect.height / 2);
+    protected Vector2 MiddlePosition =>
+        new((float)Screen.width / 2 - windowRect.width / 2, (float)Screen.height / 2 - windowRect.height / 2);
 
-        protected T AddPane<T>(T pane) where T : BasePane
-        {
-            Panes.Add(pane);
-            pane.SetParent(this);
+    protected T AddPane<T>(T pane) where T : BasePane
+    {
+        Panes.Add(pane);
+        pane.SetParent(this);
 
-            return pane;
-        }
+        return pane;
+    }
 
-        private void HandleZoom()
-        {
-            if (Input.mouseScrollDelta.y == 0f || !Visible)
-                return;
+    private void HandleZoom()
+    {
+        if (Input.mouseScrollDelta.y == 0f || !Visible)
+            return;
 
-            var mousePos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
+        var mousePos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y);
 
-            if (WindowRect.Contains(mousePos))
-                Input.ResetInputAxes();
-        }
+        if (WindowRect.Contains(mousePos))
+            Input.ResetInputAxes();
     }
 }

+ 133 - 134
src/MeidoPhotoStudio.Plugin/GUI/Windows/MainWindow.cs

@@ -1,182 +1,181 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MainWindow : BaseWindow
 {
-    public class MainWindow : BaseWindow
+    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;
+    private string settingsButtonLabel;
+    private string closeButtonLabel;
+    private Constants.Window selectedWindow;
+
+    public override Rect WindowRect
     {
-        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;
-        private string settingsButtonLabel;
-        private string closeButtonLabel;
-        private Constants.Window selectedWindow;
-
-        public override Rect WindowRect
+        set
         {
-            set
-            {
-                value.width = 240f;
-                value.height = Screen.height * 0.9f;
+            value.width = 240f;
+            value.height = Screen.height * 0.9f;
 
-                if (MeidoPhotoStudio.EditMode)
-                    value.height *= 0.85f;
+            if (MeidoPhotoStudio.EditMode)
+                value.height *= 0.85f;
 
-                value.x = Mathf.Clamp(value.x, 0, Screen.width - value.width);
-                value.y = Mathf.Clamp(value.y, -value.height + 30, Screen.height - 50);
+            value.x = Mathf.Clamp(value.x, 0, Screen.width - value.width);
+            value.y = Mathf.Clamp(value.y, -value.height + 30, Screen.height - 50);
 
-                windowRect = value;
-            }
+            windowRect = value;
         }
+    }
 
-        public BaseMainWindowPane this[Constants.Window id]
-        {
-            get => windowPanes[id];
-            set => AddWindow(id, value);
-        }
+    public BaseMainWindowPane this[Constants.Window id]
+    {
+        get => windowPanes[id];
+        set => AddWindow(id, value);
+    }
 
-        // TODO: Find a better way of doing this
-        public MainWindow(MeidoManager meidoManager, PropManager propManager, LightManager lightManager)
-        {
-            this.meidoManager = meidoManager;
-            this.meidoManager.UpdateMeido += UpdateMeido;
+    // TODO: Find a better way of doing this
+    public MainWindow(MeidoManager meidoManager, PropManager propManager, LightManager lightManager)
+    {
+        this.meidoManager = meidoManager;
+        this.meidoManager.UpdateMeido += UpdateMeido;
 
-            this.propManager = propManager;
-            this.propManager.FromPropSelect += (s, a) => ChangeWindow(Constants.Window.BG2);
+        this.propManager = propManager;
+        this.propManager.FromPropSelect += (s, a) => ChangeWindow(Constants.Window.BG2);
 
-            this.lightManager = lightManager;
-            this.lightManager.Select += (s, a) => ChangeWindow(Constants.Window.BG);
+        this.lightManager = lightManager;
+        this.lightManager.Select += (s, a) => ChangeWindow(Constants.Window.BG);
 
-            windowPanes = new();
-            WindowRect = new(Screen.width, Screen.height * 0.08f, 240f, Screen.height * 0.9f);
+        windowPanes = new();
+        WindowRect = new(Screen.width, Screen.height * 0.08f, 240f, Screen.height * 0.9f);
 
-            tabsPane = new();
-            tabsPane.TabChange += (s, a) => ChangeTab();
+        tabsPane = new();
+        tabsPane.TabChange += (s, a) => ChangeTab();
 
-            settingsButtonLabel = Translation.Get("settingsLabels", "settingsButton");
-            closeButtonLabel = Translation.Get("settingsLabels", "closeSettingsButton");
+        settingsButtonLabel = Translation.Get("settingsLabels", "settingsButton");
+        closeButtonLabel = Translation.Get("settingsLabels", "closeSettingsButton");
 
-            settingsButton = new(settingsButtonLabel);
-            settingsButton.ControlEvent += (s, a) =>
+        settingsButton = new(settingsButtonLabel);
+        settingsButton.ControlEvent += (s, a) =>
+        {
+            if (selectedWindow == Constants.Window.Settings)
+                ChangeTab();
+            else
             {
-                if (selectedWindow == Constants.Window.Settings)
-                    ChangeTab();
-                else
-                {
-                    settingsButton.Label = closeButtonLabel;
-                    SetCurrentWindow(Constants.Window.Settings);
-                }
-            };
-        }
+                settingsButton.Label = closeButtonLabel;
+                SetCurrentWindow(Constants.Window.Settings);
+            }
+        };
+    }
 
-        public void AddWindow(Constants.Window id, BaseMainWindowPane window)
-        {
-            if (windowPanes.ContainsKey(id))
-                Panes.Remove(windowPanes[id]);
+    public void AddWindow(Constants.Window id, BaseMainWindowPane window)
+    {
+        if (windowPanes.ContainsKey(id))
+            Panes.Remove(windowPanes[id]);
 
-            windowPanes[id] = window;
-            windowPanes[id].SetTabsPane(tabsPane);
-            windowPanes[id].SetParent(this);
+        windowPanes[id] = window;
+        windowPanes[id].SetTabsPane(tabsPane);
+        windowPanes[id].SetParent(this);
 
-            Panes.Add(windowPanes[id]);
-        }
+        Panes.Add(windowPanes[id]);
+    }
 
-        public override void Activate()
-        {
-            base.Activate();
+    public override void Activate()
+    {
+        base.Activate();
 
-            updating = true;
-            tabsPane.SelectedTab = Constants.Window.Call;
-            updating = false;
-            Visible = true;
-        }
+        updating = true;
+        tabsPane.SelectedTab = Constants.Window.Call;
+        updating = false;
+        Visible = true;
+    }
 
-        public override void Update()
-        {
-            base.Update();
+    public override void Update()
+    {
+        base.Update();
 
-            if (InputManager.GetKeyDown(MpsKey.ToggleUI))
-                Visible = !Visible;
-        }
+        if (InputManager.GetKeyDown(MpsKey.ToggleUI))
+            Visible = !Visible;
+    }
 
-        public override void Draw()
-        {
-            currentWindowPane?.Draw();
+    public override void Draw()
+    {
+        currentWindowPane?.Draw();
 
-            GUI.enabled = true;
+        GUI.enabled = true;
 
-            GUILayout.FlexibleSpace();
+        GUILayout.FlexibleSpace();
 
-            var labelStyle = new GUIStyle(GUI.skin.label)
-            {
-                fontSize = 10,
-                alignment = TextAnchor.LowerLeft,
-            };
+        var labelStyle = new GUIStyle(GUI.skin.label)
+        {
+            fontSize = 10,
+            alignment = TextAnchor.LowerLeft,
+        };
 
-            GUILayout.BeginHorizontal();
-            GUILayout.Label(MeidoPhotoStudio.pluginString, labelStyle);
-            GUILayout.FlexibleSpace();
+        GUILayout.BeginHorizontal();
+        GUILayout.Label(MeidoPhotoStudio.pluginString, labelStyle);
+        GUILayout.FlexibleSpace();
 
-            GUI.enabled = !InputManager.Listening;
+        GUI.enabled = !InputManager.Listening;
 
-            settingsButton.Draw(GUILayout.ExpandWidth(false));
+        settingsButton.Draw(GUILayout.ExpandWidth(false));
 
-            GUI.enabled = true;
+        GUI.enabled = true;
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUI.DragWindow();
-        }
+        GUI.DragWindow();
+    }
 
-        protected override void ReloadTranslation()
-        {
-            settingsButtonLabel = Translation.Get("settingsLabels", "settingsButton");
-            closeButtonLabel = Translation.Get("settingsLabels", "closeSettingsButton");
-            settingsButton.Label = selectedWindow == Constants.Window.Settings ? closeButtonLabel : settingsButtonLabel;
-        }
+    protected override void ReloadTranslation()
+    {
+        settingsButtonLabel = Translation.Get("settingsLabels", "settingsButton");
+        closeButtonLabel = Translation.Get("settingsLabels", "closeSettingsButton");
+        settingsButton.Label = selectedWindow == Constants.Window.Settings ? closeButtonLabel : settingsButtonLabel;
+    }
 
-        private void ChangeTab()
-        {
-            settingsButton.Label = Translation.Get("settingsLabels", "settingsButton");
-            SetCurrentWindow(tabsPane.SelectedTab);
-        }
+    private void ChangeTab()
+    {
+        settingsButton.Label = Translation.Get("settingsLabels", "settingsButton");
+        SetCurrentWindow(tabsPane.SelectedTab);
+    }
 
-        private void SetCurrentWindow(Constants.Window window)
-        {
-            if (currentWindowPane != null)
-                currentWindowPane.ActiveWindow = false;
+    private void SetCurrentWindow(Constants.Window window)
+    {
+        if (currentWindowPane != null)
+            currentWindowPane.ActiveWindow = false;
 
-            selectedWindow = window;
-            currentWindowPane = windowPanes[selectedWindow];
-            currentWindowPane.ActiveWindow = true;
-            currentWindowPane.UpdatePanes();
-        }
+        selectedWindow = window;
+        currentWindowPane = windowPanes[selectedWindow];
+        currentWindowPane.ActiveWindow = true;
+        currentWindowPane.UpdatePanes();
+    }
 
-        private void UpdateMeido(object sender, MeidoUpdateEventArgs args)
+    private void UpdateMeido(object sender, MeidoUpdateEventArgs args)
+    {
+        if (args.FromMeido)
         {
-            if (args.FromMeido)
-            {
-                var newWindow = args.IsBody ? Constants.Window.Pose : Constants.Window.Face;
+            var newWindow = args.IsBody ? Constants.Window.Pose : Constants.Window.Face;
 
-                ChangeWindow(newWindow);
-            }
-            else
-                currentWindowPane.UpdatePanes();
+            ChangeWindow(newWindow);
         }
+        else
+            currentWindowPane.UpdatePanes();
+    }
 
-        private void ChangeWindow(Constants.Window window)
-        {
-            if (selectedWindow == window)
-                currentWindowPane.UpdatePanes();
-            else
-                tabsPane.SelectedTab = window;
+    private void ChangeWindow(Constants.Window window)
+    {
+        if (selectedWindow == window)
+            currentWindowPane.UpdatePanes();
+        else
+            tabsPane.SelectedTab = window;
 
-            Visible = true;
-        }
+        Visible = true;
     }
 }

+ 82 - 83
src/MeidoPhotoStudio.Plugin/GUI/Windows/MessageWindow.cs

@@ -1,115 +1,114 @@
 using System;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MessageWindow : BaseWindow
 {
-    public class MessageWindow : BaseWindow
-    {
-        private readonly MessageWindowManager messageWindowManager;
-        private readonly TextField nameTextField;
-        private readonly Slider fontSizeSlider;
-        private readonly TextArea messageTextArea;
-        private readonly Button okButton;
+    private readonly MessageWindowManager messageWindowManager;
+    private readonly TextField nameTextField;
+    private readonly Slider fontSizeSlider;
+    private readonly TextArea messageTextArea;
+    private readonly Button okButton;
 
-        private int fontSize = 25;
+    private int fontSize = 25;
 
-        public override Rect WindowRect
+    public override Rect WindowRect
+    {
+        set
         {
-            set
-            {
-                value.width = Mathf.Clamp(Screen.width * 0.4f, 440, Mathf.Infinity);
-                value.height = Mathf.Clamp(Screen.height * 0.15f, 150, Mathf.Infinity);
-                base.WindowRect = value;
-            }
+            value.width = Mathf.Clamp(Screen.width * 0.4f, 440, Mathf.Infinity);
+            value.height = Mathf.Clamp(Screen.height * 0.15f, 150, Mathf.Infinity);
+            base.WindowRect = value;
         }
+    }
 
-        public MessageWindow(MessageWindowManager messageWindowManager)
-        {
-            this.messageWindowManager = messageWindowManager;
+    public MessageWindow(MessageWindowManager messageWindowManager)
+    {
+        this.messageWindowManager = messageWindowManager;
 
-            WindowRect = WindowRect;
-            windowRect.x = MiddlePosition.x;
-            windowRect.y = Screen.height - WindowRect.height;
+        WindowRect = WindowRect;
+        windowRect.x = MiddlePosition.x;
+        windowRect.y = Screen.height - WindowRect.height;
 
-            nameTextField = new();
+        nameTextField = new();
 
-            fontSizeSlider = new(MessageWindowManager.FontBounds);
-            fontSizeSlider.ControlEvent += ChangeFontSize;
+        fontSizeSlider = new(MessageWindowManager.FontBounds);
+        fontSizeSlider.ControlEvent += ChangeFontSize;
 
-            messageTextArea = new();
+        messageTextArea = new();
 
-            okButton = new("OK");
-            okButton.ControlEvent += ShowMessage;
-        }
+        okButton = new("OK");
+        okButton.ControlEvent += ShowMessage;
+    }
 
-        public override void Update()
-        {
-            base.Update();
+    public override void Update()
+    {
+        base.Update();
 
-            if (InputManager.GetKeyDown(MpsKey.ToggleMessage))
-                ToggleVisibility();
-        }
+        if (InputManager.GetKeyDown(MpsKey.ToggleMessage))
+            ToggleVisibility();
+    }
 
-        public override void Draw()
-        {
-            GUILayout.BeginHorizontal();
-            GUILayout.Label("Name", GUILayout.ExpandWidth(false));
-            nameTextField.Draw(GUILayout.Width(120));
+    public override void Draw()
+    {
+        GUILayout.BeginHorizontal();
+        GUILayout.Label("Name", GUILayout.ExpandWidth(false));
+        nameTextField.Draw(GUILayout.Width(120));
 
-            GUILayout.Space(30);
+        GUILayout.Space(30);
 
-            GUILayout.Label("Font Size", GUILayout.ExpandWidth(false));
-            fontSizeSlider.Draw(GUILayout.Width(120), GUILayout.ExpandWidth(false));
-            GUILayout.Label($"{fontSize}pt");
-            GUILayout.EndHorizontal();
+        GUILayout.Label("Font Size", GUILayout.ExpandWidth(false));
+        fontSizeSlider.Draw(GUILayout.Width(120), GUILayout.ExpandWidth(false));
+        GUILayout.Label($"{fontSize}pt");
+        GUILayout.EndHorizontal();
 
-            messageTextArea.Draw(GUILayout.MinHeight(90));
-            okButton.Draw(GUILayout.ExpandWidth(false), GUILayout.Width(30));
-        }
+        messageTextArea.Draw(GUILayout.MinHeight(90));
+        okButton.Draw(GUILayout.ExpandWidth(false), GUILayout.Width(30));
+    }
 
-        public override void Deactivate()
-        {
-            messageWindowManager.CloseMessagePanel();
-            Visible = false;
-            ResetUI();
-        }
+    public override void Deactivate()
+    {
+        messageWindowManager.CloseMessagePanel();
+        Visible = false;
+        ResetUI();
+    }
 
-        public override void Activate() =>
-            ResetUI();
+    public override void Activate() =>
+        ResetUI();
 
-        private void ToggleVisibility()
-        {
-            if (messageWindowManager.ShowingMessage)
-                messageWindowManager.CloseMessagePanel();
-            else
-                Visible = !Visible;
-        }
+    private void ToggleVisibility()
+    {
+        if (messageWindowManager.ShowingMessage)
+            messageWindowManager.CloseMessagePanel();
+        else
+            Visible = !Visible;
+    }
 
-        private void ChangeFontSize(object sender, EventArgs args)
-        {
-            fontSize = (int)fontSizeSlider.Value;
+    private void ChangeFontSize(object sender, EventArgs args)
+    {
+        fontSize = (int)fontSizeSlider.Value;
 
-            if (updating)
-                return;
+        if (updating)
+            return;
 
-            messageWindowManager.FontSize = fontSize;
-        }
+        messageWindowManager.FontSize = fontSize;
+    }
 
-        private void ShowMessage(object sender, EventArgs args)
-        {
-            Visible = false;
-            messageWindowManager.ShowMessage(nameTextField.Value, messageTextArea.Value);
-        }
+    private void ShowMessage(object sender, EventArgs args)
+    {
+        Visible = false;
+        messageWindowManager.ShowMessage(nameTextField.Value, messageTextArea.Value);
+    }
 
-        private void ResetUI()
-        {
-            updating = true;
+    private void ResetUI()
+    {
+        updating = true;
 
-            fontSizeSlider.Value = MessageWindowManager.FontBounds.Left;
-            nameTextField.Value = string.Empty;
-            messageTextArea.Value = string.Empty;
+        fontSizeSlider.Value = MessageWindowManager.FontBounds.Left;
+        nameTextField.Value = string.Empty;
+        messageTextArea.Value = string.Empty;
 
-            updating = false;
-        }
+        updating = false;
     }
 }

+ 189 - 190
src/MeidoPhotoStudio.Plugin/GUI/Windows/SceneModalWindow.cs

@@ -1,263 +1,262 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SceneModalWindow : BaseWindow
 {
-    public class SceneModalWindow : BaseWindow
+    private static readonly Texture2D infoHighlight = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.8f));
+
+    private readonly SceneManager sceneManager;
+    private readonly Button okButton;
+    private readonly Button cancelButton;
+    private readonly Button deleteButton;
+    private readonly Button overwriteButton;
+
+    private bool visible;
+    private string deleteDirectoryMessage;
+    private string deleteSceneMessage;
+    private string directoryDeleteCommit;
+    private string sceneDeleteCommit;
+    private string sceneLoadCommit;
+    private string infoKankyo;
+    private string infoMaidSingular;
+    private string infoMaidPlural;
+    private bool directoryMode;
+    private bool deleteScene;
+
+    public override Rect WindowRect
     {
-        private static readonly Texture2D infoHighlight = Utility.MakeTex(2, 2, new Color(0f, 0f, 0f, 0.8f));
-
-        private readonly SceneManager sceneManager;
-        private readonly Button okButton;
-        private readonly Button cancelButton;
-        private readonly Button deleteButton;
-        private readonly Button overwriteButton;
-
-        private bool visible;
-        private string deleteDirectoryMessage;
-        private string deleteSceneMessage;
-        private string directoryDeleteCommit;
-        private string sceneDeleteCommit;
-        private string sceneLoadCommit;
-        private string infoKankyo;
-        private string infoMaidSingular;
-        private string infoMaidPlural;
-        private bool directoryMode;
-        private bool deleteScene;
-
-        public override Rect WindowRect
+        set
         {
-            set
-            {
-                value.width = Mathf.Clamp(Screen.width * 0.3f, 360f, 500f);
-                value.height = directoryMode ? 150f : Mathf.Clamp(Screen.height * 0.4f, 240f, 380f);
+            value.width = Mathf.Clamp(Screen.width * 0.3f, 360f, 500f);
+            value.height = directoryMode ? 150f : Mathf.Clamp(Screen.height * 0.4f, 240f, 380f);
 
-                base.WindowRect = value;
-            }
+            base.WindowRect = value;
         }
+    }
 
-        public override bool Visible
+    public override bool Visible
+    {
+        get => visible;
+        set
         {
-            get => visible;
-            set
-            {
-                visible = value;
+            visible = value;
 
-                if (!value)
-                    return;
+            if (!value)
+                return;
 
-                WindowRect = WindowRect;
-                windowRect.x = MiddlePosition.x;
-                windowRect.y = MiddlePosition.y;
-            }
+            WindowRect = WindowRect;
+            windowRect.x = MiddlePosition.x;
+            windowRect.y = MiddlePosition.y;
         }
+    }
 
-        public SceneModalWindow(SceneManager sceneManager)
-        {
-            ReloadTranslation();
-
-            this.sceneManager = sceneManager;
+    public SceneModalWindow(SceneManager sceneManager)
+    {
+        ReloadTranslation();
 
-            windowRect.x = MiddlePosition.x;
-            windowRect.y = MiddlePosition.y;
+        this.sceneManager = sceneManager;
 
-            okButton = new(sceneLoadCommit);
-            okButton.ControlEvent += (s, a) => Commit();
+        windowRect.x = MiddlePosition.x;
+        windowRect.y = MiddlePosition.y;
 
-            cancelButton = new("Cancel");
-            cancelButton.ControlEvent += (s, a) => Cancel();
+        okButton = new(sceneLoadCommit);
+        okButton.ControlEvent += (s, a) => Commit();
 
-            deleteButton = new("Delete");
-            deleteButton.ControlEvent += (s, a) =>
-            {
-                okButton.Label = sceneDeleteCommit;
-                deleteScene = true;
-            };
+        cancelButton = new("Cancel");
+        cancelButton.ControlEvent += (s, a) => Cancel();
 
-            overwriteButton = new("Overwrite");
-            overwriteButton.ControlEvent += (s, a) =>
-            {
-                sceneManager.OverwriteScene();
-                Visible = false;
-            };
-        }
+        deleteButton = new("Delete");
+        deleteButton.ControlEvent += (s, a) =>
+        {
+            okButton.Label = sceneDeleteCommit;
+            deleteScene = true;
+        };
 
-        public override void Draw()
+        overwriteButton = new("Overwrite");
+        overwriteButton.ControlEvent += (s, a) =>
         {
-            GUILayout.BeginArea(new(10f, 10f, WindowRect.width - 20f, WindowRect.height - 20f));
+            sceneManager.OverwriteScene();
+            Visible = false;
+        };
+    }
 
-            // thumbnail
-            if (!directoryMode)
-            {
-                var scene = sceneManager.CurrentScene;
-                var thumb = scene.Thumbnail;
+    public override void Draw()
+    {
+        GUILayout.BeginArea(new(10f, 10f, WindowRect.width - 20f, WindowRect.height - 20f));
+
+        // thumbnail
+        if (!directoryMode)
+        {
+            var scene = sceneManager.CurrentScene;
+            var thumb = scene.Thumbnail;
 
-                var scale = Mathf.Min(
+            var scale = Mathf.Min(
                     (WindowRect.width - 20f) / thumb.width, (WindowRect.height - 110f) / thumb.height
-                );
+                    );
 
-                var width = Mathf.Min(thumb.width, thumb.width * scale);
-                var height = Mathf.Min(thumb.height, thumb.height * scale);
+            var width = Mathf.Min(thumb.width, thumb.width * scale);
+            var height = Mathf.Min(thumb.height, thumb.height * scale);
 
-                GUILayout.BeginHorizontal();
-                GUILayout.FlexibleSpace();
+            GUILayout.BeginHorizontal();
+            GUILayout.FlexibleSpace();
 
-                MpsGui.DrawTexture(thumb, GUILayout.Width(width), GUILayout.Height(height));
+            MpsGui.DrawTexture(thumb, GUILayout.Width(width), GUILayout.Height(height));
 
-                var labelStyle = new GUIStyle(GUI.skin.label)
-                {
-                    fontSize = Utility.GetPix(12),
-                    alignment = TextAnchor.MiddleCenter,
-                };
+            var labelStyle = new GUIStyle(GUI.skin.label)
+            {
+                fontSize = Utility.GetPix(12),
+                alignment = TextAnchor.MiddleCenter,
+            };
 
-                labelStyle.normal.background = infoHighlight;
+            labelStyle.normal.background = infoHighlight;
 
-                var labelBox = GUILayoutUtility.GetLastRect();
+            var labelBox = GUILayoutUtility.GetLastRect();
 
-                var infoString = scene.Environment
-                    ? infoKankyo
-                    : string.Format(scene.NumberOfMaids == 1 ? infoMaidSingular : infoMaidPlural, scene.NumberOfMaids);
+            var infoString = scene.Environment
+                ? infoKankyo
+                : string.Format(scene.NumberOfMaids == 1 ? infoMaidSingular : infoMaidPlural, scene.NumberOfMaids);
 
-                var labelSize = labelStyle.CalcSize(new GUIContent(infoString));
+            var labelSize = labelStyle.CalcSize(new GUIContent(infoString));
 
-                labelBox = new Rect(
+            labelBox = new Rect(
                     labelBox.x + 10, labelBox.y + labelBox.height - (labelSize.y + 10),
                     labelSize.x + 10, labelSize.y + 2
-                );
+                    );
 
-                GUI.Label(labelBox, infoString, labelStyle);
+            GUI.Label(labelBox, infoString, labelStyle);
 
-                GUILayout.FlexibleSpace();
-                GUILayout.EndHorizontal();
-            }
+            GUILayout.FlexibleSpace();
+            GUILayout.EndHorizontal();
+        }
 
-            // message
-            string currentMessage;
-            string context;
+        // message
+        string currentMessage;
+        string context;
 
-            if (directoryMode)
+        if (directoryMode)
+        {
+            currentMessage = deleteDirectoryMessage;
+            context = sceneManager.CurrentDirectoryName;
+        }
+        else
+        {
+            if (deleteScene)
             {
-                currentMessage = deleteDirectoryMessage;
-                context = sceneManager.CurrentDirectoryName;
+                currentMessage = deleteSceneMessage;
+                context = sceneManager.CurrentScene.FileInfo.Name;
             }
             else
             {
-                if (deleteScene)
-                {
-                    currentMessage = deleteSceneMessage;
-                    context = sceneManager.CurrentScene.FileInfo.Name;
-                }
-                else
-                {
-                    currentMessage = sceneManager.CurrentScene.FileInfo.Name;
-                    context = currentMessage;
-                }
+                currentMessage = sceneManager.CurrentScene.FileInfo.Name;
+                context = currentMessage;
             }
+        }
 
-            var messageStyle = new GUIStyle(GUI.skin.label)
-            {
-                alignment = TextAnchor.MiddleCenter,
-                fontSize = Utility.GetPix(12),
-            };
+        var messageStyle = new GUIStyle(GUI.skin.label)
+        {
+            alignment = TextAnchor.MiddleCenter,
+            fontSize = Utility.GetPix(12),
+        };
 
-            GUILayout.FlexibleSpace();
+        GUILayout.FlexibleSpace();
 
-            GUILayout.Label(string.Format(currentMessage, context), messageStyle);
+        GUILayout.Label(string.Format(currentMessage, context), messageStyle);
 
-            GUILayout.FlexibleSpace();
+        GUILayout.FlexibleSpace();
 
-            // Buttons
+        // Buttons
 
-            var buttonStyle = new GUIStyle(GUI.skin.button)
-            {
-                fontSize = Utility.GetPix(12),
-            };
+        var buttonStyle = new GUIStyle(GUI.skin.button)
+        {
+            fontSize = Utility.GetPix(12),
+        };
 
-            var buttonHeight = GUILayout.Height(Utility.GetPix(20));
+        var buttonHeight = GUILayout.Height(Utility.GetPix(20));
 
-            GUILayout.BeginHorizontal();
+        GUILayout.BeginHorizontal();
 
-            if (directoryMode || deleteScene)
-            {
-                GUILayout.FlexibleSpace();
-                okButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
-                cancelButton.Draw(buttonStyle, buttonHeight, GUILayout.Width(100));
-            }
-            else
-            {
-                deleteButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
-                overwriteButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
+        if (directoryMode || deleteScene)
+        {
+            GUILayout.FlexibleSpace();
+            okButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
+            cancelButton.Draw(buttonStyle, buttonHeight, GUILayout.Width(100));
+        }
+        else
+        {
+            deleteButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
+            overwriteButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
 
-                GUILayout.FlexibleSpace();
+            GUILayout.FlexibleSpace();
 
-                okButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
-                cancelButton.Draw(buttonStyle, buttonHeight, GUILayout.Width(100));
-            }
+            okButton.Draw(buttonStyle, buttonHeight, GUILayout.ExpandWidth(false));
+            cancelButton.Draw(buttonStyle, buttonHeight, GUILayout.Width(100));
+        }
 
-            GUILayout.EndHorizontal();
+        GUILayout.EndHorizontal();
 
-            GUILayout.EndArea();
-        }
+        GUILayout.EndArea();
+    }
 
-        public void ShowDirectoryDialogue()
-        {
-            okButton.Label = directoryDeleteCommit;
-            directoryMode = true;
-            Modal.Show(this);
-        }
+    public void ShowDirectoryDialogue()
+    {
+        okButton.Label = directoryDeleteCommit;
+        directoryMode = true;
+        Modal.Show(this);
+    }
 
-        public void ShowSceneDialogue()
-        {
-            directoryMode = false;
-            okButton.Label = sceneLoadCommit;
-            Modal.Show(this);
-        }
+    public void ShowSceneDialogue()
+    {
+        directoryMode = false;
+        okButton.Label = sceneLoadCommit;
+        Modal.Show(this);
+    }
 
-        protected override void ReloadTranslation()
+    protected override void ReloadTranslation()
+    {
+        deleteDirectoryMessage = Translation.Get("sceneManagerModal", "deleteDirectoryConfirm");
+        deleteSceneMessage = Translation.Get("sceneManagerModal", "deleteFileConfirm");
+        directoryDeleteCommit = Translation.Get("sceneManagerModal", "deleteDirectoryButton");
+        sceneDeleteCommit = Translation.Get("sceneManagerModal", "deleteFileCommit");
+        sceneLoadCommit = Translation.Get("sceneManagerModal", "fileLoadCommit");
+        infoKankyo = Translation.Get("sceneManagerModal", "infoKankyo");
+        infoMaidSingular = Translation.Get("sceneManagerModal", "infoMaidSingular");
+        infoMaidPlural = Translation.Get("sceneManagerModal", "infoMaidPlural");
+    }
+
+    private void Commit()
+    {
+        if (directoryMode)
         {
-            deleteDirectoryMessage = Translation.Get("sceneManagerModal", "deleteDirectoryConfirm");
-            deleteSceneMessage = Translation.Get("sceneManagerModal", "deleteFileConfirm");
-            directoryDeleteCommit = Translation.Get("sceneManagerModal", "deleteDirectoryButton");
-            sceneDeleteCommit = Translation.Get("sceneManagerModal", "deleteFileCommit");
-            sceneLoadCommit = Translation.Get("sceneManagerModal", "fileLoadCommit");
-            infoKankyo = Translation.Get("sceneManagerModal", "infoKankyo");
-            infoMaidSingular = Translation.Get("sceneManagerModal", "infoMaidSingular");
-            infoMaidPlural = Translation.Get("sceneManagerModal", "infoMaidPlural");
+            sceneManager.DeleteDirectory();
+            Modal.Close();
         }
-
-        private void Commit()
+        else
         {
-            if (directoryMode)
+            if (deleteScene)
             {
-                sceneManager.DeleteDirectory();
-                Modal.Close();
+                sceneManager.DeleteScene();
+                deleteScene = false;
             }
             else
-            {
-                if (deleteScene)
-                {
-                    sceneManager.DeleteScene();
-                    deleteScene = false;
-                }
-                else
-                    sceneManager.LoadScene(sceneManager.CurrentScene);
+                sceneManager.LoadScene(sceneManager.CurrentScene);
 
-                Modal.Close();
-            }
+            Modal.Close();
         }
+    }
 
-        private void Cancel()
+    private void Cancel()
+    {
+        if (directoryMode)
+            Modal.Close();
+        else
         {
-            if (directoryMode)
-                Modal.Close();
+            if (deleteScene)
+                deleteScene = false;
             else
-            {
-                if (deleteScene)
-                    deleteScene = false;
-                else
-                    Modal.Close();
-            }
-
-            okButton.Label = sceneLoadCommit;
+                Modal.Close();
         }
+
+        okButton.Label = sceneLoadCommit;
     }
 }

+ 77 - 78
src/MeidoPhotoStudio.Plugin/GUI/Windows/SceneWindow.cs

@@ -1,114 +1,113 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SceneWindow : BaseWindow
 {
-    public class SceneWindow : BaseWindow
-    {
-        private const float resizeHandleSize = 15f;
+    private const float resizeHandleSize = 15f;
 
-        private readonly SceneManager sceneManager;
-        private readonly SceneManagerTitleBarPane titleBar;
-        private readonly SceneManagerDirectoryPane directoryList;
-        private readonly SceneManagerScenePane sceneGrid;
+    private readonly SceneManager sceneManager;
+    private readonly SceneManagerTitleBarPane titleBar;
+    private readonly SceneManagerDirectoryPane directoryList;
+    private readonly SceneManagerScenePane sceneGrid;
 
-        private Rect resizeHandleRect;
-        private bool resizing;
-        private bool visible;
+    private Rect resizeHandleRect;
+    private bool resizing;
+    private bool visible;
 
-        public override bool Visible
+    public override bool Visible
+    {
+        get => visible;
+        set
         {
-            get => visible;
-            set
-            {
-                visible = value;
-
-                if (visible && !sceneManager.Initialized)
-                    sceneManager.Initialize();
-            }
+            visible = value;
+
+            if (visible && !sceneManager.Initialized)
+                sceneManager.Initialize();
         }
+    }
 
-        public SceneWindow(SceneManager sceneManager)
-        {
-            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;
+    public SceneWindow(SceneManager sceneManager)
+    {
+        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;
 
-            resizeHandleRect = new(0f, 0f, resizeHandleSize, resizeHandleSize);
+        resizeHandleRect = new(0f, 0f, resizeHandleSize, resizeHandleSize);
 
-            this.sceneManager = sceneManager;
-            var sceneModalWindow = new SceneModalWindow(this.sceneManager);
+        this.sceneManager = sceneManager;
+        var sceneModalWindow = new SceneModalWindow(this.sceneManager);
 
-            titleBar = AddPane(new SceneManagerTitleBarPane(sceneManager));
-            titleBar.CloseChange += (s, a) => Visible = false;
+        titleBar = AddPane(new SceneManagerTitleBarPane(sceneManager));
+        titleBar.CloseChange += (s, a) => Visible = false;
 
-            directoryList = AddPane(new SceneManagerDirectoryPane(sceneManager, sceneModalWindow));
+        directoryList = AddPane(new SceneManagerDirectoryPane(sceneManager, sceneModalWindow));
 
-            sceneGrid = AddPane(new SceneManagerScenePane(sceneManager, sceneModalWindow));
-        }
+        sceneGrid = AddPane(new SceneManagerScenePane(sceneManager, sceneModalWindow));
+    }
 
-        public override void GUIFunc(int id)
-        {
-            HandleResize();
-            Draw();
+    public override void GUIFunc(int id)
+    {
+        HandleResize();
+        Draw();
 
-            if (!resizing)
-                GUI.DragWindow();
-        }
+        if (!resizing)
+            GUI.DragWindow();
+    }
 
-        public override void Update()
-        {
-            base.Update();
+    public override void Update()
+    {
+        base.Update();
 
-            if (InputManager.GetKeyDown(MpsKey.OpenSceneManager))
-                Visible = !Visible;
-        }
+        if (InputManager.GetKeyDown(MpsKey.OpenSceneManager))
+            Visible = !Visible;
+    }
 
-        public override void Deactivate() =>
-            Visible = false;
+    public override void Deactivate() =>
+        Visible = false;
 
-        public override void Draw()
-        {
-            GUI.enabled = !SceneManager.Busy && !Modal.Visible;
+    public override void Draw()
+    {
+        GUI.enabled = !SceneManager.Busy && !Modal.Visible;
 
-            GUILayout.BeginArea(new(10f, 10f, windowRect.width - 20f, windowRect.height - 20f));
+        GUILayout.BeginArea(new(10f, 10f, windowRect.width - 20f, windowRect.height - 20f));
 
-            titleBar.Draw();
+        titleBar.Draw();
 
-            GUILayout.BeginHorizontal();
-            directoryList.Draw();
-            sceneGrid.Draw();
-            GUILayout.EndHorizontal();
+        GUILayout.BeginHorizontal();
+        directoryList.Draw();
+        sceneGrid.Draw();
+        GUILayout.EndHorizontal();
 
-            GUILayout.EndArea();
+        GUILayout.EndArea();
 
-            GUI.Box(resizeHandleRect, GUIContent.none);
-        }
+        GUI.Box(resizeHandleRect, GUIContent.none);
+    }
 
-        private void HandleResize()
-        {
-            resizeHandleRect.x = windowRect.width - resizeHandleSize;
-            resizeHandleRect.y = windowRect.height - resizeHandleSize;
+    private void HandleResize()
+    {
+        resizeHandleRect.x = windowRect.width - resizeHandleSize;
+        resizeHandleRect.y = windowRect.height - resizeHandleSize;
 
-            if (!resizing && Input.GetMouseButton(0) && resizeHandleRect.Contains(Event.current.mousePosition))
-                resizing = true;
+        if (!resizing && Input.GetMouseButton(0) && resizeHandleRect.Contains(Event.current.mousePosition))
+            resizing = true;
 
-            if (resizing)
-            {
-                var rectWidth = Event.current.mousePosition.x;
-                var rectHeight = Event.current.mousePosition.y;
+        if (resizing)
+        {
+            var rectWidth = Event.current.mousePosition.x;
+            var rectHeight = Event.current.mousePosition.y;
 
-                var minWidth = Utility.GetPix(
+            var minWidth = Utility.GetPix(
                     SceneManagerDirectoryPane.listWidth
                     + (int)(SceneManager.sceneDimensions.x * SceneManagerScenePane.thumbnailScale)
-                );
+                    );
 
-                windowRect.width = Mathf.Max(minWidth, rectWidth);
-                windowRect.height = Mathf.Max(300, rectHeight);
+            windowRect.width = Mathf.Max(minWidth, rectWidth);
+            windowRect.height = Mathf.Max(300, rectHeight);
 
-                if (!Input.GetMouseButton(0))
-                    resizing = false;
-            }
+            if (!Input.GetMouseButton(0))
+                resizing = false;
         }
     }
 }

+ 50 - 51
src/MeidoPhotoStudio.Plugin/MPSScene.cs

@@ -2,76 +2,75 @@ using System.IO;
 using System.Text;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MPSScene
 {
-    public class MPSScene
-    {
-        public Texture2D Thumbnail { get; }
-        public FileInfo FileInfo { get; }
-        public bool Environment { get; private set; }
-        public int NumberOfMaids { get; private set; }
+    public Texture2D Thumbnail { get; }
+    public FileInfo FileInfo { get; }
+    public bool Environment { get; private set; }
+    public int NumberOfMaids { get; private set; }
 
-        public byte[] Data
+    public byte[] Data
+    {
+        get
         {
-            get
-            {
-                if (data is null)
-                    Preload();
-
-                return data;
-            }
-            private set => data = value;
-        }
-
-        private byte[] data;
+            if (data is null)
+                Preload();
 
-        public MPSScene(string path, Texture2D thumbnail = null)
-        {
-            FileInfo = new(path);
+            return data;
+        }
+        private set => data = value;
+    }
 
-            if (!thumbnail)
-            {
-                thumbnail = new(1, 1, TextureFormat.ARGB32, false);
-                thumbnail.LoadImage(File.ReadAllBytes(FileInfo.FullName));
-            }
+    private byte[] data;
 
-            Thumbnail = thumbnail;
-        }
+    public MPSScene(string path, Texture2D thumbnail = null)
+    {
+        FileInfo = new(path);
 
-        public void Preload()
+        if (!thumbnail)
         {
-            if (data is not null)
-                return;
+            thumbnail = new(1, 1, TextureFormat.ARGB32, false);
+            thumbnail.LoadImage(File.ReadAllBytes(FileInfo.FullName));
+        }
 
-            using var fileStream = FileInfo.OpenRead();
+        Thumbnail = thumbnail;
+    }
 
-            Utility.SeekPngEnd(fileStream);
+    public void Preload()
+    {
+        if (data is not null)
+            return;
 
-            using var memoryStream = new MemoryStream();
+        using var fileStream = FileInfo.OpenRead();
 
-            fileStream.CopyTo(memoryStream);
-            memoryStream.Position = 0L;
+        Utility.SeekPngEnd(fileStream);
 
-            using var binaryReader = new BinaryReader(memoryStream, Encoding.UTF8);
+        using var memoryStream = new MemoryStream();
 
-            var sceneHeader = MeidoPhotoStudio.SceneHeader;
+        fileStream.CopyTo(memoryStream);
+        memoryStream.Position = 0L;
 
-            if (!Utility.BytesEqual(binaryReader.ReadBytes(sceneHeader.Length), sceneHeader))
-            {
-                Utility.LogWarning($"'{FileInfo.FullName}' is not a MPS Scene");
+        using var binaryReader = new BinaryReader(memoryStream, Encoding.UTF8);
 
-                return;
-            }
+        var sceneHeader = MeidoPhotoStudio.SceneHeader;
 
-            (_, Environment, NumberOfMaids, _) = SceneMetadata.ReadMetadata(binaryReader);
+        if (!Utility.BytesEqual(binaryReader.ReadBytes(sceneHeader.Length), sceneHeader))
+        {
+            Utility.LogWarning($"'{FileInfo.FullName}' is not a MPS Scene");
 
-            Data = memoryStream.ToArray();
+            return;
         }
 
-        public void Destroy()
-        {
-            if (Thumbnail)
-                Object.DestroyImmediate(Thumbnail);
-        }
+        (_, Environment, NumberOfMaids, _) = SceneMetadata.ReadMetadata(binaryReader);
+
+        Data = memoryStream.ToArray();
+    }
+
+    public void Destroy()
+    {
+        if (Thumbnail)
+            Object.DestroyImmediate(Thumbnail);
     }
 }

+ 100 - 101
src/MeidoPhotoStudio.Plugin/MaidPlacementUtility.cs

@@ -1,153 +1,152 @@
 using System.Collections.Generic;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class MaidPlacementUtility
 {
-    public static class MaidPlacementUtility
-    {
-        private const float pi = Mathf.PI;
-        private const 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 readonly string[] placementTypes = {
+        "horizontalRow", "verticalRow", "diagonalRow", "diagonalRowInverse", "wave", "waveInverse",
+        "v", "vInverse", "circleInner", "circleOuter", "fanInner", "fanOuter"
+    };
 
-        public static int AlternatingSequence(int x) =>
-            (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)
+    public static void ApplyPlacement(string placementType, IList<Meido> list)
+    {
+        switch (placementType)
         {
-            switch (placementType)
-            {
-                case "horizontalRow": PlacementRow(list, false); break;
-                case "verticalRow": PlacementRow(list, true); break;
-                case "diagonalRow": PlacementDiagonal(list, false); break;
-                case "diagonalRowInverse": PlacementDiagonal(list, true); break;
-                case "wave": PlacementWave(list, false); break;
-                case "waveInverse": PlacementWave(list, true); break;
-                case "v": PlacementV(list, false); break;
-                case "vInverse": PlacementV(list, true); break;
-                case "circleOuter": PlacementCircle(list, false); break;
-                case "circleInner": PlacementCircle(list, true); break;
-                case "fanInner": PlacementFan(list, false); break;
-                case "fanOuter": PlacementFan(list, true); break;
-                default: return;
-            }
+            case "horizontalRow": PlacementRow(list, false); break;
+            case "verticalRow": PlacementRow(list, true); break;
+            case "diagonalRow": PlacementDiagonal(list, false); break;
+            case "diagonalRowInverse": PlacementDiagonal(list, true); break;
+            case "wave": PlacementWave(list, false); break;
+            case "waveInverse": PlacementWave(list, true); break;
+            case "v": PlacementV(list, false); break;
+            case "vInverse": PlacementV(list, true); break;
+            case "circleOuter": PlacementCircle(list, false); break;
+            case "circleInner": PlacementCircle(list, true); break;
+            case "fanInner": PlacementFan(list, false); break;
+            case "fanOuter": PlacementFan(list, true); break;
+            default: return;
         }
+    }
 
-        public static void PlacementRow(IList<Meido> list, bool vertical = false)
+    public static void PlacementRow(IList<Meido> list, bool vertical = false)
+    {
+        for (var i = 0; i < list.Count; i++)
         {
-            for (var i = 0; i < list.Count; i++)
-            {
-                var position = Vector3.zero;
+            var position = Vector3.zero;
 
-                var maid = list[i].Maid;
+            var maid = list[i].Maid;
 
-                var a = AlternatingSequence(i) * 0.6f;
+            var a = AlternatingSequence(i) * 0.6f;
 
-                if (vertical)
-                    position.z = a;
-                else
-                    position.x = a;
+            if (vertical)
+                position.z = a;
+            else
+                position.x = a;
 
-                maid.SetPos(position);
-                maid.SetRot(Vector3.zero);
-            }
+            maid.SetPos(position);
+            maid.SetRot(Vector3.zero);
         }
+    }
 
-        public static void PlacementDiagonal(IList<Meido> list, bool inverse = false)
+    public static void PlacementDiagonal(IList<Meido> list, bool inverse = false)
+    {
+        for (var i = 0; i < list.Count; i++)
         {
-            for (var i = 0; i < list.Count; i++)
-            {
-                var maid = list[i].Maid;
+            var maid = list[i].Maid;
 
-                var z = AlternatingSequence(i) * 0.5f;
+            var z = AlternatingSequence(i) * 0.5f;
 
-                maid.SetPos(inverse ? new(z, 0, -z) : new(z, 0, z));
-                maid.SetRot(Vector3.zero);
-            }
+            maid.SetPos(inverse ? new(z, 0, -z) : new(z, 0, z));
+            maid.SetRot(Vector3.zero);
         }
+    }
 
-        public static void PlacementWave(IList<Meido> list, bool inverse = false)
+    public static void PlacementWave(IList<Meido> list, bool inverse = false)
+    {
+        for (var i = 0; i < list.Count; i++)
         {
-            for (var i = 0; i < list.Count; i++)
-            {
-                var maid = list[i].Maid;
+            var maid = list[i].Maid;
 
-                var x = AlternatingSequence(i) * 0.4f;
-                var z = (inverse ? -1 : 1) * Mathf.Cos(AlternatingSequence(i) * pi) * 0.35f;
+            var x = AlternatingSequence(i) * 0.4f;
+            var z = (inverse ? -1 : 1) * Mathf.Cos(AlternatingSequence(i) * pi) * 0.35f;
 
-                maid.SetPos(new(x, 0, z));
-                maid.SetRot(Vector3.zero);
-            }
+            maid.SetPos(new(x, 0, z));
+            maid.SetRot(Vector3.zero);
         }
+    }
 
-        public static void PlacementV(IList<Meido> list, bool inverse = false)
+    public static void PlacementV(IList<Meido> list, bool inverse = false)
+    {
+        for (var i = 0; i < list.Count; i++)
         {
-            for (var i = 0; i < list.Count; i++)
-            {
-                var maid = list[i].Maid;
+            var maid = list[i].Maid;
 
-                var x = AlternatingSequence(i) * 0.4f;
-                var z = (inverse ? 1 : -1) * Mathf.Abs(AlternatingSequence(i)) * 0.4f;
+            var x = AlternatingSequence(i) * 0.4f;
+            var z = (inverse ? 1 : -1) * Mathf.Abs(AlternatingSequence(i)) * 0.4f;
 
-                maid.SetPos(new(x, 0, z));
-                maid.SetRot(Vector3.zero);
-            }
+            maid.SetPos(new(x, 0, z));
+            maid.SetRot(Vector3.zero);
         }
+    }
 
-        public static void PlacementCircle(IList<Meido> list, bool inner = false)
-        {
-            var maidCount = list.Count;
+    public static void PlacementCircle(IList<Meido> list, bool inner = false)
+    {
+        var maidCount = list.Count;
 
-            var radius = 0.3f + 0.1f * maidCount;
+        var radius = 0.3f + 0.1f * maidCount;
 
-            for (var i = 0; i < maidCount; i++)
-            {
-                var maid = list[i].Maid;
+        for (var i = 0; i < maidCount; i++)
+        {
+            var maid = list[i].Maid;
 
-                var angle = pi / 2f + tau * AlternatingSequence(i) / maidCount;
+            var angle = pi / 2f + tau * AlternatingSequence(i) / maidCount;
 
-                var x = Mathf.Cos(angle) * radius;
-                var z = Mathf.Sin(angle) * radius;
+            var x = Mathf.Cos(angle) * radius;
+            var z = Mathf.Sin(angle) * radius;
 
-                var rotation = Mathf.Atan2(x, z);
+            var rotation = Mathf.Atan2(x, z);
 
-                if (inner)
-                    rotation += pi;
+            if (inner)
+                rotation += pi;
 
-                maid.SetPos(new(x, 0, z));
-                maid.SetRot(new(0, rotation * Mathf.Rad2Deg, 0));
-            }
+            maid.SetPos(new(x, 0, z));
+            maid.SetRot(new(0, rotation * Mathf.Rad2Deg, 0));
         }
+    }
 
-        public static void PlacementFan(IList<Meido> list, bool outer = false)
-        {
-            var maidCount = list.Count;
+    public static void PlacementFan(IList<Meido> list, bool outer = false)
+    {
+        var maidCount = list.Count;
 
-            var radius = 0.2f + 0.2f * maidCount;
+        var radius = 0.2f + 0.2f * maidCount;
 
-            list[0].Maid.SetPos(Vector3.zero);
-            list[0].Maid.SetRot(Vector3.zero);
+        list[0].Maid.SetPos(Vector3.zero);
+        list[0].Maid.SetRot(Vector3.zero);
 
-            for (var i = 1; i < maidCount; i++)
-            {
-                var maid = list[i].Maid;
+        for (var i = 1; i < maidCount; i++)
+        {
+            var maid = list[i].Maid;
 
-                var angle = pi * AlternatingSequence(i - 1) / maidCount;
+            var angle = pi * AlternatingSequence(i - 1) / maidCount;
 
-                var x = Mathf.Sin(angle) * radius;
-                var z = Mathf.Cos(angle) * radius;
+            var x = Mathf.Sin(angle) * radius;
+            var z = Mathf.Cos(angle) * radius;
 
-                var rotation = Mathf.Atan2(x, z);
+            var rotation = Mathf.Atan2(x, z);
 
-                if (outer)
-                    rotation += pi;
+            if (outer)
+                rotation += pi;
 
-                maid.SetPos(new(-x, 0, -z));
-                maid.SetRot(new(0, rotation * Mathf.Rad2Deg, 0));
-            }
+            maid.SetPos(new(-x, 0, -z));
+            maid.SetRot(new(0, rotation * Mathf.Rad2Deg, 0));
         }
     }
 }

+ 155 - 156
src/MeidoPhotoStudio.Plugin/Managers/CameraManager.cs

@@ -4,207 +4,206 @@ using UnityEngine;
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 using UInput = UnityEngine.Input;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class CameraManager : IManager
 {
-    public class CameraManager : IManager
-    {
-        public const string header = "CAMERA";
+    public const string header = "CAMERA";
 
-        private const float cameraFastMoveSpeed = 0.1f;
-        private const float cameraFastZoomSpeed = 3f;
-        private const float cameraSlowMoveSpeed = 0.004f;
-        private const float cameraSlowZoomSpeed = 0.1f;
-        private const KeyCode AlphaOne = KeyCode.Alpha1;
+    private const float cameraFastMoveSpeed = 0.1f;
+    private const float cameraFastZoomSpeed = 3f;
+    private const float cameraSlowMoveSpeed = 0.004f;
+    private const float cameraSlowZoomSpeed = 0.1f;
+    private const KeyCode AlphaOne = KeyCode.Alpha1;
 
-        private static readonly CameraMain mainCamera = CameraUtility.MainCamera;
-        private static readonly UltimateOrbitCamera ultimateOrbitCamera = CameraUtility.UOCamera;
+    private static readonly CameraMain mainCamera = CameraUtility.MainCamera;
+    private static readonly UltimateOrbitCamera ultimateOrbitCamera = CameraUtility.UOCamera;
 
-        private readonly CameraInfo tempCameraInfo = new();
-        private readonly CameraInfo[] cameraInfos;
+    private readonly CameraInfo tempCameraInfo = new();
+    private readonly CameraInfo[] cameraInfos;
 
-        public EventHandler CameraChange;
+    public EventHandler CameraChange;
 
-        private float defaultCameraMoveSpeed;
-        private float defaultCameraZoomSpeed;
-        private Camera subCamera;
-        private int currentCameraIndex;
+    private float defaultCameraMoveSpeed;
+    private float defaultCameraZoomSpeed;
+    private Camera subCamera;
+    private int currentCameraIndex;
 
-        public int CameraCount =>
-            cameraInfos.Length;
+    public int CameraCount =>
+        cameraInfos.Length;
 
-        public int CurrentCameraIndex
+    public int CurrentCameraIndex
+    {
+        get => currentCameraIndex;
+        set
         {
-            get => currentCameraIndex;
-            set
-            {
-                cameraInfos[currentCameraIndex].UpdateInfo(mainCamera);
-                currentCameraIndex = value;
-                LoadCameraInfo(cameraInfos[currentCameraIndex]);
-            }
+            cameraInfos[currentCameraIndex].UpdateInfo(mainCamera);
+            currentCameraIndex = value;
+            LoadCameraInfo(cameraInfos[currentCameraIndex]);
         }
+    }
 
-        static CameraManager()
-        {
-            Input.Register(MpsKey.CameraLayer, KeyCode.Q, "Camera control layer");
-            Input.Register(MpsKey.CameraSave, KeyCode.S, "Save camera transform");
-            Input.Register(MpsKey.CameraLoad, KeyCode.A, "Load camera transform");
-            Input.Register(MpsKey.CameraReset, KeyCode.R, "Reset camera transform");
-        }
+    static CameraManager()
+    {
+        Input.Register(MpsKey.CameraLayer, KeyCode.Q, "Camera control layer");
+        Input.Register(MpsKey.CameraSave, KeyCode.S, "Save camera transform");
+        Input.Register(MpsKey.CameraLoad, KeyCode.A, "Load camera transform");
+        Input.Register(MpsKey.CameraReset, KeyCode.R, "Reset camera transform");
+    }
 
-        public CameraManager()
-        {
-            cameraInfos = new CameraInfo[5];
+    public CameraManager()
+    {
+        cameraInfos = new CameraInfo[5];
 
-            for (var i = 0; i < cameraInfos.Length; i++)
-                cameraInfos[i] = new();
+        for (var i = 0; i < cameraInfos.Length; i++)
+            cameraInfos[i] = new();
 
-            Activate();
-        }
+        Activate();
+    }
 
-        public void Activate()
-        {
-            ultimateOrbitCamera.enabled = true;
+    public void Activate()
+    {
+        ultimateOrbitCamera.enabled = true;
 
-            defaultCameraMoveSpeed = ultimateOrbitCamera.moveSpeed;
-            defaultCameraZoomSpeed = ultimateOrbitCamera.zoomSpeed;
+        defaultCameraMoveSpeed = ultimateOrbitCamera.moveSpeed;
+        defaultCameraZoomSpeed = ultimateOrbitCamera.zoomSpeed;
 
-            if (!MeidoPhotoStudio.EditMode)
-                ResetCamera();
+        if (!MeidoPhotoStudio.EditMode)
+            ResetCamera();
 
-            currentCameraIndex = 0;
+        currentCameraIndex = 0;
 
-            tempCameraInfo.Reset();
+        tempCameraInfo.Reset();
 
-            for (var i = 0; i < CameraCount; i++)
-                cameraInfos[i].Reset();
+        for (var i = 0; i < CameraCount; i++)
+            cameraInfos[i].Reset();
 
-            mainCamera.ForceCalcNearClip();
+        mainCamera.ForceCalcNearClip();
 
-            var subCamGo = new GameObject("subcam");
+        var subCamGo = new GameObject("subcam");
 
-            subCamera = subCamGo.AddComponent<Camera>();
-            subCamera.CopyFrom(mainCamera.camera);
-            subCamera.clearFlags = CameraClearFlags.Depth;
-            subCamera.cullingMask = 1 << 8;
-            subCamera.depth = 1f;
-            subCamera.transform.parent = mainCamera.transform;
-        }
+        subCamera = subCamGo.AddComponent<Camera>();
+        subCamera.CopyFrom(mainCamera.camera);
+        subCamera.clearFlags = CameraClearFlags.Depth;
+        subCamera.cullingMask = 1 << 8;
+        subCamera.depth = 1f;
+        subCamera.transform.parent = mainCamera.transform;
+    }
 
-        public void Deactivate()
-        {
-            UnityEngine.Object.Destroy(subCamera.gameObject);
-            mainCamera.camera.backgroundColor = Color.black;
+    public void Deactivate()
+    {
+        UnityEngine.Object.Destroy(subCamera.gameObject);
+        mainCamera.camera.backgroundColor = Color.black;
 
-            ultimateOrbitCamera.moveSpeed = defaultCameraMoveSpeed;
-            ultimateOrbitCamera.zoomSpeed = defaultCameraZoomSpeed;
+        ultimateOrbitCamera.moveSpeed = defaultCameraMoveSpeed;
+        ultimateOrbitCamera.zoomSpeed = defaultCameraZoomSpeed;
 
-            if (MeidoPhotoStudio.EditMode)
-                return;
+        if (MeidoPhotoStudio.EditMode)
+            return;
 
-            mainCamera.Reset(CameraMain.CameraType.Target, true);
-            mainCamera.SetTargetPos(new Vector3(0.5609447f, 1.380762f, -1.382336f));
-            mainCamera.SetDistance(1.6f);
-            mainCamera.SetAroundAngle(new Vector2(245.5691f, 6.273283f));
+        mainCamera.Reset(CameraMain.CameraType.Target, true);
+        mainCamera.SetTargetPos(new Vector3(0.5609447f, 1.380762f, -1.382336f));
+        mainCamera.SetDistance(1.6f);
+        mainCamera.SetAroundAngle(new Vector2(245.5691f, 6.273283f));
 
-            mainCamera.ResetCalcNearClip();
-        }
+        mainCamera.ResetCalcNearClip();
+    }
 
-        public void Update()
+    public void Update()
+    {
+        if (Input.GetKey(MpsKey.CameraLayer))
         {
-            if (Input.GetKey(MpsKey.CameraLayer))
-            {
-                if (Input.GetKeyDown(MpsKey.CameraSave))
-                    SaveTempCamera();
-                else if (Input.GetKeyDown(MpsKey.CameraLoad))
-                    LoadCameraInfo(tempCameraInfo);
-                else if (Input.GetKeyDown(MpsKey.CameraReset))
-                    ResetCamera();
-
-                for (var i = 0; i < CameraCount; i++)
-                    if (i != CurrentCameraIndex && UInput.GetKeyDown(AlphaOne + i))
-                        CurrentCameraIndex = i;
-            }
-
-            subCamera.fieldOfView = mainCamera.camera.fieldOfView;
-
-            if (Input.Shift)
-            {
-                ultimateOrbitCamera.moveSpeed = cameraFastMoveSpeed;
-                ultimateOrbitCamera.zoomSpeed = cameraFastZoomSpeed;
-            }
-            else if (Input.Control)
-            {
-                ultimateOrbitCamera.moveSpeed = cameraSlowMoveSpeed;
-                ultimateOrbitCamera.zoomSpeed = cameraSlowZoomSpeed;
-            }
-            else
-            {
-                ultimateOrbitCamera.moveSpeed = defaultCameraMoveSpeed;
-                ultimateOrbitCamera.zoomSpeed = defaultCameraZoomSpeed;
-            }
+            if (Input.GetKeyDown(MpsKey.CameraSave))
+                SaveTempCamera();
+            else if (Input.GetKeyDown(MpsKey.CameraLoad))
+                LoadCameraInfo(tempCameraInfo);
+            else if (Input.GetKeyDown(MpsKey.CameraReset))
+                ResetCamera();
+
+            for (var i = 0; i < CameraCount; i++)
+                if (i != CurrentCameraIndex && UInput.GetKeyDown(AlphaOne + i))
+                    CurrentCameraIndex = i;
         }
 
-        public void LoadCameraInfo(CameraInfo info)
+        subCamera.fieldOfView = mainCamera.camera.fieldOfView;
+
+        if (Input.Shift)
         {
-            info.Apply(mainCamera);
-            CameraUtility.StopAll();
-            CameraChange?.Invoke(this, EventArgs.Empty);
+            ultimateOrbitCamera.moveSpeed = cameraFastMoveSpeed;
+            ultimateOrbitCamera.zoomSpeed = cameraFastZoomSpeed;
         }
-
-        private void SaveTempCamera()
+        else if (Input.Control)
         {
-            tempCameraInfo.UpdateInfo(mainCamera);
-            CameraUtility.StopAll();
+            ultimateOrbitCamera.moveSpeed = cameraSlowMoveSpeed;
+            ultimateOrbitCamera.zoomSpeed = cameraSlowZoomSpeed;
         }
-
-        private void ResetCamera()
+        else
         {
-            mainCamera.Reset(CameraMain.CameraType.Target, true);
-            mainCamera.SetTargetPos(new Vector3(0f, 0.9f, 0f));
-            mainCamera.SetDistance(3f);
-            CameraChange?.Invoke(this, EventArgs.Empty);
+            ultimateOrbitCamera.moveSpeed = defaultCameraMoveSpeed;
+            ultimateOrbitCamera.zoomSpeed = defaultCameraZoomSpeed;
         }
     }
 
-    public class CameraInfo
+    public void LoadCameraInfo(CameraInfo info)
     {
-        public Vector3 TargetPos { get; set; }
-        public Quaternion Angle { get; set; }
-        public float Distance { get; set; }
-        public float FOV { get; set; }
+        info.Apply(mainCamera);
+        CameraUtility.StopAll();
+        CameraChange?.Invoke(this, EventArgs.Empty);
+    }
 
-        public static CameraInfo FromCamera(CameraMain mainCamera)
-        {
-            var info = new CameraInfo();
-            info.UpdateInfo(mainCamera);
-            return info;
-        }
+    private void SaveTempCamera()
+    {
+        tempCameraInfo.UpdateInfo(mainCamera);
+        CameraUtility.StopAll();
+    }
 
-        public CameraInfo() =>
-            Reset();
+    private void ResetCamera()
+    {
+        mainCamera.Reset(CameraMain.CameraType.Target, true);
+        mainCamera.SetTargetPos(new Vector3(0f, 0.9f, 0f));
+        mainCamera.SetDistance(3f);
+        CameraChange?.Invoke(this, EventArgs.Empty);
+    }
+}
 
-        public void Reset()
-        {
-            TargetPos = new(0f, 0.9f, 0f);
-            Angle = Quaternion.Euler(10f, 180f, 0f);
-            Distance = 3f;
-            FOV = 35f;
-        }
+public class CameraInfo
+{
+    public Vector3 TargetPos { get; set; }
+    public Quaternion Angle { get; set; }
+    public float Distance { get; set; }
+    public float FOV { get; set; }
 
-        public void UpdateInfo(CameraMain camera)
-        {
-            TargetPos = camera.GetTargetPos();
-            Angle = camera.transform.rotation;
-            Distance = camera.GetDistance();
-            FOV = camera.camera.fieldOfView;
-        }
+    public static CameraInfo FromCamera(CameraMain mainCamera)
+    {
+        var info = new CameraInfo();
+        info.UpdateInfo(mainCamera);
+        return info;
+    }
 
-        public void Apply(CameraMain camera)
-        {
-            camera.SetTargetPos(TargetPos);
-            camera.SetDistance(Distance);
-            camera.transform.rotation = Angle;
-            camera.camera.fieldOfView = FOV;
-        }
+    public CameraInfo() =>
+        Reset();
+
+    public void Reset()
+    {
+        TargetPos = new(0f, 0.9f, 0f);
+        Angle = Quaternion.Euler(10f, 180f, 0f);
+        Distance = 3f;
+        FOV = 35f;
+    }
+
+    public void UpdateInfo(CameraMain camera)
+    {
+        TargetPos = camera.GetTargetPos();
+        Angle = camera.transform.rotation;
+        Distance = camera.GetDistance();
+        FOV = camera.camera.fieldOfView;
+    }
+
+    public void Apply(CameraMain camera)
+    {
+        camera.SetTargetPos(TargetPos);
+        camera.SetDistance(Distance);
+        camera.transform.rotation = Angle;
+        camera.camera.fieldOfView = FOV;
     }
 }

+ 26 - 27
src/MeidoPhotoStudio.Plugin/Managers/EffectManager.cs

@@ -1,40 +1,39 @@
 using System;
 using System.Collections.Generic;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class EffectManager : IManager
-    {
-        public const string header = "EFFECT";
-        public const string footer = "END_EFFECT";
+namespace MeidoPhotoStudio.Plugin;
 
-        private readonly Dictionary<Type, IEffectManager> EffectManagers = new();
+public class EffectManager : IManager
+{
+    public const string header = "EFFECT";
+    public const string footer = "END_EFFECT";
 
-        public T Get<T>() where T : IEffectManager =>
-            EffectManagers.ContainsKey(typeof(T)) ? (T)EffectManagers[typeof(T)] : default;
+    private readonly Dictionary<Type, IEffectManager> EffectManagers = new();
 
-        public T AddManager<T>() where T : IEffectManager, new()
-        {
-            var manager = new T();
+    public T Get<T>() where T : IEffectManager =>
+        EffectManagers.ContainsKey(typeof(T)) ? (T)EffectManagers[typeof(T)] : default;
 
-            EffectManagers[typeof(T)] = manager;
-            manager.Activate();
+    public T AddManager<T>() where T : IEffectManager, new()
+    {
+        var manager = new T();
 
-            return manager;
-        }
+        EffectManagers[typeof(T)] = manager;
+        manager.Activate();
 
-        public void Activate()
-        {
-            foreach (var effectManager in EffectManagers.Values)
-                effectManager.Activate();
-        }
+        return manager;
+    }
 
-        public void Deactivate()
-        {
-            foreach (var effectManager in EffectManagers.Values)
-                effectManager.Deactivate();
-        }
+    public void Activate()
+    {
+        foreach (var effectManager in EffectManagers.Values)
+            effectManager.Activate();
+    }
 
-        public void Update() { }
+    public void Deactivate()
+    {
+        foreach (var effectManager in EffectManagers.Values)
+            effectManager.Deactivate();
     }
+
+    public void Update() { }
 }

+ 121 - 122
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/BloomEffectManager.cs

@@ -1,163 +1,162 @@
 using System.Reflection;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BloomEffectManager : IEffectManager
 {
-    public class BloomEffectManager : IEffectManager
-    {
-        private const float bloomDefIntensity = 5.7f;
+    private const float bloomDefIntensity = 5.7f;
 
-        public const string header = "EFFECT_BLOOM";
+    public const string header = "EFFECT_BLOOM";
 
-        private static readonly CameraMain camera = GameMain.Instance.MainCamera;
-        private static readonly float backup_m_fBloomDefIntensity;
-        private static readonly FieldInfo m_fBloomDefIntensity
-            = Utility.GetFieldInfo<CameraMain>("m_fBloomDefIntensity");
+    private static readonly CameraMain camera = GameMain.Instance.MainCamera;
+    private static readonly float backup_m_fBloomDefIntensity;
+    private static readonly FieldInfo m_fBloomDefIntensity
+        = Utility.GetFieldInfo<CameraMain>("m_fBloomDefIntensity");
 
-        // CMSystem's bloomValue;
-        private static int backupBloomValue;
+    // CMSystem's bloomValue;
+    private static int backupBloomValue;
 
-        private float initialIntensity;
-        private int initialBlurIterations;
-        private Color initialThresholdColour;
-        private Bloom.HDRBloomMode initialHDRBloomMode;
-        private int blurIterations;
-        private Color bloomThresholdColour;
-        private bool bloomHdr;
+    private float initialIntensity;
+    private int initialBlurIterations;
+    private Color initialThresholdColour;
+    private Bloom.HDRBloomMode initialHDRBloomMode;
+    private int blurIterations;
+    private Color bloomThresholdColour;
+    private bool bloomHdr;
 
-        private Bloom Bloom { get; set; }
-        private float bloomValue;
+    private Bloom Bloom { get; set; }
+    private float bloomValue;
 
-        public bool Ready { get; private set; }
-        public bool Active { get; private set; }
+    public bool Ready { get; private set; }
+    public bool Active { get; private set; }
 
-        private static float BloomDefIntensity
-        {
-            set => m_fBloomDefIntensity.SetValue(camera, value);
-            get => (float)m_fBloomDefIntensity.GetValue(camera);
-        }
+    private static float BloomDefIntensity
+    {
+        set => m_fBloomDefIntensity.SetValue(camera, value);
+        get => (float)m_fBloomDefIntensity.GetValue(camera);
+    }
 
-        public float BloomValue
-        {
-            get => bloomValue;
-            set => GameMain.Instance.CMSystem.BloomValue = (int)(bloomValue = value);
-        }
+    public float BloomValue
+    {
+        get => bloomValue;
+        set => GameMain.Instance.CMSystem.BloomValue = (int)(bloomValue = value);
+    }
 
-        public int BlurIterations
-        {
-            get => blurIterations;
-            set => blurIterations = Bloom.bloomBlurIterations = value;
-        }
+    public int BlurIterations
+    {
+        get => blurIterations;
+        set => blurIterations = Bloom.bloomBlurIterations = value;
+    }
 
-        public float BloomThresholdColorRed
+    public float BloomThresholdColorRed
+    {
+        get => BloomThresholdColour.r;
+        set
         {
-            get => BloomThresholdColour.r;
-            set
-            {
-                var colour = Bloom.bloomThreshholdColor;
+            var colour = Bloom.bloomThreshholdColor;
 
-                BloomThresholdColour = new Color(value, colour.g, colour.b);
-            }
+            BloomThresholdColour = new Color(value, colour.g, colour.b);
         }
+    }
 
-        public float BloomThresholdColorGreen
+    public float BloomThresholdColorGreen
+    {
+        get => BloomThresholdColour.g;
+        set
         {
-            get => BloomThresholdColour.g;
-            set
-            {
-                var colour = Bloom.bloomThreshholdColor;
+            var colour = Bloom.bloomThreshholdColor;
 
-                BloomThresholdColour = new Color(colour.r, value, colour.b);
-            }
+            BloomThresholdColour = new Color(colour.r, value, colour.b);
         }
+    }
 
-        public float BloomThresholdColorBlue
+    public float BloomThresholdColorBlue
+    {
+        get => BloomThresholdColour.b;
+        set
         {
-            get => BloomThresholdColour.b;
-            set
-            {
-                var colour = Bloom.bloomThreshholdColor;
+            var colour = Bloom.bloomThreshholdColor;
 
-                BloomThresholdColour = new Color(colour.r, colour.g, value);
-            }
+            BloomThresholdColour = new Color(colour.r, colour.g, value);
         }
+    }
 
-        public Color BloomThresholdColour
-        {
-            get => bloomThresholdColour;
-            set => bloomThresholdColour = Bloom.bloomThreshholdColor = value;
-        }
+    public Color BloomThresholdColour
+    {
+        get => bloomThresholdColour;
+        set => bloomThresholdColour = Bloom.bloomThreshholdColor = value;
+    }
 
-        public bool BloomHDR
+    public bool BloomHDR
+    {
+        get => bloomHdr;
+        set
         {
-            get => bloomHdr;
-            set
-            {
-                Bloom.hdr = value ? Bloom.HDRBloomMode.On : Bloom.HDRBloomMode.Auto;
-                bloomHdr = value;
-            }
+            Bloom.hdr = value ? Bloom.HDRBloomMode.On : Bloom.HDRBloomMode.Auto;
+            bloomHdr = value;
         }
+    }
 
-        static BloomEffectManager() =>
-            backup_m_fBloomDefIntensity = BloomDefIntensity;
+    static BloomEffectManager() =>
+        backup_m_fBloomDefIntensity = BloomDefIntensity;
 
-        public void Activate()
+    public void Activate()
+    {
+        if (Bloom == null)
         {
-            if (Bloom == null)
-            {
-                Ready = true;
-                Bloom = GameMain.Instance.MainCamera.GetComponent<Bloom>();
-                initialIntensity = bloomValue = 50f;
-                initialBlurIterations = blurIterations = Bloom.bloomBlurIterations;
-                initialThresholdColour = bloomThresholdColour = Bloom.bloomThreshholdColor;
-                initialHDRBloomMode = Bloom.hdr;
-                bloomHdr = Bloom.hdr == Bloom.HDRBloomMode.On;
-
-                backupBloomValue = GameMain.Instance.CMSystem.BloomValue;
-            }
-
-            SetEffectActive(false);
+            Ready = true;
+            Bloom = GameMain.Instance.MainCamera.GetComponent<Bloom>();
+            initialIntensity = bloomValue = 50f;
+            initialBlurIterations = blurIterations = Bloom.bloomBlurIterations;
+            initialThresholdColour = bloomThresholdColour = Bloom.bloomThreshholdColor;
+            initialHDRBloomMode = Bloom.hdr;
+            bloomHdr = Bloom.hdr == Bloom.HDRBloomMode.On;
+
+            backupBloomValue = GameMain.Instance.CMSystem.BloomValue;
         }
 
-        public void Deactivate()
-        {
-            BloomValue = initialIntensity;
-            BlurIterations = initialBlurIterations;
-            BloomThresholdColour = initialThresholdColour;
-            BloomHDR = initialHDRBloomMode == Bloom.HDRBloomMode.On;
-            BloomHDR = false;
-            Active = false;
-
-            BloomDefIntensity = backup_m_fBloomDefIntensity;
-            GameMain.Instance.CMSystem.BloomValue = backupBloomValue;
-        }
+        SetEffectActive(false);
+    }
 
-        public void Reset()
-        {
-            GameMain.Instance.CMSystem.BloomValue = backupBloomValue;
-            Bloom.bloomBlurIterations = initialBlurIterations;
-            Bloom.bloomThreshholdColor = initialThresholdColour;
-            Bloom.hdr = initialHDRBloomMode;
+    public void Deactivate()
+    {
+        BloomValue = initialIntensity;
+        BlurIterations = initialBlurIterations;
+        BloomThresholdColour = initialThresholdColour;
+        BloomHDR = initialHDRBloomMode == Bloom.HDRBloomMode.On;
+        BloomHDR = false;
+        Active = false;
+
+        BloomDefIntensity = backup_m_fBloomDefIntensity;
+        GameMain.Instance.CMSystem.BloomValue = backupBloomValue;
+    }
 
-            BloomDefIntensity = backup_m_fBloomDefIntensity;
-        }
+    public void Reset()
+    {
+        GameMain.Instance.CMSystem.BloomValue = backupBloomValue;
+        Bloom.bloomBlurIterations = initialBlurIterations;
+        Bloom.bloomThreshholdColor = initialThresholdColour;
+        Bloom.hdr = initialHDRBloomMode;
+
+        BloomDefIntensity = backup_m_fBloomDefIntensity;
+    }
 
-        public void SetEffectActive(bool active)
+    public void SetEffectActive(bool active)
+    {
+        if (Active = active)
         {
-            if (Active = active)
-            {
-                backupBloomValue = GameMain.Instance.CMSystem.BloomValue;
-                GameMain.Instance.CMSystem.BloomValue = (int)BloomValue;
-                Bloom.bloomBlurIterations = BlurIterations;
-                Bloom.bloomThreshholdColor = BloomThresholdColour;
-                Bloom.hdr = BloomHDR ? Bloom.HDRBloomMode.On : Bloom.HDRBloomMode.Auto;
-
-                BloomDefIntensity = bloomDefIntensity;
-            }
-            else
-                Reset();
-        }
+            backupBloomValue = GameMain.Instance.CMSystem.BloomValue;
+            GameMain.Instance.CMSystem.BloomValue = (int)BloomValue;
+            Bloom.bloomBlurIterations = BlurIterations;
+            Bloom.bloomThreshholdColor = BloomThresholdColour;
+            Bloom.hdr = BloomHDR ? Bloom.HDRBloomMode.On : Bloom.HDRBloomMode.Auto;
 
-        public void Update() { }
+            BloomDefIntensity = bloomDefIntensity;
+        }
+        else
+            Reset();
     }
+
+    public void Update() { }
 }

+ 59 - 60
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/BlurEffectManager.cs

@@ -1,78 +1,77 @@
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BlurEffectManager : IEffectManager
 {
-    public class BlurEffectManager : IEffectManager
-    {
-        public const string header = "EFFECT_BLUR";
+    public const string header = "EFFECT_BLUR";
 
-        private float initialBlurSize;
-        private int initialBlurIterations;
-        private int initialDownsample;
-        private float blurSize;
+    private float initialBlurSize;
+    private int initialBlurIterations;
+    private int initialDownsample;
+    private float blurSize;
 
-        public bool Ready { get; private set; }
-        public bool Active { get; private set; }
+    public bool Ready { get; private set; }
+    public bool Active { get; private set; }
 
-        public float BlurSize
+    public float BlurSize
+    {
+        get => blurSize;
+        set
         {
-            get => blurSize;
-            set
-            {
-                blurSize = value;
-                Blur.blurSize = blurSize / 10f;
+            blurSize = value;
+            Blur.blurSize = blurSize / 10f;
 
-                if (blurSize >= 3f)
-                {
-                    Blur.blurSize -= 0.3f;
-                    Blur.blurIterations = 1;
-                    Blur.downsample = 1;
-                }
-                else
-                {
-                    Blur.blurIterations = 0;
-                    Blur.downsample = 0;
-                }
+            if (blurSize >= 3f)
+            {
+                Blur.blurSize -= 0.3f;
+                Blur.blurIterations = 1;
+                Blur.downsample = 1;
             }
-        }
-
-        private Blur Blur { get; set; }
-
-        public void Activate()
-        {
-            if (Blur == null)
+            else
             {
-                Ready = true;
-                Blur = GameMain.Instance.MainCamera.GetComponent<Blur>();
-                initialBlurSize = Blur.blurSize;
-                initialBlurIterations = Blur.blurIterations;
-                initialDownsample = Blur.downsample;
+                Blur.blurIterations = 0;
+                Blur.downsample = 0;
             }
-
-            SetEffectActive(false);
         }
+    }
 
-        public void Deactivate()
-        {
-            BlurSize = 0f;
-            Reset();
-            Blur.enabled = false;
-            Active = false;
-        }
+    private Blur Blur { get; set; }
 
-        public void SetEffectActive(bool active)
+    public void Activate()
+    {
+        if (Blur == null)
         {
-            if (Blur.enabled = Active = active)
-                BlurSize = BlurSize;
-            else
-                Reset();
+            Ready = true;
+            Blur = GameMain.Instance.MainCamera.GetComponent<Blur>();
+            initialBlurSize = Blur.blurSize;
+            initialBlurIterations = Blur.blurIterations;
+            initialDownsample = Blur.downsample;
         }
 
-        public void Reset()
-        {
-            Blur.blurSize = initialBlurSize;
-            Blur.blurIterations = initialBlurIterations;
-            Blur.downsample = initialDownsample;
-        }
+        SetEffectActive(false);
+    }
+
+    public void Deactivate()
+    {
+        BlurSize = 0f;
+        Reset();
+        Blur.enabled = false;
+        Active = false;
+    }
 
-        public void Update() { }
+    public void SetEffectActive(bool active)
+    {
+        if (Blur.enabled = Active = active)
+            BlurSize = BlurSize;
+        else
+            Reset();
     }
+
+    public void Reset()
+    {
+        Blur.blurSize = initialBlurSize;
+        Blur.blurIterations = initialBlurIterations;
+        Blur.downsample = initialDownsample;
+    }
+
+    public void Update() { }
 }

+ 82 - 83
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/DepthOfFieldManager.cs

@@ -1,108 +1,107 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DepthOfFieldEffectManager : IEffectManager
 {
-    public class DepthOfFieldEffectManager : IEffectManager
-    {
-        public const string header = "EFFECT_DOF";
+    public const string header = "EFFECT_DOF";
 
-        private readonly float initialValue = 0f;
+    private readonly float initialValue = 0f;
 
-        private float focalLength;
-        private float focalSize;
-        private float aperture;
-        private float maxBlurSize;
-        private bool visualizeFocus;
+    private float focalLength;
+    private float focalSize;
+    private float aperture;
+    private float maxBlurSize;
+    private bool visualizeFocus;
 
-        public bool Ready { get; private set; }
-        public bool Active { get; private set; }
+    public bool Ready { get; private set; }
+    public bool Active { get; private set; }
 
-        public float FocalLength
-        {
-            get => focalLength;
-            set => focalLength = DepthOfField.focalLength = value;
-        }
+    public float FocalLength
+    {
+        get => focalLength;
+        set => focalLength = DepthOfField.focalLength = value;
+    }
 
-        public float FocalSize
-        {
-            get => focalSize;
-            set => focalSize = DepthOfField.focalSize = value;
-        }
+    public float FocalSize
+    {
+        get => focalSize;
+        set => focalSize = DepthOfField.focalSize = value;
+    }
 
-        public float Aperture
-        {
-            get => aperture;
-            set => aperture = DepthOfField.aperture = value;
-        }
+    public float Aperture
+    {
+        get => aperture;
+        set => aperture = DepthOfField.aperture = value;
+    }
 
-        public float MaxBlurSize
-        {
-            get => maxBlurSize;
-            set => maxBlurSize = DepthOfField.maxBlurSize = value;
-        }
+    public float MaxBlurSize
+    {
+        get => maxBlurSize;
+        set => maxBlurSize = DepthOfField.maxBlurSize = value;
+    }
 
-        public bool VisualizeFocus
-        {
-            get => visualizeFocus;
-            set => visualizeFocus = DepthOfField.visualizeFocus = value;
-        }
+    public bool VisualizeFocus
+    {
+        get => visualizeFocus;
+        set => visualizeFocus = DepthOfField.visualizeFocus = value;
+    }
 
-        private DepthOfFieldScatter DepthOfField { get; set; }
+    private DepthOfFieldScatter DepthOfField { get; set; }
 
-        public void Activate()
+    public void Activate()
+    {
+        if (DepthOfField == null)
         {
-            if (DepthOfField == null)
-            {
-                Ready = true;
-                DepthOfField = GameMain.Instance.MainCamera.GetOrAddComponent<DepthOfFieldScatter>();
-
-                if (DepthOfField.dofHdrShader == null)
-                    DepthOfField.dofHdrShader = Shader.Find("Hidden/Dof/DepthOfFieldHdr");
+            Ready = true;
+            DepthOfField = GameMain.Instance.MainCamera.GetOrAddComponent<DepthOfFieldScatter>();
 
-                if (DepthOfField.dx11BokehShader == null)
-                    DepthOfField.dx11BokehShader = Shader.Find("Hidden/Dof/DX11Dof");
+            if (DepthOfField.dofHdrShader == null)
+                DepthOfField.dofHdrShader = Shader.Find("Hidden/Dof/DepthOfFieldHdr");
 
-                if (DepthOfField.dx11BokehTexture == null)
-                    DepthOfField.dx11BokehTexture = Resources.Load("Textures/hexShape") as Texture2D;
-            }
+            if (DepthOfField.dx11BokehShader == null)
+                DepthOfField.dx11BokehShader = Shader.Find("Hidden/Dof/DX11Dof");
 
-            SetEffectActive(false);
+            if (DepthOfField.dx11BokehTexture == null)
+                DepthOfField.dx11BokehTexture = Resources.Load("Textures/hexShape") as Texture2D;
         }
 
-        public void Deactivate()
-        {
-            FocalLength = initialValue;
-            FocalSize = initialValue;
-            Aperture = initialValue;
-            MaxBlurSize = initialValue;
-            VisualizeFocus = false;
-            DepthOfField.enabled = false;
-            Active = false;
-        }
+        SetEffectActive(false);
+    }
 
-        public void Reset()
-        {
-            DepthOfField.focalLength = initialValue;
-            DepthOfField.focalSize = initialValue;
-            DepthOfField.aperture = initialValue;
-            DepthOfField.maxBlurSize = initialValue;
-        }
+    public void Deactivate()
+    {
+        FocalLength = initialValue;
+        FocalSize = initialValue;
+        Aperture = initialValue;
+        MaxBlurSize = initialValue;
+        VisualizeFocus = false;
+        DepthOfField.enabled = false;
+        Active = false;
+    }
+
+    public void Reset()
+    {
+        DepthOfField.focalLength = initialValue;
+        DepthOfField.focalSize = initialValue;
+        DepthOfField.aperture = initialValue;
+        DepthOfField.maxBlurSize = initialValue;
+    }
 
-        public void SetEffectActive(bool active)
+    public void SetEffectActive(bool active)
+    {
+        DepthOfField.enabled = active;
+
+        if (Active = active)
         {
-            DepthOfField.enabled = active;
-
-            if (Active = active)
-            {
-                DepthOfField.focalLength = FocalLength;
-                DepthOfField.focalSize = FocalSize;
-                DepthOfField.aperture = Aperture;
-                DepthOfField.maxBlurSize = MaxBlurSize;
-            }
-            else
-                Reset();
+            DepthOfField.focalLength = FocalLength;
+            DepthOfField.focalSize = FocalSize;
+            DepthOfField.aperture = Aperture;
+            DepthOfField.maxBlurSize = MaxBlurSize;
         }
-
-        public void Update() { }
+        else
+            Reset();
     }
+
+    public void Update() { }
 }

+ 107 - 108
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/FogEffectManager.cs

@@ -1,147 +1,146 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class FogEffectManager : IEffectManager
 {
-    public class FogEffectManager : IEffectManager
-    {
-        public const string header = "EFFECT_FOG";
+    public const string header = "EFFECT_FOG";
 
-        private readonly float initialDistance = 4f;
-        private readonly float initialDensity = 1f;
-        private readonly float initialHeightScale = 1f;
-        private readonly float initialHeight = 0f;
-        private readonly Color initialColour = Color.white;
+    private readonly float initialDistance = 4f;
+    private readonly float initialDensity = 1f;
+    private readonly float initialHeightScale = 1f;
+    private readonly float initialHeight = 0f;
+    private readonly Color initialColour = Color.white;
 
-        private float distance;
-        private float density;
-        private float heightScale;
-        private float height;
-        private Color fogColour;
+    private float distance;
+    private float density;
+    private float heightScale;
+    private float height;
+    private Color fogColour;
 
-        public bool Ready { get; private set; }
-        public bool Active { get; private set; }
+    public bool Ready { get; private set; }
+    public bool Active { get; private set; }
 
-        public float Distance
-        {
-            get => distance;
-            set => distance = Fog.startDistance = value;
-        }
+    public float Distance
+    {
+        get => distance;
+        set => distance = Fog.startDistance = value;
+    }
 
-        public float Density
-        {
-            get => density;
-            set => density = Fog.globalDensity = value;
-        }
+    public float Density
+    {
+        get => density;
+        set => density = Fog.globalDensity = value;
+    }
 
-        public float HeightScale
-        {
-            get => heightScale;
-            set => heightScale = Fog.heightScale = value;
-        }
+    public float HeightScale
+    {
+        get => heightScale;
+        set => heightScale = Fog.heightScale = value;
+    }
 
-        public float Height
-        {
-            get => height;
-            set => height = Fog.height = value;
-        }
+    public float Height
+    {
+        get => height;
+        set => height = Fog.height = value;
+    }
 
-        public float FogColourRed
+    public float FogColourRed
+    {
+        get => FogColour.r;
+        set
         {
-            get => FogColour.r;
-            set
-            {
-                var fogColour = FogColour;
+            var fogColour = FogColour;
 
-                FogColour = new Color(value, fogColour.g, fogColour.b);
-            }
+            FogColour = new Color(value, fogColour.g, fogColour.b);
         }
+    }
 
-        public float FogColourGreen
+    public float FogColourGreen
+    {
+        get => FogColour.g;
+        set
         {
-            get => FogColour.g;
-            set
-            {
-                var fogColour = FogColour;
+            var fogColour = FogColour;
 
-                FogColour = new Color(fogColour.r, value, fogColour.b);
-            }
+            FogColour = new Color(fogColour.r, value, fogColour.b);
         }
+    }
 
-        public float FogColourBlue
+    public float FogColourBlue
+    {
+        get => FogColour.b;
+        set
         {
-            get => FogColour.b;
-            set
-            {
-                var fogColour = FogColour;
+            var fogColour = FogColour;
 
-                FogColour = new Color(fogColour.r, fogColour.g, value);
-            }
+            FogColour = new Color(fogColour.r, fogColour.g, value);
         }
+    }
 
-        public Color FogColour
-        {
-            get => fogColour;
-            set => fogColour = Fog.globalFogColor = value;
-        }
+    public Color FogColour
+    {
+        get => fogColour;
+        set => fogColour = Fog.globalFogColor = value;
+    }
 
-        private GlobalFog Fog { get; set; }
+    private GlobalFog Fog { get; set; }
 
-        public void Activate()
+    public void Activate()
+    {
+        if (Fog == null)
         {
-            if (Fog == null)
-            {
-                Ready = true;
-                Fog = GameMain.Instance.MainCamera.GetOrAddComponent<GlobalFog>();
-
-                if (Fog.fogShader == null)
-                    Fog.fogShader = Shader.Find("Hidden/GlobalFog");
-
-                Distance = initialDistance;
-                Density = initialDensity;
-                HeightScale = initialHeightScale;
-                Height = initialHeight;
-                FogColour = initialColour;
-            }
-
-            SetEffectActive(false);
-        }
+            Ready = true;
+            Fog = GameMain.Instance.MainCamera.GetOrAddComponent<GlobalFog>();
+
+            if (Fog.fogShader == null)
+                Fog.fogShader = Shader.Find("Hidden/GlobalFog");
 
-        public void Deactivate()
-        {
             Distance = initialDistance;
             Density = initialDensity;
             HeightScale = initialHeightScale;
             Height = initialHeight;
             FogColour = initialColour;
-            Fog.enabled = false;
-            Active = false;
         }
 
-        public void Reset()
-        {
-            Fog.startDistance = initialDistance;
-            Fog.globalDensity = initialDensity;
-            Fog.heightScale = initialHeightScale;
-            Fog.height = initialHeight;
-            Fog.globalFogColor = initialColour;
-        }
+        SetEffectActive(false);
+    }
+
+    public void Deactivate()
+    {
+        Distance = initialDistance;
+        Density = initialDensity;
+        HeightScale = initialHeightScale;
+        Height = initialHeight;
+        FogColour = initialColour;
+        Fog.enabled = false;
+        Active = false;
+    }
 
-        public void SetEffectActive(bool active)
+    public void Reset()
+    {
+        Fog.startDistance = initialDistance;
+        Fog.globalDensity = initialDensity;
+        Fog.heightScale = initialHeightScale;
+        Fog.height = initialHeight;
+        Fog.globalFogColor = initialColour;
+    }
+
+    public void SetEffectActive(bool active)
+    {
+        Fog.enabled = active;
+
+        if (Active = active)
         {
-            Fog.enabled = active;
-
-            if (Active = active)
-            {
-                Fog.startDistance = Distance;
-                Fog.globalDensity = Density;
-                Fog.heightScale = HeightScale;
-                Fog.height = Height;
-                Fog.globalFogColor = FogColour;
-            }
-            else
-                Reset();
+            Fog.startDistance = Distance;
+            Fog.globalDensity = Density;
+            Fog.heightScale = HeightScale;
+            Fog.height = Height;
+            Fog.globalFogColor = FogColour;
         }
-
-        public void Update() { }
+        else
+            Reset();
     }
+
+    public void Update() { }
 }

+ 7 - 8
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/IEffectManager.cs

@@ -1,11 +1,10 @@
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public interface IEffectManager : IManager
 {
-    public interface IEffectManager : IManager
-    {
-        bool Ready { get; }
-        bool Active { get; }
+    bool Ready { get; }
+    bool Active { get; }
 
-        void SetEffectActive(bool active);
-        void Reset();
-    }
+    void SetEffectActive(bool active);
+    void Reset();
 }

+ 23 - 24
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/SepiaToneEffectManager.cs

@@ -1,38 +1,37 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SepiaToneEffectManger : IEffectManager
 {
-    public class SepiaToneEffectManger : IEffectManager
-    {
-        public const string header = "EFFECT_SEPIA";
+    public const string header = "EFFECT_SEPIA";
 
-        public bool Ready { get; private set; }
-        public bool Active { get; private set; }
+    public bool Ready { get; private set; }
+    public bool Active { get; private set; }
 
-        private SepiaToneEffect SepiaTone { get; set; }
+    private SepiaToneEffect SepiaTone { get; set; }
 
-        public void Activate()
+    public void Activate()
+    {
+        if (SepiaTone == null)
         {
-            if (SepiaTone == null)
-            {
-                Ready = true;
-                SepiaTone = GameMain.Instance.MainCamera.GetOrAddComponent<SepiaToneEffect>();
-
-                if (SepiaTone.shader == null)
-                    SepiaTone.shader = Shader.Find("Hidden/Sepiatone Effect");
-            }
+            Ready = true;
+            SepiaTone = GameMain.Instance.MainCamera.GetOrAddComponent<SepiaToneEffect>();
 
-            SetEffectActive(false);
+            if (SepiaTone.shader == null)
+                SepiaTone.shader = Shader.Find("Hidden/Sepiatone Effect");
         }
 
-        public void Deactivate() =>
-            SetEffectActive(false);
+        SetEffectActive(false);
+    }
 
-        public void SetEffectActive(bool active) =>
-            SepiaTone.enabled = Active = active;
+    public void Deactivate() =>
+        SetEffectActive(false);
 
-        public void Reset() { }
+    public void SetEffectActive(bool active) =>
+        SepiaTone.enabled = Active = active;
 
-        public void Update() { }
-    }
+    public void Reset() { }
+
+    public void Update() { }
 }

+ 77 - 78
src/MeidoPhotoStudio.Plugin/Managers/EffectManagers/VignetteEffectManager.cs

@@ -1,97 +1,96 @@
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class VignetteEffectManager : IEffectManager
 {
-    public class VignetteEffectManager : IEffectManager
+    public const string header = "EFFECT_VIGNETTE";
+
+    private float initialIntensity;
+    private float initialBlur;
+    private float initialBlurSpread;
+    private float initialChromaticAberration;
+    private float blur;
+    private float blurSpread;
+    private float chromaticAberration;
+    private float intensity;
+
+    public bool Ready { get; private set; }
+    public bool Active { get; private set; }
+
+    public float Intensity
     {
-        public const string header = "EFFECT_VIGNETTE";
+        get => intensity;
+        set => intensity = Vignette.intensity = value;
+    }
 
-        private float initialIntensity;
-        private float initialBlur;
-        private float initialBlurSpread;
-        private float initialChromaticAberration;
-        private float blur;
-        private float blurSpread;
-        private float chromaticAberration;
-        private float intensity;
+    public float Blur
+    {
+        get => blur;
+        set => blur = Vignette.blur = value;
+    }
 
-        public bool Ready { get; private set; }
-        public bool Active { get; private set; }
+    public float BlurSpread
+    {
+        get => blurSpread;
+        set => blurSpread = Vignette.blurSpread = value;
+    }
 
-        public float Intensity
-        {
-            get => intensity;
-            set => intensity = Vignette.intensity = value;
-        }
+    public float ChromaticAberration
+    {
+        get => chromaticAberration;
+        set => chromaticAberration = Vignette.chromaticAberration = value;
+    }
 
-        public float Blur
-        {
-            get => blur;
-            set => blur = Vignette.blur = value;
-        }
+    private Vignetting Vignette { get; set; }
 
-        public float BlurSpread
+    public void Activate()
+    {
+        if (Vignette == null)
         {
-            get => blurSpread;
-            set => blurSpread = Vignette.blurSpread = value;
-        }
+            Ready = true;
+            Vignette = GameMain.Instance.MainCamera.GetOrAddComponent<Vignetting>();
+            Vignette.mode = Vignetting.AberrationMode.Simple;
 
-        public float ChromaticAberration
-        {
-            get => chromaticAberration;
-            set => chromaticAberration = Vignette.chromaticAberration = value;
+            initialIntensity = Vignette.intensity;
+            initialBlur = Vignette.blur;
+            initialBlurSpread = Vignette.blurSpread;
+            initialChromaticAberration = Vignette.chromaticAberration;
         }
 
-        private Vignetting Vignette { get; set; }
+        SetEffectActive(false);
+    }
 
-        public void Activate()
-        {
-            if (Vignette == null)
-            {
-                Ready = true;
-                Vignette = GameMain.Instance.MainCamera.GetOrAddComponent<Vignetting>();
-                Vignette.mode = Vignetting.AberrationMode.Simple;
-
-                initialIntensity = Vignette.intensity;
-                initialBlur = Vignette.blur;
-                initialBlurSpread = Vignette.blurSpread;
-                initialChromaticAberration = Vignette.chromaticAberration;
-            }
-
-            SetEffectActive(false);
-        }
+    public void Deactivate()
+    {
+        Intensity = initialIntensity;
+        Blur = initialBlur;
+        BlurSpread = initialBlurSpread;
+        ChromaticAberration = initialChromaticAberration;
+        Vignette.enabled = false;
+        Active = false;
+    }
 
-        public void Deactivate()
-        {
-            Intensity = initialIntensity;
-            Blur = initialBlur;
-            BlurSpread = initialBlurSpread;
-            ChromaticAberration = initialChromaticAberration;
-            Vignette.enabled = false;
-            Active = false;
-        }
+    public void Reset()
+    {
+        Vignette.intensity = initialIntensity;
+        Vignette.blur = initialBlur;
+        Vignette.blurSpread = initialBlurSpread;
+        Vignette.chromaticAberration = initialChromaticAberration;
+    }
 
-        public void Reset()
-        {
-            Vignette.intensity = initialIntensity;
-            Vignette.blur = initialBlur;
-            Vignette.blurSpread = initialBlurSpread;
-            Vignette.chromaticAberration = initialChromaticAberration;
-        }
+    public void SetEffectActive(bool active)
+    {
+        Vignette.enabled = active;
 
-        public void SetEffectActive(bool active)
+        if (Active = active)
         {
-            Vignette.enabled = active;
-
-            if (Active = active)
-            {
-                Vignette.intensity = Intensity;
-                Vignette.blur = Blur;
-                Vignette.blurSpread = BlurSpread;
-                Vignette.chromaticAberration = ChromaticAberration;
-            }
-            else
-                Reset();
+            Vignette.intensity = Intensity;
+            Vignette.blur = Blur;
+            Vignette.blurSpread = BlurSpread;
+            Vignette.chromaticAberration = ChromaticAberration;
         }
-
-        public void Update() { }
+        else
+            Reset();
     }
+
+    public void Update() { }
 }

+ 117 - 118
src/MeidoPhotoStudio.Plugin/Managers/EnvironmentManager.cs

@@ -3,162 +3,161 @@ using UnityEngine;
 
 using Object = UnityEngine.Object;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class EnvironmentManager : IManager
 {
-    public class EnvironmentManager : IManager
-    {
-        public const string header = "ENVIRONMENT";
-        public const string defaultBg = "Theater";
+    public const string header = "ENVIRONMENT";
+    public const string defaultBg = "Theater";
 
-        private const string myRoomPrefix = "マイルーム:";
+    private const string myRoomPrefix = "マイルーム:";
 
-        private static readonly BgMgr bgMgr = GameMain.Instance.BgMgr;
+    private static readonly BgMgr bgMgr = GameMain.Instance.BgMgr;
 
-        private static bool cubeActive;
-        private static bool cubeSmall;
-        private static event EventHandler CubeActiveChange;
-        private static event EventHandler CubeSmallChange;
+    private static bool cubeActive;
+    private static bool cubeSmall;
+    private static event EventHandler CubeActiveChange;
+    private static event EventHandler CubeSmallChange;
 
-        public static bool CubeActive
+    public static bool CubeActive
+    {
+        get => cubeActive;
+        set
         {
-            get => cubeActive;
-            set
-            {
-                if (value == cubeActive)
-                    return;
-
-                cubeActive = value;
-                CubeActiveChange?.Invoke(null, EventArgs.Empty);
-            }
+            if (value == cubeActive)
+                return;
+
+            cubeActive = value;
+            CubeActiveChange?.Invoke(null, EventArgs.Empty);
         }
+    }
 
-        public static bool CubeSmall
+    public static bool CubeSmall
+    {
+        get => cubeSmall;
+        set
         {
-            get => cubeSmall;
-            set
-            {
-                if (value == cubeSmall)
-                    return;
-
-                cubeSmall = value;
-                CubeSmallChange?.Invoke(null, EventArgs.Empty);
-            }
-        }
+            if (value == cubeSmall)
+                return;
 
-        private Transform bg;
-        private GameObject bgObject;
-        private DragPointBG bgDragPoint;
-        private bool bgVisible = true;
+            cubeSmall = value;
+            CubeSmallChange?.Invoke(null, EventArgs.Empty);
+        }
+    }
 
-        public string CurrentBgAsset { get; private set; } = defaultBg;
+    private Transform bg;
+    private GameObject bgObject;
+    private DragPointBG bgDragPoint;
+    private bool bgVisible = true;
 
-        public bool BGVisible
-        {
-            get => bgVisible;
-            set
-            {
-                bgVisible = value;
-                bgObject.SetActive(bgVisible);
-            }
-        }
+    public string CurrentBgAsset { get; private set; } = defaultBg;
 
-        public EnvironmentManager()
+    public bool BGVisible
+    {
+        get => bgVisible;
+        set
         {
-            DragPointLight.EnvironmentManager = this;
-            Activate();
+            bgVisible = value;
+            bgObject.SetActive(bgVisible);
         }
+    }
 
-        public void Update() { }
-
-        public void Activate()
-        {
-            BgMgrPatcher.ChangeBgBegin += OnChangeBegin;
-            BgMgrPatcher.ChangeBgEnd += OnChangeEnd;
+    public EnvironmentManager()
+    {
+        DragPointLight.EnvironmentManager = this;
+        Activate();
+    }
 
-            bgObject = bgMgr.Parent;
+    public void Update() { }
 
-            bgObject.SetActive(true);
+    public void Activate()
+    {
+        BgMgrPatcher.ChangeBgBegin += OnChangeBegin;
+        BgMgrPatcher.ChangeBgEnd += OnChangeEnd;
 
-            if (MeidoPhotoStudio.EditMode)
-                UpdateBG();
-            else
-                ChangeBackground(defaultBg);
+        bgObject = bgMgr.Parent;
 
-            CubeSmallChange += OnCubeSmall;
-            CubeActiveChange += OnCubeActive;
-        }
+        bgObject.SetActive(true);
 
-        public void Deactivate()
-        {
-            BgMgrPatcher.ChangeBgBegin -= OnChangeBegin;
-            BgMgrPatcher.ChangeBgEnd -= OnChangeEnd;
+        if (MeidoPhotoStudio.EditMode)
+            UpdateBG();
+        else
+            ChangeBackground(defaultBg);
 
-            DestroyDragPoint();
-            BGVisible = true;
+        CubeSmallChange += OnCubeSmall;
+        CubeActiveChange += OnCubeActive;
+    }
 
-            if (MeidoPhotoStudio.EditMode)
-                bgMgr.ChangeBg(defaultBg);
-            else
-            {
-                var isNight = GameMain.Instance.CharacterMgr.status.GetFlag("時間帯") == 3;
+    public void Deactivate()
+    {
+        BgMgrPatcher.ChangeBgBegin -= OnChangeBegin;
+        BgMgrPatcher.ChangeBgEnd -= OnChangeEnd;
 
-                bgMgr.ChangeBg(isNight ? "ShinShitsumu_ChairRot_Night" : "ShinShitsumu_ChairRot");
-            }
+        DestroyDragPoint();
+        BGVisible = true;
 
-            if (bgMgr.BgObject)
-                bgMgr.BgObject.transform.localScale = Vector3.one;
+        if (MeidoPhotoStudio.EditMode)
+            bgMgr.ChangeBg(defaultBg);
+        else
+        {
+            var isNight = GameMain.Instance.CharacterMgr.status.GetFlag("時間帯") == 3;
 
-            CubeSmallChange -= OnCubeSmall;
-            CubeActiveChange -= OnCubeActive;
+            bgMgr.ChangeBg(isNight ? "ShinShitsumu_ChairRot_Night" : "ShinShitsumu_ChairRot");
         }
 
-        public void ChangeBackground(string assetName, bool creative = false)
-        {
-            if (creative)
-                bgMgr.ChangeBgMyRoom(assetName);
-            else
-                bgMgr.ChangeBg(assetName);
-        }
+        if (bgMgr.BgObject)
+            bgMgr.BgObject.transform.localScale = Vector3.one;
 
-        private void AttachDragPoint(Transform bgTransform)
-        {
-            bgDragPoint = DragPoint.Make<DragPointBG>(PrimitiveType.Cube, Vector3.one * 0.12f);
-            bgDragPoint.Initialize(() => bgTransform.position, () => Vector3.zero);
-            bgDragPoint.Set(bgTransform);
-            bgDragPoint.AddGizmo();
-            bgDragPoint.ConstantScale = true;
-            bgDragPoint.gameObject.SetActive(CubeActive);
-        }
+        CubeSmallChange -= OnCubeSmall;
+        CubeActiveChange -= OnCubeActive;
+    }
 
-        private void OnChangeBegin(object sender, EventArgs args) => DestroyDragPoint();
+    public void ChangeBackground(string assetName, bool creative = false)
+    {
+        if (creative)
+            bgMgr.ChangeBgMyRoom(assetName);
+        else
+            bgMgr.ChangeBg(assetName);
+    }
 
-        private void OnChangeEnd(object sender, EventArgs args) => UpdateBG();
+    private void AttachDragPoint(Transform bgTransform)
+    {
+        bgDragPoint = DragPoint.Make<DragPointBG>(PrimitiveType.Cube, Vector3.one * 0.12f);
+        bgDragPoint.Initialize(() => bgTransform.position, () => Vector3.zero);
+        bgDragPoint.Set(bgTransform);
+        bgDragPoint.AddGizmo();
+        bgDragPoint.ConstantScale = true;
+        bgDragPoint.gameObject.SetActive(CubeActive);
+    }
 
-        private void UpdateBG()
-        {
-            if (!bgMgr.BgObject)
-                return;
+    private void OnChangeBegin(object sender, EventArgs args) => DestroyDragPoint();
 
-            CurrentBgAsset = bgMgr.GetBGName();
+    private void OnChangeEnd(object sender, EventArgs args) => UpdateBG();
 
-            if (CurrentBgAsset.StartsWith(myRoomPrefix))
-                CurrentBgAsset = CurrentBgAsset.Replace(myRoomPrefix, string.Empty);
+    private void UpdateBG()
+    {
+        if (!bgMgr.BgObject)
+            return;
 
-            bg = bgMgr.BgObject.transform;
+        CurrentBgAsset = bgMgr.GetBGName();
 
-            AttachDragPoint(bg);
-        }
+        if (CurrentBgAsset.StartsWith(myRoomPrefix))
+            CurrentBgAsset = CurrentBgAsset.Replace(myRoomPrefix, string.Empty);
 
-        private void DestroyDragPoint()
-        {
-            if (bgDragPoint)
-                Object.Destroy(bgDragPoint.gameObject);
-        }
+        bg = bgMgr.BgObject.transform;
 
-        private void OnCubeSmall(object sender, EventArgs args) =>
-            bgDragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
+        AttachDragPoint(bg);
+    }
 
-        private void OnCubeActive(object sender, EventArgs args) =>
-            bgDragPoint.gameObject.SetActive(CubeActive);
+    private void DestroyDragPoint()
+    {
+        if (bgDragPoint)
+            Object.Destroy(bgDragPoint.gameObject);
     }
+
+    private void OnCubeSmall(object sender, EventArgs args) =>
+        bgDragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
+
+    private void OnCubeActive(object sender, EventArgs args) =>
+        bgDragPoint.gameObject.SetActive(CubeActive);
 }

+ 6 - 7
src/MeidoPhotoStudio.Plugin/Managers/IManager.cs

@@ -1,9 +1,8 @@
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public interface IManager
 {
-    public interface IManager
-    {
-        void Update();
-        void Activate();
-        void Deactivate();
-    }
+    void Update();
+    void Activate();
+    void Deactivate();
 }

+ 124 - 125
src/MeidoPhotoStudio.Plugin/Managers/InputManager.cs

@@ -4,172 +4,171 @@ using System.Linq;
 using BepInEx.Configuration;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class InputManager
 {
-    public static class InputManager
-    {
-        public const KeyCode upperKeyCode = KeyCode.F15;
-        public const string configHeader = "Controls";
+    public const KeyCode upperKeyCode = KeyCode.F15;
+    public const string configHeader = "Controls";
 
-        public static readonly AcceptableValueBase controlRange;
+    public static readonly AcceptableValueBase controlRange;
 
-        private static readonly Dictionary<MpsKey, KeyCode> ActionKeys = new();
-        private static readonly Dictionary<MpsKey, ConfigEntry<KeyCode>> ConfigEntries = new();
+    private static readonly Dictionary<MpsKey, KeyCode> ActionKeys = new();
+    private static readonly Dictionary<MpsKey, ConfigEntry<KeyCode>> ConfigEntries = new();
 
-        public static event EventHandler KeyChange;
+    public static event EventHandler KeyChange;
 
-        public static KeyCode CurrentKeyCode { get; private set; }
-        public static bool Listening { get; private set; }
+    public static KeyCode CurrentKeyCode { get; private set; }
+    public static bool Listening { get; private set; }
 
-        public static bool Control =>
-            Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
+    public static bool Control =>
+        Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl);
 
-        public static bool Alt =>
-            Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
+    public static bool Alt =>
+        Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt);
 
-        public static bool Shift =>
-            Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
+    public static bool Shift =>
+        Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
 
-        private static InputListener inputListener;
+    private static InputListener inputListener;
 
-        static InputManager() =>
-            controlRange = new AcceptableValueRange<KeyCode>(default, upperKeyCode);
+    static InputManager() =>
+        controlRange = new AcceptableValueRange<KeyCode>(default, upperKeyCode);
 
-        public static void Register(MpsKey action, KeyCode key, string description)
-        {
-            key = Clamp(key, default, upperKeyCode);
+    public static void Register(MpsKey action, KeyCode key, string description)
+    {
+        key = Clamp(key, default, upperKeyCode);
 
-            if (ConfigEntries.ContainsKey(action))
-                Rebind(action, key);
-            else
-            {
-                var configDescription = new ConfigDescription(description, controlRange);
+        if (ConfigEntries.ContainsKey(action))
+            Rebind(action, key);
+        else
+        {
+            var configDescription = new ConfigDescription(description, controlRange);
 
-                ConfigEntries[action] = Configuration.Config.Bind(
+            ConfigEntries[action] = Configuration.Config.Bind(
                     configHeader, action.ToString(), key, configDescription
-                );
+                    );
 
-                key = ConfigEntries[action].Value;
-                ActionKeys[action] = key;
-            }
+            key = ConfigEntries[action].Value;
+            ActionKeys[action] = key;
         }
+    }
 
-        public static void Rebind(MpsKey action, KeyCode key)
-        {
-            key = Clamp(key, default, upperKeyCode);
+    public static void Rebind(MpsKey action, KeyCode key)
+    {
+        key = Clamp(key, default, upperKeyCode);
 
-            if (ConfigEntries.ContainsKey(action))
-                ConfigEntries[action].Value = key;
+        if (ConfigEntries.ContainsKey(action))
+            ConfigEntries[action].Value = key;
 
-            ActionKeys[action] = key;
-        }
+        ActionKeys[action] = key;
+    }
 
-        public static KeyCode Clamp(KeyCode value, KeyCode min, KeyCode max) =>
-            value < min ? min : value > max ? max : value;
+    public static KeyCode Clamp(KeyCode value, KeyCode min, KeyCode max) =>
+        value < min ? min : value > max ? max : value;
 
-        public static KeyCode GetActionKey(MpsKey action) =>
-            ActionKeys.TryGetValue(action, out var keyCode) ? keyCode : default;
+    public static KeyCode GetActionKey(MpsKey action) =>
+        ActionKeys.TryGetValue(action, out var keyCode) ? keyCode : default;
 
-        public static void StartListening()
-        {
-            if (inputListener == null)
-                inputListener = new GameObject().AddComponent<InputListener>();
-            else if (inputListener.gameObject.activeSelf)
-                StopListening();
-
-            inputListener.gameObject.SetActive(true);
-            inputListener.KeyChange += OnKeyChange;
-            CurrentKeyCode = KeyCode.None;
-            Listening = true;
-        }
+    public static void StartListening()
+    {
+        if (inputListener == null)
+            inputListener = new GameObject().AddComponent<InputListener>();
+        else if (inputListener.gameObject.activeSelf)
+            StopListening();
 
-        public static void StopListening()
-        {
-            if (!inputListener || !inputListener.gameObject.activeSelf)
-                return;
+        inputListener.gameObject.SetActive(true);
+        inputListener.KeyChange += OnKeyChange;
+        CurrentKeyCode = KeyCode.None;
+        Listening = true;
+    }
 
-            inputListener.gameObject.SetActive(false);
-            inputListener.KeyChange -= OnKeyChange;
-            CurrentKeyCode = KeyCode.None;
-            Listening = false;
-            Input.ResetInputAxes();
-        }
+    public static void StopListening()
+    {
+        if (!inputListener || !inputListener.gameObject.activeSelf)
+            return;
+
+        inputListener.gameObject.SetActive(false);
+        inputListener.KeyChange -= OnKeyChange;
+        CurrentKeyCode = KeyCode.None;
+        Listening = false;
+        Input.ResetInputAxes();
+    }
 
-        public static bool GetKey(MpsKey action) =>
-            !Listening && ActionKeys.ContainsKey(action) && Input.GetKey(ActionKeys[action]);
+    public static bool GetKey(MpsKey action) =>
+        !Listening && ActionKeys.ContainsKey(action) && Input.GetKey(ActionKeys[action]);
 
-        public static bool GetKeyDown(MpsKey action) =>
-            !Listening && ActionKeys.ContainsKey(action) && Input.GetKeyDown(ActionKeys[action]);
+    public static bool GetKeyDown(MpsKey action) =>
+        !Listening && ActionKeys.ContainsKey(action) && Input.GetKeyDown(ActionKeys[action]);
 
-        public static void Deactivate()
-        {
-            StopListening();
+    public static void Deactivate()
+    {
+        StopListening();
 
-            // TODO: Null propagation does not work with UnityEngine.Object
-            UnityEngine.Object.Destroy(inputListener?.gameObject);
-            inputListener = null;
-        }
+        // TODO: Null propagation does not work with UnityEngine.Object
+        UnityEngine.Object.Destroy(inputListener?.gameObject);
+        inputListener = null;
+    }
 
-        private static void OnKeyChange(object sender, KeyChangeEventArgs args)
-        {
-            CurrentKeyCode = args.Key;
-            KeyChange?.Invoke(null, EventArgs.Empty);
-            StopListening();
-        }
+    private static void OnKeyChange(object sender, KeyChangeEventArgs args)
+    {
+        CurrentKeyCode = args.Key;
+        KeyChange?.Invoke(null, EventArgs.Empty);
+        StopListening();
+    }
 
-        /* Listener taken from https://forum.unity.com/threads/find-out-which-key-was-pressed.385250/ */
-        private class InputListener : MonoBehaviour
-        {
-            private static readonly KeyCode[] keyCodes;
+    /* Listener taken from https://forum.unity.com/threads/find-out-which-key-was-pressed.385250/ */
+    private class InputListener : MonoBehaviour
+    {
+        private static readonly KeyCode[] keyCodes;
 
-            public event EventHandler<KeyChangeEventArgs> KeyChange;
+        public event EventHandler<KeyChangeEventArgs> KeyChange;
 
-            static InputListener() =>
-                keyCodes = Enum.GetValues(typeof(KeyCode))
-                    .Cast<KeyCode>()
-                    .Where(keyCode => keyCode <= upperKeyCode)
-                    .ToArray();
+        static InputListener() =>
+            keyCodes = Enum.GetValues(typeof(KeyCode))
+            .Cast<KeyCode>()
+            .Where(keyCode => keyCode <= upperKeyCode)
+            .ToArray();
 
-            private void Awake() =>
-                DontDestroyOnLoad(this);
+        private void Awake() =>
+            DontDestroyOnLoad(this);
 
-            private void Update()
-            {
-                if (!Input.anyKeyDown)
-                    return;
+        private void Update()
+        {
+            if (!Input.anyKeyDown)
+                return;
 
-                foreach (var key in keyCodes)
-                {
-                    if (!Input.GetKeyDown(key))
-                        continue;
+            foreach (var key in keyCodes)
+            {
+                if (!Input.GetKeyDown(key))
+                    continue;
 
-                    KeyChange?.Invoke(this, new KeyChangeEventArgs(key));
+                KeyChange?.Invoke(this, new KeyChangeEventArgs(key));
 
-                    break;
-                }
+                break;
             }
         }
-
-        private class KeyChangeEventArgs : EventArgs
-        {
-            public KeyCode Key { get; }
-
-            public KeyChangeEventArgs(KeyCode key) =>
-                Key = key;
-        }
     }
 
-    public enum MpsKey
+    private class KeyChangeEventArgs : EventArgs
     {
-        // MeidoPhotoStudio
-        Activate, Screenshot, ToggleUI, ToggleMessage,
-        // MeidoManager
-        MeidoUndressing,
-        // Camera
-        CameraLayer, CameraReset, CameraSave, CameraLoad,
-        // Dragpoint
-        DragSelect, DragDelete, DragMove, DragRotate, DragScale, DragFinger,
-        // Scene management
-        SaveScene, LoadScene, OpenSceneManager
+        public KeyCode Key { get; }
+
+        public KeyChangeEventArgs(KeyCode key) =>
+            Key = key;
     }
 }
+
+public enum MpsKey
+{
+    // MeidoPhotoStudio
+    Activate, Screenshot, ToggleUI, ToggleMessage,
+    // MeidoManager
+    MeidoUndressing,
+    // Camera
+    CameraLayer, CameraReset, CameraSave, CameraLoad,
+    // Dragpoint
+    DragSelect, DragDelete, DragMove, DragRotate, DragScale, DragFinger,
+    // Scene management
+    SaveScene, LoadScene, OpenSceneManager
+}

+ 143 - 144
src/MeidoPhotoStudio.Plugin/Managers/LightManager.cs

@@ -3,207 +3,206 @@ using System.Collections.Generic;
 using System.Linq;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class LightManager : IManager
 {
-    public class LightManager : IManager
-    {
-        public const string header = "LIGHT";
+    public const string header = "LIGHT";
 
-        private static bool cubeActive = true;
-        private static event EventHandler CubeActiveChange;
+    private static bool cubeActive = true;
+    private static event EventHandler CubeActiveChange;
 
-        public static bool CubeActive
+    public static bool CubeActive
+    {
+        get => cubeActive;
+        set
         {
-            get => cubeActive;
-            set
+            if (value != cubeActive)
             {
-                if (value != cubeActive)
-                {
-                    cubeActive = value;
-                    CubeActiveChange?.Invoke(null, EventArgs.Empty);
-                }
+                cubeActive = value;
+                CubeActiveChange?.Invoke(null, EventArgs.Empty);
             }
         }
+    }
 
-        private readonly List<DragPointLight> lightList = new();
+    private readonly List<DragPointLight> lightList = new();
 
-        public event EventHandler Rotate;
-        public event EventHandler Scale;
-        public event EventHandler ListModified;
-        public event EventHandler Select;
+    public event EventHandler Rotate;
+    public event EventHandler Scale;
+    public event EventHandler ListModified;
+    public event EventHandler Select;
 
-        private int selectedLightIndex;
+    private int selectedLightIndex;
 
-        public int SelectedLightIndex
+    public int SelectedLightIndex
+    {
+        get => selectedLightIndex;
+        set
         {
-            get => selectedLightIndex;
-            set
-            {
-                selectedLightIndex = Mathf.Clamp(value, 0, lightList.Count - 1);
-                lightList[SelectedLightIndex].IsActiveLight = true;
-            }
+            selectedLightIndex = Mathf.Clamp(value, 0, lightList.Count - 1);
+            lightList[SelectedLightIndex].IsActiveLight = true;
         }
+    }
 
-        public string[] LightNameList =>
-            lightList.Select(light => LightName(light.Name)).ToArray();
+    public string[] LightNameList =>
+        lightList.Select(light => LightName(light.Name)).ToArray();
 
-        public string ActiveLightName =>
-            LightName(lightList[SelectedLightIndex].Name);
+    public string ActiveLightName =>
+        LightName(lightList[SelectedLightIndex].Name);
 
-        public DragPointLight CurrentLight =>
-            lightList[SelectedLightIndex];
+    public DragPointLight CurrentLight =>
+        lightList[SelectedLightIndex];
 
-        public LightManager() =>
-            Activate();
+    public LightManager() =>
+        Activate();
 
-        public void Activate()
-        {
-            GameMain.Instance.MainCamera.GetComponent<Camera>().backgroundColor = Color.black;
-            AddLight(GameMain.Instance.MainLight.gameObject, true);
-            CubeActiveChange += OnCubeActive;
-        }
+    public void Activate()
+    {
+        GameMain.Instance.MainCamera.GetComponent<Camera>().backgroundColor = Color.black;
+        AddLight(GameMain.Instance.MainLight.gameObject, true);
+        CubeActiveChange += OnCubeActive;
+    }
 
-        public void Deactivate()
-        {
-            for (var i = 0; i < lightList.Count; i++)
-                DestroyLight(lightList[i]);
+    public void Deactivate()
+    {
+        for (var i = 0; i < lightList.Count; i++)
+            DestroyLight(lightList[i]);
 
-            selectedLightIndex = 0;
-            lightList.Clear();
+        selectedLightIndex = 0;
+        lightList.Clear();
 
-            GameMain.Instance.MainLight.Reset();
+        GameMain.Instance.MainLight.Reset();
 
-            var mainLight = GameMain.Instance.MainLight.GetComponent<Light>();
+        var mainLight = GameMain.Instance.MainLight.GetComponent<Light>();
 
-            mainLight.type = LightType.Directional;
-            DragPointLight.SetLightProperties(mainLight, new LightProperty());
-            CubeActiveChange -= OnCubeActive;
-        }
+        mainLight.type = LightType.Directional;
+        DragPointLight.SetLightProperties(mainLight, new LightProperty());
+        CubeActiveChange -= OnCubeActive;
+    }
 
-        public void Update() { }
+    public void Update() { }
 
-        public void AddLight(GameObject lightGo = null, bool isMain = false)
-        {
-            // TODO: null propagation does not work with UntiyEngine.Object
-            var go = lightGo ?? new GameObject("MPS Light");
-            var light = DragPoint.Make<DragPointLight>(PrimitiveType.Cube, Vector3.one * 0.12f);
+    public void AddLight(GameObject lightGo = null, bool isMain = false)
+    {
+        // TODO: null propagation does not work with UntiyEngine.Object
+        var go = lightGo ?? new GameObject("MPS Light");
+        var light = DragPoint.Make<DragPointLight>(PrimitiveType.Cube, Vector3.one * 0.12f);
 
-            light.Initialize(() => go.transform.position, () => go.transform.eulerAngles);
-            light.Set(go.transform);
-            light.IsMain = isMain;
+        light.Initialize(() => go.transform.position, () => go.transform.eulerAngles);
+        light.Set(go.transform);
+        light.IsMain = isMain;
 
-            light.Rotate += OnRotate;
-            light.Scale += OnScale;
-            light.Delete += OnDelete;
-            light.Select += OnSelect;
+        light.Rotate += OnRotate;
+        light.Scale += OnScale;
+        light.Delete += OnDelete;
+        light.Select += OnSelect;
 
-            lightList.Add(light);
+        lightList.Add(light);
 
-            CurrentLight.IsActiveLight = false;
-            SelectedLightIndex = lightList.Count;
-            OnListModified();
-        }
+        CurrentLight.IsActiveLight = false;
+        SelectedLightIndex = lightList.Count;
+        OnListModified();
+    }
 
-        public void DeleteActiveLight()
-        {
-            if (selectedLightIndex == 0)
-                return;
+    public void DeleteActiveLight()
+    {
+        if (selectedLightIndex == 0)
+            return;
 
-            DeleteLight(SelectedLightIndex);
-        }
+        DeleteLight(SelectedLightIndex);
+    }
 
-        public void DeleteLight(int lightIndex, bool noUpdate = false)
-        {
-            if (lightIndex == 0)
-                return;
+    public void DeleteLight(int lightIndex, bool noUpdate = false)
+    {
+        if (lightIndex == 0)
+            return;
 
-            DestroyLight(lightList[lightIndex]);
-            lightList.RemoveAt(lightIndex);
+        DestroyLight(lightList[lightIndex]);
+        lightList.RemoveAt(lightIndex);
 
-            if (lightIndex <= SelectedLightIndex)
-                SelectedLightIndex--;
+        if (lightIndex <= SelectedLightIndex)
+            SelectedLightIndex--;
 
-            if (noUpdate)
-                return;
+        if (noUpdate)
+            return;
 
-            OnListModified();
-        }
+        OnListModified();
+    }
 
-        public void SetColourModeActive(bool isColourMode) =>
-            lightList[0].IsColourMode = isColourMode;
+    public void SetColourModeActive(bool isColourMode) =>
+        lightList[0].IsColourMode = isColourMode;
 
-        public void ClearLights()
-        {
-            for (var i = lightList.Count - 1; i > 0; i--)
-                DeleteLight(i);
+    public void ClearLights()
+    {
+        for (var i = lightList.Count - 1; i > 0; i--)
+            DeleteLight(i);
 
-            selectedLightIndex = 0;
-        }
+        selectedLightIndex = 0;
+    }
 
-        private void DestroyLight(DragPointLight light)
-        {
-            if (light == null)
-                return;
+    private void DestroyLight(DragPointLight light)
+    {
+        if (light == null)
+            return;
 
-            light.Rotate -= OnRotate;
-            light.Scale -= OnScale;
-            light.Delete -= OnDelete;
-            light.Select -= OnSelect;
+        light.Rotate -= OnRotate;
+        light.Scale -= OnScale;
+        light.Delete -= OnDelete;
+        light.Select -= OnSelect;
 
-            UnityEngine.Object.Destroy(light.gameObject);
-        }
+        UnityEngine.Object.Destroy(light.gameObject);
+    }
 
-        private string LightName(string name) =>
-            Translation.Get("lightType", name);
+    private string LightName(string name) =>
+        Translation.Get("lightType", name);
 
-        private void OnDelete(object sender, EventArgs args)
+    private void OnDelete(object sender, EventArgs args)
+    {
+        var theLight = (DragPointLight)sender;
+
+        for (var i = 1; i < lightList.Count; i++)
         {
-            var theLight = (DragPointLight)sender;
+            var light = lightList[i];
 
-            for (var i = 1; i < lightList.Count; i++)
+            if (light == theLight)
             {
-                var light = lightList[i];
-
-                if (light == theLight)
-                {
-                    DeleteLight(i);
+                DeleteLight(i);
 
-                    return;
-                }
+                return;
             }
         }
+    }
 
-        private void OnRotate(object sender, EventArgs args) =>
-            OnTransformEvent((DragPointLight)sender, Rotate);
+    private void OnRotate(object sender, EventArgs args) =>
+        OnTransformEvent((DragPointLight)sender, Rotate);
 
-        private void OnScale(object sender, EventArgs args) =>
-            OnTransformEvent((DragPointLight)sender, Scale);
+    private void OnScale(object sender, EventArgs args) =>
+        OnTransformEvent((DragPointLight)sender, Scale);
 
-        private void OnTransformEvent(DragPointLight light, EventHandler handler)
-        {
-            if (light.IsActiveLight)
-                handler?.Invoke(this, EventArgs.Empty);
-        }
+    private void OnTransformEvent(DragPointLight light, EventHandler handler)
+    {
+        if (light.IsActiveLight)
+            handler?.Invoke(this, EventArgs.Empty);
+    }
 
-        private void OnSelect(object sender, EventArgs args)
-        {
-            var theLight = (DragPointLight)sender;
-            var select = lightList.FindIndex(light => light == theLight);
+    private void OnSelect(object sender, EventArgs args)
+    {
+        var theLight = (DragPointLight)sender;
+        var select = lightList.FindIndex(light => light == theLight);
 
-            if (select >= 0)
-            {
-                SelectedLightIndex = select;
-                Select?.Invoke(this, EventArgs.Empty);
-            }
+        if (select >= 0)
+        {
+            SelectedLightIndex = select;
+            Select?.Invoke(this, EventArgs.Empty);
         }
+    }
 
-        private void OnListModified() =>
-            ListModified?.Invoke(this, EventArgs.Empty);
+    private void OnListModified() =>
+        ListModified?.Invoke(this, EventArgs.Empty);
 
-        private void OnCubeActive(object sender, EventArgs args)
-        {
-            foreach (var dragPoint in lightList)
-                dragPoint.gameObject.SetActive(CubeActive);
-        }
+    private void OnCubeActive(object sender, EventArgs args)
+    {
+        foreach (var dragPoint in lightList)
+            dragPoint.gameObject.SetActive(CubeActive);
     }
 }

+ 289 - 290
src/MeidoPhotoStudio.Plugin/Managers/MeidoManager.cs

@@ -4,420 +4,419 @@ using System.Linq;
 using HarmonyLib;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MeidoManager : IManager
 {
-    public class MeidoManager : IManager
-    {
-        public const string header = "MEIDO";
+    public const string header = "MEIDO";
 
-        private static readonly CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
+    private static readonly CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
 
-        private static bool active;
+    private static bool active;
 
-        private static int EditMaidIndex { get; set; }
+    private static int EditMaidIndex { get; set; }
 
-        public event EventHandler<MeidoUpdateEventArgs> UpdateMeido;
-        public event EventHandler EndCallMeidos;
-        public event EventHandler BeginCallMeidos;
+    public event EventHandler<MeidoUpdateEventArgs> UpdateMeido;
+    public event EventHandler EndCallMeidos;
+    public event EventHandler BeginCallMeidos;
 
-        private int selectedMeido;
-        private bool globalGravity;
-        private int undress;
-        private int tempEditMaidIndex = -1;
+    private int selectedMeido;
+    private bool globalGravity;
+    private int undress;
+    private int tempEditMaidIndex = -1;
 
-        public Meido[] Meidos { get; private set; }
-        public HashSet<int> SelectedMeidoSet { get; } = new();
-        public List<int> SelectMeidoList { get; } = new();
-        public List<Meido> ActiveMeidoList { get; } = new();
+    public Meido[] Meidos { get; private set; }
+    public HashSet<int> SelectedMeidoSet { get; } = new();
+    public List<int> SelectMeidoList { get; } = new();
+    public List<Meido> ActiveMeidoList { get; } = new();
 
-        public int SelectedMeido
-        {
-            get => selectedMeido;
-            private set => selectedMeido = Utility.Bound(value, 0, ActiveMeidoList.Count - 1);
-        }
+    public int SelectedMeido
+    {
+        get => selectedMeido;
+        private set => selectedMeido = Utility.Bound(value, 0, ActiveMeidoList.Count - 1);
+    }
 
-        public bool Busy =>
-            ActiveMeidoList.Any(meido => meido.Busy);
+    public bool Busy =>
+        ActiveMeidoList.Any(meido => meido.Busy);
 
-        public Meido ActiveMeido =>
-            ActiveMeidoList.Count > 0 ? ActiveMeidoList[SelectedMeido] : null;
+    public Meido ActiveMeido =>
+        ActiveMeidoList.Count > 0 ? ActiveMeidoList[SelectedMeido] : null;
 
-        public Meido EditMeido =>
-            tempEditMaidIndex >= 0 ? Meidos[tempEditMaidIndex] : Meidos[EditMaidIndex];
+    public Meido EditMeido =>
+        tempEditMaidIndex >= 0 ? Meidos[tempEditMaidIndex] : Meidos[EditMaidIndex];
 
-        public bool HasActiveMeido =>
-            ActiveMeido != null;
+    public bool HasActiveMeido =>
+        ActiveMeido != null;
 
-        public bool GlobalGravity
+    public bool GlobalGravity
+    {
+        get => globalGravity;
+        set
         {
-            get => globalGravity;
-            set
-            {
-                globalGravity = value;
+            globalGravity = value;
 
-                if (!HasActiveMeido)
-                    return;
+            if (!HasActiveMeido)
+                return;
 
-                var activeMeido = ActiveMeido;
-                var activeMeidoSlot = activeMeido.Slot;
+            var activeMeido = ActiveMeido;
+            var activeMeidoSlot = activeMeido.Slot;
 
-                foreach (var meido in ActiveMeidoList)
-                {
-                    if (meido.Slot == activeMeidoSlot)
-                        continue;
+            foreach (var meido in ActiveMeidoList)
+            {
+                if (meido.Slot == activeMeidoSlot)
+                    continue;
 
-                    meido.HairGravityActive = value && activeMeido.HairGravityActive;
-                    meido.SkirtGravityActive = value && activeMeido.SkirtGravityActive;
-                }
+                meido.HairGravityActive = value && activeMeido.HairGravityActive;
+                meido.SkirtGravityActive = value && activeMeido.SkirtGravityActive;
             }
         }
+    }
 
-        static MeidoManager() =>
-            InputManager.Register(MpsKey.MeidoUndressing, KeyCode.H, "All maid undressing");
+    static MeidoManager() =>
+        InputManager.Register(MpsKey.MeidoUndressing, KeyCode.H, "All maid undressing");
 
-        private static void SetEditorMaid(Maid maid)
+    private static void SetEditorMaid(Maid maid)
+    {
+        if (maid == null)
         {
-            if (maid == null)
-            {
-                Utility.LogWarning("Refusing to change editing maid because the new maid is null!");
+            Utility.LogWarning("Refusing to change editing maid because the new maid is null!");
 
-                return;
-            }
+            return;
+        }
 
-            if (SceneEdit.Instance.maid.status.guid == maid.status.guid)
-            {
-                Utility.LogDebug("Editing maid is the same as new maid");
+        if (SceneEdit.Instance.maid.status.guid == maid.status.guid)
+        {
+            Utility.LogDebug("Editing maid is the same as new maid");
 
-                return;
-            }
+            return;
+        }
 
-            var uiRoot = GameObject.Find("UI Root");
+        var uiRoot = GameObject.Find("UI Root");
 
-            if (!TryGetUIControl<PresetCtrl>(uiRoot, "PresetPanel", out var presetCtrl))
-                return;
+        if (!TryGetUIControl<PresetCtrl>(uiRoot, "PresetPanel", out var presetCtrl))
+            return;
 
-            if (!TryGetUIControl<PresetButtonCtrl>(uiRoot, "PresetButtonPanel", out var presetButtonCtrl))
-                return;
+        if (!TryGetUIControl<PresetButtonCtrl>(uiRoot, "PresetButtonPanel", out var presetButtonCtrl))
+            return;
 
-            if (!TryGetUIControl<ProfileCtrl>(uiRoot, "ProfilePanel", out var profileCtrl))
-                return;
+        if (!TryGetUIControl<ProfileCtrl>(uiRoot, "ProfilePanel", out var profileCtrl))
+            return;
 
-            if (!TryGetUIControl<SceneEditWindow.CustomPartsWindow>(
-                uiRoot, "Window/CustomPartsWindow", out var sceneEditWindow
-            ))
-                return;
+        if (!TryGetUIControl<SceneEditWindow.CustomPartsWindow>(
+                    uiRoot, "Window/CustomPartsWindow", out var sceneEditWindow
+                    ))
+            return;
 
-            // Preset application
-            presetCtrl.m_maid = maid;
+        // Preset application
+        presetCtrl.m_maid = maid;
 
-            // Preset saving
-            presetButtonCtrl.m_maid = maid;
+        // Preset saving
+        presetButtonCtrl.m_maid = maid;
 
-            // Maid profile (name, description, experience etc)
-            profileCtrl.m_maidStatus = maid.status;
+        // Maid profile (name, description, experience etc)
+        profileCtrl.m_maidStatus = maid.status;
 
-            // Accessory/Parts placement
-            sceneEditWindow.maid = maid;
+        // Accessory/Parts placement
+        sceneEditWindow.maid = maid;
 
-            // Stopping maid animation and head movement when customizing parts placement
-            sceneEditWindow.animation = maid.GetAnimation();
+        // Stopping maid animation and head movement when customizing parts placement
+        sceneEditWindow.animation = maid.GetAnimation();
 
-            // Clothing/body in general and maybe other things
-            SceneEdit.Instance.m_maid = maid;
+        // Clothing/body in general and maybe other things
+        SceneEdit.Instance.m_maid = maid;
 
-            // Body status, parts colours and maybe more
-            GameMain.Instance.CharacterMgr.m_gcActiveMaid[0] = maid;
+        // Body status, parts colours and maybe more
+        GameMain.Instance.CharacterMgr.m_gcActiveMaid[0] = maid;
 
-            static bool TryGetUIControl<T>(GameObject root, string hierarchy, out T uiControl) where T : MonoBehaviour
-            {
-                uiControl = null;
+        static bool TryGetUIControl<T>(GameObject root, string hierarchy, out T uiControl) where T : MonoBehaviour
+        {
+            uiControl = null;
 
-                var uiElement = UTY.GetChildObjectNoError(root, hierarchy);
+            var uiElement = UTY.GetChildObjectNoError(root, hierarchy);
 
-                if (!uiElement)
-                    return false;
+            if (!uiElement)
+                return false;
 
-                uiControl = uiElement.GetComponent<T>();
+            uiControl = uiElement.GetComponent<T>();
 
-                return uiControl;
-            }
+            return uiControl;
         }
+    }
 
-        [HarmonyPostfix]
-        [HarmonyPatch(typeof(SceneEdit), nameof(SceneEdit.Start))]
-        private static void SceneEditStartPostfix()
-        {
-            EditMaidIndex = -1;
+    [HarmonyPostfix]
+    [HarmonyPatch(typeof(SceneEdit), nameof(SceneEdit.Start))]
+    private static void SceneEditStartPostfix()
+    {
+        EditMaidIndex = -1;
 
-            if (SceneEdit.Instance.maid == null)
-                return;
+        if (SceneEdit.Instance.maid == null)
+            return;
 
-            var originalEditingMaid = SceneEdit.Instance.maid;
+        var originalEditingMaid = SceneEdit.Instance.maid;
 
-            EditMaidIndex = GameMain.Instance.CharacterMgr.GetStockMaidList()
-                .FindIndex(maid => maid.status.guid == originalEditingMaid.status.guid);
+        EditMaidIndex = GameMain.Instance.CharacterMgr.GetStockMaidList()
+            .FindIndex(maid => maid.status.guid == originalEditingMaid.status.guid);
 
-            try
-            {
-                var editOkCancelButton = UTY.GetChildObject(GameObject.Find("UI Root"), "OkCancel")
-                    .GetComponent<EditOkCancel>();
+        try
+        {
+            var editOkCancelButton = UTY.GetChildObject(GameObject.Find("UI Root"), "OkCancel")
+                .GetComponent<EditOkCancel>();
 
-                EditOkCancel.OnClick newEditOkCancelDelegate = RestoreOriginalEditingMaid;
+            EditOkCancel.OnClick newEditOkCancelDelegate = RestoreOriginalEditingMaid;
 
-                newEditOkCancelDelegate += editOkCancelButton.m_dgOnClickOk;
+            newEditOkCancelDelegate += editOkCancelButton.m_dgOnClickOk;
 
-                editOkCancelButton.m_dgOnClickOk = newEditOkCancelDelegate;
+            editOkCancelButton.m_dgOnClickOk = newEditOkCancelDelegate;
 
-                void RestoreOriginalEditingMaid()
-                {
-                    // Only restore original editing maid when active.
-                    if (!active)
-                        return;
+            void RestoreOriginalEditingMaid()
+            {
+                // Only restore original editing maid when active.
+                if (!active)
+                    return;
 
-                    Utility.LogDebug($"Setting Editing maid back to '{originalEditingMaid.status.fullNameJpStyle}'");
+                Utility.LogDebug($"Setting Editing maid back to '{originalEditingMaid.status.fullNameJpStyle}'");
 
-                    SetEditorMaid(originalEditingMaid);
+                SetEditorMaid(originalEditingMaid);
 
-                    // Set SceneEdit's maid regardless of UI integration failing
-                    SceneEdit.Instance.m_maid = originalEditingMaid;
-                }
-            }
-            catch (Exception e)
-            {
-                Utility.LogWarning($"Failed to hook onto Edit Mode OK button: {e}");
+                // Set SceneEdit's maid regardless of UI integration failing
+                SceneEdit.Instance.m_maid = originalEditingMaid;
             }
         }
+        catch (Exception e)
+        {
+            Utility.LogWarning($"Failed to hook onto Edit Mode OK button: {e}");
+        }
+    }
 
-        public MeidoManager() =>
-            Activate();
+    public MeidoManager() =>
+        Activate();
 
-        public void ChangeMaid(int index) =>
-            OnUpdateMeido(null, new MeidoUpdateEventArgs(index));
+    public void ChangeMaid(int index) =>
+        OnUpdateMeido(null, new MeidoUpdateEventArgs(index));
 
-        public void Activate()
-        {
-            characterMgr.ResetCharaPosAll();
+    public void Activate()
+    {
+        characterMgr.ResetCharaPosAll();
 
-            if (!MeidoPhotoStudio.EditMode)
-                characterMgr.DeactivateMaid(0);
+        if (!MeidoPhotoStudio.EditMode)
+            characterMgr.DeactivateMaid(0);
 
-            Meidos = characterMgr.GetStockMaidList()
-                .Select((_, stockNo) => new Meido(stockNo)).ToArray();
+        Meidos = characterMgr.GetStockMaidList()
+            .Select((_, stockNo) => new Meido(stockNo)).ToArray();
 
-            tempEditMaidIndex = -1;
+        tempEditMaidIndex = -1;
 
-            if (MeidoPhotoStudio.EditMode && EditMaidIndex >= 0)
-                Meidos[EditMaidIndex].IsEditMaid = true;
+        if (MeidoPhotoStudio.EditMode && EditMaidIndex >= 0)
+            Meidos[EditMaidIndex].IsEditMaid = true;
 
-            ClearSelectList();
-            active = true;
-        }
+        ClearSelectList();
+        active = true;
+    }
 
-        public void Deactivate()
+    public void Deactivate()
+    {
+        foreach (var meido in Meidos)
         {
-            foreach (var meido in Meidos)
-            {
-                meido.UpdateMeido -= OnUpdateMeido;
-                meido.GravityMove -= OnGravityMove;
-                meido.Deactivate();
-            }
-
-            ActiveMeidoList.Clear();
+            meido.UpdateMeido -= OnUpdateMeido;
+            meido.GravityMove -= OnGravityMove;
+            meido.Deactivate();
+        }
 
-            if (MeidoPhotoStudio.EditMode && !GameMain.Instance.MainCamera.IsFadeOut())
-            {
-                var meido = Meidos[EditMaidIndex];
+        ActiveMeidoList.Clear();
 
-                meido.Maid.Visible = true;
-                meido.Stop = false;
-                meido.EyeToCam = true;
+        if (MeidoPhotoStudio.EditMode && !GameMain.Instance.MainCamera.IsFadeOut())
+        {
+            var meido = Meidos[EditMaidIndex];
 
-                SetEditorMaid(meido.Maid);
-            }
+            meido.Maid.Visible = true;
+            meido.Stop = false;
+            meido.EyeToCam = true;
 
-            active = false;
+            SetEditorMaid(meido.Maid);
         }
 
-        public void Update()
-        {
-            if (InputManager.GetKeyDown(MpsKey.MeidoUndressing))
-                UndressAll();
-        }
+        active = false;
+    }
 
-        public void CallMeidos()
-        {
-            BeginCallMeidos?.Invoke(this, EventArgs.Empty);
+    public void Update()
+    {
+        if (InputManager.GetKeyDown(MpsKey.MeidoUndressing))
+            UndressAll();
+    }
 
-            var moreThanEditMaid = ActiveMeidoList.Count > 1;
+    public void CallMeidos()
+    {
+        BeginCallMeidos?.Invoke(this, EventArgs.Empty);
 
-            UnloadMeidos();
+        var moreThanEditMaid = ActiveMeidoList.Count > 1;
 
-            if (SelectMeidoList.Count == 0)
-            {
-                OnEndCallMeidos(this, EventArgs.Empty);
+        UnloadMeidos();
 
-                return;
-            }
-
-            void callMeidos() =>
-                GameMain.Instance.StartCoroutine(LoadMeidos());
+        if (SelectMeidoList.Count == 0)
+        {
+            OnEndCallMeidos(this, EventArgs.Empty);
 
-            if (MeidoPhotoStudio.EditMode && !moreThanEditMaid && SelectMeidoList.Count == 1)
-                callMeidos();
-            else
-                GameMain.Instance.MainCamera.FadeOut(0.01f, f_bSkipable: false, f_dg: callMeidos);
+            return;
         }
 
-        public void SelectMeido(int index)
+        void callMeidos() =>
+            GameMain.Instance.StartCoroutine(LoadMeidos());
+
+        if (MeidoPhotoStudio.EditMode && !moreThanEditMaid && SelectMeidoList.Count == 1)
+            callMeidos();
+        else
+            GameMain.Instance.MainCamera.FadeOut(0.01f, f_bSkipable: false, f_dg: callMeidos);
+    }
+
+    public void SelectMeido(int index)
+    {
+        if (SelectedMeidoSet.Contains(index))
         {
-            if (SelectedMeidoSet.Contains(index))
-            {
-                if (!MeidoPhotoStudio.EditMode || index != EditMaidIndex)
-                {
-                    SelectedMeidoSet.Remove(index);
-                    SelectMeidoList.Remove(index);
-                }
-            }
-            else
+            if (!MeidoPhotoStudio.EditMode || index != EditMaidIndex)
             {
-                SelectedMeidoSet.Add(index);
-                SelectMeidoList.Add(index);
+                SelectedMeidoSet.Remove(index);
+                SelectMeidoList.Remove(index);
             }
         }
-
-        public void ClearSelectList()
+        else
         {
-            SelectedMeidoSet.Clear();
-            SelectMeidoList.Clear();
-
-            if (MeidoPhotoStudio.EditMode)
-            {
-                SelectedMeidoSet.Add(EditMaidIndex);
-                SelectMeidoList.Add(EditMaidIndex);
-            }
+            SelectedMeidoSet.Add(index);
+            SelectMeidoList.Add(index);
         }
+    }
+
+    public void ClearSelectList()
+    {
+        SelectedMeidoSet.Clear();
+        SelectMeidoList.Clear();
 
-        public void SetEditMaid(Meido meido)
+        if (MeidoPhotoStudio.EditMode)
         {
-            if (!MeidoPhotoStudio.EditMode)
-                return;
+            SelectedMeidoSet.Add(EditMaidIndex);
+            SelectMeidoList.Add(EditMaidIndex);
+        }
+    }
 
-            EditMeido.IsEditMaid = false;
+    public void SetEditMaid(Meido meido)
+    {
+        if (!MeidoPhotoStudio.EditMode)
+            return;
 
-            tempEditMaidIndex = meido.StockNo == EditMaidIndex ? -1 : meido.StockNo;
+        EditMeido.IsEditMaid = false;
 
-            EditMeido.IsEditMaid = true;
+        tempEditMaidIndex = meido.StockNo == EditMaidIndex ? -1 : meido.StockNo;
 
-            SetEditorMaid(EditMeido.Maid);
-        }
+        EditMeido.IsEditMaid = true;
 
-        public Meido GetMeido(string guid) =>
-            string.IsNullOrEmpty(guid) ? null : ActiveMeidoList.Find(meido => meido.Maid.status.guid == guid);
+        SetEditorMaid(EditMeido.Maid);
+    }
 
-        public Meido GetMeido(int activeIndex) =>
-            activeIndex >= 0 && activeIndex < ActiveMeidoList.Count ? ActiveMeidoList[activeIndex] : null;
+    public Meido GetMeido(string guid) =>
+        string.IsNullOrEmpty(guid) ? null : ActiveMeidoList.Find(meido => meido.Maid.status.guid == guid);
 
-        public void PlaceMeidos(string placementType) =>
-            MaidPlacementUtility.ApplyPlacement(placementType, ActiveMeidoList);
+    public Meido GetMeido(int activeIndex) =>
+        activeIndex >= 0 && activeIndex < ActiveMeidoList.Count ? ActiveMeidoList[activeIndex] : null;
 
-        private void UnloadMeidos()
-        {
-            SelectedMeido = 0;
+    public void PlaceMeidos(string placementType) =>
+        MaidPlacementUtility.ApplyPlacement(placementType, ActiveMeidoList);
 
-            var commonMeidoIDs = new HashSet<int>(
-                ActiveMeidoList.Where(meido => SelectedMeidoSet.Contains(meido.StockNo)).Select(meido => meido.StockNo)
-            );
+    private void UnloadMeidos()
+    {
+        SelectedMeido = 0;
 
-            foreach (var meido in ActiveMeidoList)
-            {
-                meido.UpdateMeido -= OnUpdateMeido;
-                meido.GravityMove -= OnGravityMove;
+        var commonMeidoIDs = new HashSet<int>(
+                ActiveMeidoList.Where(meido => SelectedMeidoSet.Contains(meido.StockNo)).Select(meido => meido.StockNo)
+                );
 
-                if (!commonMeidoIDs.Contains(meido.StockNo))
-                    meido.Unload();
-            }
+        foreach (var meido in ActiveMeidoList)
+        {
+            meido.UpdateMeido -= OnUpdateMeido;
+            meido.GravityMove -= OnGravityMove;
 
-            ActiveMeidoList.Clear();
+            if (!commonMeidoIDs.Contains(meido.StockNo))
+                meido.Unload();
         }
 
-        private System.Collections.IEnumerator LoadMeidos()
-        {
-            foreach (var slot in SelectMeidoList)
-                ActiveMeidoList.Add(Meidos[slot]);
-
-            for (var i = 0; i < ActiveMeidoList.Count; i++)
-                ActiveMeidoList[i].Load(i);
+        ActiveMeidoList.Clear();
+    }
 
-            while (Busy)
-                yield return null;
+    private System.Collections.IEnumerator LoadMeidos()
+    {
+        foreach (var slot in SelectMeidoList)
+            ActiveMeidoList.Add(Meidos[slot]);
 
-            yield return new WaitForEndOfFrame();
+        for (var i = 0; i < ActiveMeidoList.Count; i++)
+            ActiveMeidoList[i].Load(i);
 
-            OnEndCallMeidos(this, EventArgs.Empty);
-        }
+        while (Busy)
+            yield return null;
 
-        private void UndressAll()
-        {
-            if (!HasActiveMeido)
-                return;
+        yield return new WaitForEndOfFrame();
 
-            undress = ++undress % Enum.GetNames(typeof(Meido.Mask)).Length;
+        OnEndCallMeidos(this, EventArgs.Empty);
+    }
 
-            foreach (var activeMeido in ActiveMeidoList)
-                activeMeido.SetMaskMode((Meido.Mask)undress);
+    private void UndressAll()
+    {
+        if (!HasActiveMeido)
+            return;
 
-            UpdateMeido?.Invoke(ActiveMeido, new MeidoUpdateEventArgs(SelectedMeido));
-        }
+        undress = ++undress % Enum.GetNames(typeof(Meido.Mask)).Length;
 
-        private void OnUpdateMeido(object sender, MeidoUpdateEventArgs args)
-        {
-            if (!args.IsEmpty)
-                SelectedMeido = args.SelectedMeido;
+        foreach (var activeMeido in ActiveMeidoList)
+            activeMeido.SetMaskMode((Meido.Mask)undress);
 
-            UpdateMeido?.Invoke(ActiveMeido, args);
-        }
+        UpdateMeido?.Invoke(ActiveMeido, new MeidoUpdateEventArgs(SelectedMeido));
+    }
 
-        private void OnEndCallMeidos(object sender, EventArgs args)
-        {
-            GameMain.Instance.MainCamera.FadeIn(1f);
-            EndCallMeidos?.Invoke(this, EventArgs.Empty);
+    private void OnUpdateMeido(object sender, MeidoUpdateEventArgs args)
+    {
+        if (!args.IsEmpty)
+            SelectedMeido = args.SelectedMeido;
 
-            foreach (var meido in ActiveMeidoList)
-            {
-                meido.UpdateMeido += OnUpdateMeido;
-                meido.GravityMove += OnGravityMove;
-            }
+        UpdateMeido?.Invoke(ActiveMeido, args);
+    }
 
-            if (MeidoPhotoStudio.EditMode && tempEditMaidIndex >= 0 && !SelectedMeidoSet.Contains(tempEditMaidIndex))
-                SetEditMaid(Meidos[EditMaidIndex]);
-        }
+    private void OnEndCallMeidos(object sender, EventArgs args)
+    {
+        GameMain.Instance.MainCamera.FadeIn(1f);
+        EndCallMeidos?.Invoke(this, EventArgs.Empty);
 
-        private void OnGravityMove(object sender, GravityEventArgs args)
+        foreach (var meido in ActiveMeidoList)
         {
-            if (!GlobalGravity)
-                return;
-
-            foreach (var meido in ActiveMeidoList)
-                meido.ApplyGravity(args.LocalPosition, args.IsSkirt);
+            meido.UpdateMeido += OnUpdateMeido;
+            meido.GravityMove += OnGravityMove;
         }
+
+        if (MeidoPhotoStudio.EditMode && tempEditMaidIndex >= 0 && !SelectedMeidoSet.Contains(tempEditMaidIndex))
+            SetEditMaid(Meidos[EditMaidIndex]);
     }
 
-    public class MeidoUpdateEventArgs : EventArgs
+    private void OnGravityMove(object sender, GravityEventArgs args)
     {
-        public static new MeidoUpdateEventArgs Empty { get; } = new(-1);
+        if (!GlobalGravity)
+            return;
 
-        public int SelectedMeido { get; }
-        public bool IsBody { get; }
-        public bool FromMeido { get; }
+        foreach (var meido in ActiveMeidoList)
+            meido.ApplyGravity(args.LocalPosition, args.IsSkirt);
+    }
+}
 
-        public bool IsEmpty =>
-            this == Empty || SelectedMeido == -1 && !FromMeido && IsBody;
+public class MeidoUpdateEventArgs : EventArgs
+{
+    public static new MeidoUpdateEventArgs Empty { get; } = new(-1);
 
-        public MeidoUpdateEventArgs(int meidoIndex = -1, bool fromMaid = false, bool isBody = true)
-        {
-            SelectedMeido = meidoIndex;
-            IsBody = isBody;
-            FromMeido = fromMaid;
-        }
+    public int SelectedMeido { get; }
+    public bool IsBody { get; }
+    public bool FromMeido { get; }
+
+    public bool IsEmpty =>
+        this == Empty || SelectedMeido == -1 && !FromMeido && IsBody;
+
+    public MeidoUpdateEventArgs(int meidoIndex = -1, bool fromMaid = false, bool isBody = true)
+    {
+        SelectedMeido = meidoIndex;
+        IsBody = isBody;
+        FromMeido = fromMaid;
     }
 }

+ 99 - 100
src/MeidoPhotoStudio.Plugin/Managers/MessageWindowManager.cs

@@ -1,137 +1,136 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MessageWindowManager : IManager
 {
-    public class MessageWindowManager : IManager
-    {
-        public const string header = "TEXTBOX";
+    public const string header = "TEXTBOX";
 
-        public static readonly SliderProp FontBounds = new(25f, 60f);
+    public static readonly SliderProp FontBounds = new(25f, 60f);
 
-        private readonly MessageWindowMgr messageWindowMgr;
-        private readonly GameObject subtitlesDisplayPanel;
-        private readonly GameObject hitRetSprite;
-        private readonly GameObject messageBox;
-        private readonly GameObject messageButtons;
-        private readonly UILabel messageLabel;
-        private readonly UILabel speakerLabel;
+    private readonly MessageWindowMgr messageWindowMgr;
+    private readonly GameObject subtitlesDisplayPanel;
+    private readonly GameObject hitRetSprite;
+    private readonly GameObject messageBox;
+    private readonly GameObject messageButtons;
+    private readonly UILabel messageLabel;
+    private readonly UILabel speakerLabel;
 
-        public bool ShowingMessage
+    public bool ShowingMessage
+    {
+        get => messageWindowMgr.IsVisibleMessageViewer;
+        private set
         {
-            get => messageWindowMgr.IsVisibleMessageViewer;
-            private set
-            {
-                if (value)
-                    messageWindowMgr.OpenMessageWindowPanel();
-                else
-                    messageWindowMgr.CloseMessageWindowPanel();
-            }
+            if (value)
+                messageWindowMgr.OpenMessageWindowPanel();
+            else
+                messageWindowMgr.CloseMessageWindowPanel();
         }
+    }
 
-        public string MessageName
-        {
-            get => speakerLabel.text;
-            private set => speakerLabel.text = value;
-        }
+    public string MessageName
+    {
+        get => speakerLabel.text;
+        private set => speakerLabel.text = value;
+    }
 
-        public string MessageText
-        {
-            get => messageLabel.text;
-            private set => messageLabel.text = value;
-        }
+    public string MessageText
+    {
+        get => messageLabel.text;
+        private set => messageLabel.text = value;
+    }
 
-        public int FontSize
-        {
-            get => messageLabel.fontSize;
-            set => messageLabel.fontSize = (int)Mathf.Clamp(value, FontBounds.Left, FontBounds.Right);
-        }
+    public int FontSize
+    {
+        get => messageLabel.fontSize;
+        set => messageLabel.fontSize = (int)Mathf.Clamp(value, FontBounds.Left, FontBounds.Right);
+    }
 
-        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()
-        {
-            messageWindowMgr = GameMain.Instance.MsgWnd;
+    public MessageWindowManager()
+    {
+        messageWindowMgr = GameMain.Instance.MsgWnd;
 
-            var messageWindowPanel =
-                Utility.GetFieldValue<MessageWindowMgr, GameObject>(messageWindowMgr, "m_goMessageWindowPanel");
+        var messageWindowPanel =
+            Utility.GetFieldValue<MessageWindowMgr, GameObject>(messageWindowMgr, "m_goMessageWindowPanel");
 
-            var msgParent = UTY.GetChildObject(messageWindowPanel, "MessageViewer/MsgParent");
+        var msgParent = UTY.GetChildObject(messageWindowPanel, "MessageViewer/MsgParent");
 
-            messageButtons = UTY.GetChildObject(msgParent, "Buttons");
-            hitRetSprite = UTY.GetChildObject(msgParent, "Hitret");
-            subtitlesDisplayPanel = UTY.GetChildObject(msgParent, "SubtitlesDisplayPanel");
+        messageButtons = UTY.GetChildObject(msgParent, "Buttons");
+        hitRetSprite = UTY.GetChildObject(msgParent, "Hitret");
+        subtitlesDisplayPanel = UTY.GetChildObject(msgParent, "SubtitlesDisplayPanel");
 
-            messageBox = UTY.GetChildObject(msgParent, "MessageBox");
-            speakerLabel = UTY.GetChildObject(msgParent, "SpeakerName/Name").GetComponent<UILabel>();
-            messageLabel = UTY.GetChildObject(msgParent, "Message").GetComponent<UILabel>();
-        }
+        messageBox = UTY.GetChildObject(msgParent, "MessageBox");
+        speakerLabel = UTY.GetChildObject(msgParent, "SpeakerName/Name").GetComponent<UILabel>();
+        messageLabel = UTY.GetChildObject(msgParent, "Message").GetComponent<UILabel>();
+    }
 
-        public void Update() { }
+    public void Update() { }
 
-        public void Activate()
-        {
-            if (Product.supportMultiLanguage)
-                subtitlesDisplayPanel.SetActive(false);
+    public void Activate()
+    {
+        if (Product.supportMultiLanguage)
+            subtitlesDisplayPanel.SetActive(false);
 
-            ResetMessageBoxProperties();
+        ResetMessageBoxProperties();
 
-            SetMessageBoxActive(true);
+        SetMessageBoxActive(true);
 
-            SetMessageBoxExtrasActive(false);
+        SetMessageBoxExtrasActive(false);
 
-            CloseMessagePanel();
-        }
+        CloseMessagePanel();
+    }
 
-        public void Deactivate()
+    public void Deactivate()
+    {
+        if (Product.supportMultiLanguage)
         {
-            if (Product.supportMultiLanguage)
-            {
-                subtitlesDisplayPanel.SetActive(true);
+            subtitlesDisplayPanel.SetActive(true);
 
-                SetMessageBoxActive(false);
-            }
+            SetMessageBoxActive(false);
+        }
 
-            ResetMessageBoxProperties();
+        ResetMessageBoxProperties();
 
-            SetMessageBoxExtrasActive(true);
+        SetMessageBoxExtrasActive(true);
 
-            CloseMessagePanel();
-        }
+        CloseMessagePanel();
+    }
 
-        public void ShowMessage(string name, string message)
-        {
-            MessageName = name;
-            MessageText = message;
-            ShowingMessage = true;
-        }
+    public void ShowMessage(string name, string message)
+    {
+        MessageName = name;
+        MessageText = message;
+        ShowingMessage = true;
+    }
 
-        public void CloseMessagePanel()
-        {
-            if (!ShowingMessage)
-                return;
+    public void CloseMessagePanel()
+    {
+        if (!ShowingMessage)
+            return;
 
-            ShowingMessage = false;
-        }
+        ShowingMessage = false;
+    }
 
-        private void SetMessageBoxActive(bool active)
-        {
-            messageBox.SetActive(active);
-            messageLabel.gameObject.SetActive(active);
-            speakerLabel.gameObject.SetActive(active);
-        }
+    private void SetMessageBoxActive(bool active)
+    {
+        messageBox.SetActive(active);
+        messageLabel.gameObject.SetActive(active);
+        speakerLabel.gameObject.SetActive(active);
+    }
 
-        private void SetMessageBoxExtrasActive(bool active)
-        {
-            messageButtons.SetActive(active);
-            hitRetSprite.SetActive(active);
-        }
+    private void SetMessageBoxExtrasActive(bool active)
+    {
+        messageButtons.SetActive(active);
+        hitRetSprite.SetActive(active);
+    }
 
-        private void ResetMessageBoxProperties()
-        {
-            FontSize = 25;
-            MessageName = string.Empty;
-            MessageText = string.Empty;
-        }
+    private void ResetMessageBoxProperties()
+    {
+        FontSize = 25;
+        MessageName = string.Empty;
+        MessageText = string.Empty;
     }
 }

+ 253 - 254
src/MeidoPhotoStudio.Plugin/Managers/PropManager.cs

@@ -9,358 +9,357 @@ using static MeidoPhotoStudio.Plugin.ModelUtility;
 
 using Object = UnityEngine.Object;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class PropManager : IManager
 {
-    public class PropManager : IManager
-    {
-        public const string header = "PROP";
+    public const string header = "PROP";
 
-        private static readonly ConfigEntry<bool> modItemsOnly;
+    private static readonly ConfigEntry<bool> modItemsOnly;
 
-        private static bool cubeActive = true;
-        private static Dictionary<string, string> modFileToFullPath;
-        private static bool cubeSmall;
-        private static event EventHandler CubeActiveChange;
-        private static event EventHandler CubeSmallChange;
+    private static bool cubeActive = true;
+    private static Dictionary<string, string> modFileToFullPath;
+    private static bool cubeSmall;
+    private static event EventHandler CubeActiveChange;
+    private static event EventHandler CubeSmallChange;
 
-        public static bool CubeActive
+    public static bool CubeActive
+    {
+        get => cubeActive;
+        set
         {
-            get => cubeActive;
-            set
+            if (value != cubeActive)
             {
-                if (value != cubeActive)
-                {
-                    cubeActive = value;
-                    CubeActiveChange?.Invoke(null, EventArgs.Empty);
-                }
+                cubeActive = value;
+                CubeActiveChange?.Invoke(null, EventArgs.Empty);
             }
         }
+    }
 
-        public static bool CubeSmall
+    public static bool CubeSmall
+    {
+        get => cubeSmall;
+        set
         {
-            get => cubeSmall;
-            set
+            if (value != cubeSmall)
             {
-                if (value != cubeSmall)
-                {
-                    cubeSmall = value;
-                    CubeSmallChange?.Invoke(null, EventArgs.Empty);
-                }
+                cubeSmall = value;
+                CubeSmallChange?.Invoke(null, EventArgs.Empty);
             }
         }
+    }
 
-        private static Dictionary<string, string> ModFileToFullPath
+    private static Dictionary<string, string> ModFileToFullPath
+    {
+        get
         {
-            get
-            {
-                if (modFileToFullPath != null)
-                    return modFileToFullPath;
-
-                var modFiles = Menu.GetModFiles();
+            if (modFileToFullPath != null)
+                return modFileToFullPath;
 
-                modFileToFullPath = new Dictionary<string, string>(modFiles.Length, StringComparer.OrdinalIgnoreCase);
+            var modFiles = Menu.GetModFiles();
 
-                foreach (var mod in modFiles)
-                {
-                    var key = Path.GetFileName(mod);
+            modFileToFullPath = new Dictionary<string, string>(modFiles.Length, StringComparer.OrdinalIgnoreCase);
 
-                    if (!modFileToFullPath.ContainsKey(key))
-                        modFileToFullPath[key] = mod;
-                }
+            foreach (var mod in modFiles)
+            {
+                var key = Path.GetFileName(mod);
 
-                return modFileToFullPath;
+                if (!modFileToFullPath.ContainsKey(key))
+                    modFileToFullPath[key] = mod;
             }
+
+            return modFileToFullPath;
         }
+    }
 
-        public static bool ModItemsOnly =>
-            modItemsOnly.Value;
+    public static bool ModItemsOnly =>
+        modItemsOnly.Value;
 
-        public DragPointProp CurrentProp =>
-            PropCount == 0 ? null : propList[CurrentPropIndex];
+    public DragPointProp CurrentProp =>
+        PropCount == 0 ? null : propList[CurrentPropIndex];
 
-        private readonly List<DragPointProp> propList = new();
-        private readonly MeidoManager meidoManager;
+    private readonly List<DragPointProp> propList = new();
+    private readonly MeidoManager meidoManager;
 
-        public event EventHandler PropSelectionChange;
-        public event EventHandler FromPropSelect;
-        public event EventHandler PropListChange;
+    public event EventHandler PropSelectionChange;
+    public event EventHandler FromPropSelect;
+    public event EventHandler PropListChange;
 
-        private int currentPropIndex;
+    private int currentPropIndex;
 
-        public string[] PropNameList =>
-            propList.Count == 0
-            ? new[] { Translation.Get("systemMessage", "noProps") }
-            : propList.Select(prop => prop.Name).ToArray();
+    public string[] PropNameList =>
+        propList.Count == 0
+        ? new[] { Translation.Get("systemMessage", "noProps") }
+    : propList.Select(prop => prop.Name).ToArray();
 
-        public int PropCount =>
-            propList.Count;
+    public int PropCount =>
+        propList.Count;
 
-        public int CurrentPropIndex
+    public int CurrentPropIndex
+    {
+        get => currentPropIndex;
+        set
         {
-            get => currentPropIndex;
-            set
+            if (PropCount == 0)
             {
-                if (PropCount == 0)
-                {
-                    currentPropIndex = 0;
-                    return;
-                }
+                currentPropIndex = 0;
+                return;
+            }
 
-                if ((uint)value >= (uint)PropCount)
-                    throw new ArgumentOutOfRangeException(nameof(value));
+            if ((uint)value >= (uint)PropCount)
+                throw new ArgumentOutOfRangeException(nameof(value));
 
-                if (currentPropIndex == value)
-                    return;
+            if (currentPropIndex == value)
+                return;
 
-                currentPropIndex = value;
-                PropSelectionChange?.Invoke(this, EventArgs.Empty);
-            }
+            currentPropIndex = value;
+            PropSelectionChange?.Invoke(this, EventArgs.Empty);
         }
+    }
 
-        static PropManager() =>
-            modItemsOnly = Configuration.Config.Bind(
-            "Prop", "ModItemsOnly",
-            false,
-            "Disable waiting for and loading base game clothing"
-        );
+    static PropManager() =>
+        modItemsOnly = Configuration.Config.Bind(
+                "Prop", "ModItemsOnly",
+                false,
+                "Disable waiting for and loading base game clothing"
+                );
 
-        public PropManager(MeidoManager meidoManager)
-        {
-            this.meidoManager = meidoManager;
-            meidoManager.BeginCallMeidos += OnBeginCallMeidos;
-            meidoManager.EndCallMeidos += OnEndCallMeidos;
-            Activate();
-        }
+    public PropManager(MeidoManager meidoManager)
+    {
+        this.meidoManager = meidoManager;
+        meidoManager.BeginCallMeidos += OnBeginCallMeidos;
+        meidoManager.EndCallMeidos += OnEndCallMeidos;
+        Activate();
+    }
 
-        public bool AddFromPropInfo(PropInfo propInfo)
+    public bool AddFromPropInfo(PropInfo propInfo)
+    {
+        switch (propInfo.Type)
         {
-            switch (propInfo.Type)
-            {
-                case PropInfo.PropType.Mod:
-                    ModItem modItem;
-
-                    if (!string.IsNullOrEmpty(propInfo.SubFilename))
-                    {
-                        modItem = ModItem.OfficialMod(ModFileToFullPath[propInfo.Filename]);
-                        modItem.BaseMenuFile = propInfo.SubFilename;
-                    }
-                    else
-                        modItem = ModItem.Mod(propInfo.Filename);
-
-                    return AddModProp(modItem);
-                case PropInfo.PropType.MyRoom:
-                    return AddMyRoomProp(new MyRoomItem { ID = propInfo.MyRoomID, PrefabName = propInfo.Filename });
-                case PropInfo.PropType.Bg:
-                    return AddBgProp(propInfo.Filename);
-                case PropInfo.PropType.Odogu:
-                    return AddGameProp(propInfo.Filename);
-                default: throw new ArgumentOutOfRangeException();
-            }
+            case PropInfo.PropType.Mod:
+                ModItem modItem;
+
+                if (!string.IsNullOrEmpty(propInfo.SubFilename))
+                {
+                    modItem = ModItem.OfficialMod(ModFileToFullPath[propInfo.Filename]);
+                    modItem.BaseMenuFile = propInfo.SubFilename;
+                }
+                else
+                    modItem = ModItem.Mod(propInfo.Filename);
+
+                return AddModProp(modItem);
+            case PropInfo.PropType.MyRoom:
+                return AddMyRoomProp(new MyRoomItem { ID = propInfo.MyRoomID, PrefabName = propInfo.Filename });
+            case PropInfo.PropType.Bg:
+                return AddBgProp(propInfo.Filename);
+            case PropInfo.PropType.Odogu:
+                return AddGameProp(propInfo.Filename);
+            default: throw new ArgumentOutOfRangeException();
         }
+    }
 
-        public bool AddModProp(ModItem modItem)
-        {
-            var model = LoadMenuModel(modItem);
+    public bool AddModProp(ModItem modItem)
+    {
+        var model = LoadMenuModel(modItem);
 
-            if (!model)
-                return false;
+        if (!model)
+            return false;
 
-            var name = modItem.MenuFile;
+        var name = modItem.MenuFile;
 
-            if (modItem.IsOfficialMod)
-                name = Path.GetFileName(name) + ".menu"; // add '.menu' for partsedit support
+        if (modItem.IsOfficialMod)
+            name = Path.GetFileName(name) + ".menu"; // add '.menu' for partsedit support
 
-            model.name = name;
+        model.name = name;
 
-            var dragPoint = AttachDragPoint(model);
+        var dragPoint = AttachDragPoint(model);
 
-            dragPoint.Info = PropInfo.FromModItem(modItem);
+        dragPoint.Info = PropInfo.FromModItem(modItem);
 
-            AddProp(dragPoint);
+        AddProp(dragPoint);
 
-            return true;
-        }
+        return true;
+    }
 
-        public bool AddMyRoomProp(MyRoomItem myRoomItem)
-        {
-            var model = LoadMyRoomModel(myRoomItem);
+    public bool AddMyRoomProp(MyRoomItem myRoomItem)
+    {
+        var model = LoadMyRoomModel(myRoomItem);
 
-            if (!model)
-                return false;
+        if (!model)
+            return false;
 
-            model.name = Translation.Get("myRoomPropNames", myRoomItem.PrefabName);
+        model.name = Translation.Get("myRoomPropNames", myRoomItem.PrefabName);
 
-            var dragPoint = AttachDragPoint(model);
+        var dragPoint = AttachDragPoint(model);
 
-            dragPoint.Info = PropInfo.FromMyRoom(myRoomItem);
+        dragPoint.Info = PropInfo.FromMyRoom(myRoomItem);
 
-            AddProp(dragPoint);
+        AddProp(dragPoint);
 
-            return true;
-        }
+        return true;
+    }
 
-        public bool AddBgProp(string assetName)
-        {
-            var model = LoadBgModel(assetName);
+    public bool AddBgProp(string assetName)
+    {
+        var model = LoadBgModel(assetName);
 
-            if (!model)
-                return false;
+        if (!model)
+            return false;
 
-            model.name = Translation.Get("bgNames", assetName);
+        model.name = Translation.Get("bgNames", assetName);
 
-            var dragPoint = AttachDragPoint(model);
+        var dragPoint = AttachDragPoint(model);
 
-            dragPoint.Info = PropInfo.FromBg(assetName);
+        dragPoint.Info = PropInfo.FromBg(assetName);
 
-            AddProp(dragPoint);
+        AddProp(dragPoint);
 
-            return true;
-        }
+        return true;
+    }
 
-        public bool AddGameProp(string assetName)
-        {
-            var isMenu = assetName.EndsWith(".menu");
-            var model = isMenu ? LoadMenuModel(assetName) : LoadGameModel(assetName);
+    public bool AddGameProp(string assetName)
+    {
+        var isMenu = assetName.EndsWith(".menu");
+        var model = isMenu ? LoadMenuModel(assetName) : LoadGameModel(assetName);
 
-            if (!model)
-                return false;
+        if (!model)
+            return false;
 
-            model.name = Translation.Get("propNames", isMenu ? Utility.HandItemToOdogu(assetName) : assetName, !isMenu);
+        model.name = Translation.Get("propNames", isMenu ? Utility.HandItemToOdogu(assetName) : assetName, !isMenu);
 
-            var dragPoint = AttachDragPoint(model);
+        var dragPoint = AttachDragPoint(model);
 
-            dragPoint.Info = PropInfo.FromGameProp(assetName);
+        dragPoint.Info = PropInfo.FromGameProp(assetName);
 
-            AddProp(dragPoint);
+        AddProp(dragPoint);
 
-            return true;
-        }
+        return true;
+    }
 
-        public void CopyProp(int propIndex)
-        {
-            if ((uint)propIndex >= (uint)PropCount)
-                throw new ArgumentOutOfRangeException(nameof(propIndex));
+    public void CopyProp(int propIndex)
+    {
+        if ((uint)propIndex >= (uint)PropCount)
+            throw new ArgumentOutOfRangeException(nameof(propIndex));
 
-            AddFromPropInfo(propList[propIndex].Info);
-        }
+        AddFromPropInfo(propList[propIndex].Info);
+    }
 
-        public void DeleteAllProps()
-        {
-            foreach (var prop in propList)
-                DestroyProp(prop);
+    public void DeleteAllProps()
+    {
+        foreach (var prop in propList)
+            DestroyProp(prop);
 
-            propList.Clear();
-            CurrentPropIndex = 0;
+        propList.Clear();
+        CurrentPropIndex = 0;
 
-            EmitPropListChange();
-        }
+        EmitPropListChange();
+    }
 
-        public void RemoveProp(int index)
-        {
-            if ((uint)index >= (uint)PropCount)
-                throw new ArgumentOutOfRangeException(nameof(index));
+    public void RemoveProp(int index)
+    {
+        if ((uint)index >= (uint)PropCount)
+            throw new ArgumentOutOfRangeException(nameof(index));
 
-            DestroyProp(propList[index]);
-            propList.RemoveAt(index);
-            CurrentPropIndex = Utility.Bound(CurrentPropIndex, 0, PropCount - 1);
-            EmitPropListChange();
-        }
+        DestroyProp(propList[index]);
+        propList.RemoveAt(index);
+        CurrentPropIndex = Utility.Bound(CurrentPropIndex, 0, PropCount - 1);
+        EmitPropListChange();
+    }
 
-        public void AttachProp(DragPointProp prop, AttachPoint point, int index)
-        {
-            if ((uint)index >= (uint)meidoManager.ActiveMeidoList.Count)
-                return;
+    public void AttachProp(DragPointProp prop, AttachPoint point, int index)
+    {
+        if ((uint)index >= (uint)meidoManager.ActiveMeidoList.Count)
+            return;
 
-            var meido = meidoManager.ActiveMeidoList[index];
+        var meido = meidoManager.ActiveMeidoList[index];
 
-            prop.AttachTo(meido, point);
-        }
+        prop.AttachTo(meido, point);
+    }
 
-        public void Update() { }
+    public void Update() { }
 
-        public void Activate()
-        {
-            CubeSmallChange += OnCubeSmall;
-            CubeActiveChange += OnCubeActive;
-        }
+    public void Activate()
+    {
+        CubeSmallChange += OnCubeSmall;
+        CubeActiveChange += OnCubeActive;
+    }
 
-        public void Deactivate()
-        {
-            DeleteAllProps();
-            CubeSmallChange -= OnCubeSmall;
-            CubeActiveChange -= OnCubeActive;
-        }
+    public void Deactivate()
+    {
+        DeleteAllProps();
+        CubeSmallChange -= OnCubeSmall;
+        CubeActiveChange -= OnCubeActive;
+    }
 
-        private DragPointProp AttachDragPoint(GameObject model)
-        {
-            var dragPoint = DragPoint.Make<DragPointProp>(PrimitiveType.Cube, Vector3.one * 0.12f);
+    private DragPointProp AttachDragPoint(GameObject model)
+    {
+        var dragPoint = DragPoint.Make<DragPointProp>(PrimitiveType.Cube, Vector3.one * 0.12f);
 
-            dragPoint.Initialize(() => model.transform.position, () => Vector3.zero);
-            dragPoint.Set(model.transform);
-            dragPoint.AddGizmo(0.45f, CustomGizmo.GizmoMode.World);
-            dragPoint.ConstantScale = true;
-            dragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
-            dragPoint.Delete += OnDeleteProp;
-            dragPoint.Select += OnSelectProp;
+        dragPoint.Initialize(() => model.transform.position, () => Vector3.zero);
+        dragPoint.Set(model.transform);
+        dragPoint.AddGizmo(0.45f, CustomGizmo.GizmoMode.World);
+        dragPoint.ConstantScale = true;
+        dragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
+        dragPoint.Delete += OnDeleteProp;
+        dragPoint.Select += OnSelectProp;
 
-            return dragPoint;
-        }
+        return dragPoint;
+    }
 
-        private void AddProp(DragPointProp dragPoint)
-        {
-            propList.Add(dragPoint);
-            EmitPropListChange();
-        }
+    private void AddProp(DragPointProp dragPoint)
+    {
+        propList.Add(dragPoint);
+        EmitPropListChange();
+    }
 
-        private void DestroyProp(DragPointProp prop)
-        {
-            if (!prop)
-                return;
+    private void DestroyProp(DragPointProp prop)
+    {
+        if (!prop)
+            return;
 
-            prop.Delete -= OnDeleteProp;
-            prop.Select -= OnSelectProp;
-            Object.Destroy(prop.gameObject);
-        }
+        prop.Delete -= OnDeleteProp;
+        prop.Select -= OnSelectProp;
+        Object.Destroy(prop.gameObject);
+    }
 
-        private void EmitPropListChange() =>
-            PropListChange?.Invoke(this, EventArgs.Empty);
+    private void EmitPropListChange() =>
+        PropListChange?.Invoke(this, EventArgs.Empty);
 
-        private void OnBeginCallMeidos(object sender, EventArgs args)
-        {
-            foreach (var prop in propList.Where(p => p.AttachPointInfo.AttachPoint != AttachPoint.None))
-                prop.DetachTemporary();
-        }
+    private void OnBeginCallMeidos(object sender, EventArgs args)
+    {
+        foreach (var prop in propList.Where(p => p.AttachPointInfo.AttachPoint != AttachPoint.None))
+            prop.DetachTemporary();
+    }
 
-        private void OnEndCallMeidos(object sender, EventArgs args)
+    private void OnEndCallMeidos(object sender, EventArgs args)
+    {
+        foreach (var prop in propList.Where(p => p.AttachPointInfo.AttachPoint != AttachPoint.None))
         {
-            foreach (var prop in propList.Where(p => p.AttachPointInfo.AttachPoint != AttachPoint.None))
-            {
-                var info = prop.AttachPointInfo;
-                var meido = meidoManager.GetMeido(info.MaidGuid);
+            var info = prop.AttachPointInfo;
+            var meido = meidoManager.GetMeido(info.MaidGuid);
 
-                prop.AttachTo(meido, info.AttachPoint, meido == null);
-            }
+            prop.AttachTo(meido, info.AttachPoint, meido == null);
         }
+    }
 
-        private void OnDeleteProp(object sender, EventArgs args) =>
-            RemoveProp(propList.IndexOf((DragPointProp)sender));
+    private void OnDeleteProp(object sender, EventArgs args) =>
+        RemoveProp(propList.IndexOf((DragPointProp)sender));
 
-        private void OnSelectProp(object sender, EventArgs args)
-        {
-            CurrentPropIndex = propList.IndexOf((DragPointProp)sender);
-            FromPropSelect?.Invoke(this, EventArgs.Empty);
-        }
+    private void OnSelectProp(object sender, EventArgs args)
+    {
+        CurrentPropIndex = propList.IndexOf((DragPointProp)sender);
+        FromPropSelect?.Invoke(this, EventArgs.Empty);
+    }
 
-        private void OnCubeSmall(object sender, EventArgs args)
-        {
-            foreach (var dragPoint in propList)
-                dragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
-        }
+    private void OnCubeSmall(object sender, EventArgs args)
+    {
+        foreach (var dragPoint in propList)
+            dragPoint.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
+    }
 
-        private void OnCubeActive(object sender, EventArgs args)
-        {
-            foreach (var dragPoint in propList)
-                dragPoint.gameObject.SetActive(CubeActive);
-        }
+    private void OnCubeActive(object sender, EventArgs args)
+    {
+        foreach (var dragPoint in propList)
+            dragPoint.gameObject.SetActive(CubeActive);
     }
 }

+ 254 - 255
src/MeidoPhotoStudio.Plugin/Managers/SceneManager.cs

@@ -7,364 +7,363 @@ using UnityEngine;
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 using Object = UnityEngine.Object;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SceneManager : IManager
 {
-    public class SceneManager : IManager
-    {
-        public enum SortMode { Name, DateCreated, DateModified }
+    public enum SortMode { Name, DateCreated, DateModified }
 
-        public static readonly Vector2 sceneDimensions = new(480, 270);
+    public static readonly Vector2 sceneDimensions = new(480, 270);
 
-        private static readonly ConfigEntry<bool> sortDescending;
-        private static readonly ConfigEntry<SortMode> currentSortMode;
+    private static readonly ConfigEntry<bool> sortDescending;
+    private static readonly ConfigEntry<SortMode> currentSortMode;
 
-        private static byte[] tempSceneData;
+    private static byte[] tempSceneData;
 
-        public static bool Busy { get; private set; }
+    public static bool Busy { get; private set; }
 
-        private static string TempScenePath =>
-            Path.Combine(Constants.configPath, "mpstempscene");
+    private static string TempScenePath =>
+        Path.Combine(Constants.configPath, "mpstempscene");
 
-        private readonly MeidoPhotoStudio meidoPhotoStudio;
+    private readonly MeidoPhotoStudio meidoPhotoStudio;
 
-        public bool Initialized { get; private set; }
-        public bool KankyoMode { get; set; }
-        public int CurrentSceneIndex { get; private set; } = -1;
-        public List<MPSScene> SceneList { get; } = new();
-        public int CurrentDirectoryIndex { get; private set; } = -1;
+    public bool Initialized { get; private set; }
+    public bool KankyoMode { get; set; }
+    public int CurrentSceneIndex { get; private set; } = -1;
+    public List<MPSScene> SceneList { get; } = new();
+    public int CurrentDirectoryIndex { get; private set; } = -1;
 
-        public bool SortDescending
-        {
-            get => sortDescending.Value;
-            set => sortDescending.Value = value;
-        }
+    public bool SortDescending
+    {
+        get => sortDescending.Value;
+        set => sortDescending.Value = value;
+    }
 
-        public string CurrentDirectoryName =>
-            CurrentDirectoryList[CurrentDirectoryIndex];
+    public string CurrentDirectoryName =>
+        CurrentDirectoryList[CurrentDirectoryIndex];
 
-        public List<string> CurrentDirectoryList =>
-            KankyoMode ? Constants.KankyoDirectoryList : Constants.SceneDirectoryList;
+    public List<string> CurrentDirectoryList =>
+        KankyoMode ? Constants.KankyoDirectoryList : Constants.SceneDirectoryList;
 
-        public string CurrentBasePath =>
-            KankyoMode ? Constants.kankyoPath : Constants.scenesPath;
+    public string CurrentBasePath =>
+        KankyoMode ? Constants.kankyoPath : Constants.scenesPath;
 
-        public string CurrentScenesDirectory =>
-            CurrentDirectoryIndex == 0 ? CurrentBasePath : Path.Combine(CurrentBasePath, CurrentDirectoryName);
+    public string CurrentScenesDirectory =>
+        CurrentDirectoryIndex == 0 ? CurrentBasePath : Path.Combine(CurrentBasePath, CurrentDirectoryName);
 
-        public SortMode CurrentSortMode
-        {
-            get => currentSortMode.Value;
-            private set => currentSortMode.Value = value;
-        }
+    public SortMode CurrentSortMode
+    {
+        get => currentSortMode.Value;
+        private set => currentSortMode.Value = value;
+    }
 
-        public MPSScene CurrentScene =>
-            SceneList.Count == 0 ? null : SceneList[CurrentSceneIndex];
+    public MPSScene CurrentScene =>
+        SceneList.Count == 0 ? null : SceneList[CurrentSceneIndex];
 
-        private int SortDirection =>
-            SortDescending ? -1 : 1;
+    private int SortDirection =>
+        SortDescending ? -1 : 1;
 
-        static SceneManager()
-        {
-            sortDescending = Configuration.Config.Bind(
+    static SceneManager()
+    {
+        sortDescending = Configuration.Config.Bind(
                 "SceneManager", "SortDescending",
                 false,
                 "Sort scenes descending (Z-A)"
-            );
+                );
 
-            currentSortMode = Configuration.Config.Bind(
+        currentSortMode = Configuration.Config.Bind(
                 "SceneManager", "SortMode",
                 SortMode.Name,
                 "Scene sorting mode"
-            );
+                );
 
-            Input.Register(MpsKey.OpenSceneManager, KeyCode.F8, "Hide/show scene manager");
-            Input.Register(MpsKey.SaveScene, KeyCode.S, "Quick save scene");
-            Input.Register(MpsKey.LoadScene, KeyCode.A, "Load quick saved scene");
-        }
+        Input.Register(MpsKey.OpenSceneManager, KeyCode.F8, "Hide/show scene manager");
+        Input.Register(MpsKey.SaveScene, KeyCode.S, "Quick save scene");
+        Input.Register(MpsKey.LoadScene, KeyCode.A, "Load quick saved scene");
+    }
 
-        public SceneManager(MeidoPhotoStudio meidoPhotoStudio)
-        {
-            this.meidoPhotoStudio = meidoPhotoStudio;
-            Activate();
-        }
+    public SceneManager(MeidoPhotoStudio meidoPhotoStudio)
+    {
+        this.meidoPhotoStudio = meidoPhotoStudio;
+        Activate();
+    }
 
-        public void Activate() { }
+    public void Activate() { }
 
-        public void Initialize()
+    public void Initialize()
+    {
+        if (!Initialized)
         {
-            if (!Initialized)
-            {
-                Initialized = true;
-                SelectDirectory(0);
-            }
+            Initialized = true;
+            SelectDirectory(0);
         }
+    }
 
-        public void Deactivate() => ClearSceneList();
+    public void Deactivate() => ClearSceneList();
 
-        public void Update()
-        {
-            if (!Input.Control)
-                return;
+    public void Update()
+    {
+        if (!Input.Control)
+            return;
 
-            if (Input.GetKeyDown(MpsKey.SaveScene))
-                QuickSaveScene();
-            else if (Input.GetKeyDown(MpsKey.LoadScene))
-                QuickLoadScene();
-        }
+        if (Input.GetKeyDown(MpsKey.SaveScene))
+            QuickSaveScene();
+        else if (Input.GetKeyDown(MpsKey.LoadScene))
+            QuickLoadScene();
+    }
 
-        public void DeleteDirectory()
-        {
-            if (Directory.Exists(CurrentScenesDirectory))
-                Directory.Delete(CurrentScenesDirectory, true);
+    public void DeleteDirectory()
+    {
+        if (Directory.Exists(CurrentScenesDirectory))
+            Directory.Delete(CurrentScenesDirectory, true);
 
-            CurrentDirectoryList.RemoveAt(CurrentDirectoryIndex);
-            CurrentDirectoryIndex = Mathf.Clamp(CurrentDirectoryIndex, 0, CurrentDirectoryList.Count - 1);
-            UpdateSceneList();
-        }
+        CurrentDirectoryList.RemoveAt(CurrentDirectoryIndex);
+        CurrentDirectoryIndex = Mathf.Clamp(CurrentDirectoryIndex, 0, CurrentDirectoryList.Count - 1);
+        UpdateSceneList();
+    }
 
-        public void OverwriteScene() =>
-            SaveScene(overwrite: true);
+    public void OverwriteScene() =>
+        SaveScene(overwrite: true);
 
-        public void ToggleKankyoMode()
-        {
-            KankyoMode = !KankyoMode;
-            CurrentDirectoryIndex = 0;
-            UpdateSceneList();
-        }
+    public void ToggleKankyoMode()
+    {
+        KankyoMode = !KankyoMode;
+        CurrentDirectoryIndex = 0;
+        UpdateSceneList();
+    }
 
-        public void SaveScene(bool overwrite = false)
-        {
-            if (Busy)
-                return;
+    public void SaveScene(bool overwrite = false)
+    {
+        if (Busy)
+            return;
 
-            Busy = true;
+        Busy = true;
 
-            if (!Directory.Exists(CurrentScenesDirectory))
-                Directory.CreateDirectory(CurrentScenesDirectory);
+        if (!Directory.Exists(CurrentScenesDirectory))
+            Directory.CreateDirectory(CurrentScenesDirectory);
 
-            MeidoPhotoStudio.NotifyRawScreenshot += SaveScene;
+        MeidoPhotoStudio.NotifyRawScreenshot += SaveScene;
 
-            MeidoPhotoStudio.TakeScreenshot(new ScreenshotEventArgs() { InMemory = true });
+        MeidoPhotoStudio.TakeScreenshot(new ScreenshotEventArgs() { InMemory = true });
 
-            void SaveScene(object sender, ScreenshotEventArgs args)
-            {
-                MeidoPhotoStudio.NotifyRawScreenshot -= SaveScene;
-                SaveSceneToFile(args.Screenshot, overwrite);
-            }
+        void SaveScene(object sender, ScreenshotEventArgs args)
+        {
+            MeidoPhotoStudio.NotifyRawScreenshot -= SaveScene;
+            SaveSceneToFile(args.Screenshot, overwrite);
         }
+    }
 
-        public void SelectDirectory(int directoryIndex)
-        {
-            directoryIndex = Mathf.Clamp(directoryIndex, 0, CurrentDirectoryList.Count - 1);
+    public void SelectDirectory(int directoryIndex)
+    {
+        directoryIndex = Mathf.Clamp(directoryIndex, 0, CurrentDirectoryList.Count - 1);
 
-            if (directoryIndex == CurrentDirectoryIndex)
-                return;
+        if (directoryIndex == CurrentDirectoryIndex)
+            return;
 
-            CurrentDirectoryIndex = directoryIndex;
+        CurrentDirectoryIndex = directoryIndex;
 
-            UpdateSceneList();
-        }
+        UpdateSceneList();
+    }
 
-        public void SelectScene(int sceneIndex)
-        {
-            CurrentSceneIndex = Mathf.Clamp(sceneIndex, 0, SceneList.Count - 1);
-            CurrentScene.Preload();
-        }
+    public void SelectScene(int sceneIndex)
+    {
+        CurrentSceneIndex = Mathf.Clamp(sceneIndex, 0, SceneList.Count - 1);
+        CurrentScene.Preload();
+    }
 
-        public void AddDirectory(string directoryName)
-        {
-            directoryName = Utility.SanitizePathPortion(directoryName);
+    public void AddDirectory(string directoryName)
+    {
+        directoryName = Utility.SanitizePathPortion(directoryName);
 
-            if (CurrentDirectoryList.Contains(directoryName, StringComparer.InvariantCultureIgnoreCase))
-                return;
+        if (CurrentDirectoryList.Contains(directoryName, StringComparer.InvariantCultureIgnoreCase))
+            return;
 
-            var finalPath = Path.Combine(CurrentBasePath, directoryName);
-            var fullPath = Path.GetFullPath(finalPath);
+        var finalPath = Path.Combine(CurrentBasePath, directoryName);
+        var fullPath = Path.GetFullPath(finalPath);
 
-            if (!fullPath.StartsWith(CurrentBasePath))
-            {
-                var baseDirectoryName = KankyoMode ? Constants.kankyoDirectory : Constants.sceneDirectory;
+        if (!fullPath.StartsWith(CurrentBasePath))
+        {
+            var baseDirectoryName = KankyoMode ? Constants.kankyoDirectory : Constants.sceneDirectory;
 
-                Utility.LogError($"Could not add directory to {baseDirectoryName}. Path is invalid: '{fullPath}'");
+            Utility.LogError($"Could not add directory to {baseDirectoryName}. Path is invalid: '{fullPath}'");
 
-                return;
-            }
+            return;
+        }
 
-            CurrentDirectoryList.Add(directoryName);
-            Directory.CreateDirectory(finalPath);
+        CurrentDirectoryList.Add(directoryName);
+        Directory.CreateDirectory(finalPath);
 
-            UpdateDirectoryList();
-            CurrentDirectoryIndex = CurrentDirectoryList.IndexOf(directoryName);
+        UpdateDirectoryList();
+        CurrentDirectoryIndex = CurrentDirectoryList.IndexOf(directoryName);
 
-            UpdateSceneList();
-        }
+        UpdateSceneList();
+    }
 
-        public void Refresh()
-        {
-            if (!Directory.Exists(CurrentScenesDirectory))
-                CurrentDirectoryIndex = 0;
+    public void Refresh()
+    {
+        if (!Directory.Exists(CurrentScenesDirectory))
+            CurrentDirectoryIndex = 0;
 
-            if (KankyoMode)
-                Constants.InitializeKankyoDirectories();
-            else
-                Constants.InitializeSceneDirectories();
+        if (KankyoMode)
+            Constants.InitializeKankyoDirectories();
+        else
+            Constants.InitializeSceneDirectories();
 
-            UpdateSceneList();
-        }
+        UpdateSceneList();
+    }
 
-        public void SortScenes(SortMode sortMode)
-        {
-            CurrentSortMode = sortMode;
+    public void SortScenes(SortMode sortMode)
+    {
+        CurrentSortMode = sortMode;
 
-            Comparison<MPSScene> comparator = CurrentSortMode switch
-            {
-                SortMode.DateModified => SortByDateModified,
-                SortMode.DateCreated => SortByDateCreated,
-                SortMode.Name => SortByName,
-                _ => SortByName,
-            };
+        Comparison<MPSScene> comparator = CurrentSortMode switch
+        {
+            SortMode.DateModified => SortByDateModified,
+            SortMode.DateCreated => SortByDateCreated,
+            SortMode.Name => SortByName,
+            _ => SortByName,
+        };
 
-            SceneList.Sort(comparator);
-        }
+        SceneList.Sort(comparator);
+    }
 
-        public void DeleteScene()
-        {
-            if (CurrentScene.FileInfo.Exists)
-                CurrentScene.FileInfo.Delete();
+    public void DeleteScene()
+    {
+        if (CurrentScene.FileInfo.Exists)
+            CurrentScene.FileInfo.Delete();
 
-            SceneList.RemoveAt(CurrentSceneIndex);
-            CurrentSceneIndex = Mathf.Clamp(CurrentSceneIndex, 0, SceneList.Count - 1);
-        }
+        SceneList.RemoveAt(CurrentSceneIndex);
+        CurrentSceneIndex = Mathf.Clamp(CurrentSceneIndex, 0, SceneList.Count - 1);
+    }
 
-        public void LoadScene(MPSScene scene) =>
-            meidoPhotoStudio.LoadScene(scene.Data);
+    public void LoadScene(MPSScene scene) =>
+        meidoPhotoStudio.LoadScene(scene.Data);
 
-        private int SortByName(MPSScene a, MPSScene b) =>
-            SortDirection * WindowsLogicalComparer.StrCmpLogicalW(a.FileInfo.Name, b.FileInfo.Name);
+    private int SortByName(MPSScene a, MPSScene b) =>
+        SortDirection * WindowsLogicalComparer.StrCmpLogicalW(a.FileInfo.Name, b.FileInfo.Name);
 
-        private int SortByDateCreated(MPSScene a, MPSScene b) =>
-            SortDirection * DateTime.Compare(a.FileInfo.CreationTime, b.FileInfo.CreationTime);
+    private int SortByDateCreated(MPSScene a, MPSScene b) =>
+        SortDirection * DateTime.Compare(a.FileInfo.CreationTime, b.FileInfo.CreationTime);
 
-        private int SortByDateModified(MPSScene a, MPSScene b) =>
-            SortDirection * DateTime.Compare(a.FileInfo.LastWriteTime, b.FileInfo.LastWriteTime);
+    private int SortByDateModified(MPSScene a, MPSScene b) =>
+        SortDirection * DateTime.Compare(a.FileInfo.LastWriteTime, b.FileInfo.LastWriteTime);
 
-        private void UpdateSceneList()
-        {
-            ClearSceneList();
+    private void UpdateSceneList()
+    {
+        ClearSceneList();
 
-            if (!Directory.Exists(CurrentScenesDirectory))
-                Directory.CreateDirectory(CurrentScenesDirectory);
+        if (!Directory.Exists(CurrentScenesDirectory))
+            Directory.CreateDirectory(CurrentScenesDirectory);
 
-            foreach (var filename in Directory.GetFiles(CurrentScenesDirectory))
-                if (Path.GetExtension(filename) == ".png")
-                    SceneList.Add(new(filename));
+        foreach (var filename in Directory.GetFiles(CurrentScenesDirectory))
+            if (Path.GetExtension(filename) == ".png")
+                SceneList.Add(new(filename));
 
-            SortScenes(CurrentSortMode);
+        SortScenes(CurrentSortMode);
 
-            CurrentSceneIndex = Mathf.Clamp(CurrentSceneIndex, 0, SceneList.Count - 1);
-        }
+        CurrentSceneIndex = Mathf.Clamp(CurrentSceneIndex, 0, SceneList.Count - 1);
+    }
 
-        private void UpdateDirectoryList()
-        {
-            var baseDirectoryName = KankyoMode ? Constants.kankyoDirectory : Constants.sceneDirectory;
+    private void UpdateDirectoryList()
+    {
+        var baseDirectoryName = KankyoMode ? Constants.kankyoDirectory : Constants.sceneDirectory;
 
-            CurrentDirectoryList.Sort((a, b) =>
+        CurrentDirectoryList.Sort((a, b) =>
                 a.Equals(baseDirectoryName, StringComparison.InvariantCultureIgnoreCase)
-                    ? -1
-                    : WindowsLogicalComparer.StrCmpLogicalW(a, b));
-        }
+                ? -1
+                : WindowsLogicalComparer.StrCmpLogicalW(a, b));
+    }
 
-        private void ClearSceneList()
-        {
-            foreach (var scene in SceneList)
-                scene.Destroy();
+    private void ClearSceneList()
+    {
+        foreach (var scene in SceneList)
+            scene.Destroy();
 
-            SceneList.Clear();
-        }
+        SceneList.Clear();
+    }
 
-        private void QuickSaveScene()
-        {
-            if (Busy)
-                return;
+    private void QuickSaveScene()
+    {
+        if (Busy)
+            return;
 
-            var data = meidoPhotoStudio.SaveScene();
+        var data = meidoPhotoStudio.SaveScene();
 
-            if (data == null)
-                return;
+        if (data == null)
+            return;
 
-            tempSceneData = data;
+        tempSceneData = data;
 
-            File.WriteAllBytes(TempScenePath, data);
-        }
+        File.WriteAllBytes(TempScenePath, data);
+    }
+
+    private void QuickLoadScene()
+    {
+        if (Busy)
+            return;
 
-        private void QuickLoadScene()
+        if (tempSceneData == null)
         {
-            if (Busy)
+            if (File.Exists(TempScenePath))
+                tempSceneData = File.ReadAllBytes(TempScenePath);
+            else
                 return;
+        }
 
-            if (tempSceneData == null)
-            {
-                if (File.Exists(TempScenePath))
-                    tempSceneData = File.ReadAllBytes(TempScenePath);
-                else
-                    return;
-            }
+        meidoPhotoStudio.LoadScene(tempSceneData);
+    }
 
-            meidoPhotoStudio.LoadScene(tempSceneData);
-        }
+    private void SaveSceneToFile(Texture2D screenshot, bool overwrite = false)
+    {
+        Busy = true;
+
+        var sceneData = meidoPhotoStudio.SaveScene(KankyoMode);
 
-        private void SaveSceneToFile(Texture2D screenshot, bool overwrite = false)
+        if (sceneData != null)
         {
-            Busy = true;
+            var scenePrefix = KankyoMode ? "mpskankyo" : "mpsscene";
+            var fileName = $"{scenePrefix}{Utility.Timestamp}.png";
+            var savePath = Path.Combine(CurrentScenesDirectory, fileName);
 
-            var sceneData = meidoPhotoStudio.SaveScene(KankyoMode);
+            Utility.ResizeToFit(screenshot, (int)sceneDimensions.x, (int)sceneDimensions.y);
 
-            if (sceneData != null)
+            try
             {
-                var scenePrefix = KankyoMode ? "mpskankyo" : "mpsscene";
-                var fileName = $"{scenePrefix}{Utility.Timestamp}.png";
-                var savePath = Path.Combine(CurrentScenesDirectory, fileName);
-
-                Utility.ResizeToFit(screenshot, (int)sceneDimensions.x, (int)sceneDimensions.y);
+                if (overwrite && CurrentScene?.FileInfo != null)
+                    savePath = CurrentScene.FileInfo.FullName;
+                else
+                    overwrite = false;
 
-                try
+                using (var fileStream = File.Create(savePath))
                 {
-                    if (overwrite && CurrentScene?.FileInfo != null)
-                        savePath = CurrentScene.FileInfo.FullName;
-                    else
-                        overwrite = false;
-
-                    using (var fileStream = File.Create(savePath))
-                    {
-                        var encodedPng = screenshot.EncodeToPNG();
-
-                        fileStream.Write(encodedPng, 0, encodedPng.Length);
-                        fileStream.Write(sceneData, 0, sceneData.Length);
-                    }
-
-                    if (overwrite)
-                    {
-                        File.SetCreationTime(savePath, CurrentScene.FileInfo.CreationTime);
-                        CurrentScene.Destroy();
-                        SceneList.RemoveAt(CurrentSceneIndex);
-                    }
-                }
-                catch (Exception e)
-                {
-                    Utility.LogError($"Failed to save scene to disk because {e.Message}\n{e.StackTrace}");
-                    Object.DestroyImmediate(screenshot);
-                    Busy = false;
+                    var encodedPng = screenshot.EncodeToPNG();
 
-                    return;
+                    fileStream.Write(encodedPng, 0, encodedPng.Length);
+                    fileStream.Write(sceneData, 0, sceneData.Length);
                 }
 
-                SceneList.Add(new(savePath, screenshot));
-                SortScenes(CurrentSortMode);
+                if (overwrite)
+                {
+                    File.SetCreationTime(savePath, CurrentScene.FileInfo.CreationTime);
+                    CurrentScene.Destroy();
+                    SceneList.RemoveAt(CurrentSceneIndex);
+                }
             }
-            else
+            catch (Exception e)
+            {
+                Utility.LogError($"Failed to save scene to disk because {e.Message}\n{e.StackTrace}");
                 Object.DestroyImmediate(screenshot);
+                Busy = false;
 
-            Busy = false;
+                return;
+            }
+
+            SceneList.Add(new(savePath, screenshot));
+            SortScenes(CurrentSortMode);
         }
+        else
+            Object.DestroyImmediate(screenshot);
+
+        Busy = false;
     }
 }

+ 39 - 40
src/MeidoPhotoStudio.Plugin/Managers/WindowManager.cs

@@ -3,57 +3,56 @@ using UnityEngine;
 
 using static MeidoPhotoStudio.Plugin.Constants;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class WindowManager : IManager
 {
-    public class WindowManager : IManager
-    {
-        private readonly Dictionary<Window, BaseWindow> Windows = new();
+    private readonly Dictionary<Window, BaseWindow> Windows = new();
 
-        public BaseWindow this[Window id]
+    public BaseWindow this[Window id]
+    {
+        get => Windows[id];
+        set
         {
-            get => Windows[id];
-            set
-            {
-                Windows[id] = value;
-                Windows[id].Activate();
-            }
+            Windows[id] = value;
+            Windows[id].Activate();
         }
+    }
 
-        public WindowManager() =>
-            InputManager.Register(MpsKey.ToggleUI, KeyCode.Tab, "Show/hide all UI");
+    public WindowManager() =>
+        InputManager.Register(MpsKey.ToggleUI, KeyCode.Tab, "Show/hide all UI");
 
-        public void DrawWindow(BaseWindow window)
-        {
-            if (!window.Visible)
-                return;
+    public void DrawWindow(BaseWindow window)
+    {
+        if (!window.Visible)
+            return;
 
-            var windowStyle = new GUIStyle(GUI.skin.box);
+        var windowStyle = new GUIStyle(GUI.skin.box);
 
-            window.WindowRect = GUI.Window(window.windowID, window.WindowRect, window.GUIFunc, "", windowStyle);
-        }
+        window.WindowRect = GUI.Window(window.windowID, window.WindowRect, window.GUIFunc, "", windowStyle);
+    }
 
-        public void DrawWindows()
-        {
-            foreach (var window in Windows.Values)
-                DrawWindow(window);
-        }
+    public void DrawWindows()
+    {
+        foreach (var window in Windows.Values)
+            DrawWindow(window);
+    }
 
-        public void Update()
-        {
-            foreach (var window in Windows.Values)
-                window.Update();
-        }
+    public void Update()
+    {
+        foreach (var window in Windows.Values)
+            window.Update();
+    }
 
-        public void Activate()
-        {
-            foreach (var window in Windows.Values)
-                window.Activate();
-        }
+    public void Activate()
+    {
+        foreach (var window in Windows.Values)
+            window.Activate();
+    }
 
-        public void Deactivate()
-        {
-            foreach (var window in Windows.Values)
-                window.Deactivate();
-        }
+    public void Deactivate()
+    {
+        foreach (var window in Windows.Values)
+            window.Deactivate();
     }
 }

+ 68 - 69
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointFinger.cs

@@ -2,98 +2,97 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointFinger : DragPointMeido
 {
-    public class DragPointFinger : DragPointMeido
-    {
-        private static readonly Color dragpointColour = new(0.1f, 0.4f, 0.95f, defaultAlpha);
+    private static readonly Color dragpointColour = new(0.1f, 0.4f, 0.95f, defaultAlpha);
 
-        private readonly TBody.IKCMO IK = new();
-        private readonly Quaternion[] jointRotation = new Quaternion[2];
+    private readonly TBody.IKCMO IK = new();
+    private readonly Quaternion[] jointRotation = new Quaternion[2];
 
-        private IKCtrlData ikCtrlData;
-        private Transform[] ikChain;
-        private bool baseFinger;
+    private IKCtrlData ikCtrlData;
+    private Transform[] ikChain;
+    private bool baseFinger;
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-            var parentName = myObject.parent.name.Split(' ')[2];
+        var parentName = myObject.parent.name.Split(' ')[2];
 
-            // Base finger names have the form 'FingerN' or 'ToeN' where N is a natural number
-            baseFinger = parentName.Length is 7 or 4;
-            ikChain = new Transform[2] {
-                myObject.parent,
+        // Base finger names have the form 'FingerN' or 'ToeN' where N is a natural number
+        baseFinger = parentName.Length is 7 or 4;
+        ikChain = new Transform[2] {
+            myObject.parent,
                 myObject
-            };
+        };
 
-            ikCtrlData = IkCtrlData;
-        }
+        ikCtrlData = IkCtrlData;
+    }
 
-        protected override void ApplyDragType()
-        {
-            if (baseFinger && CurrentDragType == DragType.RotLocalY)
-                ApplyProperties(true, true, false);
-            else if (CurrentDragType == DragType.MoveXZ)
-                ApplyProperties(true, true, false);
-            else
-                ApplyProperties(false, false, false);
+    protected override void ApplyDragType()
+    {
+        if (baseFinger && CurrentDragType == DragType.RotLocalY)
+            ApplyProperties(true, true, false);
+        else if (CurrentDragType == DragType.MoveXZ)
+            ApplyProperties(true, true, false);
+        else
+            ApplyProperties(false, false, false);
+
+        ApplyColour(dragpointColour);
+    }
 
-            ApplyColour(dragpointColour);
-        }
+    protected override void UpdateDragType() =>
+        CurrentDragType = Input.GetKey(MpsKey.DragFinger)
+        ? Input.Shift
+        ? DragType.RotLocalY
+        : DragType.MoveXZ
+        : DragType.None;
 
-        protected override void UpdateDragType() =>
-            CurrentDragType = Input.GetKey(MpsKey.DragFinger)
-                ? Input.Shift
-                    ? DragType.RotLocalY
-                    : DragType.MoveXZ
-                : DragType.None;
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+        jointRotation[jointUpper] = ikChain[jointUpper].localRotation;
+        jointRotation[jointMiddle] = ikChain[jointMiddle].localRotation;
+        InitializeIK(IK, ikChain[jointUpper], ikChain[jointUpper], ikChain[jointMiddle]);
+    }
 
-            jointRotation[jointUpper] = ikChain[jointUpper].localRotation;
-            jointRotation[jointMiddle] = ikChain[jointMiddle].localRotation;
-            InitializeIK(IK, ikChain[jointUpper], ikChain[jointUpper], ikChain[jointMiddle]);
-        }
+    protected override void Drag()
+    {
+        if (isPlaying)
+            meido.Stop = true;
 
-        protected override void Drag()
+        if (CurrentDragType == DragType.MoveXZ)
         {
-            if (isPlaying)
-                meido.Stop = true;
+            Porc(IK, ikCtrlData, ikChain[jointUpper], ikChain[jointUpper], ikChain[jointMiddle]);
 
-            if (CurrentDragType == DragType.MoveXZ)
+            if (!baseFinger)
             {
-                Porc(IK, ikCtrlData, ikChain[jointUpper], ikChain[jointUpper], ikChain[jointMiddle]);
-
-                if (!baseFinger)
-                {
-                    SetRotation(jointUpper);
-                    SetRotation(jointMiddle);
-                }
-                else
-                {
-                    jointRotation[jointUpper] = ikChain[jointUpper].localRotation;
-                    jointRotation[jointMiddle] = ikChain[jointMiddle].localRotation;
-                }
+                SetRotation(jointUpper);
+                SetRotation(jointMiddle);
             }
-            else if (CurrentDragType == DragType.RotLocalY)
+            else
             {
-                var mouseDelta = MouseDelta();
-
-                ikChain[jointUpper].localRotation = jointRotation[jointUpper];
-                ikChain[jointUpper].Rotate(Vector3.right * (mouseDelta.x / 1.5f));
+                jointRotation[jointUpper] = ikChain[jointUpper].localRotation;
+                jointRotation[jointMiddle] = ikChain[jointMiddle].localRotation;
             }
         }
-
-        private void SetRotation(int joint)
+        else if (CurrentDragType == DragType.RotLocalY)
         {
-            var rotation = jointRotation[joint].eulerAngles;
+            var mouseDelta = MouseDelta();
 
-            rotation.z = ikChain[joint].localEulerAngles.z;
-            ikChain[joint].localRotation = Quaternion.Euler(rotation);
+            ikChain[jointUpper].localRotation = jointRotation[jointUpper];
+            ikChain[jointUpper].Rotate(Vector3.right * (mouseDelta.x / 1.5f));
         }
     }
+
+    private void SetRotation(int joint)
+    {
+        var rotation = jointRotation[joint].eulerAngles;
+
+        rotation.z = ikChain[joint].localEulerAngles.z;
+        ikChain[joint].localRotation = Quaternion.Euler(rotation);
+    }
 }

+ 76 - 77
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointHead.cs

@@ -3,106 +3,105 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointHead : DragPointMeido
 {
-    public class DragPointHead : DragPointMeido
-    {
-        public event EventHandler Select;
+    public event EventHandler Select;
 
-        private Quaternion headRotation;
-        private Vector3 eyeRotationL;
-        private Vector3 eyeRotationR;
+    private Quaternion headRotation;
+    private Vector3 eyeRotationL;
+    private Vector3 eyeRotationR;
 
-        public bool IsIK { get; set; }
+    public bool IsIK { get; set; }
 
-        protected override void ApplyDragType()
+    protected override void ApplyDragType()
+    {
+        if (IsBone)
         {
-            if (IsBone)
-            {
-                var current = CurrentDragType;
-                var active = current is DragType.MoveY or DragType.MoveXZ or DragType.Select;
-
-                ApplyProperties(active, false, false);
-            }
-            else
-                ApplyProperties(CurrentDragType != DragType.None, false, false);
-        }
+            var current = CurrentDragType;
+            var active = current is DragType.MoveY or DragType.MoveXZ or DragType.Select;
 
-        protected override void UpdateDragType()
-        {
-            var shift = Input.Shift;
-            var alt = Input.Alt;
-
-            if (alt && Input.Control)
-                // eyes
-                CurrentDragType = shift ? DragType.MoveY : DragType.MoveXZ;
-            else if (alt)
-                // head
-                CurrentDragType = shift ? DragType.RotLocalY : DragType.RotLocalXZ;
-            else if (Input.GetKey(MpsKey.DragSelect))
-                CurrentDragType = DragType.Select;
-            else
-                CurrentDragType = DragType.None;
+            ApplyProperties(active, false, false);
         }
+        else
+            ApplyProperties(CurrentDragType != DragType.None, false, false);
+    }
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+    protected override void UpdateDragType()
+    {
+        var shift = Input.Shift;
+        var alt = Input.Alt;
+
+        if (alt && Input.Control)
+            // eyes
+            CurrentDragType = shift ? DragType.MoveY : DragType.MoveXZ;
+        else if (alt)
+            // head
+            CurrentDragType = shift ? DragType.RotLocalY : DragType.RotLocalXZ;
+        else if (Input.GetKey(MpsKey.DragSelect))
+            CurrentDragType = DragType.Select;
+        else
+            CurrentDragType = DragType.None;
+    }
 
-            if (CurrentDragType == DragType.Select)
-                Select?.Invoke(this, EventArgs.Empty);
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-            headRotation = MyObject.rotation;
+        if (CurrentDragType == DragType.Select)
+            Select?.Invoke(this, EventArgs.Empty);
 
-            eyeRotationL = meido.Body.quaDefEyeL.eulerAngles;
-            eyeRotationR = meido.Body.quaDefEyeR.eulerAngles;
-        }
+        headRotation = MyObject.rotation;
 
-        protected override void OnDoubleClick()
+        eyeRotationL = meido.Body.quaDefEyeL.eulerAngles;
+        eyeRotationR = meido.Body.quaDefEyeR.eulerAngles;
+    }
+
+    protected override void OnDoubleClick()
+    {
+        if (CurrentDragType is DragType.MoveXZ or DragType.MoveY)
         {
-            if (CurrentDragType is DragType.MoveXZ or DragType.MoveY)
-            {
-                meido.Body.quaDefEyeL = meido.DefaultEyeRotL;
-                meido.Body.quaDefEyeR = meido.DefaultEyeRotR;
-            }
-            else if (CurrentDragType is DragType.RotLocalY or DragType.RotLocalXZ)
-                meido.FreeLook = !meido.FreeLook;
+            meido.Body.quaDefEyeL = meido.DefaultEyeRotL;
+            meido.Body.quaDefEyeR = meido.DefaultEyeRotR;
         }
+        else if (CurrentDragType is DragType.RotLocalY or DragType.RotLocalXZ)
+            meido.FreeLook = !meido.FreeLook;
+    }
 
-        protected override void Drag()
-        {
-            if (IsIK || CurrentDragType == DragType.Select)
-                return;
+    protected override void Drag()
+    {
+        if (IsIK || CurrentDragType == DragType.Select)
+            return;
 
-            if (!(CurrentDragType == DragType.MoveXZ || CurrentDragType == DragType.MoveY) && isPlaying)
-                meido.Stop = true;
+        if (!(CurrentDragType == DragType.MoveXZ || CurrentDragType == DragType.MoveY) && isPlaying)
+            meido.Stop = true;
 
-            var mouseDelta = MouseDelta();
+        var mouseDelta = MouseDelta();
 
-            if (CurrentDragType == DragType.RotLocalXZ)
-            {
-                MyObject.rotation = headRotation;
-                MyObject.Rotate(camera.transform.forward, -mouseDelta.x / 3f, Space.World);
-                MyObject.Rotate(camera.transform.right, mouseDelta.y / 3f, Space.World);
-            }
+        if (CurrentDragType == DragType.RotLocalXZ)
+        {
+            MyObject.rotation = headRotation;
+            MyObject.Rotate(camera.transform.forward, -mouseDelta.x / 3f, Space.World);
+            MyObject.Rotate(camera.transform.right, mouseDelta.y / 3f, Space.World);
+        }
 
-            if (CurrentDragType == DragType.RotLocalY)
-            {
-                MyObject.rotation = headRotation;
-                MyObject.Rotate(Vector3.right * mouseDelta.x / 3f);
-            }
+        if (CurrentDragType == DragType.RotLocalY)
+        {
+            MyObject.rotation = headRotation;
+            MyObject.Rotate(Vector3.right * mouseDelta.x / 3f);
+        }
 
-            if (CurrentDragType is DragType.MoveXZ or DragType.MoveY)
-            {
-                var inv = CurrentDragType == DragType.MoveY ? -1 : 1;
+        if (CurrentDragType is DragType.MoveXZ or DragType.MoveY)
+        {
+            var inv = CurrentDragType == DragType.MoveY ? -1 : 1;
 
-                meido.Body.quaDefEyeL.eulerAngles = new(
+            meido.Body.quaDefEyeL.eulerAngles = new(
                     eyeRotationL.x, eyeRotationL.y - mouseDelta.x / 10f, eyeRotationL.z - mouseDelta.y / 10f
-                );
-                meido.Body.quaDefEyeR.eulerAngles = new(
+                    );
+            meido.Body.quaDefEyeR.eulerAngles = new(
                     eyeRotationR.x, eyeRotationR.y + inv * mouseDelta.x / 10f, eyeRotationR.z + mouseDelta.y / 10f
-                );
-            }
+                    );
         }
     }
 }

+ 43 - 44
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointPelvis.cs

@@ -2,59 +2,58 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointPelvis : DragPointMeido
 {
-    public class DragPointPelvis : DragPointMeido
+    private Quaternion pelvisRotation;
+
+    protected override void ApplyDragType()
     {
-        private Quaternion pelvisRotation;
+        if (CurrentDragType == DragType.Ignore)
+            ApplyProperties();
+        else if (IsBone)
+            ApplyProperties(false, false, false);
+        else
+            ApplyProperties(CurrentDragType != DragType.None, false, false);
+    }
 
-        protected override void ApplyDragType()
-        {
-            if (CurrentDragType == DragType.Ignore)
-                ApplyProperties();
-            else if (IsBone)
-                ApplyProperties(false, false, false);
-            else
-                ApplyProperties(CurrentDragType != DragType.None, false, false);
-        }
+    protected override void UpdateDragType() =>
+        CurrentDragType = Input.Alt && !Input.Control
+        ? Input.Shift
+        ? DragType.RotLocalY
+        : DragType.RotLocalXZ
+        : OtherDragType()
+        ? DragType.Ignore
+        : DragType.None;
+
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
+        pelvisRotation = MyObject.rotation;
+    }
+
+    protected override void Drag()
+    {
+        if (CurrentDragType == DragType.None)
+            return;
+
+        if (isPlaying)
+            meido.Stop = true;
 
-        protected override void UpdateDragType() =>
-            CurrentDragType = Input.Alt && !Input.Control
-                ? Input.Shift
-                    ? DragType.RotLocalY
-                    : DragType.RotLocalXZ
-                : OtherDragType()
-                    ? DragType.Ignore
-                    : DragType.None;
+        var mouseDelta = MouseDelta();
 
-        protected override void OnMouseDown()
+        if (CurrentDragType == DragType.RotLocalXZ)
         {
-            base.OnMouseDown();
-            pelvisRotation = MyObject.rotation;
+            MyObject.rotation = pelvisRotation;
+            MyObject.Rotate(camera.transform.forward, mouseDelta.x / 6f, Space.World);
+            MyObject.Rotate(camera.transform.right, mouseDelta.y / 4f, Space.World);
         }
 
-        protected override void Drag()
+        if (CurrentDragType == DragType.RotLocalY)
         {
-            if (CurrentDragType == DragType.None)
-                return;
-
-            if (isPlaying)
-                meido.Stop = true;
-
-            var mouseDelta = MouseDelta();
-
-            if (CurrentDragType == DragType.RotLocalXZ)
-            {
-                MyObject.rotation = pelvisRotation;
-                MyObject.Rotate(camera.transform.forward, mouseDelta.x / 6f, Space.World);
-                MyObject.Rotate(camera.transform.right, mouseDelta.y / 4f, Space.World);
-            }
-
-            if (CurrentDragType == DragType.RotLocalY)
-            {
-                MyObject.rotation = pelvisRotation;
-                MyObject.Rotate(Vector3.right * (mouseDelta.x / 2.2f));
-            }
+            MyObject.rotation = pelvisRotation;
+            MyObject.Rotate(Vector3.right * (mouseDelta.x / 2.2f));
         }
     }
 }

+ 83 - 84
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointSpine.cs

@@ -2,111 +2,110 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointSpine : DragPointMeido
 {
-    public class DragPointSpine : DragPointMeido
+    private Quaternion spineRotation;
+    private bool isHip;
+    private bool isThigh;
+    private bool isHead;
+
+    public override void AddGizmo(float scale = 0.25f, CustomGizmo.GizmoMode mode = CustomGizmo.GizmoMode.Local)
     {
-        private Quaternion spineRotation;
-        private bool isHip;
-        private bool isThigh;
-        private bool isHead;
+        base.AddGizmo(scale, mode);
 
-        public override void AddGizmo(float scale = 0.25f, CustomGizmo.GizmoMode mode = CustomGizmo.GizmoMode.Local)
-        {
-            base.AddGizmo(scale, mode);
+        if (isHead)
+            Gizmo.GizmoDrag += (s, a) => meido.HeadToCam = false;
+    }
 
-            if (isHead)
-                Gizmo.GizmoDrag += (s, a) => meido.HeadToCam = false;
-        }
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+        isHip = myObject.name == "Bip01";
+        isThigh = myObject.name.EndsWith("Thigh");
+        isHead = myObject.name.EndsWith("Head");
+    }
 
-            isHip = myObject.name == "Bip01";
-            isThigh = myObject.name.EndsWith("Thigh");
-            isHead = myObject.name.EndsWith("Head");
-        }
+    protected override void ApplyDragType()
+    {
+        var current = CurrentDragType;
 
-        protected override void ApplyDragType()
+        if (IsBone && current != DragType.Ignore)
         {
-            var current = CurrentDragType;
-
-            if (IsBone && current != DragType.Ignore)
-            {
-                if (!isHead && current == DragType.RotLocalXZ)
-                    ApplyProperties(false, false, isThigh);
-                else if (!isThigh && current == DragType.MoveY)
-                    ApplyProperties(isHip, isHip, !isHip);
-                else if (!isThigh && !isHead && current == DragType.RotLocalY)
-                    ApplyProperties(!isHip, !isHip, isHip);
-                else
-                    ApplyProperties(!isThigh, !isThigh, false);
-            }
+            if (!isHead && current == DragType.RotLocalXZ)
+                ApplyProperties(false, false, isThigh);
+            else if (!isThigh && current == DragType.MoveY)
+                ApplyProperties(isHip, isHip, !isHip);
+            else if (!isThigh && !isHead && current == DragType.RotLocalY)
+                ApplyProperties(!isHip, !isHip, isHip);
             else
-                ApplyProperties(false, false, false);
+                ApplyProperties(!isThigh, !isThigh, false);
         }
+        else
+            ApplyProperties(false, false, false);
+    }
 
-        protected override void UpdateDragType()
-        {
-            var shift = Input.Shift;
-            var alt = Input.Alt;
-
-            if (OtherDragType())
-                CurrentDragType = DragType.Ignore;
-            else if (isThigh && !Input.Control && alt && shift)
-                // gizmo thigh rotation
-                CurrentDragType = DragType.RotLocalXZ;
-            else if (alt)
-                CurrentDragType = DragType.Ignore;
-            else if (shift)
-                CurrentDragType = DragType.RotLocalY;
-            else if (Input.Control)
-                // hip y transform and spine gizmo rotation
-                CurrentDragType = DragType.MoveY;
-            else
-                CurrentDragType = DragType.None;
-        }
+    protected override void UpdateDragType()
+    {
+        var shift = Input.Shift;
+        var alt = Input.Alt;
+
+        if (OtherDragType())
+            CurrentDragType = DragType.Ignore;
+        else if (isThigh && !Input.Control && alt && shift)
+            // gizmo thigh rotation
+            CurrentDragType = DragType.RotLocalXZ;
+        else if (alt)
+            CurrentDragType = DragType.Ignore;
+        else if (shift)
+            CurrentDragType = DragType.RotLocalY;
+        else if (Input.Control)
+            // hip y transform and spine gizmo rotation
+            CurrentDragType = DragType.MoveY;
+        else
+            CurrentDragType = DragType.None;
+    }
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-            spineRotation = MyObject.rotation;
-        }
+        spineRotation = MyObject.rotation;
+    }
 
-        protected override void Drag()
-        {
-            if (isPlaying)
-                meido.Stop = true;
+    protected override void Drag()
+    {
+        if (isPlaying)
+            meido.Stop = true;
 
-            var mouseDelta = MouseDelta();
+        var mouseDelta = MouseDelta();
 
-            if (CurrentDragType == DragType.None)
-            {
-                if (isHead)
-                    meido.HeadToCam = false;
+        if (CurrentDragType == DragType.None)
+        {
+            if (isHead)
+                meido.HeadToCam = false;
 
-                MyObject.rotation = spineRotation;
-                MyObject.Rotate(camera.transform.forward, -mouseDelta.x / 4.5f, Space.World);
-                MyObject.Rotate(camera.transform.right, mouseDelta.y / 3f, Space.World);
-            }
+            MyObject.rotation = spineRotation;
+            MyObject.Rotate(camera.transform.forward, -mouseDelta.x / 4.5f, Space.World);
+            MyObject.Rotate(camera.transform.right, mouseDelta.y / 3f, Space.World);
+        }
 
-            if (CurrentDragType == DragType.RotLocalY)
-            {
-                if (isHead)
-                    meido.HeadToCam = false;
+        if (CurrentDragType == DragType.RotLocalY)
+        {
+            if (isHead)
+                meido.HeadToCam = false;
 
-                MyObject.rotation = spineRotation;
-                MyObject.Rotate(Vector3.right * mouseDelta.x / 4f);
-            }
+            MyObject.rotation = spineRotation;
+            MyObject.Rotate(Vector3.right * mouseDelta.x / 4f);
+        }
 
-            if (CurrentDragType == DragType.MoveY)
-            {
-                var cursorPosition = CursorPosition();
+        if (CurrentDragType == DragType.MoveY)
+        {
+            var cursorPosition = CursorPosition();
 
-                MyObject.position = new Vector3(MyObject.position.x, cursorPosition.y, MyObject.position.z);
-            }
+            MyObject.position = new Vector3(MyObject.position.x, cursorPosition.y, MyObject.position.z);
         }
     }
 }

+ 61 - 62
src/MeidoPhotoStudio.Plugin/Meido/IK/DragPointTorso.cs

@@ -2,83 +2,82 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointTorso : DragPointMeido
 {
-    public class DragPointTorso : DragPointMeido
-    {
-        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 static readonly float[] blah = new[] { 0.03f, 0.1f, 0.09f, 0.07f };
+    private static readonly float[] something = new[] { 0.08f, 0.15f };
 
-        private readonly Quaternion[] spineRotation = new Quaternion[4];
-        private readonly Transform[] spine = new Transform[4];
+    private readonly Quaternion[] spineRotation = new Quaternion[4];
+    private readonly Transform[] spine = new Transform[4];
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-            var spine = myObject;
+        var spine = myObject;
 
-            for (var i = 0; i < this.spine.Length; i++)
-            {
-                this.spine[i] = spine;
+        for (var i = 0; i < this.spine.Length; i++)
+        {
+            this.spine[i] = spine;
 
-                spine = spine.parent;
-            }
+            spine = spine.parent;
         }
+    }
 
-        protected override void ApplyDragType()
-        {
-            if (CurrentDragType == DragType.Ignore)
-                ApplyProperties();
-            else if (IsBone)
-                ApplyProperties(false, false, false);
-            else
-                ApplyProperties(CurrentDragType != DragType.None, false, false);
-        }
+    protected override void ApplyDragType()
+    {
+        if (CurrentDragType == DragType.Ignore)
+            ApplyProperties();
+        else if (IsBone)
+            ApplyProperties(false, false, false);
+        else
+            ApplyProperties(CurrentDragType != DragType.None, false, false);
+    }
 
-        protected override void UpdateDragType() =>
-            CurrentDragType = Input.Alt && !Input.Control
-                ? Input.Shift
-                    ? DragType.RotLocalY
-                    : DragType.RotLocalXZ
-                : OtherDragType()
-                    ? DragType.Ignore
-                    : DragType.None;
+    protected override void UpdateDragType() =>
+        CurrentDragType = Input.Alt && !Input.Control
+        ? Input.Shift
+        ? DragType.RotLocalY
+        : DragType.RotLocalXZ
+        : OtherDragType()
+        ? DragType.Ignore
+        : DragType.None;
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-            for (var i = 0; i < spine.Length; i++)
-                spineRotation[i] = spine[i].localRotation;
-        }
+        for (var i = 0; i < spine.Length; i++)
+            spineRotation[i] = spine[i].localRotation;
+    }
 
-        protected override void Drag()
-        {
-            if (CurrentDragType == DragType.None)
-                return;
+    protected override void Drag()
+    {
+        if (CurrentDragType == DragType.None)
+            return;
 
-            if (isPlaying)
-                meido.Stop = true;
+        if (isPlaying)
+            meido.Stop = true;
 
-            var mouseDelta = MouseDelta();
+        var mouseDelta = MouseDelta();
 
-            if (CurrentDragType == DragType.RotLocalXZ)
-                for (var i = 0; i < spine.Length; i++)
-                {
-                    spine[i].localRotation = spineRotation[i];
-                    spine[i].Rotate(
+        if (CurrentDragType == DragType.RotLocalXZ)
+            for (var i = 0; i < spine.Length; i++)
+            {
+                spine[i].localRotation = spineRotation[i];
+                spine[i].Rotate(
                         camera.transform.forward, -mouseDelta.x / 1.5f * blah[i], Space.World
-                    );
-                    spine[i].Rotate(camera.transform.right, mouseDelta.y * blah[i], Space.World);
-                }
-
-            if (CurrentDragType == DragType.RotLocalY)
-                for (var i = 0; i < spine.Length; i++)
-                {
-                    spine[i].localRotation = spineRotation[i];
-                    spine[i].Rotate(Vector3.right * (mouseDelta.x / 1.5f * something[i / 2]));
-                }
-        }
+                        );
+                spine[i].Rotate(camera.transform.right, mouseDelta.y * blah[i], Space.World);
+            }
+
+        if (CurrentDragType == DragType.RotLocalY)
+            for (var i = 0; i < spine.Length; i++)
+            {
+                spine[i].localRotation = spineRotation[i];
+                spine[i].Rotate(Vector3.right * (mouseDelta.x / 1.5f * something[i / 2]));
+            }
     }
 }

+ 25 - 26
src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointChain.cs

@@ -1,41 +1,40 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class DragPointChain : DragPointMeido
 {
-    public abstract class DragPointChain : DragPointMeido
-    {
-        protected readonly TBody.IKCMO IK = new();
-        protected readonly Quaternion[] jointRotation = new Quaternion[3];
+    protected readonly TBody.IKCMO IK = new();
+    protected readonly Quaternion[] jointRotation = new Quaternion[3];
 
-        protected IKCtrlData ikCtrlData;
-        protected Transform[] ikChain;
+    protected IKCtrlData ikCtrlData;
+    protected Transform[] ikChain;
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
 
-            ikChain = new Transform[] {
-                myObject.parent,
+        ikChain = new Transform[] {
+            myObject.parent,
                 myObject.parent,
                 myObject
-            };
+        };
 
-            ikCtrlData = IkCtrlData;
-        }
+        ikCtrlData = IkCtrlData;
+    }
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-            InitializeRotation();
+        InitializeRotation();
 
-            InitializeIK(IK, ikChain[jointUpper], ikChain[jointMiddle], ikChain[jointLower]);
-        }
+        InitializeIK(IK, ikChain[jointUpper], ikChain[jointMiddle], ikChain[jointLower]);
+    }
 
-        protected void InitializeRotation()
-        {
-            for (var i = 0; i < jointRotation.Length; i++)
-                jointRotation[i] = ikChain[i].localRotation;
-        }
+    protected void InitializeRotation()
+    {
+        for (var i = 0; i < jointRotation.Length; i++)
+            jointRotation[i] = ikChain[i].localRotation;
     }
 }

+ 98 - 99
src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointLimb.cs

@@ -2,134 +2,133 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointLimb : DragPointChain
 {
-    public class DragPointLimb : DragPointChain
-    {
-        private int foot = 1;
-        private bool isLower;
-        private bool isMiddle;
-        private bool isUpper;
+    private int foot = 1;
+    private bool isLower;
+    private bool isMiddle;
+    private bool isUpper;
 
-        public override bool IsBone
+    public override bool IsBone
+    {
+        set
         {
-            set
-            {
-                base.IsBone = value;
+            base.IsBone = value;
 
-                BaseScale = isBone ? boneScale : OriginalScale;
-            }
+            BaseScale = isBone ? boneScale : OriginalScale;
         }
+    }
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+    public override void Set(Transform myObject)
+    {
+        base.Set(myObject);
+
+        var name = myObject.name;
 
-            var name = myObject.name;
+        foot = name.EndsWith("Foot") ? -1 : 1;
+        isLower = name.EndsWith("Hand") || foot == -1;
+        isMiddle = name.EndsWith("Calf") || name.EndsWith("Forearm");
+        isUpper = !isMiddle && !isLower;
+
+        if (isLower)
+            ikChain[0] = ikChain[0].parent;
+    }
 
-            foot = name.EndsWith("Foot") ? -1 : 1;
-            isLower = name.EndsWith("Hand") || foot == -1;
-            isMiddle = name.EndsWith("Calf") || name.EndsWith("Forearm");
-            isUpper = !isMiddle && !isLower;
+    protected override void ApplyDragType()
+    {
+        var current = CurrentDragType;
+        var isBone = IsBone;
 
+        if (CurrentDragType == DragType.Ignore)
+            ApplyProperties();
+        else if (current == DragType.RotLocalXZ)
+        {
             if (isLower)
-                ikChain[0] = ikChain[0].parent;
+                ApplyProperties(!isBone, false, isBone);
+            else
+                ApplyProperties();
         }
-
-        protected override void ApplyDragType()
+        else if (current == DragType.RotLocalY)
         {
-            var current = CurrentDragType;
-            var isBone = IsBone;
-
-            if (CurrentDragType == DragType.Ignore)
+            if (isLower || isMiddle)
+                ApplyProperties(!isBone, false, false);
+            else if (isUpper)
+                ApplyProperties(false, false, isBone);
+            else
                 ApplyProperties();
-            else if (current == DragType.RotLocalXZ)
-            {
-                if (isLower)
-                    ApplyProperties(!isBone, false, isBone);
-                else
-                    ApplyProperties();
-            }
-            else if (current == DragType.RotLocalY)
-            {
-                if (isLower || isMiddle)
-                    ApplyProperties(!isBone, false, false);
-                else if (isUpper)
-                    ApplyProperties(false, false, isBone);
-                else
-                    ApplyProperties();
-            }
-            else if (current == DragType.RotY)
-            {
-                if (isMiddle)
-                    ApplyProperties(false, false, isBone);
-                else
-                    ApplyProperties();
-            }
-            else if (current == DragType.MoveXZ)
-            {
-                if (isLower)
-                    ApplyProperties(true, isBone, false);
-                else
-                    ApplyProperties();
-            }
+        }
+        else if (current == DragType.RotY)
+        {
+            if (isMiddle)
+                ApplyProperties(false, false, isBone);
             else
+                ApplyProperties();
+        }
+        else if (current == DragType.MoveXZ)
+        {
+            if (isLower)
                 ApplyProperties(true, isBone, false);
+            else
+                ApplyProperties();
         }
+        else
+            ApplyProperties(true, isBone, false);
+    }
+
+    protected override void UpdateDragType()
+    {
+        var control = Input.Control;
+        var alt = Input.Alt;
 
-        protected override void UpdateDragType()
+        // Check for DragMove so that hand dragpoint is not in the way
+        if (OtherDragType())
+            CurrentDragType = DragType.Ignore;
+        else if (control && !Input.GetKey(MpsKey.DragMove))
         {
-            var control = Input.Control;
-            var alt = Input.Alt;
-
-            // Check for DragMove so that hand dragpoint is not in the way
-            if (OtherDragType())
-                CurrentDragType = DragType.Ignore;
-            else if (control && !Input.GetKey(MpsKey.DragMove))
-            {
-                if (alt)
-                    CurrentDragType = DragType.RotY;
-                else
-                    CurrentDragType = DragType.MoveXZ;
-            }
-            else if (alt)
-                CurrentDragType = Input.Shift ? DragType.RotLocalY : DragType.RotLocalXZ;
+            if (alt)
+                CurrentDragType = DragType.RotY;
             else
-                CurrentDragType = Input.Shift ? DragType.Ignore : DragType.None;
+                CurrentDragType = DragType.MoveXZ;
         }
+        else if (alt)
+            CurrentDragType = Input.Shift ? DragType.RotLocalY : DragType.RotLocalXZ;
+        else
+            CurrentDragType = Input.Shift ? DragType.Ignore : DragType.None;
+    }
 
-        protected override void Drag()
-        {
-            if (isPlaying)
-                meido.Stop = true;
+    protected override void Drag()
+    {
+        if (isPlaying)
+            meido.Stop = true;
 
-            var altRotation = CurrentDragType is DragType.MoveXZ or DragType.RotY;
+        var altRotation = CurrentDragType is DragType.MoveXZ or DragType.RotY;
 
-            if (CurrentDragType == DragType.None || altRotation)
-            {
-                var upperJoint = altRotation ? jointMiddle : jointUpper;
+        if (CurrentDragType == DragType.None || altRotation)
+        {
+            var upperJoint = altRotation ? jointMiddle : jointUpper;
 
-                Porc(IK, ikCtrlData, ikChain[upperJoint], ikChain[jointMiddle], ikChain[jointLower]);
+            Porc(IK, ikCtrlData, ikChain[upperJoint], ikChain[jointMiddle], ikChain[jointLower]);
 
-                InitializeRotation();
-            }
+            InitializeRotation();
+        }
 
-            var mouseDelta = MouseDelta();
+        var mouseDelta = MouseDelta();
 
-            if (CurrentDragType == DragType.RotLocalY)
-            {
-                var joint = isMiddle ? jointUpper : jointLower;
+        if (CurrentDragType == DragType.RotLocalY)
+        {
+            var joint = isMiddle ? jointUpper : jointLower;
 
-                ikChain[joint].localRotation = jointRotation[joint];
-                ikChain[joint].Rotate(Vector3.right * (-mouseDelta.x / 1.5f));
-            }
+            ikChain[joint].localRotation = jointRotation[joint];
+            ikChain[joint].Rotate(Vector3.right * (-mouseDelta.x / 1.5f));
+        }
 
-            if (CurrentDragType == DragType.RotLocalXZ)
-            {
-                ikChain[jointLower].localRotation = jointRotation[jointLower];
-                ikChain[jointLower].Rotate(Vector3.up * (foot * mouseDelta.x / 1.5f));
-                ikChain[jointLower].Rotate(Vector3.forward * (foot * mouseDelta.y / 1.5f));
-            }
+        if (CurrentDragType == DragType.RotLocalXZ)
+        {
+            ikChain[jointLower].localRotation = jointRotation[jointLower];
+            ikChain[jointLower].Rotate(Vector3.up * (foot * mouseDelta.x / 1.5f));
+            ikChain[jointLower].Rotate(Vector3.forward * (foot * mouseDelta.y / 1.5f));
         }
     }
 }

+ 45 - 46
src/MeidoPhotoStudio.Plugin/Meido/IK/IK Chain/DragPointMune.cs

@@ -2,67 +2,66 @@ using UnityEngine;
 
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointMune : DragPointChain
 {
-    public class DragPointMune : DragPointChain
+    private bool isMuneL;
+    private int inv = 1;
+
+    public override void Set(Transform myObject)
     {
-        private bool isMuneL;
-        private int inv = 1;
+        base.Set(myObject);
 
-        public override void Set(Transform myObject)
-        {
-            base.Set(myObject);
+        isMuneL = myObject.name[5] == 'L'; // Mune_L_Sub
 
-            isMuneL = myObject.name[5] == 'L'; // Mune_L_Sub
+        if (isMuneL)
+            inv *= -1;
+    }
 
-            if (isMuneL)
-                inv *= -1;
-        }
+    protected override void ApplyDragType() =>
+        ApplyProperties(CurrentDragType != DragType.None, false, false);
 
-        protected override void ApplyDragType() =>
-            ApplyProperties(CurrentDragType != DragType.None, false, false);
+    protected override void OnMouseDown()
+    {
+        base.OnMouseDown();
 
-        protected override void OnMouseDown()
-        {
-            base.OnMouseDown();
+        meido.SetMune(false, isMuneL);
+    }
 
-            meido.SetMune(false, isMuneL);
-        }
+    protected override void OnDoubleClick()
+    {
+        if (CurrentDragType != DragType.None)
+            meido.SetMune(true, isMuneL);
+    }
 
-        protected override void OnDoubleClick()
-        {
-            if (CurrentDragType != DragType.None)
-                meido.SetMune(true, isMuneL);
-        }
+    protected override void UpdateDragType()
+    {
+        if (Input.Control && Input.Alt)
+            CurrentDragType = Input.Shift ? DragType.RotLocalY : DragType.RotLocalXZ;
+        else
+            CurrentDragType = DragType.None;
+    }
 
-        protected override void UpdateDragType()
+    protected override void Drag()
+    {
+        if (isPlaying)
+            meido.Stop = true;
+
+        if (CurrentDragType == DragType.RotLocalXZ)
         {
-            if (Input.Control && Input.Alt)
-                CurrentDragType = Input.Shift ? DragType.RotLocalY : DragType.RotLocalXZ;
-            else
-                CurrentDragType = DragType.None;
+            Porc(IK, ikCtrlData, ikChain[jointUpper], ikChain[jointMiddle], ikChain[jointLower]);
+            InitializeRotation();
         }
 
-        protected override void Drag()
+        if (CurrentDragType == DragType.RotLocalY)
         {
-            if (isPlaying)
-                meido.Stop = true;
-
-            if (CurrentDragType == DragType.RotLocalXZ)
-            {
-                Porc(IK, ikCtrlData, ikChain[jointUpper], ikChain[jointMiddle], ikChain[jointLower]);
-                InitializeRotation();
-            }
-
-            if (CurrentDragType == DragType.RotLocalY)
-            {
-                var mouseDelta = MouseDelta();
+            var mouseDelta = MouseDelta();
 
-                ikChain[jointLower].localRotation = jointRotation[jointLower];
-                // TODO: Reorder operands for better performance
-                ikChain[jointLower].Rotate(Vector3.up * (-mouseDelta.x / 1.5f) * inv);
-                ikChain[jointLower].Rotate(Vector3.forward * (mouseDelta.y / 1.5f) * inv);
-            }
+            ikChain[jointLower].localRotation = jointRotation[jointLower];
+            // TODO: Reorder operands for better performance
+            ikChain[jointLower].Rotate(Vector3.up * (-mouseDelta.x / 1.5f) * inv);
+            ikChain[jointLower].Rotate(Vector3.forward * (mouseDelta.y / 1.5f) * inv);
         }
     }
 }

File diff suppressed because it is too large
+ 655 - 656
src/MeidoPhotoStudio.Plugin/Meido/Meido.cs


File diff suppressed because it is too large
+ 638 - 639
src/MeidoPhotoStudio.Plugin/Meido/MeidoDragPointManager.cs


+ 408 - 409
src/MeidoPhotoStudio.Plugin/MeidoPhotoStudio.cs

@@ -7,486 +7,486 @@ using UnityEngine;
 using UnityEngine.SceneManagement;
 using Input = MeidoPhotoStudio.Plugin.InputManager;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
+[BepInDependency("org.bepinex.plugins.unityinjectorloader", BepInDependency.DependencyFlags.SoftDependency)]
+public class MeidoPhotoStudio : BaseUnityPlugin
 {
-    [BepInPlugin(pluginGuid, pluginName, pluginVersion)]
-    [BepInDependency("org.bepinex.plugins.unityinjectorloader", BepInDependency.DependencyFlags.SoftDependency)]
-    public class MeidoPhotoStudio : BaseUnityPlugin
+    public const string pluginName = "MeidoPhotoStudio";
+    public const string pluginVersion = "1.0.0";
+    public const string pluginSubVersion = "beta.4.1";
+    public const short sceneVersion = 2;
+    public const int kankyoMagic = -765;
+
+    private const string pluginGuid = "com.habeebweeb.com3d2.meidophotostudio";
+
+    public static readonly byte[] SceneHeader = Encoding.UTF8.GetBytes("MPSSCENE");
+    public static readonly string pluginString = $"{pluginName} {pluginVersion}";
+
+    public static bool EditMode =>
+        currentScene is Constants.Scene.Edit;
+
+    public static event EventHandler<ScreenshotEventArgs> NotifyRawScreenshot;
+
+    private static event EventHandler<ScreenshotEventArgs> ScreenshotEvent;
+    private static Constants.Scene currentScene;
+
+    private HarmonyLib.Harmony harmony;
+    private WindowManager windowManager;
+    private SceneManager sceneManager;
+    private MeidoManager meidoManager;
+    private EnvironmentManager environmentManager;
+    private MessageWindowManager messageWindowManager;
+    private LightManager lightManager;
+    private PropManager propManager;
+    private EffectManager effectManager;
+    private CameraManager cameraManager;
+    private bool initialized;
+    private bool active;
+    private bool uiActive;
+
+    static MeidoPhotoStudio()
     {
-        public const string pluginName = "MeidoPhotoStudio";
-        public const string pluginVersion = "1.0.0";
-        public const string pluginSubVersion = "beta.4.1";
-        public const short sceneVersion = 2;
-        public const int kankyoMagic = -765;
-
-        private const string pluginGuid = "com.habeebweeb.com3d2.meidophotostudio";
-
-        public static readonly byte[] SceneHeader = Encoding.UTF8.GetBytes("MPSSCENE");
-        public static readonly string pluginString = $"{pluginName} {pluginVersion}";
-
-        public static bool EditMode =>
-            currentScene is Constants.Scene.Edit;
-
-        public static event EventHandler<ScreenshotEventArgs> NotifyRawScreenshot;
-
-        private static event EventHandler<ScreenshotEventArgs> ScreenshotEvent;
-        private static Constants.Scene currentScene;
-
-        private HarmonyLib.Harmony harmony;
-        private WindowManager windowManager;
-        private SceneManager sceneManager;
-        private MeidoManager meidoManager;
-        private EnvironmentManager environmentManager;
-        private MessageWindowManager messageWindowManager;
-        private LightManager lightManager;
-        private PropManager propManager;
-        private EffectManager effectManager;
-        private CameraManager cameraManager;
-        private bool initialized;
-        private bool active;
-        private bool uiActive;
-
-        static MeidoPhotoStudio()
-        {
-            Input.Register(MpsKey.Screenshot, KeyCode.S, "Take screenshot");
-            Input.Register(MpsKey.Activate, KeyCode.F6, "Activate/deactivate MeidoPhotoStudio");
+        Input.Register(MpsKey.Screenshot, KeyCode.S, "Take screenshot");
+        Input.Register(MpsKey.Activate, KeyCode.F6, "Activate/deactivate MeidoPhotoStudio");
 
-            if (!string.IsNullOrEmpty(pluginSubVersion))
-                pluginString += $"-{pluginSubVersion}";
-        }
+        if (!string.IsNullOrEmpty(pluginSubVersion))
+            pluginString += $"-{pluginSubVersion}";
+    }
 
-        public static void TakeScreenshot(ScreenshotEventArgs args) =>
-            ScreenshotEvent?.Invoke(null, args);
+    public static void TakeScreenshot(ScreenshotEventArgs args) =>
+        ScreenshotEvent?.Invoke(null, args);
 
-        public static void TakeScreenshot(string path = "", int superSize = -1, bool hideMaids = false) =>
-            TakeScreenshot(new ScreenshotEventArgs() { Path = path, SuperSize = superSize, HideMaids = hideMaids });
+    public static void TakeScreenshot(string path = "", int superSize = -1, bool hideMaids = false) =>
+        TakeScreenshot(new ScreenshotEventArgs() { Path = path, SuperSize = superSize, HideMaids = hideMaids });
 
-        public byte[] SaveScene(bool environment = false)
-        {
-            if (meidoManager.Busy)
-                return null;
+    public byte[] SaveScene(bool environment = false)
+    {
+        if (meidoManager.Busy)
+            return null;
 
-            try
-            {
-                using var memoryStream = new MemoryStream();
-                using var headerWriter = new BinaryWriter(memoryStream, Encoding.UTF8);
+        try
+        {
+            using var memoryStream = new MemoryStream();
+            using var headerWriter = new BinaryWriter(memoryStream, Encoding.UTF8);
 
-                headerWriter.Write(SceneHeader);
+            headerWriter.Write(SceneHeader);
 
-                new SceneMetadata
-                {
-                    Version = sceneVersion,
-                    Environment = environment,
-                    MaidCount = environment ? kankyoMagic : meidoManager.ActiveMeidoList.Count,
-                    MMConverted = false,
-                }.WriteMetadata(headerWriter);
+            new SceneMetadata
+            {
+                Version = sceneVersion,
+                Environment = environment,
+                MaidCount = environment ? kankyoMagic : meidoManager.ActiveMeidoList.Count,
+                MMConverted = false,
+            }.WriteMetadata(headerWriter);
 
-                using var compressionStream = memoryStream.GetCompressionStream();
-                using var dataWriter = new BinaryWriter(compressionStream, Encoding.UTF8);
+            using var compressionStream = memoryStream.GetCompressionStream();
+            using var dataWriter = new BinaryWriter(compressionStream, Encoding.UTF8);
 
-                if (!environment)
-                {
-                    Serialization.Get<MeidoManager>().Serialize(meidoManager, dataWriter);
-                    Serialization.Get<MessageWindowManager>().Serialize(messageWindowManager, dataWriter);
-                    Serialization.Get<CameraManager>().Serialize(cameraManager, dataWriter);
-                }
+            if (!environment)
+            {
+                Serialization.Get<MeidoManager>().Serialize(meidoManager, dataWriter);
+                Serialization.Get<MessageWindowManager>().Serialize(messageWindowManager, dataWriter);
+                Serialization.Get<CameraManager>().Serialize(cameraManager, dataWriter);
+            }
 
-                Serialization.Get<LightManager>().Serialize(lightManager, dataWriter);
-                Serialization.Get<EffectManager>().Serialize(effectManager, dataWriter);
-                Serialization.Get<EnvironmentManager>().Serialize(environmentManager, dataWriter);
-                Serialization.Get<PropManager>().Serialize(propManager, dataWriter);
+            Serialization.Get<LightManager>().Serialize(lightManager, dataWriter);
+            Serialization.Get<EffectManager>().Serialize(effectManager, dataWriter);
+            Serialization.Get<EnvironmentManager>().Serialize(environmentManager, dataWriter);
+            Serialization.Get<PropManager>().Serialize(propManager, dataWriter);
 
-                dataWriter.Write("END");
+            dataWriter.Write("END");
 
-                compressionStream.Close();
+            compressionStream.Close();
 
-                var data = memoryStream.ToArray();
+            var data = memoryStream.ToArray();
 
-                return data;
-            }
-            catch (Exception e)
-            {
-                Utility.LogError($"Failed to save scene because {e.Message}\n{e.StackTrace}");
-                return null;
-            }
+            return data;
         }
+        catch (Exception e)
+        {
+            Utility.LogError($"Failed to save scene because {e.Message}\n{e.StackTrace}");
+            return null;
+        }
+    }
 
-        public void LoadScene(byte[] buffer)
+    public void LoadScene(byte[] buffer)
+    {
+        if (meidoManager.Busy)
         {
-            if (meidoManager.Busy)
-            {
-                Utility.LogMessage("Could not apply scene. Meidos are Busy");
-                return;
-            }
+            Utility.LogMessage("Could not apply scene. Meidos are Busy");
+            return;
+        }
 
-            using var memoryStream = new MemoryStream(buffer);
-            using var headerReader = new BinaryReader(memoryStream, Encoding.UTF8);
+        using var memoryStream = new MemoryStream(buffer);
+        using var headerReader = new BinaryReader(memoryStream, Encoding.UTF8);
 
-            if (!Utility.BytesEqual(headerReader.ReadBytes(SceneHeader.Length), SceneHeader))
-            {
-                Utility.LogError("Not a MPS scene!");
-                return;
-            }
+        if (!Utility.BytesEqual(headerReader.ReadBytes(SceneHeader.Length), SceneHeader))
+        {
+            Utility.LogError("Not a MPS scene!");
+            return;
+        }
 
-            var metadata = SceneMetadata.ReadMetadata(headerReader);
+        var metadata = SceneMetadata.ReadMetadata(headerReader);
 
-            if (metadata.Version > sceneVersion)
-            {
-                Utility.LogWarning("Cannot load scene. Scene is too new.");
-                Utility.LogWarning($"Your version: {sceneVersion}, Scene version: {metadata.Version}");
-                return;
-            }
+        if (metadata.Version > sceneVersion)
+        {
+            Utility.LogWarning("Cannot load scene. Scene is too new.");
+            Utility.LogWarning($"Your version: {sceneVersion}, Scene version: {metadata.Version}");
+            return;
+        }
 
-            using var uncompressed = memoryStream.Decompress();
-            using var dataReader = new BinaryReader(uncompressed, Encoding.UTF8);
+        using var uncompressed = memoryStream.Decompress();
+        using var dataReader = new BinaryReader(uncompressed, Encoding.UTF8);
 
-            var header = string.Empty;
-            var previousHeader = string.Empty;
+        var header = string.Empty;
+        var previousHeader = string.Empty;
 
-            try
+        try
+        {
+            while ((header = dataReader.ReadString()) is not "END")
             {
-                while ((header = dataReader.ReadString()) is not "END")
+                switch (header)
                 {
-                    switch (header)
-                    {
-                        case MeidoManager.header:
-                            Serialization.Get<MeidoManager>().Deserialize(meidoManager, dataReader, metadata);
-                            break;
-                        case MessageWindowManager.header:
-                            Serialization.Get<MessageWindowManager>().Deserialize(messageWindowManager, dataReader, metadata);
-                            break;
-                        case CameraManager.header:
-                            Serialization.Get<CameraManager>().Deserialize(cameraManager, dataReader, metadata);
-                            break;
-                        case LightManager.header:
-                            Serialization.Get<LightManager>().Deserialize(lightManager, dataReader, metadata);
-                            break;
-                        case EffectManager.header:
-                            Serialization.Get<EffectManager>().Deserialize(effectManager, dataReader, metadata);
-                            break;
-                        case EnvironmentManager.header:
-                            Serialization.Get<EnvironmentManager>().Deserialize(environmentManager, dataReader, metadata);
-                            break;
-                        case PropManager.header:
-                            Serialization.Get<PropManager>().Deserialize(propManager, dataReader, metadata);
-                            break;
-                        default: throw new Exception($"Unknown header '{header}'");
-                    }
-
-                    previousHeader = header;
+                    case MeidoManager.header:
+                        Serialization.Get<MeidoManager>().Deserialize(meidoManager, dataReader, metadata);
+                        break;
+                    case MessageWindowManager.header:
+                        Serialization.Get<MessageWindowManager>().Deserialize(messageWindowManager, dataReader, metadata);
+                        break;
+                    case CameraManager.header:
+                        Serialization.Get<CameraManager>().Deserialize(cameraManager, dataReader, metadata);
+                        break;
+                    case LightManager.header:
+                        Serialization.Get<LightManager>().Deserialize(lightManager, dataReader, metadata);
+                        break;
+                    case EffectManager.header:
+                        Serialization.Get<EffectManager>().Deserialize(effectManager, dataReader, metadata);
+                        break;
+                    case EnvironmentManager.header:
+                        Serialization.Get<EnvironmentManager>().Deserialize(environmentManager, dataReader, metadata);
+                        break;
+                    case PropManager.header:
+                        Serialization.Get<PropManager>().Deserialize(propManager, dataReader, metadata);
+                        break;
+                    default: throw new Exception($"Unknown header '{header}'");
                 }
+
+                previousHeader = header;
             }
-            catch (Exception e)
-            {
-                Utility.LogError(
+        }
+        catch (Exception e)
+        {
+            Utility.LogError(
                     $"Failed to deserialize scene because {e.Message}"
                     + $"\nCurrent header: '{header}'. Last header: '{previousHeader}'"
-                );
-                Utility.LogError(e.StackTrace);
-            }
+                    );
+            Utility.LogError(e.StackTrace);
         }
+    }
 
-        private void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) =>
-            currentScene = (Constants.Scene)scene.buildIndex;
+    private void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode) =>
+        currentScene = (Constants.Scene)scene.buildIndex;
 
-        private void OnSceneChanged(Scene current, Scene next)
-        {
-            if (active)
-                Deactivate(true);
+    private void OnSceneChanged(Scene current, Scene next)
+    {
+        if (active)
+            Deactivate(true);
 
-            CameraUtility.MainCamera.ResetCalcNearClip();
-        }
+        CameraUtility.MainCamera.ResetCalcNearClip();
+    }
 
-        private void OnScreenshotEvent(object sender, ScreenshotEventArgs args) =>
-            StartCoroutine(Screenshot(args));
+    private void OnScreenshotEvent(object sender, ScreenshotEventArgs args) =>
+        StartCoroutine(Screenshot(args));
 
-        private void Awake()
-        {
-            harmony = HarmonyLib.Harmony.CreateAndPatchAll(typeof(AllProcPropSeqStartPatcher));
-            harmony.PatchAll(typeof(BgMgrPatcher));
-            harmony.PatchAll(typeof(MeidoManager));
+    private void Awake()
+    {
+        harmony = HarmonyLib.Harmony.CreateAndPatchAll(typeof(AllProcPropSeqStartPatcher));
+        harmony.PatchAll(typeof(BgMgrPatcher));
+        harmony.PatchAll(typeof(MeidoManager));
 
-            ScreenshotEvent += OnScreenshotEvent;
+        ScreenshotEvent += OnScreenshotEvent;
 
-            DontDestroyOnLoad(this);
+        DontDestroyOnLoad(this);
 
-            UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
-            UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnSceneChanged;
-        }
+        UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
+        UnityEngine.SceneManagement.SceneManager.activeSceneChanged += OnSceneChanged;
+    }
 
-        private void Start()
-        {
-            Constants.Initialize();
-            Translation.Initialize(Translation.CurrentLanguage);
-        }
+    private void Start()
+    {
+        Constants.Initialize();
+        Translation.Initialize(Translation.CurrentLanguage);
+    }
 
-        private void Update()
+    private void Update()
+    {
+        if (currentScene is Constants.Scene.Daily or Constants.Scene.Edit)
         {
-            if (currentScene is Constants.Scene.Daily or Constants.Scene.Edit)
+            if (Input.GetKeyDown(MpsKey.Activate))
             {
-                if (Input.GetKeyDown(MpsKey.Activate))
-                {
-                    if (active)
-                        Deactivate();
-                    else
-                        Activate();
-                }
-
                 if (active)
-                {
-                    if (!Input.Control && !Input.GetKey(MpsKey.CameraLayer) && Input.GetKeyDown(MpsKey.Screenshot))
-                        TakeScreenshot();
-
-                    meidoManager.Update();
-                    cameraManager.Update();
-                    windowManager.Update();
-                    effectManager.Update();
-                    sceneManager.Update();
-                }
+                    Deactivate();
+                else
+                    Activate();
+            }
+
+            if (active)
+            {
+                if (!Input.Control && !Input.GetKey(MpsKey.CameraLayer) && Input.GetKeyDown(MpsKey.Screenshot))
+                    TakeScreenshot();
+
+                meidoManager.Update();
+                cameraManager.Update();
+                windowManager.Update();
+                effectManager.Update();
+                sceneManager.Update();
             }
         }
+    }
 
-        private IEnumerator Screenshot(ScreenshotEventArgs args)
+    private IEnumerator Screenshot(ScreenshotEventArgs args)
+    {
+        // Hide UI and dragpoints
+        var gameMain = GameMain.Instance.gameObject;
+        var editUI = UTY.GetChildObject(GameObject.Find("UI Root"), "Camera");
+        var fpsViewer = UTY.GetChildObject(gameMain, "SystemUI Root/FpsCounter");
+        var sysDialog = UTY.GetChildObject(gameMain, "SystemUI Root/SystemDialog");
+        var sysShortcut = UTY.GetChildObject(gameMain, "SystemUI Root/SystemShortcut");
+
+        // CameraUtility can hide the edit UI so keep its state for later
+        var editUIWasActive = editUI.activeSelf;
+
+        uiActive = false;
+        editUI.SetActive(false);
+        fpsViewer.SetActive(false);
+        sysDialog.SetActive(false);
+        sysShortcut.SetActive(false);
+
+        // Hide maid dragpoints and maids
+        var activeMeidoList = meidoManager.ActiveMeidoList;
+        var isIK = new bool[activeMeidoList.Count];
+        var isVisible = new bool[activeMeidoList.Count];
+
+        for (var i = 0; i < activeMeidoList.Count; i++)
         {
-            // Hide UI and dragpoints
-            var gameMain = GameMain.Instance.gameObject;
-            var editUI = UTY.GetChildObject(GameObject.Find("UI Root"), "Camera");
-            var fpsViewer = UTY.GetChildObject(gameMain, "SystemUI Root/FpsCounter");
-            var sysDialog = UTY.GetChildObject(gameMain, "SystemUI Root/SystemDialog");
-            var sysShortcut = UTY.GetChildObject(gameMain, "SystemUI Root/SystemShortcut");
-
-            // CameraUtility can hide the edit UI so keep its state for later
-            var editUIWasActive = editUI.activeSelf;
-
-            uiActive = false;
-            editUI.SetActive(false);
-            fpsViewer.SetActive(false);
-            sysDialog.SetActive(false);
-            sysShortcut.SetActive(false);
-
-            // Hide maid dragpoints and maids
-            var activeMeidoList = meidoManager.ActiveMeidoList;
-            var isIK = new bool[activeMeidoList.Count];
-            var isVisible = new bool[activeMeidoList.Count];
-
-            for (var i = 0; i < activeMeidoList.Count; i++)
-            {
-                var meido = activeMeidoList[i];
+            var meido = activeMeidoList[i];
 
-                isIK[i] = meido.IK;
+            isIK[i] = meido.IK;
 
-                if (meido.IK)
-                    meido.IK = false;
+            if (meido.IK)
+                meido.IK = false;
 
-                // Hide the maid if needed
-                if (args.HideMaids)
-                {
-                    isVisible[i] = meido.Maid.Visible;
-                    meido.Maid.Visible = false;
-                }
+            // Hide the maid if needed
+            if (args.HideMaids)
+            {
+                isVisible[i] = meido.Maid.Visible;
+                meido.Maid.Visible = false;
             }
+        }
 
-            // Hide other drag points
-            var isCubeActive = new[] {
-                MeidoDragPointManager.CubeActive,
+        // Hide other drag points
+        var isCubeActive = new[] {
+            MeidoDragPointManager.CubeActive,
                 PropManager.CubeActive,
                 LightManager.CubeActive,
                 EnvironmentManager.CubeActive
-            };
+        };
 
-            MeidoDragPointManager.CubeActive = false;
-            PropManager.CubeActive = false;
-            LightManager.CubeActive = false;
-            EnvironmentManager.CubeActive = false;
+        MeidoDragPointManager.CubeActive = false;
+        PropManager.CubeActive = false;
+        LightManager.CubeActive = false;
+        EnvironmentManager.CubeActive = false;
 
-            // hide gizmos
-            GizmoRender.UIVisible = false;
+        // hide gizmos
+        GizmoRender.UIVisible = false;
 
-            yield return new WaitForEndOfFrame();
+        yield return new WaitForEndOfFrame();
 
-            Texture2D rawScreenshot = null;
+        Texture2D rawScreenshot = null;
 
-            if (args.InMemory)
-            {
-                // Take a screenshot directly to a Texture2D for immediate processing
-                var renderTexture = new RenderTexture(Screen.width, Screen.height, 24);
+        if (args.InMemory)
+        {
+            // Take a screenshot directly to a Texture2D for immediate processing
+            var renderTexture = new RenderTexture(Screen.width, Screen.height, 24);
 
-                RenderTexture.active = renderTexture;
-                CameraUtility.MainCamera.camera.targetTexture = renderTexture;
-                CameraUtility.MainCamera.camera.Render();
+            RenderTexture.active = renderTexture;
+            CameraUtility.MainCamera.camera.targetTexture = renderTexture;
+            CameraUtility.MainCamera.camera.Render();
 
-                rawScreenshot = new(Screen.width, Screen.height, TextureFormat.RGB24, false);
-                rawScreenshot.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0, false);
-                rawScreenshot.Apply();
+            rawScreenshot = new(Screen.width, Screen.height, TextureFormat.RGB24, false);
+            rawScreenshot.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0, false);
+            rawScreenshot.Apply();
 
-                CameraUtility.MainCamera.camera.targetTexture = null;
-                RenderTexture.active = null;
-                DestroyImmediate(renderTexture);
-            }
-            else
-            {
-                // Take Screenshot
-                var defaultSuperSize = new[] { 1, 2, 4 };
-                var selectedSuperSize = args.SuperSize < 1
-                    ? defaultSuperSize[(int)GameMain.Instance.CMSystem.ScreenShotSuperSize]
-                    : args.SuperSize;
+            CameraUtility.MainCamera.camera.targetTexture = null;
+            RenderTexture.active = null;
+            DestroyImmediate(renderTexture);
+        }
+        else
+        {
+            // Take Screenshot
+            var defaultSuperSize = new[] { 1, 2, 4 };
+            var selectedSuperSize = args.SuperSize < 1
+                ? defaultSuperSize[(int)GameMain.Instance.CMSystem.ScreenShotSuperSize]
+                : args.SuperSize;
 
-                var path = string.IsNullOrEmpty(args.Path)
-                    ? Utility.ScreenshotFilename()
-                    : args.Path;
+            var path = string.IsNullOrEmpty(args.Path)
+                ? Utility.ScreenshotFilename()
+                : args.Path;
 
-                Application.CaptureScreenshot(path, selectedSuperSize);
-            }
+            Application.CaptureScreenshot(path, selectedSuperSize);
+        }
 
-            GameMain.Instance.SoundMgr.PlaySe("se022.ogg", false);
+        GameMain.Instance.SoundMgr.PlaySe("se022.ogg", false);
 
-            yield return new WaitForEndOfFrame();
+        yield return new WaitForEndOfFrame();
 
-            // Show UI and dragpoints
-            uiActive = true;
-            editUI.SetActive(editUIWasActive);
-            fpsViewer.SetActive(GameMain.Instance.CMSystem.ViewFps);
-            sysDialog.SetActive(true);
-            sysShortcut.SetActive(true);
+        // Show UI and dragpoints
+        uiActive = true;
+        editUI.SetActive(editUIWasActive);
+        fpsViewer.SetActive(GameMain.Instance.CMSystem.ViewFps);
+        sysDialog.SetActive(true);
+        sysShortcut.SetActive(true);
 
-            for (var i = 0; i < activeMeidoList.Count; i++)
-            {
-                var meido = activeMeidoList[i];
+        for (var i = 0; i < activeMeidoList.Count; i++)
+        {
+            var meido = activeMeidoList[i];
 
-                if (isIK[i])
-                    meido.IK = true;
-                if (args.HideMaids && isVisible[i])
-                    meido.Maid.Visible = true;
-            }
+            if (isIK[i])
+                meido.IK = true;
+            if (args.HideMaids && isVisible[i])
+                meido.Maid.Visible = true;
+        }
 
-            MeidoDragPointManager.CubeActive = isCubeActive[0];
-            PropManager.CubeActive = isCubeActive[1];
-            LightManager.CubeActive = isCubeActive[2];
-            EnvironmentManager.CubeActive = isCubeActive[3];
+        MeidoDragPointManager.CubeActive = isCubeActive[0];
+        PropManager.CubeActive = isCubeActive[1];
+        LightManager.CubeActive = isCubeActive[2];
+        EnvironmentManager.CubeActive = isCubeActive[3];
 
-            GizmoRender.UIVisible = true;
+        GizmoRender.UIVisible = true;
 
-            if (args.InMemory && rawScreenshot)
-                NotifyRawScreenshot?.Invoke(null, new() { Screenshot = rawScreenshot });
-        }
+        if (args.InMemory && rawScreenshot)
+            NotifyRawScreenshot?.Invoke(null, new() { Screenshot = rawScreenshot });
+    }
 
-        private void OnGUI()
+    private void OnGUI()
+    {
+        if (uiActive)
         {
-            if (uiActive)
-            {
-                windowManager.DrawWindows();
+            windowManager.DrawWindows();
 
-                if (DropdownHelper.Visible)
-                    DropdownHelper.HandleDropdown();
+            if (DropdownHelper.Visible)
+                DropdownHelper.HandleDropdown();
 
-                if (Modal.Visible)
-                    Modal.Draw();
-            }
+            if (Modal.Visible)
+                Modal.Draw();
         }
+    }
 
-        private void Initialize()
-        {
-            if (initialized)
-                return;
+    private void Initialize()
+    {
+        if (initialized)
+            return;
 
-            initialized = true;
+        initialized = true;
 
-            meidoManager = new();
-            environmentManager = new();
-            messageWindowManager = new();
-            messageWindowManager.Activate();
-            lightManager = new();
-            propManager = new(meidoManager);
-            sceneManager = new(this);
-            cameraManager = new();
+        meidoManager = new();
+        environmentManager = new();
+        messageWindowManager = new();
+        messageWindowManager.Activate();
+        lightManager = new();
+        propManager = new(meidoManager);
+        sceneManager = new(this);
+        cameraManager = new();
 
-            effectManager = new();
-            effectManager.AddManager<BloomEffectManager>();
-            effectManager.AddManager<DepthOfFieldEffectManager>();
-            effectManager.AddManager<FogEffectManager>();
-            effectManager.AddManager<VignetteEffectManager>();
-            effectManager.AddManager<SepiaToneEffectManger>();
-            effectManager.AddManager<BlurEffectManager>();
+        effectManager = new();
+        effectManager.AddManager<BloomEffectManager>();
+        effectManager.AddManager<DepthOfFieldEffectManager>();
+        effectManager.AddManager<FogEffectManager>();
+        effectManager.AddManager<VignetteEffectManager>();
+        effectManager.AddManager<SepiaToneEffectManger>();
+        effectManager.AddManager<BlurEffectManager>();
 
-            meidoManager.BeginCallMeidos += (s, a) => uiActive = false;
-            meidoManager.EndCallMeidos += (s, a) => uiActive = true;
+        meidoManager.BeginCallMeidos += (s, a) => uiActive = false;
+        meidoManager.EndCallMeidos += (s, a) => uiActive = true;
 
-            var maidSwitcherPane = new MaidSwitcherPane(meidoManager);
+        var maidSwitcherPane = new MaidSwitcherPane(meidoManager);
 
-            var sceneWindow = new SceneWindow(sceneManager);
+        var sceneWindow = new SceneWindow(sceneManager);
 
-            windowManager = new()
+        windowManager = new()
+        {
+            [Constants.Window.Main] = new MainWindow(meidoManager, propManager, lightManager)
             {
-                [Constants.Window.Main] = new MainWindow(meidoManager, propManager, lightManager)
-                {
-                    [Constants.Window.Call] = new CallWindowPane(meidoManager),
-                    [Constants.Window.Pose] = new PoseWindowPane(meidoManager, maidSwitcherPane),
-                    [Constants.Window.Face] = new FaceWindowPane(meidoManager, maidSwitcherPane),
-                    [Constants.Window.BG] = new BGWindowPane(
-                        environmentManager, lightManager, effectManager, sceneWindow, cameraManager
-                    ),
-                    [Constants.Window.BG2] = new BG2WindowPane(meidoManager, propManager),
-                    [Constants.Window.Settings] = new SettingsWindowPane()
-                },
-                [Constants.Window.Message] = new MessageWindow(messageWindowManager),
-                [Constants.Window.Save] = sceneWindow
-            };
-        }
+                [Constants.Window.Call] = new CallWindowPane(meidoManager),
+                [Constants.Window.Pose] = new PoseWindowPane(meidoManager, maidSwitcherPane),
+                [Constants.Window.Face] = new FaceWindowPane(meidoManager, maidSwitcherPane),
+                [Constants.Window.BG] = new BGWindowPane(
+                            environmentManager, lightManager, effectManager, sceneWindow, cameraManager
+                            ),
+                [Constants.Window.BG2] = new BG2WindowPane(meidoManager, propManager),
+                [Constants.Window.Settings] = new SettingsWindowPane()
+            },
+            [Constants.Window.Message] = new MessageWindow(messageWindowManager),
+            [Constants.Window.Save] = sceneWindow
+        };
+    }
 
-        private void Activate()
-        {
-            if (!GameMain.Instance.SysDlg.IsDecided)
-                return;
+    private void Activate()
+    {
+        if (!GameMain.Instance.SysDlg.IsDecided)
+            return;
 
-            if (!initialized)
-                Initialize();
-            else
-            {
-                meidoManager.Activate();
-                environmentManager.Activate();
-                cameraManager.Activate();
-                propManager.Activate();
-                lightManager.Activate();
-                effectManager.Activate();
-                messageWindowManager.Activate();
-                windowManager.Activate();
-            }
+        if (!initialized)
+            Initialize();
+        else
+        {
+            meidoManager.Activate();
+            environmentManager.Activate();
+            cameraManager.Activate();
+            propManager.Activate();
+            lightManager.Activate();
+            effectManager.Activate();
+            messageWindowManager.Activate();
+            windowManager.Activate();
+        }
 
-            uiActive = true;
-            active = true;
+        uiActive = true;
+        active = true;
 
-            if (!EditMode)
-            {
-                // TODO: Rework this to not use null propagation (UNT008)
-                var dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
+        if (!EditMode)
+        {
+            // TODO: Rework this to not use null propagation (UNT008)
+            var dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
 
-                if (dailyPanel)
-                    dailyPanel.SetActive(false);
-            }
-            else
-                meidoManager.CallMeidos();
+            if (dailyPanel)
+                dailyPanel.SetActive(false);
         }
+        else
+            meidoManager.CallMeidos();
+    }
 
-        private void Deactivate(bool force = false)
-        {
-            if (meidoManager.Busy || SceneManager.Busy)
-                return;
+    private void Deactivate(bool force = false)
+    {
+        if (meidoManager.Busy || SceneManager.Busy)
+            return;
 
-            var sysDialog = GameMain.Instance.SysDlg;
+        var sysDialog = GameMain.Instance.SysDlg;
 
-            if (!sysDialog.IsDecided && !force)
-                return;
+        if (!sysDialog.IsDecided && !force)
+            return;
 
-            uiActive = false;
-            active = false;
+        uiActive = false;
+        active = false;
 
-            if (force)
-            {
-                Exit();
-                return;
-            }
+        if (force)
+        {
+            Exit();
+            return;
+        }
 
-            sysDialog.Show(
+        sysDialog.Show(
                 string.Format(Translation.Get("systemMessage", "exitConfirm"), pluginName),
                 SystemDialog.TYPE.OK_CANCEL,
                 Exit,
@@ -496,45 +496,44 @@ namespace MeidoPhotoStudio.Plugin
                     uiActive = true;
                     active = true;
                 }
-            );
+                );
 
-            void Exit()
-            {
-                sysDialog.Close();
+        void Exit()
+        {
+            sysDialog.Close();
 
-                meidoManager.Deactivate();
-                environmentManager.Deactivate();
-                cameraManager.Deactivate();
-                propManager.Deactivate();
-                lightManager.Deactivate();
-                effectManager.Deactivate();
-                messageWindowManager.Deactivate();
-                windowManager.Deactivate();
-                Input.Deactivate();
+            meidoManager.Deactivate();
+            environmentManager.Deactivate();
+            cameraManager.Deactivate();
+            propManager.Deactivate();
+            lightManager.Deactivate();
+            effectManager.Deactivate();
+            messageWindowManager.Deactivate();
+            windowManager.Deactivate();
+            Input.Deactivate();
 
-                Modal.Close();
+            Modal.Close();
 
-                Configuration.Config.Save();
+            Configuration.Config.Save();
 
-                if (EditMode)
-                    return;
+            if (EditMode)
+                return;
 
-                // TODO: Rework this to not use null propagation (UNT008)
-                var dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
+            // TODO: Rework this to not use null propagation (UNT008)
+            var dailyPanel = GameObject.Find("UI Root")?.transform.Find("DailyPanel")?.gameObject;
 
-                // NOTE: using is (not) for null checks on UnityEngine.Object does not work
-                if (dailyPanel != null)
-                    dailyPanel.SetActive(true);
-            }
+            // NOTE: using is (not) for null checks on UnityEngine.Object does not work
+            if (dailyPanel != null)
+                dailyPanel.SetActive(true);
         }
     }
+}
 
-    public class ScreenshotEventArgs : EventArgs
-    {
-        public string Path { get; set; } = string.Empty;
-        public int SuperSize { get; set; } = -1;
-        public bool HideMaids { get; set; }
-        public bool InMemory { get; set; } = false;
-        public Texture2D Screenshot { get; set; }
-    }
+public class ScreenshotEventArgs : EventArgs
+{
+    public string Path { get; set; } = string.Empty;
+    public int SuperSize { get; set; } = -1;
+    public bool HideMaids { get; set; }
+    public bool InMemory { get; set; } = false;
+    public Texture2D Screenshot { get; set; }
 }

+ 44 - 46
src/MeidoPhotoStudio.Plugin/MenuFileCache.cs

@@ -5,73 +5,71 @@ using System.IO;
     All of this is pretty much stolen from COM3D2.CacheEditMenu. Thanks Mr. Horsington.
     https://git.coder.horse/ghorsington/COM3D2.CacheEditMenu
 */
-namespace MeidoPhotoStudio.Plugin
-{
+namespace MeidoPhotoStudio.Plugin;
 
-    public class MenuFileCache
-    {
-        private const int cacheVersion = 765;
+public class MenuFileCache
+{
+    private const int cacheVersion = 765;
 
-        public static readonly string cachePath = Path.Combine(Constants.configPath, "cache.dat");
+    public static readonly string cachePath = Path.Combine(Constants.configPath, "cache.dat");
 
-        private readonly Dictionary<string, ModItem> modItems;
+    private readonly Dictionary<string, ModItem> modItems;
 
-        private bool rebuild;
+    private bool rebuild;
 
-        public ModItem this[string menu]
+    public ModItem this[string menu]
+    {
+        get => modItems[menu];
+        set
         {
-            get => modItems[menu];
-            set
+            if (!modItems.ContainsKey(menu))
             {
-                if (!modItems.ContainsKey(menu))
-                {
-                    rebuild = true;
-                    modItems[menu] = value;
-                }
+                rebuild = true;
+                modItems[menu] = value;
             }
         }
+    }
 
-        public MenuFileCache()
-        {
-            modItems = new();
+    public MenuFileCache()
+    {
+        modItems = new();
 
-            if (File.Exists(cachePath))
-                Deserialize();
-        }
+        if (File.Exists(cachePath))
+            Deserialize();
+    }
 
-        public bool Has(string menuFileName) =>
-            modItems.ContainsKey(menuFileName);
+    public bool Has(string menuFileName) =>
+        modItems.ContainsKey(menuFileName);
 
-        public void Serialize()
-        {
-            if (!rebuild)
-                return;
+    public void Serialize()
+    {
+        if (!rebuild)
+            return;
 
-            using var binaryWriter = new BinaryWriter(File.OpenWrite(cachePath));
+        using var binaryWriter = new BinaryWriter(File.OpenWrite(cachePath));
 
-            binaryWriter.Write(cacheVersion);
+        binaryWriter.Write(cacheVersion);
 
-            foreach (var item in modItems.Values)
-                item.Serialize(binaryWriter);
-        }
+        foreach (var item in modItems.Values)
+            item.Serialize(binaryWriter);
+    }
 
-        private void Deserialize()
-        {
-            using var binaryReader = new BinaryReader(File.OpenRead(cachePath));
+    private void Deserialize()
+    {
+        using var binaryReader = new BinaryReader(File.OpenRead(cachePath));
 
-            if (binaryReader.ReadInt32() is not cacheVersion)
-            {
-                Utility.LogInfo("Cache version out of date. Rebuilding");
+        if (binaryReader.ReadInt32() is not cacheVersion)
+        {
+            Utility.LogInfo("Cache version out of date. Rebuilding");
 
-                return;
-            }
+            return;
+        }
 
-            while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
-            {
-                var item = ModItem.Deserialize(binaryReader);
+        while (binaryReader.BaseStream.Position < binaryReader.BaseStream.Length)
+        {
+            var item = ModItem.Deserialize(binaryReader);
 
-                modItems[item.MenuFile] = item;
-            }
+            modItems[item.MenuFile] = item;
         }
     }
 }

+ 194 - 195
src/MeidoPhotoStudio.Plugin/MenuFileUtility.cs

@@ -6,278 +6,277 @@ using System.Linq;
 using System.Text;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class MenuFileUtility
 {
-    public static class MenuFileUtility
+    public const string noCategory = "noCategory";
+
+    public static readonly string[] MenuCategories =
     {
-        public const string noCategory = "noCategory";
+        noCategory, "acchat", "headset", "wear", "skirt", "onepiece", "mizugi", "bra", "panz", "stkg", "shoes",
+        "acckami", "megane", "acchead", "acchana", "accmimi", "glove", "acckubi", "acckubiwa", "acckamisub",
+        "accnip", "accude", "accheso", "accashi", "accsenaka", "accshippo", "accxxx"
+    };
 
-        public static readonly string[] MenuCategories =
-        {
-            noCategory, "acchat", "headset", "wear", "skirt", "onepiece", "mizugi", "bra", "panz", "stkg", "shoes",
-            "acckami", "megane", "acchead", "acchana", "accmimi", "glove", "acckubi", "acckubiwa", "acckamisub",
-            "accnip", "accude", "accheso", "accashi", "accsenaka", "accshippo", "accxxx"
-        };
+    private static readonly HashSet<string> accMpn = new(StringComparer.InvariantCultureIgnoreCase);
 
-        private static readonly HashSet<string> accMpn = new(StringComparer.InvariantCultureIgnoreCase);
+    public static event EventHandler MenuFilesReadyChange;
+    public static bool MenuFilesReady { get; private set; }
 
-        public static event EventHandler MenuFilesReadyChange;
-        public static bool MenuFilesReady { get; private set; }
+    private static byte[] fileBuffer;
 
-        private static byte[] fileBuffer;
+    static MenuFileUtility()
+    {
+        accMpn.UnionWith(MenuCategories.Skip(1));
+        GameMain.Instance.StartCoroutine(CheckMenuDataBaseJob());
+    }
 
-        static MenuFileUtility()
-        {
-            accMpn.UnionWith(MenuCategories.Skip(1));
-            GameMain.Instance.StartCoroutine(CheckMenuDataBaseJob());
-        }
+    public static byte[] ReadAFileBase(string filename)
+    {
+        using var aFileBase = GameUty.FileOpen(filename);
 
-        public static byte[] ReadAFileBase(string filename)
+        if (!aFileBase.IsValid() || aFileBase.GetSize() is 0)
         {
-            using var aFileBase = GameUty.FileOpen(filename);
+            Utility.LogError($"AFileBase '{filename}' is invalid");
 
-            if (!aFileBase.IsValid() || aFileBase.GetSize() is 0)
-            {
-                Utility.LogError($"AFileBase '{filename}' is invalid");
+            return null;
+        }
 
-                return null;
-            }
+        ref var buffer = ref GetFileBuffer(aFileBase.GetSize());
 
-            ref var buffer = ref GetFileBuffer(aFileBase.GetSize());
+        aFileBase.Read(ref buffer, aFileBase.GetSize());
 
-            aFileBase.Read(ref buffer, aFileBase.GetSize());
+        return buffer;
+    }
 
-            return buffer;
-        }
+    public static byte[] ReadOfficialMod(string filename)
+    {
+        using var fileStream = new FileStream(filename, FileMode.Open);
 
-        public static byte[] ReadOfficialMod(string filename)
+        if (fileStream.Length is 0)
         {
-            using var fileStream = new FileStream(filename, FileMode.Open);
+            Utility.LogWarning($"Mod menu file '{filename}' is invalid");
+            return null;
+        }
 
-            if (fileStream.Length is 0)
-            {
-                Utility.LogWarning($"Mod menu file '{filename}' is invalid");
-                return null;
-            }
+        ref var buffer = ref GetFileBuffer(fileStream.Length);
 
-            ref var buffer = ref GetFileBuffer(fileStream.Length);
+        fileStream.Read(buffer, 0, (int)fileStream.Length);
 
-            fileStream.Read(buffer, 0, (int)fileStream.Length);
+        return buffer;
+    }
 
-            return buffer;
-        }
+    public static bool ParseNativeMenuFile(int menuIndex, ModItem modItem)
+    {
+        var menuDataBase = GameMain.Instance.MenuDataBase;
+        menuDataBase.SetIndex(menuIndex);
 
-        public static bool ParseNativeMenuFile(int menuIndex, ModItem modItem)
-        {
-            var menuDataBase = GameMain.Instance.MenuDataBase;
-            menuDataBase.SetIndex(menuIndex);
+        if (menuDataBase.GetBoDelOnly())
+            return false;
 
-            if (menuDataBase.GetBoDelOnly())
-                return false;
+        modItem.Category = menuDataBase.GetCategoryMpnText();
 
-            modItem.Category = menuDataBase.GetCategoryMpnText();
+        if (!accMpn.Contains(modItem.Category))
+            return false;
 
-            if (!accMpn.Contains(modItem.Category))
-                return false;
+        modItem.MenuFile = menuDataBase.GetMenuFileName().ToLower();
 
-            modItem.MenuFile = menuDataBase.GetMenuFileName().ToLower();
+        if (!ValidBG2MenuFile(modItem.MenuFile))
+            return false;
 
-            if (!ValidBG2MenuFile(modItem.MenuFile))
-                return false;
+        modItem.Name = menuDataBase.GetMenuName();
+        modItem.IconFile = menuDataBase.GetIconS();
+        modItem.Priority = menuDataBase.GetPriority();
+
+        return true;
+    }
 
-            modItem.Name = menuDataBase.GetMenuName();
-            modItem.IconFile = menuDataBase.GetIconS();
-            modItem.Priority = menuDataBase.GetPriority();
+    public static void ParseMenuFile(string menuFile, ModItem modItem)
+    {
+        if (!ValidBG2MenuFile(menuFile))
+            return;
 
-            return true;
-        }
+        byte[] buffer;
 
-        public static void ParseMenuFile(string menuFile, ModItem modItem)
+        try
         {
-            if (!ValidBG2MenuFile(menuFile))
-                return;
+            buffer = ReadAFileBase(menuFile);
+        }
+        catch (Exception e)
+        {
+            Utility.LogError($"Could not read menu file '{menuFile}' because {e.Message}");
 
-            byte[] buffer;
+            return;
+        }
 
-            try
-            {
-                buffer = ReadAFileBase(menuFile);
-            }
-            catch (Exception e)
-            {
-                Utility.LogError($"Could not read menu file '{menuFile}' because {e.Message}");
+        try
+        {
+            using var binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
 
+            if (binaryReader.ReadString() is not "CM3D2_MENU")
                 return;
-            }
 
-            try
-            {
-                using var binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8);
-
-                if (binaryReader.ReadString() is not "CM3D2_MENU")
-                    return;
-
-                binaryReader.ReadInt32(); // file version
-                binaryReader.ReadString(); // txt path
-                modItem.Name = binaryReader.ReadString(); // name
-                binaryReader.ReadString(); // category
-                binaryReader.ReadString(); // description
-                binaryReader.ReadInt32(); // idk (as long)
+            binaryReader.ReadInt32(); // file version
+            binaryReader.ReadString(); // txt path
+            modItem.Name = binaryReader.ReadString(); // name
+            binaryReader.ReadString(); // category
+            binaryReader.ReadString(); // description
+            binaryReader.ReadInt32(); // idk (as long)
 
-                while (true)
-                {
-                    var numberOfProps = binaryReader.ReadByte();
-                    var menuPropString = string.Empty;
+            while (true)
+            {
+                var numberOfProps = binaryReader.ReadByte();
+                var menuPropString = string.Empty;
 
-                    if (numberOfProps is 0)
-                        break;
+                if (numberOfProps is 0)
+                    break;
 
-                    for (var i = 0; i < numberOfProps; i++)
-                        menuPropString = $"{menuPropString}\"{binaryReader.ReadString()}\"";
+                for (var i = 0; i < numberOfProps; i++)
+                    menuPropString = $"{menuPropString}\"{binaryReader.ReadString()}\"";
 
-                    if (string.IsNullOrEmpty(menuPropString))
-                        continue;
+                if (string.IsNullOrEmpty(menuPropString))
+                    continue;
 
-                    var header = UTY.GetStringCom(menuPropString);
-                    var menuProps = UTY.GetStringList(menuPropString);
+                var header = UTY.GetStringCom(menuPropString);
+                var menuProps = UTY.GetStringList(menuPropString);
 
-                    if (header is "end")
-                        break;
+                if (header is "end")
+                    break;
 
-                    if (header is "category")
-                    {
-                        modItem.Category = menuProps[1];
+                if (header is "category")
+                {
+                    modItem.Category = menuProps[1];
 
-                        if (!accMpn.Contains(modItem.Category))
-                            return;
-                    }
-                    else if (header is "icons" or "icon")
-                    {
-                        modItem.IconFile = menuProps[1];
+                    if (!accMpn.Contains(modItem.Category))
+                        return;
+                }
+                else if (header is "icons" or "icon")
+                {
+                    modItem.IconFile = menuProps[1];
 
-                        break;
-                    }
-                    else if (header is "priority")
-                        modItem.Priority = float.Parse(menuProps[1]);
+                    break;
                 }
-            }
-            catch (Exception e)
-            {
-                Utility.LogWarning($"Could not parse menu file '{menuFile}' because {e.Message}");
+                else if (header is "priority")
+                    modItem.Priority = float.Parse(menuProps[1]);
             }
         }
-
-        public static bool ParseModMenuFile(string modMenuFile, ModItem modItem)
+        catch (Exception e)
         {
-            if (!ValidBG2MenuFile(modMenuFile))
-                return false;
+            Utility.LogWarning($"Could not parse menu file '{menuFile}' because {e.Message}");
+        }
+    }
 
-            byte[] modBuffer;
+    public static bool ParseModMenuFile(string modMenuFile, ModItem modItem)
+    {
+        if (!ValidBG2MenuFile(modMenuFile))
+            return false;
 
-            try
-            {
-                modBuffer = ReadOfficialMod(modMenuFile);
-            }
-            catch (Exception e)
-            {
-                Utility.LogError($"Could not read mod menu file '{modMenuFile} because {e.Message}'");
-                return false;
-            }
+        byte[] modBuffer;
 
-            try
-            {
-                using var binaryReader = new BinaryReader(new MemoryStream(modBuffer), Encoding.UTF8);
+        try
+        {
+            modBuffer = ReadOfficialMod(modMenuFile);
+        }
+        catch (Exception e)
+        {
+            Utility.LogError($"Could not read mod menu file '{modMenuFile} because {e.Message}'");
+            return false;
+        }
 
-                if (binaryReader.ReadString() is not "CM3D2_MOD")
-                    return false;
+        try
+        {
+            using var binaryReader = new BinaryReader(new MemoryStream(modBuffer), Encoding.UTF8);
 
-                binaryReader.ReadInt32();
+            if (binaryReader.ReadString() is not "CM3D2_MOD")
+                return false;
 
-                var iconName = binaryReader.ReadString();
-                var baseItemPath = binaryReader.ReadString().Replace(":", " ");
+            binaryReader.ReadInt32();
 
-                modItem.BaseMenuFile = Path.GetFileName(baseItemPath);
-                modItem.Name = binaryReader.ReadString();
-                modItem.Category = binaryReader.ReadString();
+            var iconName = binaryReader.ReadString();
+            var baseItemPath = binaryReader.ReadString().Replace(":", " ");
 
-                if (!accMpn.Contains(modItem.Category))
-                    return false;
+            modItem.BaseMenuFile = Path.GetFileName(baseItemPath);
+            modItem.Name = binaryReader.ReadString();
+            modItem.Category = binaryReader.ReadString();
 
-                binaryReader.ReadString();
+            if (!accMpn.Contains(modItem.Category))
+                return false;
 
-                var mpnValue = binaryReader.ReadString();
-                var mpn = MPN.null_mpn;
+            binaryReader.ReadString();
 
-                try
-                {
-                    mpn = (MPN)Enum.Parse(typeof(MPN), mpnValue, true);
-                }
-                catch { /* ignored */ }
+            var mpnValue = binaryReader.ReadString();
+            var mpn = MPN.null_mpn;
 
-                if (mpn is not MPN.null_mpn)
-                    binaryReader.ReadString();
+            try
+            {
+                mpn = (MPN)Enum.Parse(typeof(MPN), mpnValue, true);
+            }
+            catch { /* ignored */ }
 
+            if (mpn is not MPN.null_mpn)
                 binaryReader.ReadString();
 
-                var entryCount = binaryReader.ReadInt32();
+            binaryReader.ReadString();
 
-                for (var i = 0; i < entryCount; i++)
-                {
-                    var key = binaryReader.ReadString();
-                    var count = binaryReader.ReadInt32();
-                    var data = binaryReader.ReadBytes(count);
+            var entryCount = binaryReader.ReadInt32();
 
-                    if (!string.Equals(key, iconName, StringComparison.InvariantCultureIgnoreCase))
-                        continue;
+            for (var i = 0; i < entryCount; i++)
+            {
+                var key = binaryReader.ReadString();
+                var count = binaryReader.ReadInt32();
+                var data = binaryReader.ReadBytes(count);
 
-                    var tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
+                if (!string.Equals(key, iconName, StringComparison.InvariantCultureIgnoreCase))
+                    continue;
 
-                    tex.LoadImage(data);
-                    modItem.Icon = tex;
+                var tex = new Texture2D(1, 1, TextureFormat.RGBA32, false);
 
-                    break;
-                }
-            }
-            catch (Exception e)
-            {
-                Utility.LogWarning($"Could not parse mod menu file '{modMenuFile}' because {e}");
-                return false;
-            }
+                tex.LoadImage(data);
+                modItem.Icon = tex;
 
-            return true;
+                break;
+            }
+        }
+        catch (Exception e)
+        {
+            Utility.LogWarning($"Could not parse mod menu file '{modMenuFile}' because {e}");
+            return false;
         }
 
-        public static bool ValidBG2MenuFile(ModItem modItem) =>
-            accMpn.Contains(modItem.Category) && ValidBG2MenuFile(modItem.MenuFile);
+        return true;
+    }
 
-        public static bool ValidBG2MenuFile(string menu)
-        {
-            menu = Path.GetFileNameWithoutExtension(menu).ToLower();
+    public static bool ValidBG2MenuFile(ModItem modItem) =>
+        accMpn.Contains(modItem.Category) && ValidBG2MenuFile(modItem.MenuFile);
 
-            return !(menu.EndsWith("_del") || menu.Contains("zurashi") || menu.Contains("mekure")
-                || menu.Contains("porori") || menu.Contains("moza") || menu.Contains("folder"));
-        }
+    public static bool ValidBG2MenuFile(string menu)
+    {
+        menu = Path.GetFileNameWithoutExtension(menu).ToLower();
 
-        private static IEnumerator CheckMenuDataBaseJob()
-        {
-            if (MenuFilesReady)
-                yield break;
+        return !(menu.EndsWith("_del") || menu.Contains("zurashi") || menu.Contains("mekure")
+            || menu.Contains("porori") || menu.Contains("moza") || menu.Contains("folder"));
+    }
 
-            while (!GameMain.Instance.MenuDataBase.JobFinished())
-                yield return null;
+    private static IEnumerator CheckMenuDataBaseJob()
+    {
+        if (MenuFilesReady)
+            yield break;
 
-            MenuFilesReady = true;
-            MenuFilesReadyChange?.Invoke(null, EventArgs.Empty);
-        }
+        while (!GameMain.Instance.MenuDataBase.JobFinished())
+            yield return null;
 
-        private static ref byte[] GetFileBuffer(long size)
-        {
-            if (fileBuffer is null)
-                fileBuffer = new byte[Math.Max(500000, size)];
-            else if (fileBuffer.Length < size)
-                fileBuffer = new byte[size];
+        MenuFilesReady = true;
+        MenuFilesReadyChange?.Invoke(null, EventArgs.Empty);
+    }
 
-            return ref fileBuffer;
-        }
+    private static ref byte[] GetFileBuffer(long size)
+    {
+        if (fileBuffer is null)
+            fileBuffer = new byte[Math.Max(500000, size)];
+        else if (fileBuffer.Length < size)
+            fileBuffer = new byte[size];
+
+        return ref fileBuffer;
     }
 }

+ 65 - 67
src/MeidoPhotoStudio.Plugin/MenuItem.cs

@@ -2,84 +2,82 @@ using System.Globalization;
 using System.IO;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public abstract class MenuItem
-    {
-        public string IconFile { get; set; }
-        public Texture2D Icon { get; set; }
-    }
+namespace MeidoPhotoStudio.Plugin;
 
-    public class ModItem : MenuItem
-    {
-        public string MenuFile { get; set; }
-        public string BaseMenuFile { get; set; }
-        public string Name { get; set; }
-        public string Category { get; set; }
-        public float Priority { get; set; }
-        public bool IsMod { get; private set; }
-        public bool IsOfficialMod { get; private set; }
+public abstract class MenuItem
+{
+    public string IconFile { get; set; }
+    public Texture2D Icon { get; set; }
+}
 
-        public static ModItem OfficialMod(string menuFile) =>
-            new()
-            {
-                MenuFile = menuFile,
-                IsMod = true,
-                IsOfficialMod = true,
-                Priority = 1000f
-            };
+public class ModItem : MenuItem
+{
+    public string MenuFile { get; set; }
+    public string BaseMenuFile { get; set; }
+    public string Name { get; set; }
+    public string Category { get; set; }
+    public float Priority { get; set; }
+    public bool IsMod { get; private set; }
+    public bool IsOfficialMod { get; private set; }
 
-        public static ModItem Mod(string menuFile) =>
-            new()
-            {
-                MenuFile = menuFile,
-                IsMod = true
-            };
+    public static ModItem OfficialMod(string menuFile) =>
+        new()
+        {
+            MenuFile = menuFile,
+            IsMod = true,
+            IsOfficialMod = true,
+            Priority = 1000f
+        };
 
-        public static ModItem Deserialize(BinaryReader binaryReader) =>
-            new()
-            {
-                MenuFile = binaryReader.ReadNullableString(),
-                BaseMenuFile = binaryReader.ReadNullableString(),
-                IconFile = binaryReader.ReadNullableString(),
-                Name = binaryReader.ReadNullableString(),
-                Category = binaryReader.ReadNullableString(),
-                Priority = float.Parse(binaryReader.ReadNullableString()),
-                IsMod = binaryReader.ReadBoolean(),
-                IsOfficialMod = binaryReader.ReadBoolean()
-            };
+    public static ModItem Mod(string menuFile) =>
+        new()
+        {
+            MenuFile = menuFile,
+            IsMod = true
+        };
 
+    public static ModItem Deserialize(BinaryReader binaryReader) =>
+        new()
+        {
+            MenuFile = binaryReader.ReadNullableString(),
+            BaseMenuFile = binaryReader.ReadNullableString(),
+            IconFile = binaryReader.ReadNullableString(),
+            Name = binaryReader.ReadNullableString(),
+            Category = binaryReader.ReadNullableString(),
+            Priority = float.Parse(binaryReader.ReadNullableString()),
+            IsMod = binaryReader.ReadBoolean(),
+            IsOfficialMod = binaryReader.ReadBoolean()
+        };
 
-        public ModItem() { }
+    public ModItem() { }
 
-        public ModItem(string menuFile) =>
-            MenuFile = menuFile;
+    public ModItem(string menuFile) =>
+        MenuFile = menuFile;
 
-        public override string ToString() =>
-            IsOfficialMod ? $"{Path.GetFileName(MenuFile)}#{BaseMenuFile}" : MenuFile;
+    public override string ToString() =>
+        IsOfficialMod ? $"{Path.GetFileName(MenuFile)}#{BaseMenuFile}" : MenuFile;
 
-        public void Serialize(BinaryWriter binaryWriter)
-        {
-            if (IsOfficialMod)
-                return;
+    public void Serialize(BinaryWriter binaryWriter)
+    {
+        if (IsOfficialMod)
+            return;
 
-            binaryWriter.WriteNullableString(MenuFile);
-            binaryWriter.WriteNullableString(BaseMenuFile);
-            binaryWriter.WriteNullableString(IconFile);
-            binaryWriter.WriteNullableString(Name);
-            binaryWriter.WriteNullableString(Category);
-            binaryWriter.WriteNullableString(Priority.ToString(CultureInfo.InvariantCulture));
-            binaryWriter.Write(IsMod);
-            binaryWriter.Write(IsOfficialMod);
-        }
+        binaryWriter.WriteNullableString(MenuFile);
+        binaryWriter.WriteNullableString(BaseMenuFile);
+        binaryWriter.WriteNullableString(IconFile);
+        binaryWriter.WriteNullableString(Name);
+        binaryWriter.WriteNullableString(Category);
+        binaryWriter.WriteNullableString(Priority.ToString(CultureInfo.InvariantCulture));
+        binaryWriter.Write(IsMod);
+        binaryWriter.Write(IsOfficialMod);
     }
+}
 
-    public class MyRoomItem : MenuItem
-    {
-        public int ID { get; set; }
-        public string PrefabName { get; set; }
+public class MyRoomItem : MenuItem
+{
+    public int ID { get; set; }
+    public string PrefabName { get; set; }
 
-        public override string ToString() =>
-            $"MYR_{ID}#{PrefabName}";
-    }
+    public override string ToString() =>
+        $"MYR_{ID}#{PrefabName}";
 }

File diff suppressed because it is too large
+ 445 - 446
src/MeidoPhotoStudio.Plugin/ModelUtility.cs


+ 102 - 103
src/MeidoPhotoStudio.Plugin/MyGui.cs

@@ -1,111 +1,110 @@
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class MpsGui
 {
-    public static class MpsGui
+    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));
+    public static readonly GUIStyle SliderLabelStyle;
+    public static readonly GUIStyle SliderStyle;
+    public static readonly GUIStyle SliderStyleNoLabel;
+    public static readonly GUIStyle SliderTextBoxStyle;
+    public static readonly GUIStyle SliderThumbStyle;
+    public static readonly GUIStyle SliderResetButtonStyle;
+
+    private static readonly GUIStyle lineStyleWhite;
+    private static readonly GUIStyle lineStyleBlack;
+    private static readonly GUIStyle textureBoxStyle;
+    private static readonly GUIStyle headerLabelStyle;
+
+    static MpsGui()
     {
-        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));
-        public static readonly GUIStyle SliderLabelStyle;
-        public static readonly GUIStyle SliderStyle;
-        public static readonly GUIStyle SliderStyleNoLabel;
-        public static readonly GUIStyle SliderTextBoxStyle;
-        public static readonly GUIStyle SliderThumbStyle;
-        public static readonly GUIStyle SliderResetButtonStyle;
-
-        private static readonly GUIStyle lineStyleWhite;
-        private static readonly GUIStyle lineStyleBlack;
-        private static readonly GUIStyle textureBoxStyle;
-        private static readonly GUIStyle headerLabelStyle;
-
-        static MpsGui()
+        GUI.skin = null;
+
+        lineStyleWhite = new(GUI.skin.box)
+        {
+            margin = new(0, 0, 8, 8),
+            normal = {
+                background = Utility.MakeTex(2, 2, new(1f, 1f, 1f, 0.2f)),
+            },
+        };
+
+        lineStyleWhite.padding = lineStyleWhite.border = new(0, 0, 1, 1);
+
+        lineStyleBlack = new(lineStyleWhite)
+        {
+            normal = {
+                background = Utility.MakeTex(2, 2, new(0f, 0f, 0f, 0.3f)),
+            },
+        };
+
+        textureBoxStyle = new(GUI.skin.box)
+        {
+            normal = {
+                background = Utility.MakeTex(2, 2, new(0f, 0f, 0f, 0f)),
+            },
+        };
+
+        textureBoxStyle.padding = textureBoxStyle.margin = new(0, 0, 0, 0);
+
+        headerLabelStyle = new(GUI.skin.label)
+        {
+            padding = new(7, 0, 0, -5),
+            normal = {
+                textColor = Color.white,
+            },
+            fontSize = 14,
+        };
+
+        SliderLabelStyle = new(GUI.skin.label)
+        {
+            alignment = TextAnchor.LowerLeft,
+            fontSize = 13,
+            normal = {
+                textColor = Color.white,
+            },
+        };
+
+        SliderStyle = new(GUI.skin.horizontalSlider);
+        SliderStyleNoLabel = new(SliderStyle)
         {
-            GUI.skin = null;
-
-            lineStyleWhite = new(GUI.skin.box)
-            {
-                margin = new(0, 0, 8, 8),
-                normal = {
-                    background = Utility.MakeTex(2, 2, new(1f, 1f, 1f, 0.2f)),
-                },
-            };
-
-            lineStyleWhite.padding = lineStyleWhite.border = new(0, 0, 1, 1);
-
-            lineStyleBlack = new(lineStyleWhite)
-            {
-                normal = {
-                    background = Utility.MakeTex(2, 2, new(0f, 0f, 0f, 0.3f)),
-                },
-            };
-
-            textureBoxStyle = new(GUI.skin.box)
-            {
-                normal = {
-                    background = Utility.MakeTex(2, 2, new(0f, 0f, 0f, 0f)),
-                },
-            };
-
-            textureBoxStyle.padding = textureBoxStyle.margin = new(0, 0, 0, 0);
-
-            headerLabelStyle = new(GUI.skin.label)
-            {
-                padding = new(7, 0, 0, -5),
-                normal = {
-                    textColor = Color.white,
-                },
-                fontSize = 14,
-            };
-
-            SliderLabelStyle = new(GUI.skin.label)
-            {
-                alignment = TextAnchor.LowerLeft,
-                fontSize = 13,
-                normal = {
-                    textColor = Color.white,
-                },
-            };
-
-            SliderStyle = new(GUI.skin.horizontalSlider);
-            SliderStyleNoLabel = new(SliderStyle)
-            {
-                margin = {
-                    top = 10,
-                },
-            };
-
-            SliderTextBoxStyle = new(GUI.skin.textField)
-            {
-                fontSize = 12,
-            };
-
-            SliderResetButtonStyle = new(GUI.skin.button)
-            {
-                alignment = TextAnchor.MiddleRight,
-                fontSize = 10,
-            };
-
-            SliderThumbStyle = new(GUI.skin.horizontalSliderThumb);
-        }
-
-        public static void WhiteLine() =>
-            Line(lineStyleWhite);
-
-        public static void BlackLine() =>
-            Line(lineStyleBlack);
-
-        public static void DrawTexture(Texture texture, params GUILayoutOption[] layoutOptions) =>
-            GUILayout.Box(texture, textureBoxStyle, layoutOptions);
-
-        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) =>
-            GUILayout.Label(text, headerLabelStyle, layoutOptions);
-
-        private static void Line(GUIStyle style) =>
-            GUILayout.Box(GUIContent.none, style, GUILayout.Height(1));
+            margin = {
+                top = 10,
+            },
+        };
 
+        SliderTextBoxStyle = new(GUI.skin.textField)
+        {
+            fontSize = 12,
+        };
+
+        SliderResetButtonStyle = new(GUI.skin.button)
+        {
+            alignment = TextAnchor.MiddleRight,
+            fontSize = 10,
+        };
+
+        SliderThumbStyle = new(GUI.skin.horizontalSliderThumb);
     }
+
+    public static void WhiteLine() =>
+        Line(lineStyleWhite);
+
+    public static void BlackLine() =>
+        Line(lineStyleBlack);
+
+    public static void DrawTexture(Texture texture, params GUILayoutOption[] layoutOptions) =>
+        GUILayout.Box(texture, textureBoxStyle, layoutOptions);
+
+    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) =>
+        GUILayout.Label(text, headerLabelStyle, layoutOptions);
+
+    private static void Line(GUIStyle style) =>
+        GUILayout.Box(GUIContent.none, style, GUILayout.Height(1));
+
 }

+ 15 - 16
src/MeidoPhotoStudio.Plugin/Patchers/AllProcPropSeqStartPatcher.cs

@@ -1,24 +1,23 @@
 using System;
 using HarmonyLib;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+//
+// TODO: Extend this further to potentially reduce the need for coroutines that wait for maid proc state
+public static class AllProcPropSeqStartPatcher
 {
-    // TODO: Extend this further to potentially reduce the need for coroutines that wait for maid proc state
-    public static class AllProcPropSeqStartPatcher
-    {
-        public static event EventHandler<ProcStartEventArgs> SequenceStart;
+    public static event EventHandler<ProcStartEventArgs> SequenceStart;
 
-        [HarmonyPatch(typeof(Maid), nameof(Maid.AllProcPropSeqStart))]
-        [HarmonyPostfix]
-        private static void NotifyProcStart(Maid __instance) =>
-            SequenceStart?.Invoke(null, new ProcStartEventArgs(__instance));
-    }
+    [HarmonyPatch(typeof(Maid), nameof(Maid.AllProcPropSeqStart))]
+    [HarmonyPostfix]
+    private static void NotifyProcStart(Maid __instance) =>
+        SequenceStart?.Invoke(null, new ProcStartEventArgs(__instance));
+}
 
-    public class ProcStartEventArgs : EventArgs
-    {
-        public readonly Maid maid;
+public class ProcStartEventArgs : EventArgs
+{
+    public readonly Maid maid;
 
-        public ProcStartEventArgs(Maid maid) =>
-            this.maid = maid;
-    }
+    public ProcStartEventArgs(Maid maid) =>
+        this.maid = maid;
 }

+ 15 - 16
src/MeidoPhotoStudio.Plugin/Patchers/BgMgrPatcher.cs

@@ -1,23 +1,22 @@
 using System;
 using HarmonyLib;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class BgMgrPatcher
 {
-    public static class BgMgrPatcher
-    {
-        public static event EventHandler ChangeBgBegin;
-        public static event EventHandler ChangeBgEnd;
+    public static event EventHandler ChangeBgBegin;
+    public static event EventHandler ChangeBgEnd;
 
-        [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
-        [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
-        [HarmonyPrefix]
-        private static void NotifyBeginChangeBg() =>
-            ChangeBgBegin?.Invoke(null, EventArgs.Empty);
+    [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
+    [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
+    [HarmonyPrefix]
+    private static void NotifyBeginChangeBg() =>
+        ChangeBgBegin?.Invoke(null, EventArgs.Empty);
 
-        [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
-        [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
-        [HarmonyPostfix]
-        private static void NotifyEndChangeBg() =>
-            ChangeBgEnd?.Invoke(null, EventArgs.Empty);
-    }
+    [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
+    [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
+    [HarmonyPostfix]
+    private static void NotifyEndChangeBg() =>
+        ChangeBgEnd?.Invoke(null, EventArgs.Empty);
 }

+ 5 - 6
src/MeidoPhotoStudio.Plugin/Serialization/ISerializer.cs

@@ -1,10 +1,9 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public interface ISerializer
 {
-    public interface ISerializer
-    {
-        void Serialize(object thing, BinaryWriter writer);
-        void Deserialize(object thing, BinaryReader reader, SceneMetadata metadata);
-    }
+    void Serialize(object thing, BinaryWriter writer);
+    void Deserialize(object thing, BinaryReader reader, SceneMetadata metadata);
 }

+ 5 - 6
src/MeidoPhotoStudio.Plugin/Serialization/ISimpleSerializer.cs

@@ -1,10 +1,9 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public interface ISimpleSerializer
 {
-    public interface ISimpleSerializer
-    {
-        void Serialize(object obj, BinaryWriter writer);
-        object Deserialize(BinaryReader reader, SceneMetadata metadata);
-    }
+    void Serialize(object obj, BinaryWriter writer);
+    object Deserialize(BinaryReader reader, SceneMetadata metadata);
 }

+ 28 - 29
src/MeidoPhotoStudio.Plugin/Serialization/SceneMetadata.cs

@@ -1,37 +1,36 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class SceneMetadata
-    {
-        public short Version { get; set; }
-        public bool Environment { get; set; }
-        public int MaidCount { get; set; }
-        public bool MMConverted { get; set; }
+namespace MeidoPhotoStudio.Plugin;
 
-        public static SceneMetadata ReadMetadata(BinaryReader reader) =>
-            new()
-            {
-                Version = reader.ReadVersion(),
-                Environment = reader.ReadBoolean(),
-                MaidCount = reader.ReadInt32(),
-                MMConverted = reader.ReadBoolean()
-            };
+public class SceneMetadata
+{
+    public short Version { get; set; }
+    public bool Environment { get; set; }
+    public int MaidCount { get; set; }
+    public bool MMConverted { get; set; }
 
-        public void WriteMetadata(BinaryWriter writer)
+    public static SceneMetadata ReadMetadata(BinaryReader reader) =>
+        new()
         {
-            writer.Write(Version);
-            writer.Write(Environment);
-            writer.Write(MaidCount);
-            writer.Write(MMConverted);
-        }
+            Version = reader.ReadVersion(),
+            Environment = reader.ReadBoolean(),
+            MaidCount = reader.ReadInt32(),
+            MMConverted = reader.ReadBoolean()
+        };
 
-        public void Deconstruct(out short version, out bool environment, out int maidCount, out bool mmConverted)
-        {
-            version = Version;
-            environment = Environment;
-            mmConverted = MMConverted;
-            maidCount = MaidCount;
-        }
+    public void WriteMetadata(BinaryWriter writer)
+    {
+        writer.Write(Version);
+        writer.Write(Environment);
+        writer.Write(MaidCount);
+        writer.Write(MMConverted);
+    }
+
+    public void Deconstruct(out short version, out bool environment, out int maidCount, out bool mmConverted)
+    {
+        version = Version;
+        environment = Environment;
+        mmConverted = MMConverted;
+        maidCount = MaidCount;
     }
 }

+ 33 - 34
src/MeidoPhotoStudio.Plugin/Serialization/Serialization.cs

@@ -3,47 +3,46 @@ using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public static class Serialization
-    {
-        private static readonly Dictionary<Type, ISerializer> Serializers;
+namespace MeidoPhotoStudio.Plugin;
 
-        private static readonly Dictionary<Type, ISimpleSerializer> SimpleSerializers;
-
-        static Serialization()
-        {
-            var types =
-                (from t in typeof(MeidoPhotoStudio).Assembly.GetTypes()
-                 let baseType = t.BaseType
-                 where !t.IsAbstract && !t.IsInterface && baseType?.IsGenericType == true
-                 select new { type = t, baseType }).ToArray();
+public static class Serialization
+{
+    private static readonly Dictionary<Type, ISerializer> Serializers;
 
-            Serializers = types.Where(t => t.baseType.GetGenericTypeDefinition() == typeof(Serializer<>))
-                .Select(t => new { t.type, arg = t.baseType.GetGenericArguments()[0] })
-                .ToDictionary(x => x.arg, x => (ISerializer)Activator.CreateInstance(x.type));
+    private static readonly Dictionary<Type, ISimpleSerializer> SimpleSerializers;
 
-            SimpleSerializers = types.Where(t => t.baseType.GetGenericTypeDefinition() == typeof(SimpleSerializer<>))
-                .Select(t => new { t.type, arg = t.baseType.GetGenericArguments()[0] })
-                .ToDictionary(x => x.arg, x => (ISimpleSerializer)Activator.CreateInstance(x.type));
-        }
+    static Serialization()
+    {
+        var types =
+            (from t in typeof(MeidoPhotoStudio).Assembly.GetTypes()
+             let baseType = t.BaseType
+             where !t.IsAbstract && !t.IsInterface && baseType?.IsGenericType == true
+             select new { type = t, baseType }).ToArray();
+
+        Serializers = types.Where(t => t.baseType.GetGenericTypeDefinition() == typeof(Serializer<>))
+            .Select(t => new { t.type, arg = t.baseType.GetGenericArguments()[0] })
+            .ToDictionary(x => x.arg, x => (ISerializer)Activator.CreateInstance(x.type));
+
+        SimpleSerializers = types.Where(t => t.baseType.GetGenericTypeDefinition() == typeof(SimpleSerializer<>))
+            .Select(t => new { t.type, arg = t.baseType.GetGenericArguments()[0] })
+            .ToDictionary(x => x.arg, x => (ISimpleSerializer)Activator.CreateInstance(x.type));
+    }
 
-        public static Serializer<T> Get<T>() =>
-            Serializers[typeof(T)] as Serializer<T>;
+    public static Serializer<T> Get<T>() =>
+        Serializers[typeof(T)] as Serializer<T>;
 
-        public static ISerializer Get(Type type) =>
-            Serializers[type];
+    public static ISerializer Get(Type type) =>
+        Serializers[type];
 
-        public static SimpleSerializer<T> GetSimple<T>() =>
-            SimpleSerializers[typeof(T)] as SimpleSerializer<T>;
+    public static SimpleSerializer<T> GetSimple<T>() =>
+        SimpleSerializers[typeof(T)] as SimpleSerializer<T>;
 
-        public static ISimpleSerializer GetSimple(Type type) =>
-            SimpleSerializers[type];
+    public static ISimpleSerializer GetSimple(Type type) =>
+        SimpleSerializers[type];
 
-        public static short ReadVersion(this BinaryReader reader) =>
-            reader.ReadInt16();
+    public static short ReadVersion(this BinaryReader reader) =>
+        reader.ReadInt16();
 
-        public static void WriteVersion(this BinaryWriter writer, short version) =>
-            writer.Write(version);
-    }
+    public static void WriteVersion(this BinaryWriter writer, short version) =>
+        writer.Write(version);
 }

+ 9 - 10
src/MeidoPhotoStudio.Plugin/Serialization/Serializer.cs

@@ -1,17 +1,16 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class Serializer<T> : ISerializer
 {
-    public abstract class Serializer<T> : ISerializer
-    {
-        void ISerializer.Serialize(object obj, BinaryWriter writer) =>
-            Serialize((T)obj, writer);
+    void ISerializer.Serialize(object obj, BinaryWriter writer) =>
+        Serialize((T)obj, writer);
 
-        void ISerializer.Deserialize(object obj, BinaryReader reader, SceneMetadata metadata) =>
-            Deserialize((T)obj, reader, metadata);
+    void ISerializer.Deserialize(object obj, BinaryReader reader, SceneMetadata metadata) =>
+        Deserialize((T)obj, reader, metadata);
 
-        public abstract void Serialize(T obj, BinaryWriter writer);
+    public abstract void Serialize(T obj, BinaryWriter writer);
 
-        public abstract void Deserialize(T obj, BinaryReader reader, SceneMetadata metadata);
-    }
+    public abstract void Deserialize(T obj, BinaryReader reader, SceneMetadata metadata);
 }

+ 16 - 17
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/AttachPointInfoSerializer.cs

@@ -1,27 +1,26 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class AttachPointInfoSerializer : SimpleSerializer<AttachPointInfo>
 {
-    public class AttachPointInfoSerializer : SimpleSerializer<AttachPointInfo>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(AttachPointInfo info, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+    public override void Serialize(AttachPointInfo info, BinaryWriter writer)
+    {
+        writer.WriteVersion(version);
 
-            writer.Write((int)info.AttachPoint);
-            writer.Write(info.MaidIndex);
-        }
+        writer.Write((int)info.AttachPoint);
+        writer.Write(info.MaidIndex);
+    }
 
-        public override AttachPointInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override AttachPointInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var attachPoint = (AttachPoint)reader.ReadInt32();
-            var maidIndex = reader.ReadInt32();
+        var attachPoint = (AttachPoint)reader.ReadInt32();
+        var maidIndex = reader.ReadInt32();
 
-            return new(attachPoint, string.Empty, maidIndex);
-        }
+        return new(attachPoint, string.Empty, maidIndex);
     }
 }

+ 19 - 20
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/CameraInfoSerializer.cs

@@ -1,29 +1,28 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class CameraInfoSerializer : Serializer<CameraInfo>
 {
-    public class CameraInfoSerializer : Serializer<CameraInfo>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(CameraInfo info, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+    public override void Serialize(CameraInfo info, BinaryWriter writer)
+    {
+        writer.WriteVersion(version);
 
-            writer.Write(info.TargetPos);
-            writer.Write(info.Angle);
-            writer.Write(info.Distance);
-            writer.Write(info.FOV);
-        }
+        writer.Write(info.TargetPos);
+        writer.Write(info.Angle);
+        writer.Write(info.Distance);
+        writer.Write(info.FOV);
+    }
 
-        public override void Deserialize(CameraInfo info, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(CameraInfo info, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            info.TargetPos = reader.ReadVector3();
-            info.Angle = reader.ReadQuaternion();
-            info.Distance = reader.ReadSingle();
-            info.FOV = reader.ReadSingle();
-        }
+        info.TargetPos = reader.ReadVector3();
+        info.Angle = reader.ReadQuaternion();
+        info.Distance = reader.ReadSingle();
+        info.FOV = reader.ReadSingle();
     }
 }

+ 29 - 30
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/DragPointLightSerializer.cs

@@ -1,45 +1,44 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointLightSerializer : Serializer<DragPointLight>
 {
-    public class DragPointLightSerializer : Serializer<DragPointLight>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        private static Serializer<LightProperty> LightPropertySerializer =>
-            Serialization.Get<LightProperty>();
+    private static Serializer<LightProperty> LightPropertySerializer =>
+        Serialization.Get<LightProperty>();
 
-        private static LightProperty[] GetLightProperties(DragPointLight light) =>
-            Utility.GetFieldValue<DragPointLight, LightProperty[]>(light, "LightProperties");
+    private static LightProperty[] GetLightProperties(DragPointLight light) =>
+        Utility.GetFieldValue<DragPointLight, LightProperty[]>(light, "LightProperties");
 
-        public override void Serialize(DragPointLight light, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+    public override void Serialize(DragPointLight light, BinaryWriter writer)
+    {
+        writer.WriteVersion(version);
 
-            var lightList = GetLightProperties(light);
+        var lightList = GetLightProperties(light);
 
-            for (var i = 0; i < 3; i++)
-                LightPropertySerializer.Serialize(lightList[i], writer);
+        for (var i = 0; i < 3; i++)
+            LightPropertySerializer.Serialize(lightList[i], writer);
 
-            writer.Write(light.MyObject.position);
-            writer.Write((int)light.SelectedLightType);
-            writer.Write(light.IsColourMode);
-            writer.Write(light.IsDisabled);
-        }
+        writer.Write(light.MyObject.position);
+        writer.Write((int)light.SelectedLightType);
+        writer.Write(light.IsColourMode);
+        writer.Write(light.IsDisabled);
+    }
 
-        public override void Deserialize(DragPointLight light, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(DragPointLight light, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var lightList = GetLightProperties(light);
+        var lightList = GetLightProperties(light);
 
-            for (var i = 0; i < 3; i++)
-                LightPropertySerializer.Deserialize(lightList[i], reader, metadata);
+        for (var i = 0; i < 3; i++)
+            LightPropertySerializer.Deserialize(lightList[i], reader, metadata);
 
-            light.MyObject.position = reader.ReadVector3();
-            light.SetLightType((DragPointLight.MPSLightType)reader.ReadInt32());
-            light.IsColourMode = reader.ReadBoolean();
-            light.IsDisabled = reader.ReadBoolean();
-        }
+        light.MyObject.position = reader.ReadVector3();
+        light.SetLightType((DragPointLight.MPSLightType)reader.ReadInt32());
+        light.IsColourMode = reader.ReadBoolean();
+        light.IsDisabled = reader.ReadBoolean();
     }
 }

+ 23 - 24
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/BloomEffectSerializer.cs

@@ -1,35 +1,34 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BloomEffectSerializer : Serializer<BloomEffectManager>
 {
-    public class BloomEffectSerializer : Serializer<BloomEffectManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(BloomEffectManager effect, BinaryWriter writer)
-        {
-            writer.Write(BloomEffectManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(BloomEffectManager effect, BinaryWriter writer)
+    {
+        writer.Write(BloomEffectManager.header);
+        writer.WriteVersion(version);
 
-            writer.Write(effect.Active);
-            writer.Write(effect.BloomValue);
-            writer.Write(effect.BlurIterations);
-            writer.Write(effect.BloomThresholdColour);
-            writer.Write(effect.BloomHDR);
-        }
+        writer.Write(effect.Active);
+        writer.Write(effect.BloomValue);
+        writer.Write(effect.BlurIterations);
+        writer.Write(effect.BloomThresholdColour);
+        writer.Write(effect.BloomHDR);
+    }
 
-        public override void Deserialize(BloomEffectManager effect, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(BloomEffectManager effect, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var active = reader.ReadBoolean();
+        var active = reader.ReadBoolean();
 
-            effect.BloomValue = reader.ReadSingle();
-            effect.BlurIterations = reader.ReadInt32();
-            effect.BloomThresholdColour = reader.ReadColour();
-            effect.BloomHDR = reader.ReadBoolean();
+        effect.BloomValue = reader.ReadSingle();
+        effect.BlurIterations = reader.ReadInt32();
+        effect.BloomThresholdColour = reader.ReadColour();
+        effect.BloomHDR = reader.ReadBoolean();
 
-            effect.SetEffectActive(active);
-        }
+        effect.SetEffectActive(active);
     }
 }

+ 17 - 18
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/BlurEffectSerializer.cs

@@ -1,29 +1,28 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class BlurEffectSerializer : Serializer<BlurEffectManager>
 {
-    public class BlurEffectSerializer : Serializer<BlurEffectManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(BlurEffectManager effect, BinaryWriter writer)
-        {
-            writer.Write(BlurEffectManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(BlurEffectManager effect, BinaryWriter writer)
+    {
+        writer.Write(BlurEffectManager.header);
+        writer.WriteVersion(version);
 
-            writer.Write(effect.Active);
-            writer.Write(effect.BlurSize);
-        }
+        writer.Write(effect.Active);
+        writer.Write(effect.BlurSize);
+    }
 
-        public override void Deserialize(BlurEffectManager effect, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(BlurEffectManager effect, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var active = reader.ReadBoolean();
+        var active = reader.ReadBoolean();
 
-            effect.BlurSize = reader.ReadSingle();
+        effect.BlurSize = reader.ReadSingle();
 
-            effect.SetEffectActive(active);
-        }
+        effect.SetEffectActive(active);
     }
 }

+ 30 - 31
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/DepthOfFieldEffectSerializer.cs

@@ -1,37 +1,36 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DepthOfFieldEffectSerializer : Serializer<DepthOfFieldEffectManager>
 {
-    public class DepthOfFieldEffectSerializer : Serializer<DepthOfFieldEffectManager>
+    private const short version = 1;
+
+    public override void Serialize(DepthOfFieldEffectManager effect, BinaryWriter writer)
     {
-        private const short version = 1;
-
-        public override void Serialize(DepthOfFieldEffectManager effect, BinaryWriter writer)
-        {
-            writer.Write(DepthOfFieldEffectManager.header);
-            writer.WriteVersion(version);
-
-            writer.Write(effect.Active);
-            writer.Write(effect.FocalLength);
-            writer.Write(effect.FocalSize);
-            writer.Write(effect.Aperture);
-            writer.Write(effect.MaxBlurSize);
-            writer.Write(effect.VisualizeFocus);
-        }
-
-        public override void Deserialize(DepthOfFieldEffectManager effect, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
-
-            var active = reader.ReadBoolean();
-
-            effect.FocalLength = reader.ReadSingle();
-            effect.FocalSize = reader.ReadSingle();
-            effect.Aperture = reader.ReadSingle();
-            effect.MaxBlurSize = reader.ReadSingle();
-            effect.VisualizeFocus = reader.ReadBoolean();
-
-            effect.SetEffectActive(active);
-        }
+        writer.Write(DepthOfFieldEffectManager.header);
+        writer.WriteVersion(version);
+
+        writer.Write(effect.Active);
+        writer.Write(effect.FocalLength);
+        writer.Write(effect.FocalSize);
+        writer.Write(effect.Aperture);
+        writer.Write(effect.MaxBlurSize);
+        writer.Write(effect.VisualizeFocus);
+    }
+
+    public override void Deserialize(DepthOfFieldEffectManager effect, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
+
+        var active = reader.ReadBoolean();
+
+        effect.FocalLength = reader.ReadSingle();
+        effect.FocalSize = reader.ReadSingle();
+        effect.Aperture = reader.ReadSingle();
+        effect.MaxBlurSize = reader.ReadSingle();
+        effect.VisualizeFocus = reader.ReadBoolean();
+
+        effect.SetEffectActive(active);
     }
 }

+ 30 - 31
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/FogEffectSerializer.cs

@@ -1,37 +1,36 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class FogEffectSerializer : Serializer<FogEffectManager>
 {
-    public class FogEffectSerializer : Serializer<FogEffectManager>
+    private const short version = 1;
+
+    public override void Serialize(FogEffectManager effect, BinaryWriter writer)
     {
-        private const short version = 1;
-
-        public override void Serialize(FogEffectManager effect, BinaryWriter writer)
-        {
-            writer.Write(FogEffectManager.header);
-            writer.WriteVersion(version);
-
-            writer.Write(effect.Active);
-            writer.Write(effect.Distance);
-            writer.Write(effect.Density);
-            writer.Write(effect.HeightScale);
-            writer.Write(effect.Height);
-            writer.WriteColour(effect.FogColour);
-        }
-
-        public override void Deserialize(FogEffectManager effect, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
-
-            var active = reader.ReadBoolean();
-
-            effect.Distance = reader.ReadSingle();
-            effect.Density = reader.ReadSingle();
-            effect.HeightScale = reader.ReadSingle();
-            effect.Height = reader.ReadSingle();
-            effect.FogColour = reader.ReadColour();
-
-            effect.SetEffectActive(active);
-        }
+        writer.Write(FogEffectManager.header);
+        writer.WriteVersion(version);
+
+        writer.Write(effect.Active);
+        writer.Write(effect.Distance);
+        writer.Write(effect.Density);
+        writer.Write(effect.HeightScale);
+        writer.Write(effect.Height);
+        writer.WriteColour(effect.FogColour);
+    }
+
+    public override void Deserialize(FogEffectManager effect, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
+
+        var active = reader.ReadBoolean();
+
+        effect.Distance = reader.ReadSingle();
+        effect.Density = reader.ReadSingle();
+        effect.HeightScale = reader.ReadSingle();
+        effect.Height = reader.ReadSingle();
+        effect.FogColour = reader.ReadColour();
+
+        effect.SetEffectActive(active);
     }
 }

+ 14 - 15
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/SepiaToneEffectSerializer.cs

@@ -1,25 +1,24 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class SepiaToneEffectSerializer : Serializer<SepiaToneEffectManger>
 {
-    public class SepiaToneEffectSerializer : Serializer<SepiaToneEffectManger>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(SepiaToneEffectManger effect, BinaryWriter writer)
-        {
-            writer.Write(SepiaToneEffectManger.header);
+    public override void Serialize(SepiaToneEffectManger effect, BinaryWriter writer)
+    {
+        writer.Write(SepiaToneEffectManger.header);
 
-            writer.WriteVersion(version);
+        writer.WriteVersion(version);
 
-            writer.Write(effect.Active);
-        }
+        writer.Write(effect.Active);
+    }
 
-        public override void Deserialize(SepiaToneEffectManger effect, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(SepiaToneEffectManger effect, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            effect.SetEffectActive(reader.ReadBoolean());
-        }
+        effect.SetEffectActive(reader.ReadBoolean());
     }
 }

+ 23 - 24
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/EffectSerializers/VignetteEffectSerializer.cs

@@ -1,35 +1,34 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class VignetteEffectSerializer : Serializer<VignetteEffectManager>
 {
-    public class VignetteEffectSerializer : Serializer<VignetteEffectManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(VignetteEffectManager manager, BinaryWriter writer)
-        {
-            writer.Write(VignetteEffectManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(VignetteEffectManager manager, BinaryWriter writer)
+    {
+        writer.Write(VignetteEffectManager.header);
+        writer.WriteVersion(version);
 
-            writer.Write(manager.Active);
-            writer.Write(manager.Intensity);
-            writer.Write(manager.Blur);
-            writer.Write(manager.BlurSpread);
-            writer.Write(manager.ChromaticAberration);
-        }
+        writer.Write(manager.Active);
+        writer.Write(manager.Intensity);
+        writer.Write(manager.Blur);
+        writer.Write(manager.BlurSpread);
+        writer.Write(manager.ChromaticAberration);
+    }
 
-        public override void Deserialize(VignetteEffectManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(VignetteEffectManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var active = reader.ReadBoolean();
+        var active = reader.ReadBoolean();
 
-            manager.Intensity = reader.ReadSingle();
-            manager.Blur = reader.ReadSingle();
-            manager.BlurSpread = reader.ReadSingle();
-            manager.ChromaticAberration = reader.ReadSingle();
+        manager.Intensity = reader.ReadSingle();
+        manager.Blur = reader.ReadSingle();
+        manager.BlurSpread = reader.ReadSingle();
+        manager.ChromaticAberration = reader.ReadSingle();
 
-            manager.SetEffectActive(active);
-        }
+        manager.SetEffectActive(active);
     }
 }

+ 23 - 24
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/LightPropertySerializer.cs

@@ -1,33 +1,32 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class LightPropertySerializer : Serializer<LightProperty>
 {
-    public class LightPropertySerializer : Serializer<LightProperty>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(LightProperty prop, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+    public override void Serialize(LightProperty prop, BinaryWriter writer)
+    {
+        writer.WriteVersion(version);
 
-            writer.Write(prop.Rotation);
-            writer.Write(prop.Intensity);
-            writer.Write(prop.Range);
-            writer.Write(prop.SpotAngle);
-            writer.Write(prop.ShadowStrength);
-            writer.Write(prop.LightColour);
-        }
+        writer.Write(prop.Rotation);
+        writer.Write(prop.Intensity);
+        writer.Write(prop.Range);
+        writer.Write(prop.SpotAngle);
+        writer.Write(prop.ShadowStrength);
+        writer.Write(prop.LightColour);
+    }
 
-        public override void Deserialize(LightProperty prop, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(LightProperty prop, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            prop.Rotation = reader.ReadQuaternion();
-            prop.Intensity = reader.ReadSingle();
-            prop.Range = reader.ReadSingle();
-            prop.SpotAngle = reader.ReadSingle();
-            prop.ShadowStrength = reader.ReadSingle();
-            prop.LightColour = reader.ReadColour();
-        }
+        prop.Rotation = reader.ReadQuaternion();
+        prop.Intensity = reader.ReadSingle();
+        prop.Range = reader.ReadSingle();
+        prop.SpotAngle = reader.ReadSingle();
+        prop.ShadowStrength = reader.ReadSingle();
+        prop.LightColour = reader.ReadColour();
     }
 }

+ 34 - 35
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/CameraManagerSerializer.cs

@@ -1,57 +1,56 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class CameraManagerSerializer : Serializer<CameraManager>
 {
-    public class CameraManagerSerializer : Serializer<CameraManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        private static readonly CameraInfo dummyInfo = new();
+    private static readonly CameraInfo dummyInfo = new();
 
-        private static Serializer<CameraInfo> InfoSerializer =>
-            Serialization.Get<CameraInfo>();
+    private static Serializer<CameraInfo> InfoSerializer =>
+        Serialization.Get<CameraInfo>();
 
-        private static CameraInfo[] GetCameraInfos(CameraManager manager) =>
-            Utility.GetFieldValue<CameraManager, CameraInfo[]>(manager, "cameraInfos");
+    private static CameraInfo[] GetCameraInfos(CameraManager manager) =>
+        Utility.GetFieldValue<CameraManager, CameraInfo[]>(manager, "cameraInfos");
 
-        public override void Serialize(CameraManager manager, BinaryWriter writer)
-        {
-            writer.Write(CameraManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(CameraManager manager, BinaryWriter writer)
+    {
+        writer.Write(CameraManager.header);
+        writer.WriteVersion(version);
 
-            var cameraInfos = GetCameraInfos(manager);
+        var cameraInfos = GetCameraInfos(manager);
 
-            cameraInfos[manager.CurrentCameraIndex].UpdateInfo(CameraUtility.MainCamera);
+        cameraInfos[manager.CurrentCameraIndex].UpdateInfo(CameraUtility.MainCamera);
 
-            writer.Write(manager.CurrentCameraIndex);
-            writer.Write(manager.CameraCount);
+        writer.Write(manager.CurrentCameraIndex);
+        writer.Write(manager.CameraCount);
 
-            foreach (var info in cameraInfos)
-                InfoSerializer.Serialize(info, writer);
+        foreach (var info in cameraInfos)
+            InfoSerializer.Serialize(info, writer);
 
-            CameraUtility.StopAll();
-        }
+        CameraUtility.StopAll();
+    }
 
-        public override void Deserialize(CameraManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(CameraManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var camera = CameraUtility.MainCamera;
+        var camera = CameraUtility.MainCamera;
 
-            manager.CurrentCameraIndex = reader.ReadInt32();
+        manager.CurrentCameraIndex = reader.ReadInt32();
 
-            var cameraCount = reader.ReadInt32();
-            var cameraInfos = GetCameraInfos(manager);
+        var cameraCount = reader.ReadInt32();
+        var cameraInfos = GetCameraInfos(manager);
 
-            for (var i = 0; i < cameraCount; i++)
-                InfoSerializer.Deserialize(i >= manager.CameraCount ? dummyInfo : cameraInfos[i], reader, metadata);
+        for (var i = 0; i < cameraCount; i++)
+            InfoSerializer.Deserialize(i >= manager.CameraCount ? dummyInfo : cameraInfos[i], reader, metadata);
 
-            if (metadata.Environment)
-                return;
+        if (metadata.Environment)
+            return;
 
-            cameraInfos[manager.CurrentCameraIndex].Apply(camera);
+        cameraInfos[manager.CurrentCameraIndex].Apply(camera);
 
-            CameraUtility.StopAll();
-        }
+        CameraUtility.StopAll();
     }
 }

+ 24 - 25
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/EffectManagerSerializer.cs

@@ -3,42 +3,41 @@ using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class EffectManagerSerializer : Serializer<EffectManager>
 {
-    public class EffectManagerSerializer : Serializer<EffectManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        private static Dictionary<Type, IEffectManager> GetEffectManagers(EffectManager manager) =>
-            Utility.GetFieldValue<EffectManager, Dictionary<Type, IEffectManager>>(manager, "EffectManagers");
+    private static Dictionary<Type, IEffectManager> GetEffectManagers(EffectManager manager) =>
+        Utility.GetFieldValue<EffectManager, Dictionary<Type, IEffectManager>>(manager, "EffectManagers");
 
-        public override void Serialize(EffectManager manager, BinaryWriter writer)
-        {
-            writer.Write(EffectManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(EffectManager manager, BinaryWriter writer)
+    {
+        writer.Write(EffectManager.header);
+        writer.WriteVersion(version);
 
-            foreach (var effectManager in GetEffectManagers(manager).Values)
-                Serialization.Get(effectManager.GetType()).Serialize(effectManager, writer);
+        foreach (var effectManager in GetEffectManagers(manager).Values)
+            Serialization.Get(effectManager.GetType()).Serialize(effectManager, writer);
 
-            writer.Write(EffectManager.footer);
-        }
+        writer.Write(EffectManager.footer);
+    }
 
-        public override void Deserialize(EffectManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(EffectManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var headerToManager = GetEffectManagers(manager).ToDictionary(
+        var headerToManager = GetEffectManagers(manager).ToDictionary(
                 x => (string)x.Key.GetField("header").GetValue(null),
                 y => y.Value
-            );
+                );
 
-            string header;
+        string header;
 
-            while ((header = reader.ReadString()) != EffectManager.footer)
-            {
-                var effectManager = headerToManager[header];
-                Serialization.Get(effectManager.GetType()).Deserialize(effectManager, reader, metadata);
-            }
+        while ((header = reader.ReadString()) != EffectManager.footer)
+        {
+            var effectManager = headerToManager[header];
+            Serialization.Get(effectManager.GetType()).Deserialize(effectManager, reader, metadata);
         }
     }
 }

+ 47 - 48
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/EnvironmentManagerSerializer.cs

@@ -2,72 +2,71 @@ using System;
 using System.IO;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class EnvironmentManagerSerializer : Serializer<EnvironmentManager>
 {
-    public class EnvironmentManagerSerializer : Serializer<EnvironmentManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        private static SimpleSerializer<TransformDTO> TransformDtoSerializer =>
-            Serialization.GetSimple<TransformDTO>();
+    private static SimpleSerializer<TransformDTO> TransformDtoSerializer =>
+        Serialization.GetSimple<TransformDTO>();
 
-        private static Transform GetBgTransform(EnvironmentManager manager) =>
-            Utility.GetFieldValue<EnvironmentManager, Transform>(manager, "bg");
+    private static Transform GetBgTransform(EnvironmentManager manager) =>
+        Utility.GetFieldValue<EnvironmentManager, Transform>(manager, "bg");
 
-        public override void Serialize(EnvironmentManager manager, BinaryWriter writer)
-        {
-            writer.Write(EnvironmentManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(EnvironmentManager manager, BinaryWriter writer)
+    {
+        writer.Write(EnvironmentManager.header);
+        writer.WriteVersion(version);
 
-            writer.Write(manager.CurrentBgAsset);
+        writer.Write(manager.CurrentBgAsset);
 
-            var bgTransform = GetBgTransform(manager);
-            var transformDto = bgTransform ? new TransformDTO(bgTransform) : new TransformDTO();
+        var bgTransform = GetBgTransform(manager);
+        var transformDto = bgTransform ? new TransformDTO(bgTransform) : new TransformDTO();
 
-            TransformDtoSerializer.Serialize(transformDto, writer);
-        }
+        TransformDtoSerializer.Serialize(transformDto, writer);
+    }
 
-        public override void Deserialize(EnvironmentManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override void Deserialize(EnvironmentManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            var bgAsset = reader.ReadString();
-            var transformDto = TransformDtoSerializer.Deserialize(reader, metadata);
-            var creativeBg = Utility.IsGuidString(bgAsset);
+        var bgAsset = reader.ReadString();
+        var transformDto = TransformDtoSerializer.Deserialize(reader, metadata);
+        var creativeBg = Utility.IsGuidString(bgAsset);
 
-            var bgList = creativeBg
-                ? Constants.MyRoomCustomBGList.ConvertAll(kvp => kvp.Key)
-                : Constants.BGList;
+        var bgList = creativeBg
+            ? Constants.MyRoomCustomBGList.ConvertAll(kvp => kvp.Key)
+            : Constants.BGList;
 
-            var assetIndex = bgList.FindIndex(
+        var assetIndex = bgList.FindIndex(
                 asset => asset.Equals(bgAsset, StringComparison.InvariantCultureIgnoreCase)
-            );
+                );
 
-            var validBg = assetIndex >= 0;
+        var validBg = assetIndex >= 0;
 
-            if (validBg)
-                bgAsset = bgList[assetIndex];
-            else
-            {
-                Utility.LogWarning($"Could not load BG '{bgAsset}'");
-                creativeBg = false;
-                bgAsset = EnvironmentManager.defaultBg;
-            }
+        if (validBg)
+            bgAsset = bgList[assetIndex];
+        else
+        {
+            Utility.LogWarning($"Could not load BG '{bgAsset}'");
+            creativeBg = false;
+            bgAsset = EnvironmentManager.defaultBg;
+        }
 
-            manager.ChangeBackground(bgAsset, creativeBg);
+        manager.ChangeBackground(bgAsset, creativeBg);
 
-            if (!validBg)
-                return;
+        if (!validBg)
+            return;
 
-            var bg = GetBgTransform(manager);
+        var bg = GetBgTransform(manager);
 
-            if (!bg)
-                return;
+        if (!bg)
+            return;
 
-            // TODO: Use transform.SetPositionAndRotation
-            bg.position = transformDto.Position;
-            bg.rotation = transformDto.Rotation;
-            bg.localScale = transformDto.LocalScale;
-        }
+        // TODO: Use transform.SetPositionAndRotation
+        bg.position = transformDto.Position;
+        bg.rotation = transformDto.Rotation;
+        bg.localScale = transformDto.LocalScale;
     }
 }

+ 28 - 29
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/LightManagerSerializer.cs

@@ -1,48 +1,47 @@
 using System.Collections.Generic;
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class LightManagerSerializer : Serializer<LightManager>
 {
-    public class LightManagerSerializer : Serializer<LightManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        private static Serializer<DragPointLight> LightSerializer =>
-            Serialization.Get<DragPointLight>();
+    private static Serializer<DragPointLight> LightSerializer =>
+        Serialization.Get<DragPointLight>();
 
-        private static List<DragPointLight> GetLightList(LightManager manager) =>
-            Utility.GetFieldValue<LightManager, List<DragPointLight>>(manager, "lightList");
+    private static List<DragPointLight> GetLightList(LightManager manager) =>
+        Utility.GetFieldValue<LightManager, List<DragPointLight>>(manager, "lightList");
 
-        public override void Serialize(LightManager manager, BinaryWriter writer)
-        {
-            writer.Write(LightManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(LightManager manager, BinaryWriter writer)
+    {
+        writer.Write(LightManager.header);
+        writer.WriteVersion(version);
 
-            var list = GetLightList(manager);
+        var list = GetLightList(manager);
 
-            writer.Write(list.Count);
+        writer.Write(list.Count);
 
-            foreach (var light in list)
-                LightSerializer.Serialize(light, writer);
-        }
+        foreach (var light in list)
+            LightSerializer.Serialize(light, writer);
+    }
 
-        public override void Deserialize(LightManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            manager.ClearLights();
+    public override void Deserialize(LightManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        manager.ClearLights();
 
-            _ = reader.ReadVersion();
+        _ = reader.ReadVersion();
 
-            var lightCount = reader.ReadInt32();
+        var lightCount = reader.ReadInt32();
 
-            var list = GetLightList(manager);
+        var list = GetLightList(manager);
 
-            LightSerializer.Deserialize(list[0], reader, metadata);
+        LightSerializer.Deserialize(list[0], reader, metadata);
 
-            for (var i = 1; i < lightCount; i++)
-            {
-                manager.AddLight();
-                LightSerializer.Deserialize(list[i], reader, metadata);
-            }
+        for (var i = 1; i < lightCount; i++)
+        {
+            manager.AddLight();
+            LightSerializer.Deserialize(list[i], reader, metadata);
         }
     }
 }

+ 62 - 63
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/MeidoManagerSerializer.cs

@@ -1,89 +1,88 @@
 using System.IO;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MeidoManagerSerializer : Serializer<MeidoManager>
 {
-    public class MeidoManagerSerializer : Serializer<MeidoManager>
+    private const short version = 1;
+
+    private static Serializer<Meido> MeidoSerializer =>
+        Serialization.Get<Meido>();
+
+    public override void Serialize(MeidoManager manager, BinaryWriter writer)
     {
-        private const short version = 1;
+        writer.Write(MeidoManager.header);
+        writer.WriteVersion(version);
 
-        private static Serializer<Meido> MeidoSerializer =>
-            Serialization.Get<Meido>();
+        var meidoList = manager.ActiveMeidoList;
 
-        public override void Serialize(MeidoManager manager, BinaryWriter writer)
-        {
-            writer.Write(MeidoManager.header);
-            writer.WriteVersion(version);
+        var meidoCount = meidoList.Count;
 
-            var meidoList = manager.ActiveMeidoList;
+        var hairPosition = Vector3.zero;
+        var skirtPosition = Vector3.zero;
 
-            var meidoCount = meidoList.Count;
+        var hairMeidoFound = false;
+        var skirtMeidoFound = false;
 
-            var hairPosition = Vector3.zero;
-            var skirtPosition = Vector3.zero;
+        var globalGravity = manager.GlobalGravity;
 
-            var hairMeidoFound = false;
-            var skirtMeidoFound = false;
+        writer.Write(meidoCount);
+        foreach (var meido in meidoList)
+        {
+            MeidoSerializer.Serialize(meido, writer);
 
-            var globalGravity = manager.GlobalGravity;
+            if (!globalGravity || meidoCount <= 0)
+                continue;
 
-            writer.Write(meidoCount);
-            foreach (var meido in meidoList)
+            // Get gravity and skirt control positions to apply to meidos past the meido count
+            if (!hairMeidoFound && meido.HairGravityControl.Valid)
             {
-                MeidoSerializer.Serialize(meido, writer);
-
-                if (!globalGravity || meidoCount <= 0)
-                    continue;
-
-                // Get gravity and skirt control positions to apply to meidos past the meido count
-                if (!hairMeidoFound && meido.HairGravityControl.Valid)
-                {
-                    hairPosition = meido.HairGravityControl.Control.transform.localPosition;
-                    hairMeidoFound = true;
-                }
-                else if (!skirtMeidoFound && meido.SkirtGravityControl.Valid)
-                {
-                    skirtPosition = meido.SkirtGravityControl.Control.transform.localPosition;
-                    skirtMeidoFound = true;
-                }
+                hairPosition = meido.HairGravityControl.Control.transform.localPosition;
+                hairMeidoFound = true;
+            }
+            else if (!skirtMeidoFound && meido.SkirtGravityControl.Valid)
+            {
+                skirtPosition = meido.SkirtGravityControl.Control.transform.localPosition;
+                skirtMeidoFound = true;
             }
-
-            writer.Write(globalGravity);
-            writer.Write(hairPosition);
-            writer.Write(skirtPosition);
         }
 
-        public override void Deserialize(MeidoManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+        writer.Write(globalGravity);
+        writer.Write(hairPosition);
+        writer.Write(skirtPosition);
+    }
 
-            var meidoCount = reader.ReadInt32();
-            for (var i = 0; i < meidoCount; i++)
-            {
-                if (i >= manager.ActiveMeidoList.Count)
-                {
-                    reader.BaseStream.Seek(reader.ReadInt64(), SeekOrigin.Current);
-                    continue;
-                }
+    public override void Deserialize(MeidoManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-                MeidoSerializer.Deserialize(manager.ActiveMeidoList[i], reader, metadata);
+        var meidoCount = reader.ReadInt32();
+        for (var i = 0; i < meidoCount; i++)
+        {
+            if (i >= manager.ActiveMeidoList.Count)
+            {
+                reader.BaseStream.Seek(reader.ReadInt64(), SeekOrigin.Current);
+                continue;
             }
 
-            var globalGravity = reader.ReadBoolean();
-            var hairPosition = reader.ReadVector3();
-            var skirtPosition = reader.ReadVector3();
-            Utility.SetFieldValue(manager, "globalGravity", globalGravity);
+            MeidoSerializer.Deserialize(manager.ActiveMeidoList[i], reader, metadata);
+        }
 
-            if (!globalGravity)
-                return;
+        var globalGravity = reader.ReadBoolean();
+        var hairPosition = reader.ReadVector3();
+        var skirtPosition = reader.ReadVector3();
+        Utility.SetFieldValue(manager, "globalGravity", globalGravity);
 
-            foreach (var meido in manager.ActiveMeidoList)
-            {
-                meido.HairGravityActive = true;
-                meido.SkirtGravityActive = true;
-                meido.ApplyGravity(hairPosition);
-                meido.ApplyGravity(skirtPosition, true);
-            }
+        if (!globalGravity)
+            return;
+
+        foreach (var meido in manager.ActiveMeidoList)
+        {
+            meido.HairGravityActive = true;
+            meido.SkirtGravityActive = true;
+            meido.ApplyGravity(hairPosition);
+            meido.ApplyGravity(skirtPosition, true);
         }
     }
 }

+ 23 - 24
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/MessageWindowManagerSerializer.cs

@@ -1,37 +1,36 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MessageWindowManagerSerializer : Serializer<MessageWindowManager>
 {
-    public class MessageWindowManagerSerializer : Serializer<MessageWindowManager>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(MessageWindowManager manager, BinaryWriter writer)
-        {
-            writer.Write(MessageWindowManager.header);
-            writer.WriteVersion(version);
+    public override void Serialize(MessageWindowManager manager, BinaryWriter writer)
+    {
+        writer.Write(MessageWindowManager.header);
+        writer.WriteVersion(version);
 
-            writer.Write(manager.ShowingMessage);
-            writer.Write(manager.FontSize);
-            writer.Write(manager.MessageName);
-            writer.Write(manager.MessageText);
-        }
+        writer.Write(manager.ShowingMessage);
+        writer.Write(manager.FontSize);
+        writer.Write(manager.MessageName);
+        writer.Write(manager.MessageText);
+    }
 
-        public override void Deserialize(MessageWindowManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            manager.CloseMessagePanel();
+    public override void Deserialize(MessageWindowManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        manager.CloseMessagePanel();
 
-            _ = reader.ReadVersion();
+        _ = reader.ReadVersion();
 
-            var showingMessage = reader.ReadBoolean();
+        var showingMessage = reader.ReadBoolean();
 
-            manager.FontSize = reader.ReadInt32();
+        manager.FontSize = reader.ReadInt32();
 
-            var messageName = reader.ReadString();
-            var messageText = reader.ReadString();
+        var messageName = reader.ReadString();
+        var messageText = reader.ReadString();
 
-            if (showingMessage)
-                manager.ShowMessage(messageName, messageText);
-        }
+        if (showingMessage)
+            manager.ShowMessage(messageName, messageText);
     }
 }

+ 47 - 48
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/ManagerSerializers/PropManagerSerializer.cs

@@ -1,73 +1,72 @@
 using System.Collections.Generic;
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
-{
-    public class PropManagerSerializer : Serializer<PropManager>
-    {
-        private const short version = 1;
+namespace MeidoPhotoStudio.Plugin;
 
-        private static SimpleSerializer<DragPointPropDTO> DragPointDtoSerializer =>
-            Serialization.GetSimple<DragPointPropDTO>();
+public class PropManagerSerializer : Serializer<PropManager>
+{
+    private const short version = 1;
 
-        private static List<DragPointProp> GetPropList(PropManager manager) =>
-            Utility.GetFieldValue<PropManager, List<DragPointProp>>(manager, "propList");
+    private static SimpleSerializer<DragPointPropDTO> DragPointDtoSerializer =>
+        Serialization.GetSimple<DragPointPropDTO>();
 
-        private static void Apply(PropManager manager, DragPointProp prop, DragPointPropDTO dto)
-        {
-            var (transformDto, attachPointInfo, shadowCasting) = dto;
+    private static List<DragPointProp> GetPropList(PropManager manager) =>
+        Utility.GetFieldValue<PropManager, List<DragPointProp>>(manager, "propList");
 
-            prop.ShadowCasting = shadowCasting;
+    private static void Apply(PropManager manager, DragPointProp prop, DragPointPropDTO dto)
+    {
+        var (transformDto, attachPointInfo, shadowCasting) = dto;
 
-            var transform = prop.MyObject;
+        prop.ShadowCasting = shadowCasting;
 
-            if (attachPointInfo.AttachPoint != AttachPoint.None)
-            {
-                manager.AttachProp(prop, attachPointInfo.AttachPoint, attachPointInfo.MaidIndex);
-                transform.localPosition = transformDto.LocalPosition;
-                transform.localRotation = transformDto.LocalRotation;
-            }
+        var transform = prop.MyObject;
 
-            // TODO: Use transform.SetRotationAndPosition or whatever it's called.
-            transform.position = transformDto.Position;
-            transform.rotation = transformDto.Rotation;
-            transform.localScale = transformDto.LocalScale;
+        if (attachPointInfo.AttachPoint != AttachPoint.None)
+        {
+            manager.AttachProp(prop, attachPointInfo.AttachPoint, attachPointInfo.MaidIndex);
+            transform.localPosition = transformDto.LocalPosition;
+            transform.localRotation = transformDto.LocalRotation;
         }
 
-        public override void Serialize(PropManager manager, BinaryWriter writer)
-        {
-            writer.Write(PropManager.header);
-            writer.WriteVersion(version);
+        // TODO: Use transform.SetRotationAndPosition or whatever it's called.
+        transform.position = transformDto.Position;
+        transform.rotation = transformDto.Rotation;
+        transform.localScale = transformDto.LocalScale;
+    }
 
-            var propList = GetPropList(manager);
+    public override void Serialize(PropManager manager, BinaryWriter writer)
+    {
+        writer.Write(PropManager.header);
+        writer.WriteVersion(version);
 
-            writer.Write(propList.Count);
+        var propList = GetPropList(manager);
 
-            foreach (var prop in propList)
-                DragPointDtoSerializer.Serialize(new DragPointPropDTO(prop), writer);
-        }
+        writer.Write(propList.Count);
 
-        public override void Deserialize(PropManager manager, BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+        foreach (var prop in propList)
+            DragPointDtoSerializer.Serialize(new DragPointPropDTO(prop), writer);
+    }
 
-            manager.DeleteAllProps();
+    public override void Deserialize(PropManager manager, BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
+
+        manager.DeleteAllProps();
 
-            var propList = GetPropList(manager);
-            var propCount = reader.ReadInt32();
-            var propIndex = 0;
+        var propList = GetPropList(manager);
+        var propCount = reader.ReadInt32();
+        var propIndex = 0;
 
-            for (var i = 0; i < propCount; i++)
-            {
-                var dragPointPropDto = DragPointDtoSerializer.Deserialize(reader, metadata);
+        for (var i = 0; i < propCount; i++)
+        {
+            var dragPointPropDto = DragPointDtoSerializer.Deserialize(reader, metadata);
 
-                if (!manager.AddFromPropInfo(dragPointPropDto.PropInfo))
-                    continue;
+            if (!manager.AddFromPropInfo(dragPointPropDto.PropInfo))
+                continue;
 
-                Apply(manager, propList[propIndex], dragPointPropDto);
+            Apply(manager, propList[propIndex], dragPointPropDto);
 
-                propIndex++;
-            }
+            propIndex++;
         }
     }
 }

+ 242 - 243
src/MeidoPhotoStudio.Plugin/Serialization/Serializers/MeidoSerializer.cs

@@ -4,343 +4,342 @@ using System.Linq;
 using System.Text;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class MeidoSerializer : Serializer<Meido>
 {
-    public class MeidoSerializer : Serializer<Meido>
-    {
-        private const short version = 1;
-        private const short headVersion = 1;
-        private const short bodyVersion = 2;
-        private const short clothingVersion = 1;
+    private const short version = 1;
+    private const short headVersion = 1;
+    private const short bodyVersion = 2;
+    private const short clothingVersion = 1;
 
-        private static SimpleSerializer<PoseInfo> PoseInfoSerializer =>
-            Serialization.GetSimple<PoseInfo>();
+    private static SimpleSerializer<PoseInfo> PoseInfoSerializer =>
+        Serialization.GetSimple<PoseInfo>();
 
-        private static SimpleSerializer<TransformDTO> TransformDtoSerializer =>
-            Serialization.GetSimple<TransformDTO>();
+    private static SimpleSerializer<TransformDTO> TransformDtoSerializer =>
+        Serialization.GetSimple<TransformDTO>();
 
-        private static void SerializeHead(Meido meido, BinaryWriter writer)
-        {
-            var body = meido.Body;
+    private static void SerializeHead(Meido meido, BinaryWriter writer)
+    {
+        var body = meido.Body;
 
-            writer.WriteVersion(headVersion);
+        writer.WriteVersion(headVersion);
 
-            // eye direction
-            writer.WriteQuaternion(body.quaDefEyeL * Quaternion.Inverse(meido.DefaultEyeRotL));
-            writer.WriteQuaternion(body.quaDefEyeR * Quaternion.Inverse(meido.DefaultEyeRotR));
+        // eye direction
+        writer.WriteQuaternion(body.quaDefEyeL * Quaternion.Inverse(meido.DefaultEyeRotL));
+        writer.WriteQuaternion(body.quaDefEyeR * Quaternion.Inverse(meido.DefaultEyeRotR));
 
-            // free look
-            writer.Write(meido.FreeLook);
-            writer.WriteVector3(body.offsetLookTarget);
-            writer.WriteVector3(Utility.GetFieldValue<TBody, Vector3>(body, "HeadEulerAngle"));
+        // free look
+        writer.Write(meido.FreeLook);
+        writer.WriteVector3(body.offsetLookTarget);
+        writer.WriteVector3(Utility.GetFieldValue<TBody, Vector3>(body, "HeadEulerAngle"));
 
-            // Head/eye to camera
-            writer.Write(meido.HeadToCam);
-            writer.Write(meido.EyeToCam);
+        // Head/eye to camera
+        writer.Write(meido.HeadToCam);
+        writer.Write(meido.EyeToCam);
 
-            // face
-            var faceDict = meido.SerializeFace();
+        // face
+        var faceDict = meido.SerializeFace();
 
-            writer.Write(faceDict.Count);
+        writer.Write(faceDict.Count);
 
-            foreach (var (hash, value) in faceDict)
-            {
-                writer.Write(hash);
-                writer.Write(value);
-            }
+        foreach (var (hash, value) in faceDict)
+        {
+            writer.Write(hash);
+            writer.Write(value);
         }
+    }
 
-        private static void SerializeBody(Meido meido, BinaryWriter writer)
-        {
-            writer.WriteVersion(bodyVersion);
+    private static void SerializeBody(Meido meido, BinaryWriter writer)
+    {
+        writer.WriteVersion(bodyVersion);
 
-            // pose
-            var poseBuffer = meido.SerializePose(true);
+        // pose
+        var poseBuffer = meido.SerializePose(true);
 
-            writer.Write(poseBuffer.Length);
-            writer.Write(poseBuffer);
+        writer.Write(poseBuffer.Length);
+        writer.Write(poseBuffer);
 
-            PoseInfoSerializer.Serialize(meido.CachedPose, writer);
+        PoseInfoSerializer.Serialize(meido.CachedPose, writer);
 
-            // TODO: Think about how to indicate code for new versions of serialization.
-            #region v2
-            // sub mune rotation
-            var body = meido.Body;
+        // TODO: Think about how to indicate code for new versions of serialization.
+        #region v2
+        // sub mune rotation
+        var body = meido.Body;
 
-            writer.WriteQuaternion(body.GetBone("Mune_L_sub").localRotation);
-            writer.WriteQuaternion(body.GetBone("Mune_R_sub").localRotation);
-            #endregion
-        }
+        writer.WriteQuaternion(body.GetBone("Mune_L_sub").localRotation);
+        writer.WriteQuaternion(body.GetBone("Mune_R_sub").localRotation);
+        #endregion
+    }
 
-        private static void SerializeClothing(Meido meido, BinaryWriter writer)
-        {
-            var maid = meido.Maid;
-            var body = meido.Body;
+    private static void SerializeClothing(Meido meido, BinaryWriter writer)
+    {
+        var maid = meido.Maid;
+        var body = meido.Body;
 
-            writer.WriteVersion(clothingVersion);
+        writer.WriteVersion(clothingVersion);
 
-            // body visible
-            writer.Write(body.GetMask(TBody.SlotID.body));
+        // body visible
+        writer.Write(body.GetMask(TBody.SlotID.body));
+
+        // clothing
+        foreach (var clothingSlot in MaidDressingPane.ClothingSlots)
+        {
+            var value = true;
 
-            // clothing
-            foreach (var clothingSlot in MaidDressingPane.ClothingSlots)
+            if (clothingSlot == TBody.SlotID.wear)
             {
-                var value = true;
-
-                if (clothingSlot == TBody.SlotID.wear)
-                {
-                    if (MaidDressingPane.WearSlots.Any(slot => body.GetSlotLoaded(slot)))
-                        value = MaidDressingPane.WearSlots.Any(slot => body.GetMask(slot));
-                }
-                else if (clothingSlot == TBody.SlotID.megane)
-                {
-                    var slots = new[] { TBody.SlotID.megane, TBody.SlotID.accHead };
-
-                    if (slots.Any(slot => body.GetSlotLoaded(slot)))
-                        value = slots.Any(slot => body.GetMask(slot));
-                }
-                else if (body.GetSlotLoaded(clothingSlot))
-                    value = body.GetMask(clothingSlot);
-
-                writer.Write(value);
+                if (MaidDressingPane.WearSlots.Any(slot => body.GetSlotLoaded(slot)))
+                    value = MaidDressingPane.WearSlots.Any(slot => body.GetMask(slot));
             }
+            else if (clothingSlot == TBody.SlotID.megane)
+            {
+                var slots = new[] { TBody.SlotID.megane, TBody.SlotID.accHead };
 
-            // zurashi and mekure
-            writer.Write(meido.CurlingFront);
-            writer.Write(meido.CurlingBack);
-            writer.Write(meido.PantsuShift);
+                if (slots.Any(slot => body.GetSlotLoaded(slot)))
+                    value = slots.Any(slot => body.GetMask(slot));
+            }
+            else if (body.GetSlotLoaded(clothingSlot))
+                value = body.GetMask(clothingSlot);
 
-            // mpn attach props
-            var hasKousokuUpper = body.GetSlotLoaded(TBody.SlotID.kousoku_upper);
+            writer.Write(value);
+        }
 
-            writer.Write(hasKousokuUpper);
-            writer.Write(maid.GetProp(MPN.kousoku_upper).strTempFileName);
+        // zurashi and mekure
+        writer.Write(meido.CurlingFront);
+        writer.Write(meido.CurlingBack);
+        writer.Write(meido.PantsuShift);
 
-            var hasKousokuLower = body.GetSlotLoaded(TBody.SlotID.kousoku_lower);
+        // mpn attach props
+        var hasKousokuUpper = body.GetSlotLoaded(TBody.SlotID.kousoku_upper);
 
-            writer.Write(hasKousokuLower);
-            writer.Write(maid.GetProp(MPN.kousoku_lower).strTempFileName);
+        writer.Write(hasKousokuUpper);
+        writer.Write(maid.GetProp(MPN.kousoku_upper).strTempFileName);
 
-            // hair/skirt gravity
-            writer.Write(meido.HairGravityActive);
-            writer.Write(meido.HairGravityControl.Control.transform.localPosition);
+        var hasKousokuLower = body.GetSlotLoaded(TBody.SlotID.kousoku_lower);
 
-            writer.Write(meido.SkirtGravityActive);
-            writer.Write(meido.SkirtGravityControl.Control.transform.localPosition);
-        }
+        writer.Write(hasKousokuLower);
+        writer.Write(maid.GetProp(MPN.kousoku_lower).strTempFileName);
 
-        private static void DeserializeHead(Meido meido, BinaryReader reader, SceneMetadata metadata)
-        {
-            var body = meido.Body;
+        // hair/skirt gravity
+        writer.Write(meido.HairGravityActive);
+        writer.Write(meido.HairGravityControl.Control.transform.localPosition);
 
-            _ = reader.ReadVersion();
+        writer.Write(meido.SkirtGravityActive);
+        writer.Write(meido.SkirtGravityControl.Control.transform.localPosition);
+    }
 
-            var mmConverted = metadata.MMConverted;
+    private static void DeserializeHead(Meido meido, BinaryReader reader, SceneMetadata metadata)
+    {
+        var body = meido.Body;
 
-            var eyeRotationL = reader.ReadQuaternion();
-            var eyeRotationR = reader.ReadQuaternion();
+        _ = reader.ReadVersion();
 
-            if (!mmConverted)
-            {
-                eyeRotationL *= meido.DefaultEyeRotL;
-                eyeRotationR *= meido.DefaultEyeRotR;
-            }
+        var mmConverted = metadata.MMConverted;
 
-            body.quaDefEyeL = eyeRotationL;
-            body.quaDefEyeR = eyeRotationR;
+        var eyeRotationL = reader.ReadQuaternion();
+        var eyeRotationR = reader.ReadQuaternion();
 
-            var freeLook = meido.FreeLook = reader.ReadBoolean();
-            var offsetLookTarget = reader.ReadVector3();
-            var headEulerAngle = reader.ReadVector3();
+        if (!mmConverted)
+        {
+            eyeRotationL *= meido.DefaultEyeRotL;
+            eyeRotationR *= meido.DefaultEyeRotR;
+        }
 
-            if (freeLook)
-                body.offsetLookTarget = offsetLookTarget;
+        body.quaDefEyeL = eyeRotationL;
+        body.quaDefEyeR = eyeRotationR;
 
-            if (!metadata.MMConverted)
-            {
-                Utility.SetFieldValue(body, "HeadEulerAngleG", Vector3.zero);
-                Utility.SetFieldValue(body, "HeadEulerAngle", headEulerAngle);
-            }
+        var freeLook = meido.FreeLook = reader.ReadBoolean();
+        var offsetLookTarget = reader.ReadVector3();
+        var headEulerAngle = reader.ReadVector3();
 
-            meido.HeadToCam = reader.ReadBoolean();
-            meido.EyeToCam = reader.ReadBoolean();
+        if (freeLook)
+            body.offsetLookTarget = offsetLookTarget;
 
-            var faceBlendCount = reader.ReadInt32();
+        if (!metadata.MMConverted)
+        {
+            Utility.SetFieldValue(body, "HeadEulerAngleG", Vector3.zero);
+            Utility.SetFieldValue(body, "HeadEulerAngle", headEulerAngle);
+        }
 
-            for (var i = 0; i < faceBlendCount; i++)
-            {
-                var hash = reader.ReadString();
-                var value = reader.ReadSingle();
+        meido.HeadToCam = reader.ReadBoolean();
+        meido.EyeToCam = reader.ReadBoolean();
 
-                meido.SetFaceBlendValue(hash, value);
-            }
-        }
+        var faceBlendCount = reader.ReadInt32();
 
-        private static void DeserializeBody(Meido meido, BinaryReader reader, SceneMetadata metadata)
+        for (var i = 0; i < faceBlendCount; i++)
         {
-            var version = reader.ReadVersion();
+            var hash = reader.ReadString();
+            var value = reader.ReadSingle();
 
-            var muneSetting = new KeyValuePair<bool, bool>(true, true);
+            meido.SetFaceBlendValue(hash, value);
+        }
+    }
 
-            if (metadata.MMConverted)
-                meido.IKManager.Deserialize(reader);
-            else
-            {
-                var poseBufferLength = reader.ReadInt32();
-                var poseBuffer = reader.ReadBytes(poseBufferLength);
+    private static void DeserializeBody(Meido meido, BinaryReader reader, SceneMetadata metadata)
+    {
+        var version = reader.ReadVersion();
 
-                muneSetting = meido.SetFrameBinary(poseBuffer);
-            }
+        var muneSetting = new KeyValuePair<bool, bool>(true, true);
 
-            var poseInfo = PoseInfoSerializer.Deserialize(reader, metadata);
+        if (metadata.MMConverted)
+            meido.IKManager.Deserialize(reader);
+        else
+        {
+            var poseBufferLength = reader.ReadInt32();
+            var poseBuffer = reader.ReadBytes(poseBufferLength);
 
-            Utility.SetPropertyValue(meido, nameof(Meido.CachedPose), poseInfo);
+            muneSetting = meido.SetFrameBinary(poseBuffer);
+        }
 
-            meido.SetMune(!muneSetting.Key, true);
-            meido.SetMune(!muneSetting.Value);
+        var poseInfo = PoseInfoSerializer.Deserialize(reader, metadata);
 
-            if (version >= 2)
-            {
-                var muneLSubRotation = reader.ReadQuaternion();
-                var muneSubRRotation = reader.ReadQuaternion();
+        Utility.SetPropertyValue(meido, nameof(Meido.CachedPose), poseInfo);
 
-                var body = meido.Body;
+        meido.SetMune(!muneSetting.Key, true);
+        meido.SetMune(!muneSetting.Value);
 
-                if (muneSetting.Key)
-                    body.GetBone("Mune_L_sub").localRotation = muneLSubRotation;
+        if (version >= 2)
+        {
+            var muneLSubRotation = reader.ReadQuaternion();
+            var muneSubRRotation = reader.ReadQuaternion();
 
-                if (muneSetting.Value)
-                    body.GetBone("Mune_R_sub").localRotation = muneSubRRotation;
-            }
+            var body = meido.Body;
+
+            if (muneSetting.Key)
+                body.GetBone("Mune_L_sub").localRotation = muneLSubRotation;
+
+            if (muneSetting.Value)
+                body.GetBone("Mune_R_sub").localRotation = muneSubRRotation;
         }
+    }
 
-        private static void DeserializeClothing(Meido meido, BinaryReader reader, SceneMetadata metadata)
-        {
-            var body = meido.Body;
+    private static void DeserializeClothing(Meido meido, BinaryReader reader, SceneMetadata metadata)
+    {
+        var body = meido.Body;
+
+        _ = reader.ReadVersion();
 
-            _ = reader.ReadVersion();
+        meido.SetBodyMask(reader.ReadBoolean());
 
-            meido.SetBodyMask(reader.ReadBoolean());
+        foreach (var clothingSlot in MaidDressingPane.ClothingSlots)
+        {
+            var value = reader.ReadBoolean();
+
+            if (metadata.MMConverted)
+                continue;
 
-            foreach (var clothingSlot in MaidDressingPane.ClothingSlots)
+            if (clothingSlot == TBody.SlotID.wear)
+            {
+                body.SetMask(TBody.SlotID.wear, value);
+                body.SetMask(TBody.SlotID.mizugi, value);
+                body.SetMask(TBody.SlotID.onepiece, value);
+            }
+            else if (clothingSlot == TBody.SlotID.megane)
             {
-                var value = reader.ReadBoolean();
-
-                if (metadata.MMConverted)
-                    continue;
-
-                if (clothingSlot == TBody.SlotID.wear)
-                {
-                    body.SetMask(TBody.SlotID.wear, value);
-                    body.SetMask(TBody.SlotID.mizugi, value);
-                    body.SetMask(TBody.SlotID.onepiece, value);
-                }
-                else if (clothingSlot == TBody.SlotID.megane)
-                {
-                    body.SetMask(TBody.SlotID.megane, value);
-                    body.SetMask(TBody.SlotID.accHead, value);
-                }
-                else if (body.GetSlotLoaded(clothingSlot))
-                    body.SetMask(clothingSlot, value);
+                body.SetMask(TBody.SlotID.megane, value);
+                body.SetMask(TBody.SlotID.accHead, value);
             }
+            else if (body.GetSlotLoaded(clothingSlot))
+                body.SetMask(clothingSlot, value);
+        }
 
-            // zurashi and mekure
-            var curlingFront = reader.ReadBoolean();
-            var curlingBack = reader.ReadBoolean();
-            var curlingPantsu = reader.ReadBoolean();
+        // zurashi and mekure
+        var curlingFront = reader.ReadBoolean();
+        var curlingBack = reader.ReadBoolean();
+        var curlingPantsu = reader.ReadBoolean();
 
-            if (!metadata.MMConverted)
-            {
-                if (meido.CurlingFront != curlingFront)
-                    meido.SetCurling(Meido.Curl.Front, curlingFront);
+        if (!metadata.MMConverted)
+        {
+            if (meido.CurlingFront != curlingFront)
+                meido.SetCurling(Meido.Curl.Front, curlingFront);
 
-                if (meido.CurlingBack != curlingBack)
-                    meido.SetCurling(Meido.Curl.Back, curlingBack);
+            if (meido.CurlingBack != curlingBack)
+                meido.SetCurling(Meido.Curl.Back, curlingBack);
 
-                meido.SetCurling(Meido.Curl.Shift, curlingPantsu);
-            }
+            meido.SetCurling(Meido.Curl.Shift, curlingPantsu);
+        }
 
-            // MPN attach upper prop
-            var hasKousokuUpper = reader.ReadBoolean();
-            var upperMenuFile = reader.ReadString();
+        // MPN attach upper prop
+        var hasKousokuUpper = reader.ReadBoolean();
+        var upperMenuFile = reader.ReadString();
 
-            if (hasKousokuUpper)
-                meido.SetMpnProp(new MpnAttachProp(MPN.kousoku_upper, upperMenuFile), false);
+        if (hasKousokuUpper)
+            meido.SetMpnProp(new MpnAttachProp(MPN.kousoku_upper, upperMenuFile), false);
 
-            // MPN attach lower prop
-            var hasKousokuLower = reader.ReadBoolean();
-            var lowerMenuFile = reader.ReadString();
+        // MPN attach lower prop
+        var hasKousokuLower = reader.ReadBoolean();
+        var lowerMenuFile = reader.ReadString();
 
-            if (hasKousokuLower)
-                meido.SetMpnProp(new MpnAttachProp(MPN.kousoku_lower, lowerMenuFile), false);
+        if (hasKousokuLower)
+            meido.SetMpnProp(new MpnAttachProp(MPN.kousoku_lower, lowerMenuFile), false);
 
-            // hair gravity
-            var hairGravityActive = reader.ReadBoolean();
-            var hairPosition = reader.ReadVector3();
+        // hair gravity
+        var hairGravityActive = reader.ReadBoolean();
+        var hairPosition = reader.ReadVector3();
 
-            meido.HairGravityActive = hairGravityActive;
+        meido.HairGravityActive = hairGravityActive;
 
-            if (meido.HairGravityActive)
-                meido.ApplyGravity(hairPosition);
+        if (meido.HairGravityActive)
+            meido.ApplyGravity(hairPosition);
 
-            // skirt gravity
-            var skirtGravityActive = reader.ReadBoolean();
-            var skirtPosition = reader.ReadVector3();
+        // skirt gravity
+        var skirtGravityActive = reader.ReadBoolean();
+        var skirtPosition = reader.ReadVector3();
 
-            meido.SkirtGravityActive = skirtGravityActive;
+        meido.SkirtGravityActive = skirtGravityActive;
 
-            if (meido.SkirtGravityActive)
-                meido.ApplyGravity(skirtPosition, true);
-        }
+        if (meido.SkirtGravityActive)
+            meido.ApplyGravity(skirtPosition, true);
+    }
 
-        public override void Serialize(Meido meido, BinaryWriter writer)
-        {
-            var maid = meido.Maid;
+    public override void Serialize(Meido meido, BinaryWriter writer)
+    {
+        var maid = meido.Maid;
 
-            using var memoryStream = new MemoryStream();
-            using var tempWriter = new BinaryWriter(memoryStream, Encoding.UTF8);
+        using var memoryStream = new MemoryStream();
+        using var tempWriter = new BinaryWriter(memoryStream, Encoding.UTF8);
 
-            tempWriter.WriteVersion(version);
+        tempWriter.WriteVersion(version);
 
-            TransformDtoSerializer.Serialize(new TransformDTO(maid.transform), tempWriter);
+        TransformDtoSerializer.Serialize(new TransformDTO(maid.transform), tempWriter);
 
-            SerializeHead(meido, tempWriter);
+        SerializeHead(meido, tempWriter);
 
-            SerializeBody(meido, tempWriter);
+        SerializeBody(meido, tempWriter);
 
-            SerializeClothing(meido, tempWriter);
+        SerializeClothing(meido, tempWriter);
 
-            writer.Write(memoryStream.Length);
-            writer.Write(memoryStream.ToArray());
-        }
+        writer.Write(memoryStream.Length);
+        writer.Write(memoryStream.ToArray());
+    }
 
-        public override void Deserialize(Meido meido, BinaryReader reader, SceneMetadata metadata)
-        {
-            var maid = meido.Maid;
+    public override void Deserialize(Meido meido, BinaryReader reader, SceneMetadata metadata)
+    {
+        var maid = meido.Maid;
 
-            maid.GetAnimation().Stop();
-            meido.DetachAllMpnAttach();
-            meido.StopBlink();
+        maid.GetAnimation().Stop();
+        meido.DetachAllMpnAttach();
+        meido.StopBlink();
 
-            reader.ReadInt64(); // data length
+        reader.ReadInt64(); // data length
 
-            _ = reader.ReadVersion();
+        _ = reader.ReadVersion();
 
-            var transformDto = TransformDtoSerializer.Deserialize(reader, metadata);
-            var maidTransform = maid.transform;
+        var transformDto = TransformDtoSerializer.Deserialize(reader, metadata);
+        var maidTransform = maid.transform;
 
-            // TODO: use transform.SetRotationAndPosition
-            maidTransform.position = transformDto.Position;
-            maidTransform.rotation = transformDto.Rotation;
-            maidTransform.localScale = transformDto.LocalScale;
+        // TODO: use transform.SetRotationAndPosition
+        maidTransform.position = transformDto.Position;
+        maidTransform.rotation = transformDto.Rotation;
+        maidTransform.localScale = transformDto.LocalScale;
 
-            meido.IKManager.SetDragPointScale(maidTransform.localScale.x);
+        meido.IKManager.SetDragPointScale(maidTransform.localScale.x);
 
-            DeserializeHead(meido, reader, metadata);
+        DeserializeHead(meido, reader, metadata);
 
-            DeserializeBody(meido, reader, metadata);
+        DeserializeBody(meido, reader, metadata);
 
-            DeserializeClothing(meido, reader, metadata);
-        }
+        DeserializeClothing(meido, reader, metadata);
     }
 }

+ 9 - 10
src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializer.cs

@@ -1,17 +1,16 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public abstract class SimpleSerializer<T> : ISimpleSerializer
 {
-    public abstract class SimpleSerializer<T> : ISimpleSerializer
-    {
-        void ISimpleSerializer.Serialize(object obj, BinaryWriter writer) =>
-            Serialize((T)obj, writer);
+    void ISimpleSerializer.Serialize(object obj, BinaryWriter writer) =>
+        Serialize((T)obj, writer);
 
-        object ISimpleSerializer.Deserialize(BinaryReader reader, SceneMetadata metadata) =>
-            Deserialize(reader, metadata);
+    object ISimpleSerializer.Deserialize(BinaryReader reader, SceneMetadata metadata) =>
+        Deserialize(reader, metadata);
 
-        public abstract void Serialize(T obj, BinaryWriter writer);
+    public abstract void Serialize(T obj, BinaryWriter writer);
 
-        public abstract T Deserialize(BinaryReader reader, SceneMetadata metadata);
-    }
+    public abstract T Deserialize(BinaryReader reader, SceneMetadata metadata);
 }

+ 48 - 49
src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/DragPointPropDTOSerializer.cs

@@ -1,69 +1,68 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class DragPointPropDTOSerializer : SimpleSerializer<DragPointPropDTO>
 {
-    public class DragPointPropDTOSerializer : SimpleSerializer<DragPointPropDTO>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        private static SimpleSerializer<PropInfo> PropInfoSerializer =>
-            Serialization.GetSimple<PropInfo>();
+    private static SimpleSerializer<PropInfo> PropInfoSerializer =>
+        Serialization.GetSimple<PropInfo>();
 
-        private static SimpleSerializer<TransformDTO> TransformSerializer =>
-            Serialization.GetSimple<TransformDTO>();
+    private static SimpleSerializer<TransformDTO> TransformSerializer =>
+        Serialization.GetSimple<TransformDTO>();
 
-        private static SimpleSerializer<AttachPointInfo> AttachPointSerializer =>
-            Serialization.GetSimple<AttachPointInfo>();
+    private static SimpleSerializer<AttachPointInfo> AttachPointSerializer =>
+        Serialization.GetSimple<AttachPointInfo>();
 
-        public override void Serialize(DragPointPropDTO dragPointDto, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+    public override void Serialize(DragPointPropDTO dragPointDto, BinaryWriter writer)
+    {
+        writer.WriteVersion(version);
 
-            PropInfoSerializer.Serialize(dragPointDto.PropInfo, writer);
+        PropInfoSerializer.Serialize(dragPointDto.PropInfo, writer);
 
-            TransformSerializer.Serialize(dragPointDto.TransformDTO, writer);
+        TransformSerializer.Serialize(dragPointDto.TransformDTO, writer);
 
-            AttachPointSerializer.Serialize(dragPointDto.AttachPointInfo, writer);
+        AttachPointSerializer.Serialize(dragPointDto.AttachPointInfo, writer);
 
-            writer.Write(dragPointDto.ShadowCasting);
-        }
+        writer.Write(dragPointDto.ShadowCasting);
+    }
+
+    public override DragPointPropDTO Deserialize(BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-        public override DragPointPropDTO Deserialize(BinaryReader reader, SceneMetadata metadata)
+        return new DragPointPropDTO
         {
-            _ = reader.ReadVersion();
-
-            return new DragPointPropDTO
-            {
-                PropInfo = PropInfoSerializer.Deserialize(reader, metadata),
-                TransformDTO = TransformSerializer.Deserialize(reader, metadata),
-                AttachPointInfo = AttachPointSerializer.Deserialize(reader, metadata),
-                ShadowCasting = reader.ReadBoolean()
-            };
-        }
+            PropInfo = PropInfoSerializer.Deserialize(reader, metadata),
+            TransformDTO = TransformSerializer.Deserialize(reader, metadata),
+            AttachPointInfo = AttachPointSerializer.Deserialize(reader, metadata),
+            ShadowCasting = reader.ReadBoolean()
+        };
     }
+}
 
-    public class DragPointPropDTO
-    {
-        public TransformDTO TransformDTO { get; set; }
-        public AttachPointInfo AttachPointInfo { get; set; }
-        public PropInfo PropInfo { get; set; }
-        public bool ShadowCasting { get; set; }
+public class DragPointPropDTO
+{
+    public TransformDTO TransformDTO { get; set; }
+    public AttachPointInfo AttachPointInfo { get; set; }
+    public PropInfo PropInfo { get; set; }
+    public bool ShadowCasting { get; set; }
 
-        public DragPointPropDTO() { }
+    public DragPointPropDTO() { }
 
-        public DragPointPropDTO(DragPointProp dragPoint)
-        {
-            TransformDTO = new TransformDTO(dragPoint.MyObject.transform);
-            ShadowCasting = dragPoint.ShadowCasting;
-            AttachPointInfo = dragPoint.AttachPointInfo;
-            PropInfo = dragPoint.Info;
-        }
+    public DragPointPropDTO(DragPointProp dragPoint)
+    {
+        TransformDTO = new TransformDTO(dragPoint.MyObject.transform);
+        ShadowCasting = dragPoint.ShadowCasting;
+        AttachPointInfo = dragPoint.AttachPointInfo;
+        PropInfo = dragPoint.Info;
+    }
 
-        public void Deconstruct(out TransformDTO transform, out AttachPointInfo attachPointInfo, out bool shadowCasting)
-        {
-            transform = TransformDTO;
-            attachPointInfo = AttachPointInfo;
-            shadowCasting = ShadowCasting;
-        }
+    public void Deconstruct(out TransformDTO transform, out AttachPointInfo attachPointInfo, out bool shadowCasting)
+    {
+        transform = TransformDTO;
+        attachPointInfo = AttachPointInfo;
+        shadowCasting = ShadowCasting;
     }
 }

+ 15 - 16
src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/PoseInfoSerializer.cs

@@ -1,25 +1,24 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class PoseInfoSerializer : SimpleSerializer<PoseInfo>
 {
-    public class PoseInfoSerializer : SimpleSerializer<PoseInfo>
-    {
-        private const short version = 1;
+    private const short version = 1;
 
-        public override void Serialize(PoseInfo obj, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+    public override void Serialize(PoseInfo obj, BinaryWriter writer)
+    {
+        writer.WriteVersion(version);
 
-            writer.Write(obj.PoseGroup);
-            writer.Write(obj.Pose);
-            writer.Write(obj.CustomPose);
-        }
+        writer.Write(obj.PoseGroup);
+        writer.Write(obj.Pose);
+        writer.Write(obj.CustomPose);
+    }
 
-        public override PoseInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
-        {
-            _ = reader.ReadVersion();
+    public override PoseInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-            return new(reader.ReadString(), reader.ReadString(), reader.ReadBoolean());
-        }
+        return new(reader.ReadString(), reader.ReadString(), reader.ReadBoolean());
     }
 }

+ 22 - 23
src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/PropInfoSerializer.cs

@@ -1,33 +1,32 @@
 using System.IO;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class PropInfoSerializer : SimpleSerializer<PropInfo>
 {
-    public class PropInfoSerializer : SimpleSerializer<PropInfo>
+    private const short version = 1;
+
+    public override void Serialize(PropInfo info, BinaryWriter writer)
     {
-        private const short version = 1;
+        writer.WriteVersion(version);
 
-        public override void Serialize(PropInfo info, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+        writer.Write((int)info.Type);
+        writer.WriteNullableString(info.Filename);
+        writer.WriteNullableString(info.SubFilename);
+        writer.Write(info.MyRoomID);
+        writer.WriteNullableString(info.IconFile);
+    }
 
-            writer.Write((int)info.Type);
-            writer.WriteNullableString(info.Filename);
-            writer.WriteNullableString(info.SubFilename);
-            writer.Write(info.MyRoomID);
-            writer.WriteNullableString(info.IconFile);
-        }
+    public override PropInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-        public override PropInfo Deserialize(BinaryReader reader, SceneMetadata metadata)
+        return new PropInfo((PropInfo.PropType)reader.ReadInt32())
         {
-            _ = reader.ReadVersion();
-
-            return new PropInfo((PropInfo.PropType)reader.ReadInt32())
-            {
-                Filename = reader.ReadNullableString(),
-                SubFilename = reader.ReadNullableString(),
-                MyRoomID = reader.ReadInt32(),
-                IconFile = reader.ReadNullableString()
-            };
-        }
+            Filename = reader.ReadNullableString(),
+            SubFilename = reader.ReadNullableString(),
+            MyRoomID = reader.ReadInt32(),
+            IconFile = reader.ReadNullableString()
+        };
     }
 }

+ 39 - 40
src/MeidoPhotoStudio.Plugin/Serialization/SimpleSerializers/TransformDTOSerializer.cs

@@ -1,55 +1,54 @@
 using System.IO;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class TransformDTOSerializer : SimpleSerializer<TransformDTO>
 {
-    public class TransformDTOSerializer : SimpleSerializer<TransformDTO>
+    private const short version = 1;
+
+    public override void Serialize(TransformDTO transform, BinaryWriter writer)
     {
-        private const short version = 1;
+        writer.WriteVersion(version);
 
-        public override void Serialize(TransformDTO transform, BinaryWriter writer)
-        {
-            writer.WriteVersion(version);
+        writer.Write(transform.Position);
+        writer.Write(transform.Rotation);
+        writer.Write(transform.LocalPosition);
+        writer.Write(transform.LocalRotation);
+        writer.Write(transform.LocalScale);
+    }
 
-            writer.Write(transform.Position);
-            writer.Write(transform.Rotation);
-            writer.Write(transform.LocalPosition);
-            writer.Write(transform.LocalRotation);
-            writer.Write(transform.LocalScale);
-        }
+    public override TransformDTO Deserialize(BinaryReader reader, SceneMetadata metadata)
+    {
+        _ = reader.ReadVersion();
 
-        public override TransformDTO Deserialize(BinaryReader reader, SceneMetadata metadata)
+        return new TransformDTO
         {
-            _ = reader.ReadVersion();
-
-            return new TransformDTO
-            {
-                Position = reader.ReadVector3(),
-                Rotation = reader.ReadQuaternion(),
-                LocalPosition = reader.ReadVector3(),
-                LocalRotation = reader.ReadQuaternion(),
-                LocalScale = reader.ReadVector3()
-            };
-        }
+            Position = reader.ReadVector3(),
+            Rotation = reader.ReadQuaternion(),
+            LocalPosition = reader.ReadVector3(),
+            LocalRotation = reader.ReadQuaternion(),
+            LocalScale = reader.ReadVector3()
+        };
     }
+}
 
-    public class TransformDTO
-    {
-        public Vector3 Position { get; set; }
-        public Vector3 LocalPosition { get; set; }
-        public Quaternion Rotation { get; set; } = Quaternion.identity;
-        public Quaternion LocalRotation { get; set; } = Quaternion.identity;
-        public Vector3 LocalScale { get; set; } = Vector3.one;
+public class TransformDTO
+{
+    public Vector3 Position { get; set; }
+    public Vector3 LocalPosition { get; set; }
+    public Quaternion Rotation { get; set; } = Quaternion.identity;
+    public Quaternion LocalRotation { get; set; } = Quaternion.identity;
+    public Vector3 LocalScale { get; set; } = Vector3.one;
 
-        public TransformDTO() { }
+    public TransformDTO() { }
 
-        public TransformDTO(Transform transform)
-        {
-            Position = transform.position;
-            LocalPosition = transform.localPosition;
-            Rotation = transform.rotation;
-            LocalRotation = transform.localRotation;
-            LocalScale = transform.localScale;
-        }
+    public TransformDTO(Transform transform)
+    {
+        Position = transform.position;
+        LocalPosition = transform.localPosition;
+        Rotation = transform.rotation;
+        LocalRotation = transform.localRotation;
+        LocalScale = transform.localScale;
     }
 }

+ 90 - 91
src/MeidoPhotoStudio.Plugin/Translation.cs

@@ -5,140 +5,139 @@ using System.Linq;
 using BepInEx.Configuration;
 using Newtonsoft.Json.Linq;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class Translation
 {
-    public static class Translation
-    {
-        private const string settingsHeader = "Translation";
+    private const string settingsHeader = "Translation";
 
-        private static readonly string[] props = { "ui", "props", "bg", "face" };
-        private static readonly ConfigEntry<string> currentLanguage;
-        private static readonly ConfigEntry<bool> suppressWarnings;
+    private static readonly string[] props = { "ui", "props", "bg", "face" };
+    private static readonly ConfigEntry<string> currentLanguage;
+    private static readonly ConfigEntry<bool> suppressWarnings;
 
-        private static Dictionary<string, Dictionary<string, string>> Translations;
-        private static bool forceSuppressWarnings;
-        private static bool suppressWarningsCached;
+    private static Dictionary<string, Dictionary<string, string>> Translations;
+    private static bool forceSuppressWarnings;
+    private static bool suppressWarningsCached;
 
-        public static event EventHandler ReloadTranslationEvent;
+    public static event EventHandler ReloadTranslationEvent;
 
-        public static bool SuppressWarnings
+    public static bool SuppressWarnings
+    {
+        get => suppressWarningsCached;
+        set
         {
-            get => suppressWarningsCached;
-            set
-            {
-                suppressWarningsCached = value;
-                suppressWarnings.Value = value;
-            }
+            suppressWarningsCached = value;
+            suppressWarnings.Value = value;
         }
+    }
 
-        public static string CurrentLanguage
-        {
-            get => currentLanguage.Value;
-            set => currentLanguage.Value = value;
-        }
+    public static string CurrentLanguage
+    {
+        get => currentLanguage.Value;
+        set => currentLanguage.Value = value;
+    }
 
-        static Translation()
-        {
-            currentLanguage = Configuration.Config.Bind(
+    static Translation()
+    {
+        currentLanguage = Configuration.Config.Bind(
                 settingsHeader, "Language",
                 "en",
                 "Directory to pull translations from"
                 + "\nTranslations are found in the 'Translations' folder"
-            );
+                );
 
-            suppressWarnings = Configuration.Config.Bind(
+        suppressWarnings = Configuration.Config.Bind(
                 settingsHeader, "SuppressWarnings",
                 false,
                 "Suppress translation warnings from showing up in the console"
-            );
+                );
 
-            suppressWarningsCached = !suppressWarnings.Value;
-        }
+        suppressWarningsCached = !suppressWarnings.Value;
+    }
 
-        public static void Initialize(string language)
-        {
-            forceSuppressWarnings = false;
+    public static void Initialize(string language)
+    {
+        forceSuppressWarnings = false;
 
-            var rootTranslationPath = Path.Combine(Constants.configPath, Constants.translationDirectory);
-            var currentTranslationPath = Path.Combine(rootTranslationPath, language);
+        var rootTranslationPath = Path.Combine(Constants.configPath, Constants.translationDirectory);
+        var currentTranslationPath = Path.Combine(rootTranslationPath, language);
 
-            Translations = new(StringComparer.InvariantCultureIgnoreCase);
+        Translations = new(StringComparer.InvariantCultureIgnoreCase);
 
-            if (!Directory.Exists(currentTranslationPath))
-            {
-                Utility.LogError($"No translations found for '{language}' in '{currentTranslationPath}'");
-                forceSuppressWarnings = true;
+        if (!Directory.Exists(currentTranslationPath))
+        {
+            Utility.LogError($"No translations found for '{language}' in '{currentTranslationPath}'");
+            forceSuppressWarnings = true;
 
-                return;
-            }
+            return;
+        }
+
+        foreach (var prop in props)
+        {
+            var translationFile = $"translation.{prop}.json";
 
-            foreach (var prop in props)
+            try
             {
-                var translationFile = $"translation.{prop}.json";
+                var translationPath = Path.Combine(currentTranslationPath, translationFile);
+                var translationJson = File.ReadAllText(translationPath);
+                var translation = JObject.Parse(translationJson);
 
-                try
+                foreach (var translationProp in translation.AsJEnumerable().Cast<JProperty>())
                 {
-                    var translationPath = Path.Combine(currentTranslationPath, translationFile);
-                    var translationJson = File.ReadAllText(translationPath);
-                    var translation = JObject.Parse(translationJson);
-
-                    foreach (var translationProp in translation.AsJEnumerable().Cast<JProperty>())
-                    {
-                        var token = translationProp.Value;
+                    var token = translationProp.Value;
 
-                        Translations[translationProp.Path] = new(
+                    Translations[translationProp.Path] = new(
                             token.ToObject<Dictionary<string, string>>(), StringComparer.InvariantCultureIgnoreCase
-                        );
-                    }
-                }
-                catch
-                {
-                    forceSuppressWarnings = true;
-                    Utility.LogError($"Could not find translation file '{translationFile}'");
+                            );
                 }
             }
+            catch
+            {
+                forceSuppressWarnings = true;
+                Utility.LogError($"Could not find translation file '{translationFile}'");
+            }
         }
+    }
 
-        public static void ReinitializeTranslation()
-        {
-            Initialize(CurrentLanguage);
-            ReloadTranslationEvent?.Invoke(null, EventArgs.Empty);
-        }
+    public static void ReinitializeTranslation()
+    {
+        Initialize(CurrentLanguage);
+        ReloadTranslationEvent?.Invoke(null, EventArgs.Empty);
+    }
 
-        public static bool Has(string category, string text, bool warn = false)
-        {
-            warn = !forceSuppressWarnings && !SuppressWarnings && warn;
+    public static bool Has(string category, string text, bool warn = false)
+    {
+        warn = !forceSuppressWarnings && !SuppressWarnings && warn;
 
-            if (!Translations.ContainsKey(category))
-            {
-                if (warn)
-                    Utility.LogWarning($"Could not translate '{text}': category '{category}' was not found");
+        if (!Translations.ContainsKey(category))
+        {
+            if (warn)
+                Utility.LogWarning($"Could not translate '{text}': category '{category}' was not found");
 
-                return false;
-            }
+            return false;
+        }
 
-            if (!Translations[category].ContainsKey(text))
+        if (!Translations[category].ContainsKey(text))
+        {
+            if (warn)
             {
-                if (warn)
-                {
-                    Utility.LogWarning(
+                Utility.LogWarning(
                         $"Could not translate '{text}': '{text}' was not found in category '{category}'"
-                    );
-                }
-
-                return false;
+                        );
             }
 
-            return true;
+            return false;
         }
 
-        public static string Get(string category, string text, bool warn = true) =>
-            Has(category, text, warn) ? Translations[category][text] : text;
+        return true;
+    }
 
-        public static string[] GetArray(string category, IEnumerable<string> list) =>
-            GetList(category, list).ToArray();
+    public static string Get(string category, string text, bool warn = true) =>
+        Has(category, text, warn) ? Translations[category][text] : text;
 
-        public static IEnumerable<string> GetList(string category, IEnumerable<string> list) =>
-            list.Select(uiName => Get(category, uiName));
-    }
+    public static string[] GetArray(string category, IEnumerable<string> list) =>
+        GetList(category, list).ToArray();
+
+    public static IEnumerable<string> GetList(string category, IEnumerable<string> list) =>
+        list.Select(uiName => Get(category, uiName));
 }

+ 321 - 322
src/MeidoPhotoStudio.Plugin/Utility.cs

@@ -7,451 +7,450 @@ using System.Text.RegularExpressions;
 using Ionic.Zlib;
 using UnityEngine;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public static class Utility
 {
-    public static class Utility
-    {
-        public enum ModKey { Control, Shift, Alt }
+    public enum ModKey { Control, Shift, Alt }
 
-        private const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
-            | BindingFlags.Static;
+    private const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic
+        | BindingFlags.Static;
 
-        public static readonly BepInEx.Logging.ManualLogSource Logger =
-            BepInEx.Logging.Logger.CreateLogSource(MeidoPhotoStudio.pluginName);
+    public static readonly BepInEx.Logging.ManualLogSource Logger =
+        BepInEx.Logging.Logger.CreateLogSource(MeidoPhotoStudio.pluginName);
 
-        public static string Timestamp =>
-            $"{DateTime.Now:yyyyMMddHHmmss}";
+    public static string Timestamp =>
+        $"{DateTime.Now:yyyyMMddHHmmss}";
 
-        public static Vector3 MousePosition =>
-            mousePosition.Position;
+    public static Vector3 MousePosition =>
+        mousePosition.Position;
 
-        internal static readonly byte[] pngHeader = { 137, 80, 78, 71, 13, 10, 26, 10 };
-        internal static readonly byte[] pngEnd = System.Text.Encoding.ASCII.GetBytes("IEND");
-        internal static readonly Regex guidRegEx = new(
+    internal static readonly byte[] pngHeader = { 137, 80, 78, 71, 13, 10, 26, 10 };
+    internal static readonly byte[] pngEnd = System.Text.Encoding.ASCII.GetBytes("IEND");
+    internal static readonly Regex guidRegEx = new(
             @"^[a-f0-9]{8}(\-[a-f0-9]{4}){3}\-[a-f0-9]{12}$", RegexOptions.IgnoreCase
-        );
-        internal static readonly GameObject mousePositionGo;
-        internal static readonly MousePosition mousePosition;
+            );
+    internal static readonly GameObject mousePositionGo;
+    internal static readonly MousePosition mousePosition;
 
-        static Utility()
-        {
-            mousePositionGo = new();
-            mousePosition = mousePositionGo.AddComponent<MousePosition>();
-        }
+    static Utility()
+    {
+        mousePositionGo = new();
+        mousePosition = mousePositionGo.AddComponent<MousePosition>();
+    }
 
-        public static void LogInfo(object data) =>
-            Logger.LogInfo(data);
+    public static void LogInfo(object data) =>
+        Logger.LogInfo(data);
 
-        public static void LogMessage(object data) =>
-            Logger.LogMessage(data);
+    public static void LogMessage(object data) =>
+        Logger.LogMessage(data);
 
-        public static void LogWarning(object data) =>
-            Logger.LogWarning(data);
+    public static void LogWarning(object data) =>
+        Logger.LogWarning(data);
 
-        public static void LogError(object data) =>
-            Logger.LogError(data);
+    public static void LogError(object data) =>
+        Logger.LogError(data);
 
-        public static void LogDebug(object data) =>
-            Logger.LogDebug(data);
+    public static void LogDebug(object data) =>
+        Logger.LogDebug(data);
 
-        public static int Wrap(int value, int min, int max)
-        {
-            max--;
+    public static int Wrap(int value, int min, int max)
+    {
+        max--;
 
-            return value < min ? max : value > max ? min : value;
-        }
+        return value < min ? max : value > max ? min : value;
+    }
 
-        public static int GetPix(int num) =>
-            (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) =>
-            left > (double)right ? Mathf.Clamp(value, right, left) : Mathf.Clamp(value, left, right);
+    public static float Bound(float value, float left, float right) =>
+        left > (double)right ? Mathf.Clamp(value, right, left) : Mathf.Clamp(value, left, right);
 
-        public static int Bound(int value, int left, int right) =>
-            left > right ? Mathf.Clamp(value, right, left) : Mathf.Clamp(value, left, right);
+    public static int Bound(int value, int left, int right) =>
+        left > right ? Mathf.Clamp(value, right, left) : Mathf.Clamp(value, left, right);
 
-        public static Texture2D MakeTex(int width, int height, Color color)
-        {
-            var colors = new Color32[width * height];
+    public static Texture2D MakeTex(int width, int height, Color color)
+    {
+        var colors = new Color32[width * height];
 
-            for (var i = 0; i < colors.Length; i++)
-                colors[i] = color;
+        for (var i = 0; i < colors.Length; i++)
+            colors[i] = color;
 
-            var texture2D = new Texture2D(width, height);
+        var texture2D = new Texture2D(width, height);
 
-            texture2D.SetPixels32(colors);
-            texture2D.Apply();
+        texture2D.SetPixels32(colors);
+        texture2D.Apply();
 
-            return texture2D;
-        }
+        return texture2D;
+    }
 
-        public static FieldInfo GetFieldInfo<T>(string field) =>
-            typeof(T).GetField(field, bindingFlags);
+    public static FieldInfo GetFieldInfo<T>(string field) =>
+        typeof(T).GetField(field, bindingFlags);
 
-        public static TValue GetFieldValue<TType, TValue>(TType instance, string field)
-        {
-            var fieldInfo = GetFieldInfo<TType>(field);
+    public static TValue GetFieldValue<TType, TValue>(TType instance, string field)
+    {
+        var fieldInfo = GetFieldInfo<TType>(field);
 
-            return fieldInfo is null || !fieldInfo.IsStatic && instance == null
-                ? default :
-                (TValue)fieldInfo.GetValue(instance);
-        }
+        return fieldInfo is null || !fieldInfo.IsStatic && instance == null
+            ? default :
+            (TValue)fieldInfo.GetValue(instance);
+    }
 
-        public static void SetFieldValue<TType, TValue>(TType instance, string name, TValue value) =>
-            GetFieldInfo<TType>(name).SetValue(instance, value);
+    public static void SetFieldValue<TType, TValue>(TType instance, string name, TValue value) =>
+        GetFieldInfo<TType>(name).SetValue(instance, value);
 
-        public static PropertyInfo GetPropertyInfo<T>(string field) =>
-            typeof(T).GetProperty(field, bindingFlags);
+    public static PropertyInfo GetPropertyInfo<T>(string field) =>
+        typeof(T).GetProperty(field, bindingFlags);
 
-        public static TValue GetPropertyValue<TType, TValue>(TType instance, string property)
-        {
-            var propertyInfo = GetPropertyInfo<TType>(property);
+    public static TValue GetPropertyValue<TType, TValue>(TType instance, string property)
+    {
+        var propertyInfo = GetPropertyInfo<TType>(property);
 
-            return propertyInfo is null
-                ? default
-                : (TValue)propertyInfo.GetValue(instance, null);
-        }
+        return propertyInfo is null
+            ? default
+            : (TValue)propertyInfo.GetValue(instance, null);
+    }
 
-        public static void SetPropertyValue<TType, TValue>(TType instance, string name, TValue value) =>
-            GetPropertyInfo<TType>(name).SetValue(instance, value, null);
+    public static void SetPropertyValue<TType, TValue>(TType instance, string name, TValue value) =>
+        GetPropertyInfo<TType>(name).SetValue(instance, value, null);
 
-        public static bool AnyMouseDown() =>
-            Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2);
+    public static bool AnyMouseDown() =>
+        Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2);
 
-        public static string ScreenshotFilename()
-        {
-            var screenShotDir = Path.Combine(
+    public static string ScreenshotFilename()
+    {
+        var 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{Timestamp}.png");
-        }
+        return Path.Combine(screenShotDir, $"img{Timestamp}.png");
+    }
 
-        public static string TempScreenshotFilename() =>
-            Path.Combine(Path.GetTempPath(), $"cm3d2_{Guid.NewGuid()}.png");
+    public static string TempScreenshotFilename() =>
+        Path.Combine(Path.GetTempPath(), $"cm3d2_{Guid.NewGuid()}.png");
 
-        public static void ShowMouseExposition(string text, float time = 2f)
-        {
-            var mouseExposition = MouseExposition.GetObject();
+    public static void ShowMouseExposition(string text, float time = 2f)
+    {
+        var mouseExposition = MouseExposition.GetObject();
 
-            mouseExposition.SetText(text, time);
-        }
+        mouseExposition.SetText(text, time);
+    }
 
-        public static bool IsGuidString(string guid) =>
-            !string.IsNullOrEmpty(guid) && guid.Length is 36 && guidRegEx.IsMatch(guid);
+    public static bool IsGuidString(string guid) =>
+        !string.IsNullOrEmpty(guid) && guid.Length is 36 && guidRegEx.IsMatch(guid);
 
-        public static string HandItemToOdogu(string menu)
-        {
-            menu = menu.Substring(menu.IndexOf('_') + 1);
-            menu = menu.Substring(0, menu.IndexOf("_i_.menu", StringComparison.OrdinalIgnoreCase));
-            menu = $"odogu_{menu}";
+    public static string HandItemToOdogu(string menu)
+    {
+        menu = menu.Substring(menu.IndexOf('_') + 1);
+        menu = menu.Substring(0, menu.IndexOf("_i_.menu", StringComparison.OrdinalIgnoreCase));
+        menu = $"odogu_{menu}";
 
-            return menu;
-        }
+        return menu;
+    }
 
-        public static void FixGameObjectScale(GameObject go)
-        {
-            var scale = go.transform.localScale;
-            var largest = Mathf.Max(scale.x, Mathf.Max(scale.y, scale.z));
+    public static void FixGameObjectScale(GameObject go)
+    {
+        var scale = go.transform.localScale;
+        var largest = Mathf.Max(scale.x, Mathf.Max(scale.y, scale.z));
 
-            go.transform.localScale = Vector3.one * (float)Math.Round(largest, 3);
-        }
+        go.transform.localScale = Vector3.one * (float)Math.Round(largest, 3);
+    }
 
-        public static string SanitizePathPortion(string path)
-        {
-            var invalid = Path.GetInvalidFileNameChars();
+    public static string SanitizePathPortion(string path)
+    {
+        var invalid = Path.GetInvalidFileNameChars();
 
-            path = path.Trim();
-            path = string.Join("_", path.Split(invalid)).Replace(".", "").Trim('_');
+        path = path.Trim();
+        path = string.Join("_", path.Split(invalid)).Replace(".", "").Trim('_');
 
-            return path;
-        }
+        return path;
+    }
 
-        public static string GP01FbFaceHash(TMorph face, string hash)
+    public static string GP01FbFaceHash(TMorph face, string hash)
+    {
+        if (face.bodyskin.PartsVersion >= 120 && hash is not "eyeclose3" && hash.StartsWith("eyeclose"))
         {
-            if (face.bodyskin.PartsVersion >= 120 && hash is not "eyeclose3" && hash.StartsWith("eyeclose"))
-            {
-                if (hash is "eyeclose")
-                    hash += '1';
-
-                hash += TMorph.crcFaceTypesStr[(int)face.GetFaceTypeGP01FB()];
-            }
+            if (hash is "eyeclose")
+                hash += '1';
 
-            return hash;
+            hash += TMorph.crcFaceTypesStr[(int)face.GetFaceTypeGP01FB()];
         }
 
-        public static void ResizeToFit(Texture2D texture, int maxWidth, int maxHeight)
-        {
-            var width = texture.width;
-            var height = texture.height;
+        return hash;
+    }
 
-            if (width == maxWidth && height == maxHeight)
-                return;
+    public static void ResizeToFit(Texture2D texture, int maxWidth, int maxHeight)
+    {
+        var width = texture.width;
+        var height = texture.height;
 
-            var scale = Mathf.Min(maxWidth / (float)width, maxHeight / (float)height);
+        if (width == maxWidth && height == maxHeight)
+            return;
 
-            width = Mathf.RoundToInt(width * scale);
-            height = Mathf.RoundToInt(height * scale);
-            TextureScale.Bilinear(texture, width, height);
-        }
+        var scale = Mathf.Min(maxWidth / (float)width, maxHeight / (float)height);
 
-        public static bool BytesEqual(byte[] buffer, byte[] other)
-        {
-            if (buffer.Length != other.Length)
-                return false;
+        width = Mathf.RoundToInt(width * scale);
+        height = Mathf.RoundToInt(height * scale);
+        TextureScale.Bilinear(texture, width, height);
+    }
 
-            for (var i = 0; i < buffer.Length; i++)
-                if (buffer[i] != other[i])
-                    return false;
+    public static bool BytesEqual(byte[] buffer, byte[] other)
+    {
+        if (buffer.Length != other.Length)
+            return false;
 
-            return true;
-        }
+        for (var i = 0; i < buffer.Length; i++)
+            if (buffer[i] != other[i])
+                return false;
 
-        public static bool IsPngFile(Stream stream)
-        {
-            var buffer = new byte[8];
+        return true;
+    }
 
-            stream.Read(buffer, 0, 8);
+    public static bool IsPngFile(Stream stream)
+    {
+        var buffer = new byte[8];
 
-            return BytesEqual(buffer, pngHeader);
-        }
+        stream.Read(buffer, 0, 8);
 
-        public static bool SeekPngEnd(Stream stream)
-        {
-            var buffer = new byte[8];
+        return BytesEqual(buffer, pngHeader);
+    }
 
-            stream.Read(buffer, 0, 8);
+    public static bool SeekPngEnd(Stream stream)
+    {
+        var buffer = new byte[8];
 
-            if (!BytesEqual(buffer, pngHeader))
-                return false;
+        stream.Read(buffer, 0, 8);
 
-            buffer = new byte[4];
+        if (!BytesEqual(buffer, pngHeader))
+            return false;
 
-            do
-            {
-                stream.Read(buffer, 0, 4);
+        buffer = new byte[4];
 
-                if (BitConverter.IsLittleEndian)
-                    Array.Reverse(buffer);
+        do
+        {
+            stream.Read(buffer, 0, 4);
 
-                var length = BitConverter.ToUInt32(buffer, 0);
+            if (BitConverter.IsLittleEndian)
+                Array.Reverse(buffer);
 
-                stream.Read(buffer, 0, 4);
-                stream.Seek(length + 4L, SeekOrigin.Current);
-            } while (!BytesEqual(buffer, pngEnd));
+            var length = BitConverter.ToUInt32(buffer, 0);
 
-            return true;
-        }
+            stream.Read(buffer, 0, 4);
+            stream.Seek(length + 4L, SeekOrigin.Current);
+        } while (!BytesEqual(buffer, pngEnd));
 
-        public static void WriteToFile(string name, IEnumerable<string> list)
-        {
-            if (Path.GetExtension(name) is not ".txt")
-                name += ".txt";
+        return true;
+    }
 
-            File.WriteAllLines(Path.Combine(Constants.configPath, name), list.ToArray());
-        }
+    public static void WriteToFile(string name, IEnumerable<string> list)
+    {
+        if (Path.GetExtension(name) is not ".txt")
+            name += ".txt";
 
-        public static void WriteToFile(string name, byte[] data) =>
-            File.WriteAllBytes(Path.Combine(Constants.configPath, name), data);
+        File.WriteAllLines(Path.Combine(Constants.configPath, name), list.ToArray());
     }
 
-    public class MousePosition : MonoBehaviour
-    {
-        public Vector3 Position =>
-            mousePosition;
+    public static void WriteToFile(string name, byte[] data) =>
+        File.WriteAllBytes(Path.Combine(Constants.configPath, name), data);
+}
 
-        private Vector3 mousePosition;
+public class MousePosition : MonoBehaviour
+{
+    public Vector3 Position =>
+        mousePosition;
 
-        private void Awake()
-        {
-            DontDestroyOnLoad(this);
+    private Vector3 mousePosition;
 
-            mousePosition = Input.mousePosition;
-        }
+    private void Awake()
+    {
+        DontDestroyOnLoad(this);
 
-        private void Update()
-        {
-            if (Input.GetMouseButton(0))
-            {
-                mousePosition.x += Input.GetAxis("Mouse X") * 20;
-                mousePosition.y += Input.GetAxis("Mouse Y") * 20;
-            }
-            else
-                mousePosition = Input.mousePosition;
-        }
+        mousePosition = Input.mousePosition;
     }
 
-    public static class KeyValuePairExtensions
+    private void Update()
     {
-        public static void Deconstruct<TKey, TValue>(
-            this KeyValuePair<TKey, TValue> kvp, out TKey key, out TValue value
-        )
+        if (Input.GetMouseButton(0))
         {
-            key = kvp.Key;
-            value = kvp.Value;
+            mousePosition.x += Input.GetAxis("Mouse X") * 20;
+            mousePosition.y += Input.GetAxis("Mouse Y") * 20;
         }
+        else
+            mousePosition = Input.mousePosition;
     }
+}
 
-    public static class StreamExtensions
+public static class KeyValuePairExtensions
+{
+    public static void Deconstruct<TKey, TValue>(
+            this KeyValuePair<TKey, TValue> kvp, out TKey key, out TValue value
+            )
     {
-        public static void CopyTo(this Stream stream, Stream outStream)
-        {
-            var buf = new byte[1024 * 32];
+        key = kvp.Key;
+        value = kvp.Value;
+    }
+}
 
-            int length;
+public static class StreamExtensions
+{
+    public static void CopyTo(this Stream stream, Stream outStream)
+    {
+        var buf = new byte[1024 * 32];
 
-            while ((length = stream.Read(buf, 0, buf.Length)) > 0)
-                outStream.Write(buf, 0, length);
-        }
+        int length;
 
-        public static MemoryStream Decompress(this MemoryStream stream)
-        {
-            var dataMemoryStream = new MemoryStream();
+        while ((length = stream.Read(buf, 0, buf.Length)) > 0)
+            outStream.Write(buf, 0, length);
+    }
 
-            using var compressionStream = new DeflateStream(stream, CompressionMode.Decompress, true);
+    public static MemoryStream Decompress(this MemoryStream stream)
+    {
+        var dataMemoryStream = new MemoryStream();
 
-            compressionStream.CopyTo(dataMemoryStream);
-            compressionStream.Flush();
+        using var compressionStream = new DeflateStream(stream, CompressionMode.Decompress, true);
 
-            dataMemoryStream.Position = 0L;
+        compressionStream.CopyTo(dataMemoryStream);
+        compressionStream.Flush();
 
-            return dataMemoryStream;
-        }
+        dataMemoryStream.Position = 0L;
 
-        public static DeflateStream GetCompressionStream(this MemoryStream stream) =>
-            new(stream, CompressionMode.Compress);
+        return dataMemoryStream;
     }
 
-    public static class CameraUtility
-    {
-        public static CameraMain MainCamera => GameMain.Instance.MainCamera;
-        public static UltimateOrbitCamera UOCamera { get; } =
-            GameMain.Instance.MainCamera.GetComponent<UltimateOrbitCamera>();
+    public static DeflateStream GetCompressionStream(this MemoryStream stream) =>
+        new(stream, CompressionMode.Compress);
+}
 
-        public static void StopSpin()
-        {
-            Utility.SetFieldValue(UOCamera, "xVelocity", 0f);
-            Utility.SetFieldValue(UOCamera, "yVelocity", 0f);
-        }
+public static class CameraUtility
+{
+    public static CameraMain MainCamera => GameMain.Instance.MainCamera;
+    public static UltimateOrbitCamera UOCamera { get; } =
+        GameMain.Instance.MainCamera.GetComponent<UltimateOrbitCamera>();
 
-        public static void StopMovement() =>
-            MainCamera.SetTargetPos(MainCamera.GetTargetPos());
+    public static void StopSpin()
+    {
+        Utility.SetFieldValue(UOCamera, "xVelocity", 0f);
+        Utility.SetFieldValue(UOCamera, "yVelocity", 0f);
+    }
 
-        public static void StopAll()
-        {
-            StopSpin();
-            StopMovement();
-        }
+    public static void StopMovement() =>
+        MainCamera.SetTargetPos(MainCamera.GetTargetPos());
 
-        public static void ForceCalcNearClip(this CameraMain camera)
-        {
-            camera.StopAllCoroutines();
-            camera.m_bCalcNearClip = false;
-            camera.camera.nearClipPlane = 0.01f;
-        }
-
-        public static void ResetCalcNearClip(this CameraMain camera)
-        {
-            if (camera.m_bCalcNearClip)
-                return;
+    public static void StopAll()
+    {
+        StopSpin();
+        StopMovement();
+    }
 
-            camera.StopAllCoroutines();
-            camera.m_bCalcNearClip = true;
-            camera.Start();
-        }
+    public static void ForceCalcNearClip(this CameraMain camera)
+    {
+        camera.StopAllCoroutines();
+        camera.m_bCalcNearClip = false;
+        camera.camera.nearClipPlane = 0.01f;
     }
 
-    public static class BinaryExtensions
+    public static void ResetCalcNearClip(this CameraMain camera)
     {
-        public static string ReadNullableString(this BinaryReader binaryReader) =>
-            binaryReader.ReadBoolean() ? binaryReader.ReadString() : null;
+        if (camera.m_bCalcNearClip)
+            return;
 
-        public static void WriteNullableString(this BinaryWriter binaryWriter, string str)
-        {
-            binaryWriter.Write(str is not null);
+        camera.StopAllCoroutines();
+        camera.m_bCalcNearClip = true;
+        camera.Start();
+    }
+}
 
-            if (str is not null)
-                binaryWriter.Write(str);
-        }
+public static class BinaryExtensions
+{
+    public static string ReadNullableString(this BinaryReader binaryReader) =>
+        binaryReader.ReadBoolean() ? binaryReader.ReadString() : null;
 
-        public static void Write(this BinaryWriter binaryWriter, Vector3 vector3)
-        {
-            binaryWriter.Write(vector3.x);
-            binaryWriter.Write(vector3.y);
-            binaryWriter.Write(vector3.z);
-        }
+    public static void WriteNullableString(this BinaryWriter binaryWriter, string str)
+    {
+        binaryWriter.Write(str is not null);
 
-        public static void WriteVector3(this BinaryWriter binaryWriter, Vector3 vector3)
-        {
-            binaryWriter.Write(vector3.x);
-            binaryWriter.Write(vector3.y);
-            binaryWriter.Write(vector3.z);
-        }
+        if (str is not null)
+            binaryWriter.Write(str);
+    }
 
-        public static Vector2 ReadVector2(this BinaryReader binaryReader) =>
-            new(binaryReader.ReadSingle(), binaryReader.ReadSingle());
+    public static void Write(this BinaryWriter binaryWriter, Vector3 vector3)
+    {
+        binaryWriter.Write(vector3.x);
+        binaryWriter.Write(vector3.y);
+        binaryWriter.Write(vector3.z);
+    }
+
+    public static void WriteVector3(this BinaryWriter binaryWriter, Vector3 vector3)
+    {
+        binaryWriter.Write(vector3.x);
+        binaryWriter.Write(vector3.y);
+        binaryWriter.Write(vector3.z);
+    }
+
+    public static Vector2 ReadVector2(this BinaryReader binaryReader) =>
+        new(binaryReader.ReadSingle(), binaryReader.ReadSingle());
 
-        public static Vector3 ReadVector3(this BinaryReader binaryReader) =>
-            new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
+    public static Vector3 ReadVector3(this BinaryReader binaryReader) =>
+        new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle());
 
-        public static Vector4 ReadVector4(this BinaryReader binaryReader) =>
-            new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(),
+    public static Vector4 ReadVector4(this BinaryReader binaryReader) =>
+        new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(),
                 binaryReader.ReadSingle()
-            );
+           );
 
-        public static void Write(this BinaryWriter binaryWriter, Quaternion quaternion)
-        {
-            binaryWriter.Write(quaternion.x);
-            binaryWriter.Write(quaternion.y);
-            binaryWriter.Write(quaternion.z);
-            binaryWriter.Write(quaternion.w);
-        }
+    public static void Write(this BinaryWriter binaryWriter, Quaternion quaternion)
+    {
+        binaryWriter.Write(quaternion.x);
+        binaryWriter.Write(quaternion.y);
+        binaryWriter.Write(quaternion.z);
+        binaryWriter.Write(quaternion.w);
+    }
 
-        public static void WriteQuaternion(this BinaryWriter binaryWriter, Quaternion quaternion)
-        {
-            binaryWriter.Write(quaternion.x);
-            binaryWriter.Write(quaternion.y);
-            binaryWriter.Write(quaternion.z);
-            binaryWriter.Write(quaternion.w);
-        }
+    public static void WriteQuaternion(this BinaryWriter binaryWriter, Quaternion quaternion)
+    {
+        binaryWriter.Write(quaternion.x);
+        binaryWriter.Write(quaternion.y);
+        binaryWriter.Write(quaternion.z);
+        binaryWriter.Write(quaternion.w);
+    }
 
-        public static Quaternion ReadQuaternion(this BinaryReader binaryReader) =>
-            new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(),
+    public static Quaternion ReadQuaternion(this BinaryReader binaryReader) =>
+        new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(),
                 binaryReader.ReadSingle()
-            );
+           );
 
-        public static void Write(this BinaryWriter binaryWriter, Color colour)
-        {
-            binaryWriter.Write(colour.r);
-            binaryWriter.Write(colour.g);
-            binaryWriter.Write(colour.b);
-            binaryWriter.Write(colour.a);
-        }
+    public static void Write(this BinaryWriter binaryWriter, Color colour)
+    {
+        binaryWriter.Write(colour.r);
+        binaryWriter.Write(colour.g);
+        binaryWriter.Write(colour.b);
+        binaryWriter.Write(colour.a);
+    }
 
-        public static void WriteColour(this BinaryWriter binaryWriter, Color colour)
-        {
-            binaryWriter.Write(colour.r);
-            binaryWriter.Write(colour.g);
-            binaryWriter.Write(colour.b);
-            binaryWriter.Write(colour.a);
-        }
+    public static void WriteColour(this BinaryWriter binaryWriter, Color colour)
+    {
+        binaryWriter.Write(colour.r);
+        binaryWriter.Write(colour.g);
+        binaryWriter.Write(colour.b);
+        binaryWriter.Write(colour.a);
+    }
 
-        public static Color ReadColour(this BinaryReader binaryReader) =>
-            new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(),
+    public static Color ReadColour(this BinaryReader binaryReader) =>
+        new(binaryReader.ReadSingle(), binaryReader.ReadSingle(), binaryReader.ReadSingle(),
                 binaryReader.ReadSingle()
-            );
+           );
 
-        public static Matrix4x4 ReadMatrix4x4(this BinaryReader binaryReader)
-        {
-            Matrix4x4 matrix = default;
+    public static Matrix4x4 ReadMatrix4x4(this BinaryReader binaryReader)
+    {
+        Matrix4x4 matrix = default;
 
-            for (var i = 0; i < 16; i++)
-                matrix[i] = binaryReader.ReadSingle();
+        for (var i = 0; i < 16; i++)
+            matrix[i] = binaryReader.ReadSingle();
 
-            return matrix;
-        }
+        return matrix;
     }
 }

+ 7 - 8
src/MeidoPhotoStudio.Plugin/WindowsLogicalComparer.cs

@@ -1,14 +1,13 @@
 using System.Collections.Generic;
 using System.Runtime.InteropServices;
 
-namespace MeidoPhotoStudio.Plugin
+namespace MeidoPhotoStudio.Plugin;
+
+public class WindowsLogicalComparer : IComparer<string>
 {
-    public class WindowsLogicalComparer : IComparer<string>
-    {
-        [DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
-        public static extern int StrCmpLogicalW(string x, string y);
+    [DllImport("shlwapi.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
+    public static extern int StrCmpLogicalW(string x, string y);
 
-        public int Compare(string x, string y) =>
-            StrCmpLogicalW(x, y);
-    }
+    public int Compare(string x, string y) =>
+        StrCmpLogicalW(x, y);
 }