void OnGUI() { if (cursorShow && (!KISAddonPointer.isRunning || !Input.GetKey(KISAddonConfig.hideHintKey))) { _mousePosition = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); using (new GuiMatrixScope()) { _guiMainScale.UpdateMatrix(); GUI.DrawTexture( new Rect( _mousePosition.x - ActionIconSize / 2, _mousePosition.y - ActionIconSize / 2, ActionIconSize, ActionIconSize), cursorTexture, ScaleMode.ScaleToFit); } if (KISAddonConfig.showHintText) { // Compile the whole hint text. var allLines = new List <String> { cursorText }; if (cursorAdditionalTexts != null && cursorAdditionalTexts.Any()) { allLines.Add(""); // A linefeed between status and hint text. allLines.AddRange(cursorAdditionalTexts); } var hintText = String.Join("\n", allLines.ToArray()); hintOverlay.text = hintText; hintOverlay.ShowAtCursor(); } } }
void OnGUI() { if (cursorShow && (!KISAddonPointer.isRunning || !Input.GetKey(KISAddonConfig.hideHintKey))) { var mousePosition = Input.mousePosition; mousePosition.y = Screen.height - mousePosition.y; // Display action icon. GUI.DrawTexture( new Rect(mousePosition.x - ActionIconSize / 2, mousePosition.y - ActionIconSize / 2, ActionIconSize, ActionIconSize), cursorTexture, ScaleMode.ScaleToFit); if (KISAddonConfig.showHintText) { // Compile the whole hint text. var allLines = new List <String> { cursorText }; if (cursorAdditionalTexts != null && cursorAdditionalTexts.Any()) { allLines.Add(""); // A linefeed between status and hint text. allLines.AddRange(cursorAdditionalTexts); } var hintText = String.Join("\n", allLines.ToArray()); hintOverlay.text = hintText; hintOverlay.ShowAtCursor(); } } }
/// <summary>Displays info and hint when in camera focus mode.</summary> /// <remarks>It's called every frame so, don't put heavy code here.</remarks> void ShowHoveredPartInfo() { var sb = new List <string>(); var camera = FlightCamera.fetch; var trgPart = Mouse.HoveredPart; if (trgPart != null) { if (camera.Target == trgPart.transform) { sb.Add(CurrentPartInFocusStatusMsg); sb.Add(AnotherPartFocusHintMsg); } else { sb.Add(SetFocusToCurrentPartHintMsg.Format( MouseButtonLookup.Lookup(switchMouseButton))); } if (camera.targetMode == FlightCamera.TargetMode.Part) { sb.Add(ResetFocusHintMsg); } if (trgPart.vessel != FlightGlobals.ActiveVessel) { sb.Add(""); sb.Add(NotCurrentVesselPartStatusMsg); } } else { if (camera.targetMode == FlightCamera.TargetMode.Part) { sb.Add(ResetFocusToCurrentVesselHintMsg.Format( MouseButtonLookup.Lookup(switchMouseButton))); } else { sb.Add(SomePartFocusHintMsg); } } _mouseInfoOverlay.text = string.Join("\n", sb.ToArray()); _mouseInfoOverlay.ShowAtCursor(); }