Exemplo n.º 1
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public ProjectionState(ICursorState pCursor, InteractionSettings pSettings, Transform pBaseTx)
 {
     Cursor    = pCursor;
     vSettings = pSettings;
     vBaseTx   = pBaseTx;
     IsActive  = true;
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public HovercastState(IItemHierarchy pItemHierarchy, HovercursorSetup pHovercusorSetup,
                              InteractionSettings pInterSett, IInput pInput, Transform pBaseTx)
        {
            vInteractSettings = pInterSett;
            vHovercursorSetup = pHovercusorSetup;
            vInput            = pInput;
            BaseTransform     = pBaseTx;

            FullMenu          = new MenuState(pItemHierarchy, vInteractSettings);
            ActiveCursorTypes = new CursorType[0];

            vCursorMap = new Dictionary <CursorType, ICursorState>();

            vLeftCursorConvertMap = new Dictionary <HovercastCursorType, CursorType> {
                { HovercastCursorType.Palm, CursorType.LeftPalm },
                { HovercastCursorType.Thumb, CursorType.LeftThumb },
                { HovercastCursorType.Index, CursorType.LeftIndex },
                { HovercastCursorType.Middle, CursorType.LeftMiddle },
                { HovercastCursorType.Ring, CursorType.LeftRing },
                { HovercastCursorType.Pinky, CursorType.LeftPinky },
                { HovercastCursorType.Look, CursorType.Look }
            };

            vRightCursorConvertMap = new Dictionary <HovercastCursorType, CursorType> {
                { HovercastCursorType.Palm, CursorType.RightPalm },
                { HovercastCursorType.Thumb, CursorType.RightThumb },
                { HovercastCursorType.Index, CursorType.RightIndex },
                { HovercastCursorType.Middle, CursorType.RightMiddle },
                { HovercastCursorType.Ring, CursorType.RightRing },
                { HovercastCursorType.Pinky, CursorType.RightPinky },
                { HovercastCursorType.Look, CursorType.Look }
            };

            OnSideChange += (() => {});
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public PanelState(ItemPanel pItemPanel, InteractionSettings pSettings)
        {
            ItemPanel = pItemPanel;
            vSettings = pSettings;

            RefreshGrids();
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public GridState(IItemGrid pItemGrid, InteractionSettings pSettings)
        {
            ItemGrid  = pItemGrid;
            vSettings = pSettings;

            RefreshItems();
        }
Exemplo n.º 5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public LayoutState(IItemLayout pItemLayout, InteractionSettings pSettings)
        {
            ItemLayout      = pItemLayout;
            vSettings       = pSettings;
            DisplayStrength = 1;

            RefreshItems();
        }
Exemplo n.º 6
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public PanelState(ItemPanel pItemPanel, InteractionSettings pSettings)
        {
            ItemPanel       = pItemPanel;
            vSettings       = pSettings;
            DisplayStrength = 1;

            RefreshLayouts();
        }
Exemplo n.º 7
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 InteractionSettings  GetInteractionSettings()
        {
            if (InteractionSettings == null)
            {
                InteractionSettings = base.GetInteractionSettings();
            }

            return(InteractionSettings);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        protected override void Setup()
        {
            const string env = "DemoEnvironment";

            Enviro       = GameObject.Find(env).GetComponent <DemoEnvironment>();
            CastSetup    = GameObject.Find("Hovercast").GetComponent <HovercastSetup>();
            ItemSett     = CastSetup.DefaultItemVisualSettings;
            InteractSett = CastSetup.InteractionSettings.GetSettings();
        }
Exemplo n.º 10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        protected override void Setup()
        {
            const string env = "DemoEnvironment";

            Enviro       = GameObject.Find(env).GetComponent <DemoEnvironment>();
            Custom       = GameObject.Find(env + "/MenuData").GetComponent <HovercastCustomizationProvider>();
            SegSett      = Custom.GetSegmentSettings(null);
            InteractSett = Custom.GetInteractionSettings();
        }
        /*--------------------------------------------------------------------------------------------*/
        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;
        }
Exemplo n.º 12
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public MenuState(IInputProvider pInputProv, NavRoot pNavRoot, InteractionSettings pSettings)
        {
            vInputProv = pInputProv;
            vSettings  = pSettings;

            Arc    = new ArcState(pNavRoot, vSettings);
            Cursor = new CursorState(vSettings);

            OnSideChange += (() => {});
        }
Exemplo n.º 13
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public MenuState(IItemHierarchy pItemHierarchy, InteractionSettings pInteractSettings)
        {
            vItemHierarchy    = pItemHierarchy;
            vInteractSettings = pInteractSettings;
            vItems            = new List <BaseItemState>();
            vCurrentCursors   = new ICursorState[0];

            OnLevelChange += (d => {});

            vItemHierarchy.OnLevelChange += HandleLevelChange;
            HandleLevelChange(0);
        }
Exemplo n.º 14
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public ArcState(NavRoot pNavRoot, InteractionSettings pSettings)
        {
            vNavRoot  = pNavRoot;
            vSegments = new List <SegmentState>();
            vSettings = pSettings;

            IsLeft = vSettings.IsMenuOnLeftSide;

            OnLevelChange += (d => {});

            vNavRoot.OnLevelChange += HandleLevelChange;
            HandleLevelChange(0);
        }
Exemplo n.º 15
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public ArcState(NavProvider pNavProv, InteractionSettings pSettings)
        {
            vNavProv  = pNavProv;
            vSegments = new List <ArcSegmentState>();
            vSettings = pSettings;

            IsLeft = vSettings.IsMenuOnLeftSide;

            OnLevelChange += (d => {});

            vNavProv.OnLevelChange += HandleLevelChange;
            HandleLevelChange(0);
        }
Exemplo n.º 16
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public LayoutState(IItemLayout pItemLayout, InteractionSettings pSettings)
        {
            ItemLayout      = pItemLayout;
            vSettings       = pSettings;
            DisplayStrength = 1;
            FullItems       = new BaseItemState[ItemLayout.Items.Length];

            for (int i = 0; i < ItemLayout.Items.Length; i++)
            {
                var item = new BaseItemState(ItemLayout.Items[i], vSettings);
                FullItems[i] = item;
            }

            Items = new ReadOnlyCollection <IBaseItemState>(FullItems);
        }
Exemplo n.º 17
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public PanelState(ItemPanel pItemPanel, InteractionSettings pSettings)
        {
            ItemPanel       = pItemPanel;
            vSettings       = pSettings;
            DisplayStrength = 1;
            FullLayouts     = new LayoutState[ItemPanel.Layouts.Length];

            for (int i = 0; i < ItemPanel.Layouts.Length; i++)
            {
                var layout = new LayoutState(ItemPanel.Layouts[i], vSettings);
                FullLayouts[i] = layout;
            }

            Layouts = new ReadOnlyCollection <IHoverboardLayoutState>(FullLayouts);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public MenuState(IItemHierarchy pItemHierarchy, InteractionSettings pInteractSettings)
        {
            vItemHierarchy    = pItemHierarchy;
            vInteractSettings = pInteractSettings;

            vAllItems       = new List <BaseItemState>();
            vItems          = new ReadList <BaseItemState>();
            vLevelItems     = new ReadList <IBaseItemState>();
            vPalmItem       = new BaseItemState(vItemHierarchy.NavigateBackItem, pInteractSettings);
            vCurrentCursors = new List <ICursorState>();

            OnLevelChange += (d => {});

            vItemHierarchy.OnLevelChange += HandleLevelChange;
            HandleLevelChange(0);
        }
Exemplo n.º 19
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public HoverboardState(ItemPanel[] pItemPanels, HovercursorSetup pHovercusorSetup,
                               InteractionSettings pInterSett, Transform pBaseTx)
        {
            vInteractSett    = pInterSett;
            vHovercusorSetup = pHovercusorSetup;
            vBaseTx          = pBaseTx;
            vProjectionMap   = new ListMap <CursorType, ProjectionState>(EnumIntKeyComparer.CursorType);

            ////

            var panels   = new List <PanelState>();
            var allItems = new List <ItemTree>();

            foreach (ItemPanel itemPanel in pItemPanels)
            {
                var panel = new PanelState(itemPanel, vInteractSett);
                panel.InteractionPlane = new PlaneData("Hoverboard.Panel-" + panels.Count,
                                                       ((GameObject)panel.ItemPanel.DisplayContainer).transform, Vector3.up);
                panels.Add(panel);

                foreach (LayoutState layout in panel.FullLayouts)
                {
                    layout.ItemLayout.SetRadioSiblingsFunc(GetRadioSiblings);

                    foreach (BaseItemState item in layout.FullItems)
                    {
                        var tree = new ItemTree {
                            Panel  = panel,
                            Layout = layout,
                            Item   = item
                        };

                        allItems.Add(tree);
                    }
                }
            }

            vAllItems    = allItems.ToArray();
            vActiveItems = new List <ItemTree>();
            vActiveCursorInteractions = new ReadList <IBaseItemInteractionState>();
            vActiveCursorPlanes       = new ReadList <PlaneData>();

            FullPanels        = panels.ToArray();
            Panels            = new ReadOnlyCollection <IHoverboardPanelState>(FullPanels);
            ActiveCursorTypes = new ReadOnlyCollection <CursorType>(vInteractSett.Cursors);
        }
Exemplo n.º 20
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        protected override void Setup()
        {
            base.Setup();
            vInteractSett = HoverboardSetup.InteractionSettings.GetSettings();

            vNoThumbCursors = new[] {
                CursorType.LeftIndex,
                CursorType.RightIndex
            };

            vThumbCursors = new[] {
                CursorType.LeftIndex,
                CursorType.LeftThumb,
                CursorType.RightIndex,
                CursorType.RightThumb
            };

            Item.OnValueChanged += HandleValueChanged;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public HoverboardState(ItemPanel[] pItemPanels, HovercursorSetup pHovercusorSetup,
                               InteractionSettings pInterSett, Transform pBaseTx)
        {
            vInteractSett    = pInterSett;
            vHovercusorSetup = pHovercusorSetup;
            vBaseTx          = pBaseTx;
            vProjectionMap   = new Dictionary <CursorType, ProjectionState>();

            ////

            var panels   = new List <PanelState>();
            var allItems = new List <ItemTree>();

            foreach (ItemPanel itemPanel in pItemPanels)
            {
                var panel = new PanelState(itemPanel, vInteractSett);
                panel.InteractionPlane = new PlaneData("Hoverboard.Panel-" + panels.Count,
                                                       ((GameObject)panel.ItemPanel.DisplayContainer).transform, Vector3.up);
                panels.Add(panel);

                foreach (GridState grid in panel.Grids)
                {
                    foreach (BaseItemState item in grid.Items)
                    {
                        var tree = new ItemTree {
                            Panel = panel,
                            Grid  = grid,
                            Item  = item
                        };

                        allItems.Add(tree);
                    }
                }
            }

            Panels            = panels.ToArray();
            vAllItems         = allItems.ToArray();
            ActiveCursorTypes = new CursorType[0];
        }
Exemplo n.º 22
0
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		public HovercastState(IItemHierarchy pItemHierarchy, HovercursorSetup pHovercusorSetup, 
				InteractionSettings pInterSett, IInput pInput, Transform pBaseTx) {
			vInteractSettings = pInterSett;
			vHovercursorSetup = pHovercusorSetup;
			vInput = pInput;
			BaseTransform = pBaseTx;

			FullMenu = new MenuState(pItemHierarchy, vInteractSettings);

			vActiveCursorInteractions = new ReadList<IBaseItemInteractionState>();
			vMenuPlanes = new ReadList<PlaneData>();
			vActiveCursorTypes = new ReadList<CursorType>();

			ActiveCursorTypes = vActiveCursorTypes.ReadOnly;

			vLeftCursorConvertMap = 
				new Dictionary<HovercastCursorType, CursorType>(HovercastCursorTypeComparer);
			vLeftCursorConvertMap.Add(HovercastCursorType.Palm, CursorType.LeftPalm);
			vLeftCursorConvertMap.Add(HovercastCursorType.Thumb, CursorType.LeftThumb);
			vLeftCursorConvertMap.Add(HovercastCursorType.Index, CursorType.LeftIndex);
			vLeftCursorConvertMap.Add(HovercastCursorType.Middle, CursorType.LeftMiddle);
			vLeftCursorConvertMap.Add(HovercastCursorType.Ring, CursorType.LeftRing);
			vLeftCursorConvertMap.Add(HovercastCursorType.Pinky, CursorType.LeftPinky);
			vLeftCursorConvertMap.Add(HovercastCursorType.Look, CursorType.Look);

			vRightCursorConvertMap =
				new Dictionary<HovercastCursorType, CursorType>(HovercastCursorTypeComparer);
			vRightCursorConvertMap.Add(HovercastCursorType.Palm, CursorType.RightPalm);
			vRightCursorConvertMap.Add(HovercastCursorType.Thumb, CursorType.RightThumb);
			vRightCursorConvertMap.Add(HovercastCursorType.Index, CursorType.RightIndex);
			vRightCursorConvertMap.Add(HovercastCursorType.Middle, CursorType.RightMiddle);
			vRightCursorConvertMap.Add(HovercastCursorType.Ring, CursorType.RightRing);
			vRightCursorConvertMap.Add(HovercastCursorType.Pinky, CursorType.RightPinky);
			vRightCursorConvertMap.Add(HovercastCursorType.Look, CursorType.Look);

			OnSideChange += (() => {});
		}
Exemplo n.º 23
0
        /*--------------------------------------------------------------------------------------------*/
        public void Update()
        {
            if (vState == null)
            {
                return;
            }

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

            ////

            InteractionSettings interSett = InteractionSettings.GetSettings();

            if (interSett.ApplyScaleMultiplier)
            {
                Vector3 worldUp = transform.TransformVector(Vector3.up);
                interSett.ScaleMultiplier = 1 / worldUp.magnitude;
            }
            else
            {
                interSett.ScaleMultiplier = 1;
            }
        }
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 protected override void Setup()
 {
     base.Setup();
     vInteractSett        = HoverboardSetup.InteractionSettings.GetSettings();
     Item.OnValueChanged += HandleValueChanged;
 }
Exemplo n.º 25
0
 private void Awake()
 {
     instance = this;
 }
Exemplo n.º 26
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public CursorState(InteractionSettings pSettings)
 {
     vSettings = pSettings;
 }
Exemplo n.º 27
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public ArcSegmentState(NavItem pNavItem, InteractionSettings pSettings)
 {
     NavItem   = pNavItem;
     vSettings = pSettings;
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 protected override void Setup()
 {
     CastSetup    = GameObject.Find("Hovercast").GetComponent <HovercastSetup>();
     ItemSett     = CastSetup.DefaultItemVisualSettings;
     InteractSett = CastSetup.InteractionSettings.GetSettings();
 }