/*--------------------------------------------------------------------------------------------*/
        public void UpdateAfterInput()
        {
            UpdateActiveDelegates();

            foreach (CursorState cursor in vCursorStates)
            {
                CursorType type         = cursor.Type;
                float      maxDispStren = 0;

                cursor.ClearInteractions();

                foreach (IHovercursorDelegate del in vActiveDelegates)
                {
                    if (!CursorTypeUtil.Contains(del.ActiveCursorTypes, type))
                    {
                        continue;
                    }

                    maxDispStren = Math.Max(maxDispStren, del.CursorDisplayStrength);
                    cursor.AddInteractions(del.GetActiveCursorInteractions(type));
                }

                cursor.UpdateAfterInput(maxDispStren);
            }
        }
Пример #2
0
        /*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            vState.UpdateAfterInput();

            for (int i = 0; i < vState.Panels.Count; i++)
            {
                IItemPanel itemPanel = vState.Panels[i].ItemPanel;
                ((GameObject)itemPanel.DisplayContainer).SetActive(itemPanel.IsVisible);
            }

            ////

            InteractionSettings interSett = InteractionSettings.GetSettings();

            if (interSett.ApplyScaleMultiplier)
            {
                Vector3 worldUp = transform.TransformVector(Vector3.up);
                interSett.ScaleMultiplier = 1 / worldUp.magnitude;
            }
            else
            {
                interSett.ScaleMultiplier = 1;
            }

            ////

            IList <CursorType>        activeCursorTypes = interSett.Cursors;
            IProjectionVisualSettings projSett          = ProjectionVisualSettings.GetSettings();

            CursorTypeUtil.Exclude(vPrevActiveCursorTypes, activeCursorTypes, vHideCursorTypes);
            CursorTypeUtil.Exclude(activeCursorTypes, vPrevActiveCursorTypes, vShowCursorTypes);

            foreach (CursorType cursorType in vHideCursorTypes)
            {
                vProjMap[cursorType].gameObject.SetActive(false);
                vState.ActivateProjection(cursorType, false);
            }

            foreach (CursorType cursorType in vShowCursorTypes)
            {
                if (vProjMap.ContainsKey(cursorType))
                {
                    vProjMap[cursorType].gameObject.SetActive(true);
                    vState.ActivateProjection(cursorType, true);
                    continue;
                }

                var projObj = new GameObject("Proj-" + cursorType);
                projObj.transform.SetParent(gameObject.transform, false);
                UiProjection uiProj = projObj.AddComponent <UiProjection>();
                uiProj.Build(vState.GetProjection(cursorType), projSett);

                vProjMap.Add(cursorType, uiProj);
            }

            vPrevActiveCursorTypes.Clear();
            vPrevActiveCursorTypes.AddRange(activeCursorTypes);
        }
        /*--------------------------------------------------------------------------------------------*/
        public override IInputCursor GetCursor(CursorType pType)
        {
            if (pType == CursorType.Look)
            {
                throw new Exception("The " + typeof(HovercursorLeapInput) + " component does not support " +
                                    "the use of " + typeof(CursorType) + "." + pType + ".");
            }

            if (!vCursorMap.ContainsKey(pType))
            {
                vCursorMap.Add(pType, new InputCursor(pType));
                vSideMap.Add(pType, CursorTypeUtil.IsLeft(pType));
            }

            return(vCursorMap[pType]);
        }
Пример #4
0
        /*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            if (vState == null || Input.IsFailure)
            {
                return;
            }

            vState.UpdateBeforeInput();
            Input.UpdateInput();
            vState.UpdateAfterInput();

            ReadOnlyCollection <CursorType> activeTypes = vState.ActiveCursorTypes;
            ICursorSettings visualSett = DefaultVisualSettings.GetSettings();
            Transform       cameraTx   = CenterCamera.gameObject.transform;

            CursorTypeUtil.Exclude(vPrevActiveCursorTypes, activeTypes, vHideCursorTypes);
            CursorTypeUtil.Exclude(activeTypes, vPrevActiveCursorTypes, vShowCursorTypes);

            foreach (CursorType type in vHideCursorTypes)
            {
                vCursorMap[type].gameObject.SetActive(false);
            }

            foreach (CursorType type in vShowCursorTypes)
            {
                if (vCursorMap.ContainsKey(type))
                {
                    vCursorMap[type].gameObject.SetActive(true);
                    continue;
                }

                ICursorState cursor = vState.GetCursorState(type);

                var cursorObj = new GameObject("Cursor-" + type);
                cursorObj.transform.SetParent(gameObject.transform, false);
                UiCursor uiCursor = cursorObj.AddComponent <UiCursor>();
                uiCursor.Build(cursor, visualSett, cameraTx);

                vCursorMap.Add(type, uiCursor);
                vState.SetCursorTransform(type, cursorObj.transform);
            }

            vPrevActiveCursorTypes.Clear();
            vPrevActiveCursorTypes.AddRange(activeTypes);
        }
Пример #5
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public InputCursor(CursorType pType)
 {
     Type            = pType;
     vLeapFingerType = LeapUtil.GetFingerType(pType);
     vIsPalm         = CursorTypeUtil.IsPalm(pType);
 }