public void MouseLeaves(MCToolTipOwner owner) { // Stop updating our position. if (_updatePosition != null) { StopCoroutine(_updatePosition); _updatePosition = null; } // 'Unregister' us. Destroy(owner); // Hide the tooltip. Hide(); }
public override void Show(object data) { if (data == null) { throw new Exception("Trying to start a simple popup with a data that is equal to null!"); } MCSimpleTooltipData simplePopupData = data as MCSimpleTooltipData; if (simplePopupData == null) { throw new Exception("Trying to show a simple tooltip, but using the wrong data type: " + data.GetType()); } DisableIfNoTitle.SetActive(!string.IsNullOrEmpty(simplePopupData.Title)); TitleText.text = simplePopupData.Title; DisableIfNoDescription.SetActive(!string.IsNullOrEmpty(simplePopupData.Description)); DescriptionText.text = simplePopupData.Description; if (simplePopupData.HasCustomPosition) { RectTransform rectTransform = this.GetComponent <RectTransform>(); if (!rectTransform) { throw new Exception("No RectTransform could be found on this tooltip!"); } if (_updatePosition == null) { _updatePosition = StartCoroutine(UpdatePosition(rectTransform)); } if (simplePopupData.AutoRemove) { // 'Register' us to the target component, by adding a component to the object. _toolTipOwner = simplePopupData.ToolTipOwner.gameObject.AddComponent <MCToolTipOwner>(); _toolTipOwner.InsideListener = this; _toolTipOwner.Inside = true; } } base.Show(data); }