Esempio n. 1
0
    public void CollapseEntry()
    {
        if (selection is PhuneHeaderCell)
        {
            PhuneHeaderCell header = (PhuneHeaderCell)selection;
            header.expanded = true;
            header.Populate(false);

            int index = allCells.IndexOf(selection);
            selection = allCells[index + 1];
            selection.Populate(true);
        }
        else
        {
            selection.Populate(false);

            PhuneHeaderCell header = null;
            foreach (PhuneCell cell in allCells)
            {
                if (cell is PhuneHeaderCell)
                {
                    header = (PhuneHeaderCell)cell;
                }
                if (cell == selection)
                {
                    header.expanded = false;
                    header.Populate(true);
                    selection = header;
                    break;
                }
            }
        }
        UpdateSelection();
    }
Esempio n. 2
0
    private void AddSection(string headerText, List <PhuneEntryCell> entries)
    {
        PhuneHeaderCell header = Instantiate(headerPrefab);

        header.Populate(false, false, headerText);
        AddCell(header);
        this.entries[header] = entries;
        foreach (PhuneEntryCell entry in entries)
        {
            AddCell(entry);
        }
    }
Esempio n. 3
0
    private void UpdateSelection()
    {
        PhuneHeaderCell header = null;

        foreach (PhuneCell cell in allCells)
        {
            if (cell is PhuneHeaderCell)
            {
                header = (PhuneHeaderCell)cell;
            }
            else
            {
                cell.gameObject.SetActive(header.expanded);
            }
        }
    }
Esempio n. 4
0
    private void ReloadData()
    {
        allCells.Clear();
        foreach (Transform child in attachPoint.transform)
        {
            Destroy(child.gameObject);
        }

        Dictionary <PhuneCategoryData, List <PhuneEntryCell> > entriesByCategory =
            new Dictionary <PhuneCategoryData, List <PhuneEntryCell> >();

        foreach (PhuneEntryData data in dataModel)
        {
            if (!entriesByCategory.ContainsKey(data.category))
            {
                List <PhuneEntryCell> newSiblings = new List <PhuneEntryCell>();
                entriesByCategory[data.category] = newSiblings;
            }
            List <PhuneEntryCell> siblings = entriesByCategory[data.category];
            siblings.Add(GenerateEntry(data));
        }

        foreach (PhuneCategoryData category in entriesByCategory.Keys)
        {
            AddSection(category.GetSummary(), entriesByCategory[category]);
        }

        selection = allCells[0];
        foreach (PhuneCell cell in allCells)
        {
            if (cell is PhuneHeaderCell)
            {
                PhuneHeaderCell header = (PhuneHeaderCell)cell;
                if (defaultCat != null && header.text.text == defaultCat.headerName)
                {
                    selection = cell;
                }
            }
        }

        selection.Populate(true);
        UpdateSelection();
    }