コード例 #1
0
        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}";
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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));
        }