コード例 #1
0
    public void Build(ModelTexture mtex)
    {
        if (mtex == null)
        {
            return;
        }
        Grid.Clear();
        Grid.AddElement(Instantiate(HLine));
        Variant variant = mtex.GetParent <Variant>();

        foreach (ModelTexture sibling in variant.Children <ModelTexture>())
        {
            if (sibling != mtex)
            {
                ARColorIcon icon = MakeIcon();
                icon.modeltexture       = sibling;
                icon.ColorIcon.Selected = sibling == mtex;
                icon.ClickBox.AddEventListener("onclick", () => {
                    if (OnSelect != null)
                    {
                        OnSelect(sibling);
                    }
                });
                Grid.AddElement(icon);
                Grid.AddElement(Instantiate(HLine));
            }
        }
    }
コード例 #2
0
    /* Build, given a variant builds a grid with every color of its
     * children modelTexture's. The default modelTexture will be selected.
     */
    public void Build(Variant variant)
    {
        if (variant == null)
        {
            return;
        }

        Clear();


        ModelTexture def = variant.GetDefaultModelTexture();

        foreach (ModelTexture modelTexture in variant.Children <ModelTexture>())
        {
            AddIcon(modelTexture, def == modelTexture);
        }
    }