ソースを参照

Make GUI draggable

denikson 6 年 前
コミット
6138b7f0e8

+ 36 - 43
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Gui.cs

@@ -13,6 +13,8 @@ namespace CM3D2.MultipleMaids.Plugin
 {
     public partial class MultipleMaids
     {
+        const int DRAG_BAR_HEIGHT = 5;
+
         public void OnGUI()
         {
             for (int index1 = 0; index1 < maidCnt; ++index1)
@@ -45,7 +47,7 @@ namespace CM3D2.MultipleMaids.Plugin
                 }
             }
 
-            GUIStyle style = "box";
+            GUIStyle style = GUI.skin.box;
             style.fontSize = GetPix(11);
             style.alignment = TextAnchor.UpperRight;
             if (bGui)
@@ -54,40 +56,17 @@ namespace CM3D2.MultipleMaids.Plugin
                 {
                     isGuiInit = false;
                     screenSize = new Vector2(Screen.width, Screen.height);
-                }
 
-                if (sceneLevel != 5 && sceneLevel != 14)
-                {
-                    if (kankyoFlg || kankyo2Flg)
-                    {
-                        rectWin.Set(0.0f, 0.0f, GetPix(210), Screen.height * 0.9f);
-                    }
-                    else
-                    {
-                        rectWin.Set(0.0f, 0.0f, GetPix(170), Screen.height * 0.9f);
-                    }
-                }
-                else if (kankyoFlg || kankyo2Flg)
-                {
-                    rectWin.Set(0.0f,
-                                0.0f,
-                                 GetPix(210),
-                                (float)(Screen.height * 0.899999976158142 * 0.850000023841858));
-                }
-                else
-                {
-                    rectWin.Set(0.0f,
-                                0.0f,
-                                 GetPix(170),
-                                (float)(Screen.height * 0.899999976158142 * 0.850000023841858));
+                    //rectWin.x = screenSize.x - rectWin.width;
+                    //rectWin.y = GetPix(65);
+                    //if (sceneLevel == 14)
+                    //    rectWin.x = screenSize.x - rectWin.width - GetPix(23);
                 }
 
-                rectWin.x = screenSize.x - rectWin.width;
-                rectWin.y = GetPix(65);
-                if (sceneLevel == 14)
-                {
-                    rectWin.x = screenSize.x - rectWin.width - GetPix(23);
-                }
+                rectWin.height = Screen.height * 0.9f;
+                rectWin.width = GetPix(kankyoFlg || kankyo2Flg ? 210 : 170);
+                if (sceneLevel == 5 || sceneLevel == 14)
+                    rectWin.height *= 0.85f;
 
                 comboBoxControl.height = rectWin.height;
                 faceCombo.height = rectWin.height;
@@ -113,11 +92,11 @@ namespace CM3D2.MultipleMaids.Plugin
                                                                                               - Input.mousePosition.y)));
                     }
 
-                    rectWin = GUI.Window(129, rectWin, new GUI.WindowFunction(GuiFunc), "", style);
+                    rectWin = GUI.Window(129, rectWin, MaidCallWindow, "", style);
                 }
                 else if (sceneFlg)
                 {
-                    rectWin = GUI.Window(129, rectWin, new GUI.WindowFunction(GuiFunc5), "", style);
+                    rectWin = GUI.Window(129, rectWin, GuiFunc5, "", style);
                     Rect rect = new Rect(0.0f, 0.0f, 0.0f, 0.0f);
                     dispNo = 0;
                     for (int index = 0; index < 10; ++index)
@@ -211,7 +190,7 @@ namespace CM3D2.MultipleMaids.Plugin
                         Input.ResetInputAxes();
                     }
 
-                    rectWin = GUI.Window(129, rectWin, new GUI.WindowFunction(GuiFunc6), "", style);
+                    rectWin = GUI.Window(129, rectWin, BGSelectWindow, "", style);
                 }
                 else if (kankyo2Flg)
                 {
@@ -229,7 +208,7 @@ namespace CM3D2.MultipleMaids.Plugin
                         Input.ResetInputAxes();
                     }
 
