فهرست منبع

Change GUI logic and fix message window dragging

habeebweeb 4 سال پیش
والد
کامیت
1c04534417

+ 31 - 29
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Gui.cs

@@ -51,19 +51,38 @@ namespace CM3D2.MultipleMaids.Plugin
             style.fontSize = GetPix(11);
             style.alignment = TextAnchor.UpperRight;
 
-            if (bGui)
+            if (isGuiInit)
             {
-                if (isGuiInit || screenSize != new Vector2(Screen.width, Screen.height))
-                {
-                    isGuiInit = false;
-                    screenSize = new Vector2(Screen.width, Screen.height);
+                isGuiInit = false;
 
-                    //rectWin.x = screenSize.x - rectWin.width;
-                    rectWin.y = GetPix(65);
-                    //if (sceneLevel == 14)
-                    //    rectWin.x = screenSize.x - rectWin.width - GetPix(23);
-                }
+                rectWin2.width = Screen.width * 0.4f;
+                rectWin2.height = Screen.height * 0.15f;
+
+                rectWin2.x = (float)(Screen.width / 2.0 - rectWin2.width / 2.0);
+                rectWin2.y = sceneLevel != 5
+                    ? Screen.width - rectWin2.height
+                    : Screen.height * 0.94f - rectWin2.height;
+
+                rectWin.width = GetPix(kankyoFlg || kankyo2Flg ? 210 : 170);
+                rectWin.height = Screen.height * 0.9f;
+
+                rectWin.x = Screen.width - rectWin.width;
+                rectWin.y = GetPix(65);
+            }
+
+            if (bGuiMessage)
+            {
+                rectWin2.width = Screen.width * 0.4f;
+                rectWin2.height = Screen.height * 0.15f;
+
+                rectWin2.x = Mathf.Clamp(rectWin2.x, 0, Screen.width - rectWin2.width);
+                rectWin2.y = Mathf.Clamp(rectWin2.y, 0, Screen.height - rectWin2.height);
 
+                rectWin2 = GUI.Window(130, rectWin2, MessageWindow, "", style);
+            }
+
+            if (bGui)
+            {
                 rectWin.x = Mathf.Clamp(rectWin.x, 0, Screen.width - rectWin.width);
                 rectWin.y = Mathf.Clamp(rectWin.y, 0, Screen.height - DRAG_BAR_HEIGHT);
 
@@ -270,17 +289,6 @@ namespace CM3D2.MultipleMaids.Plugin
                     rectWin = GUI.Window(129, rectWin, FaceWindow, "", style);
                 }
             }
-
-            if (!bGuiMessage)
-            {
-                return;
-            }
-
-            screenSize = new Vector2(Screen.width, Screen.height);
-            rectWin2.Set(0.0f, 0.0f, Screen.width * 0.4f, Screen.height * 0.15f);
-            rectWin2.x = (float)(screenSize.x / 2.0 - rectWin2.width / 2.0);
-            rectWin2.y = sceneLevel != 5 ? screenSize.y - rectWin2.height : screenSize.y * 0.94f - rectWin2.height;
-            rectWin2 = GUI.Window(129, rectWin2, MessageWindow, "", style);
         }
 
         private void SaveSceneWindow(int winID)
@@ -306,7 +314,6 @@ namespace CM3D2.MultipleMaids.Plugin
                 kankyoFlg = true;
                 kankyo2Flg = false;
                 bGui = true;
-                // isGuiInit = true;
                 copyIndex = 0;
             }
 
@@ -599,7 +606,6 @@ namespace CM3D2.MultipleMaids.Plugin
                         kankyoFlg = false;
                         kankyo2Flg = false;
                         bGui = true;
-                        // isGuiInit = true;
                     }
                 }
 
@@ -1344,7 +1350,6 @@ namespace CM3D2.MultipleMaids.Plugin
                         kankyoFlg = false;
                         kankyo2Flg = false;
                         bGui = true;
-                        // isGuiInit = true;
                     }
                 }
 
@@ -3805,7 +3810,6 @@ namespace CM3D2.MultipleMaids.Plugin
                         kankyoFlg = false;
                         kankyo2Flg = false;
                         bGui = true;
-                        // isGuiInit = true;
                     }
                 }
 
@@ -6129,7 +6133,6 @@ namespace CM3D2.MultipleMaids.Plugin
                         kankyoFlg = false;
                         kankyo2Flg = false;
                         bGui = true;
-                        // isGuiInit = true;
                     }
                 }
 
@@ -7729,7 +7732,6 @@ namespace CM3D2.MultipleMaids.Plugin
                 kankyoFlg = false;
                 kankyo2Flg = false;
                 bGui = true;
-                // isGuiInit = true;
             }
 
             if (!yotogiFlg && GUI.Toggle(new Rect(GetPix(41),
@@ -9107,8 +9109,8 @@ namespace CM3D2.MultipleMaids.Plugin
 
         private void MessageWindow(int winID)
         {
-            GUI.DragWindow(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT));
-            GUI.Box(new Rect(0, 0, rectWin.width, DRAG_BAR_HEIGHT), "");
+            GUI.DragWindow(new Rect(0, 0, rectWin2.width, DRAG_BAR_HEIGHT));
+            GUI.Box(new Rect(0, 0, rectWin2.width, DRAG_BAR_HEIGHT), "");
             GUIStyle style1 = "label";
             style1.fontSize = GetPix(12);
             style1.alignment = TextAnchor.UpperLeft;

+ 2 - 2
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.MaidUpdate.cs

@@ -3087,7 +3087,7 @@ namespace CM3D2.MultipleMaids.Plugin
                                                 mHead2[i].isClick = false;
                                                 bGui = true;
                                                 isFaceInit = true;
-                                                isGuiInit = true;
+                                                // isGuiInit = true;
                                                 faceFlg = true;
                                                 poseFlg = false;
                                                 sceneFlg = false;
@@ -3103,7 +3103,7 @@ namespace CM3D2.MultipleMaids.Plugin
                                                 mMaid2[i].isClick = false;
                                                 bGui = true;
                                                 isPoseInit = true;
-                                                isGuiInit = true;
+                                                // isGuiInit = true;
                                                 poseFlg = true;
                                                 faceFlg = false;
                                                 sceneFlg = false;

+ 1 - 1
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Update.cs

@@ -8468,4 +8468,4 @@ namespace CM3D2.MultipleMaids.Plugin
             }
         }
     }
-}
+}