// SAMPLE DATA
    public void initList(string prefix, int count)
    {
        for (int i = 0; i < count; i++)
        {
            GameObject newListElement = (GameObject)Instantiate(listElementPrefab);

            NGUITools.Destroy(newListElement.GetComponent <UIPanel>());
            ListElementController listElementController = newListElement.GetComponent <ListElementController>();
            listElementController.titleText.text       = "Element " + prefix + "_" + i;
            listElementController.descriptionText.text = "Description for element " + prefix + "_" + i;
            newListElement.transform.parent            = productListGrid.transform;
            newListElement.transform.localScale        = Vector3.one;
            newListElement.transform.localPosition     = new Vector3(0f, 0f, -1f);

            //BoxCollider collider = NGUITools.AddWidgetCollider(newListElement);

            newListElement.AddComponent <UIDragPanelContents>();

            // Color
            UISlicedSprite bgSprite = newListElement.GetComponent <ListElementController>().bgSprite;
            if (i % 2 == 0)
            {
                bgSprite.color = new Color(0.35f, 0.35f, 0.35f);
            }
            else
            {
                bgSprite.color = new Color(0.5f, 0.5f, 0.5f);
            }
        }

        productListGrid.Reposition();
    }
Esempio n. 2
0
    void InstantiateImportedListElementIntoParent(GameObject Model, GameObject Parent)
    {
        GameObject gameObject = Instantiate(ListElement);

        gameObject.transform.SetParent(Parent.transform, false);
        ListElementController listElementController = gameObject.GetComponent <ListElementController>();

        listElementController.setModel(Model);
        gameObject.GetComponentInChildren <Text>().text = Model.name;
    }
 //
 private void handleListElementActionButtonPressed(string elementId, ListElementController.ListType type)
 {
     if (currentView == View.CategoryListView) {
         //currentViewPanel.GetComponent<ProductBrowsePanelController>().doNewBrowseList(currentView);
         //currentViewPanel.GetComponent<ProductBrowsePanelController>().doNewCategoryImage(true, 1);
         currentView = View.CategoryListView;
     }
 }
 public void setListElement(ListElementController listElement)
 {
     this.listElementController = listElement;
 }