private void UpdateLinkMetadata() { var link = _links.Get(_user.SelectedId); if (!link) { return; } var linkPos = link.GetComponentInChildren <LinkPosition>(); var userPos = linkPos.transform.InverseTransformPoint(_cam.position); var flowDirection = userPos.x >= 0 ? "ltr" : "rtl"; // left to right || right to left var side = "side"; var extra = ""; //if (Mathf.Abs(userPos.x) < 10 && Mathf.Abs(userPos.y) > 3) //{ // side = "top"; // var lookDirection = linkHitbox.transform.rotation * Camera.main.transform.forward; // if (lookDirection.z <= 0) // flowDirection = "rtl"; // else // flowDirection = "ltr"; // if (userPos.y < 0) // extra = "bottom"; //} _user.SelectedMetadata = $"{side}|{flowDirection}|{extra}"; }
public static ILink FromLink(this ISession session, string link) { IntPtr linkHandle; lock (Spotify.Mutex) { linkHandle = Spotify.sp_link_create_from_string(link); } return(LinkManager.Get(session, linkHandle, link)); }
public static ILink <ISearch> ToLink(this ISearch search) { var wrapper = search as INativeObject; if (wrapper == null) { return(null); } IntPtr linkPtr; lock (Spotify.Mutex) { linkPtr = Spotify.sp_link_create_from_search(wrapper.Handle); } return((ILink <ISearch>)LinkManager.Get(wrapper.Session, linkPtr, search.Query)); }
private void UpdateSelection() { if (_client.SelectedType == "plot") { var plot = _plots.Get(_client.SelectedId); _selection = plot?.Visualization; _lineRenderer.material.color = plot?.Color ?? Color.white; } else if (_client.SelectedType == "link") { _selection = _links.Get(_client.SelectedId)?.Visualization; _lineRenderer.material.color = Color.white; } else { _selection = null; } _lineRenderer.enabled = _selection != null; }
private static ILink <T> CreateLink <T>( Func <IntPtr> getInstanceHandle, ISession session, Func <IntPtr, IntPtr> create, TimeSpan?trackLinkOffset = null) { IntPtr handle = getInstanceHandle(); if (handle == IntPtr.Zero) { return(null); } IntPtr linkPtr; lock (Spotify.Mutex) { linkPtr = create(handle); } return((ILink <T>)LinkManager.Get(session, linkPtr, trackLinkOffset: trackLinkOffset)); }