Exemplo n.º 1
0
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		internal void Build(IHoverboardPanelState pPanelState, IHoverboardLayoutState pLayoutState, 
										BaseItemState pItemState, IItemVisualSettings pVisualSettings) {
			vPanelState = pPanelState;
			vItemState = pItemState;

			vSlideX0 = 0.5f;
			vSlideZ0 = 0.5f;
			vSlideW = vItemState.Item.Width-vSlideX0*2;
			vSlideH = vItemState.Item.Height-vSlideZ0*2;
			vIsVert = (vItemState.Item.Height > vItemState.Item.Width);

			////
			
			vRendererObj = new GameObject("Renderer");
			vRendererObj.transform.SetParent(gameObject.transform, false);

			vRenderer = (IUiItemRenderer)vRendererObj.AddComponent(pVisualSettings.Renderer);
			vRenderer.Build(pPanelState, pLayoutState, vItemState, pVisualSettings);
			vRenderer.SetDepthHint(vPanelState.DisplayDepthHint);
			vPrevDepth = vPanelState.DisplayDepthHint;

			vItemState.HoverPointUpdater = vRenderer.UpdateHoverPoints;

			gameObject.transform.localPosition = Vector3.zero;
			gameObject.transform.localRotation = Quaternion.identity;
			gameObject.transform.localScale = Vector3.one;
		}
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		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);
		}
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public MenuState(IItemHierarchy pItemHierarchy, InteractionSettings pInteractSettings)
        {
            vItemHierarchy = pItemHierarchy;
            vInteractSettings = pInteractSettings;

            vAllItems = new List<BaseItemState>();
            vItems = new List<BaseItemState>();
            vCurrentCursors = new ICursorState[0];
            vPalmItem = new BaseItemState(vItemHierarchy.NavigateBackItem, pInteractSettings);

            OnLevelChange += (d => {});

            vItemHierarchy.OnLevelChange += HandleLevelChange;
            HandleLevelChange(0);
        }
Exemplo n.º 4
0
		////////////////////////////////////////////////////////////////////////////////////////////////
		/*--------------------------------------------------------------------------------------------*/
		internal void Build(MenuState pMenuState, BaseItemState pItemState, float pArcAngle, 
																IItemVisualSettings pVisualSettings) {
			vMenuState = pMenuState;
			vItemState = pItemState;
			ArcAngle = pArcAngle;

			const float pi = (float)Math.PI;
			const float slideBufferAngle = pi/80f;

			vSlideDegrees = (pArcAngle-slideBufferAngle*2)/(float)Math.PI*180;
			vSlideDir0 = MeshUtil.GetRingPoint(1, -pArcAngle/2f+slideBufferAngle);

			////

			vRendererObj = new GameObject("Renderer");
			vRendererObj.transform.SetParent(gameObject.transform, false);

			vRenderer = (IUiItemRenderer)vRendererObj.AddComponent(pVisualSettings.Renderer);
			vRenderer.Build(vMenuState, vItemState, pArcAngle, pVisualSettings);
			vRenderer.SetDepthHint(vMenuState.DisplayDepthHint);
			vPrevDepth = vMenuState.DisplayDepthHint;

			vItemState.HoverPointUpdater = vRenderer.UpdateHoverPoints;
		}
        /*--------------------------------------------------------------------------------------------*/
        private void HandleLevelChange(int pDirection)
        {
            vAllItems.Clear();
            vItems.Clear();

            IBaseItem[] items = vItemHierarchy.CurrentLevel.Items;

            foreach ( IBaseItem item in items ) {
                var seg = new BaseItemState(item, vInteractSettings);
                vAllItems.Add(seg);
                vItems.Add(seg);
            }

            vAllItems.Add(vPalmItem);
            OnLevelChange(pDirection);
        }