Exemplo n.º 1
0
    public void InitDropDownUI(Dictionary <baseGroceryItemSO.CATEGORY, List <baseGroceryItemSO> > grocerieList)
    {
        //panelImage.color = panelDefaultColor;
        SetPanelActive(true);

        HomeUI.Instance.startingPage = App_Scenes.Search;
        HomeUI.Instance.currentPage  = App_Scenes.Search;

        HomeUI.Instance.HomeObject.SetActive(false);

        //check how many categories i have first
        //check how many items in each category
        //start initialising
        //each category must intialise also
        foreach (KeyValuePair <baseGroceryItemSO.CATEGORY, List <baseGroceryItemSO> > entry in grocerieList)
        {
            GameObject dropDownPrefab = Instantiate(m_DropDownPrefab, m_DropDownParent);

            DropDownOption dropDownOption = dropDownPrefab.GetComponent <DropDownOption>();
            if (dropDownOption == null)
            {
                continue;
            }

            dropDownOption.Init(entry.Key);

            foreach (baseGroceryItemSO grocery in entry.Value)
            {
                dropDownOption.AddContentToPanel(Instantiate(m_DropDownContentPrefab), grocery.GetEnumID());
            }
        }
    }