Browse Source

Initial commit

denikson 6 years ago
commit
66ebbbcaa9

+ 232 - 0
.gitignore

@@ -0,0 +1,232 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+build/
+bld/
+[Bb]in/
+[Oo]bj/
+
+# Roslyn cache directories
+*.ide/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+#NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding addin-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings 
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# If using the old MSBuild-Integrated Package Restore, uncomment this:
+#!**/packages/repositories.config
+
+# Windows Azure Build Output
+csx/
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# =========================
+# Operating System Files
+# =========================
+
+# OSX
+# =========================
+
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Thumbnails
+._*
+
+# Files that might appear on external disk
+.Spotlight-V100
+.Trashes
+
+# Directories potentially created on remote AFP share
+.AppleDB
+.AppleDesktop
+Network Trash Folder
+Temporary Items
+.apdisk
+
+# Windows
+# =========================
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+/.vs/

+ 3 - 0
MultipleMaids/AssemblyInfo.cs

@@ -0,0 +1,3 @@
+using System.Reflection;
+
+[assembly: AssemblyVersion("0.0.0.0")]

+ 106 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Config.cs

@@ -0,0 +1,106 @@
+using ExIni;
+
+namespace CM3D2.MultipleMaids.Plugin
+{
+    public partial class MultipleMaids
+    {
+        public void Preference()
+        {
+            if (isPref)
+                return;
+            isPref = true;
+            if (Preferences["config"]["hair_setting"].Value == "true")
+            {
+                isKamiyure = true;
+                IniKey iniKey1 = Preferences["config"]["hair_radius"];
+                IniKey iniKey2 = Preferences["config"]["hair_elasticity"];
+                kamiyure2 = float.Parse(Preferences["config"]["hair_damping"].Value);
+                kamiyure3 = float.Parse(iniKey2.Value);
+                kamiyure4 = float.Parse(iniKey1.Value);
+            }
+            else
+            {
+                isKamiyure = false;
+                kamiyure2 = 0.6f;
+                kamiyure3 = 1f;
+                kamiyure4 = 0.02f;
+            }
+
+            if (Preferences["config"]["skirt_setting"].Value == "true")
+            {
+                isSkirtyure = true;
+                IniKey iniKey1 = Preferences["config"]["skirt_radius"];
+                IniKey iniKey2 = Preferences["config"]["skirt_elasticity"];
+                skirtyure2 = float.Parse(Preferences["config"]["skirt_damping"].Value);
+                skirtyure3 = float.Parse(iniKey2.Value);
+                skirtyure4 = float.Parse(iniKey1.Value);
+            }
+            else
+            {
+                isSkirtyure = false;
+                skirtyure2 = 0.1f;
+                skirtyure3 = 0.05f;
+                skirtyure4 = 0.1f;
+            }
+
+            if (Preferences["config"]["hair_details"].Value == "true")
+                isShosai = true;
+            IniKey iniKey3 = Preferences["config"]["vr_scroll"];
+            if (iniKey3.Value == "false")
+            {
+                isVRScroll = false;
+            }
+            else if (iniKey3.Value != "true")
+            {
+                Preferences["config"]["vr_scroll"].Value = "true";
+                SaveConfig();
+            }
+
+            if (Preferences["config"]["shift_f7"].Value == "true")
+                isF7S = true;
+            if (Preferences["config"]["shift_f8"].Value == "false")
+                isVR2 = false;
+            IniKey iniKey4 = Preferences["config"]["ik_all"];
+            if (iniKey4.Value == "true")
+            {
+                isIKAll = true;
+                for (int index = 0; index < maxMaidCnt; ++index)
+                    isIK[index] = true;
+            }
+            else if (iniKey4.Value != "false")
+            {
+                Preferences["config"]["ik_all"].Value = "true";
+                SaveConfig();
+                isIKAll = true;
+                for (int index = 0; index < maxMaidCnt; ++index)
+                    isIK[index] = true;
+            }
+
+            if (!int.TryParse(Preferences["config"]["scene_max"].Value, out maxPage))
+            {
+                maxPage = 100;
+                Preferences["config"]["scene_max"].Value = "100";
+                SaveConfig();
+            }
+
+            if (!int.TryParse(Preferences["config"]["kankyo_max"].Value, out kankyoMax))
+            {
+                kankyoMax = 20;
+                Preferences["config"]["kankyo_max"].Value = "20";
+                SaveConfig();
+            }
+
+            for (int index = 0; index < kankyoMax; ++index)
+            {
+                IniKey iniKey1 = Preferences["kankyo"]["kankyo" + (index + 1)];
+                if (iniKey1.Value == null || iniKey1.Value == "")
+                {
+                    Preferences["kankyo"]["kankyo" + (index + 1)].Value = "環境" + (index + 1);
+                    SaveConfig();
+                }
+            }
+
+            maxPage /= 10;
+        }
+    }
+}

File diff suppressed because it is too large
+ 9829 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Gui.cs


+ 805 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.IK.cs

