Esempio n. 1
0
    void Awake()
    {
        upgradeStats.Id = (transform.GetSiblingIndex() + 1) + (transform.parent.GetSiblingIndex() + 1) * 10 + (transform.parent.parent.GetSiblingIndex() + 1) * 100;
        parent.Buttons.Add(this);
        connector = GetComponent <UILineConnector>();

        icon.sprite = iconSource;

        if (connector != null && previousButton.Count > 0)
        {
            connector.PrevObj = previousButton[0].transform;
        }
    }
Esempio n. 2
0
    UILineRenderer DrawLine(RectTransform start, RectTransform end)
    {
        GameObject      go        = Instantiate(linePrefab.gameObject);
        UILineConnector connector = go.GetComponent <UILineConnector>();

        connector.canvas = content.GetComponent <RectTransform>();

        go.transform.SetParent(lineContainer.GetComponent <RectTransform>(), false);

        UILineRenderer line = go.GetComponent <UILineRenderer>();

        line.enabled = true;

        connector.transforms = new RectTransform[] { start, end };
        connector.enabled    = true;

        return(line);
    }
Esempio n. 3
0
    public void newMapLink(GameObject mapLink, GameObject parentNode, GameObject start, GameObject end, Color defaultColor, Color activeColor)
    {
        this.start        = start;
        this.end          = end;
        this.defaultColor = defaultColor;
        this.activeColor  = activeColor;

        lineObject = GameObject.Instantiate(mapLink, parentNode.transform.parent);
        //lineObject = new GameObject("Link");
        //lineObject.transform.parent = parentNode.transform.parent;
        lineConnector = lineObject.GetComponent <UILineConnector>();

        line = lineConnector.lr;

        line.color = defaultColor;

        RectTransform[] points = new RectTransform[] { (RectTransform)start.transform, (RectTransform)end.transform };

        lineConnector.transforms = points;
    }
Esempio n. 4
0
 // Use this for initialization
 void Start()
 {
     m_UILineConnector = FindObjectOfType <UILineConnector>();
     quiBut.onClick.AddListener(delegate { m_UILineConnector.ImgQuesButtonCallBack(quiBut, lrPos); });
 }