public void OnPointerClick(PointerEventData eventData) { Vector2 localPoint; RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, out localPoint); int hrefEntryCount = m_HrefEntrys.Count; for (int i = 0; i < hrefEntryCount; i++) { var hrefEntry = m_HrefEntrys[i]; var hrefRects = hrefEntry.rects; int hrefRectCount = hrefRects.Count; for (int ii = 0; ii < hrefRectCount; ii++) { if (hrefRects[ii].Contains(localPoint)) { m_OnHrefClick.Invoke(hrefEntry.name); return; } } } }
public void OnPointerClick(PointerEventData eventData) { RectTransformUtility.ScreenPointToLocalPointInRectangle(base.rectTransform, eventData.position, eventData.pressEventCamera, out var localPoint); foreach (HrefInfo hrefInfo in m_HrefInfos) { List <Rect> boxes = hrefInfo.boxes; for (int i = 0; i < boxes.Count; i++) { if (boxes[i].Contains(localPoint)) { m_OnHrefClick.Invoke(hrefInfo.name); return; } } } }
/// <summary> /// Click event is detected whether to click a hyperlink text /// </summary> /// <param name="eventData"></param> public void OnPointerClick(PointerEventData eventData) { RectTransformUtility.ScreenPointToLocalPointInRectangle( rectTransform, eventData.position, eventData.pressEventCamera, out lp); for (int h = 0; h < m_HrefInfos.Count; h++) { for (int i = 0; i < m_HrefInfos[h].boxes.Count; ++i) { if (m_HrefInfos[h].boxes[i].Contains(lp)) { m_OnHrefClick.Invoke(m_HrefInfos[h].name); return; } } } }
/// <summary> /// 点击事件检测是否点击到超链接文本 /// </summary> public void OnPointerClick(PointerEventData eventData) { Vector2 lp; RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, out lp); foreach (var hrefInfo in mHrefInfos) { var boxes = hrefInfo.boxes; for (var i = 0; i < boxes.Count; ++i) { if (boxes[i].Contains(lp)) { OnHrefClick.Invoke(hrefInfo.param); return; } } } }
public void OnPointerClick(PointerEventData eventData) { Vector2 pos; RectTransformUtility.ScreenPointToLocalPointInRectangle( rectTransform, eventData.position, eventData.pressEventCamera, out pos); foreach (var item in hyperDataList) { var boxes = item.Boxes; for (int i = 0; i < boxes.Count; i++) { if (boxes[i].Contains(pos)) { OnHrefClick.Invoke(new object[] { item.HyperType, item.HyperContent, item.Value }); return; } } } }
//响应点击事件-->检测是否在超链接的范围内 public void OnPointerClick(PointerEventData eventData) { Vector2 lp; RectTransformUtility.ScreenPointToLocalPointInRectangle( rectTransform, eventData.position, eventData.pressEventCamera, out lp); foreach (var hrefInfo in _listHrefInfos) { var boxes = hrefInfo.Boxes; for (var i = 0; i < boxes.Count; ++i) { if (boxes[i].Contains(lp)) { OnHrefClick.Invoke(hrefInfo.HrefValue, hrefInfo.Id); Debug.Log("click " + hrefInfo.Id + " " + hrefInfo.HrefValue); return; } } } }
public void OnPointerClick(PointerEventData eventData) { Vector2 lp; RectTransformUtility.ScreenPointToLocalPointInRectangle( rectTransform, eventData.position, eventData.pressEventCamera, out lp); var v_hrefInfo = GetHrefInsidePosition(lp); if (v_hrefInfo != null) { Debug.Log("HrefInfoClicked: " + v_hrefInfo.name); SpecialHrefEvent v_specialHrefSelected = null; foreach (var v_specialHref in SpecialHrefClickEvents) { if (v_specialHref.hrefName == v_hrefInfo.name) { v_specialHrefSelected = v_specialHref; break; } } if (v_specialHrefSelected != null) { if (v_specialHrefSelected.OnHrefClicked != null) { v_specialHrefSelected.OnHrefClicked.Invoke(v_specialHrefSelected.hrefName); } } else { if (OnHrefClick != null) { OnHrefClick.Invoke(v_hrefInfo.name); } } } }