Ejemplo n.º 1
0
 public void GUIDropDownDisplay(params GUILayoutOption[] GUIoptions)
 {
     if (GUILayout.Button(optionStrings[selectedOption], GUIoptions))
     {
         listActive = true;
     }
     if (listStyle == null)
     {
         listStyle         = new GUIStyle(GUI.skin.window);
         listStyle.padding = new RectOffset(1, 1, 1, 1);
     }
     if (buttonStyle == null)
     {
         buttonStyle         = new GUIStyle(GUI.skin.button);
         buttonStyle.padding = new RectOffset(0, 0, 0, 0);
     }
     if (listActive && !hasActivated)
     {
         Vector3 upperLeft = FARGUIUtils.GetMousePos();
         displayObject.ActivateDisplay(this.GetHashCode(), new Rect(upperLeft.x - 5, upperLeft.y - 5, 100, 150), ListDisplay, listStyle);
         hasActivated = true;
         InputLockManager.SetControlLock(ControlTypes.All, "DropdownScrollLock");
     }
     if (hasActivated)
     {
         if (!displayObject.displayRect.Contains(FARGUIUtils.GetMousePos()))
         {
             listActive   = false;
             hasActivated = false;
             displayObject.DisableDisplay();
             InputLockManager.RemoveControlLock("DropdownScrollLock");
         }
     }
 }
 public void OnGUI()
 {
     GUI.skin = HighLogic.Skin;
     if (debugMenu)
     {
         debugWinPos = GUILayout.Window("FARDebug".GetHashCode(), debugWinPos, debugWindow, "FAR Debug Options, v0.14.6", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
         if (!inputLocked && debugWinPos.Contains(FARGUIUtils.GetMousePos()))
         {
             InputLockManager.SetControlLock(ControlTypes.KSC_ALL, "FARDebugLock");
             inputLocked = true;
         }
         else if (inputLocked && !debugWinPos.Contains(FARGUIUtils.GetMousePos()))
         {
             InputLockManager.RemoveControlLock("FARDebugLock");
             inputLocked = false;
         }
     }
     else if (inputLocked)
     {
         InputLockManager.RemoveControlLock("FARDebugLock");
         inputLocked = false;
     }
 }