コード例 #1
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);
        }
コード例 #2
0
        /*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            vState.UpdateAfterInput();

            foreach (PanelState panelState in vState.Panels)
            {
                ItemPanel itemPanel = panelState.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;
            }

            ////

            CursorType[]              activeCursorTypes = interSett.Cursors;
            IEnumerable <CursorType>  hideCursorTypes   = vPrevActiveCursorTypes.Except(activeCursorTypes);
            IEnumerable <CursorType>  showCursorTypes   = activeCursorTypes.Except(vPrevActiveCursorTypes);
            IProjectionVisualSettings projSett          = ProjectionVisualSettings.GetSettings();

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

            foreach (CursorType cursorType in showCursorTypes)
            {
                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 = activeCursorTypes;
        }