protected virtual void SpawnToolTip(TooltipTypes type, object _obj) { bool make_generic = false; string generic_text = ""; ToolTipInstance = Instantiate(ToolTipFactory.GetPrefab(type, _obj, out make_generic, out generic_text)).GetComponent <UI_ToolTip_Base>(); if (make_generic) { _obj = new GenericToolTipTarget(string.IsNullOrEmpty(generic_text) ? DisplayText : generic_text); } InitializeToolTip(_obj); }
protected virtual void InitializeToolTip(object _obj) { ToolTipInstance.GetComponent <UI_ToolTip_Base>().SetItem(_obj); UI_ToolTip_Base parent = gameObject.GetComponent <UI_ToolTip_Base>(); if (parent == null) { parent = gameObject.GetComponentInParent <UI_ToolTip_Base>(); } if (parent != null) { parent.RegisterChild(ToolTipInstance.GetComponent <UI_ToolTip_Base>()); } ToolTipInstance.transform.SetParent(GameObject.FindWithTag("UI_Overlay").transform, true); ToolTipInstance.GetComponent <RectTransform>().position = ToolTipAnchor.position; }
public void RegisterChild(UI_ToolTip_Base ch) { child = ch; child.OnHide += ChildHidden; }