Esempio n. 1
0
    public void Select(int newSelection) // Select note of index "newSelection" from the dataList, assigning all visuals accordingly
    {
        if (newSelection == -1)
        {
            noteContent.text       = "";
            noteEditorTitle.text   = "";
            noteEditorContent.text = "";
            noteEditorColourIndex  = 0;
            noteEditorColourIndicator.GetComponent <Image>().color = colourOptions[0].color;

            if (0 < selection && selection < UIList.Count)
            {
                UIList[selection].GetComponent <Toggle>().onValueChanged.RemoveAllListeners();
            }                   // Remove the listeners from the button that will change
            titleToggleGroup.SetAllTogglesOff();
            audioSource.Play(); // Play the click that was removed with the other listeners
            UpdateList();       // Re-apply the listeners

            editNote.interactable   = false;
            deleteNote.interactable = false;
        }

        else
        {
            noteContent.text       = dataList[newSelection].content;
            noteEditorTitle.text   = dataList[newSelection].title;
            noteEditorContent.text = dataList[newSelection].content;
            noteEditorColourIndex  = dataList[newSelection].colour;
            noteEditorColourIndicator.GetComponent <Image>().color = colourOptions[dataList[newSelection].colour].color;

            UIList[newSelection].GetComponent <Toggle>().onValueChanged.RemoveAllListeners(); // Remove the listeners
            titleToggleGroup.SetAllTogglesOff();
            UIList[newSelection].GetComponent <Toggle>().isOn = true;
            audioSource.Play(); // Play the click that was removed with the other listeners
            UpdateList();       // Re-apply the listeners

            editNote.interactable   = true;
            deleteNote.interactable = true;
        }

        selection = newSelection;
        contentScrolling.UpdateLimits();
        contentScrolling.Reset();
    }
Esempio n. 2
0
    public void Select(int newSelection) // Select deck of index "newSelection" from the dataList, assigning all visuals accordingly
    {
        card_handler.DeleteCardUI();     // Clear Old Card UI First

        // Must have 3 states to allow for the reminder script to be called with the correct selection.
        int oldSelection = selection;

        selection = newSelection;

        if (newSelection == -1)
        {
            description.text       = "";
            editorTitle.text       = "";
            editorDescription.text = "";
            editorColourIndex      = 0;
            editorColourIndicator.GetComponent <Image>().color = colourOptions[0].color;
            reminderPeriod.text = "";

            if (0 < oldSelection && oldSelection < UIList.Count)
            {
                UIList[oldSelection].GetComponent <Toggle>().onValueChanged.RemoveAllListeners();
            }                   // Remove the listeners from the button that will change
            titleToggleGroup.SetAllTogglesOff();
            audioSource.Play(); // Play the click that was removed with the other listeners
            UpdateList();       // Re-apply the listeners

            practiceButton.interactable       = false;
            editButton.interactable           = false;
            deleteButton.interactable         = false;
            viewScoreButton.interactable      = false;
            multipleChoiceToggle.interactable = false;
            multipleChoiceToggle.isOn         = false;
            card_handler.dataList             = new List <Card_Handler.Card>();
        }
        else
        {
            description.text       = dataList[newSelection].description;
            editorTitle.text       = dataList[newSelection].title;
            editorDescription.text = dataList[newSelection].description;
            editorColourIndex      = dataList[newSelection].colour;
            editorColourIndicator.GetComponent <Image>().color = colourOptions[dataList[newSelection].colour].color;
            reminder_handler.ChangeReminder(0);

            UIList[newSelection].GetComponent <Toggle>().onValueChanged.RemoveAllListeners(); // Remove the listeners
            titleToggleGroup.SetAllTogglesOff();
            UIList[newSelection].GetComponent <Toggle>().isOn = true;
            audioSource.Play(); // Play the click that was removed with the other listeners
            UpdateList();       // Re-apply the listeners

            if (dataList[newSelection].content.Count > 0)
            {
                practiceButton.interactable = true;
            }
            else
            {
                practiceButton.interactable = false;
            }
            editButton.interactable   = true;
            deleteButton.interactable = true;
            if (dataList[newSelection].practiceSessions.Count > 0)
            {
                viewScoreButton.interactable = true;
            }
            else
            {
                viewScoreButton.interactable = false;
            }
            if (dataList[newSelection].practiceSessions.Count > 4)
            {
                multipleChoiceToggle.interactable = true;
            }
            else
            {
                multipleChoiceToggle.interactable = false;
                multipleChoiceToggle.isOn         = false;
            }
            card_handler.dataList = new List <Card_Handler.Card>(dataList[newSelection].content);
        }
        contentScrolling.UpdateLimits();
        contentScrolling.Reset();
        card_handler.Select(-1);
    }