Example #1
0
        public static void OnGUI(Action onClose = null)
        {
            GUI.skin = s_skin;

            const float kScrollBarWidth = 16f;

            using (new GUILayout.VerticalScope("box", GUILayout.Width(Screen.width - kScrollBarWidth), GUILayout.Height(Screen.height)))
            {
                using (new GUILayout.HorizontalScope())
                {
                    if (s_current != s_root)
                    {
                        if (GUILayout.Button("戻る", GUILayout.Width(Screen.width * 0.5f)))
                        {
                            s_current = s_current.directory;
                        }
                    }

                    if (GUILayout.Button("閉じる") && onClose != null)
                    {
                        onClose();
                        return;
                    }
                }

                s_current.OnGUI();
            }
        }
Example #2
0
        internal DebugMenuDirectory GetDirectory(Stack <string> stack)
        {
            Assert.IsTrue(stack.Count > 0);

            var itemName = stack.Pop();

            var item = m_itemList.Find(i => i.name == itemName);

            if (item == null)
            {
                item = new DebugMenuDirectory(itemName, this);
                m_itemList.Add(item);
                m_itemList.Sort(CompareItem);
            }

            var dir = item as DebugMenuDirectory;

            if (dir == null)
            {
                return(null);
            }

            return(stack.Count == 0 ? dir : dir.GetDirectory(stack));
        }
Example #3
0
        //------------------------------------------------------
        // from directory/item
        //------------------------------------------------------

        internal static void SetCurrent(DebugMenuDirectory dir)
        {
            s_current = dir ?? s_root;
        }
Example #4
0
        //------------------------------------------------------
        // lifetime
        //------------------------------------------------------

        public DebugMenuDirectory(string name, DebugMenuDirectory directory)
            : base(name, directory)
        {
        }
Example #5
0
 public DebugMenuItem(string name, DebugMenuDirectory dir)
 {
     this.name   = name;
     m_directory = dir;
 }
Example #6
0
        //------------------------------------------------------
        // lifetime
        //------------------------------------------------------

        public DebugMenuItem(string path)
        {
            name        = Path.GetFileName(path);
            m_directory = DebugMenuManager.GetDirectory(Path.GetDirectoryName(path));
            m_directory.AddItem(this);
        }