Beispiel #1
0
    public void SetData(DynamicListRowData data)
    {
        this.data = data;

        arrText[0].text = data.text1;
        arrText[1].text = data.text2;
    }
    public void OnClickAdd()
    {
        GameObject row = Instantiate(rowOrigin);

        row.transform.SetParent(contentPanel.transform, false);

        newRowID++;

        DynamicListRowData newData = new DynamicListRowData();

        newData.text1           = "rowText" + newRowID.ToString();
        newData.text2           = newData.text1.GetHashCode().ToString();
        newData.callbackDestroy = OnRemoveRow;

        row.SendMessage("SetData", newData);

        row.GetComponentsInChildren <Button>()[1].onClick.AddListener(() =>
        {
            listCount.Value = contentPanel.transform.childCount;
        });

        UpdateCountDisplay();
    }