• Hi Guest!

    We are extremely excited to announce the release of our first Beta1.1 and the first release of our Public AddonKit!
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. For access to the Public AddonKit you must be a Creator tier member. Once subscribed, download instructions can be found here.

    Click here for information and guides regarding the VaM2 beta. Join our Discord server for more announcements and community discussion about VaM2.
  • Hi Guest!

    VaM2 Resource Categories have now been added to the Hub! For information on posting VaM2 resources and details about VaM2 related changes to our Community Forums, please see our official announcement here.
CustomTreeUI

Plugins + Scripts CustomTreeUI

Download [<1 MB]
※ Reporting bugs or issues will help me improve the plugin and help others.
CustomTreeUI

● This plugin is designed to simplify the implementation and usage of TreeUI.
● By implementing the object-pooling-technique with sliding window, I confirmed that even hundreds of thousands of Tree Items can be displayed without any issues.
● Feel free to customize or use it as you wish. You can refer to the provided examples for guidance.
● Once again, I ended up making a resource that ㅠㅠ nobody seems to like. :ROFLMAO:
14mhz.Plugin-CustomTreeUI.1.gif

Example1 - BasicTree.jpg

● You can easily implement a tree structure with just a few lines of code, as shown below.
C#:
{
    CustomTreeUI<String>tree = new CustomTreeUI<String>(this, "TreeBasic")
        .newHalfLineUI(CreateUIElement, true).setHeight(330)
        .setColorSet(CustomTreeUI<String>.UI_SKIN_BASIC)
        .addSelectClickCallback(selectClickEvent)
        .addDoubleClickCallback(doubleClickEvent)
        .addExpandClickCallback(expandClickEvent);
    setdata(tree);
}

public static void setdata(CustomTreeUI<String>tree)
{
    tree.removeAll();
    TreeItem<String>item1 = tree.add("Fruit");
    item1.add("Apple");
    item1.add("Banana");
    item1.add("Grape");
    item1.add("Pineapple");

    TreeItem<String>item2 = tree.add("Car");
    TreeItem<String>item2sub1 = item2.add("Sedan");
    TreeItem<String>item2sub2 = item2.add("Trucks");

    item2sub1.add("Hyundai");
    item2sub1.add("Chevrolet");
    item2sub1.add("Toyota");
    item2sub1.add("Jaguar");
    item2sub1.add("Tesla");

    item2.find("Trucks").add("Ford");
    item2.find("Trucks").add("Chevrolet");
    item2.find("Trucks").add("GMC");
    item2.find("Trucks").add("RAM");
}
Example2 - BasicTreeSkinned.jpg

● Three different SkinModes are supported.
- Basic Vam Skin
- White Skin
- Black Skin
Example3 - DynamicTree.jpg

● Provides a dynamic tree structure with support for adding and removing nodes.
Example4 - StructuredTree.jpg

● Hierarchical tree structures can also be loaded.
● To integrate with the existing hierarchical system architecture, you can use the internally defined bind function to establish the connection.
C#:
// Defined binding structure
public class TreeSystem : TreeItem<Tree>
{// sup_tree : parent(super) treeitem
 // this_obj : thiz object,  you want to handle will be this
 // tree_dep : depth of the hierarchical structure
    public TreeSystem(TreeItem<Tree>sup_tree, Tree this_obj, int tree_dep = 0)  : base(sup_tree, this_obj, tree_dep) {}
    public override String getName(Tree o)
    {
        return o.nme;
    }

    public override String getDisplayName(Tree o)
    {
        return getName(o);
    }

    public override String getPath(TreeItem<Tree>sup_tree, Tree o)
    {
        String sup_path = is_root() ? "/" : sup_tree.treepath + "/";
        return sup_path + getName(o);
    }

    public override List<Tree>getChild(Tree o)
    {
        List<Tree>list = new List<Tree>();
        list.AddRange(o.child);
        return list;
    }
}

// An example of a tree-structured system to be integrated.
public class Tree
{
    public Tree      sup;
    public String    nme;
    public object    obj { get; set; }
    public List<Tree>child = new List<Tree>();
 
    public Tree(String nme)
    {
        this.nme = nme;
    }
 
    public Tree parent()
    {
        return sup;
    }

    public Tree add(Tree t)
    {
        t.sup = this; child.Add(t); return t;
    }
 
    public Tree find(String n)
    {
        if (nme.Equals(n)) return this;
        for (int i = 0; child != null && i < child.Count; i++) { Tree t = child[i].find(n); if (t != null) return t; }
        return null;
    }
}
Example5 - FileExplorer.jpg

● File system loading is of course supported. This is an example of loading a sub-file system from VaM.
● Typically, pressing F5 triggers a refresh, and this is especially noticeable when working within the file system..
Example6 - JsonExplorer.jpg

● Loading of JSON structures is also supported in the demo. Naturally, it's read-only?modification and deletion are not allowed.
● TreeItem can also serve as a trigger target.
Example7 - TreeBasedTrigger.gif
● It’s currently under preparation...
React to this content...

More resources from 14mhz

Share this resource

Latest reviews

Positive
Version: 1
Awesome work!
Upvote 0
Back
Top Bottom