internal void OnTooltipEnabled(ShowTooltip showTooltip, bool enabled) { if (enabled) { tooltipGameObjects.Add(showTooltip.gameObject, showTooltip); } else { tooltipGameObjects.Remove(showTooltip.gameObject); } }
void LateUpdate() { CustomInputModule.RaycastMouse(_raycasts); var didFind = false; foreach (var r in _raycasts) { ShowTooltip showTooltip = null; if (tooltipGameObjects.TryGetValue(r.gameObject, out showTooltip)) { if (showTooltip != lastInfo) { lastInfo = showTooltip; dirty = true; } didFind = true; break; } } if (!didFind && lastInfo != null) { lastInfo = null; dirty = true; } if (!dirty) { return; } dirty = false; tooltip.SetActive(lastInfo != null); if (!lastInfo) { return; } text.text = text2.text = lastInfo.text; if (moveToObject) { var p = lastInfo.GetComponent <RectTransform>().position; p += transform.TransformPoint(offset); tooltip.transform.position = p; } }