Пример #1
0
 public DebugMenuItem(string name, Type type, Func <object> getter, Action <object> setter, bool dynamicDisplay = false, DebugItemDrawer drawer = null)
 {
     m_Type           = type;
     m_Setter         = setter;
     m_Getter         = getter;
     m_Name           = name;
     m_Drawer         = drawer;
     m_DynamicDisplay = dynamicDisplay;
 }
Пример #2
0
        public void AddDebugMenuItem <ItemType>(string name, Func <object> getter, Action <object> setter, bool dynamicDisplay = false, DebugItemDrawer drawer = null)
        {
            if (drawer == null)
            {
                drawer = new DebugItemDrawer();
            }
            DebugMenuItem newItem = new DebugMenuItem(name, typeof(ItemType), getter, setter, dynamicDisplay, drawer);

            drawer.SetDebugItem(newItem);
            m_Items.Add(newItem);
        }
Пример #3
0
        private void RebuildGUI()
        {
            m_Root.transform.DetachChildren();

            DebugMenuUI.CreateTextElement(string.Format("{0} Title", m_Name), m_Name, 14, TextAnchor.MiddleLeft, m_Root);

            m_ItemsUI.Clear();
            foreach (DebugMenuItem menuItem in m_Items)
            {
                DebugItemDrawer drawer = menuItem.drawer; // Should never be null, we have at least the default drawer
                m_ItemsUI.Add(drawer.BuildGUI(m_Root, menuItem));
            }
        }
Пример #4
0
        public void AddDebugItem <ItemType>(string debugMenuName, string name, Func <object> getter, Action <object> setter = null, bool dynamicDisplay = false, DebugItemDrawer drawer = null)
        {
            DebugMenu debugMenu = GetDebugMenu(debugMenuName);

            // If the menu does not exist, create a generic one. This way, users don't have to explicitely create a new DebugMenu class if they don't need any particular overriding of default behavior.
            if (debugMenu == null)
            {
                debugMenu = new DebugMenu(debugMenuName);
                m_DebugMenus.Add(debugMenu);
            }

            if (debugMenu != null)
            {
                debugMenu.AddDebugMenuItem <ItemType>(name, getter, setter, dynamicDisplay, drawer);
            }
        }
Пример #5
0
        public void AddDebugItem <DebugMenuType, ItemType>(string name, Func <object> getter, Action <object> setter = null, bool dynamicDisplay = false, DebugItemDrawer drawer = null) where DebugMenuType : DebugMenu
        {
            DebugMenuType debugMenu = GetDebugMenu <DebugMenuType>();

            if (debugMenu != null)
            {
                debugMenu.AddDebugMenuItem <ItemType>(name, getter, setter, dynamicDisplay, drawer);
            }
        }