Пример #1
0
        /// <summary>
        /// Shows selected inspector content panel while hiding previously selected one
        /// </summary>
        /// <param name="menuItem">Menu item that was selected</param>
        public void MenuItemSelected(InspectorMenuItem menuItem)
        {
            if (!menuItems.Contains(menuItem))
            {
                Log.Warning("Cannot show inspector panel which is not in the inspector content hierarchy.");
                return;
            }

            if (activeMenuItem != null)
            {
                activeMenuItem.HidePanel();
            }

            menuItem.ShowPanel();
            activeMenuItem = menuItem;
            MenuItemChanged?.Invoke(activeMenuItem);
        }
Пример #2
0
        /// <summary>
        /// Initialization method
        /// </summary>
        public void Initialize()
        {
            for (var i = 0; i < menuItemsPrefabs.Count; i++)
            {
                var menuItem = Instantiate(menuItemsPrefabs[i], menu.transform);
                menuItems.Add(menuItem);
                menuItem.Initialize(this);
                if (i == 0)
                {
                    menuItem.ShowPanel();
                }
                else
                {
                    menuItem.HidePanel();
                }
            }

            activeMenuItem = menuItems.Count > 0 ? menuItems[0] : null;
            MenuItemChanged?.Invoke(activeMenuItem);
        }