Пример #1
0
    public static NodeWindow Instantiate(GameObject prefab, GameObject parent, Node node)
    {
        NodeWindow obj = Instantiate(prefab, parent.transform).GetComponent <NodeWindow>();

        obj.node = node;
        if (node.color != "")
        {
            obj.SetColor(node.color);
        }
        else if (node is BaseNode)
        {
            obj.bg.color      = obj.baseNodeColor;
            obj.bgTitle.color = obj.baseNodeColor;
        }
        obj.removeButton.SetActive(node.optional);
        obj.titleText.text   = node.title;
        obj.description.text = node.text;
        obj.icon.sprite      = ImageIO.GetIcon(node.iconName);
        obj.SetComponentForParameter();
        return(obj);
    }