Пример #1
0
    // sets the placeholder transform to the graph, then destroys the placeholder
    public void SetPlaceAndDestroyHolder(GraphPositioning positioning, GraphAppearance appearance)
    {
        // find placeholder
        PlaceholderController placeholder = transform.GetComponentInChildren <PlaceholderController>();

        // assign offsets as placeholder offsets
        positioning.SetAllVariables(
            anchorMin: new Vector2(0, 0), anchorMax: new Vector2(1, 1),
            anchoredPosition: new Vector2(0.5f, 0.5f),
            offsetMin: placeholder.GetOffsetMin(), offsetMax: placeholder.GetOffsetMax());
        // apply placeholder colors to graph appearance
        appearance.SetAllVariables(
            backgroundColor: placeholder.background.color,
            detailColor: placeholder.text.color);
        // remove placeholder
        GameObject.Destroy(placeholder.gameObject);
    }