Example #1
0
 public void Home()
 {
     print("Home");
     if (root.GetHashCode() == currentWidget.GetHashCode())
     {
         return;
     }
     currentWidget.Hide();
     currentWidget = root;
     currentWidget.Show();
 }
Example #2
0
    public void Back()
    {
        print("Back");
        if (root.GetHashCode() == currentWidget.GetHashCode())
        {
            return;
        }

        currentWidget.Hide();
        currentWidget = currentWidget.parent;
        currentWidget.Show();
    }
Example #3
0
    public void Navigate(int i)
    {
        print($"Navigate {i}");
        if (currentWidget.childs.Count <= i)
        {
            print("theres no such a child");
            return;
        }

        currentWidget.Hide();
        currentWidget = currentWidget.childs[i];
        currentWidget.Show();
    }
Example #4
0
    private void Start()
    {
        var widgets = GetComponentsInChildren <TreeWidget>();

        foreach (var w in widgets)
        {
            if (w.parent)
            {
                w.parent.AddChild(w);
            }
            w.Hide();
        }
        currentWidget = root;
        currentWidget.Show();
    }