@@ -0,0 +1,805 @@
+using System.IO;
+using UnityEngine;
+
+namespace CM3D2.MultipleMaids.Plugin
+{
+    public partial class MultipleMaids
+    {
+        private void SetIKInit6(int k)
+        {
+            gHead2[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gHead2[k].GetComponent<Renderer>().enabled = false;
+            mHead2[k] = gHead2[k].AddComponent<MouseDrag5>();
+            mHead2[k].obj = gHead2[k];
+            gHead2[k].transform.localScale = new Vector3(0.2f, 0.24f, 0.2f);
+            gMaid2[k] = GameObject.CreatePrimitive(PrimitiveType.Capsule);
+            gMaid2[k].GetComponent<Renderer>().enabled = false;
+            mMaid2[k] = gMaid2[k].AddComponent<MouseDrag5>();
+            mMaid2[k].obj = gMaid2[k];
+            gMaid2[k].transform.localScale = new Vector3(0.2f, 0.3f, 0.24f);
+        }
+
+        private void SetIKInit7(int k)
+        {
+            gIKMuneL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gIKMuneL[k].GetComponent<Renderer>().enabled = false;
+            mIKMuneL[k] = gIKMuneL[k].AddComponent<MouseDrag>();
+            mIKMuneL[k].obj = gIKMuneL[k];
+            gIKMuneL[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+            gIKMuneR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gIKMuneR[k].GetComponent<Renderer>().enabled = false;
+            mIKMuneR[k] = gIKMuneR[k].AddComponent<MouseDrag>();
+            mIKMuneR[k].obj = gIKMuneR[k];
+            gIKMuneR[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+        }
+
+        private void SetIKInit5(int k)
+        {
+            gIKHandL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gIKHandL[k].GetComponent<Renderer>().enabled = false;
+            mIKHandL[k] = gIKHandL[k].AddComponent<MouseDrag4>();
+            mIKHandL[k].obj = gIKHandL[k];
+            gIKHandL[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+            gIKHandR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gIKHandR[k].GetComponent<Renderer>().enabled = false;
+            mIKHandR[k] = gIKHandR[k].AddComponent<MouseDrag4>();
+            mIKHandR[k].obj = gIKHandR[k];
+            gIKHandR[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+        }
+
+        private void SetIKInit4(int k)
+        {
+            gHead[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gHead[k].GetComponent<Renderer>().enabled = false;
+            mHead[k] = gHead[k].AddComponent<MouseDrag3>();
+            mHead[k].obj = gHead[k];
+            gHead[k].transform.localScale = new Vector3(0.2f, 0.24f, 0.2f);
+            gJotai[k] = GameObject.CreatePrimitive(PrimitiveType.Capsule);
+            gJotai[k].GetComponent<Renderer>().enabled = false;
+            mJotai[k] = gJotai[k].AddComponent<MouseDrag3>();
+            mJotai[k].obj = gJotai[k];
+            gJotai[k].transform.localScale = new Vector3(0.2f, 0.19f, 0.24f);
+            gKahuku[k] = GameObject.CreatePrimitive(PrimitiveType.Capsule);
+            gKahuku[k].GetComponent<Renderer>().enabled = false;
+            mKahuku[k] = gKahuku[k].AddComponent<MouseDrag3>();
+            mKahuku[k].obj = gKahuku[k];
+            gKahuku[k].transform.localScale = new Vector3(0.2f, 0.15f, 0.24f);
+        }
+
+        private void SetIKInit3(int k)
+        {
+            gMaid[k] = GameObject.CreatePrimitive(PrimitiveType.Capsule);
+            gMaid[k].GetComponent<Renderer>().enabled = false;
+            mMaid[k] = gMaid[k].AddComponent<MouseDrag2>();
+            mMaid[k].obj = gMaid[k];
+            gMaid[k].transform.localScale = new Vector3(0.2f, 0.3f, 0.24f);
+            gMaidC[k] = GameObject.CreatePrimitive(PrimitiveType.Cube);
+            gMaidC[k].GetComponent<Renderer>().enabled = true;
+            mMaidC[k] = gMaidC[k].AddComponent<MouseDrag2>();
+            mMaidC[k].obj = gMaidC[k];
+            gMaidC[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+            gMaidC[k].GetComponent<Renderer>().material =
+                    new Material(Shader.Find("Transparent/Diffuse")) { color = new Color(0.5f, 0.5f, 1f, 0.8f) };
+            gMaidC[k].layer = 8;
+        }
+
+        private void SetIKInit2(int k)
+        {
+            for (int index = 0; index < 30; ++index)
+            {
+                gFinger[k, index] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+                if (index % 3 != 0)
+                    ;
+                mFinger[k, index] = gFinger[k, index].AddComponent<MouseDrag>();
+                mFinger[k, index].obj = gFinger[k, index];
+                float num = 0.0f;
+                switch (index)
+                {
+                    case 0:
+                    case 15:
+                        num = 0.024f;
+                        break;
+                    case 1:
+                    case 16:
+                        num = 0.018f;
+                        break;
+                    case 2:
+                    case 17:
+                        num = 0.014f;
+                        break;
+                    case 3:
+                    case 6:
+                    case 9:
+                    case 18:
+                    case 21:
+                    case 24:
+                        num = 0.017f;
+                        break;
+                    case 4:
+                    case 7:
+                    case 10:
+                    case 19:
+                    case 22:
+                    case 25:
+                        num = 0.015f;
+                        break;
+                    case 5:
+                    case 8:
+                    case 11:
+                    case 20:
+                    case 23:
+                    case 26:
+                        num = 0.013f;
+                        break;
+                    case 12:
+                    case 27:
+                        num = 0.015f;
+                        break;
+                    case 13:
+                    case 28:
+                        num = 0.013f;
+                        break;
+                    case 14:
+                    case 29:
+                        num = 0.012f;
+                        break;
+                }
+
+                gFinger[k, index].transform.localScale = new Vector3(num, num, num);
+                var material = new Material(Shader.Find("Transparent/Diffuse"));
+                gFinger[k, index].GetComponent<Renderer>().material = material;
+                gFinger[k, index].GetComponent<MeshRenderer>().material.color = new Color(0.0f, 0.0f, 1f, 0.2f);
+            }
+
+            for (int index = 0; index < 12; ++index)
+            {
+                gFinger2[k, index] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+                mFinger2[k, index] = gFinger2[k, index].AddComponent<MouseDrag>();
+                mFinger2[k, index].obj = gFinger2[k, index];
+                float num = 0.0f;
+                switch (index)
+                {
+                    case 0:
+                    case 6:
+                        num = 0.017f;
+                        break;
+                    case 1:
+                    case 7:
+                        num = 0.016f;
+                        break;
+                    case 2:
+                    case 8:
+                        num = 0.024f;
+                        break;
+                    case 3:
+                    case 9:
+                        num = 0.017f;
+                        break;
+                    case 4:
+                    case 10:
+                        num = 0.024f;
+                        break;
+                    case 5:
+                    case 11:
+                        num = 0.018f;
+                        break;
+                }
+
+                gFinger2[k, index].transform.localScale = new Vector3(num, num, num);
+                var material = new Material(Shader.Find("Transparent/Diffuse"));
+                gFinger2[k, index].GetComponent<Renderer>().material = material;
+                gFinger2[k, index].GetComponent<MeshRenderer>().material.color = new Color(0.0f, 0.0f, 1f, 0.2f);
+            }
+        }
+
+        private void SetIKInit(int k)
+        {
+            var material = new Material(Shader.Find("Transparent/Diffuse"));
+            material.color = new Color(0.4f, 0.4f, 1f, 0.3f);
+            m_material2 = new Material(Shader.Find("Transparent/Diffuse"));
+            m_material2.color = new Color(0.4f, 0.4f, 1f, 0.26f);
+            m_material3 = new Material(Shader.Find("Transparent/Diffuse"));
+            m_material3.color = new Color(0.4f, 0.4f, 1f, 0.36f);
+            gHandL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gHandL[k].GetComponent<Renderer>().enabled = false;
+            gHandL[k].layer = 8;
+            mHandL[k] = gHandL[k].AddComponent<MouseDrag>();
+            mHandL[k].obj = gHandL[k];
+            gArmL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gArmL[k].GetComponent<Renderer>().enabled = false;
+            gArmL[k].layer = 8;
+            mArmL[k] = gArmL[k].AddComponent<MouseDrag>();
+            mArmL[k].obj = gArmL[k];
+            gFootL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gFootL[k].GetComponent<Renderer>().enabled = false;
+            gFootL[k].layer = 8;
+            mFootL[k] = gFootL[k].AddComponent<MouseDrag>();
+            mFootL[k].obj = gFootL[k];
+            gHizaL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gHizaL[k].GetComponent<Renderer>().enabled = false;
+            gHizaL[k].layer = 8;
+            mHizaL[k] = gHizaL[k].AddComponent<MouseDrag>();
+            mHizaL[k].obj = gHizaL[k];
+            gHandR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gHandR[k].GetComponent<Renderer>().enabled = false;
+            gHandR[k].layer = 8;
+            mHandR[k] = gHandR[k].AddComponent<MouseDrag>();
+            mHandR[k].obj = gHandR[k];
+            gArmR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gArmR[k].GetComponent<Renderer>().enabled = false;
+            gArmR[k].layer = 8;
+            mArmR[k] = gArmR[k].AddComponent<MouseDrag>();
+            mArmR[k].obj = gArmR[k];
+            gFootR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gFootR[k].GetComponent<Renderer>().enabled = false;
+            gFootR[k].layer = 8;
+            mFootR[k] = gFootR[k].AddComponent<MouseDrag>();
+            mFootR[k].obj = gFootR[k];
+            gHizaR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gHizaR[k].GetComponent<Renderer>().enabled = false;
+            gHizaR[k].layer = 8;
+            mHizaR[k] = gHizaR[k].AddComponent<MouseDrag>();
+            mHizaR[k].obj = gHizaR[k];
+            gClavicleL[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gClavicleL[k].GetComponent<Renderer>().enabled = false;
+            gClavicleL[k].layer = 8;
+            mClavicleL[k] = gClavicleL[k].AddComponent<MouseDrag>();
+            mClavicleL[k].obj = gClavicleL[k];
+            gClavicleR[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gClavicleR[k].GetComponent<Renderer>().enabled = false;
+            gClavicleR[k].layer = 8;
+            mClavicleR[k] = gClavicleR[k].AddComponent<MouseDrag>();
+            mClavicleR[k].obj = gClavicleR[k];
+            if (!isBone[k])
+            {
+                gHandL[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+                gHandR[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+                gArmL[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+                gArmR[k].transform.localScale = new Vector3(0.12f, 0.12f, 0.12f);
+                gFootL[k].transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
+                gFootR[k].transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
+                gHizaL[k].transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
+                gHizaR[k].transform.localScale = new Vector3(0.15f, 0.15f, 0.15f);
+                gClavicleL[k].transform.localScale = new Vector3(0.13f, 0.13f, 0.13f);
+                mClavicleR[k].transform.localScale = new Vector3(0.13f, 0.13f, 0.13f);
+            }
+            else
+            {
+                gHandL[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gHandR[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gArmL[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gArmR[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gFootL[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gFootR[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gHizaL[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gHizaR[k].transform.localScale = new Vector3(0.07f, 0.07f, 0.07f);
+                gClavicleL[k].transform.localScale = new Vector3(0.06f, 0.06f, 0.06f);
+                gClavicleR[k].transform.localScale = new Vector3(0.06f, 0.06f, 0.06f);
+                gHandL[k].GetComponent<Renderer>().enabled = true;
+                gHandR[k].GetComponent<Renderer>().enabled = true;
+                gArmL[k].GetComponent<Renderer>().enabled = true;
+                gArmR[k].GetComponent<Renderer>().enabled = true;
+                gFootL[k].GetComponent<Renderer>().enabled = true;
+                gFootR[k].GetComponent<Renderer>().enabled = true;
+                gHizaL[k].GetComponent<Renderer>().enabled = true;
+                gHizaR[k].GetComponent<Renderer>().enabled = true;
+                gClavicleL[k].GetComponent<Renderer>().enabled = true;
+                gClavicleR[k].GetComponent<Renderer>().enabled = true;
+                gHandL[k].GetComponent<Renderer>().material = m_material2;
+                gHandR[k].GetComponent<Renderer>().material = m_material2;
+                gArmL[k].GetComponent<Renderer>().material = m_material2;
+                gArmR[k].GetComponent<Renderer>().material = m_material2;
+                gFootL[k].GetComponent<Renderer>().material = m_material2;
+                gFootR[k].GetComponent<Renderer>().material = m_material2;
+                gHizaL[k].GetComponent<Renderer>().material = m_material2;
+                gHizaR[k].GetComponent<Renderer>().material = m_material2;
+                gClavicleL[k].GetComponent<Renderer>().material = m_material2;
+                gClavicleR[k].GetComponent<Renderer>().material = m_material2;
+            }
+
+            var gameObject1 = new GameObject();
+            gameObject1.transform.SetParent(transform, false);
+            gizmoHandL[k] = gameObject1.AddComponent<GizmoRender>();
+            gizmoHandL[k].eRotate = true;
+            gizmoHandL[k].offsetScale = 0.25f;
+            gizmoHandL[k].lineRSelectedThick = 0.25f;
+            gizmoHandL[k].Visible = false;
+            var gameObject2 = new GameObject();
+            gameObject2.transform.SetParent(transform, false);
+            gizmoHandR[k] = gameObject2.AddComponent<GizmoRender>();
+            gizmoHandR[k].eRotate = true;
+            gizmoHandR[k].offsetScale = 0.25f;
+            gizmoHandR[k].lineRSelectedThick = 0.25f;
+            gizmoHandR[k].Visible = false;
+            var gameObject3 = new GameObject();
+            gameObject3.transform.SetParent(transform, false);
+            gizmoFootL[k] = gameObject3.AddComponent<GizmoRender>();
+            gizmoFootL[k].eRotate = true;
+            gizmoFootL[k].offsetScale = 0.25f;
+            gizmoFootL[k].lineRSelectedThick = 0.25f;
+            gizmoFootL[k].Visible = false;
+            var gameObject4 = new GameObject();
+            gameObject4.transform.SetParent(transform, false);
+            gizmoFootR[k] = gameObject4.AddComponent<GizmoRender>();
+            gizmoFootR[k].eRotate = true;
+            gizmoFootR[k].offsetScale = 0.25f;
+            gizmoFootR[k].lineRSelectedThick = 0.25f;
+            gizmoFootR[k].Visible = false;
+            gNeck[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gNeck[k].GetComponent<Renderer>().material = material;
+            gNeck[k].layer = 8;
+            mNeck[k] = gNeck[k].AddComponent<MouseDrag3>();
+            mNeck[k].obj = gNeck[k];
+            gNeck[k].transform.localScale = new Vector3(0.055f, 0.055f, 0.055f);
+            gNeck[k].SetActive(false);
+            gSpine[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gSpine[k].GetComponent<Renderer>().material = material;
+            gSpine[k].layer = 8;
+            mSpine[k] = gSpine[k].AddComponent<MouseDrag3>();
+            mSpine[k].obj = gSpine[k];
+            gSpine[k].transform.localScale = new Vector3(0.04f, 0.04f, 0.04f);
+            gSpine[k].SetActive(false);
+            gSpine0a[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gSpine0a[k].GetComponent<Renderer>().material = material;
+            gSpine0a[k].layer = 8;
+            mSpine0a[k] = gSpine0a[k].AddComponent<MouseDrag3>();
+            mSpine0a[k].obj = gSpine0a[k];
+            gSpine0a[k].transform.localScale = new Vector3(0.04f, 0.04f, 0.04f);
+            gSpine0a[k].SetActive(false);
+            gSpine1a[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gSpine1a[k].GetComponent<Renderer>().material = material;
+            gSpine1a[k].layer = 8;
+            mSpine1a[k] = gSpine1a[k].AddComponent<MouseDrag3>();
+            mSpine1a[k].obj = gSpine1a[k];
+            gSpine1a[k].transform.localScale = new Vector3(0.04f, 0.04f, 0.04f);
+            gSpine1a[k].SetActive(false);
+            gSpine1[k] = GameObject.CreatePrimitive(PrimitiveType.Sphere);
+            gSpine1[k].GetComponent<Renderer>().material = material;
+            gSpine1[k].layer = 8;
+            mSpine1[k] = gSpine1[k].AddComponent<MouseDrag3>();
+            mSpine1[k].obj = gSpine1[k];
+            gSpine1[k].transform.localScale = new Vector3(0.04f, 0.04f, 0.04f);
+            gSpine1[k].SetActive(false);
+            gPelvis[k] = GameObject.CreatePrimitive(PrimitiveType.Cube);
+            gPelvis[k].GetComponent<Renderer>().material = m_material3;
+            gPelvis[k].layer = 8;
+            mPelvis[k] = gPelvis[k].AddComponent<MouseDrag3>();
+            mPelvis[k].obj = gPelvis[k];
+            gPelvis[k].transform.localScale = new Vector3(0.045f, 0.045f, 0.045f);
+            gPelvis[k].SetActive(false);
+        }
+
+        private void SetIK(Maid maid, int i)
+        {
+            Head = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Neck", true);
+            Head1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Neck", true);
+            Head2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Head", true);
+            Head3[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 HeadNub", true);
+            IKHandL[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "_IK_handL", true);
+            IKHandR[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "_IK_handR", true);
+            IKMuneL[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Mune_L", true);
+            IKMuneLSub[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Mune_L_sub", true);
+            IKMuneR[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Mune_R", true);
+            IKMuneRSub[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Mune_R_sub", true);
+            Spine = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine", true);
+            Spine0a = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine0a", true);
+            Spine1 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine1", true);
+            Spine1a = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine1a", true);
+            Pelvis = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Pelvis", true);
+            Neck[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Neck", true);
+            Pelvis2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true);
+            Spine12[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine1", true);
+            Spine0a2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine0a", true);
+            Spine2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine", true);
+            Spine1a2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 Spine1a", true);
+            HandL1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Hand", true);
+            UpperArmL1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L UpperArm", true);
+            ForearmL1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Forearm", true);
+            HandR1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Hand", true);
+            UpperArmR1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R UpperArm", true);
+            ForearmR1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Forearm", true);
+            HandL2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Foot", true);
+            UpperArmL2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Thigh", true);
+            ForearmL2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Calf", true);
+            HandR2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Foot", true);
+            UpperArmR2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Thigh", true);
+            ForearmR2[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Calf", true);
+            ClavicleL1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Clavicle", true);
+            ClavicleR1[i] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Clavicle", true);
+            Finger[i, 0] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger0", true);
+            Finger[i, 1] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger01", true);
+            Finger[i, 2] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger02", true);
+            Finger[i, 3] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger0Nub", true);
+            Finger[i, 4] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger1", true);
+            Finger[i, 5] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger11", true);
+            Finger[i, 6] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger12", true);
+            Finger[i, 7] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger1Nub", true);
+            Finger[i, 8] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger2", true);
+            Finger[i, 9] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger21", true);
+            Finger[i, 10] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger22", true);
+            Finger[i, 11] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger2Nub", true);
+            Finger[i, 12] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger3", true);
+            Finger[i, 13] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger31", true);
+            Finger[i, 14] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger32", true);
+            Finger[i, 15] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger3Nub", true);
+            Finger[i, 16] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger4", true);
+            Finger[i, 17] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger41", true);
+            Finger[i, 18] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger42", true);
+            Finger[i, 19] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Finger4Nub", true);
+            Finger[i, 20] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger0", true);
+            Finger[i, 21] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger01", true);
+            Finger[i, 22] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger02", true);
+            Finger[i, 23] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger0Nub", true);
+            Finger[i, 24] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger1", true);
+            Finger[i, 25] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger11", true);
+            Finger[i, 26] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger12", true);
+            Finger[i, 27] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger1Nub", true);
+            Finger[i, 28] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger2", true);
+            Finger[i, 29] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger21", true);
+            Finger[i, 30] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger22", true);
+            Finger[i, 31] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger2Nub", true);
+            Finger[i, 32] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger3", true);
+            Finger[i, 33] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger31", true);
+            Finger[i, 34] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger32", true);
+            Finger[i, 35] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger3Nub", true);
+            Finger[i, 36] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger4", true);
+            Finger[i, 37] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger41", true);
+            Finger[i, 38] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger42", true);
+            Finger[i, 39] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Finger4Nub", true);
+            Finger2[i, 0] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe0", true);
+            Finger2[i, 1] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe01", true);
+            Finger2[i, 2] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe0Nub", true);
+            Finger2[i, 3] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe1", true);
+            Finger2[i, 4] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe11", true);
+            Finger2[i, 5] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe1Nub", true);
+            Finger2[i, 6] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe2", true);
+            Finger2[i, 7] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe21", true);
+            Finger2[i, 8] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe2Nub", true);
+            Finger2[i, 9] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe0", true);
+            Finger2[i, 10] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe01", true);
+            Finger2[i, 11] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe0Nub", true);
+            Finger2[i, 12] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe1", true);
+            Finger2[i, 13] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe11", true);
+            Finger2[i, 14] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe1Nub", true);
+            Finger2[i, 15] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe2", true);
+            Finger2[i, 16] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe21", true);
+            Finger2[i, 17] = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe2Nub", true);
+        }
+
+        private void CopyIK(Maid maid, int i, Maid maid2, int i2)
+        {
+            poseIndex[i] = poseIndex[i2];
+            if (!(bool)maid || !maid.Visible)
+                return;
+            var strArray = poseArray[poseIndex[i]].Split(',');
+            isStop[i] = false;
+            if (strArray[0].Contains("_momi") || strArray[0].Contains("paizuri_"))
+            {
+                maid.body0.MuneYureL(0.0f);
+                maid.body0.MuneYureR(0.0f);
+            }
+            else
+            {
+                maid.body0.MuneYureL(1f);
+                maid.body0.MuneYureR(1f);
+            }
+
+            if (strArray[0].Contains("MultipleMaidsPose"))
+            {
+                string path = strArray[0].Split('/')[1];
+                var numArray = new byte[0];
+                try
+                {
+                    using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
+                    {
+                        numArray = new byte[fileStream.Length];
+                        fileStream.Read(numArray, 0, numArray.Length);
+                    }
+                }
+                catch { }
+
+                if (0 < numArray.Length)
+                {
+                    long hashCode = Path.GetFileName(path).GetHashCode();
+                    maid.body0.CrossFade(hashCode.ToString(), numArray, false, false, false, 0.0f, 1f);
+                    var autoTwistArray = new Maid.AutoTwist[6]
+                    {
+                            Maid.AutoTwist.ShoulderL, Maid.AutoTwist.ShoulderR, Maid.AutoTwist.WristL, Maid.AutoTwist.WristR,
+                            Maid.AutoTwist.ThighL, Maid.AutoTwist.ThighR
+                    };
+                    foreach (Maid.AutoTwist f_eType in autoTwistArray)
+                        maid.SetAutoTwist(f_eType, true);
+                }
+            }
+            else
+            {
+                int result;
+                if (strArray[0].StartsWith("p") && int.TryParse(strArray[0].Substring(1), out result))
+                {
+                    loadPose[i] = strArray[0];
+                }
+                else if (!strArray[0].StartsWith("dance_"))
+                {
+                    maidArray[i].CrossFade(strArray[0] + ".anm", false, true, false, 0.0f, 1f);
+                }
+                else
+                {
+                    if (!(bool)maid.body0.m_Bones.GetComponent<Animation>().GetClip(strArray[0] + ".anm"))
+                        maid.body0.LoadAnime(strArray[0] + ".anm", GameUty.FileSystem, strArray[0] + ".anm", false, false);
+                    maid.body0.m_Bones.GetComponent<Animation>().Play(strArray[0] + ".anm");
+                }
+            }
+
+            if (strArray.Length > 1)
+            {
+                maid.body0.m_Bones.GetComponent<Animation>()[strArray[0] + ".anm"].time = float.Parse(strArray[1]);
+                isStop[i] = true;
+                if (strArray.Length > 2)
+                {
+                    CMT.SearchObjName(maidArray[i].body0.m_Bones.transform, "Bip01", true);
+                    isPoseIti[i] = true;
+                    poseIti[i] = maidArray[i].transform.position;
+                    maidArray[i].transform.position = new Vector3(100f, 100f, 100f);
+                }
+            }
+        }
+
+        private void CopyIK2(Maid maid, int i, Maid maid2, int i2)
+        {
+            isStop[i] = true;
+            isLock[i] = true;
+            maid.transform.position = new Vector3(maid.transform.position.x, maid2.transform.position.y, maid.transform.position.z);
+            SetIK(maid2, i2);
+            Transform transform1 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe0", true);
+            Transform transform2 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe0", true);
+            Transform transform3 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe01", true);
+            Transform transform4 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe01", true);
+            Transform transform5 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe0Nub", true);
+            Transform transform6 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe0Nub", true);
+            Transform transform7 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe1", true);
+            Transform transform8 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe1", true);
+            Transform transform9 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe11", true);
+            Transform transform10 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe11", true);
+            Transform transform11 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe1Nub", true);
+            Transform transform12 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe1Nub", true);
+            Transform transform13 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe2", true);
+            Transform transform14 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe2", true);
+            Transform transform15 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe21", true);
+            Transform transform16 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe21", true);
+            Transform transform17 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 L Toe2Nub", true);
+            Transform transform18 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01 R Toe2Nub", true);
+            Transform transform19 = CMT.SearchObjName(maid2.body0.m_Bones.transform, "Bip01", true);
+            Vector3 eulerAngles1 = Head.eulerAngles;
+            Vector3 eulerAngles2 = Spine.eulerAngles;
+            Vector3 eulerAngles3 = Spine0a.eulerAngles;
+            Vector3 eulerAngles4 = Spine1.eulerAngles;
+            Vector3 eulerAngles5 = Spine1a.eulerAngles;
+            Vector3 eulerAngles6 = Pelvis.eulerAngles;
+            Vector3 eulerAngles7 = ClavicleL1[i2].eulerAngles;
+            Vector3 eulerAngles8 = ClavicleR1[i2].eulerAngles;
+            Vector3 localEulerAngles1 = transform1.localEulerAngles;
+            Vector3 localEulerAngles2 = transform2.localEulerAngles;
+            Vector3 localEulerAngles3 = transform3.localEulerAngles;
+            Vector3 localEulerAngles4 = transform4.localEulerAngles;
+            Vector3 localEulerAngles5 = transform5.localEulerAngles;
+            Vector3 localEulerAngles6 = transform6.localEulerAngles;
+            Vector3 localEulerAngles7 = transform7.localEulerAngles;
+            Vector3 localEulerAngles8 = transform8.localEulerAngles;
+            Vector3 localEulerAngles9 = transform9.localEulerAngles;
+            Vector3 localEulerAngles10 = transform10.localEulerAngles;
+            Vector3 localEulerAngles11 = transform11.localEulerAngles;
+            Vector3 localEulerAngles12 = transform12.localEulerAngles;
+            Vector3 localEulerAngles13 = transform13.localEulerAngles;
+            Vector3 localEulerAngles14 = transform14.localEulerAngles;
+            Vector3 localEulerAngles15 = transform15.localEulerAngles;
+            Vector3 localEulerAngles16 = transform16.localEulerAngles;
+            Vector3 localEulerAngles17 = transform17.localEulerAngles;
+            Vector3 localEulerAngles18 = transform18.localEulerAngles;
+            Vector3 eulerAngles9 = transform19.eulerAngles;
+            Vector3 localEulerAngles19 = HandL1[i2].localEulerAngles;
+            Vector3 localEulerAngles20 = HandR1[i2].localEulerAngles;
+            Vector3 localEulerAngles21 = HandL2[i2].localEulerAngles;
+            Vector3 localEulerAngles22 = HandR2[i2].localEulerAngles;
+            var vector3Array = new Vector3[40];
+            for (int index = 0; index < 20; ++index)
+                vector3Array[index] = Finger[i2, index].localEulerAngles;
+            for (int index = 20; index < 40; ++index)
+                vector3Array[index] = Finger[i2, index].localEulerAngles;
+            Vector3 eulerAngles10 = UpperArmL1[i2].eulerAngles;
+            Vector3 eulerAngles11 = ForearmL1[i2].eulerAngles;
+            Vector3 eulerAngles12 = UpperArmR1[i2].eulerAngles;
+            Vector3 eulerAngles13 = ForearmR1[i2].eulerAngles;
+            Vector3 eulerAngles14 = UpperArmL2[i2].eulerAngles;
+            Vector3 eulerAngles15 = ForearmL2[i2].eulerAngles;
+            Vector3 eulerAngles16 = UpperArmR2[i2].eulerAngles;
+            Vector3 eulerAngles17 = ForearmR2[i2].eulerAngles;
+            maid.transform.localEulerAngles = maid2.transform.localEulerAngles;
+            SetIK(maid, i);
+            Transform transform20 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe0", true);
+            Transform transform21 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe0", true);
+            Transform transform22 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe01", true);
+            Transform transform23 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe01", true);
+            Transform transform24 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe0Nub", true);
+            Transform transform25 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe0Nub", true);
+            Transform transform26 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe1", true);
+            Transform transform27 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe1", true);
+            Transform transform28 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe11", true);
+            Transform transform29 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe11", true);
+            Transform transform30 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe1Nub", true);
+            Transform transform31 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe1Nub", true);
+            Transform transform32 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe2", true);
+            Transform transform33 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe2", true);
+            Transform transform34 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe21", true);
+            Transform transform35 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe21", true);
+            Transform transform36 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe2Nub", true);
+            Transform transform37 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe2Nub", true);
+            CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true).eulerAngles = eulerAngles9;
+            Pelvis.eulerAngles = eulerAngles6;
+            Spine.eulerAngles = eulerAngles2;
+            Spine0a.eulerAngles = eulerAngles3;
+            Spine1.eulerAngles = eulerAngles4;
+            Spine1a.eulerAngles = eulerAngles5;
+            ClavicleL1[i].eulerAngles = eulerAngles7;
+            ClavicleR1[i].eulerAngles = eulerAngles8;
+            Head.eulerAngles = eulerAngles1;
+            HandL1[i].localEulerAngles = localEulerAngles19;
+            HandR1[i].localEulerAngles = localEulerAngles20;
+            HandL2[i].localEulerAngles = localEulerAngles21;
+            HandR2[i].localEulerAngles = localEulerAngles22;
+            for (int index = 0; index < 20; ++index)
+                Finger[i, index].localEulerAngles = vector3Array[index];
+            for (int index = 20; index < 40; ++index)
+                Finger[i, index].localEulerAngles = vector3Array[index];
+            transform20.localEulerAngles = localEulerAngles1;
+            transform21.localEulerAngles = localEulerAngles2;
+            transform22.localEulerAngles = localEulerAngles3;
+            transform23.localEulerAngles = localEulerAngles4;
+            transform24.localEulerAngles = localEulerAngles5;
+            transform25.localEulerAngles = localEulerAngles6;
+            transform26.localEulerAngles = localEulerAngles7;
+            transform27.localEulerAngles = localEulerAngles8;
+            transform28.localEulerAngles = localEulerAngles9;
+            transform29.localEulerAngles = localEulerAngles10;
+            transform30.localEulerAngles = localEulerAngles11;
+            transform31.localEulerAngles = localEulerAngles12;
+            transform32.localEulerAngles = localEulerAngles13;
+            transform33.localEulerAngles = localEulerAngles14;
+            transform34.localEulerAngles = localEulerAngles15;
+            transform35.localEulerAngles = localEulerAngles16;
+            transform36.localEulerAngles = localEulerAngles17;
+            transform37.localEulerAngles = localEulerAngles18;
+            UpperArmL1[i].eulerAngles = eulerAngles10;
+            UpperArmR1[i].eulerAngles = eulerAngles12;
+            ForearmL1[i].eulerAngles = eulerAngles11;
+            ForearmR1[i].eulerAngles = eulerAngles13;
+            UpperArmL2[i].eulerAngles = eulerAngles14;
+            UpperArmR2[i].eulerAngles = eulerAngles16;
+            ForearmL2[i].eulerAngles = eulerAngles15;
+            ForearmR2[i].eulerAngles = eulerAngles17;
+        }
+
+        private void SetHanten(Maid maid, int i)
+        {
+            SetIK(maid, i);
+            int num = pHandL[selectMaidIndex];
+            pHandL[selectMaidIndex] = pHandR[selectMaidIndex];
+            pHandR[selectMaidIndex] = num;
+            isStop[i] = true;
+            isLock[i] = true;
+            Transform transform1 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Hip_L", true);
+            Transform transform2 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Hip_R", true);
+            Transform transform3 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe0", true);
+            Transform transform4 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe0", true);
+            Transform transform5 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe01", true);
+            Transform transform6 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe01", true);
+            Transform transform7 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe0Nub", true);
+            Transform transform8 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe0Nub", true);
+            Transform transform9 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe1", true);
+            Transform transform10 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe1", true);
+            Transform transform11 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe11", true);
+            Transform transform12 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe11", true);
+            Transform transform13 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe1Nub", true);
+            Transform transform14 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe1Nub", true);
+            Transform transform15 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe2", true);
+            Transform transform16 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe2", true);
+            Transform transform17 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe21", true);
+            Transform transform18 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe21", true);
+            Transform transform19 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 L Toe2Nub", true);
+            Transform transform20 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01 R Toe2Nub", true);
+            Transform transform21 = CMT.SearchObjName(maid.body0.m_Bones.transform, "Bip01", true);
+            Vector3 eulerAngles1 = Head.eulerAngles;
+            Vector3 eulerAngles2 = Spine.eulerAngles;
+            Vector3 eulerAngles3 = Spine0a.eulerAngles;
+            Vector3 eulerAngles4 = Spine1.eulerAngles;
+            Vector3 eulerAngles5 = Spine1a.eulerAngles;
+            Vector3 eulerAngles6 = Pelvis.eulerAngles;
+            Vector3 eulerAngles7 = ClavicleL1[i].eulerAngles;
+            Vector3 eulerAngles8 = ClavicleR1[i].eulerAngles;
+            Vector3 eulerAngles9 = transform1.eulerAngles;
+            Vector3 eulerAngles10 = transform2.eulerAngles;
+            Vector3 localEulerAngles1 = transform3.localEulerAngles;
+            Vector3 localEulerAngles2 = transform4.localEulerAngles;
+            Vector3 localEulerAngles3 = transform5.localEulerAngles;
+            Vector3 localEulerAngles4 = transform6.localEulerAngles;
+            Vector3 localEulerAngles5 = transform7.localEulerAngles;
+            Vector3 localEulerAngles6 = transform8.localEulerAngles;
+            Vector3 localEulerAngles7 = transform9.localEulerAngles;
+            Vector3 localEulerAngles8 = transform10.localEulerAngles;
+            Vector3 localEulerAngles9 = transform11.localEulerAngles;
+            Vector3 localEulerAngles10 = transform12.localEulerAngles;
+            Vector3 localEulerAngles11 = transform13.localEulerAngles;
+            Vector3 localEulerAngles12 = transform14.localEulerAngles;
+            Vector3 localEulerAngles13 = transform15.localEulerAngles;
+            Vector3 localEulerAngles14 = transform16.localEulerAngles;
+            Vector3 localEulerAngles15 = transform17.localEulerAngles;
+            Vector3 localEulerAngles16 = transform18.localEulerAngles;
+            Vector3 localEulerAngles17 = transform19.localEulerAngles;
+            Vector3 localEulerAngles18 = transform20.localEulerAngles;
+            Vector3 eulerAngles11 = transform21.eulerAngles;
+            Vector3 localEulerAngles19 = HandL1[i].localEulerAngles;
+            Vector3 localEulerAngles20 = HandR1[i].localEulerAngles;
+            Vector3 localEulerAngles21 = HandL2[i].localEulerAngles;
+            Vector3 localEulerAngles22 = HandR2[i].localEulerAngles;
+            var vector3Array = new Vector3[40];
+            for (int index = 0; index < 20; ++index)
+                vector3Array[index] = Finger[i, index].localEulerAngles;
+            for (int index = 20; index < 40; ++index)
+                vector3Array[index] = Finger[i, index].localEulerAngles;
+            Vector3 eulerAngles12 = UpperArmL1[i].eulerAngles;
+            Vector3 eulerAngles13 = ForearmL1[i].eulerAngles;
+            Vector3 eulerAngles14 = UpperArmR1[i].eulerAngles;
+            Vector3 eulerAngles15 = ForearmR1[i].eulerAngles;
+            Vector3 eulerAngles16 = UpperArmL2[i].eulerAngles;
+            Vector3 eulerAngles17 = ForearmL2[i].eulerAngles;
+            Vector3 eulerAngles18 = UpperArmR2[i].eulerAngles;
+            Vector3 eulerAngles19 = ForearmR2[i].eulerAngles;
+            transform21.eulerAngles = new Vector3((float)(360.0 - (eulerAngles11.x + 270.0) - 270.0),
+                                                  (float)(360.0 - (eulerAngles11.y + 90.0) - 90.0),
+                                                  360f - eulerAngles11.z);
+            transform1.eulerAngles = getHanten(eulerAngles10);
+            transform2.eulerAngles = getHanten(eulerAngles9);
+            Pelvis.eulerAngles = getHanten(eulerAngles6);
+            Spine.eulerAngles = getHanten(eulerAngles2);
+            Spine0a.eulerAngles = getHanten(eulerAngles3);
+            Spine1.eulerAngles = getHanten(eulerAngles4);
+            Spine1a.eulerAngles = getHanten(eulerAngles5);
+            ClavicleL1[i].eulerAngles = getHanten(eulerAngles8);
+            ClavicleR1[i].eulerAngles = getHanten(eulerAngles7);
+            Head.eulerAngles = getHanten(eulerAngles1);
+            HandR1[i].localEulerAngles = getHanten2(localEulerAngles19);
+            HandL1[i].localEulerAngles = getHanten2(localEulerAngles20);
+            HandR2[i].localEulerAngles = getHanten2(localEulerAngles21);
+            HandL2[i].localEulerAngles = getHanten2(localEulerAngles22);
+            for (int index = 0; index < 20; ++index)
+                Finger[i, index].localEulerAngles = getHanten2(vector3Array[index + 20]);
+            for (int index = 20; index < 40; ++index)
+                Finger[i, index].localEulerAngles = getHanten2(vector3Array[index - 20]);
+            transform4.localEulerAngles = getHanten2(localEulerAngles1);
+            transform3.localEulerAngles = getHanten2(localEulerAngles2);
+            transform6.localEulerAngles = getHanten2(localEulerAngles3);
+            transform5.localEulerAngles = getHanten2(localEulerAngles4);
+            transform8.localEulerAngles = getHanten2(localEulerAngles5);
+            transform7.localEulerAngles = getHanten2(localEulerAngles6);
+            transform10.localEulerAngles = getHanten2(localEulerAngles7);
+            transform9.localEulerAngles = getHanten2(localEulerAngles8);
+            transform12.localEulerAngles = getHanten2(localEulerAngles9);
+            transform11.localEulerAngles = getHanten2(localEulerAngles10);
+            transform14.localEulerAngles = getHanten2(localEulerAngles11);
+            transform13.localEulerAngles = getHanten2(localEulerAngles12);
+            transform16.localEulerAngles = getHanten2(localEulerAngles13);
+            transform15.localEulerAngles = getHanten2(localEulerAngles14);
+            transform18.localEulerAngles = getHanten2(localEulerAngles15);
+            transform17.localEulerAngles = getHanten2(localEulerAngles16);
+            transform20.localEulerAngles = getHanten2(localEulerAngles17);
+            transform19.localEulerAngles = getHanten2(localEulerAngles18);
+            UpperArmR1[i].eulerAngles = getHanten(eulerAngles12);
+            UpperArmL1[i].eulerAngles = getHanten(eulerAngles14);
+            ForearmR1[i].eulerAngles = getHanten(eulerAngles13);
+            ForearmL1[i].eulerAngles = getHanten(eulerAngles15);
+            UpperArmR2[i].eulerAngles = getHanten(eulerAngles16);
+            UpperArmL2[i].eulerAngles = getHanten(eulerAngles18);
+            ForearmR2[i].eulerAngles = getHanten(eulerAngles17);
+            ForearmL2[i].eulerAngles = getHanten(eulerAngles19);
+        }
+    }
+}

File diff suppressed because it is too large
+ 1287 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Init.cs


File diff suppressed because it is too large
+ 16071 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.MaidUpdate.cs


File diff suppressed because it is too large
+ 6587 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Update.cs


File diff suppressed because it is too large
+ 5074 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.cs


+ 99 - 0
MultipleMaids/ComboBox2.cs

@@ -0,0 +1,99 @@
+using UnityEngine;
+
+public class ComboBox2
+{
+    private static bool forceToUnShow;
+    private static int useControlID = -1;
+    public float height;
+    public bool isClickedComboButton;
+    public Vector2 scrollPos = new Vector2(0.0f, 0.0f);
+    public int selectedItemIndex;
+    private Vector2 scrollPosOld = new Vector2(0.0f, 0.0f);
+
+    public int List(Rect rect, string buttonText, GUIContent[] listContent, GUIStyle listStyle)
+    {
+        return List(rect, new GUIContent(buttonText), listContent, "button", "box", listStyle);
+    }
+
+    public int List(Rect rect, GUIContent buttonContent, GUIContent[] listContent, GUIStyle listStyle)
+    {
+        return List(rect, buttonContent, listContent, "button", "box", listStyle);
+    }
+
+    public int List(Rect rect, string buttonText, GUIContent[] listContent, GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle)
+    {
+        return List(rect, new GUIContent(buttonText), listContent, buttonStyle, boxStyle, listStyle);
+    }
+
+    public int List(Rect rect,
+                    GUIContent buttonContent,
+                    GUIContent[] listContent,
+                    GUIStyle buttonStyle,
+                    GUIStyle boxStyle,
+                    GUIStyle listStyle)
+    {
+        if (forceToUnShow)
+        {
+            forceToUnShow = false;
+            isClickedComboButton = false;
+        }
+
+        bool flag = false;
+        int controlId = GUIUtility.GetControlID(FocusType.Passive);
+        if (Event.current.GetTypeForControl(controlId) == EventType.MouseUp && isClickedComboButton && scrollPosOld == scrollPos)
+            flag = true;
+        if (GUI.Button(rect, buttonContent, buttonStyle))
+        {
+            if (useControlID == -1)
+            {
+                useControlID = controlId;
+                isClickedComboButton = false;
+            }
+
+            if (useControlID != controlId)
+            {
+                forceToUnShow = true;
+                useControlID = controlId;
+            }
+
+            isClickedComboButton = true;
+        }
+
+        if (isClickedComboButton)
+        {
+            var position = new Rect(rect.x, rect.y + GetPix(23), rect.width, listStyle.CalcHeight(listContent[0], 1f) * listContent.Length);
+            if (position.y + (double)position.height > height)
+            {
+                position.height = (float)(height - (double)position.y - 2.0);
+                position.width += 16f;
+            }
+
+            GUI.Box(position, "", boxStyle);
+            if (Input.GetMouseButtonDown(0))
+                scrollPosOld = scrollPos;
+            var rect1 = new Rect(rect.x,
+                                 rect.y + listStyle.CalcHeight(listContent[0], 1f),
+                                 rect.width,
+                                 listStyle.CalcHeight(listContent[0], 1f) * listContent.Length);
+            scrollPos = GUI.BeginScrollView(position, scrollPos, rect1);
+            int num = GUI.SelectionGrid(rect1, selectedItemIndex, listContent, 1, listStyle);
+            if (num != selectedItemIndex)
+                selectedItemIndex = num;
+            GUI.EndScrollView();
+        }
+
+        if (flag)
+            isClickedComboButton = false;
+        return GetSelectedItemIndex();
+    }
+
+    public int GetSelectedItemIndex()
+    {
+        return selectedItemIndex;
+    }
+
+    private int GetPix(int i)
+    {
+        return (int)((1.0 + (Screen.width / 1280.0 - 1.0) * 0.600000023841858) * i);
+    }
+}

+ 39 - 0
MultipleMaids/IK.cs

@@ -0,0 +1,39 @@
+using UnityEngine;
+
+public class IK
+{
+    private TBody body;
+    private Quaternion defHipQ;
+    private Quaternion defKneeQ;
+    private float defLEN1;
+    private float defLEN2;
+    private Vector3 knee_old;
+    private Vector3 vechand;
+
+    public void Init(Transform hip, Transform knee, Transform ankle, TBody b)
+    {
+        body = b;
+        defLEN1 = (hip.position - knee.position).magnitude;
+        defLEN2 = (ankle.position - knee.position).magnitude;
+        knee_old = knee.position;
+        defHipQ = hip.localRotation;
+        defKneeQ = knee.localRotation;
+        vechand = Vector3.zero;
+    }
+
+    public void Porc(Transform hip, Transform knee, Transform ankle, Vector3 tgt, Vector3 vechand_offset)
+    {
+        knee_old = knee_old * 0.5f + knee.position * 0.5f;
+        Vector3 normalized1 = (knee_old - tgt).normalized;
+        knee_old = tgt + normalized1 * defLEN2;
+        Vector3 normalized2 = (knee_old - hip.position).normalized;
+        knee_old = hip.position + normalized2 * defLEN1;
+        new Quaternion().SetLookRotation(normalized2);
+        hip.transform.rotation =
+                Quaternion.FromToRotation(knee.transform.position - hip.transform.position, knee_old - hip.transform.position)
+                * hip.transform.rotation;
+        knee.transform.rotation =
+                Quaternion.FromToRotation(ankle.transform.position - knee.transform.position, tgt - knee.transform.position)
+                * knee.transform.rotation;
+    }
+}

+ 477 - 0
MultipleMaids/ImportCM2.cs

@@ -0,0 +1,477 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using UnityEngine;
+
+public class ImportCM2 : MonoBehaviour
+{
+    public static byte[] m_aniTempFile = null;
+    private static Dictionary<string, Material> m_dicCacheMaterial = new Dictionary<string, Material>();
+    private static Dictionary<int, KeyValuePair<string, float>> m_hashPriorityMaterials;
+    private static byte[] m_matTempFile;
+    private static byte[] m_skinTempFile;
+
+    private static string[] properties = new string[7]
+    {
+            "m_LocalRotation.x", "m_LocalRotation.y", "m_LocalRotation.z", "m_LocalRotation.w", "m_LocalPosition.x", "m_LocalPosition.y",
+            "m_LocalPosition.z"
+    };
+
+    public static GameObject LoadSkinMesh_R(string filename, string[] filename2, string slotname, TBodySkin bodyskin, int layer)
+    {
+        try
+        {
+            using (AFileBase afileBase = GameUty.FileOpen(filename, null))
+            {
+                if (m_skinTempFile == null)
+                    m_skinTempFile = new byte[Math.Max(500000, afileBase.GetSize())];
+                else if (m_skinTempFile.Length < afileBase.GetSize())
+                    m_skinTempFile = new byte[afileBase.GetSize()];
+                afileBase.Read(ref m_skinTempFile, afileBase.GetSize());
+            }
+        }
+        catch (Exception ex)
+        {
+            NDebug.Assert("ファイルが開けませんでした。" + filename + "\n" + ex.Message, false);
+        }
+
+        var r = new BinaryReader(new MemoryStream(m_skinTempFile), Encoding.UTF8);
+        TBodySkin.OriVert oriVert = bodyskin.m_OriVert;
+        var gameObject1 = Instantiate(Resources.Load("seed")) as GameObject;
+        gameObject1.layer = layer;
+        var gameObject2 = (GameObject)null;
+        var hashtable = new Hashtable();
+        string str1 = r.ReadString();
+        if (str1 != "CM3D2_MESH")
+            NDebug.Assert("LoadSkinMesh_R 例外 : ヘッダーファイルが不正です。" + str1, false);
+        int num1 = r.ReadInt32();
+        string str2 = r.ReadString();
+        gameObject1.name = "_SM_" + str2;
+        string str3 = r.ReadString();
+        int num2 = r.ReadInt32();
+        var gameObjectList = new List<GameObject>();
+        for (int index = 0; index < num2; ++index)
+        {
+            var gameObject3 = Instantiate(Resources.Load("seed")) as GameObject;
+            gameObject3.layer = layer;
+            gameObject3.name = r.ReadString();
+            gameObjectList.Add(gameObject3);
+            if (gameObject3.name == str3)
+                gameObject2 = gameObject3;
+            hashtable[gameObject3.name] = gameObject3;
+            if (r.ReadByte() != 0)
+            {
+                var gameObject4 = Instantiate(Resources.Load("seed")) as GameObject;
+                gameObject4.name = gameObject3.name + "_SCL_";
+                gameObject4.transform.parent = gameObject3.transform;
+                hashtable[gameObject3.name + "&_SCL_"] = gameObject4;
+            }
+        }
+
+        for (int index1 = 0; index1 < num2; ++index1)
+        {
+            int index2 = r.ReadInt32();
+            gameObjectList[index1].transform.parent = index2 < 0 ? gameObject1.transform : gameObjectList[index2].transform;
+        }
+
+        for (int index = 0; index < num2; ++index)
+        {
+            Transform transform = gameObjectList[index].transform;
+            float x1 = r.ReadSingle();
+            float y1 = r.ReadSingle();
+            float z1 = r.ReadSingle();
+            transform.localPosition = new Vector3(x1, y1, z1);
+            float x2 = r.ReadSingle();
+            float y2 = r.ReadSingle();
+            float z2 = r.ReadSingle();
+            float w = r.ReadSingle();
+            transform.localRotation = new Quaternion(x2, y2, z2, w);
+            if (2001 <= num1 && r.ReadBoolean())
+            {
+                float x3 = r.ReadSingle();
+                float y3 = r.ReadSingle();
+                float z3 = r.ReadSingle();
+                transform.localScale = new Vector3(x3, y3, z3);
+            }
+        }
+
+        int length1 = r.ReadInt32();
+        int length2 = r.ReadInt32();
+        int length3 = r.ReadInt32();
+        oriVert.VCount = length1;
+        oriVert.nSubMeshCount = length2;
+        gameObject2.AddComponent(typeof(SkinnedMeshRenderer));
+        gameObject1.AddComponent(typeof(Animation));
+        var component = gameObject2.GetComponent<Renderer>() as SkinnedMeshRenderer;
+        component.updateWhenOffscreen = true;
+        var transformArray = new Transform[length3];
+        for (int index = 0; index < length3; ++index)
+        {
+            string str4 = r.ReadString();
+            if (hashtable.ContainsKey(str4))
+            {
+                GameObject gameObject3 = !hashtable.ContainsKey(str4 + "&_SCL_")
+                                                 ? (GameObject)hashtable[str4]
+                                                 : (GameObject)hashtable[str4 + "&_SCL_"];
+                transformArray[index] = gameObject3.transform;
+            }
+        }
+
+        component.bones = transformArray;
+        var mesh1 = new Mesh();
+        component.sharedMesh = mesh1;
+        Mesh mesh2 = mesh1;
+        var matrix4x4Array = new Matrix4x4[length3];
+        for (int index1 = 0; index1 < length3; ++index1)
+            for (int index2 = 0; index2 < 16; ++index2)
+                matrix4x4Array[index1][index2] = r.ReadSingle();
+        mesh2.bindposes = matrix4x4Array;
+        var vector3Array1 = new Vector3[length1];
+        var vector3Array2 = new Vector3[length1];
+        var vector2Array = new Vector2[length1];
+        var boneWeightArray = new BoneWeight[length1];
+        for (int index = 0; index < length1; ++index)
+        {
+            float new_x1 = r.ReadSingle();
+            float new_y1 = r.ReadSingle();
+            float new_z1 = r.ReadSingle();
+            vector3Array1[index].Set(new_x1, new_y1, new_z1);
+            float new_x2 = r.ReadSingle();
+            float new_y2 = r.ReadSingle();
+            float new_z2 = r.ReadSingle();
+            vector3Array2[index].Set(new_x2, new_y2, new_z2);
+            float newX = r.ReadSingle();
+            float newY = r.ReadSingle();
+            vector2Array[index].Set(newX, newY);
+        }
+
+        mesh2.vertices = vector3Array1;
+        mesh2.normals = vector3Array2;
+        mesh2.uv = vector2Array;
+        oriVert.vOriVert = vector3Array1;
+        oriVert.vOriNorm = vector3Array2;
+        int length4 = r.ReadInt32();
+        if (length4 > 0)
+        {
+            var vector4Array = new Vector4[length4];
+            for (int index = 0; index < length4; ++index)
+            {
+                float x = r.ReadSingle();
+                float y = r.ReadSingle();
+                float z = r.ReadSingle();
+                float w = r.ReadSingle();
+                vector4Array[index] = new Vector4(x, y, z, w);
+            }
+
+            mesh2.tangents = vector4Array;
+        }
+
+        for (int index = 0; index < length1; ++index)
+        {
+            boneWeightArray[index].boneIndex0 = r.ReadUInt16();
+            boneWeightArray[index].boneIndex1 = r.ReadUInt16();
+            boneWeightArray[index].boneIndex2 = r.ReadUInt16();
+            boneWeightArray[index].boneIndex3 = r.ReadUInt16();
+            boneWeightArray[index].weight0 = r.ReadSingle();
+            boneWeightArray[index].weight1 = r.ReadSingle();
+            boneWeightArray[index].weight2 = r.ReadSingle();
+            boneWeightArray[index].weight3 = r.ReadSingle();
+        }
+
+        mesh2.boneWeights = boneWeightArray;
+        mesh2.subMeshCount = length2;
+        oriVert.bwWeight = boneWeightArray;
+        oriVert.nSubMeshCount = length2;
+        oriVert.nSubMeshOriTri = new int[length2][];
+        for (int submesh = 0; submesh < length2; ++submesh)
+        {
+            int length5 = r.ReadInt32();
+            var triangles = new int[length5];
+            for (int index = 0; index < length5; ++index)
+                triangles[index] = r.ReadUInt16();
+            oriVert.nSubMeshOriTri[submesh] = triangles;
+            mesh2.SetTriangles(triangles, submesh);
+        }
+
+        int length6 = r.ReadInt32();
+        var materialArray = new Material[length6];
+        for (int index = 0; index < length6; ++index)
+        {
+            Material material = ReadMaterial(r, bodyskin, null, filename2[1 + index]);
+            materialArray[index] = material;
+        }
+
+        component.materials = materialArray;
+        r.Close();
+        return gameObject1;
+    }
+
+    public static Material ReadMaterial(BinaryReader r, TBodySkin bodyskin, Material existmat, string filename)
+    {
+        bodyskin = null;
+        existmat = null;
+        if (m_hashPriorityMaterials == null)
+        {
+            m_hashPriorityMaterials = new Dictionary<int, KeyValuePair<string, float>>();
+            var list = GameUty.FileSystem.GetList("prioritymaterial", AFileSystemBase.ListType.AllFile);
+            if (list != null && 0 < list.Length)
+                for (int index = 0; index < list.Length; ++index)
+                    if (Path.GetExtension(list[index]) == ".pmat")
+                    {
+                        string fileName = list[index];
+                        using (AFileBase afileBase = GameUty.FileOpen(fileName, null))
+                        {
+                            NDebug.Assert(afileBase.IsValid(), fileName + "を開けませんでした");
+                            using (var binaryReader = new BinaryReader(new MemoryStream(afileBase.ReadAll()), Encoding.UTF8))
+                            {
+                                NDebug.Assert(binaryReader.ReadString() == "CM3D2_PMATERIAL", "ヘッダーエラー\n" + fileName);
+                                binaryReader.ReadInt32();
+                                int key1 = binaryReader.ReadInt32();
+                                string key2 = binaryReader.ReadString();
+                                float num = binaryReader.ReadSingle();
+                                NDebug.Assert(!m_hashPriorityMaterials.ContainsKey(key1), "すでにハッシュが登録されています");
+                                m_hashPriorityMaterials.Add(key1, new KeyValuePair<string, float>(key2, num));
+                            }
+                        }
+                    }
+        }
+
+        string str1 = r.ReadString();
+        string str2 = r.ReadString();
+        string path1 = "DefMaterial/" + r.ReadString();
+        Material material;
+        if (existmat == null)
+        {
+            var original = Resources.Load(path1, typeof(Material)) as Material;
+            if (original == null)
+                return original;
+            material = Instantiate(original);
+        }
+        else
+        {
+            material = existmat;
+            NDebug.Assert(material.shader.name == str2, "マテリアル入れ替えエラー。違うシェーダーに入れようとしました。 " + str2 + " -> " + material.shader.name);
+        }
+
+        material.name = str1;
+        int hashCode1 = material.name.GetHashCode();
+        if (m_hashPriorityMaterials != null && m_hashPriorityMaterials.ContainsKey(hashCode1))
+        {
+            var priorityMaterial = m_hashPriorityMaterials[hashCode1];
+            if (priorityMaterial.Key == material.name)
+            {
+                material.SetFloat("_SetManualRenderQueue", priorityMaterial.Value);
+                material.renderQueue = (int)priorityMaterial.Value;
+            }
+        }
+
+        string str3;
+        Vector2 vector2_1;
+        Vector2 vector2_2;
+        string str4;
+        string str5;
+        Color color;
+        Vector4 vector4;
+        bool flag;
+        while (true)
+        {
+            flag = true;
+            string str6 = r.ReadString();
+            if (!(str6 == "end"))
+            {
+                string name = r.ReadString();
+                if (str6 == "tex")
+                {
+                    string str7 = r.ReadString();
+                    if (str7 == "null")
+                    {
+                        material.SetTexture(name, null);
+                    }
+                    else if (str7 == "tex2d")
+                    {
+                        try
+                        {
+                            string str8 = r.ReadString();
+                            str3 = r.ReadString();
+                            var data = ImportCM.LoadTexture(GameUty.FileSystem, str8 + ".tex", false).data;
+                            vector2_1.x = r.ReadSingle();
+                            vector2_1.y = r.ReadSingle();
+                            vector2_2.x = r.ReadSingle();
+                            vector2_2.y = r.ReadSingle();
+                            if (filename == null || !filename.Contains(".mate"))
+                            {
+                                var texture2D = new Texture2D(1, 1, TextureFormat.RGBA32, false);
+                                texture2D.LoadImage(data);
+                                texture2D.name = str8;
+                                texture2D.wrapMode = TextureWrapMode.Clamp;
+                                material.SetTexture(name, texture2D);
+                                material.SetTextureOffset(name, vector2_1);
+                                material.SetTextureScale(name, vector2_2);
+                            }
+                        }
+                        catch
+                        {
+                            break;
+                        }
+                    }
+                    else if (str7 == "texRT")
+                    {
+                        str4 = r.ReadString();
+                        str5 = r.ReadString();
+                    }
+                }
+                else if (str6 == "col")
+                {
+                    color.r = r.ReadSingle();
+                    color.g = r.ReadSingle();
+                    color.b = r.ReadSingle();
+                    color.a = r.ReadSingle();
+                    material.SetColor(name, color);
+                }
+                else if (str6 == "vec")
+                {
+                    vector4.x = r.ReadSingle();
+                    vector4.y = r.ReadSingle();
+                    vector4.z = r.ReadSingle();
+                    vector4.w = r.ReadSingle();
+                    material.SetVector(name, vector4);
+                }
+                else if (str6 == "f")
+                {
+                    float num = r.ReadSingle();
+                    material.SetFloat(name, num);
+                }
+            }
+            else
+            {
+                break;
+            }
+        }
+
+        if (filename != null && filename.Contains(".mate"))
+        {
+            try
+            {
+                using (AFileBase afileBase = GameUty.FileOpen(filename, null))
+                {
+                    if (m_matTempFile == null)
+                        m_matTempFile = new byte[Math.Max(10000, afileBase.GetSize())];
+                    else if (m_matTempFile.Length < afileBase.GetSize())
+                        m_matTempFile = new byte[afileBase.GetSize()];
+                    afileBase.Read(ref m_matTempFile, afileBase.GetSize());
+                }
+            }
+            catch { }
+
+            var binaryReader = new BinaryReader(new MemoryStream(m_matTempFile), Encoding.UTF8);
+            string str6 = binaryReader.ReadString();
+            NDebug.Assert(str6 == "CM3D2_MATERIAL", "ProcScriptBin 例外 : ヘッダーファイルが不正です。" + str6);
+            binaryReader.ReadInt32();
+            binaryReader.ReadString();
+            r = binaryReader;
+            string str7 = r.ReadString();
+            string str8 = r.ReadString();
+            string path2 = "DefMaterial/" + r.ReadString();
+            if (existmat == null)
+            {
+                var original = Resources.Load(path2, typeof(Material)) as Material;
+                if (original == null)
+                    return original;
+                material = Instantiate(original);
+            }
+            else
+            {
+                material = existmat;
+                NDebug.Assert(material.shader.name == str8, "マテリアル入れ替えエラー。違うシェーダーに入れようとしました。 " + str8 + " -> " + material.shader.name);
+            }
+
+            material.name = str7;
+            int hashCode2 = material.name.GetHashCode();
+            if (m_hashPriorityMaterials != null && m_hashPriorityMaterials.ContainsKey(hashCode2))
+            {
+                var priorityMaterial = m_hashPriorityMaterials[hashCode2];
+                if (priorityMaterial.Key == material.name)
+                {
+                    material.SetFloat("_SetManualRenderQueue", priorityMaterial.Value);
+                    material.renderQueue = (int)priorityMaterial.Value;
+                }
+            }
+
+            while (true)
+            {
+                flag = true;
+                string str9 = r.ReadString();
+                if (!(str9 == "end"))
+                {
+                    string name = r.ReadString();
+                    if (str9 == "tex")
+                    {
+                        string str10 = r.ReadString();
+                        if (str10 == "null")
+                        {
+                            material.SetTexture(name, null);
+                        }
+                        else if (str10 == "tex2d")
+                        {
+                            try
+                            {
+                                string str11 = r.ReadString();
+                                str3 = r.ReadString();
+                                var data = ImportCM.LoadTexture(GameUty.FileSystem, str11 + ".tex", false).data;
+                                var texture2D = new Texture2D(1, 1, TextureFormat.RGBA32, false);
+                                texture2D.LoadImage(data);
+                                texture2D.name = str11;
+                                texture2D.wrapMode = TextureWrapMode.Clamp;
+                                material.SetTexture(name, texture2D);
+                                vector2_1.x = r.ReadSingle();
+                                vector2_1.y = r.ReadSingle();
+                                material.SetTextureOffset(name, vector2_1);
+                                vector2_2.x = r.ReadSingle();
+                                vector2_2.y = r.ReadSingle();
+                                material.SetTextureScale(name, vector2_2);
+                            }
+                            catch
+                            {
+                                break;
+                            }
+                        }
+                        else if (str10 == "texRT")
+                        {
+                            str4 = r.ReadString();
+                            str5 = r.ReadString();
+                        }
+                    }
+                    else if (str9 == "col")
+                    {
+                        color.r = r.ReadSingle();
+                        color.g = r.ReadSingle();
+                        color.b = r.ReadSingle();
+                        color.a = r.ReadSingle();
+                        material.SetColor(name, color);
+                    }
+                    else if (str9 == "vec")
+                    {
+                        vector4.x = r.ReadSingle();
+                        vector4.y = r.ReadSingle();
+                        vector4.z = r.ReadSingle();
+                        vector4.w = r.ReadSingle();
+                        material.SetVector(name, vector4);
+                    }
+                    else if (str9 == "f")
+                    {
+                        float num = r.ReadSingle();
+                        material.SetFloat(name, num);
+                    }
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+
+        return material;
+    }
+}

+ 315 - 0
MultipleMaids/MouseDrag.cs

@@ -0,0 +1,315 @@
+using UnityEngine;
+
+public class MouseDrag : MonoBehaviour
+{
+    public Transform ForearmL;
+    public Transform HandL;
+    public Vector3 HandLangles;
+    public int ido;
+    public bool initFlg;
+    public bool initFlg2;
+    public bool isIdo;
+    public bool isMouseDown;
+    public bool isMouseDrag;
+    public bool isMouseUp;
+    public bool isPlay;
+    public bool isSelect;
+    public bool isStop;
+    public Maid maid;
+    public GameObject obj;
+    public Vector3 off;
+    public Vector3 off2;
+    public bool onFlg;
+    public bool onFlg2;
+    public bool reset;
+    public float shoki = -1000f;
+    public Transform UpperArmL;
+    public Vector3 UpperArmLangles;
+    private readonly GameObject ForearmL2 = new GameObject();
+    private readonly GameObject HandL2 = new GameObject();
+    private readonly TBody.IKCMO IK = new TBody.IKCMO();
+    private Vector3 mouseIti;
+    private Vector3 mouseIti2;
+    private Vector3 rotate;
+    private Vector3 rotate2;
+    private readonly GameObject UpperArmL2 = new GameObject();
+    private Vector3 worldPoint;
+
+    public void OnMouseDown()
+    {
+        if (!(maid != null))
+            return;
+        IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手", false);
+        worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+        off = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+        off2 = new Vector3(obj.transform.position.x - HandL.position.x,
+                           obj.transform.position.y - HandL.position.y,
+                           obj.transform.position.z - HandL.position.z);
+        if (!initFlg)
+        {
+            IK.Init(UpperArmL, ForearmL, HandL, maid.body0);
+            initFlg = true;
+            if (!initFlg2)
+            {
+                initFlg2 = true;
+                HandL2.transform.position = HandL.position;
+                UpperArmL2.transform.position = UpperArmL.position;
+                ForearmL2.transform.position = ForearmL.position;
+                HandL2.transform.localRotation = HandL.localRotation;
+                UpperArmL2.transform.localRotation = UpperArmL.localRotation;
+                ForearmL2.transform.localRotation = ForearmL.localRotation;
+            }
+        }
+
+        if (onFlg)
+        {
+            onFlg2 = true;
+            IK.Init(UpperArmL, ForearmL, HandL, maid.body0);
+        }
+
+        mouseIti = Input.mousePosition;
+        isPlay = maid.body0.m_Bones.GetComponent<Animation>().isPlaying;
+        isSelect = true;
+        rotate = HandL.localEulerAngles;
+        rotate2 = UpperArmL.localEulerAngles;
+        isMouseUp = false;
+        isMouseDown = true;
+        if (ido == 10)
+        {
+            Vector3 tgt = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z)) + off
+                          - off2;
+            IK.Init(UpperArmL2.transform, ForearmL2.transform, HandL2.transform, maid.body0);
+            for (int index = 0; index < 10; ++index)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+            }
+        }
+
+        if (shoki != -1000.0)
+            return;
+        shoki = UpperArmL.localEulerAngles.x;
+        if (shoki <= 300.0)
+            return;
+        shoki -= 360f;
+    }
+
+    public void OnMouseUp()
+    {
+        isMouseUp = true;
+        isMouseDown = false;
+    }
+
+    public void OnMouseDrag()
+    {
+        if (!(maid != null))
+            return;
+        if (isPlay && mouseIti != Input.mousePosition)
+        {
+            maid.body0.m_Bones.GetComponent<Animation>().Stop();
+            isStop = true;
+            isPlay = false;
+        }
+
+        if (reset)
+        {
+            reset = false;
+            worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+            off = transform.position
+                  - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+            off2 = new Vector3(obj.transform.position.x - HandL.position.x,
+                               obj.transform.position.y - HandL.position.y,
+                               obj.transform.position.z - HandL.position.z);
+            rotate = HandL.localEulerAngles;
+            rotate2 = UpperArmL.localEulerAngles;
+            mouseIti = Input.mousePosition;
+            if (onFlg)
+                IK.Init(UpperArmL, ForearmL, HandL, maid.body0);
+        }
+
+        if (mouseIti != Input.mousePosition)
+        {
+            Vector3 tgt = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z)) + off
+                          - off2;
+            IKCtrlData ikData = maid.body0.IKCtrl.GetIKData("左手", false);
+            isMouseDrag = true;
+            if (!isPlay)
+                isStop = true;
+            isIdo = false;
+            if (ido == 0)
+            {
+                isIdo = true;
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                HandLangles = new Vector3(HandL.localEulerAngles.x, HandL.localEulerAngles.y, HandL.localEulerAngles.z);
+                UpperArmLangles = new Vector3(UpperArmL.localEulerAngles.x, UpperArmL.localEulerAngles.y, UpperArmL.localEulerAngles.z);
+            }
+            else if (ido == 11)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                float x = UpperArmL.localEulerAngles.x;
+                if (x > 250.0 + shoki && x < 352.0 + shoki)
+                    x = 352f + shoki;
+                if (x < 100.0 + shoki && x > 8.0 + shoki)
+                    x = 8f + shoki;
+                float z = UpperArmL.localEulerAngles.z;
+                if (z > 140.0 && z < 240.0)
+                    z = 240f;
+                if (z <= 140.0 && z > 7.0)
+                    z = 7f;
+                HandL.localEulerAngles = new Vector3(rotate.x, rotate.y, HandL.localEulerAngles.z);
+                UpperArmL.localEulerAngles = new Vector3(x, rotate2.y, z);
+            }
+            else if (ido == 12)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                float x = UpperArmL.localEulerAngles.x;
+                if (x > 250.0 + shoki && x < 357.0 + shoki)
+                    x = 357f + shoki;
+                if (x < 100.0 + shoki && x > 3.0 + shoki)
+                    x = 3f + shoki;
+                float z = UpperArmL.localEulerAngles.z;
+                if (z > 140.0 && z < 270.0)
+                    z = 270f;
+                if (z <= 140.0 && z > 15.0)
+                    z = 15f;
+                HandL.localEulerAngles = new Vector3(rotate.x, rotate.y, HandL.localEulerAngles.z);
+                UpperArmL.localEulerAngles = new Vector3(x, rotate2.y, z);
+            }
+            else if (ido == 17)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                float x = UpperArmL.localEulerAngles.x;
+                if (x > 250.0 + shoki && x < 357.0 + shoki)
+                    x = 357f + shoki;
+                if (x < 100.0 + shoki && x > 3.0 + shoki)
+                    x = 3f + shoki;
+                float z = UpperArmL.localEulerAngles.z;
+                if (z > 220.0 && z < 345.0)
+                    z = 345f;
+                if (z <= 220.0 && z > 90.0)
+                    z = 90f;
+                HandL.localEulerAngles = new Vector3(rotate.x, rotate.y, HandL.localEulerAngles.z);
+                UpperArmL.localEulerAngles = new Vector3(x, rotate2.y, z);
+            }
+            else if (ido == 13)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                float num1 = UpperArmL.localEulerAngles.x;
+                if (num1 > 250.0 && num1 < 345.0)
+                    num1 = 345f;
+                if (num1 <= 250.0)
+                    ;
+                float z = UpperArmL.localEulerAngles.z;
+                if (z > 160.0 && z < 275.0)
+                    z = 275f;
+                if (z <= 160.0 && z > 60.0)
+                    z = 60f;
+                float num2 = UpperArmL.localEulerAngles.y;
+                if (num2 > 250.0 && num2 < 345.0)
+                    num2 = 345f;
+                if (num2 <= 250.0)
+                    ;
+                HandL.localEulerAngles = new Vector3(rotate.x, HandL.localEulerAngles.y, HandL.localEulerAngles.z);
+                UpperArmL.localEulerAngles = new Vector3(UpperArmL.localEulerAngles.x, UpperArmL.localEulerAngles.y, z);
+            }
+            else if (ido == 14)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                float x = UpperArmL.localEulerAngles.x;
+                if (x > 250.0 + shoki && x < 345.0 + shoki)
+                    x = 345f + shoki;
+                if (x < 100.0 + shoki && x > 15.0 + shoki)
+                    x = 15f + shoki;
+                float z = UpperArmL.localEulerAngles.z;
+                if (z > 150.0 && z < 240.0)
+                    z = 240f;
+                if (z <= 150.0 && z > 30.0)
+                    z = 30f;
+                HandL.localEulerAngles = new Vector3(rotate.x, rotate.y, HandL.localEulerAngles.z);
+                UpperArmL.localEulerAngles = new Vector3(x, rotate2.y, z);
+            }
+            else if (ido == 15)
+            {
+                IK.Porc(UpperArmL, ForearmL, HandL, tgt, new Vector3(), ikData);
+                if (!onFlg)
+                    IK.Porc(UpperArmL, ForearmL, HandL, tgt + (tgt - HandL.position), new Vector3(), ikData);
+                float x = UpperArmL.localEulerAngles.x;
+                if (x > 250.0 + shoki && x < 357.0 + shoki)
+                    x = 357f + shoki;
+                if (x < 100.0 + shoki && x > 3.0 + shoki)
+                    x = 3f + shoki;
+                float z = UpperArmL.localEulerAngles.z;
+                if (z > 150.0 && z < 270.0)
+                    z = 270f;
+                if (z <= 150.0 && z > 30.0)
+                    z = 30f;
+                HandL.localEulerAngles = new Vector3(rotate.x, rotate.y, HandL.localEulerAngles.z);
+                UpperArmL.localEulerAngles = new Vector3(x, rotate2.y, z);
+            }
+            else if (ido == 16)
+            {
+                Vector3 vector3 = Input.mousePosition - mouseIti;
+                Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+                transform.TransformDirection(Vector3.right);
+                transform.TransformDirection(Vector3.forward);
+                if (mouseIti2 != Input.mousePosition)
+                {
+                    UpperArmL.localEulerAngles = rotate2;
+                    UpperArmL.localRotation = Quaternion.Euler(UpperArmL.localEulerAngles)
+                                              * Quaternion.AngleAxis(vector3.x / 2.2f, Vector3.right);
+                }
+            }
+            else
+            {
+                Vector3 vector3_1 = Input.mousePosition - mouseIti;
+                Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+                Vector3 vector3_2 = transform.TransformDirection(Vector3.right);
+                Vector3 vector3_3 = transform.TransformDirection(Vector3.forward);
+                if (mouseIti2 != Input.mousePosition)
+                {
+                    if (ido <= 4)
+                        HandL.localEulerAngles = rotate;
+                    else
+                        UpperArmL.localEulerAngles = rotate2;
+                    if (ido == 1)
+                    {
+                        HandL.localRotation = Quaternion.Euler(HandL.localEulerAngles)
+                                              * Quaternion.AngleAxis(vector3_1.x / 1.5f, Vector3.up);
+                        HandL.localRotation = Quaternion.Euler(HandL.localEulerAngles)
+                                              * Quaternion.AngleAxis(vector3_1.y / 1.5f, Vector3.forward);
+                    }
+
+                    if (ido == 2)
+                        HandL.localRotation = Quaternion.Euler(HandL.localEulerAngles)
+                                              * Quaternion.AngleAxis(vector3_1.x / 1.5f, Vector3.right);
+                    if (ido == 3)
+                    {
+                        HandL.RotateAround(HandL.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / 1f);
+                        HandL.RotateAround(HandL.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), vector3_1.x / 1.5f);
+                    }
+
+                    if (ido == 4)
+                        HandL.localRotation = Quaternion.Euler(HandL.localEulerAngles)
+                                              * Quaternion.AngleAxis((float)(-(double)vector3_1.x / 1.5), Vector3.right);
+                    if (ido == 5)
+                        UpperArmL.localRotation = Quaternion.Euler(UpperArmL.localEulerAngles)
+                                                  * Quaternion.AngleAxis((float)(-(double)vector3_1.x / 1.5), Vector3.right);
+                }
+            }
+        }
+
+        mouseIti2 = Input.mousePosition;
+    }
+}

+ 157 - 0
MultipleMaids/MouseDrag2.cs

@@ -0,0 +1,157 @@
+using UnityEngine;
+
+public class MouseDrag2 : MonoBehaviour
+{
+    public int ido;
+    public bool isClick;
+    public bool isIdo;
+    public bool isOn;
+    public bool isSelect;
+    public Maid maid = null;
+    public GameObject obj;
+    public bool reset;
+    private float doubleTapTime;
+    private int idoOld;
+    private Vector3 mouseIti;
+    private Vector3 mouseIti2;
+    private Vector3 off;
+    private Vector3 off2;
+    private Vector3 rotate;
+    private float size;
+    private Vector3 worldPoint;
+
+    public void Update()
+    {
+        doubleTapTime += Time.deltaTime;
+    }
+
+    public void OnMouseDown()
+    {
+        if (!(maid != null))
+            return;
+        worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+        off = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+        off2 = new Vector3(obj.transform.position.x - maid.transform.position.x,
+                           obj.transform.position.y - maid.transform.position.y,
+                           obj.transform.position.z - maid.transform.position.z);
+        mouseIti = Input.mousePosition;
+        if (doubleTapTime < 0.300000011920929 && isClick && ido == idoOld)
+        {
+            if (ido == 5)
+                maid.transform.localScale = new Vector3(1f, 1f, 1f);
+            if (ido == 4 || ido == 6)
+                maid.transform.eulerAngles = new Vector3(0.0f, maid.transform.eulerAngles.y, 0.0f);
+        }
+
+        if (doubleTapTime >= 0.300000011920929 && isClick)
+            isClick = false;
+        doubleTapTime = 0.0f;
+        rotate = maid.transform.localEulerAngles;
+        size = maid.transform.localScale.x;
+        isSelect = true;
+        isOn = true;
+    }
+
+    public void OnMouseUp()
+    {
+        if (maid != null)
+            isOn = false;
+        if (doubleTapTime >= 0.300000011920929)
+            return;
+        isClick = true;
+        doubleTapTime = 0.0f;
+        idoOld = ido;
+    }
+
+    public void OnMouseDrag()
+    {
+        if (!(maid != null))
+            return;
+        if (reset)
+        {
+            reset = false;
+            worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+            off = transform.position
+                  - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+            off2 = new Vector3(obj.transform.position.x - maid.transform.position.x,
+                               obj.transform.position.y - maid.transform.position.y,
+                               obj.transform.position.z - maid.transform.position.z);
+            rotate = maid.transform.localEulerAngles;
+            size = maid.transform.localScale.x;
+            mouseIti = Input.mousePosition;
+        }
+
+        if (mouseIti != Input.mousePosition)
+        {
+            Vector3 vector3_1 = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z))
+                                + off - off2;
+            isIdo = false;
+            if (ido == 1)
+            {
+                maid.transform.position = new Vector3(vector3_1.x, maid.transform.position.y, vector3_1.z);
+                isIdo = true;
+            }
+
+            if (ido == 2)
+            {
+                maid.transform.position = new Vector3(maid.transform.position.x, vector3_1.y, maid.transform.position.z);
+                isIdo = true;
+            }
+
+            Vector3 vector3_2;
+            if (ido == 3)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                maid.transform.eulerAngles =
+                        new Vector3(maid.transform.eulerAngles.x, rotate.y - vector3_2.x / 2.2f, maid.transform.eulerAngles.z);
+            }
+
+            Vector3 vector3_3;
+            if (ido == 4)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+                vector3_3 = transform.TransformDirection(Vector3.right);
+                Vector3 vector3_4 = transform.TransformDirection(Vector3.forward);
+                if (mouseIti2 != Input.mousePosition)
+                {
+                    maid.transform.localEulerAngles = rotate;
+                    maid.transform.RotateAround(maid.transform.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), vector3_2.y / 4f);
+                    maid.transform.RotateAround(maid.transform.position,
+                                                new Vector3(vector3_4.x, 0.0f, vector3_4.z),
+                                                (float)(-(double)vector3_2.x / 6.0));
+                }
+
+                isIdo = true;
+                mouseIti2 = Input.mousePosition;
+            }
+
+            if (ido == 6)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+                vector3_3 = transform.TransformDirection(Vector3.right);
+                transform.TransformDirection(Vector3.forward);
+                if (mouseIti2 != Input.mousePosition)
+                {
+                    maid.transform.localEulerAngles = rotate;
+                    maid.body0.transform.localRotation = Quaternion.Euler(maid.body0.transform.localEulerAngles)
+                                                         * Quaternion.AngleAxis((float)(-(double)vector3_2.x / 2.20000004768372),
+                                                                                Vector3.up);
+                }
+
+                isIdo = true;
+                mouseIti2 = Input.mousePosition;
+            }
+
+            if (ido == 5)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                float num = size + vector3_2.y / 200f;
+                if (num < 0.100000001490116)
+                    num = 0.1f;
+                maid.transform.localScale = new Vector3(num, num, num);
+            }
+        }
+    }
+}

+ 270 - 0
MultipleMaids/MouseDrag3.cs

@@ -0,0 +1,270 @@
+using UnityEngine;
+
+public class MouseDrag3 : MonoBehaviour
+{
+    public Transform head;
+    public int ido;
+    public bool isClick;
+    public bool isClick2;
+    public bool isHead;
+    public bool isIdo;
+    public bool isPlay;
+    public bool isSelect;
+    public bool isStop;
+    public Maid maid;
+    public int no;
+    public GameObject obj;
+    public Transform Pelvis;
+    public bool reset;
+    public bool shodaiFlg = false;
+    public Transform Spine;
+    public Transform Spine0a;
+    public Transform Spine1;
+    public Transform Spine1a;
+    private float doubleTapTime;
+    private int idoOld;
+    private Vector3 mouseIti;
+    private Vector3 mouseIti2;
+    private Vector3 off;
+    private Vector3 off2;
+    private Vector3 pos3;
+    private Quaternion quaL;
+    private Quaternion quaR;
+    private Vector3 rotate;
+    private Vector3 rotate1;
+    private Vector3 rotate2;
+    private Vector3 rotate3;
+    private Vector3 rotate4;
+    private Vector3 rotate5;
+    private Vector3 rotateL;
+    private Vector3 rotateR;
+    private Vector3 worldPoint;
+
+    public void Update()
+    {
+        doubleTapTime += Time.deltaTime;
+    }
+
+    public void OnMouseDown()
+    {
+        if (!(maid != null))
+            return;
+        worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+        mouseIti = Input.mousePosition;
+        if (ido == 1 || ido == 4 || ido == 8)
+            rotate = head.localEulerAngles;
+        if (ido == 2 || ido == 5)
+        {
+            rotate1 = Spine1a.localEulerAngles;
+            rotate2 = Spine1.localEulerAngles;
+            rotate3 = Spine0a.localEulerAngles;
+            rotate4 = Spine.localEulerAngles;
+        }
+
+        if (ido == 3 || ido == 6)
+            rotate5 = Pelvis.localEulerAngles;
+        if (ido == 7)
+        {
+            rotateR = maid.body0.quaDefEyeR.eulerAngles;
+            rotateL = maid.body0.quaDefEyeL.eulerAngles;
+            quaL = maid.body0.quaDefEyeL;
+            quaR = maid.body0.quaDefEyeR;
+        }
+
+        if (ido == 9)
+        {
+            worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+            off = transform.position
+                  - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+            off2 = new Vector3(obj.transform.position.x - head.position.x,
+                               obj.transform.position.y - head.position.y,
+                               obj.transform.position.z - head.position.z);
+            mouseIti = Input.mousePosition;
+        }
+
+        isSelect = true;
+        isPlay = maid.body0.m_Bones.GetComponent<Animation>().isPlaying;
+        if (!isPlay)
+            isStop = true;
+        if (doubleTapTime < 0.300000011920929 && isClick2 && ido == idoOld)
+            isHead = true;
+        if (doubleTapTime >= 0.300000011920929 && isClick)
+            isClick = false;
+        if (doubleTapTime >= 0.300000011920929 && isClick2)
+            isClick2 = false;
+        doubleTapTime = 0.0f;
+        pos3 = Input.mousePosition - mouseIti;
+    }
+
+    public void OnMouseUp()
+    {
+        if (!(maid != null) || doubleTapTime >= 0.300000011920929)
+            return;
+        if (ido == 7)
+            isClick = true;
+        isClick2 = true;
+        doubleTapTime = 0.0f;
+        idoOld = ido;
+    }
+
+    public void OnMouseDrag()
+    {
+        if (!(maid != null))
+            return;
+        if (isPlay && mouseIti != Input.mousePosition)
+        {
+            maid.body0.m_Bones.GetComponent<Animation>().Stop();
+            isStop = true;
+            isPlay = false;
+        }
+
+        if (reset)
+        {
+            reset = false;
+            worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+            if (ido == 1 || ido == 4 || ido == 8)
+                rotate = head.localEulerAngles;
+            if (ido == 2 || ido == 5)
+            {
+                rotate1 = Spine1a.localEulerAngles;
+                rotate2 = Spine1.localEulerAngles;
+                rotate3 = Spine0a.localEulerAngles;
+                rotate4 = Spine.localEulerAngles;
+            }
+
+            if (ido == 3 || ido == 6)
+                rotate5 = Pelvis.localEulerAngles;
+            if (ido == 7)
+            {
+                rotateR = maid.body0.quaDefEyeR.eulerAngles;
+                rotateL = maid.body0.quaDefEyeL.eulerAngles;
+                quaL = maid.body0.quaDefEyeL;
+                quaR = maid.body0.quaDefEyeR;
+            }
+
+            mouseIti = Input.mousePosition;
+            if (ido == 9)
+            {
+                worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+                off = transform.position
+                      - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+                off2 = new Vector3(obj.transform.position.x - head.position.x,
+                                   obj.transform.position.y - head.position.y,
+                                   obj.transform.position.z - head.position.z);
+                mouseIti = Input.mousePosition;
+            }
+        }
+
+        if (mouseIti != Input.mousePosition)
+        {
+            var position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z);
+            Vector3 vector3_1 = Input.mousePosition - mouseIti;
+            Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+            Vector3 vector3_2 = transform.TransformDirection(Vector3.right);
+            Vector3 vector3_3 = transform.TransformDirection(Vector3.forward);
+            if (mouseIti2 != Input.mousePosition)
+            {
+                if (ido == 1)
+                {
+                    isIdo = true;
+                    head.localEulerAngles = rotate;
+                    head.RotateAround(head.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / 3f);
+                    head.RotateAround(head.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), (float)(-(double)vector3_1.x / 4.5));
+                }
+
+                if (ido == 4)
+                {
+                    isIdo = true;
+                    head.localEulerAngles = rotate;
+                    head.localRotation = Quaternion.Euler(head.localEulerAngles) * Quaternion.AngleAxis(vector3_1.x / 3f, Vector3.right);
+                }
+
+                if (ido == 8)
+                {
+                    isIdo = true;
+                    head.localEulerAngles = rotate;
+                    head.localRotation = Quaternion.Euler(head.localEulerAngles)
+                                         * Quaternion.AngleAxis((float)(-(double)vector3_1.x / 3.0), Vector3.forward);
+                }
+
+                if (ido == 9)
+                    head.transform.position = new Vector3(head.transform.position.x,
+                                                          (Camera.main.ScreenToWorldPoint(position) + off - off2).y,
+                                                          head.transform.position.z);
+                if (ido == 2)
+                {
+                    Spine1a.localEulerAngles = rotate1;
+                    Spine1.localEulerAngles = rotate2;
+                    Spine0a.localEulerAngles = rotate3;
+                    Spine.localEulerAngles = rotate4;
+                    float num1 = 1.5f;
+                    float num2 = 1f;
+                    float num3 = 0.03f;
+                    float num4 = 0.1f;
+                    float num5 = 0.09f;
+                    float num6 = 0.07f;
+                    Spine1a.RotateAround(Spine1a.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / num2 * num3);
+                    Spine1a.RotateAround(Spine1a.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), -vector3_1.x / num1 * num3);
+                    Spine1.RotateAround(Spine1.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / num2 * num4);
+                    Spine1.RotateAround(Spine1.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), -vector3_1.x / num1 * num4);
+                    Spine0a.RotateAround(Spine0a.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / num2 * num5);
+                    Spine0a.RotateAround(Spine0a.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), -vector3_1.x / num1 * num5);
+                    Spine.RotateAround(Spine.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / num2 * num6);
+                    Spine.RotateAround(Spine.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), -vector3_1.x / num1 * num6);
+                }
+
+                if (ido == 5)
+                {
+                    Spine1a.localEulerAngles = rotate1;
+                    Spine1.localEulerAngles = rotate2;
+                    Spine0a.localEulerAngles = rotate3;
+                    Spine.localEulerAngles = rotate4;
+                    Spine1a.localRotation = Quaternion.Euler(Spine1a.localEulerAngles)
+                                            * Quaternion.AngleAxis((float)(vector3_1.x / 1.5 * 0.0839999988675117), Vector3.right);
+                    Spine0a.localRotation = Quaternion.Euler(Spine0a.localEulerAngles)
+                                            * Quaternion.AngleAxis((float)(vector3_1.x / 1.5 * 0.156000003218651), Vector3.right);
+                    Spine.localRotation = Quaternion.Euler(Spine.localEulerAngles)
+                                          * Quaternion.AngleAxis((float)(vector3_1.x / 1.5 * 0.156000003218651), Vector3.right);
+                }
+
+                if (ido == 3)
+                {
+                    Pelvis.localEulerAngles = rotate5;
+                    Pelvis.RotateAround(Pelvis.position, new Vector3(vector3_2.x, 0.0f, vector3_2.z), vector3_1.y / 4f);
+                    Pelvis.RotateAround(Pelvis.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), vector3_1.x / 6f);
+                }
+
+                if (ido == 6)
+                {
+                    Pelvis.localEulerAngles = rotate5;
+                    Pelvis.localRotation =
+                            Quaternion.Euler(Pelvis.localEulerAngles) * Quaternion.AngleAxis(vector3_1.x / 3f, Vector3.right);
+                }
+
+                if (ido == 7)
+                {
+                    var vector3_4 = new Vector3(rotateR.x, rotateR.y + vector3_1.x / 10f, rotateR.z + vector3_1.y / 10f);
+                    if (shodaiFlg)
+                    {
+                        if (vector3_4.z < 345.700012207031 && vector3_4.z > 335.700012207031)
+                            pos3.y = vector3_1.y;
+                        if (vector3_4.y < 347.600006103516 && vector3_4.y > 335.600006103516)
+                            pos3.x = vector3_1.x;
+                    }
+                    else
+                    {
+                        if (vector3_4.z < 354.799987792969 && vector3_4.z > 344.799987792969)
+                            pos3.y = vector3_1.y;
+                        if (vector3_4.y < 354.0 && vector3_4.y > 342.0)
+                            pos3.x = vector3_1.x;
+                    }
+
+                    maid.body0.quaDefEyeR.eulerAngles = new Vector3(rotateR.x, rotateR.y + pos3.x / 10f, rotateR.z + pos3.y / 10f);
+                    maid.body0.quaDefEyeL.eulerAngles = new Vector3(rotateL.x, rotateL.y - pos3.x / 10f, rotateL.z - pos3.y / 10f);
+                }
+            }
+
+            mouseIti2 = Input.mousePosition;
+        }
+    }
+}

+ 76 - 0
MultipleMaids/MouseDrag4.cs

@@ -0,0 +1,76 @@
+using UnityEngine;
+
+public class MouseDrag4 : MonoBehaviour
+{
+    public Transform HandL;
+    public int ido;
+    public bool isPlay = false;
+    public bool isSelect;
+    public bool isStop = false;
+    public Maid maid = null;
+    public GameObject obj;
+    public bool reset;
+    private Vector3 mouseIti;
+    private Vector3 mouseIti2;
+    private Vector3 off;
+    private Vector3 off2;
+    private Vector3 rotate;
+    private Vector3 worldPoint;
+
+    public void OnMouseDown()
+    {
+        if (!(maid != null))
+            return;
+        worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+        off = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+        off2 = new Vector3(obj.transform.position.x - HandL.position.x,
+                           obj.transform.position.y - HandL.position.y,
+                           obj.transform.position.z - HandL.position.z);
+        mouseIti = Input.mousePosition;
+        isSelect = true;
+        rotate = HandL.localEulerAngles;
+    }
+
+    public void OnMouseDrag()
+    {
+        if (!(maid != null))
+            return;
+        if (reset)
+        {
+            reset = false;
+            worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+            off = transform.position
+                  - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+            off2 = new Vector3(obj.transform.position.x - HandL.position.x,
+                               obj.transform.position.y - HandL.position.y,
+                               obj.transform.position.z - HandL.position.z);
+            rotate = HandL.localEulerAngles;
+            mouseIti = Input.mousePosition;
+        }
+
+        if (mouseIti != Input.mousePosition)
+        {
+            Vector3 vector3_1 = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z))
+                                + off - off2;
+            Vector3 vector3_2 = Input.mousePosition - mouseIti;
+            Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+            Vector3 vector3_3 = transform.TransformDirection(Vector3.right);
+            Vector3 vector3_4 = transform.TransformDirection(Vector3.forward);
+            if (mouseIti2 != Input.mousePosition)
+            {
+                HandL.localEulerAngles = rotate;
+                if (ido == 1)
+                {
+                    HandL.RotateAround(HandL.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), vector3_2.y / 1f);
+                    HandL.RotateAround(HandL.position, new Vector3(vector3_4.x, 0.0f, vector3_4.z), (float)(-(double)vector3_2.x / 1.5));
+                }
+
+                if (ido == 2)
+                    HandL.localRotation = Quaternion.Euler(HandL.localEulerAngles)
+                                          * Quaternion.AngleAxis(vector3_2.x / 1.5f, Vector3.right);
+            }
+        }
+
+        mouseIti2 = Input.mousePosition;
+    }
+}

+ 20 - 0
MultipleMaids/MouseDrag5.cs

@@ -0,0 +1,20 @@
+using UnityEngine;
+
+public class MouseDrag5 : MonoBehaviour
+{
+    public int ido;
+    public bool isClick;
+    public Maid maid = null;
+    public int no;
+    public GameObject obj;
+
+    public void OnMouseDown()
+    {
+        if (!(maid != null))
+            return;
+        if (ido == 1)
+            isClick = true;
+        if (ido == 2)
+            isClick = true;
+    }
+}

+ 211 - 0
MultipleMaids/MouseDrag6.cs

@@ -0,0 +1,211 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+public class MouseDrag6 : MonoBehaviour
+{
+    public Vector3 angles;
+    public int count;
+    public bool del;
+    public int ido;
+    public bool isAlt;
+    public bool isClick;
+    public bool isIdo;
+    public bool isOn;
+    public bool isScale = false;
+    public bool isScale2 = false;
+    public bool isSelect;
+    public GameObject maid = null;
+    public GameObject[] maidArray = null;
+    public MouseDrag6[] mArray = null;
+    public GameObject obj;
+    public bool reset;
+    public Vector3 scale;
+    public Vector3 scale2;
+    private float doubleTapTime;
+    private int idoOld;
+    private Vector3 mouseIti;
+    private Vector3 mouseIti2;
+    private Vector3 off;
+    private Vector3 off2;
+    private Vector3 rotate;
+    private float size;
+    private Vector3 worldPoint;
+    private List<float> xList = new List<float>();
+    private List<float> yList = new List<float>();
+    private List<float> zList = new List<float>();
+
+    public void Update()
+    {
+        doubleTapTime += Time.deltaTime;
+    }
+
+    public void OnMouseDown()
+    {
+        if (!(maid != null))
+            return;
+        worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+        off = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+        off2 = new Vector3(obj.transform.position.x - maid.transform.position.x,
+                           obj.transform.position.y - maid.transform.position.y,
+                           obj.transform.position.z - maid.transform.position.z);
+        mouseIti = Input.mousePosition;
+        if (doubleTapTime < 0.300000011920929 && isClick && ido == idoOld)
+        {
+            if (ido == 5)
+                maid.transform.localScale = !isScale2 ? new Vector3(1f, 1f, 1f) : scale2;
+            if (ido == 4 || ido == 6)
+                maid.transform.eulerAngles = new Vector3(angles.x, maid.transform.eulerAngles.y, angles.z);
+        }
+
+        if (doubleTapTime >= 0.300000011920929 && isClick)
+            isClick = false;
+        doubleTapTime = 0.0f;
+        rotate = maid.transform.localEulerAngles;
+        size = maid.transform.localScale.x;
+        isSelect = true;
+        isOn = true;
+        if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
+            isAlt = !isAlt;
+        xList = new List<float>();
+        yList = new List<float>();
+        zList = new List<float>();
+        if (maidArray != null)
+            for (int index = 0; index < maidArray.Length; ++index)
+            {
+                xList.Add(maid.transform.position.x - maidArray[index].transform.position.x);
+                yList.Add(maid.transform.position.y - maidArray[index].transform.position.y);
+                zList.Add(maid.transform.position.z - maidArray[index].transform.position.z);
+            }
+    }
+
+    public void OnMouseUp()
+    {
+        if (!(maid != null))
+            return;
+        isOn = false;
+        if (doubleTapTime < 0.300000011920929)
+        {
+            isClick = true;
+            doubleTapTime = 0.0f;
+            idoOld = ido;
+        }
+
+        if (ido == 7)
+            del = true;
+    }
+
+    public void OnMouseDrag()
+    {
+        if (!(maid != null))
+            return;
+        if (reset)
+        {
+            reset = false;
+            worldPoint = Camera.main.WorldToScreenPoint(transform.position);
+            off = transform.position
+                  - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z));
+            off2 = new Vector3(obj.transform.position.x - maid.transform.position.x,
+                               obj.transform.position.y - maid.transform.position.y,
+                               obj.transform.position.z - maid.transform.position.z);
+            rotate = maid.transform.localEulerAngles;
+            size = maid.transform.localScale.x;
+            mouseIti = Input.mousePosition;
+        }
+
+        if (mouseIti != Input.mousePosition)
+        {
+            Vector3 vector3_1 = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, worldPoint.z))
+                                + off - off2;
+            isIdo = false;
+            if (ido == 1)
+            {
+                maid.transform.position = new Vector3(vector3_1.x, maid.transform.position.y, vector3_1.z);
+                if (maidArray != null)
+                    for (int index = 0; index < maidArray.Length; ++index)
+                        if (mArray[index].isAlt)
+                            maidArray[index].transform.position = new Vector3(vector3_1.x - xList[index],
+                                                                              maidArray[index].transform.position.y,
+                                                                              vector3_1.z - zList[index]);
+                isIdo = true;
+            }
+
+            if (ido == 2)
+            {
+                maid.transform.position = new Vector3(maid.transform.position.x, vector3_1.y, maid.transform.position.z);
+                if (maidArray != null)
+                    for (int index = 0; index < maidArray.Length; ++index)
+                        if (mArray[index].isAlt)
+                            maidArray[index].transform.position = new Vector3(maidArray[index].transform.position.x,
+                                                                              vector3_1.y - yList[index],
+                                                                              maidArray[index].transform.position.z);
+                isIdo = true;
+            }
+
+            Vector3 vector3_2;
+            if (ido == 3)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                maid.transform.eulerAngles =
+                        new Vector3(maid.transform.eulerAngles.x, rotate.y - vector3_2.x / 2.2f, maid.transform.eulerAngles.z);
+            }
+
+            Vector3 vector3_3;
+            if (ido == 4)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+                vector3_3 = transform.TransformDirection(Vector3.right);
+                Vector3 vector3_4 = transform.TransformDirection(Vector3.forward);
+                if (mouseIti2 != Input.mousePosition)
+                {
+                    maid.transform.localEulerAngles = rotate;
+                    maid.transform.RotateAround(maid.transform.position, new Vector3(vector3_3.x, 0.0f, vector3_3.z), vector3_2.y / 4f);
+                    maid.transform.RotateAround(maid.transform.position,
+                                                new Vector3(vector3_4.x, 0.0f, vector3_4.z),
+                                                (float)(-(double)vector3_2.x / 6.0));
+                }
+
+                isIdo = true;
+                mouseIti2 = Input.mousePosition;
+            }
+
+            if (ido == 6)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                Transform transform = GameMain.Instance.MainCamera.gameObject.transform;
+                vector3_3 = transform.TransformDirection(Vector3.right);
+                transform.TransformDirection(Vector3.forward);
+                if (mouseIti2 != Input.mousePosition)
+                {
+                    maid.transform.localEulerAngles = rotate;
+                    maid.transform.localRotation = Quaternion.Euler(maid.transform.localEulerAngles)
+                                                   * Quaternion.AngleAxis((float)(-(double)vector3_2.x / 2.20000004768372), Vector3.up);
+                }
+
+                isIdo = true;
+                mouseIti2 = Input.mousePosition;
+            }
+
+            if (ido == 5)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                float num = size + vector3_2.y / 200f;
+                if (num < 0.00999999977648258)
+                    num = 0.01f;
+                maid.transform.localScale =
+                        !isScale ? new Vector3(num, num, num) : new Vector3(scale.x * num, scale.y * num, scale.z * num);
+            }
+
+            if (ido == 15)
+            {
+                vector3_2 = Input.mousePosition - mouseIti;
+                float num = size + vector3_2.y / 2f;
+                if (num < 0.00999999977648258)
+                    num = 0.01f;
+                if (num > 150.0)
+                    num = 150f;
+                maid.transform.localScale = new Vector3(num, num, num);
+            }
+        }
+    }
+}

