Browse Source

Add photoshoot mode

ghorsington 4 years ago
parent
commit
713ca19b2d
1 changed files with 36 additions and 1 deletions
  1. 36 1
      COM3D2.ToukaScreenShot.Plugin/ToukaScreenShot.cs

+ 36 - 1
COM3D2.ToukaScreenShot.Plugin/ToukaScreenShot.cs

@@ -11,7 +11,7 @@ using UnityInjector.Attributes;
 
 namespace CM3D2.ToukaScreenShot.Plugin
 {
-    [PluginVersion("0.1.1.0")]
+    [PluginVersion("0.1.2.0")]
     [PluginName("Com3d2.ToukaScreenShot.Plugin")]
     [PluginFilter("COM3D2x64")]
     public class ToukaScreenShot : PluginBase
@@ -43,6 +43,7 @@ namespace CM3D2.ToukaScreenShot.Plugin
         private bool noConfigFlg;
         private bool shiftKey;
         private string triggerKey = "s";
+        private string photoShootKey = "d";
 
         private void Start()
         {
@@ -59,6 +60,7 @@ namespace CM3D2.ToukaScreenShot.Plugin
             ctrlKey = GetValueIni("Command", "Ctrl", true);
             shiftKey = GetValueIni("Command", "Shift", false);
             triggerKey = GetValueIni("Command", "Trigger", "s");
+            photoShootKey = GetValueIni("Command", "Trigger", "d");
             if (noConfigFlg) SaveConfig();
         }
 
@@ -96,6 +98,39 @@ namespace CM3D2.ToukaScreenShot.Plugin
             var pressedShift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
             if (altKey == pressedAlt && ctrlKey == pressedCtrl && shiftKey == pressedShift && Input.GetKeyDown(triggerKey))
                 StartCoroutine(ExecScreenShot());
+            else if (altKey == pressedAlt && ctrlKey == pressedCtrl && shiftKey == pressedShift && Input.GetKeyDown(photoShootKey))
+                StartCoroutine(StartPhotoShoot());
+        }
+
+        private IEnumerator StartPhotoShoot()
+        {
+            yield return new WaitForEndOfFrame();
+
+            var activeMaidCount = GameMain.Instance.CharacterMgr.GetMaidCount();
+            Maid activeMaid = null;
+            for (var i = 0; i < activeMaidCount; i++)
+                if ((activeMaid = GameMain.Instance.CharacterMgr.GetMaid(i)).Visible)
+                    break;
+
+            if (activeMaid == null)
+            {
+                Debug.Log("No maid found!");
+                yield break;
+            }
+            
+            var poseList =
+                Directory.GetFiles(Path.Combine(UTY.gameProjectPath, Path.Combine("PhotoModeData", "MyPose")));
+            
+            Debug.Log($"Maid to use: {activeMaid.name}");
+            Debug.Log($"Pose count: {poseList.Length}");
+            for (var poseNum = 0; poseNum < poseList.Length; poseNum++)
+            {
+                Debug.Log($"{poseNum + 1} / {poseList.Length}");
+                var poseFile = poseList[poseNum];
+                PhotoMotionData.AddMyPose(poseFile).Apply(activeMaid);
+                yield return ExecScreenShot();
+            }
+            Debug.Log("Done!");
         }
 
         private IEnumerator ExecScreenShot()