本文整理汇总了C#中UnityEngine.Rect.ContainsMouse方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.ContainsMouse方法的具体用法?C# Rect.ContainsMouse怎么用?C# Rect.ContainsMouse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Rect
的用法示例。
在下文中一共展示了Rect.ContainsMouse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
public void OnGUI()
{
if (Event.current.type == EventType.Repaint && MapView.MapIsEnabled)
{
foreach (ISatellite s in RTCore.Instance.Satellites.FindCommandStations().Concat(RTCore.Instance.Network.GroundStations.Values))
{
bool showOnMapview = true;
var worldPos = ScaledSpace.LocalToScaledSpace(s.Position);
if (MapView.MapCamera.transform.InverseTransformPoint(worldPos).z < 0f) continue;
Vector3 pos = PlanetariumCamera.Camera.WorldToScreenPoint(worldPos);
var screenRect = new Rect((pos.x - 8), (Screen.height - pos.y) - 8, 16, 16);
// Hide the current ISatellite if it is behind its body
if (RTSettings.Instance.HideGroundStationsBehindBody && IsOccluded(s.Position, s.Body))
showOnMapview = false;
if (RTSettings.Instance.HideGroundStationsOnDistance && !IsOccluded(s.Position, s.Body) && this.IsCamDistanceToWide(s.Position))
showOnMapview = false;
// orbiting remote stations are always shown
if(s.isVessel && !s.parentVessel.Landed)
showOnMapview = true;
if (showOnMapview)
{
Color pushColor = GUI.color;
// tint the white mark.png into the defined color
GUI.color = s.MarkColor;
// draw the mark.png
GUI.DrawTexture(screenRect, mTexMark, ScaleMode.ScaleToFit, true);
GUI.color = pushColor;
// Show Mouse over informations to the ground station
if (RTSettings.Instance.ShowMouseOverInfoGroundStations && s is MissionControlSatellite && screenRect.ContainsMouse())
{
Rect headline = screenRect;
Vector2 nameDim = this.smallStationHead.CalcSize(new GUIContent(s.Name));
headline.x -= nameDim.x + 10;
headline.y -= 3;
headline.width = nameDim.x;
headline.height = 14;
// draw headline of the station
GUI.Label(headline, s.Name, this.smallStationHead);
// loop antennas
String antennaRanges = String.Empty;
foreach (var antenna in s.Antennas)
{
if(antenna.Omni > 0)
{
antennaRanges += "Omni: "+ RTUtil.FormatSI(antenna.Omni,"m") + Environment.NewLine;
}
if (antenna.Dish > 0)
{
antennaRanges += "Dish: " + RTUtil.FormatSI(antenna.Dish, "m") + Environment.NewLine;
}
}
if(!antennaRanges.Equals(String.Empty))
{
Rect antennas = screenRect;
GUIContent content = new GUIContent(antennaRanges);
Vector2 antennaDim = this.smallStationText.CalcSize(content);
float maxHeight = this.smallStationText.CalcHeight(content, antennaDim.x);
antennas.y += headline.height - 3;
antennas.x -= antennaDim.x + 10;
antennas.width = antennaDim.x;
antennas.height = maxHeight;
// draw antenna infos of the station
GUI.Label(antennas, antennaRanges, this.smallStationText);
}
}
}
}
}
}