+ 100 - 0
MultipleMaids/MultipleMaids.csproj

@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{B5308AA1-CCC7-4EE2-B85D-A5BB3D0C8872}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AssemblyName>COM3D2.MultipleMaids.Plugin</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>3.5</OldToolsVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>0.0.0.0</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Assembly-CSharp">
+      <HintPath>lib\Assembly-CSharp.dll</HintPath>
+    </Reference>
+    <Reference Include="Assembly-CSharp-firstpass">
+      <HintPath>lib\Assembly-CSharp-firstpass.dll</HintPath>
+    </Reference>
+    <Reference Include="Assembly-UnityScript-firstpass">
+      <HintPath>lib\Assembly-UnityScript-firstpass.dll</HintPath>
+    </Reference>
+    <Reference Include="ExIni">
+      <HintPath>lib\ExIni.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="UnityEngine">
+      <HintPath>lib\UnityEngine.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityInjector">
+      <HintPath>lib\UnityInjector.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.Config.cs" />
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.Gui.cs" />
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.IK.cs" />
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.Init.cs" />
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.MaidUpdate.cs" />
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.Update.cs" />
+    <Compile Include="ComboBox2.cs" />
+    <Compile Include="MouseDrag.cs" />
+    <Compile Include="MouseDrag2.cs" />
+    <Compile Include="MouseDrag3.cs" />
+    <Compile Include="MouseDrag4.cs" />
+    <Compile Include="MouseDrag5.cs" />
+    <Compile Include="MouseDrag6.cs" />
+    <Compile Include="IK.cs" />
+    <Compile Include="ImportCM2.cs" />
+    <Compile Include="CM3D2\MultipleMaids\Plugin\MultipleMaids.cs" />
+    <Compile Include="AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 24 - 0
MultipleMaids/MultipleMaids.sln

