Exemple #1
0
    public void GoToStep(int newStepIndex)
    {
        if (hasFinishedModule)
        {
            return;
        }

        ResetSceneObjects();
        currentStepIndex = newStepIndex;

        // Update UI Text
        UIManager.s_instance.UpdateDescriptionViewText(acquireStepList[currentStepIndex].uiText.descriptionViewText);

        // Update scene
        StartCoroutine(InitializeNextStep());

        // Get our new selected list view button, change its text white, set it interactable, and check its checkbox.
        ListViewButton newListViewButtonSelection = UIManager.s_instance.listViewContentParent.GetChild(currentStepIndex).GetComponent <ListViewButton>();

        newListViewButtonSelection.GetComponent <Button>().interactable = true;
        newListViewButtonSelection.childText.color = Color.white;
        newListViewButtonSelection.checkBox.isOn   = true;

        // Highlight button and check if the "Next" button should appear or disappear.
        ToggleListViewButtonHighLight(currentStepIndex, true);
        UpdateNextButton();
    }
Exemple #2
0
    private void InitializeAcquireListView()
    {
        int acquireListCount = acquireStepList.Count;

        // Setting the height of the list view to match the amount of buttons I will add to it.
        RectTransform listViewVerticalLayoutGroup = UIManager.s_instance.listViewContentParent;
        Vector2       newWidthHeight = listViewVerticalLayoutGroup.sizeDelta;

        //newWidthHeight.x = defaultListViewButton.GetComponent<RectTransform>().sizeDelta.x;
        newWidthHeight.y = UIManager.s_instance.defaultListViewButton.GetComponent <RectTransform>().sizeDelta.y *acquireListCount;
        listViewVerticalLayoutGroup.sizeDelta = newWidthHeight;

        // Creating new buttons out the dictionary and stuffing them in the vertical layout group
        for (int i = 0; i < acquireListCount; i++)
        {
            // Index 0 is special because it is the title for our list view
            if (i == 0)
            {
                ListViewButton newListViewSectionTitle = Instantiate(UIManager.s_instance.defaultListViewModuleTitle).GetComponent <ListViewButton>();
                newListViewSectionTitle.listIndex = 0;
                newListViewSectionTitle.transform.SetParent(listViewVerticalLayoutGroup, false);
                newListViewSectionTitle.childText.text = acquireStepList[0].uiText.listViewText;
                continue;
            }

            StepsListEntry temp = acquireStepList[i];

            if (temp.isSectionParent)
            {
                ListViewButton newListViewSectionTitle = Instantiate(defaultListViewSectionTitle).GetComponent <ListViewButton>();
                newListViewSectionTitle.listIndex = i;
                newListViewSectionTitle.transform.SetParent(listViewVerticalLayoutGroup, false);
                newListViewSectionTitle.childText.text = /*contextIndentation + contextIndentation +*/ temp.uiText.listViewText;
            }
            else
            {
                ListViewButton newListViewButton = Instantiate(UIManager.s_instance.defaultListViewButton).GetComponent <ListViewButton>();
                newListViewButton.listIndex = i;
                newListViewButton.transform.SetParent(listViewVerticalLayoutGroup, false);
                newListViewButton.childText.text  = temp.uiText.listViewText;
                newListViewButton.childText.color = Color.grey;
                newListViewButton.GetComponent <Button>().interactable = false;
            }
        }
    }