/// <summary>
        /// Add the specified debug item.
        /// </summary>
        /// <param name="item">New item.</param>
        public override IDebugGroup Add(IDebugItem item)
        {
            if (item == null)
            {
                UnityEngine.Debug.LogWarning("Debug item cannot be null.");
                return(this);
            }

            if (IsDuplicated(item))
            {
                UnityEngine.Debug.LogWarningFormat("Debug item {0} already exists.", item.Name);
                return(this);
            }

            if (item is IDebugGroup)
            {
                ((IDebugGroup)item).Parent = this;
            }

            item.Menu = Menu;
            items.Add(item);

            return(this);
        }
 void AddDebugItem(DebugOutputBase parameters, IDebugItem debugItem)
 {
     var debugItemResults = parameters.GetDebugItemResult();
     debugItem.AddRange(debugItemResults);
 }
Ejemplo n.º 3
0
        void AddDebugItem(DebugOutputBase parameters, IDebugItem debugItem)
        {
            var debugItemResults = parameters.GetDebugItemResult();

            debugItem.AddRange(debugItemResults);
        }
 private bool IsDuplicated(IDebugItem item)
 {
     return(items.Exists(e => e.Name == item.Name));
 }
        /// <summary>
        /// Draws the item list.
        /// </summary>
        protected override void DrawContent()
        {
            GUILayout.BeginVertical(lowOpacity ? Menu.Style.LowOpacityBoxStyle : Menu.Style.BoxStyle);

            GUILayout.Label(Content);

            GUILayout.BeginHorizontal();

            // TODO: Draw button back
            if (GUILayout.Button(LABEL_BACK))
            {
                Back();
            }

            // TODO: Draw button close
            if (GUILayout.Button(LABEL_CLOSE))
            {
                Close();
            }

            GUILayout.EndHorizontal();

            if (scrollStyle == null)
            {
                scrollStyle = new GUIStyle(GUI.skin.scrollView);

                // Set padding right for 20 px to avoid overlapping
                // the right scrollbar over the elements
                scrollStyle.padding.right = 20;
            }

            if (items.Count > 2)
            {
                scrollPos = GUILayout.BeginScrollView(scrollPos, scrollStyle,
                                                      GUILayout.Height(Mathf.Clamp(items.Count, 0, MAX_DISPLAY_COUNT) * MAX_ELEMENT_HEIGHT));
            }

            // Draw to list all debug items
            for (int i = 0; i < items.Count; i++)
            {
                IDebugItem item = items [i];
                item.Draw();
                if (item is IDebugGroup)
                {
                    IDebugGroup group = (IDebugGroup)item;
                    if (group.IsAccess)
                    {
                        InvokeOnExit();
                        Menu.CurrentItem = group;
                        break;
                    }
                }
            }

            if (items.Count > 2)
            {
                GUILayout.EndScrollView();
            }

            GUILayout.EndVertical();
        }
 public abstract IDebugGroup Add(IDebugItem item);