Exemplo n.º 1
0
    public void ScrollRight()
    {
        for (int i = 1; i < programAnchors.Length; i++)
        {
            displayedPrograms[i].transform.position = programAnchors[i - 1].transform.position;
        }
        ProgramListItem temp = displayedPrograms[0];

        displayedPrograms.Remove(temp);
        Destroy(temp.gameObject);
        scrollIndex++;
        ProgramListItem newListItem = Instantiate(listItem, programAnchors[programAnchors.Length - 1].transform).GetComponent <ProgramListItem>();

        newListItem.SetProgram(PersistentState.instance.GetOwnedPrograms()[scrollIndex + programAnchors.Length - 1]);
        displayedPrograms.Add(newListItem);
        UpdateScrollEnabled();
    }
Exemplo n.º 2
0
    private void RefreshProgramList()
    {
        foreach (ProgramListItem listItem in displayedPrograms)
        {
            Destroy(listItem.gameObject);
        }
        displayedPrograms.Clear();
        int i = scrollIndex;

        while (i < scrollIndex + programAnchors.Length && i < PersistentState.instance.GetOwnedPrograms().Count)
        {
            ProgramListItem newListItem = Instantiate(listItem, programAnchors[i - scrollIndex].transform).GetComponent <ProgramListItem>();
            newListItem.SetProgram(PersistentState.instance.GetOwnedPrograms()[i]);
            displayedPrograms.Add(newListItem);
            i++;
        }
        UpdateScrollEnabled();
    }