////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		internal void Build(PanelState pPanelState, IItemVisualSettingsProvider pItemVisualSettProv) {
			vLayoutStates = pPanelState.FullLayouts;

			foreach ( LayoutState layoutState in vLayoutStates ) {
				IItemLayout itemLayout = layoutState.ItemLayout;
				GameObject layoutObj = (GameObject)itemLayout.DisplayContainer;
				
				UiLayout uiLayout = layoutObj.AddComponent<UiLayout>();
				uiLayout.Build(pPanelState, layoutState, pItemVisualSettProv);

				Vector2 pos = itemLayout.Position*UiItem.Size - uiLayout.Bounds.position - 
					Vector2.Scale(itemLayout.Anchor, uiLayout.Bounds.size);
				uiLayout.transform.localPosition = new Vector3(pos.x, 0, pos.y);
			}
		}
Example #2
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);
        }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		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);
		}
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        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];
        }
Example #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        internal void Build(PanelState pPanelState, IItemVisualSettingsProvider pItemVisualSettProv)
        {
            vLayoutStates = pPanelState.FullLayouts;

            foreach ( LayoutState layoutState in vLayoutStates ) {
                IItemLayout itemLayout = layoutState.ItemLayout;
                GameObject layoutObj = (GameObject)itemLayout.DisplayContainer;

                UiLayout uiLayout = layoutObj.AddComponent<UiLayout>();
                uiLayout.Build(pPanelState, layoutState, pItemVisualSettProv);

                Vector2 pos = itemLayout.Position*UiItem.Size - uiLayout.Bounds.position -
                    Vector2.Scale(itemLayout.Anchor, uiLayout.Bounds.size);
            if (layoutState.FullItems.Length > 0) {
              BaseItemState itemState = layoutState.FullItems[0];
              IItemVisualSettings visualSett = pItemVisualSettProv.GetSettings(itemState.Item);
              ItemVisualSettingsStandard vSettings = (ItemVisualSettingsStandard)visualSett;
              Debug. Log("old pos=" + pos);
              pos.Scale(new Vector2(vSettings.ExpandSize, vSettings.ExpandSize));
              Debug. Log("new pos=" + pos);
            }
                uiLayout.transform.localPosition = new Vector3(pos.x, 0, pos.y);
            }
        }
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 private bool IsPanelActive(PanelState pPanel)
 {
     return(pPanel.ItemPanel.IsVisible && pPanel.ItemPanel.IsEnabled &&
            !pPanel.IsEveryItemSelectionPreventedViaDisplay());
 }
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		private bool IsPanelActive(PanelState pPanel) {
			return (pPanel.ItemPanel.IsVisible && pPanel.ItemPanel.IsEnabled &&
				!pPanel.IsEveryItemSelectionPreventedViaDisplay());
		}