Esempio n. 1
0
    public void TestToggleBoundingBox()
    {
        actions.EnableBoundingBox(false);
        Assert.IsFalse(coll.enabled);
        Assert.IsFalse(boundingBoxPiece.gameObject.activeSelf);

        actions.EnableBoundingBox(true);
        Assert.IsTrue(coll.enabled);
        Assert.IsTrue(boundingBoxPiece.gameObject.activeSelf);
    }
Esempio n. 2
0
    private void SelectQuiz()
    {
        if (quizButton.ButtonChecked)                                         // case: no quiz active => select a new quiz
        {
            if (InformationManager.Instance.playerType == PlayerType.STUDENT) // if student: prepare quiz mode and lock any editing
            {
                MenuEnabled = false;                                          // disable this menu; the user can only get back if the quiz-direction menu is closed
                QuizStyleMenu styleMenu = transform.Find("QuizStyle Menu").GetComponent <QuizStyleMenu>();
                // specify what should happen if the quiz direction menu is closed again => this depends on the reason for closing
                // if the menu was closed because a quiz was selected => go into quiz mode and lock editing
                // if the menu was closed without a quiz selection => restore normal annotation settings
                styleMenu.OnCloseAction = (selectionSuccessful) =>
                {
                    quizButton.ButtonChecked = selectionSuccessful; // display if a quiz is now active
                    if (selectionSuccessful)
                    {
                        // if a quiz is selected: disable the bounding box so that the user can immediately access the questions
                        // ... also display that the bounding box is now disabled
                        actions.EnableBoundingBox(false);
                        boundingBoxButton.ButtonChecked = false;

                        // disable the edit mode and display that it is off
                        actions.EnableEditMode(false);
                        editModeButton.ButtonChecked = false;
                    }
                    // lock the edit mode if a quiz was selected so that the user cannot turn it back on again
                    editModeButton.ButtonEnabled = !selectionSuccessful;
                };
                styleMenu.gameObject.SetActive(true); // "open" quiz direction menu
            }
            else // author mode: just change to the quiz questions and set everything to be editable and accessible
            {
                actions.EnableBoundingBox(false);
                boundingBoxButton.ButtonChecked = false;
                actions.EnableEditMode(true);
                editModeButton.ButtonChecked = true;

                actions.SelectQuiz();
            }
        }
        else
        {
            actions.AbortQuizSelection(); // in case it was still in quiz selection
            actions.LoadAnnotations();
            editModeButton.ButtonEnabled = true;
            editModeButton.ButtonChecked = true;
            actions.EnableEditMode(true);
        }
    }