예제 #1
0
    public void AddExample(Board board)
    {
        GameObject     newExample = (GameObject)Instantiate(examplePrefab);
        DisplayExample de         = newExample.GetComponent <DisplayExample>();

        de.SetDisplay(gc, board);
        //newExample.transform.SetParent(examplesContainer);
        //de.SetSize(scrollRect.rect);
        exampleDisplays.Add(de);
        listDirty = true;
        Debug.Log("Adding example to list");
    }
예제 #2
0
    void sc_OnOpenComplete()
    {
        Debug.Log("Doing open complete. Dirty list ? " + listDirty);
        if (listDirty)
        {
            int start = scrollBar.numberOfSteps;
            for (int i = start; i < exampleDisplays.Count; i++)
            {
                DisplayExample de = exampleDisplays[i];
                de.GetComponent <RectTransform>().SetParent(examplesContainer);
                de.SetSize(scrollRect.GetComponent <RectTransform>().rect);
            }

            scrollBar.numberOfSteps = exampleDisplays.Count;
            scrollRect.horizontalNormalizedPosition = 1f;
            scrollBar.onValueChanged.Invoke(scrollBar.value);

            listDirty = false;
        }
    }