public void OnGUI()
{
if (!styleSetup)
{
styleSetup = true;
Styles.InitStyles ();
}
EditorLogic editor = EditorLogic.fetch;
if (!HighLogic.LoadedSceneIsEditor || !editor) {
return;
}
//UpdateMixtures ();
bool cursorInGUI = false; // nicked the locking code from Ferram
mousePos = Input.mousePosition; //Mouse location; based on Kerbal Engineer Redux code
mousePos.y = Screen.height - mousePos.y;
Rect tooltipRect;
int posMult = 0;
if (offsetGUIPos != -1) {
posMult = offsetGUIPos;
}
if (ActionGroupMode) {
if (guiWindowRect.width == 0) {
guiWindowRect = new Rect (430 * posMult, 365, 438, (Screen.height - 365));
}
tooltipRect = new Rect (guiWindowRect.xMin + 440, mousePos.y-5, 300, 20);
} else {
if (guiWindowRect.width == 0) {
guiWindowRect = new Rect (Screen.width - 8 - 430 * (posMult+1), 365, 438, (Screen.height - 365));
}
tooltipRect = new Rect (guiWindowRect.xMin - (230-8), mousePos.y - 5, 220, 20);
}
cursorInGUI = guiWindowRect.Contains (mousePos);
if (cursorInGUI) {
editor.Lock (false, false, false, "MFTGUILock");
if (KSP.UI.Screens.Editor.PartListTooltipMasterController.Instance != null)
KSP.UI.Screens.Editor.PartListTooltipMasterController.Instance.HideTooltip ();
} else {
editor.Unlock ("MFTGUILock");
}
myToolTip = myToolTip.Trim ();
if (!String.IsNullOrEmpty(myToolTip))
GUI.Label(tooltipRect, myToolTip, Styles.styleEditorTooltip);
guiWindowRect = GUILayout.Window (GetInstanceID (), guiWindowRect, GUIWindow, "Fuel Tanks for " + tank_module.part.partInfo.title, Styles.styleEditorPanel);
}