public static bool MouseIsOverWindow(MechJebCore core) { //try to check if the mouse is over any active DisplayModule foreach (DisplayModule m in core.GetComputerModules <DisplayModule>()) { if (m.enabled && m.showInCurrentScene && !m.IsOverlay && m.windowPos.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y) / GuiUtils.scale)) { return(true); } } return(false); }
public static bool MouseIsOverWindow(MechJebCore core) { //try to check if the mouse is over any active DisplayModule foreach (DisplayModule m in core.GetComputerModules<DisplayModule>()) { if (m.enabled && m.showInCurrentScene && m.windowPos.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { return true; } } return false; }
void HandleLights() { if (greenLight == null || redLight == null) { InitializeLights(); } if (core == null || MapView.MapIsEnabled) { litLight = LightColor.NEITHER; } else { bool somethingEnabled = false; if (vessel.GetMasterMechJeb() == core) { foreach (DisplayModule display in core.GetComputerModules <DisplayModule>()) { if (display is MechJebModuleMenu) { continue; } if (display.enabled && display.showInCurrentScene) { somethingEnabled = true; } } } litLight = (somethingEnabled ? LightColor.GREEN : LightColor.RED); } switch (litLight) { case LightColor.GREEN: if (!greenLight.enabled) { TurnOnLight(LightColor.GREEN); } if (redLight.enabled) { TurnOffLight(LightColor.RED); } break; case LightColor.RED: if (greenLight.enabled) { TurnOffLight(LightColor.GREEN); } if (!redLight.enabled) { TurnOnLight(LightColor.RED); } break; case LightColor.NEITHER: if (greenLight.enabled) { TurnOffLight(LightColor.GREEN); } if (redLight.enabled) { TurnOffLight(LightColor.RED); } break; } }