@@ -0,0 +1,24 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27428.2043
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultipleMaids", "MultipleMaids.csproj", "{B5308AA1-CCC7-4EE2-B85D-A5BB3D0C8872}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B5308AA1-CCC7-4EE2-B85D-A5BB3D0C8872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B5308AA1-CCC7-4EE2-B85D-A5BB3D0C8872}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B5308AA1-CCC7-4EE2-B85D-A5BB3D0C8872}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B5308AA1-CCC7-4EE2-B85D-A5BB3D0C8872}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {1B87F947-025F-4B9F-9C7B-17C43A9E78B8}
+	EndGlobalSection
+EndGlobal

BIN
MultipleMaids/lib/Assembly-CSharp-firstpass.dll


BIN
MultipleMaids/lib/Assembly-CSharp.dll


BIN
MultipleMaids/lib/Assembly-UnityScript-firstpass.dll


BIN
MultipleMaids/lib/ExIni.dll


BIN
MultipleMaids/lib/UnityEngine.dll


BIN
MultipleMaids/lib/UnityInjector.dll


+ 18 - 0
README.md

@@ -0,0 +1,18 @@
+# OpenMM
+
+Make MultipleMaids great again.
+
+Decompiled version of 22.1 with some edits.
+
+## Edits done
+
+* Removed EXE filters
+* Split `MultipleMaids.cs` into partial classes for easier editing
+* Removed constructor and moved variable initialization into class body
+* Formatted code with CodeFormatter
+
+## Note
+
+The code is still messy and requires a lot of editing.
+
+Credits go to the original dev of MultipleMaids.