// Dynamic creation of menu public void InitializeMenu(MenuRow parentRow, RowDetails details) { radius = Constants.Menu.Radius; maxRows = details.rows; maxColumns = details.columns; itemScale = details.itemScale; gapBetweenItems = details.gapBetweenItems; startInMiddle = details.startInMiddle; canMove = details.canMove; //transform.Find("mesh").localScale = new Vector3(radius+1f, radius+1f, 3f); gameObject.SetActive(false); if (parentRow != null) { belowRow = parentRow; menuItems = belowRow.selectedItem.subMenuItems; PositionMenuItems(); CreateMainButtons(); } else { PositionMenuItems(); } }
// Use this for initialization void Start() { cam = Camera.main; titleText = title.GetComponent <Text>(); // Generate starting MenuRow currentRow = Instantiate(MenuRowPrefab, transform).GetComponent <MenuRow>(); currentRow.maxRows = 1; currentRow.maxColumns = 5; currentRow.name = "Home Screen"; for (int i = 0; i < transform.childCount; i++) { MenuItem m = transform.GetChild(i).GetComponent <MenuItem>(); if (m != null) { currentRow.menuItems.Add(m); } } // circleRadius, maxRows, maxColumns, mainMenuItemScale, gapBetweenItems, true, true); RowDetails rowDetails = new RowDetails(maxRows, maxColumns, mainMenuItemScale, gapBetweenItems, true, true); currentRow.InitializeMenu(null, rowDetails); currentRow.StartTransitionIn(); raycaster = RayCaster.instance; raycaster.looker = cam.transform; AddRaycasters(); AddGestureListeners(); }