public void RemoveFeedbackRequest(ProxyFeedbackRequest request) { foreach (var affordance in m_Affordances) { if (affordance.control != request.control) { continue; } foreach (var renderer in affordance.renderers) { m_AffordanceData[renderer].SetVisibility(false, request.duration, request.control); this.SetHighlight(renderer.gameObject, false); if (!string.IsNullOrEmpty(request.tooltipText)) { foreach (var tooltip in affordance.tooltips) { if (tooltip) { tooltip.tooltipText = string.Empty; this.HideTooltip(tooltip, true); } } } } } foreach (var feedbackRequest in m_FeedbackRequests) { if (feedbackRequest == request) { m_FeedbackRequests.Remove(feedbackRequest); if (!request.showBody) { ExecuteFeedback(request); } break; } } }
public void UpdateValues(ProxyFeedbackRequest request) { m_Control = request.control; m_TooltipText = request.tooltipText; }
void ExecuteFeedback(ProxyFeedbackRequest changedRequest) { if (!isActiveAndEnabled) { return; } if (changedRequest.showBody) { foreach (var tuple in m_BodyData) { tuple.Item2.SetVisibility(true, changedRequest.duration); } return; } ProxyFeedbackRequest request = null; foreach (var feedbackRequest in m_FeedbackRequests) { if (feedbackRequest.control != changedRequest.control || feedbackRequest.showBody != changedRequest.showBody) { continue; } if (request == null || feedbackRequest.priority >= request.priority) { request = feedbackRequest; } } if (request == null) { return; } var requestKey = GetRequestKey(); requestKey.UpdateValues(request); RequestData data; if (!m_RequestData.TryGetValue(requestKey, out data)) { data = new RequestData(); m_RequestData[requestKey] = data; } else { m_RequestKeyPool.Enqueue(requestKey); } var suppress = data.presentations > request.maxPresentations - 1; var suppressPresentation = request.suppressPresentation; if (suppressPresentation != null) { suppress = suppressPresentation(); } if (suppress) { return; } foreach (var affordance in m_Affordances) { if (affordance.control != request.control) { continue; } foreach (var renderer in affordance.renderers) { m_AffordanceData[renderer].SetVisibility(!request.suppressExisting, request.duration, changedRequest.control); this.SetHighlight(renderer.gameObject, !request.suppressExisting); var tooltipText = request.tooltipText; if (!string.IsNullOrEmpty(tooltipText) || request.suppressExisting) { foreach (var tooltip in affordance.tooltips) { if (tooltip) { data.visibleThisPresentation = false; tooltip.tooltipText = tooltipText; this.ShowTooltip(tooltip, true, placement: tooltip.GetPlacement(m_FacingDirection), becameVisible: data.onBecameVisible); } } } } } }
public void AddFeedbackRequest(ProxyFeedbackRequest request) { m_FeedbackRequests.Add(request); ExecuteFeedback(request); }