コード例 #1
0
        public override DebugItemUI BuildGUI(GameObject parent)
        {
            Initialize();

            DebugItemUI newItemUI = null;

            if (m_DebugItem.GetItemType() == typeof(bool))
            {
                newItemUI = new DebugBoolItemUI(parent, m_DebugItem, m_Label.text);
            }
            else if (m_DebugItem.GetItemType() == typeof(int))
            {
                newItemUI = new DebugIntItemUI(parent, m_DebugItem, m_Label.text);
            }
            else if (m_DebugItem.GetItemType() == typeof(uint))
            {
                newItemUI = new DebugUIntItemUI(parent, m_DebugItem, m_Label.text);
            }
            else if (m_DebugItem.GetItemType() == typeof(float))
            {
                newItemUI = new DebugFloatItemUI(parent, m_DebugItem, m_Label.text);
            }
            else if (m_DebugItem.GetItemType() == typeof(Color))
            {
                newItemUI = new DebugColorItemUI(parent, m_DebugItem, m_Label.text);
            }
            else if (m_DebugItem.GetItemType().BaseType == typeof(System.Enum))
            {
                newItemUI = new DebugEnumItemUI(parent, m_DebugItem, m_Label.text, m_EnumStrings.ToArray(), m_EnumValues.ToArray());
            }

            return(newItemUI);
        }
コード例 #2
0
        protected void AddDebugItemUI(DebugItem item, GameObject parent)
        {
#if UNITY_EDITOR
            // We don't want runtime only items even in the "player" debug menu if we are in the editor.
            if (item.runtimeOnly)
            {
                return;
            }
#endif
            if (item.editorOnly)
            {
                return;
            }

            DebugItemUI itemUI = item.handler.BuildGUI(parent);
            if (itemUI == null)
            {
                Debug.LogWarning(String.Format("DebugItemUI not provided for item {0} of type {1}.\n Did you implement BuildGUI for your custom Handler?", item.name, item.type));
            }
            else
            {
                m_ItemsUI.Add(itemUI);
            }
        }