-                    rectWin = GUI.Window(129, rectWin, new GUI.WindowFunction(GuiFunc7), "", style);
+                    rectWin = GUI.Window(129, rectWin, BGSelectWindow2, "", style);
                 }
                 else if (poseFlg)
                 {
@@ -249,7 +228,7 @@ namespace CM3D2.MultipleMaids.Plugin
                         Input.ResetInputAxes();
                     }
 
-                    rectWin = GUI.Window(129, rectWin, new GUI.WindowFunction(GuiFunc4), "", style);
+                    rectWin = GUI.Window(129, rectWin, PoseWindow, "", style);
                 }
                 else
                 {
@@ -269,7 +248,7 @@ namespace CM3D2.MultipleMaids.Plugin
                         Input.ResetInputAxes();
                     }
 
-                    rectWin = GUI.Window(129, rectWin, new GUI.WindowFunction(GuiFunc2), "", style);
+                    rectWin = GUI.Window(129, rectWin, FaceWindow, "", style);
                 }
             }
 
@@ -287,6 +266,8 @@ namespace CM3D2.MultipleMaids.Plugin
 
         private void GuiFunc5(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             GUIStyle style1 = "label";
             style1.fontSize = GetPix(12);
             style1.alignment = TextAnchor.UpperLeft;
@@ -498,8 +479,10 @@ namespace CM3D2.MultipleMaids.Plugin
             }
         }
 
-        private void GuiFunc7(int winID)
+        private void BGSelectWindow2(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             GUIStyle guiStyle1 = "label";
             guiStyle1.fontSize = GetPix(12);
             guiStyle1.alignment = TextAnchor.UpperLeft;
@@ -1196,8 +1179,10 @@ namespace CM3D2.MultipleMaids.Plugin
             sortList = sortItemList;
         }
 
-        private void GuiFunc6(int winID)
+        private void BGSelectWindow(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             GUIStyle guistyle = "label";
             guistyle.fontSize = GetPix(12);
             guistyle.alignment = TextAnchor.UpperLeft;
@@ -3338,8 +3323,10 @@ namespace CM3D2.MultipleMaids.Plugin
         }
 
 
-        private void GuiFunc4(int winID)
+        private void PoseWindow(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             GUIStyle style1 = "label";
             style1.fontSize = GetPix(12);
             style1.alignment = TextAnchor.UpperLeft;
@@ -6037,8 +6024,10 @@ namespace CM3D2.MultipleMaids.Plugin
             }
         }
 
-        private void GuiFunc2(int winID)
+        private void FaceWindow(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             GUIStyle style1 = "label";
             style1.fontSize = GetPix(12);
             style1.alignment = TextAnchor.UpperLeft;
@@ -7668,8 +7657,10 @@ namespace CM3D2.MultipleMaids.Plugin
             yotogiFlg = true;
         }
 
-        private void GuiFunc(int winID)
+        private void MaidCallWindow(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
             GUIStyle style1 = "label";
             style1.fontSize = GetPix(14);
@@ -9097,6 +9088,8 @@ namespace CM3D2.MultipleMaids.Plugin
 
         private void GuiFunc3(int winID)
         {
+            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
             GUIStyle style1 = "label";
             style1.fontSize = GetPix(12);
             style1.alignment = TextAnchor.UpperLeft;

+ 2 - 0
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Init.cs

@@ -1686,6 +1686,8 @@ namespace CM3D2.MultipleMaids.Plugin
             }
 
             itemBArray = stringList14.ToArray();
+
+            //rectWin.y = GetPix(65);
         }
     }
 }

+ 0 - 3
MultipleMaids/ImportCM2.cs

@@ -274,10 +274,8 @@ public class ImportCM2 : MonoBehaviour
         string str5;
         Color color;
         Vector4 vector4;
-        bool flag;
         while (true)
         {
-            flag = true;
             string str6 = r.ReadString();
             if (!(str6 == "end"))
             {
@@ -401,7 +399,6 @@ public class ImportCM2 : MonoBehaviour
 
             while (true)
             {
-                flag = true;
                 string str9 = r.ReadString();
                 if (!(str9 == "end"))
                 {

+ 0 - 4
MultipleMaids/MouseDrag.cs

@@ -207,8 +207,6 @@ public class MouseDrag : MonoBehaviour
                 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;
@@ -217,8 +215,6 @@ public class MouseDrag : MonoBehaviour
                 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);
             }